import { nothing, PropertyValueMap, TemplateResult } from "lit"; import { SelectElement, SgdsOptionData } from "../../base/select-element"; import { SgdsBadge } from "../Badge/sgds-badge"; import SgdsIcon from "../Icon/sgds-icon"; import { SgdsComboBoxOption } from "./sgds-combo-box-option"; import SgdsSpinner from "../Spinner/sgds-spinner"; import { ISgdsComboBoxInputEventDetail } from "./types"; /** * Each item in the ComboBox has a label to display * and a value (the actual data / ID). */ type SgdsComboBoxOptionData = SgdsOptionData; export type { ISgdsComboBoxInputEventDetail }; /** * @summary ComboBox component is used for users to make one or more selections from a list through user input, keyboard or mouse actions * * @slot default - default slot to pass in sgds-combo-box-option * * @event sgds-select - Emitted when the combo box's selected value changes. * @event sgds-change - Emitted when the combo box's value changes. * @event sgds-input - Emitted when user input is received and its value changes. `event.detail = { displayValue }` * @eventDetail {ISgdsComboBoxInputEventDetail} sgds-input * @event sgds-focus - Emitted when user input is focused. * @event sgds-blur - Emitted when user input is blurred. * @event sgds-invalid - Emitted when the combo box's invalid state is set to true. * @event sgds-valid - Emitted when the combo box's invalid state is set to false. */ export declare class SgdsComboBox extends SelectElement { static styles: import("lit").CSSResult[]; static childName: string; /** @internal */ static dependencies: { [SgdsComboBox.childName]: typeof SgdsComboBoxOption; "sgds-icon": typeof SgdsIcon; "sgds-badge": typeof SgdsBadge; "sgds-spinner": typeof SgdsSpinner; }; /** If true, renders multiple checkbox selection items. If false, single-select. */ multiSelect: boolean; /** If true, renders badge that fills width of combobox */ badgeFullWidth: boolean; /** If true, a clear button will be enabled on focus */ clearable: boolean; /** Disables native and sgds validation for the combo box. */ noValidate: boolean; /** Enables the asynchronous behaviour of a combo box. When true, filterFunction is ignored and filtering is done remotely. */ async: boolean; /** When filtering remotely and there are no results, set this to true to enable no options feedback on the menu. Applicable for async combo box only. */ emptyMenuAsync: boolean; /** The function used to filter the menu list, given the user's input value. */ filterFunction: (inputValue: string, item: SgdsComboBoxOptionData) => boolean; private _multiSelectInput; protected options: SgdsComboBoxOption[]; private optionList; private emptyMenuAfterFiltering; protected isFocused: boolean; connectedCallback(): void; firstUpdated(changedProperties: PropertyValueMap): Promise; protected _handleDefaultSlotChange(e: Event): Promise; private _setupValidation; _handleValueChange(): Promise; _handleOptionListChange(): void; _handleMenuListChange(): void; private _updateValueAndDisplayValue; protected _handleInputChange(e: CustomEvent): Promise; /** * Called whenever an dispatches sgds-select" */ protected _handleItemSelected(e: Event): Promise; private _handleItemUnselect; private _handleBadgeDismissed; private _handleMultiSelectKeyDown; protected _handleFocus(): void; protected _handleInputBlur(e: Event): Promise; protected _handleClear(): Promise; /** For form reset */ protected _mixinResetFormControl(): Promise; /** Template for the suffix icon */ protected suffixIconTemplate: TemplateResult; protected prefixIconTemplate: TemplateResult; /** * Used `repeat` helper from Lit to render instead of .map: * The reassigning of value is affecting the truncation on badge as it is not triggering the slot change event. * * To compare this to lit-html's default handling for lists, consider reversing a large list of names: * For a list created using Array.map, lit-html maintains the DOM nodes for the list items, but reassigns the values * For a list created using repeat, the repeat directive reorders the existing DOM nodes, so the nodes representing the first list item move to the last position. */ protected _renderInput(showClearButton: boolean): TemplateResult; protected _renderFeedbackMenu(): TemplateResult<1> | typeof nothing; render(): TemplateResult<1>; } export default SgdsComboBox;