UNPKG

@kelvininc/ui-components

Version:
1,272 lines (1,271 loc) 52.4 kB
import { Host, h } from "@stencil/core"; import { MINIMUM_SEARCHABLE_OPTIONS } from "./multi-select-dropdown.config"; import { getBadgeLabelValue, getDropdownDisplayValue } from "./multi-select-dropdown.helper"; import { EComponentSize } from "../../types"; import { getCssStyle } from "../utils"; import { getClassMap } from "../../utils/css-class.helper"; import { DEFAULT_DROPDOWN_Z_INDEX } from "../../globals/config"; import { merge } from "lodash-es"; export class KvMultiSelectDropdown { constructor() { /** @inheritdoc */ this.loading = false; /** @inheritdoc */ this.searchable = true; /** @inheritdoc */ this.selectionClearable = true; /** @inheritdoc */ this.helpText = []; /** @inheritdoc */ this.options = {}; /** @inheritdoc */ this.selectedOptions = {}; /** @inheritdoc */ this.inputSize = EComponentSize.Large; /** @inheritdoc */ this.customClass = ''; /** @inheritdoc */ this.selectionAll = true; /** @inheritdoc */ this.counter = true; /** @inheritdoc */ this.minSearchOptions = MINIMUM_SEARCHABLE_OPTIONS; /** @inheritdoc */ this.shortcuts = false; /** @inheritdoc */ this.showShortcuts = false; /** @inheritdoc */ this.clickOutsideClose = true; /** @inheritdoc */ this.actionElement = null; /** @inheritdoc */ this.zIndex = DEFAULT_DROPDOWN_Z_INDEX; /** @inheritdoc */ this.autoFocus = true; // eslint-disable-line @stencil-community/reserved-member-names /** @inheritdoc */ this.hideBadge = false; this._badgeLabel = this.badge; this._isOpen = false; this.onOptionsSelected = ({ detail: newOptions }) => { this.optionsSelected.emit(newOptions); }; this.onSearchChange = ({ detail: searchValue }) => { this.setSearch(searchValue); }; this.onClearSelection = (event) => { event.stopPropagation(); this.clearSelection.emit(); this.calculateLabelValue(); }; this.onSelectAll = (event) => { event.stopPropagation(); this.selectAll.emit(); this.calculateLabelValue(); }; this.onDismiss = () => { this.setOpenState(false); this.dismiss.emit(); }; this.onOpenStateChange = ({ detail: state }) => { this.setOpenState(state); }; this.setOpenState = (state) => { if (state) { if (this.autoFocus) { this.focusSearchInput(); } } else { this.setSearch(''); } this.clearHighlightedOption(); this._isOpen = state; }; this.setSearch = (searchTerm) => { this._searchValue = searchTerm; this.searchChange.emit(searchTerm); }; this.clearHighlightedOption = () => { var _a; (_a = this.selectRef) === null || _a === void 0 ? void 0 : _a.clearHighlightedOption(); }; this.calculateLabelValue = () => { var _a; if ((_a = this.displayValue) === null || _a === void 0 ? void 0 : _a.length) { this._selectionDisplayValue = this.displayValue; } else { this._selectionDisplayValue = getDropdownDisplayValue(this.options, this.selectedOptions); } }; this.calculateBadgeValue = () => { var _a; if ((_a = this.badge) === null || _a === void 0 ? void 0 : _a.length) { this._badgeLabel = this.badge; } else { this._badgeLabel = getBadgeLabelValue(this.selectedOptions); } }; this.focusSearchInput = () => { setTimeout(() => { var _a; return (_a = this.selectRef) === null || _a === void 0 ? void 0 : _a.focusSearch(); }); }; } badgeChangeHandler() { this.calculateBadgeValue(); } labelValueHandler() { this.calculateLabelValue(); this.calculateBadgeValue(); } /** Focuses the search text field */ async focusSearch() { var _a; (_a = this.selectRef) === null || _a === void 0 ? void 0 : _a.focusSearch(); } componentWillLoad() { this.calculateLabelValue(); this.calculateBadgeValue(); } getMaxHeight() { var _a; const maxHeight = getCssStyle(this.el, '--dropdown-max-height'); return (_a = this.maxHeight) !== null && _a !== void 0 ? _a : maxHeight; } getMinHeight() { var _a; const minHeight = getCssStyle(this.el, '--dropdown-min-height'); return (_a = this.minHeight) !== null && _a !== void 0 ? _a : minHeight; } getMaxWidth() { var _a; const maxWidth = getCssStyle(this.el, '--dropdown-max-width'); return (_a = this.maxWidth) !== null && _a !== void 0 ? _a : maxWidth; } getMinWidth() { var _a; const minWidth = getCssStyle(this.el, '--dropdown-min-width'); return (_a = this.minWidth) !== null && _a !== void 0 ? _a : minWidth; } getInputConfig() { return merge({}, this.inputConfig, { label: this.label, value: this._selectionDisplayValue, valuePrefix: this.displayPrefix, loading: this.loading, icon: this.icon, inputDisabled: this.disabled, inputRequired: this.required, placeholder: this.placeholder, state: this.errorState, helpText: this.helpText, size: this.inputSize, badge: this._badgeLabel, hideBadge: this.hideBadge }); } connectedCallback() { if (this.autoFocus) { this.focusSearchInput(); } } render() { return (h(Host, { key: '635437fbd5b3d05180802259bec9f21acf43baa7' }, h("kv-dropdown", { key: '038128f47273668a5eed7bf065bbe43fd9c0d7c2', inputConfig: this.getInputConfig(), isOpen: this._isOpen, onOpenStateChange: this.onOpenStateChange, disabled: this.disabled, options: this.dropdownOptions, clickOutsideClose: this.clickOutsideClose, actionElement: this.actionElement, zIndex: this.zIndex }, h("slot", { key: 'df7cd0ed16946f0afd1f0b8ac8b307f1e2d99573', name: "dropdown-action", slot: "dropdown-action" }), h("div", { key: '5e7b7026e86157714bef7bf6a23ed6c9b9c3342c', class: getClassMap(this.customClass) }, h("kv-select-multi-options", { key: 'd5a54b9c37e501dceb6583c57af16e55ef3cb0cb', ref: element => (this.selectRef = element), options: this.options, filteredOptions: this.filteredOptions, selectedOptions: this.selectedOptions, noDataAvailableConfig: this.noDataAvailableConfig, noResultsFoundConfig: this.noResultsFoundConfig, searchable: this.searchable, minSearchOptions: this.minSearchOptions, searchValue: this._searchValue, selectionClearable: this.selectionClearable, clearSelectionLabel: this.clearSelectionLabel, selectionAll: this.selectionAll, selectAllLabel: this.selectAllLabel, searchPlaceholder: this.searchPlaceholder, maxHeight: this.getMaxHeight(), minHeight: this.getMinHeight(), maxWidth: this.getMaxWidth(), minWidth: this.getMinWidth(), counter: this.counter, shortcuts: this._isOpen && this.shortcuts, showShortcuts: this.showShortcuts, maxSelectable: this.maxSelectable, onSearchChange: this.onSearchChange, onClearSelection: this.onClearSelection, onOptionsSelected: this.onOptionsSelected, onSelectAll: this.onSelectAll, onDismiss: this.onDismiss, exportparts: "select" }, h("slot", { key: '7c5b61e9bcb287981b8c55bb3a8a5ba8fcfacc25', name: "select-header-actions", slot: "select-header-actions" }), h("slot", { key: '5d963c20803edf6a0fa679d6110fd76f02cca4e0', name: "select-header-label", slot: "select-header-label" }), h("slot", { key: '96ff302ecab3e6eff537dbe5b06405b868c00c7e', name: "no-data-available", slot: "no-data-available" }), h("slot", { key: '5b62441d40392e8f444f213cdcc36de8435c2330', name: "no-results-found", slot: "no-results-found" }), h("slot", { key: '771dd2cfb0ed95f77f96530ef221f4d86db0cb8f', name: "select-footer", slot: "select-footer" })))))); } static get is() { return "kv-multi-select-dropdown"; } static get originalStyleUrls() { return { "$": ["multi-select-dropdown.scss"] }; } static get styleUrls() { return { "$": ["multi-select-dropdown.css"] }; } static get properties() { return { "placeholder": { "type": "string", "attribute": "placeholder", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(required) The text to display as the dropdown placeholder" }, "getter": false, "setter": false, "reflect": true }, "loading": { "type": "boolean", "attribute": "loading", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `true` the dropdown is loading" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "false" }, "icon": { "type": "string", "attribute": "icon", "mutable": false, "complexType": { "original": "EIconName", "resolved": "EIconName", "references": { "EIconName": { "location": "import", "path": "../icon/icon.types", "id": "src/components/icon/icon.types.ts::EIconName" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The icon to display on the dropdown" }, "getter": false, "setter": false, "reflect": true }, "searchable": { "type": "boolean", "attribute": "searchable", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `false` the dropdown is not searchable. Default `true`" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "true" }, "searchPlaceholder": { "type": "string", "attribute": "search-placeholder", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The list search text field placeholder" }, "getter": false, "setter": false, "reflect": true }, "selectionClearable": { "type": "boolean", "attribute": "selection-clearable", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `true` dropdown items can be cleared" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "true" }, "clearSelectionLabel": { "type": "string", "attribute": "clear-selection-label", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The clear selection action text" }, "getter": false, "setter": false, "reflect": true }, "required": { "type": "boolean", "attribute": "required", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `true` dropdown requires a value to be selected" }, "getter": false, "setter": false, "reflect": true }, "label": { "type": "string", "attribute": "label", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The text to display on the dropdown label" }, "getter": false, "setter": false, "reflect": true }, "displayValue": { "type": "string", "attribute": "display-value", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The text to display on the dropdown" }, "getter": false, "setter": false, "reflect": true }, "displayPrefix": { "type": "string", "attribute": "display-prefix", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The text to display as a prefix to `displayValue`" }, "getter": false, "setter": false, "reflect": true }, "badge": { "type": "string", "attribute": "badge", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) Text to display inside a badge on the right side of the displayed value" }, "getter": false, "setter": false, "reflect": true }, "errorState": { "type": "string", "attribute": "error-state", "mutable": false, "complexType": { "original": "EValidationState", "resolved": "EValidationState.Invalid | EValidationState.None | EValidationState.Valid", "references": { "EValidationState": { "location": "import", "path": "../text-field/text-field.types", "id": "src/components/text-field/text-field.types.ts::EValidationState" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(required) The error state for the dropdown" }, "getter": false, "setter": false, "reflect": true }, "helpText": { "type": "string", "attribute": "help-text", "mutable": false, "complexType": { "original": "string | string[]", "resolved": "string | string[]", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The text to display as help text" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "[]" }, "disabled": { "type": "boolean", "attribute": "disabled", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `true` the dropdown is disabled" }, "getter": false, "setter": false, "reflect": true }, "noDataAvailableConfig": { "type": "unknown", "attribute": "no-data-available-config", "mutable": false, "complexType": { "original": "IIllustrationMessage", "resolved": "IIllustrationMessage", "references": { "IIllustrationMessage": { "location": "import", "path": "../../types", "id": "src/types.ts::IIllustrationMessage" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The configuration for the \"no data available\" empty state illustration" }, "getter": false, "setter": false }, "noResultsFoundConfig": { "type": "unknown", "attribute": "no-results-found-config", "mutable": false, "complexType": { "original": "IIllustrationMessage", "resolved": "IIllustrationMessage", "references": { "IIllustrationMessage": { "location": "import", "path": "../../types", "id": "src/types.ts::IIllustrationMessage" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The configuration for the \"no results found\" empty state illustration" }, "getter": false, "setter": false }, "options": { "type": "unknown", "attribute": "options", "mutable": false, "complexType": { "original": "ISelectMultiOptions", "resolved": "{ [x: string]: ISelectMultiOption; }", "references": { "ISelectMultiOptions": { "location": "import", "path": "../select-multi-options/select-multi-options.types", "id": "src/components/select-multi-options/select-multi-options.types.ts::ISelectMultiOptions" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The object with the dropdown options" }, "getter": false, "setter": false, "defaultValue": "{}" }, "selectedOptions": { "type": "unknown", "attribute": "selected-options", "mutable": false, "complexType": { "original": "Record<string, boolean>", "resolved": "{ [x: string]: boolean; }", "references": { "Record": { "location": "global", "id": "global::Record" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The object with indexed by the dropdown labels and its selected value" }, "getter": false, "setter": false, "defaultValue": "{}" }, "filteredOptions": { "type": "unknown", "attribute": "filtered-options", "mutable": false, "complexType": { "original": "ISelectMultiOptions", "resolved": "{ [x: string]: ISelectMultiOption; }", "references": { "ISelectMultiOptions": { "location": "import", "path": "../select-multi-options/select-multi-options.types", "id": "src/components/select-multi-options/select-multi-options.types.ts::ISelectMultiOptions" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The object with the dropdown options filtered" }, "getter": false, "setter": false }, "minHeight": { "type": "string", "attribute": "min-height", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The dropdown's min-height" }, "getter": false, "setter": false, "reflect": true }, "maxHeight": { "type": "string", "attribute": "max-height", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The dropdown's max-height" }, "getter": false, "setter": false, "reflect": true }, "minWidth": { "type": "string", "attribute": "min-width", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The dropdown's min-width" }, "getter": false, "setter": false, "reflect": true }, "maxWidth": { "type": "string", "attribute": "max-width", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The dropdown's max-width" }, "getter": false, "setter": false, "reflect": true }, "inputSize": { "type": "string", "attribute": "input-size", "mutable": false, "complexType": { "original": "EComponentSize", "resolved": "EComponentSize.Large | EComponentSize.Small", "references": { "EComponentSize": { "location": "import", "path": "../../types", "id": "src/types.ts::EComponentSize" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The size of the input" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "EComponentSize.Large" }, "customClass": { "type": "string", "attribute": "custom-class", "mutable": false, "complexType": { "original": "CustomCssClass", "resolved": "CssClassMap | string | string[]", "references": { "CustomCssClass": { "location": "import", "path": "../../types", "id": "src/types.ts::CustomCssClass" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) Additional classes to apply for custom CSS. If multiple classes are\nprovided they should be separated by spaces. It is also valid to provide\nCssClassMap with boolean logic." }, "getter": false, "setter": false, "reflect": true, "defaultValue": "''" }, "dropdownOptions": { "type": "unknown", "attribute": "dropdown-options", "mutable": false, "complexType": { "original": "Partial<ComputePositionConfig>", "resolved": "{ strategy?: Strategy; placement?: Placement; middleware?: (false | { name: string; options?: any; fn: (state: { x: number; y: number; initialPlacement: Placement; strategy: Strategy; platform: Platform; placement: Placement; middlewareData: MiddlewareData; rects: ElementRects; elements: Elements; }) => Promisable<MiddlewareReturn>; })[]; platform?: Platform; }", "references": { "Partial": { "location": "global", "id": "global::Partial" }, "ComputePositionConfig": { "location": "import", "path": "@floating-ui/dom", "id": "../../node_modules/.pnpm/@floating-ui+dom@1.6.11/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.ts::ComputePositionConfig" } } }, "required": false, "optional": false, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The dropdown position config options" }, "getter": false, "setter": false }, "selectionAll": { "type": "boolean", "attribute": "selection-all", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `true` the list has an action to select all items" }, "getter": false, "setter": false, "reflect": false, "defaultValue": "true" }, "selectAllLabel": { "type": "string", "attribute": "select-all-label", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The selection all action text" }, "getter": false, "setter": false, "reflect": false }, "counter": { "type": "boolean", "attribute": "counter", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": false, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `true` a selection counter is displayed" }, "getter": false, "setter": false, "reflect": false, "defaultValue": "true" }, "minSearchOptions": { "type": "number", "attribute": "min-search-options", "mutable": false, "complexType": { "original": "number", "resolved": "number", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The minimum amount of options required to display the search. Defaults to `15`." }, "getter": false, "setter": false, "reflect": true, "defaultValue": "MINIMUM_SEARCHABLE_OPTIONS" }, "shortcuts": { "type": "boolean", "attribute": "shortcuts", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `true` the keyboard shortcuts can be used to navigate between the dropdown results. Default `false`" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "false" }, "showShortcuts": { "type": "boolean", "attribute": "show-shortcuts", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "false" }, "clickOutsideClose": { "type": "boolean", "attribute": "click-outside-close", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `false` clicking outside the dropdown will not trigger state change. Default: true" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "true" }, "actionElement": { "type": "unknown", "attribute": "action-element", "mutable": false, "complexType": { "original": "HTMLElement | null", "resolved": "HTMLElement", "references": { "HTMLElement": { "location": "global", "id": "global::HTMLElement" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) A reference to the dropdown action element" }, "getter": false, "setter": false, "defaultValue": "null" }, "zIndex": { "type": "number", "attribute": "z-index", "mutable": false, "complexType": { "original": "number", "resolved": "number", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) the dropdown list z-index (default: 9004)" }, "getter": false, "setter": false, "reflect": false, "defaultValue": "DEFAULT_DROPDOWN_Z_INDEX" }, "inputConfig": { "type": "unknown", "attribute": "input-config", "mutable": false, "complexType": { "original": "Partial<ITextField>", "resolved": "{ type?: EInputFieldType; label?: string; icon?: EIconName; actionIcon?: EIconName; inputName?: string; examples?: string[]; placeholder?: string; maxLength?: number; minLength?: number; max?: string | number; min?: string | number; step?: string | number; size?: EComponentSize; inputDisabled?: boolean; inputRequired?: boolean; loading?: boolean; state?: EValidationState; helpText?: string | string[]; value?: string | number; valuePrefix?: string; badge?: string; inputReadonly?: boolean; forcedFocus?: boolean; tooltipConfig?: Partial<ITooltip>; useInputMask?: boolean; inputMaskRegex?: string; fitContent?: boolean; customStyle?: { [key: string]: string; }; isDirty?: boolean; hideBadge?: boolean; }", "references": { "Partial": { "location": "global", "id": "global::Partial" }, "ITextField": { "location": "import", "path": "../text-field/text-field.types", "id": "src/components/text-field/text-field.types.ts::ITextField" } } }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) The text field options" }, "getter": false, "setter": false }, "autoFocus": { "type": "boolean", "attribute": "auto-focus", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `false` the search text field is not auto-focused. Default `true`." }, "getter": false, "setter": false, "reflect": true, "defaultValue": "true" }, "hideBadge": { "type": "boolean", "attribute": "hide-badge", "mutable": false, "complexType": { "original": "boolean", "resolved": "boolean", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) If `true` the badge is not displayed" }, "getter": false, "setter": false, "reflect": true, "defaultValue": "false" }, "maxSelectable": { "type": "number", "attribute": "max-selectable", "mutable": false, "complexType": { "original": "number", "resolved": "number", "references": {} }, "required": false, "optional": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "(optional) Maximum number of items that can be selected" }, "getter": false, "setter": false, "reflect": true } }; } static get states() { return { "_selectionDisplayValue": {}, "_searchValue": {}, "_badgeLabel": {}, "_isOpen": {} }; } static get events() { return [{ "method": "optionsSelected", "name": "optionsSelected", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "Emitted when the selected options change" }, "complexType": { "original": "Record<string, boolean>", "resolved": "{ [x: string]: boolean; }", "references": { "Record": { "location": "global", "id": "global::Record" } } } }, { "method": "searchChange", "name": "searchChange", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "Emitted when the user interacts with the search text field" }, "complexType": { "original": "string", "resolved": "string", "references": {} } }, { "method": "clearSelection", "name": "clearSelection", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "Emitted when the user clears the selected items" }, "complexType": { "original": "void", "resolved": "void", "references": {} } }, { "method": "selectAll", "name": "selectAll", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "Emitted when the user clicks on the all items" }, "complexType": { "original": "void", "resolved": "void", "references": {} } }, { "method": "dismiss", "name": "dismiss", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined }], "text": "Emitted when the 'esc' key is pressed" }, "complexType": { "original": "void", "resolved": "void", "references": {} } }, { "method": "clickOutside", "name": "clickOutside", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [{ "name": "inheritdoc", "text": undefined