import type { ChangeEventHandler } from 'react'; import { ChevronDownIcon } from '@heroicons/react/24/solid'; import type { ComponentSize } from './types'; type DropdownLayout = 'stacked' | 'inline'; type DropdownChoice = { label: string; id: string; }; type DropdownProps = { label?: string; value: string; choices: DropdownChoice[]; size?: ComponentSize; layout?: DropdownLayout; disabled?: boolean; required?: boolean; onChange?: (value: string) => void; error?: string; className?: string; selectClassName?: string; }; export function Dropdown({ label, value, choices, size = 'md', layout = 'stacked', disabled = false, required = false, onChange, error, className = '', selectClassName = '', }: Readonly) { const containerSizeClass = { sm: 'max-w-xs', md: 'max-w-sm', lg: 'max-w-md', full: 'max-w-none', }[size]; const selectSizeClass = { sm: 'h-8 !text-xs', md: 'h-10 text-sm', lg: 'h-12 text-sm', full: 'h-10 text-sm', }[size]; const handleChange: ChangeEventHandler = (event) => { onChange?.(event.target.value); }; const wrapperClass = layout === 'inline' ? 'inline-flex w-auto items-center gap-2' : 'block w-full gap-1'; const selectWrapperClass = layout === 'inline' ? 'relative' : 'relative mt-1'; const labelClass = layout === 'inline' ? 'text-xs ui-body-secondary' : ''; return ( ); }