import { PropertyValueMap } from 'lit'; import { PopupPlacement } from '../../common/types'; import { GenericFormElement } from '../../internal/mixin/genericFormElement'; import { DapDSOptionData, DapDSOptionRenderer } from '../option-list/option-data'; import { default as DapDSOptionList } from '../option-list/option-list.component'; export default class ComboboxBaseElement extends GenericFormElement { readonly triggerInput: HTMLInputElement; readonly optionList: DapDSOptionList; placement: PopupPlacement; opened: boolean; searchMode: 'none' | 'typehead' | 'autocomplete' | 'manual'; search: boolean; clearButton?: string; placeholder: string | null; sync?: boolean; allowManualInput?: boolean; searchForText?: boolean; searchOnValueSet?: string | undefined; loading?: boolean; selectable?: string; noAnimation?: boolean; textComplete?: boolean; openOnEmpty?: boolean; disableViewportAutoClose: boolean; /** * Shows the whole selected value, wrapped over several lines, while the field * is not focused, and grows the field to fit it. While focused the field keeps * that height and the input shows the text on one line. Multiselect ignores it. */ wrapValue: boolean; searchButtonAriaLabel?: string; /** * The accessible name of the clear button. Defaults to "Clear selection" * with the field's label, so each field's clear button is told apart. */ clearButtonAriaLabel?: string; subtle: boolean; multiselect: boolean; maxSelections?: number; /** The options as data instead of `dap-ds-option-item` children; also accepted as a JSON attribute. */ get items(): DapDSOptionData[] | undefined; set items(value: DapDSOptionData[] | string | undefined); private _items?; /** Renders the content of each option given in `items`; defaults to the label. */ renderOption?: DapDSOptionRenderer; /** `data-testid` for the clear button. */ clearButtonTestId: string; /** `data-testid` for the search button. */ searchButtonTestId: string; /** * When enabled, the search button (the trailing icon button in search mode) is * automatically disabled while the input is empty and re-enabled as soon as the * user types. Opt-in; does not affect the input itself, which stays editable. */ disableSearchWhenEmpty: boolean; /** True when the search input currently holds non-whitespace text. */ private get hasSearchText(); selectedItem: any; /** * Display text of the selected item. `selectedItem` is either an option element * (has `optionText`) when set from `value`, or an option event detail (has `text`) * when picked by the user; reading `.text` alone yields "undefined" for the former. */ private get selectedItemText(); selectedItems: any[]; currentItem: any; selectedText: string; /** * Whether the input text filters the list. Typing turns it on; opening turns * it off when the input just shows the selection, so reopening lists every * option instead of only those matching the selected text. */ private filtering; /** * The filter text the option list has applied, as of its last * dds-list-changed. While it trails the input, the list (and so the * highlighted option) still shows the previous results. */ private listFilterText; private optionListObserver; private isUserInteraction; private pendingInitialValues; static readonly styles: import('lit').CSSResult; protected firstUpdated(_changedProperties: PropertyValueMap | Map): Promise; protected updated(_changedProperties: PropertyValueMap | Map): void; private get isFreeTextSearch(); /** * Handles value changes from outside the component * This ensures the selection state is updated when the value is set programmatically */ private handleValueChange; private setupOptionListObserver; private updateComboboxState; /** * Updates the selection state based on the current value * This is useful when options are loaded asynchronously */ private updateSelectionFromValue; private cleanupOptionListObserver; disconnectedCallback(): void; attributeChangedCallback(name: string, _old: string | null, value: string | null): void; get isAutoComplete(): boolean; /** * The option a value refers to. With `searchForText` a pick stores the * option's text as the value, so fall back to matching the text; otherwise * the pick is treated as an unknown value and the input gets cleared. */ private findOptionForValue; /** The option value the list should mark as selected. */ private get listValue(); /** * Get all option items directly from the combobox element * This is more reliable for dynamic updates than the option list component */ private getComboboxOptions; get isOpenOnEmpty(): boolean; get isOpenOnAutocomplete(): boolean; get shouldHideClearIcon(): boolean; handleClick: () => void; private handleEnterKey; private handleCurrentItemEnter; private handleSearchEnter; private handleDefaultEnter; private handleSelectedItemChange; private handleTextSearch; private handleArrowKeys; handleKeyDown: (event: KeyboardEvent) => Promise; handleInput: (event: InputEvent) => Promise; clearSelection(): Promise; /** * Multiselect helper methods */ private getSelectedValues; private isMaxSelectionsReached; private addSelectedItem; private removeSelectedItem; private clearAllSelections; private updateMultipleSelectionsFromValues; /** * Override value getter/setter to handle multiselect mode */ get value(): string | undefined; set value(val: string | undefined); handleListKeyDown: (event: CustomEvent) => void; handleDocumentMouseDown: (event: MouseEvent) => void; private readonly handlePopupAutoClose; handleFocus: () => void; handleBlur: () => void; showDropDown(): Promise; hideDropDown(options?: { skipFocus?: boolean; }): Promise; get focusElement(): HTMLInputElement; handleSelectedChange: (event: CustomEvent) => Promise; handleOptionDeselect: (event: CustomEvent) => void; handleCurrentOptionChange: (event: CustomEvent) => void; /** The filter text passed to the option list. */ private get listFilter(); handleListChanged: (event: CustomEvent) => void; handleClearClick: () => void; handleSearchClick: (event: MouseEvent) => void; private setSelectionRange; private clearSelectionRange; getValidity(): boolean; formResetCallback(): void; private getMultiSelectValidity; private getAutoCompleteValidity; private getManualInputValidity; private getSearchTextValidity; private getSelectedItemValidity; private getBasicValidity; get validity(): ValidityState; get validationMessage(): string; checkValidity(): boolean; reportValidity(): boolean; setValidity(): void; handleInvalid(event: Event): void; /** * Screen-reader status for the highlighted option while focus stays in the input. * aria-activedescendant cannot reach options inside option-list's shadow root, so * the highlight (e.g. the first match after typing) is announced through a polite * live region instead. Once focus moves onto an option it is announced natively, * so the status is cleared to avoid a double announcement. */ get activeOptionStatus(): string; getActiveDescendant(): HTMLInputElement | import('../option-item/option-item.component').default | null | undefined; getSearchIconSize(size: string): "sm" | "md" | "lg"; getInnerIconSize(size: string): 16 | 10; private handleChipRemove; private renderChip; private renderChips; private renderInput; private get hasWrappedValue(); private get clearButtonName(); private renderClearButton; private renderIndicatorIcon; private renderSelectActions; private renderOptionList; renderCombobox(): import('lit-html').TemplateResult; }