Line data Source code
1 16 : <script setup lang="ts">
2 : import type { SelectItemProps } from 'reka-ui'
3 : import { SelectItem, SelectItemIndicator, SelectItemText } from 'reka-ui'
4 : import type { HTMLAttributes } from 'vue'
5 :
6 : import { cn } from '@comfyorg/tailwind-utils'
7 :
8 2355 : const {
9 : class: className,
10 : textClass,
11 : reserveIndicator = false,
12 : ...restProps
13 : } = defineProps<
14 612 : SelectItemProps & {
15 : class?: HTMLAttributes['class']
16 : /** Classes for the item's text, which holds the slot. */
17 : textClass?: HTMLAttributes['class']
18 : /** Keeps the check's column on unchecked items too, so text that ends at the right lines up. */
19 : reserveIndicator?: boolean
20 : }
21 : >()
22 : </script>
23 :
24 : <template>
25 885 : <SelectItem
26 : v-bind="restProps"
27 : :class="
28 : cn(
29 : 'relative flex w-full cursor-pointer items-center justify-between select-none',
30 : 'gap-3 rounded-sm px-2 py-3 text-sm outline-none',
31 : 'hover:bg-accent',
32 : 'focus:bg-accent',
33 : 'data-[state=checked]:bg-muted',
34 : 'data-[state=checked]:hover:bg-muted',
35 : 'data-disabled:pointer-events-none data-disabled:opacity-50',
36 : className
37 : )
38 : "
39 : >
40 : <SelectItemText :class="cn('truncate', textClass)">
41 : <slot />
42 : </SelectItemText>
43 :
44 : <span
45 : :class="
46 : cn(
47 : 'flex shrink-0 items-center justify-center',
48 : reserveIndicator ? 'w-4' : 'empty:hidden'
49 : )
50 : "
51 : >
52 : <SelectItemIndicator class="flex items-center justify-center">
53 : <i class="icon-[lucide--check] text-foreground" aria-hidden="true" />
54 : </SelectItemIndicator>
55 : </span>
56 : </SelectItem>
57 : </template>
|