import * as React from 'react'; import { Check, ChevronDown } from 'lucide-react'; import { cn } from '../lib/utils'; import { Button } from './button'; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem } from './command'; import { Popover, PopoverContent, PopoverTrigger } from './popover'; type ComboboxProps = { className?: string; options: string[]; value: string | null; onChange: (_value: string | null) => void; placeholder?: string; disabled?: boolean; }; const Combobox = ({ className, options, value, onChange, disabled = false, placeholder, }: ComboboxProps) => { const [open, setOpen] = React.useState(false); const onOptionSelected = (newValue: string) => { onChange(newValue === value ? null : newValue); setOpen(false); }; const placeholderValue = placeholder ?? 'Select an option'; return ( No value found. {options.map((option, index) => ( onOptionSelected(option)}> {option} ))} ); }; export { Combobox };