import type { LucideIcon } from "lucide-react"; import { ChevronDown } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger, } from "@/components/DropdownMenu"; import { useFocusVisible } from "@/hooks/useFocusVisible"; import { cn } from "@/lib/cn"; export type SelectOption = { value: T; label: string; icon?: LucideIcon; }; type SelectProps = { value: T; options: SelectOption[]; onChange: (value: T) => void; ariaLabel: string; disabled?: boolean; className?: string; }; export function Select({ value, options, onChange, ariaLabel, disabled, className, }: SelectProps) { const isFocusVisible = useFocusVisible(); const current = options.find((o) => o.value === value) ?? options[0]; const CurrentIcon = current?.icon; return ( onChange(v as T)}> {options.map(({ value: optionValue, label, icon: Icon }) => ( {Icon && ( )} {label} ))} ); }