import { noop } from 'lodash-es' import { Check, ChevronsUpDown } from 'lucide-react' import { useState } from 'react' import { Button_Shadcn_ as Button, cn, Command_Shadcn_ as Command, CommandEmpty_Shadcn_ as CommandEmpty, CommandGroup_Shadcn_ as CommandGroup, CommandInput_Shadcn_ as CommandInput, CommandItem_Shadcn_ as CommandItem, CommandList_Shadcn_ as CommandList, Popover_Shadcn_ as Popover, PopoverContent_Shadcn_ as PopoverContent, PopoverTrigger_Shadcn_ as PopoverTrigger, ScrollArea, } from 'ui' export interface ComboBoxOption { id: string value: string displayName: string } export function ComboBox({ isLoading, disabled, name, options, selectedOption, onSelectOption = noop, className, }: { isLoading: boolean disabled?: boolean name: string options: Opt[] selectedOption?: string onSelectOption?: (newValue: string) => void className?: string }) { const [open, setOpen] = useState(false) const selectedOptionDisplayName = options.find( (option) => option.value === selectedOption )?.displayName return ( No {name} found. 10 ? 'h-[280px]' : ''}> {options.map((option) => ( { setOpen(false) onSelectOption(selectedValue) }} className="cursor-pointer" > {option.displayName} ))} ) }