export default ComboboxField; /** @implements {ExposedInternals} @implements {FieldPropertiesAndMethods} */ declare class ComboboxField extends HTMLElement implements ExposedInternals, FieldPropertiesAndMethods { /** @returns {true} */ static get formAssociated(): true; static get observedAttributes(): readonly ["id", "required", "filter", "valueis", "nomatchesmessage", "valuemissingerror"]; /** Internally used to indicate when the `combobox` is actively transitioning out of {@link filter} mode. */ static #filterDisabedKey: symbol; /** * Handles the searching logic for `combobox`es without a {@link filter} * @param {KeyboardEvent} event * @returns {void} */ static #handleTypeahead(event: KeyboardEvent): void; /** * Handles the searching logic for `combobox`es with a {@link filter} * @param {InputEvent} event * @returns {void} */ static #handleSearch(event: InputEvent): void; static defaultNoMatchesMessage: string; /** * @param {MouseEvent} event * @returns {void} */ static #handleClick(event: MouseEvent): void; /** * Used to determine if a {@link filter filterable} `combobox` was `:focus`ed by a `click` event. * @param {MouseEvent} event * @returns {void} */ static #handleMousedown(event: MouseEvent): void; /** * (For {@link filter filtered} `combobox`es only) * @param {FocusEvent} event * @returns {void} */ static #handleFocus(event: FocusEvent): void; /** * @param {FocusEvent} event * @returns {void} */ static #handleBlur(event: FocusEvent): void; /** * @param {KeyboardEvent} event * @returns {void} */ static #handleKeydown(event: KeyboardEvent): void; /** * Collapses the `combobox` when the user leaves the component from the `listbox`. * @param {FocusEvent} event * @returns {void} */ static #handleListboxBlur(event: FocusEvent): void; /** * @param {MouseEvent} event * @returns {void} */ static #handleDelegatedOptionHover(event: MouseEvent): void; /** * @param {MouseEvent} event * @returns {void} */ static #handleDelegatedOptionClick(event: MouseEvent): void; /** * @param {MouseEvent} event * @returns {void} */ static #handleDelegatedMousedown(event: MouseEvent): void; /** * @param {MutationRecord[]} mutations * @returns {void} */ static #preserveTextNode(mutations: MutationRecord[]): void; /** * @param {MutationRecord[]} mutations * @returns {void} */ static #watchExpansion(mutations: MutationRecord[]): void; /** * @param {MutationRecord[]} mutations * @returns {void} */ static #watchActiveDescendant(mutations: MutationRecord[]): void; /** * @param {MutationRecord[]} mutations * @returns {void} */ static #watchOptionNodes(mutations: MutationRecord[]): void; /** * @param {typeof ComboboxField.observedAttributes[number]} name * @param {string | null} oldValue * @param {string | null} newValue * @returns {void} */ attributeChangedCallback(name: (typeof ComboboxField.observedAttributes)[number], oldValue: string | null, newValue: string | null): void; /** @param {string} V */ set value(V: string); /** Sets or retrieves the `value` of the `combobox` @returns {string | null} */ get value(): string | null; /** "On Mount" for Custom Elements @returns {void} */ connectedCallback(): void; set noMatchesMessage(value: string); /** * The message displayed to users when none of the `combobox`'s `option`s match their filter. * @returns {string} */ get noMatchesMessage(): string; /** "On Unmount" for Custom Elements @returns {void} */ disconnectedCallback(): void; /** * Updates the {@link ComboboxOption.filteredOut `filteredOut`} property for all of the `option`s, * then returns the `option`s that match the user's current filter. * * @returns {GetFilteredOptionsReturnType} */ getFilteredOptions(): { /** * The `option`s which match the user's current filter */ matchingOptions: ComboboxOption[]; /** * (Optional): The `option` which is a candidate for * automatic selection. See: {@link ComboboxField.autoselectableOption}. */ autoselectableOption?: ComboboxOption | undefined; }; /** * @typedef GetFilteredOptionsReturnType * @property {ComboboxOption[]} matchingOptions The `option`s which match the user's current filter * @property {ComboboxOption} [autoselectableOption] (Optional): The `option` which is a candidate for * automatic selection. See: {@link ComboboxField.autoselectableOption}. */ /** * The logic used by {@link filter filterable} `combobox`es to determine if an `option` matches the user's filter. * * **Note**: If {@link getFilteredOptions} is overridden, this method will do nothing unless it is * used directly within the new implementation. * * @param {ComboboxOption} option * @returns {boolean} */ optionMatchesFilter(option: ComboboxOption): boolean; /** * Coerces the value and filter of the `combobox` to an empty string, and deselects the currently-selected `option` * if one exists (including any `option` whose value is an empty string). * * @returns {void} * @throws {TypeError} if the `combobox` is not {@link filter filterable}, or if its value * {@link valueIs cannot be cleared}. */ forceEmptyValue(): void; /** * Retrieves the `option` with the provided `value` (if it exists) * @param {string} value * @returns {ComboboxOption | null} */ getOptionByValue(value: string): ComboboxOption | null; set name(value: HTMLInputElement["name"]); /** @returns {HTMLInputElement["name"]} */ get name(): HTMLInputElement["name"]; set disabled(value: HTMLInputElement["disabled"]); /** @returns {HTMLInputElement["disabled"]} */ get disabled(): HTMLInputElement["disabled"]; set required(value: HTMLInputElement["required"]); /** @returns {HTMLInputElement["required"]} */ get required(): HTMLInputElement["required"]; /** * The `listbox` that this `combobox` controls. * @returns {ListboxWithChildren} */ get listbox(): ListboxWithChildren; /** * The _singular_ {@link Text} Node associated with the `combobox`. * * To alter the `combobox`'s text content, update this node **_instead of_** using {@link textContent}. * @returns {Text} */ get text(): Text; set filter(value: boolean); /** Activates a textbox that can be used to filter the list of `combobox` `option`s. @returns {boolean} */ get filter(): boolean; set filterMethod(value: Extract); /** * Determines the method used to filter the `option`s as the user types. * - `startsWith`: {@link String.startsWith} will be used to filter the `option`s. * - `includes`: {@link String.includes} will be used to filter the `option`s. * * **Note**: This property does nothing if {@link optionMatchesFilter} or {@link getFilteredOptions} is overridden. * * @returns {Extract} */ get filterMethod(): Extract; set valueIs(value: "unclearable" | "clearable" | "anyvalue"); /** * Indicates how a `combobox`'s value will behave. * - `unclearable`: The field's {@link value `value`} must be a string matching one of the `option`s, * and it cannot be cleared. (Default when {@link filter `filter`} mode is off.) * - `clearable`: The field's `value` must be a string matching one of the `option`s, * but it can be cleared. (Default in `filter` mode. Requires enabling `filter` mode.) * - `anyvalue`: The field's `value` can be any string, and it will automatically be set to * whatever value the user types. (Requires enabling `filter` mode.) * * [API Reference](https://github.com/ITenthusiasm/custom-elements/blob/main/src/Combobox/docs/combobox-field.md#attributes-valueis) * * @returns {"unclearable" | "clearable" | "anyvalue"} */ get valueIs(): "unclearable" | "clearable" | "anyvalue"; /** * @param {string} value * @returns {boolean} `true` if the `combobox` will accept the provided `value` when no corresponding `option` exists. * Otherwise, returns `false`. */ acceptsValue(value: string): boolean; /** * Returns the `option` whose `label` matches the user's most recent filter input (if one exists). * * Value will be `null` if: * - The user's filter didn't match any (enabled) `option`s * - The `combobox`'s text content was altered by a `value` change * - The `combobox` was just recently expanded * @returns {ComboboxOption | null} */ get autoselectableOption(): ComboboxOption | null; set valueMissingError(value: string); /** The error message displayed to users when the `combobox`'s `required` constraint is broken. @returns {string} */ get valueMissingError(): string; /** @returns {ElementInternals["labels"]} */ get labels(): ElementInternals["labels"]; /** @returns {ElementInternals["form"]} */ get form(): ElementInternals["form"]; /** @returns {ElementInternals["validity"]} */ get validity(): ElementInternals["validity"]; /** @returns {ElementInternals["validationMessage"]} */ get validationMessage(): ElementInternals["validationMessage"]; /** @returns {ElementInternals["willValidate"]} */ get willValidate(): ElementInternals["willValidate"]; checkValidity(): boolean; reportValidity(): boolean; setCustomValidity(error: string): void; /** @returns {void} */ formResetCallback(): void; /** * @param {string} state * @param {"restore" | "autocomplete"} _mode * @returns {void} */ formStateRestoreCallback(state: string, _mode: "restore" | "autocomplete"): void; /** * @param {boolean} disabled * @returns {void} */ formDisabledCallback(disabled: boolean): void; #private; } import type { ExposedInternals } from "../types/helpers.js"; import type { FieldPropertiesAndMethods } from "../types/helpers.js"; import ComboboxOption from "./ComboboxOption.js"; import type { ListboxWithChildren } from "./types/helpers.js"; //# sourceMappingURL=ComboboxField.d.ts.map