import React from "react"; import { XmAutocomplete as XmAutocompleteElement, CustomEvent, } from "../lit/components/autocomplete/index.js"; /** * A generic type for strongly typing custom events with their targets * @template T - The type of the event target (extends EventTarget) * @template D - The type of the detail payload for the custom event */ type TypedEvent = E & { target: T; }; /** `XmAutocomplete` component event */ export type XmAutocompleteElementEvent = TypedEvent< XmAutocompleteElement, E >; export type { XmAutocompleteElement, CustomEvent }; export interface XmAutocompleteProps extends Pick< React.AllHTMLAttributes, | "children" | "dir" | "hidden" | "id" | "lang" | "slot" | "style" | "title" | "translate" | "onClick" | "onFocus" | "onBlur" > { /** undefined */ required?: boolean; /** undefined */ disabled?: boolean; /** undefined */ readOnly?: boolean; /** undefined */ loading?: boolean; /** INITIAL checked for toggle subclasses; mapped from attribute `checked`. */ initialChecked?: boolean; /** Native placeholder shown when the query is empty. */ placeholder?: XmAutocompleteElement["placeholder"]; /** undefined */ label?: XmAutocompleteElement["label"]; /** undefined */ helper?: XmAutocompleteElement["helper"]; /** Severity copy. Non-empty ⇒ the field is in error (icon + copy, never color). */ error?: XmAutocompleteElement["error"]; /** undefined */ size?: XmAutocompleteElement["size"]; /** Form-control name — mirrors native . */ name?: XmAutocompleteElement["name"]; /** INITIAL value (uncontrolled-first, AD-6): the `value` attribute seeds the live state once, then never overrides user input. Mapped from attribute `value` so authors write ``. */ initialValue?: XmAutocompleteElement["initialValue"]; /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */ className?: string; /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */ exportparts?: string; /** Used for labels to link them with their inputs (using input id). */ htmlFor?: string; /** Used to help React identify which items have changed, are added, or are removed within a list. */ key?: number | string; /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */ part?: string; /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */ ref?: React.Ref; /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */ tabIndex?: number; /** Shared option model — `{ label, value, disabled? }` (AD-8a). */ options?: XmAutocompleteElement["options"]; /** Typed primitive read for consumers; the inherited string `value` stays in sync for xm-form / ElementInternals. */ selectedValue?: XmAutocompleteElement["selectedValue"]; /** Fired on commit with the new value in `detail`. */ onChange?: (event: XmAutocompleteElementEvent) => void; /** Fired on each edit with the current value in `detail`. */ onInput?: (event: XmAutocompleteElementEvent) => void; } /** * * * ## Attributes & Properties * * Component attributes and properties that can be applied to the element or by using JavaScript. * * - `placeholder`: Native placeholder shown when the query is empty. * - `label`: undefined * - `helper`: undefined * - `error`: Severity copy. Non-empty ⇒ the field is in error (icon + copy, never color). * - `size`: undefined * - `required`: undefined * - `disabled`: undefined * - `readonly`/`readOnly`: undefined * - `loading`: undefined * - `name`: Form-control name — mirrors native . * - `value`/`initialValue`: INITIAL value (uncontrolled-first, AD-6): the `value` attribute seeds the * live state once, then never overrides user input. Mapped from attribute * `value` so authors write ``. * - `checked`/`initialChecked`: INITIAL checked for toggle subclasses; mapped from attribute `checked`. * - `options`: Shared option model — `{ label, value, disabled? }` (AD-8a). (property only) * - `selectedValue`: Typed primitive read for consumers; the inherited string `value` stays in * sync for xm-form / ElementInternals. (property only) (readonly) * - `readonly`: undefined (property only) * - `value`: Programmatic reset support — setting `value` after first paint updates live state. (property only) * - `checked`: Public read contract for toggle subclasses (AD-6a). (property only) * * ## Events * * Events that will be emitted by the component. * * - `change`: Fired on commit with the new value in `detail`. * - `input`: Fired on each edit with the current value in `detail`. * * ## Methods * * Methods that can be called to access component functionality. * * - `setFormDisabled(disabled: boolean) => void`: Down-propagation hook: xm-form (Story 2.10) sets this; it OR's with the * field's own disabled and can never re-enable a self-disabled field. */ export const XmAutocomplete: React.ForwardRefExoticComponent;