import * as React from "react" import { CheckIcon, ChevronsUpDownIcon } from "lucide-react" import { cn } from "~/lib/utils" import { Button } from "~/components/ui/button" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "~/components/ui/command" import { Popover, PopoverContent, PopoverTrigger, } from "~/components/ui/popover" export function Combobox({ values = [], defaultText = "Select value...", placeholderText = "Search...", emptyText = "No value found.", current, setValue, disabled = false, }: { values?: { value: string; label: string }[] emptyText?: string placeholderText?: string defaultText?: string current?: string setValue: (value: string) => void disabled?: boolean }) { const [open, setOpen] = React.useState(false) return ( {emptyText} {values.map(({ value, label }) => ( { setValue(currentValue === current ? "" : currentValue) setOpen(false) }} > {label} ))} ) }