import * as React from "react"; import { Check, ChevronsUpDown } from "lucide-react"; import { cn } from "../../lib/utils"; import { Button } from "./button"; import { Popover, PopoverContent, PopoverTrigger, } from "./popover"; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "./command"; export interface ComboboxOption { value: string; label: string; } export interface ComboboxProps { options: ComboboxOption[]; value?: string; onValueChange?: (value: string) => void; placeholder?: string; searchPlaceholder?: string; emptyText?: string; className?: string; disabled?: boolean; } const Combobox = React.forwardRef( ( { options, value, onValueChange, placeholder = "Selecione uma opção...", searchPlaceholder = "Pesquisar...", emptyText = "Nenhum resultado encontrado.", className, disabled, }, ref ) => { const [open, setOpen] = React.useState(false); const selectedOption = options.find((option) => option.value === value); return ( {emptyText} {options.map((option) => ( { onValueChange?.(option.value); setOpen(false); }} > {option.label} ))} ); } ); Combobox.displayName = "Combobox"; export { Combobox };