import { AutocompleteItemProps, AutocompleteProps } from '@heroui/react'; import { ReactNode } from 'react'; import { Control, FieldValues, Path, RegisterOptions } from 'react-hook-form'; export type CreatableOption = { value: string | number; label: string; props?: AutocompleteItemProps; }; /** Payload stored by the RHF adapter (Option A): `id` is `null` for a newly-created entry. */ export type CreatableValue = { id: string | null; label: string; }; interface Props extends Omit, "children" | "items" | "defaultItems" | "selectedKey" | "defaultSelectedKey" | "onSelectionChange" | "allowsCustomValue"> { options: CreatableOption[]; /** Fired when an existing option is chosen. */ onSelectItem?(item: CreatableOption): void; /** Fired when the "create" action is chosen with the typed text. */ onCreateOption?(label: string): void; /** Renders the create action label. Default: `Use "…"`. */ createOptionLabel?(input: string): ReactNode; } declare function InputCreatableAutocomplete(props: Props): import("react").JSX.Element; declare namespace InputCreatableAutocomplete { var displayName: string; var WithRHFControl: typeof WithControl; } /** * How the create action + form value behave: * - `"string"` (default) — the field stores the raw label string (existing pick stores its label). * - `"object"` — the field stores `{ id, label }`; create stores `{ id: null, label }` (Option A). * - `"action"` — the field stores the label string on an existing pick; the create action fires * `onCreateAction` (e.g. open a modal) and does NOT change the field. */ export type CreatableMode = "string" | "object" | "action"; type WithControlProps = Props & { control: Control; name: Path; rules?: RegisterOptions>; mode?: CreatableMode; /** Only used in `mode="action"`: called with the typed text instead of committing a value. */ onCreateAction?(input: string): void; }; declare function WithControl(props: WithControlProps): import("react").JSX.Element; export default InputCreatableAutocomplete;