import { useState } from 'react'; import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'; import { cn } from '@/utils'; import { Button } from '../ui/button'; import { Command, CommandInput, CommandEmpty, CommandGroup, CommandItem } from '../ui/command'; import { CaretSortIcon, CheckIcon } from '@radix-ui/react-icons'; import { ScrollArea } from '../ui/scroll-area'; import React from 'react'; import { IDropdownSelectProps } from '.'; function Combobox({ options = [], selectedKey: value, onSelect, className, popClassName, placeholder = 'Select A Value', }: IDropdownSelectProps & { popClassName?: string }) { const [open, setOpen] = useState(false); const selectedKey = value || '_none'; return ( No options found. {options.map((opt) => ( { if (opt.value === '_none') { onSelect?.(''); } else { onSelect?.(opt.value === selectedKey ? '' : opt.value); } setOpen(false); }} > {opt.label} ))} ); } export default Combobox;