import { ListBoxItemProps } from "../ListBox/ListBoxItem.mjs"; import { SectionProps } from "../ListBox/ListBoxSection.mjs"; import { FieldBaseProps } from "../FieldBase/FieldBase.mjs"; import { ListBoxProps } from "../ListBox/ListBox.mjs"; import { WidthProp } from "@marigold/system"; import { ReactNode, Ref } from "react"; import { Key as Key$1 } from "react-aria-components/ComboBox"; import RAC from "react-aria-components"; type RemovedProps = 'className' | 'style' | 'children' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'inputValue' | 'onInputChange' | 'defaultValue' | 'validate' | 'validationState' | 'slot'; export interface AutocompleteProps extends Omit, RemovedProps>, Pick, 'label' | 'addon' | 'description' | 'errorMessage'> { /** * ReactNode or function to render the list of items. */ children?: ReactNode | ((item: T) => ReactNode); /** * The value of the input (uncontrolled). */ defaultValue?: RAC.ComboBoxProps['defaultInputValue']; /** * Sets the width of the field. You can see allowed tokens here: https://tailwindcss.com/docs/width * Note: `"fit"` is not supported because the virtualizer controls item sizing. * * Numeric/scale values are spacing-scale tokens, not pixels: `width={64}` * resolves to `calc(var(--spacing) * 64)` ~= 16rem (256px), not 64px. * @default 'full' */ width?: Exclude; /** * The value of the input (controlled). */ value?: RAC.ComboBoxProps['inputValue']; /** * Values that invalidate the cached items, like a hook's dependency array. * Only needed for `items` plus a render function: rendered items are cached * per item object, so anything the function reads from outside the item — * state, a lookup, a prop — has to be listed here or it renders stale. */ dependencies?: ListBoxProps['dependencies']; /** * Called when the input value changes. */ onChange?: RAC.ComboBoxProps['onInputChange']; /** * Called when the clear button is pressed. */ onClear?: () => void; /** * If `true`, the input is disabled. * * @default false */ disabled?: RAC.ComboBoxProps['isDisabled']; /** * If `true`, the input is required. * * @default false */ required?: RAC.ComboBoxProps['isRequired']; /** * If `true`, the field is considered invalid and if set the `errorMessage` is shown instead of the `description`. * * @default false */ error?: RAC.ComboBoxProps['isInvalid']; /** * If `true`, the input is readOnly. * * @default false */ readOnly?: RAC.ComboBoxProps['isReadOnly']; /** * Provides content to display when there are no items in the list. */ emptyState?: ReactNode; /** * If `true`, a loading spinner will show up. * @default false */ loading?: boolean; /** * Visual variant of the component. Which values exist is defined by the theme * and listed in the "Appearance" section of the component's documentation. */ variant?: string; /** * Size of the component. Which values exist is defined by the theme and listed * in the "Appearance" section of the component's documentation. */ size?: string; /** * Placeholder text shown while the input is empty. It is a hint and does not * replace the `label`. */ placeholder?: string; /** * Handler that is called when the SearchAutocomplete is submitted. * * A `key` will be passed if the submission is a selected item (e.g. a user * clicks or presses enter on an option). If the input is a custom `value`, `key` will be `null`. * * A `value` will be passed if the submission is a custom value (e.g. a user * types then presses enter). If the input is a selected item, `value` will be `null`. */ onSubmit?: (key: Key$1 | null, value: string | number | null) => void; } declare function AutocompleteBase({ children, dependencies, defaultValue, value, disabled, error, readOnly, required, emptyState, loading, onChange, onClear, onSubmit, ref, ...rest }: AutocompleteProps & { ref?: Ref; }): import("react").JSX.Element; export declare const Autocomplete: typeof AutocompleteBase & { Option: (props: ListBoxItemProps) => import("react").JSX.Element; Section: ({ header, children, ...props }: SectionProps) => import("react").JSX.Element; }; export {};