* chore: add storybook * chore: unify FE codeabse * chore: update eslint rules * chore: harmonize the use of "subtle" color * chore: remove an extra sidebar rail * refactor: make panel items more consistent * chore: cleanups after merging new code from base * refactor: refine composables * fix: add lost import * chore: make icon style consistent * fix: don't show empty "supported" methods * refactor: solidify select items
62 lines
1.5 KiB
Vue
62 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
/**
|
|
* @component AppSelectItem
|
|
* @description An individual selectable item within a select menu.
|
|
*/
|
|
import { cn } from '@/utils/ui';
|
|
import { reactiveOmit } from '@vueuse/core';
|
|
import { Check } from 'lucide-vue-next';
|
|
import {
|
|
SelectItem,
|
|
SelectItemIndicator,
|
|
type SelectItemProps,
|
|
SelectItemText,
|
|
useForwardProps,
|
|
} from 'reka-ui';
|
|
import { type HTMLAttributes } from 'vue';
|
|
|
|
/*
|
|
* Types & Interfaces.
|
|
*/
|
|
|
|
export interface AppSelectItemProps extends SelectItemProps {
|
|
class?: HTMLAttributes['class'];
|
|
}
|
|
|
|
/*
|
|
* Component Setup.
|
|
*/
|
|
|
|
const props = defineProps<AppSelectItemProps>();
|
|
|
|
/*
|
|
* Computed & Methods.
|
|
*/
|
|
|
|
const delegatedProps = reactiveOmit(props, 'class');
|
|
|
|
const forwardedProps = useForwardProps(delegatedProps);
|
|
</script>
|
|
|
|
<template>
|
|
<SelectItem
|
|
v-bind="forwardedProps"
|
|
:class="
|
|
cn(
|
|
'relative flex w-full cursor-pointer items-center rounded-sm py-1 pr-8 pl-1 text-sm outline-none select-none focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-zinc-800 dark:focus:text-zinc-50',
|
|
props.class,
|
|
)
|
|
"
|
|
>
|
|
<span class="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
<SelectItemIndicator>
|
|
<Check class="h-4 w-4" />
|
|
</SelectItemIndicator>
|
|
</span>
|
|
|
|
<SelectItemText>
|
|
<slot />
|
|
</SelectItemText>
|
|
</SelectItem>
|
|
</template>
|