import { ChevronDown } from 'lucide-react'; import type { ReactNode } from 'react'; import { Select as AriaSelect, type SelectProps as AriaSelectProps, Button, ListBox, type ListBoxItemProps, SelectValue, type ValidationResult, } from 'react-aria-components/Select'; import { tv } from 'tailwind-variants'; import { Description, FieldError, Label } from './Field'; import { DropdownItem, DropdownSection, type DropdownSectionProps, } from './ListBox'; import { Popover } from './Popover'; import { composeTailwindRenderProps, focusRing } from './utils'; const styles = tv({ extend: focusRing, base: 'relative flex w-full cursor-default items-center gap-4 rounded-md border border-transparent bg-white py-1.5 pr-2 pl-3 text-start text-zinc-800 shadow ring-1 ring-zinc-900/5 transition dark:border-zinc-200/40 dark:bg-zinc-900 dark:text-zinc-200', variants: { isDisabled: { false: 'group-invalid:border-warning-600 pressed:bg-gray-200 dark:pressed:bg-zinc-500 text-gray-800 hover:bg-gray-100 dark:text-zinc-300 dark:hover:bg-zinc-600 forced-colors:group-invalid:border-[Mark]', true: 'border-gray-200 text-gray-200 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-600', }, }, }); export interface SelectProps extends Omit< AriaSelectProps, 'children' > { label?: string; description?: string; errorMessage?: string | ((validation: ValidationResult) => string); items?: Iterable; children: ReactNode | ((item: T) => ReactNode); } export function Select({ label, description, errorMessage, children, items, ...props }: SelectProps) { return ( {label && } {description && {description}} {errorMessage} {children} ); } export function SelectItem(props: ListBoxItemProps) { return ; } export function SelectSection( props: DropdownSectionProps, ) { return ; }