import * as React from 'react' import { Combobox as ComboboxPrimitive } from '@base-ui/react' import { ArrowDown01Icon, Cancel01Icon, Tick02Icon, } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' import { cn } from '@/lib/utils' import { Button } from '@/components/ui/button' import { ComboboxInput as LegacyComboboxInput, type ComboboxInputOption, } from '@/components/ui/combobox-input' import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from '@/components/ui/input-group' type LegacyComboboxProps = { options: ComboboxInputOption[] value?: string onValueChange?: (value: string | null) => void placeholder?: string searchPlaceholder?: string emptyText?: string allowCustomValue?: boolean className?: string id?: string } function Combobox(props: LegacyComboboxProps): React.ReactElement function Combobox( props: ComboboxPrimitive.Root.Props ): React.ReactElement function Combobox( props: | ComboboxPrimitive.Root.Props | LegacyComboboxProps ) { if ('options' in props) { return ( props.onValueChange?.(value)} placeholder={props.searchPlaceholder ?? props.placeholder} emptyText={props.emptyText} className={props.className} /> ) } return } function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) { return } function ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props) { return ( {children} ) } function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) { return ( } className={cn(className)} {...props} > ) } function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }: ComboboxPrimitive.Input.Props & { showTrigger?: boolean showClear?: boolean }) { return ( } {...props} /> {showTrigger && ( } data-slot='input-group-button' className='group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent' disabled={disabled} /> )} {showClear && } {children} ) } function ComboboxContent({ className, side = 'bottom', sideOffset = 6, align = 'start', alignOffset = 0, anchor, ...props }: ComboboxPrimitive.Popup.Props & Pick< ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor' >) { return ( ) } function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) { return ( ) } function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props) { return ( {children} } > ) } function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) { return ( ) } function ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props) { return ( ) } function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) { return ( ) } function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) { return (