// @subframe/sync-disable // @ts-nocheck "use client"; /* * Documentation: * Combobox — https://app.subframe.com/f023064a5ca0/library?component=Combobox_8a1be2ee-c1b7-4407-9c21-6448306d2700 * Loader — https://app.subframe.com/f023064a5ca0/library?component=Loader_f2e570c8-e463-45c2-aae9-a960146bc5d5 */ import React from "react"; import { FeatherCheck } from "@subframe/core"; import { FeatherChevronDown } from "@subframe/core"; import { FeatherLoader } from "@subframe/core"; import { FeatherPlus } from "@subframe/core"; import { FeatherSearch } from "@subframe/core"; import { FeatherSearchX } from "@subframe/core"; import { FeatherX } from "@subframe/core"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; import { Loader } from "../Loader"; export interface ChipProps extends React.HTMLAttributes { children?: React.ReactNode; className?: string; } const Chip = React.forwardRef(function Chip( { children, className, ...otherProps }: ChipProps, ref ) { return (
{children ? ( {children} ) : null}
); }); export interface ItemProps extends React.HTMLAttributes { children?: React.ReactNode; selected?: boolean; showCheckbox?: boolean; className?: string; } const Item = React.forwardRef(function Item( { children, selected = false, showCheckbox = false, className, ...otherProps }: ItemProps, ref ) { return (
{children ? ( {children} ) : null}
); }); export interface AddItemProps extends React.HTMLAttributes { children?: React.ReactNode; className?: string; } const AddItem = React.forwardRef(function AddItem( { children, className, ...otherProps }: AddItemProps, ref ) { return (
{children ? ( {children} ) : null}
); }); export interface ComboboxRootProps extends Omit, "placeholder"> { disabled?: boolean; error?: boolean; state?: "default" | "typing" | "no-results" | "loading" | "create-new"; hasValue?: boolean; open?: boolean; showLabel?: boolean; label?: React.ReactNode; helpText?: React.ReactNode; searchValue?: React.ReactNode; placeholder?: React.ReactNode; createLabel?: React.ReactNode; emptyText?: React.ReactNode; loadingText?: React.ReactNode; message?: React.ReactNode; icon?: React.ReactNode; chipChildren?: React.ReactNode; children?: React.ReactNode; size?: "small" | "medium" | "large"; className?: string; } const ComboboxRoot = React.forwardRef( function ComboboxRoot( { disabled = false, error = false, state = "default", hasValue = false, open = false, showLabel = false, label, helpText, searchValue, placeholder, createLabel, emptyText, loadingText, message, icon = , chipChildren, children, size = "medium", className, ...otherProps }: ComboboxRootProps, ref ) { return (
{label ? ( {label} ) : null} {helpText ? ( {helpText} ) : null}
{icon ? ( {icon} ) : null} {chipChildren ? (
{chipChildren}
) : null}
{message ? ( {message} ) : null}
{children ? (
{children}
) : null}
{emptyText ? ( {emptyText} ) : null}
{loadingText ? ( {loadingText} ) : null}
{createLabel ? ( {createLabel} ) : null}
); } ); export const Combobox = Object.assign(ComboboxRoot, { Chip, Item, AddItem, });