"use client" import * as React from "react" import { cn } from "cn" import { Button as ButtonPrimitive, Collection, ComboBox as ComboBoxPrimitive, ComboBoxStateContext, ComboBoxValue as ComboBoxValuePrimitive, composeRenderProps, Group, Header as HeaderPrimitive, Input as InputPrimitive, ListBoxItem as ListBoxItemPrimitive, ListBox as ListBoxPrimitive, ListBoxSection as ListBoxSectionPrimitive, Popover as PopoverPrimitive, Separator as SeparatorPrimitive, TagGroup as TagGroupPrimitive, TagList as TagListPrimitive, Tag as TagPrimitive, type ButtonProps, type ComboBoxValueProps, type GroupProps, type HeaderProps, type InputProps, type ListBoxItemProps, type ListBoxProps, type ListBoxSectionProps, type SeparatorProps, type TagListProps, type TagProps, } from "react-aria-components" import { Button } from "@/registry/bases/aria/ui/button" import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from "@/registry/bases/aria/ui/input-group" import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder" function ComboboxValue({ ...props }: ComboBoxValueProps) { return } function ComboboxTrigger({ className, children, ...props }: Omit & { children?: React.ReactNode }) { return ( {children} ) } function ComboboxClear({ className, ...props }: React.ComponentProps) { const state = React.useContext(ComboBoxStateContext) if (state?.inputValue === "") { return null } return ( { state?.setValue(null) }} slot={null} {...props} > ) } function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }: React.ComponentProps<"input"> & { showTrigger?: boolean showClear?: boolean }) { return ( {showTrigger && ( )} {showClear && } {children} ) } function ComboboxContent({ className, placement = "bottom", offset = 6, crossOffset = 0, anchor, ...props }: Omit< React.ComponentProps, "className" | "children" > & { className?: string children?: React.ReactNode anchor?: React.RefObject }) { return ( ) } function ComboboxList({ className, ...props }: ListBoxProps) { return ( ) } function ComboboxItem({ className, children, ...props }: ListBoxItemProps) { return ( {composeRenderProps(children, (children, { isSelected }) => ( <> {children} {isSelected ? ( ) : null} ))} ) } function ComboboxGroup({ className, ...props }: ListBoxSectionProps) { return ( ) } function ComboboxLabel({ className, ...props }: HeaderProps) { return ( ) } function ComboboxEmpty({ className, ...props }: React.ComponentProps<"div">) { return (
) } function ComboboxSeparator({ className, ...props }: SeparatorProps) { return ( ) } function ComboboxChips({ children, className, ...props }: GroupProps) { return ( {children} ) } function ComboboxChipList({ className, ...props }: Omit, "className" | "items"> & { className?: string }) { return ( className="contents"> {({ selectedItems, state }) => ( { if (Array.isArray(state.value)) { state.setValue(state.value.filter((k) => !keys.has(k))) } }} > item != null)} {...props} /> )} ) } function ComboboxChip({ className, children, showRemove = true, ...props }: Omit & { showRemove?: boolean children?: React.ReactNode }) { return ( {children} {showRemove && ( )} ) } function ComboboxChipsInput({ className, ...props }: InputProps) { const state = React.useContext(ComboBoxStateContext) return ( { if ( e.key === "Backspace" && e.currentTarget.value === "" && Array.isArray(state?.value) && state.value.length > 0 ) { e.preventDefault() state.setValue(state.value.slice(0, -1)) } }} {...props} /> ) } function useComboboxAnchor() { return React.useRef(null) } export { ComboBoxPrimitive as Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, Collection as ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipList, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, useComboboxAnchor, }