({
label,
description,
errorMessage,
children,
items,
...props
}: SelectProps<T, M>)
| 40 | } |
| 41 | |
| 42 | export function Select<T, M extends 'single' | 'multiple' = 'single'>({ |
| 43 | label, |
| 44 | description, |
| 45 | errorMessage, |
| 46 | children, |
| 47 | items, |
| 48 | ...props |
| 49 | }: SelectProps<T, M>) { |
| 50 | return ( |
| 51 | <AriaSelect |
| 52 | {...props} |
| 53 | className={composeTailwindRenderProps( |
| 54 | props.className, |
| 55 | 'group flex flex-col gap-1 relative font-sans' |
| 56 | )}> |
| 57 | {label && <Label>{label}</Label>} |
| 58 | <Button className={styles}> |
| 59 | <SelectValue className="flex-1 text-sm"> |
| 60 | {({selectedText, defaultChildren}) => selectedText || defaultChildren} |
| 61 | </SelectValue> |
| 62 | <ChevronDown |
| 63 | aria-hidden |
| 64 | className="w-4 h-4 text-neutral-600 dark:text-neutral-400 forced-colors:text-[ButtonText] group-disabled:text-neutral-200 dark:group-disabled:text-neutral-600 forced-colors:group-disabled:text-[GrayText]" |
| 65 | /> |
| 66 | </Button> |
| 67 | {description && <Description>{description}</Description>} |
| 68 | <FieldError>{errorMessage}</FieldError> |
| 69 | <Popover className="min-w-(--trigger-width)"> |
| 70 | <ListBox |
| 71 | items={items} |
| 72 | className="outline-hidden box-border p-1 max-h-[inherit] overflow-auto [clip-path:inset(0_0_0_0_round_.75rem)]"> |
| 73 | {children} |
| 74 | </ListBox> |
| 75 | </Popover> |
| 76 | </AriaSelect> |
| 77 | ); |
| 78 | } |
| 79 | |
| 80 | export function SelectItem(props: ListBoxItemProps) { |
| 81 | return <DropdownItem {...props} />; |
nothing calls this directly
no test coverage detected