'use client'
import { Combobox as ComboboxPrimitive } from '@base-ui/react'
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput,
} from '@/components/ui/input-group'
import { cn } from '@/lib/utils'
import { CheckIcon, ChevronDownIcon, XIcon } from 'lucide-react'
const Combobox = ComboboxPrimitive.Root
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 && (
)}
{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 ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
return (
)
}
export { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList }