@cas-smartdesign/combo-box 7.5.1 → 7.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ const n = (o = class extends _ {
35
35
  return !!(typeof e.caption == "string" && e.caption.toLowerCase().includes(i) || typeof e.description == "string" && e.description.toLowerCase().includes(i));
36
36
  }, this.minimumOverlayWidth = 250, this._itemGenerator = w, this._itemCache = [], this.debouncedFilterItemsInMemory = f(this.filterItemsInMemory.bind(this), 200), this.handleSelection = (t) => {
37
37
  const e = this._dataProvider.items[t.detail.index];
38
- t.detail.selected || (this._list.selectedIndices = [t.detail.index]), this.comboBoxValue = { index: this._itemCache.indexOf(e), item: e }, this.dispatchSelectionChangeEvent(), this.opened = !1;
38
+ t.detail.selected || (this._list.selectedIndices = [t.detail.index]), this.comboBoxValue = { index: this._itemCache.indexOf(e), item: e }, this.dispatchSelectionChangeEvent(), this.focus(), this.opened = !1;
39
39
  }, this.handleWindowPointerDown = (t) => {
40
40
  !(t.target instanceof Node && this.contains(t.target)) && this.opened && t.composedPath().indexOf(this._list) === -1 && (this.triggerOnly && (this.value = null), this.opened = !1);
41
41
  }, this.handleKeyDown = (t) => {
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.mjs","sources":["../toggle.svg?raw","../clear.svg?raw","../combo-box.ts"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"toggle-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M13 4v2l-5 5-5-5v-2l5 5z\\\"/>\\r\\n</svg>\\r\\n\"","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"clear-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M12.96 4.46l-1.42-1.42-3.54 3.55-3.54-3.55-1.42 1.42 3.55 3.54-3.55 3.54 1.42 1.42 3.54-3.55 3.54 3.55 1.42-1.42-3.55-3.54 3.55-3.54z\\\"/>\\r\\n</svg>\\r\\n\"","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { unsafeCSS, PropertyValues, css, TemplateResult, html } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { createPopper, Instance as Popper } from \"@popperjs/core\";\nimport SDInput, { CustomEventMap as InputCustomEventMap } from \"@cas-smartdesign/lit-input\";\nimport VirtualList, { SelectionType, ItemGenerator, ListDataProvider } from \"@cas-smartdesign/virtual-list\";\nimport { ItemData, generator } from \"@cas-smartdesign/list-item\";\n\nconst TAG_NAME = \"sd-combo-box\";\n\nfunction debounce<T>(func: (...args: T[]) => unknown, delay: number): typeof func {\n let timeout: number;\n return function (...args: T[]) {\n if (timeout != null) {\n clearTimeout(timeout);\n }\n timeout = window.setTimeout(() => func(...args), delay);\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [TAG_NAME]: ComboBox;\n }\n}\n\nimport style from \"./style.scss?inline\";\nimport toggleSvg from \"./toggle.svg?raw\";\nimport clearSvg from \"./clear.svg?raw\";\nimport ImageTools from \"@cas-smartdesign/image-tools\";\n\nexport type ComboBoxValue = {\n index: number;\n item: ItemData | any;\n};\nexport type InMemoryFilter = (filterText: string, item: any) => boolean;\nexport type DataResponse = {\n items: any[];\n finalSizeIsKnown: boolean;\n};\n\nlet idCounter = 0;\n\nexport interface ISelectionEvent {\n selection: ComboBoxValue | string;\n isCustomValue: boolean;\n}\nexport interface IFilterChangeEvent {\n value: string;\n}\n\nexport interface CustomEventMap extends InputCustomEventMap {\n \"selection-change\": CustomEvent<ISelectionEvent>;\n \"filter-change\": CustomEvent<IFilterChangeEvent>;\n}\n\nexport default interface ComboBox {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport default class ComboBox extends SDInput {\n public static readonly ID: string = TAG_NAME;\n public static ensureDefined = (): void => {\n VirtualList.ensureDefined();\n if (!customElements.get(ComboBox.ID)) {\n customElements.define(ComboBox.ID, ComboBox);\n }\n };\n static formAssociated = true;\n\n private static readonly DATA_REQUEST_CANCELLED: string = \"cancel_data_request\";\n\n @property({ type: Boolean, reflect: true })\n public opened = false;\n @property({ type: Number, attribute: \"item-height\" })\n public itemHeight = 50;\n @property({ type: Boolean, attribute: \"allow-custom-value\", reflect: true })\n public allowCustomValue: boolean;\n @property({ type: Boolean, attribute: \"trigger-only\", reflect: true })\n public triggerOnly: boolean;\n @property({ type: Boolean, attribute: \"null-setting-disallowed\", reflect: true })\n public nullSettingDisallowed: boolean;\n @property({ type: Boolean, attribute: \"show-icon\", reflect: true })\n public showIcon: boolean;\n @property({ type: String, attribute: \"display-value-path\", noAccessor: true })\n public displayValuePath = \"caption\";\n @property({ type: String, attribute: \"filter-property\", noAccessor: true })\n public filterProperty: string;\n @property({ type: String, attribute: true, reflect: true })\n public id: string = ComboBox.ID + \"_\" + idCounter++;\n\n public inMemoryFilter: InMemoryFilter = (filterText, item) => {\n if (!filterText) {\n return true;\n }\n const lowerCaseFilter = filterText.toLowerCase();\n if (typeof item.caption == \"string\" && item.caption.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n if (typeof item.description == \"string\" && item.description.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n return false;\n };\n\n public filterText: string;\n public minimumOverlayWidth = 250;\n\n private _comboBoxValue: ComboBoxValue | string;\n private _clearButton: SVGElement;\n private _toggleButton: SVGElement;\n private _popper: Popper;\n private _list: VirtualList;\n private _dataProvider: ListDataProvider;\n private _itemGenerator: ItemGenerator = generator;\n private _itemCache: any[] = [];\n private _declarativeItems: HTMLElement[];\n private _onDataRequest: (filterText: string, page: number) => Promise<DataResponse>;\n private _pendingDataRequest: { cancel: (reason?: any) => void };\n private _openedByFilterTextChange: boolean;\n private _lastRequestedPage: number;\n private _lastRequestedFilterText: string;\n private _icon: HTMLElement;\n\n constructor() {\n super();\n this._dataProvider = new ListDataProvider();\n this._dataProvider.finalSizeIsKnown = true;\n }\n\n public get clearFilterOnLazyLoadedSelection(): boolean {\n return this.triggerOnly;\n }\n\n /**\n * @deprecated The method should not be used.\n * Use {@link ComboBox#triggerOnly} instead.\n * @param {boolean} value\n */\n public set clearFilterOnLazyLoadedSelection(value: boolean) {\n console.warn(\n \"Using clearFilterOnLazyLoadedSelection setting on a combo-box is deprecated. Use triggerOnly instead.\",\n );\n this.triggerOnly = value;\n }\n\n public get itemGenerator(): ItemGenerator {\n return this._itemGenerator;\n }\n\n public set itemGenerator(value: ItemGenerator) {\n this._itemGenerator = value;\n if (this._list) {\n this._list.itemGenerator = this._itemGenerator;\n }\n }\n\n public get items(): any[] {\n return this._itemCache;\n }\n\n public set items(items: any[]) {\n this._itemCache = items;\n if (this.isLazyLoadConfigured) {\n this._dataProvider.items = items;\n this._lastRequestedPage = null;\n }\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n this.filterItemsInMemory();\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n public get finalSizeIsKnown(): boolean {\n return this._dataProvider.finalSizeIsKnown;\n }\n\n public set finalSizeIsKnown(value: boolean) {\n this._dataProvider.finalSizeIsKnown = value;\n }\n\n public configureLazyLoad(onDataRequest: (filterText: string, page: number) => Promise<DataResponse>): void {\n if (!onDataRequest) {\n throw new Error(\"It is not possible to configure lazy load without a given onDataRequest calback.\");\n }\n this._dataProvider.finalSizeIsKnown = false;\n this._onDataRequest = onDataRequest;\n this._dataProvider.onDataRequest = (page: number) => {\n this.requestData(page, false);\n };\n }\n\n public get comboBoxValue(): ComboBoxValue | string {\n return this._comboBoxValue;\n }\n\n public set comboBoxValue(value: ComboBoxValue | string) {\n this._comboBoxValue = value;\n this.updateInputValue(null);\n this.updateHasValue();\n }\n\n public get selectedIndex(): number {\n if (this.isCustomValue(this.comboBoxValue) || !this.comboBoxValue) {\n return -1;\n }\n return this.comboBoxValue.index;\n }\n\n public get displayValue(): string {\n return this.value;\n }\n\n public open(): void {\n this.opened = true;\n }\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n\n public render(): TemplateResult {\n return html`\n ${super.render()}\n <slot @slotchange=${this.onDefaultSlotChange} id=\"default-slot\"></slot>\n `;\n }\n\n public attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue !== newValue) {\n switch (name) {\n case \"opened\": {\n this.handleOpenedStateChange();\n break;\n }\n case \"item-height\": {\n if (this._list) {\n this._list.itemHeight = this.itemHeight;\n }\n break;\n }\n case \"id\": {\n this.updateListId();\n break;\n }\n }\n }\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n window.requestAnimationFrame(() => {\n this.initClearButtton();\n this.initToggleButtton();\n this.updateHasValue();\n\n this.addEventListener(\"click\", () => {\n if (!this.disabled) {\n this.opened = !this.opened;\n }\n });\n this.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n if (!this.disabled) {\n this.handleKeyDown(event);\n }\n });\n });\n this.inputElement.setAttribute(\"role\", \"combobox\");\n this.inputElement.setAttribute(\"aria-autocomplete\", \"list\");\n }\n\n private updateComboBoxValueFromValue() {\n if (this.value) {\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value,\n );\n if (selectedIndex > -1) {\n this._comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else if (this.allowCustomValue) {\n this._comboBoxValue = this.value;\n } else {\n this._comboBoxValue = null;\n }\n this.updateHasValue();\n this.updateIconFromCurrentValue();\n }\n }\n\n public updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has(\"showIcon\")) {\n if (this.showIcon) {\n if (this._icon == null) {\n this.initIconWrapper();\n }\n } else if (this._icon != null) {\n this._icon.remove();\n this._icon = null;\n }\n }\n if (changedProperties.has(\"currentText\")) {\n this.updateHasValue();\n }\n if (changedProperties.has(\"triggerOnly\") && this._list) {\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n }\n }\n\n private initIconWrapper() {\n this._icon = document.createElement(\"div\");\n this._icon.className = \"icon-wrapper\";\n this._icon.role = \"img\";\n const iconEl = document.createElement(\"div\");\n iconEl.style.backgroundRepeat = \"no-repeat\";\n iconEl.style.backgroundPosition = \"center\";\n iconEl.style.backgroundSize = \"cover\";\n iconEl.style.height = \"24px\";\n iconEl.style.width = \"24px\";\n this._icon.appendChild(iconEl);\n this._icon.slot = \"prefix\";\n this.appendChild(this._icon);\n this.updateIconFromCurrentValue();\n }\n\n private updateIconFromCurrentValue() {\n if (this.isCustomValue(this.comboBoxValue)) {\n this.updateIcon(null);\n } else {\n this.updateIcon(this.comboBoxValue?.item);\n }\n }\n\n private updateIcon(item) {\n if (this._icon) {\n if (item && (item.icon || item.iconPlaceholder)) {\n const selectedItem = item as {\n iconBackgroundColor?: string;\n attributes?: Record<string, string>;\n };\n if (selectedItem.attributes == null) {\n this._icon.title = \"\";\n this._icon.ariaLabel = \"\";\n } else {\n this._icon.title = selectedItem.attributes[\"icon-attr-title\"] ?? \"\";\n this._icon.ariaLabel = selectedItem.attributes[\"icon-attr-aria-label\"] ?? \"\";\n }\n this._icon.style.backgroundColor = selectedItem.iconBackgroundColor;\n this._icon.style.display = \"\";\n ImageTools.showImage(this._icon.querySelector(\"div\"), item.icon, item.iconPlaceholder);\n } else if (this._icon) {\n this._icon.style.display = \"none\";\n }\n }\n }\n\n private updateHasValue() {\n if (this.currentText || (this.comboBoxValue != null && this.comboBoxValue != \"\")) {\n this.setAttribute(\"has-value\", \"\");\n if (this._clearButton) {\n this._clearButton.style.display = \"\";\n }\n } else {\n this.removeAttribute(\"has-value\");\n }\n }\n\n protected shouldFloat() {\n return super.shouldFloat() || (this.comboBoxValue != null && this.comboBoxValue != \"\");\n }\n\n private initClearButtton(): void {\n const clearButtonTemplate = document.createElement(\"template\");\n clearButtonTemplate.innerHTML = clearSvg;\n this._clearButton = clearButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._clearButton);\n\n this._clearButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n this.clearValue();\n });\n }\n\n private initToggleButtton(): void {\n const toggleButtonTemplate = document.createElement(\"template\");\n toggleButtonTemplate.innerHTML = toggleSvg;\n this._toggleButton = toggleButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._toggleButton);\n\n this._toggleButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = !this.opened;\n this.select();\n });\n }\n\n private debouncedFilterItemsInMemory = debounce(this.filterItemsInMemory.bind(this), 200);\n private filterItemsInMemory(): void {\n if (this.isLazyLoadConfigured) {\n return;\n }\n let filteredInMemory = false;\n if (this.filterText) {\n if (this.filterProperty) {\n this._dataProvider.items = this._itemCache.filter((item) => {\n return item[this.filterProperty] && String(item[this.filterProperty]).indexOf(this.filterText) > -1;\n });\n filteredInMemory = true;\n } else if (this.inMemoryFilter) {\n this._dataProvider.items = this._itemCache.filter((item) => this.inMemoryFilter(this.filterText, item));\n filteredInMemory = true;\n }\n }\n if (!filteredInMemory) {\n this._dataProvider.items = this._itemCache;\n if (this._list) {\n this.updateFocusAndSelectedIndexFromValue();\n }\n } else if (this._list) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n let index = this._dataProvider.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this._dataProvider.items.findIndex((item: any) => item.id == selectedId);\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = null;\n }\n }\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n private ensureListAndPopperInitialized(): void {\n if (!this._list) {\n this._list = document.createElement(VirtualList.ID) as VirtualList;\n this.updateListId();\n this._list.classList.add(\"combo-box-dropdown\");\n this._list.itemHeight = this.itemHeight;\n this._list.itemGenerator = this.itemGenerator;\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n this._list.setAttribute(\"focus-target\", \"\");\n Object.assign(this._list.style, {\n zIndex: \"21000\",\n boxShadow: `rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,\n rgba(0, 0, 0, 0.12) 0px 1px 5px 0px,\n rgba(0, 0, 0, 0.2) 0px 3px 1px -2px`,\n background: \"white\",\n overflowY: \"auto\",\n });\n this._list.addEventListener(\"selection\", this.handleSelection);\n this._dataProvider.connectList(this._list);\n }\n if (!this._popper) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const comboBox = this;\n this._popper = createPopper(this, this._list, {\n placement: \"bottom-start\",\n modifiers: [\n {\n name: \"computeStyles\",\n options: {\n gpuAcceleration: true,\n },\n },\n {\n name: \"hide\",\n enabled: false,\n },\n {\n name: \"closeIfReferenceHidden\",\n enabled: true,\n phase: \"afterWrite\",\n fn({ state }) {\n const comboBox = state.elements.reference as ComboBox;\n comboBox.closeIfNotVisible();\n },\n },\n {\n name: \"offset\",\n options: {\n offset: ({ placement }) => {\n if (placement.indexOf(\"top\") > -1) {\n return [0, -parseInt(getComputedStyle(comboBox).paddingTop, 10)];\n }\n if (placement.indexOf(\"bottom\") > -1) {\n return [\n 0,\n -parseInt(getComputedStyle(comboBox).paddingBottom, 10) -\n ((\n this.shadowRoot.querySelector(\n \".validation-message-wrapper\",\n ) as HTMLElement\n )?.offsetHeight ?? 0),\n ];\n }\n return [0, 0];\n },\n },\n },\n {\n name: \"adjustWidthIfNeeded\",\n enabled: true,\n phase: \"read\",\n fn({ state }) {\n const list = state.elements.popper as VirtualList;\n list.increaseWidthOnNextRenderIfNeeded();\n },\n },\n ],\n });\n }\n }\n\n private closeIfNotVisible(): void {\n const elementFromPoint = this.elementFromMiddleOfComboBox();\n // elementFromPoint might be the list itself in Safari, thus it needs to be checked as well (Fixes: 244485)\n if (\n !this.contains(elementFromPoint) &&\n !this.shadowRoot.contains(elementFromPoint) &&\n elementFromPoint !== this._list\n ) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n }\n\n private elementFromMiddleOfComboBox(): Element {\n const rect = this.getBoundingClientRect();\n return document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);\n }\n\n private handleSelection = (event: CustomEvent) => {\n const selectedItem = this._dataProvider.items[event.detail.index];\n if (!event.detail.selected) {\n // null selection is not allowed via clicking inside the dropdown\n this._list.selectedIndices = [event.detail.index];\n }\n this.comboBoxValue = { index: this._itemCache.indexOf(selectedItem), item: selectedItem };\n this.dispatchSelectionChangeEvent();\n this.opened = false;\n };\n\n private async handleOpenedStateChange(): Promise<void> {\n this.inputElement.setAttribute(\"aria-expanded\", String(this.opened));\n if (this.opened) {\n if (!this.disabled) {\n this.ensureListAndPopperInitialized();\n\n const filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n if (this.isLazyLoadConfigured && (this.items.length == 0 || filterChanged)) {\n this.requestData(0, filterChanged);\n }\n\n this.updateDropdownSizes();\n this.ownerDocument.body.appendChild(this._list);\n this.updateFocusAndSelectedIndexFromValue();\n\n window.requestAnimationFrame(() => {\n if (this._popper) {\n this._popper.update();\n }\n });\n\n window.addEventListener(\"pointerdown\", this.handleWindowPointerDown);\n\n if (!this.allowCustomValue && !this._openedByFilterTextChange) {\n this.select();\n }\n }\n this._openedByFilterTextChange = false;\n } else {\n await this._list.updateComplete;\n if (this._popper) {\n await this._popper.update;\n }\n this.ownerDocument.body.removeChild(this._list);\n window.removeEventListener(\"pointerdown\", this.handleWindowPointerDown);\n this.updateValueOnClose();\n this.clearFilter();\n this.setSelectionRange(0, 0);\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n }\n\n private updateValueOnClose(): void {\n const oldValue = this.comboBoxValue ?? \"\";\n if (this.nullSettingDisallowed && !this.value && this.comboBoxValue) {\n this.restorePreviousSelection();\n } else if (this.value !== (this.convertToDisplayValue(null) ?? \"\")) {\n // value change only if needed\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n disabled?: boolean;\n };\n if (focusedItem && (focusedItem[this.displayValuePath] ?? \"\") === this.value) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n // 1. select focused item if the input's value is the same\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n } else if (this.allowCustomValue || !this.value) {\n // 2. set as a custom or empty value\n this.comboBoxValue = this.value;\n } else {\n // 3. try to search for an identical item\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value && !item.disabled,\n );\n if (selectedIndex > -1) {\n this.comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else {\n this.restorePreviousSelection(); // Fixes C1XRTYID\n }\n }\n } else {\n // Allow selecting another item with same caption but different id\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n id?: string;\n disabled?: boolean;\n };\n if (focusedItem && focusedItem.id != null) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n if (\n !this.comboBoxValue ||\n this.isCustomValue(this.comboBoxValue) ||\n this.comboBoxValue.item.id != focusedItem.id\n ) {\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n }\n }\n }\n if (oldValue !== (this.comboBoxValue ?? \"\")) {\n this.dispatchSelectionChangeEvent();\n }\n this.updateIcon(this.isCustomValue(this.comboBoxValue) ? null : this.comboBoxValue?.item);\n }\n\n private restorePreviousSelection() {\n this.updateInputValue(null);\n }\n\n private updateFocusAndSelectedIndexFromValue(): void {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue) && !this._openedByFilterTextChange) {\n let index = this.comboBoxValue.index;\n if (index == -1 || this.isLazyLoadConfigured) {\n index = this.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = -1;\n this._list.selectedIndices = [];\n }\n this.updateActiveDescendant();\n }\n\n private handleWindowPointerDown = (event: PointerEvent) => {\n const contains = event.target instanceof Node && this.contains(event.target);\n if (!contains && this.opened && event.composedPath().indexOf(this._list) === -1) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Down\":\n case \"ArrowDown\": {\n event.preventDefault();\n this.navigateInList(+1);\n break;\n }\n case \"Up\":\n case \"ArrowUp\": {\n event.preventDefault();\n this.navigateInList(-1);\n break;\n }\n case \"Enter\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n }\n break;\n }\n case \"Escape\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n if (\n this._list.selectedIndices.indexOf(this._list.focusIndex) > -1 &&\n this._dataProvider.items.length > this._list.focusIndex\n ) {\n this.opened = false;\n } else {\n this.clearFilter();\n this.updateInputValue(null);\n this.updateFocusAndSelectedIndexFromValue();\n if (!this._list.selectedIndices.includes(this._list.focusIndex)) {\n this._list.selectedIndices.push(this._list.focusIndex);\n }\n }\n }\n break;\n }\n case \"Tab\": {\n if (this.opened) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n break;\n }\n }\n };\n\n private navigateInList(offset: number): void {\n if (!this.opened) {\n this.opened = true;\n } else {\n if (this._list.focusIndex == null) {\n if (offset > 0) {\n this._list.focusIndex = 0;\n } else {\n this._list.focusIndex = Math.max(0, this._dataProvider.items.length - 1);\n }\n } else {\n this._list.focusIndex = Math.max(\n 0,\n Math.min(this._dataProvider.items.length - 1, this._list.focusIndex + offset),\n );\n }\n this.updateInputValue(this._dataProvider.items[this._list.focusIndex] as ItemData | any);\n this.updateActiveDescendant();\n if (!this.allowCustomValue) {\n this.select();\n }\n }\n }\n\n private updateActiveDescendant() {\n const focusedListItem = this._list && this._list.getListItem(this._list.focusIndex);\n if (focusedListItem) {\n this.inputElement.setAttribute(\"aria-activedescendant\", focusedListItem.id);\n } else {\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n }\n }\n\n private updateInputValue(item: ItemData): void {\n this.updateComplete.then(() => {\n this.value = this.convertToDisplayValue(item);\n if (item) {\n this.updateIcon(item);\n } else {\n this.updateIconFromCurrentValue();\n }\n });\n }\n\n private convertToDisplayValue(item: ItemData): string {\n if (item) {\n return item[this.displayValuePath];\n } else if (this.comboBoxValue) {\n if (this.isCustomValue(this.comboBoxValue)) {\n return this.comboBoxValue;\n } else {\n return this.comboBoxValue.item[this.displayValuePath];\n }\n } else {\n return null;\n }\n }\n\n protected fireValueChange(immediate?: boolean): void {\n if (immediate) {\n if (this.filterText !== this.value) {\n const effectiveFilterChange = (this.filterText ?? \"\") !== this.value;\n this.filterText = this.value;\n this.updateIcon(null);\n if (!this.opened) {\n this._openedByFilterTextChange = true;\n this.opened = true;\n }\n if (effectiveFilterChange) {\n this.dispatchFilterChangeEvent();\n this.debouncedFilterItemsInMemory();\n }\n }\n }\n // consume both change events triggered from input, combo box provides a different API for that\n }\n\n private clearValue(): void {\n if (!this.nullSettingDisallowed) {\n this.value = null;\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n if (this._list) {\n this._list.selectedIndices = [];\n }\n this.clearFilter();\n if (this.comboBoxValue) {\n this.comboBoxValue = null;\n this.dispatchSelectionChangeEvent();\n }\n this.requestUpdate();\n }\n }\n\n private clearFilter(): void {\n if (this.filterText != null) {\n this.filterText = undefined;\n this.filterItemsInMemory();\n this.dispatchFilterChangeEvent();\n this.updateIconFromCurrentValue();\n }\n }\n\n private updateDropdownSizes(): void {\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight;\n const overlayMaxHeight = (viewportHeight - this.offsetHeight) * 0.5;\n Object.assign(this._list.style, {\n maxHeight: `${overlayMaxHeight}px`,\n minWidth: `${Math.max(this.offsetWidth, this.minimumOverlayWidth)}px`,\n maxWidth: `max(50vw, ${this.offsetWidth}px)`,\n });\n }\n\n private updateListId() {\n if (this.inputElement && this._list) {\n this._list.id = this.id + \"_list\";\n this.inputElement.setAttribute(\"aria-controls\", this._list.id);\n }\n }\n\n private isCustomValue(value: ComboBoxValue | string): value is string {\n return typeof value === \"string\";\n }\n\n private dispatchSelectionChangeEvent(): void {\n this.updateComplete\n .then(() => {\n this.dispatchEvent(\n new CustomEvent<ISelectionEvent>(\"selection-change\", {\n detail: {\n selection: this.comboBoxValue,\n isCustomValue: this.isCustomValue(this.comboBoxValue),\n },\n }),\n );\n if (this.triggerOnly) {\n this.comboBoxValue = null;\n } else {\n const comboBoxValue = this.comboBoxValue;\n if (this.isCustomValue(comboBoxValue)) {\n this.setFormValue(comboBoxValue);\n } else {\n this.setFormValue(comboBoxValue?.item?.caption);\n }\n }\n })\n .catch((e) => {\n console.error(\"Could not dispatch selection change event due to:\", e);\n });\n }\n\n private dispatchFilterChangeEvent(): void {\n this.dispatchEvent(\n new CustomEvent<IFilterChangeEvent>(\"filter-change\", {\n detail: { value: this.filterText },\n composed: true,\n }),\n );\n this.debouncedRequestData(0);\n }\n\n private get isLazyLoadConfigured(): boolean {\n return !!this._onDataRequest;\n }\n\n /**\n * Used only when lazy loading is configured.\n */\n private debouncedRequestData = debounce(this.requestData.bind(this), 250);\n private requestData(page: number, filterChanged?: boolean) {\n if (filterChanged == null) {\n filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n }\n if (this.isLazyLoadConfigured) {\n if (!this.opened) {\n if (filterChanged) {\n this._dataProvider.items = [];\n this._itemCache = [];\n }\n return;\n }\n if (this._lastRequestedPage == page && !filterChanged) {\n return;\n }\n if (this._pendingDataRequest) {\n this._pendingDataRequest.cancel(ComboBox.DATA_REQUEST_CANCELLED);\n }\n const cancellationPromise = new Promise<DataResponse>((_resolve, reject) => {\n this._pendingDataRequest = { cancel: reject };\n });\n this._lastRequestedPage = page;\n this._lastRequestedFilterText = this.filterText;\n this.setAttribute(\"loading\", \"\");\n Promise.race([cancellationPromise, this._onDataRequest(this._lastRequestedFilterText, page)])\n .then((dataResponse) => {\n if (this.filterText == this._lastRequestedFilterText && this._lastRequestedPage == page) {\n this._dataProvider.finalSizeIsKnown = dataResponse.finalSizeIsKnown;\n if (filterChanged) {\n this._dataProvider.items = dataResponse.items;\n this._itemCache = dataResponse.items;\n } else {\n this._dataProvider.addItems(dataResponse.items);\n this._itemCache = this._dataProvider.items;\n }\n if (this._list) {\n this._list.itemCount = this._dataProvider.items.length;\n }\n if (this._popper && this.opened) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n const selectedItem = this.comboBoxValue.item;\n if (\n this._list.selectedIndices.length == 0 ||\n this.items[this._list.selectedIndices[0]] != selectedItem\n ) {\n let index = this.items.indexOf(selectedItem);\n if (index == -1) {\n const selectedId = selectedItem.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n this.comboBoxValue.index = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n }\n }\n this.updateDropdownSizes();\n this._popper.update();\n }\n }\n this._pendingDataRequest = null;\n this.removeAttribute(\"loading\");\n })\n .catch((e) => {\n if (e !== ComboBox.DATA_REQUEST_CANCELLED) {\n console.error(\n `Data could not be loaded for filter \"${this._lastRequestedFilterText}\" and page number \"${page}\" due to the following error:\\n${e}`,\n );\n this._dataProvider.finalSizeIsKnown = true;\n\n if (this.items.length == 0) {\n this.opened = false;\n } else if (this._list) {\n this._list.itemCount = this.items.length;\n }\n this.removeAttribute(\"loading\");\n }\n this._pendingDataRequest = null;\n });\n }\n }\n\n private get defaultSlot(): HTMLSlotElement {\n return this.shadowRoot.querySelector(\"#default-slot\");\n }\n\n private onDefaultSlotChange(): void {\n this._declarativeItems = this.defaultSlot.assignedElements() as HTMLElement[];\n if (this._declarativeItems.length > 0) {\n this.finalSizeIsKnown = true;\n this.itemGenerator = (_data, index) => {\n return this._declarativeItems[index].cloneNode(true) as HTMLElement;\n };\n this.items = this._declarativeItems.map((item) => {\n const data = {\n caption: item.getAttribute(\"caption\"),\n description: item.getAttribute(\"description\"),\n };\n if (\"caption\" != this.displayValuePath && \"description\" != this.displayValuePath) {\n data[this.displayValuePath] =\n item[this.displayValuePath] || item.getAttribute(this.displayValuePath);\n }\n return data;\n });\n }\n }\n}\n\nComboBox.ensureDefined();\n"],"names":["toggleSvg","clearSvg","TAG_NAME","debounce","func","delay","timeout","args","idCounter","_ComboBox","_a","SDInput","filterText","item","lowerCaseFilter","generator","event","selectedItem","ListDataProvider","value","items","onDataRequest","page","css","unsafeCSS","style","html","name","oldValue","newValue","changedProperties","selectedIndex","SelectionType","iconEl","ImageTools","clearButtonTemplate","toggleButtonTemplate","filteredInMemory","index","selectedId","VirtualList","comboBox","createPopper","state","placement","elementFromPoint","rect","filterChanged","focusedItem","offset","focusedListItem","immediate","effectiveFilterChange","overlayMaxHeight","comboBoxValue","e","cancellationPromise","_resolve","reject","dataResponse","_data","data","__decorateClass","property","ComboBox"],"mappings":";;;;;;;6mKAAAA,IAAe;AAAA;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AW,2BAA2B,SAAS,IAAM;AAAA,GApB/DtD,EAqBV,WAAA,uBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,SAAS,WAAW,aAAa,SAAS,IAAM;AAAA,GAtBjDtD,EAuBV,WAAA,UAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,sBAAsB,YAAY,IAAM;AAAA,GAxB5DtD,EAyBV,WAAA,kBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,mBAAmB,YAAY,IAAM;AAAA,GA1BzDtD,EA2BV,WAAA,gBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,IAAM,SAAS,IAAM;AAAA,GA5BzCtD,EA6BV,WAAA,IAAA;AA7BX,IAAqBuD,IAArBvD;AAo9BAuD,EAAS,cAAA;"}
1
+ {"version":3,"file":"combo-box.mjs","sources":["../toggle.svg?raw","../clear.svg?raw","../combo-box.ts"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"toggle-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M13 4v2l-5 5-5-5v-2l5 5z\\\"/>\\r\\n</svg>\\r\\n\"","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"clear-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M12.96 4.46l-1.42-1.42-3.54 3.55-3.54-3.55-1.42 1.42 3.55 3.54-3.55 3.54 1.42 1.42 3.54-3.55 3.54 3.55 1.42-1.42-3.55-3.54 3.55-3.54z\\\"/>\\r\\n</svg>\\r\\n\"","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { unsafeCSS, PropertyValues, css, TemplateResult, html } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { createPopper, Instance as Popper } from \"@popperjs/core\";\nimport SDInput, { CustomEventMap as InputCustomEventMap } from \"@cas-smartdesign/lit-input\";\nimport VirtualList, { SelectionType, ItemGenerator, ListDataProvider } from \"@cas-smartdesign/virtual-list\";\nimport { ItemData, generator } from \"@cas-smartdesign/list-item\";\n\nconst TAG_NAME = \"sd-combo-box\";\n\nfunction debounce<T>(func: (...args: T[]) => unknown, delay: number): typeof func {\n let timeout: number;\n return function (...args: T[]) {\n if (timeout != null) {\n clearTimeout(timeout);\n }\n timeout = window.setTimeout(() => func(...args), delay);\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [TAG_NAME]: ComboBox;\n }\n}\n\nimport style from \"./style.scss?inline\";\nimport toggleSvg from \"./toggle.svg?raw\";\nimport clearSvg from \"./clear.svg?raw\";\nimport ImageTools from \"@cas-smartdesign/image-tools\";\n\nexport type ComboBoxValue = {\n index: number;\n item: ItemData | any;\n};\nexport type InMemoryFilter = (filterText: string, item: any) => boolean;\nexport type DataResponse = {\n items: any[];\n finalSizeIsKnown: boolean;\n};\n\nlet idCounter = 0;\n\nexport interface ISelectionEvent {\n selection: ComboBoxValue | string;\n isCustomValue: boolean;\n}\nexport interface IFilterChangeEvent {\n value: string;\n}\n\nexport interface CustomEventMap extends InputCustomEventMap {\n \"selection-change\": CustomEvent<ISelectionEvent>;\n \"filter-change\": CustomEvent<IFilterChangeEvent>;\n}\n\nexport default interface ComboBox {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport default class ComboBox extends SDInput {\n public static readonly ID: string = TAG_NAME;\n public static ensureDefined = (): void => {\n VirtualList.ensureDefined();\n if (!customElements.get(ComboBox.ID)) {\n customElements.define(ComboBox.ID, ComboBox);\n }\n };\n static formAssociated = true;\n\n private static readonly DATA_REQUEST_CANCELLED: string = \"cancel_data_request\";\n\n @property({ type: Boolean, reflect: true })\n public opened = false;\n @property({ type: Number, attribute: \"item-height\" })\n public itemHeight = 50;\n @property({ type: Boolean, attribute: \"allow-custom-value\", reflect: true })\n public allowCustomValue: boolean;\n @property({ type: Boolean, attribute: \"trigger-only\", reflect: true })\n public triggerOnly: boolean;\n @property({ type: Boolean, attribute: \"null-setting-disallowed\", reflect: true })\n public nullSettingDisallowed: boolean;\n @property({ type: Boolean, attribute: \"show-icon\", reflect: true })\n public showIcon: boolean;\n @property({ type: String, attribute: \"display-value-path\", noAccessor: true })\n public displayValuePath = \"caption\";\n @property({ type: String, attribute: \"filter-property\", noAccessor: true })\n public filterProperty: string;\n @property({ type: String, attribute: true, reflect: true })\n public id: string = ComboBox.ID + \"_\" + idCounter++;\n\n public inMemoryFilter: InMemoryFilter = (filterText, item) => {\n if (!filterText) {\n return true;\n }\n const lowerCaseFilter = filterText.toLowerCase();\n if (typeof item.caption == \"string\" && item.caption.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n if (typeof item.description == \"string\" && item.description.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n return false;\n };\n\n public filterText: string;\n public minimumOverlayWidth = 250;\n\n private _comboBoxValue: ComboBoxValue | string;\n private _clearButton: SVGElement;\n private _toggleButton: SVGElement;\n private _popper: Popper;\n private _list: VirtualList;\n private _dataProvider: ListDataProvider;\n private _itemGenerator: ItemGenerator = generator;\n private _itemCache: any[] = [];\n private _declarativeItems: HTMLElement[];\n private _onDataRequest: (filterText: string, page: number) => Promise<DataResponse>;\n private _pendingDataRequest: { cancel: (reason?: any) => void };\n private _openedByFilterTextChange: boolean;\n private _lastRequestedPage: number;\n private _lastRequestedFilterText: string;\n private _icon: HTMLElement;\n\n constructor() {\n super();\n this._dataProvider = new ListDataProvider();\n this._dataProvider.finalSizeIsKnown = true;\n }\n\n public get clearFilterOnLazyLoadedSelection(): boolean {\n return this.triggerOnly;\n }\n\n /**\n * @deprecated The method should not be used.\n * Use {@link ComboBox#triggerOnly} instead.\n * @param {boolean} value\n */\n public set clearFilterOnLazyLoadedSelection(value: boolean) {\n console.warn(\n \"Using clearFilterOnLazyLoadedSelection setting on a combo-box is deprecated. Use triggerOnly instead.\",\n );\n this.triggerOnly = value;\n }\n\n public get itemGenerator(): ItemGenerator {\n return this._itemGenerator;\n }\n\n public set itemGenerator(value: ItemGenerator) {\n this._itemGenerator = value;\n if (this._list) {\n this._list.itemGenerator = this._itemGenerator;\n }\n }\n\n public get items(): any[] {\n return this._itemCache;\n }\n\n public set items(items: any[]) {\n this._itemCache = items;\n if (this.isLazyLoadConfigured) {\n this._dataProvider.items = items;\n this._lastRequestedPage = null;\n }\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n this.filterItemsInMemory();\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n public get finalSizeIsKnown(): boolean {\n return this._dataProvider.finalSizeIsKnown;\n }\n\n public set finalSizeIsKnown(value: boolean) {\n this._dataProvider.finalSizeIsKnown = value;\n }\n\n public configureLazyLoad(onDataRequest: (filterText: string, page: number) => Promise<DataResponse>): void {\n if (!onDataRequest) {\n throw new Error(\"It is not possible to configure lazy load without a given onDataRequest calback.\");\n }\n this._dataProvider.finalSizeIsKnown = false;\n this._onDataRequest = onDataRequest;\n this._dataProvider.onDataRequest = (page: number) => {\n this.requestData(page, false);\n };\n }\n\n public get comboBoxValue(): ComboBoxValue | string {\n return this._comboBoxValue;\n }\n\n public set comboBoxValue(value: ComboBoxValue | string) {\n this._comboBoxValue = value;\n this.updateInputValue(null);\n this.updateHasValue();\n }\n\n public get selectedIndex(): number {\n if (this.isCustomValue(this.comboBoxValue) || !this.comboBoxValue) {\n return -1;\n }\n return this.comboBoxValue.index;\n }\n\n public get displayValue(): string {\n return this.value;\n }\n\n public open(): void {\n this.opened = true;\n }\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n\n public render(): TemplateResult {\n return html`\n ${super.render()}\n <slot @slotchange=${this.onDefaultSlotChange} id=\"default-slot\"></slot>\n `;\n }\n\n public attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue !== newValue) {\n switch (name) {\n case \"opened\": {\n this.handleOpenedStateChange();\n break;\n }\n case \"item-height\": {\n if (this._list) {\n this._list.itemHeight = this.itemHeight;\n }\n break;\n }\n case \"id\": {\n this.updateListId();\n break;\n }\n }\n }\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n window.requestAnimationFrame(() => {\n this.initClearButtton();\n this.initToggleButtton();\n this.updateHasValue();\n\n this.addEventListener(\"click\", () => {\n if (!this.disabled) {\n this.opened = !this.opened;\n }\n });\n this.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n if (!this.disabled) {\n this.handleKeyDown(event);\n }\n });\n });\n this.inputElement.setAttribute(\"role\", \"combobox\");\n this.inputElement.setAttribute(\"aria-autocomplete\", \"list\");\n }\n\n private updateComboBoxValueFromValue() {\n if (this.value) {\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value,\n );\n if (selectedIndex > -1) {\n this._comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else if (this.allowCustomValue) {\n this._comboBoxValue = this.value;\n } else {\n this._comboBoxValue = null;\n }\n this.updateHasValue();\n this.updateIconFromCurrentValue();\n }\n }\n\n public updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has(\"showIcon\")) {\n if (this.showIcon) {\n if (this._icon == null) {\n this.initIconWrapper();\n }\n } else if (this._icon != null) {\n this._icon.remove();\n this._icon = null;\n }\n }\n if (changedProperties.has(\"currentText\")) {\n this.updateHasValue();\n }\n if (changedProperties.has(\"triggerOnly\") && this._list) {\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n }\n }\n\n private initIconWrapper() {\n this._icon = document.createElement(\"div\");\n this._icon.className = \"icon-wrapper\";\n this._icon.role = \"img\";\n const iconEl = document.createElement(\"div\");\n iconEl.style.backgroundRepeat = \"no-repeat\";\n iconEl.style.backgroundPosition = \"center\";\n iconEl.style.backgroundSize = \"cover\";\n iconEl.style.height = \"24px\";\n iconEl.style.width = \"24px\";\n this._icon.appendChild(iconEl);\n this._icon.slot = \"prefix\";\n this.appendChild(this._icon);\n this.updateIconFromCurrentValue();\n }\n\n private updateIconFromCurrentValue() {\n if (this.isCustomValue(this.comboBoxValue)) {\n this.updateIcon(null);\n } else {\n this.updateIcon(this.comboBoxValue?.item);\n }\n }\n\n private updateIcon(item) {\n if (this._icon) {\n if (item && (item.icon || item.iconPlaceholder)) {\n const selectedItem = item as {\n iconBackgroundColor?: string;\n attributes?: Record<string, string>;\n };\n if (selectedItem.attributes == null) {\n this._icon.title = \"\";\n this._icon.ariaLabel = \"\";\n } else {\n this._icon.title = selectedItem.attributes[\"icon-attr-title\"] ?? \"\";\n this._icon.ariaLabel = selectedItem.attributes[\"icon-attr-aria-label\"] ?? \"\";\n }\n this._icon.style.backgroundColor = selectedItem.iconBackgroundColor;\n this._icon.style.display = \"\";\n ImageTools.showImage(this._icon.querySelector(\"div\"), item.icon, item.iconPlaceholder);\n } else if (this._icon) {\n this._icon.style.display = \"none\";\n }\n }\n }\n\n private updateHasValue() {\n if (this.currentText || (this.comboBoxValue != null && this.comboBoxValue != \"\")) {\n this.setAttribute(\"has-value\", \"\");\n if (this._clearButton) {\n this._clearButton.style.display = \"\";\n }\n } else {\n this.removeAttribute(\"has-value\");\n }\n }\n\n protected shouldFloat() {\n return super.shouldFloat() || (this.comboBoxValue != null && this.comboBoxValue != \"\");\n }\n\n private initClearButtton(): void {\n const clearButtonTemplate = document.createElement(\"template\");\n clearButtonTemplate.innerHTML = clearSvg;\n this._clearButton = clearButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._clearButton);\n\n this._clearButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n this.clearValue();\n });\n }\n\n private initToggleButtton(): void {\n const toggleButtonTemplate = document.createElement(\"template\");\n toggleButtonTemplate.innerHTML = toggleSvg;\n this._toggleButton = toggleButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._toggleButton);\n\n this._toggleButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = !this.opened;\n this.select();\n });\n }\n\n private debouncedFilterItemsInMemory = debounce(this.filterItemsInMemory.bind(this), 200);\n private filterItemsInMemory(): void {\n if (this.isLazyLoadConfigured) {\n return;\n }\n let filteredInMemory = false;\n if (this.filterText) {\n if (this.filterProperty) {\n this._dataProvider.items = this._itemCache.filter((item) => {\n return item[this.filterProperty] && String(item[this.filterProperty]).indexOf(this.filterText) > -1;\n });\n filteredInMemory = true;\n } else if (this.inMemoryFilter) {\n this._dataProvider.items = this._itemCache.filter((item) => this.inMemoryFilter(this.filterText, item));\n filteredInMemory = true;\n }\n }\n if (!filteredInMemory) {\n this._dataProvider.items = this._itemCache;\n if (this._list) {\n this.updateFocusAndSelectedIndexFromValue();\n }\n } else if (this._list) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n let index = this._dataProvider.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this._dataProvider.items.findIndex((item: any) => item.id == selectedId);\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = null;\n }\n }\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n private ensureListAndPopperInitialized(): void {\n if (!this._list) {\n this._list = document.createElement(VirtualList.ID) as VirtualList;\n this.updateListId();\n this._list.classList.add(\"combo-box-dropdown\");\n this._list.itemHeight = this.itemHeight;\n this._list.itemGenerator = this.itemGenerator;\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n this._list.setAttribute(\"focus-target\", \"\");\n Object.assign(this._list.style, {\n zIndex: \"21000\",\n boxShadow: `rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,\n rgba(0, 0, 0, 0.12) 0px 1px 5px 0px,\n rgba(0, 0, 0, 0.2) 0px 3px 1px -2px`,\n background: \"white\",\n overflowY: \"auto\",\n });\n this._list.addEventListener(\"selection\", this.handleSelection);\n this._dataProvider.connectList(this._list);\n }\n if (!this._popper) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const comboBox = this;\n this._popper = createPopper(this, this._list, {\n placement: \"bottom-start\",\n modifiers: [\n {\n name: \"computeStyles\",\n options: {\n gpuAcceleration: true,\n },\n },\n {\n name: \"hide\",\n enabled: false,\n },\n {\n name: \"closeIfReferenceHidden\",\n enabled: true,\n phase: \"afterWrite\",\n fn({ state }) {\n const comboBox = state.elements.reference as ComboBox;\n comboBox.closeIfNotVisible();\n },\n },\n {\n name: \"offset\",\n options: {\n offset: ({ placement }) => {\n if (placement.indexOf(\"top\") > -1) {\n return [0, -parseInt(getComputedStyle(comboBox).paddingTop, 10)];\n }\n if (placement.indexOf(\"bottom\") > -1) {\n return [\n 0,\n -parseInt(getComputedStyle(comboBox).paddingBottom, 10) -\n ((\n this.shadowRoot.querySelector(\n \".validation-message-wrapper\",\n ) as HTMLElement\n )?.offsetHeight ?? 0),\n ];\n }\n return [0, 0];\n },\n },\n },\n {\n name: \"adjustWidthIfNeeded\",\n enabled: true,\n phase: \"read\",\n fn({ state }) {\n const list = state.elements.popper as VirtualList;\n list.increaseWidthOnNextRenderIfNeeded();\n },\n },\n ],\n });\n }\n }\n\n private closeIfNotVisible(): void {\n const elementFromPoint = this.elementFromMiddleOfComboBox();\n // elementFromPoint might be the list itself in Safari, thus it needs to be checked as well (Fixes: 244485)\n if (\n !this.contains(elementFromPoint) &&\n !this.shadowRoot.contains(elementFromPoint) &&\n elementFromPoint !== this._list\n ) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n }\n\n private elementFromMiddleOfComboBox(): Element {\n const rect = this.getBoundingClientRect();\n return document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);\n }\n\n private handleSelection = (event: CustomEvent) => {\n const selectedItem = this._dataProvider.items[event.detail.index];\n if (!event.detail.selected) {\n // null selection is not allowed via clicking inside the dropdown\n this._list.selectedIndices = [event.detail.index];\n }\n this.comboBoxValue = { index: this._itemCache.indexOf(selectedItem), item: selectedItem };\n this.dispatchSelectionChangeEvent();\n this.focus();\n this.opened = false;\n };\n\n private async handleOpenedStateChange(): Promise<void> {\n this.inputElement.setAttribute(\"aria-expanded\", String(this.opened));\n if (this.opened) {\n if (!this.disabled) {\n this.ensureListAndPopperInitialized();\n\n const filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n if (this.isLazyLoadConfigured && (this.items.length == 0 || filterChanged)) {\n this.requestData(0, filterChanged);\n }\n\n this.updateDropdownSizes();\n this.ownerDocument.body.appendChild(this._list);\n this.updateFocusAndSelectedIndexFromValue();\n\n window.requestAnimationFrame(() => {\n if (this._popper) {\n this._popper.update();\n }\n });\n\n window.addEventListener(\"pointerdown\", this.handleWindowPointerDown);\n\n if (!this.allowCustomValue && !this._openedByFilterTextChange) {\n this.select();\n }\n }\n this._openedByFilterTextChange = false;\n } else {\n await this._list.updateComplete;\n if (this._popper) {\n await this._popper.update;\n }\n this.ownerDocument.body.removeChild(this._list);\n window.removeEventListener(\"pointerdown\", this.handleWindowPointerDown);\n this.updateValueOnClose();\n this.clearFilter();\n this.setSelectionRange(0, 0);\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n }\n\n private updateValueOnClose(): void {\n const oldValue = this.comboBoxValue ?? \"\";\n if (this.nullSettingDisallowed && !this.value && this.comboBoxValue) {\n this.restorePreviousSelection();\n } else if (this.value !== (this.convertToDisplayValue(null) ?? \"\")) {\n // value change only if needed\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n disabled?: boolean;\n };\n if (focusedItem && (focusedItem[this.displayValuePath] ?? \"\") === this.value) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n // 1. select focused item if the input's value is the same\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n } else if (this.allowCustomValue || !this.value) {\n // 2. set as a custom or empty value\n this.comboBoxValue = this.value;\n } else {\n // 3. try to search for an identical item\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value && !item.disabled,\n );\n if (selectedIndex > -1) {\n this.comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else {\n this.restorePreviousSelection(); // Fixes C1XRTYID\n }\n }\n } else {\n // Allow selecting another item with same caption but different id\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n id?: string;\n disabled?: boolean;\n };\n if (focusedItem && focusedItem.id != null) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n if (\n !this.comboBoxValue ||\n this.isCustomValue(this.comboBoxValue) ||\n this.comboBoxValue.item.id != focusedItem.id\n ) {\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n }\n }\n }\n if (oldValue !== (this.comboBoxValue ?? \"\")) {\n this.dispatchSelectionChangeEvent();\n }\n this.updateIcon(this.isCustomValue(this.comboBoxValue) ? null : this.comboBoxValue?.item);\n }\n\n private restorePreviousSelection() {\n this.updateInputValue(null);\n }\n\n private updateFocusAndSelectedIndexFromValue(): void {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue) && !this._openedByFilterTextChange) {\n let index = this.comboBoxValue.index;\n if (index == -1 || this.isLazyLoadConfigured) {\n index = this.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = -1;\n this._list.selectedIndices = [];\n }\n this.updateActiveDescendant();\n }\n\n private handleWindowPointerDown = (event: PointerEvent) => {\n const contains = event.target instanceof Node && this.contains(event.target);\n if (!contains && this.opened && event.composedPath().indexOf(this._list) === -1) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Down\":\n case \"ArrowDown\": {\n event.preventDefault();\n this.navigateInList(+1);\n break;\n }\n case \"Up\":\n case \"ArrowUp\": {\n event.preventDefault();\n this.navigateInList(-1);\n break;\n }\n case \"Enter\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n }\n break;\n }\n case \"Escape\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n if (\n this._list.selectedIndices.indexOf(this._list.focusIndex) > -1 &&\n this._dataProvider.items.length > this._list.focusIndex\n ) {\n this.opened = false;\n } else {\n this.clearFilter();\n this.updateInputValue(null);\n this.updateFocusAndSelectedIndexFromValue();\n if (!this._list.selectedIndices.includes(this._list.focusIndex)) {\n this._list.selectedIndices.push(this._list.focusIndex);\n }\n }\n }\n break;\n }\n case \"Tab\": {\n if (this.opened) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n break;\n }\n }\n };\n\n private navigateInList(offset: number): void {\n if (!this.opened) {\n this.opened = true;\n } else {\n if (this._list.focusIndex == null) {\n if (offset > 0) {\n this._list.focusIndex = 0;\n } else {\n this._list.focusIndex = Math.max(0, this._dataProvider.items.length - 1);\n }\n } else {\n this._list.focusIndex = Math.max(\n 0,\n Math.min(this._dataProvider.items.length - 1, this._list.focusIndex + offset),\n );\n }\n this.updateInputValue(this._dataProvider.items[this._list.focusIndex] as ItemData | any);\n this.updateActiveDescendant();\n if (!this.allowCustomValue) {\n this.select();\n }\n }\n }\n\n private updateActiveDescendant() {\n const focusedListItem = this._list && this._list.getListItem(this._list.focusIndex);\n if (focusedListItem) {\n this.inputElement.setAttribute(\"aria-activedescendant\", focusedListItem.id);\n } else {\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n }\n }\n\n private updateInputValue(item: ItemData): void {\n this.updateComplete.then(() => {\n this.value = this.convertToDisplayValue(item);\n if (item) {\n this.updateIcon(item);\n } else {\n this.updateIconFromCurrentValue();\n }\n });\n }\n\n private convertToDisplayValue(item: ItemData): string {\n if (item) {\n return item[this.displayValuePath];\n } else if (this.comboBoxValue) {\n if (this.isCustomValue(this.comboBoxValue)) {\n return this.comboBoxValue;\n } else {\n return this.comboBoxValue.item[this.displayValuePath];\n }\n } else {\n return null;\n }\n }\n\n protected fireValueChange(immediate?: boolean): void {\n if (immediate) {\n if (this.filterText !== this.value) {\n const effectiveFilterChange = (this.filterText ?? \"\") !== this.value;\n this.filterText = this.value;\n this.updateIcon(null);\n if (!this.opened) {\n this._openedByFilterTextChange = true;\n this.opened = true;\n }\n if (effectiveFilterChange) {\n this.dispatchFilterChangeEvent();\n this.debouncedFilterItemsInMemory();\n }\n }\n }\n // consume both change events triggered from input, combo box provides a different API for that\n }\n\n private clearValue(): void {\n if (!this.nullSettingDisallowed) {\n this.value = null;\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n if (this._list) {\n this._list.selectedIndices = [];\n }\n this.clearFilter();\n if (this.comboBoxValue) {\n this.comboBoxValue = null;\n this.dispatchSelectionChangeEvent();\n }\n this.requestUpdate();\n }\n }\n\n private clearFilter(): void {\n if (this.filterText != null) {\n this.filterText = undefined;\n this.filterItemsInMemory();\n this.dispatchFilterChangeEvent();\n this.updateIconFromCurrentValue();\n }\n }\n\n private updateDropdownSizes(): void {\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight;\n const overlayMaxHeight = (viewportHeight - this.offsetHeight) * 0.5;\n Object.assign(this._list.style, {\n maxHeight: `${overlayMaxHeight}px`,\n minWidth: `${Math.max(this.offsetWidth, this.minimumOverlayWidth)}px`,\n maxWidth: `max(50vw, ${this.offsetWidth}px)`,\n });\n }\n\n private updateListId() {\n if (this.inputElement && this._list) {\n this._list.id = this.id + \"_list\";\n this.inputElement.setAttribute(\"aria-controls\", this._list.id);\n }\n }\n\n private isCustomValue(value: ComboBoxValue | string): value is string {\n return typeof value === \"string\";\n }\n\n private dispatchSelectionChangeEvent(): void {\n this.updateComplete\n .then(() => {\n this.dispatchEvent(\n new CustomEvent<ISelectionEvent>(\"selection-change\", {\n detail: {\n selection: this.comboBoxValue,\n isCustomValue: this.isCustomValue(this.comboBoxValue),\n },\n }),\n );\n if (this.triggerOnly) {\n this.comboBoxValue = null;\n } else {\n const comboBoxValue = this.comboBoxValue;\n if (this.isCustomValue(comboBoxValue)) {\n this.setFormValue(comboBoxValue);\n } else {\n this.setFormValue(comboBoxValue?.item?.caption);\n }\n }\n })\n .catch((e) => {\n console.error(\"Could not dispatch selection change event due to:\", e);\n });\n }\n\n private dispatchFilterChangeEvent(): void {\n this.dispatchEvent(\n new CustomEvent<IFilterChangeEvent>(\"filter-change\", {\n detail: { value: this.filterText },\n composed: true,\n }),\n );\n this.debouncedRequestData(0);\n }\n\n private get isLazyLoadConfigured(): boolean {\n return !!this._onDataRequest;\n }\n\n /**\n * Used only when lazy loading is configured.\n */\n private debouncedRequestData = debounce(this.requestData.bind(this), 250);\n private requestData(page: number, filterChanged?: boolean) {\n if (filterChanged == null) {\n filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n }\n if (this.isLazyLoadConfigured) {\n if (!this.opened) {\n if (filterChanged) {\n this._dataProvider.items = [];\n this._itemCache = [];\n }\n return;\n }\n if (this._lastRequestedPage == page && !filterChanged) {\n return;\n }\n if (this._pendingDataRequest) {\n this._pendingDataRequest.cancel(ComboBox.DATA_REQUEST_CANCELLED);\n }\n const cancellationPromise = new Promise<DataResponse>((_resolve, reject) => {\n this._pendingDataRequest = { cancel: reject };\n });\n this._lastRequestedPage = page;\n this._lastRequestedFilterText = this.filterText;\n this.setAttribute(\"loading\", \"\");\n Promise.race([cancellationPromise, this._onDataRequest(this._lastRequestedFilterText, page)])\n .then((dataResponse) => {\n if (this.filterText == this._lastRequestedFilterText && this._lastRequestedPage == page) {\n this._dataProvider.finalSizeIsKnown = dataResponse.finalSizeIsKnown;\n if (filterChanged) {\n this._dataProvider.items = dataResponse.items;\n this._itemCache = dataResponse.items;\n } else {\n this._dataProvider.addItems(dataResponse.items);\n this._itemCache = this._dataProvider.items;\n }\n if (this._list) {\n this._list.itemCount = this._dataProvider.items.length;\n }\n if (this._popper && this.opened) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n const selectedItem = this.comboBoxValue.item;\n if (\n this._list.selectedIndices.length == 0 ||\n this.items[this._list.selectedIndices[0]] != selectedItem\n ) {\n let index = this.items.indexOf(selectedItem);\n if (index == -1) {\n const selectedId = selectedItem.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n this.comboBoxValue.index = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n }\n }\n this.updateDropdownSizes();\n this._popper.update();\n }\n }\n this._pendingDataRequest = null;\n this.removeAttribute(\"loading\");\n })\n .catch((e) => {\n if (e !== ComboBox.DATA_REQUEST_CANCELLED) {\n console.error(\n `Data could not be loaded for filter \"${this._lastRequestedFilterText}\" and page number \"${page}\" due to the following error:\\n${e}`,\n );\n this._dataProvider.finalSizeIsKnown = true;\n\n if (this.items.length == 0) {\n this.opened = false;\n } else if (this._list) {\n this._list.itemCount = this.items.length;\n }\n this.removeAttribute(\"loading\");\n }\n this._pendingDataRequest = null;\n });\n }\n }\n\n private get defaultSlot(): HTMLSlotElement {\n return this.shadowRoot.querySelector(\"#default-slot\");\n }\n\n private onDefaultSlotChange(): void {\n this._declarativeItems = this.defaultSlot.assignedElements() as HTMLElement[];\n if (this._declarativeItems.length > 0) {\n this.finalSizeIsKnown = true;\n this.itemGenerator = (_data, index) => {\n return this._declarativeItems[index].cloneNode(true) as HTMLElement;\n };\n this.items = this._declarativeItems.map((item) => {\n const data = {\n caption: item.getAttribute(\"caption\"),\n description: item.getAttribute(\"description\"),\n };\n if (\"caption\" != this.displayValuePath && \"description\" != this.displayValuePath) {\n data[this.displayValuePath] =\n item[this.displayValuePath] || item.getAttribute(this.displayValuePath);\n }\n return data;\n });\n }\n }\n}\n\nComboBox.ensureDefined();\n"],"names":["toggleSvg","clearSvg","TAG_NAME","debounce","func","delay","timeout","args","idCounter","_ComboBox","_a","SDInput","filterText","item","lowerCaseFilter","generator","event","selectedItem","ListDataProvider","value","items","onDataRequest","page","css","unsafeCSS","style","html","name","oldValue","newValue","changedProperties","selectedIndex","SelectionType","iconEl","ImageTools","clearButtonTemplate","toggleButtonTemplate","filteredInMemory","index","selectedId","VirtualList","comboBox","createPopper","state","placement","elementFromPoint","rect","filterChanged","focusedItem","offset","focusedListItem","immediate","effectiveFilterChange","overlayMaxHeight","comboBoxValue","e","cancellationPromise","_resolve","reject","dataResponse","_data","data","__decorateClass","property","ComboBox"],"mappings":";;;;;;;6mKAAAA,IAAe;AAAA;AAAA;AAAA,GCAfC,IAAe;AAAA;AAAA;AAAA;;;;;;ACQf,MAAMC,IAAW;AAEjB,SAASC,EAAYC,GAAiCC,GAA4B;AAC9E,MAAIC;AACJ,SAAO,YAAaC,GAAW;AAC3B,IAAID,KAAW,QACX,aAAaA,CAAO,GAExBA,IAAU,OAAO,W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;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,sBAAsB,YAAY,IAAM;AAAA,GAxB5DtD,EAyBV,WAAA,kBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,mBAAmB,YAAY,IAAM;AAAA,GA1BzDtD,EA2BV,WAAA,gBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,IAAM,SAAS,IAAM;AAAA,GA5BzCtD,EA6BV,WAAA,IAAA;AA7BX,IAAqBuD,IAArBvD;AAq9BAuD,EAAS,cAAA;"}
package/dist/docs/doc.mjs CHANGED
@@ -39,6 +39,10 @@ sd-combo-box.legacy-validation-layout {
39
39
  grid-template-columns: repeat(2, 1fr);
40
40
  column-gap: 16px;
41
41
  }
42
+
43
+ sd-combo-box[long-validation-message] {
44
+ max-width: 320px;
45
+ }
42
46
  `,on={mainContent:rn,description:nn,css:Ct},ln=Object.freeze(Object.defineProperty({__proto__:null,default:on},Symbol.toStringTag,{value:"Module"})),cn="modulepreload",mn=function(t,e){return new URL(t,e).href},ea={},Wt=function(e,i,a){let s=Promise.resolve();if(i&&i.length>0){let u=function(n){return Promise.all(n.map(m=>Promise.resolve(m).then(c=>({status:"fulfilled",value:c}),c=>({status:"rejected",reason:c}))))};const o=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");s=u(i.map(n=>{if(n=mn(n,a),n in ea)return;ea[n]=!0;const m=n.endsWith(".css"),c=m?'[rel="stylesheet"]':"";if(!!a)for(let p=o.length-1;p>=0;p--){const N=o[p];if(N.href===n&&(!m||N.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${c}`))return;const f=document.createElement("link");if(f.rel=m?"stylesheet":cn,m||(f.as="script"),f.crossOrigin="",f.href=n,h&&f.setAttribute("nonce",h),document.head.appendChild(f),m)return new Promise((p,N)=>{f.addEventListener("load",p),f.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${n}`)))})}))}function r(o){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=o,window.dispatchEvent(d),!d.defaultPrevented)throw o}return s.then(o=>{for(const d of o||[])d.status==="rejected"&&r(d.reason);return e().catch(r)})},dn=`<div class="grid-example-container" id="basic-examples-container">
43
47
  <sd-combo-box id="basic-combobox" label="I am a combo box" item-height="40" placeholder="-- select an option --">
44
48
  </sd-combo-box>
@@ -1310,7 +1314,7 @@ export default class DataProvider {
1310
1314
  { firstName: "Therese", lastName: "Janota" },
1311
1315
  { firstName: "Aaren", lastName: "Phair" },
1312
1316
  ];
1313
- `,En={mainContent:xn,description:wn,initializer:{content:Sn,type:"typescript",initialize:()=>Wt(()=>import("./4_lazy_loading.js"),[],import.meta.url)},css:Ct+_n,additionalSources:[{content:Cn,language:"typescript",label:"DataProvider",type:"source"},{content:An,language:"typescript",label:"Example data",type:"source"}]},kn=Object.freeze(Object.defineProperty({__proto__:null,default:En},Symbol.toStringTag,{value:"Module"})),Mn=`<div class="grid-example-container" id="unusual-data-examples">
1317
+ `,En={mainContent:xn,description:wn,initializer:{content:Sn,type:"typescript",initialize:()=>Wt(()=>import("./4_lazy_loading.js"),[],import.meta.url)},css:Ct+_n,additionalSources:[{content:Cn,language:"typescript",label:"DataProvider",type:"source"},{content:An,language:"typescript",label:"Example data",type:"source"}]},kn=Object.freeze(Object.defineProperty({__proto__:null,default:En},Symbol.toStringTag,{value:"Module"})),Mn=`<div class="grid-example-container" id="unusual-data-examples" style="max-width: 500px">
1314
1318
  <sd-combo-box
1315
1319
  id="long-prefixes-example"
1316
1320
  label="Long prefixes"
@@ -1486,7 +1490,7 @@ function updateMandatory(combobox: ComboBox) {
1486
1490
  </sd-field-validation-message>
1487
1491
  `}
1488
1492
  </div>
1489
- `}updated(t){super.updated(t),this._needsAutocompletedCheck&&!this.autocompleted&&setTimeout(()=>{try{this.autocompleted=this.autocompleted||!!this.shadowRoot.querySelector(":-webkit-autofill")}catch{}},0),this.rows>1&&((t.has("min")||t.has("max")||t.has("pattern"))&&console.warn("min, max & pattern attributes are not supported with multiple rows configuration."),this.type!="text"&&console.warn(`type: ${this.type} is not supported with multiple rows configuration.`))}update(t){if(super.update(t),t.has("validationMessage")&&(this.validationMessage?this._internals?.setValidity({customError:!0},this.validationMessage):this._internals?.setValidity(this.inputElement.validity,this.inputElement.validationMessage)),this._initialized&&t.has("rows"))throw Error("rows attribute cannot be changed after the input is attached to the DOM")}fireValueChange(t){this.dispatchEvent(new CustomEvent(`${t?"immediate-":""}value-change`,{detail:{value:this.value}})),this.setFormValue(this.value)}updateFormValidity(){if(this.validationMessage==null){this._internals.setValidity(this.inputElement.validity,this.inputElement.validationMessage);const t=this.shadowRoot.querySelector("sd-field-validation-message");this.requestUpdate("validationMessage",t==null?null:t.message)}}shouldFloat(){return this.alwaysFloatLabel||this.currentText||this.placeholder||this.autocompleted||this.type==="date"}setFormValue(t){this._internals?.setFormValue(t),this.updateFormValidity()}formResetCallback(){this.value=this._initialValue}formDisabledCallback(t){this.effectiveDisabled=t||this.hasAttribute("disabled")}formAssociatedCallback(t){this._needsAutocompletedCheck=!0}formStateRestoreCallback(t,e){typeof t=="string"&&(this.value=t)}},De.ID=wl,De.DEFAULT_MAX_LENGTH=524288,De.formAssociated=!0,De.shadowRootOptions={...We.shadowRootOptions,delegatesFocus:va},De);ie([B({type:String,reflect:!0})],ee.prototype,"label");ie([B({type:String,attribute:!0})],ee.prototype,"validationMessage");ie([B({type:String,attribute:!0})],ee.prototype,"validationIconSrc");ie([B({type:Ni,attribute:!0,reflect:!0})],ee.prototype,"validationLevel");ie([B({type:String,hasChanged(t,e){return e!=null&&e!=t}})],ee.prototype,"currentText");ie([B({type:Boolean,attribute:!0})],ee.prototype,"alwaysFloatLabel");ie([B({type:Boolean,attribute:!0})],ee.prototype,"autocompleted");ie([B({type:Number,attribute:!0})],ee.prototype,"rows");ie([B({type:Boolean,reflect:!0,attribute:"effective-disabled"})],ee.prototype,"effectiveDisabled");ie([B({type:Boolean,reflect:!0,attribute:"extended-prefix"})],ee.prototype,"extendedPrefix");ie([B({type:String,reflect:!0})],ee.prototype,"type");ie([B({type:String,reflect:!0})],ee.prototype,"placeholder");ie([B({type:String,reflect:!0})],ee.prototype,"sdAriaLabel");ie([B({type:Number,reflect:!0})],ee.prototype,"maxlength");ie([B({type:Boolean,reflect:!0})],ee.prototype,"readonly");ie([B({type:Boolean,reflect:!0})],ee.prototype,"required");ie([B({type:String,reflect:!0})],ee.prototype,"name");ie([B({type:Boolean,reflect:!0})],ee.prototype,"inactive");ie([B({type:String,attribute:!0})],ee.prototype,"autocomplete");ie([B({type:String,attribute:!0})],ee.prototype,"min");ie([B({type:String,attribute:!0})],ee.prototype,"max");ie([B({type:String,attribute:!0})],ee.prototype,"pattern");let hi=ee;customElements.get(hi.ID)||customElements.define(hi.ID,hi);const Ls={ATTRIBUTE:1,CHILD:2},ur=t=>(...e)=>({_$litDirective$:t,values:e});let hr=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,i,a){this._$Ct=e,this._$AM=i,this._$Ci=a}_$AS(e,i){return this.update(e,i)}update(e,i){return this.render(...i)}};class Ns extends hr{constructor(e){if(super(e),this.it=Y,e.type!==Ls.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Y||e==null)return this._t=void 0,this.it=e;if(e===dt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const i=[e];return i.raw=i,this._t={_$litType$:this.constructor.resultType,strings:i,values:[]}}}Ns.directiveName="unsafeHTML",Ns.resultType=1;const Sl=ur(Ns);const Cl=t=>t.strings===void 0;const Dt=(t,e)=>{const i=t._$AN;if(i===void 0)return!1;for(const a of i)a._$AO?.(e,!1),Dt(a,e);return!0},bi=t=>{let e,i;do{if((e=t._$AM)===void 0)break;i=e._$AN,i.delete(t),t=e}while(i?.size===0)},fr=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(i===void 0)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),kl(e)}};function Al(t){this._$AN!==void 0?(bi(this),this._$AM=t,fr(this)):this._$AM=t}function El(t,e=!1,i=0){const a=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(a))for(let r=i;r<a.length;r++)Dt(a[r],!1),bi(a[r]);else a!=null&&(Dt(a,!1),bi(a));else Dt(this,t)}const kl=t=>{t.type==Ls.CHILD&&(t._$AP??=El,t._$AQ??=Al)};let Ml=class extends hr{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,i,a){super._$AT(e,i,a),fr(this),this.isConnected=e._$AU}_$AO(e,i=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),i&&(Dt(this,e),bi(this))}setValue(e){if(Cl(this._$Ct))this._$Ct._$AI(e,this);else{const i=[...this._$Ct._$AH];i[this._$Ci]=e,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}};const bs=t=>t?t.startsWith("url")?t:`url("${t}")`:null,pr=(t,e)=>{if(t){const i=new Image;i.addEventListener("load",e),i.src=t,i.complete&&(i.removeEventListener("load",e),e())}};class Ol{static showImage(e,i,a,s){let r;s||!(e instanceof HTMLImageElement)?r=o=>e.style.backgroundImage=bs(o):r=o=>e.src=o,r(a),pr(i,()=>{r(i)})}}class Il extends Ml{constructor(e){if(super(e),e.type!==Ls.ATTRIBUTE||e.name!=="src"&&e.name!=="style")throw new Error("The `placeholder` directive must be used in the `src` or `style` attributes")}update(e,[i,a]){return this.useCssBackground=e.name=="style",this.render(i,a)}render(e,i){this.loadingToken!=null&&(this.loadingToken.cancelled=!0);const a={cancelled:!1};return this.loadingToken=a,typeof e=="string"?this.preload(e,a):e?.then(s=>{this.preload(s,a)}),this.useCssBackground?bs(i):i}preload(e,i){e!=null&&!i.cancelled&&pr(e,()=>{i.cancelled||this.setValue(this.useCssBackground?bs(e):e)})}}const Rl=ur(Il),$l=':host{display:block;contain:strict;height:50px}:host([selected]){background-color:#d3e6fa}:host(:not([selected]):hover),:host(:not([selected])[focused]){background-color:#e7f1fa}@media (forced-colors: active){:host([selected]){outline:4px solid}:host(:not([selected]):hover){outline:4px dotted}:host(:not([selected])[focused]){outline:4px dashed}}:host([enable-line-clamp]) .labels>:only-child{display:-webkit-box;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal;overflow-wrap:break-word}.container{display:flex;height:100%;box-sizing:border-box}.container .level-indicator{width:7px;height:100%}.container .level-indicator.level-0{background-color:#a0c3ef}.container .level-indicator.level-1{background-color:#e7c374}.container .level-indicator.level-2{background-color:#bfd596}.container .level-indicator.level-3{background-color:#fd998d}.container .level-indicator.level-4{background-color:#c6e8f5}.container .level-indicator.level-5{background-color:#fde3a4}.container .level-indicator.level-6{background-color:#dcbfe0}.side-content{display:flex;align-items:center;flex-grow:0}.labels{display:flex;flex-direction:column;justify-content:center;flex:1 1 0px;height:100%;line-height:normal;overflow:hidden;padding:var(--sd-list-item-label-content-padding, 0 8px)}.caption,.description{width:100%;font-family:var(--sd-list-item-font-family, "Segoe UI", "Lucida Sans", Arial, sans-serif);font-style:normal;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-webkit-user-select:none;user-select:none;text-decoration:var(--sd-list-item-text-decoration, inherit)}.caption em,.description em{font-weight:bolder}.caption{font-size:var(--sd-list-item-caption-font-size, 16px);color:var(--sd-list-item-caption-text-color, #111);font-weight:var(--sd-list-item-caption-font-weight, normal)}.description{font-size:var(--sd-list-item-description-font-size, 13px);color:var(--sd-list-item-description-text-color, #767676);font-weight:var(--sd-list-item-description-font-weight, normal)}.icon-wrapper{width:var(--sd-list-item-icon-wrapper-width, 45px);height:100%;display:flex;align-items:center;justify-content:center}.icon-wrapper .icon{min-height:var(--sd-list-item-icon-size, 24px);min-width:var(--sd-list-item-icon-size, 24px);background-repeat:no-repeat;background-position:center;background-size:cover}';var Ll=Object.defineProperty,Ne=(t,e,i,a)=>{for(var s=void 0,r=t.length-1,o;r>=0;r--)(o=t[r])&&(s=o(e,i,s)||s);return s&&Ll(e,i,s),s},ot;const he=(ot=class extends We{constructor(){super(...arguments),this.contentMode="text",this.role="option"}static get styles(){return[Gt`
1493
+ `}updated(t){super.updated(t),this._needsAutocompletedCheck&&!this.autocompleted&&setTimeout(()=>{try{this.autocompleted=this.autocompleted||!!this.shadowRoot.querySelector(":-webkit-autofill")}catch{}},0),this.rows>1&&((t.has("min")||t.has("max")||t.has("pattern"))&&console.warn("min, max & pattern attributes are not supported with multiple rows configuration."),this.type!="text"&&console.warn(`type: ${this.type} is not supported with multiple rows configuration.`))}update(t){if(super.update(t),t.has("validationMessage")&&(this.validationMessage?this._internals?.setValidity({customError:!0},this.validationMessage):this._internals?.setValidity(this.inputElement.validity,this.inputElement.validationMessage)),this._initialized&&t.has("rows"))throw Error("rows attribute cannot be changed after the input is attached to the DOM")}fireValueChange(t){this.dispatchEvent(new CustomEvent(`${t?"immediate-":""}value-change`,{detail:{value:this.value}})),this.setFormValue(this.value)}updateFormValidity(){if(this.validationMessage==null&&this.inputElement!=null){this._internals.setValidity(this.inputElement.validity,this.inputElement.validationMessage);const t=this.shadowRoot.querySelector("sd-field-validation-message");this.requestUpdate("validationMessage",t==null?null:t.message)}}shouldFloat(){return this.alwaysFloatLabel||this.currentText||this.placeholder||this.autocompleted||this.type==="date"}setFormValue(t){this._internals?.setFormValue(t),this.updateFormValidity()}formResetCallback(){this.value=this._initialValue}formDisabledCallback(t){this.effectiveDisabled=t||this.hasAttribute("disabled")}formAssociatedCallback(t){this._needsAutocompletedCheck=!0}formStateRestoreCallback(t,e){typeof t=="string"&&(this.value=t)}},De.ID=wl,De.DEFAULT_MAX_LENGTH=524288,De.formAssociated=!0,De.shadowRootOptions={...We.shadowRootOptions,delegatesFocus:va},De);ie([B({type:String,reflect:!0})],ee.prototype,"label");ie([B({type:String,attribute:!0})],ee.prototype,"validationMessage");ie([B({type:String,attribute:!0})],ee.prototype,"validationIconSrc");ie([B({type:Ni,attribute:!0,reflect:!0})],ee.prototype,"validationLevel");ie([B({type:String,hasChanged(t,e){return e!=null&&e!=t}})],ee.prototype,"currentText");ie([B({type:Boolean,attribute:!0})],ee.prototype,"alwaysFloatLabel");ie([B({type:Boolean,attribute:!0})],ee.prototype,"autocompleted");ie([B({type:Number,attribute:!0})],ee.prototype,"rows");ie([B({type:Boolean,reflect:!0,attribute:"effective-disabled"})],ee.prototype,"effectiveDisabled");ie([B({type:Boolean,reflect:!0,attribute:"extended-prefix"})],ee.prototype,"extendedPrefix");ie([B({type:String,reflect:!0})],ee.prototype,"type");ie([B({type:String,reflect:!0})],ee.prototype,"placeholder");ie([B({type:String,reflect:!0})],ee.prototype,"sdAriaLabel");ie([B({type:Number,reflect:!0})],ee.prototype,"maxlength");ie([B({type:Boolean,reflect:!0})],ee.prototype,"readonly");ie([B({type:Boolean,reflect:!0})],ee.prototype,"required");ie([B({type:String,reflect:!0})],ee.prototype,"name");ie([B({type:Boolean,reflect:!0})],ee.prototype,"inactive");ie([B({type:String,attribute:!0})],ee.prototype,"autocomplete");ie([B({type:String,attribute:!0})],ee.prototype,"min");ie([B({type:String,attribute:!0})],ee.prototype,"max");ie([B({type:String,attribute:!0})],ee.prototype,"pattern");let hi=ee;customElements.get(hi.ID)||customElements.define(hi.ID,hi);const Ls={ATTRIBUTE:1,CHILD:2},ur=t=>(...e)=>({_$litDirective$:t,values:e});let hr=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,i,a){this._$Ct=e,this._$AM=i,this._$Ci=a}_$AS(e,i){return this.update(e,i)}update(e,i){return this.render(...i)}};class Ns extends hr{constructor(e){if(super(e),this.it=Y,e.type!==Ls.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Y||e==null)return this._t=void 0,this.it=e;if(e===dt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const i=[e];return i.raw=i,this._t={_$litType$:this.constructor.resultType,strings:i,values:[]}}}Ns.directiveName="unsafeHTML",Ns.resultType=1;const Sl=ur(Ns);const Cl=t=>t.strings===void 0;const Dt=(t,e)=>{const i=t._$AN;if(i===void 0)return!1;for(const a of i)a._$AO?.(e,!1),Dt(a,e);return!0},bi=t=>{let e,i;do{if((e=t._$AM)===void 0)break;i=e._$AN,i.delete(t),t=e}while(i?.size===0)},fr=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(i===void 0)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),kl(e)}};function Al(t){this._$AN!==void 0?(bi(this),this._$AM=t,fr(this)):this._$AM=t}function El(t,e=!1,i=0){const a=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(a))for(let r=i;r<a.length;r++)Dt(a[r],!1),bi(a[r]);else a!=null&&(Dt(a,!1),bi(a));else Dt(this,t)}const kl=t=>{t.type==Ls.CHILD&&(t._$AP??=El,t._$AQ??=Al)};let Ml=class extends hr{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,i,a){super._$AT(e,i,a),fr(this),this.isConnected=e._$AU}_$AO(e,i=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),i&&(Dt(this,e),bi(this))}setValue(e){if(Cl(this._$Ct))this._$Ct._$AI(e,this);else{const i=[...this._$Ct._$AH];i[this._$Ci]=e,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}};const bs=t=>t?t.startsWith("url")?t:`url("${t}")`:null,pr=(t,e)=>{if(t){const i=new Image;i.addEventListener("load",e),i.src=t,i.complete&&(i.removeEventListener("load",e),window.queueMicrotask(()=>e()))}};class Ol{static showImage(e,i,a,s){let r;s||!(e instanceof HTMLImageElement)?r=o=>e.style.backgroundImage=bs(o):r=o=>e.src=o,r(a),pr(i,()=>{r(i)})}}class Il extends Ml{constructor(e){if(super(e),e.type!==Ls.ATTRIBUTE||e.name!=="src"&&e.name!=="style")throw new Error("The `placeholder` directive must be used in the `src` or `style` attributes")}update(e,[i,a]){return this.useCssBackground=e.name=="style",this.render(i,a)}render(e,i){this.loadingToken!=null&&(this.loadingToken.cancelled=!0);const a={cancelled:!1};return this.loadingToken=a,typeof e=="string"?this.preload(e,a):e?.then(s=>{this.preload(s,a)}),this.useCssBackground?bs(i):i}preload(e,i){e!=null&&!i.cancelled&&pr(e,()=>{i.cancelled||this.setValue(this.useCssBackground?bs(e):e)})}}const Rl=ur(Il),$l=':host{display:block;contain:strict;height:50px}:host([selected]){background-color:#d3e6fa}:host(:not([selected]):hover),:host(:not([selected])[focused]){background-color:#e7f1fa}@media (forced-colors: active){:host([selected]){outline:4px solid}:host(:not([selected]):hover){outline:4px dotted}:host(:not([selected])[focused]){outline:4px dashed}}:host([enable-line-clamp]) .labels>:only-child{display:-webkit-box;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal;overflow-wrap:break-word}.container{display:flex;height:100%;box-sizing:border-box}.container .level-indicator{width:7px;height:100%}.container .level-indicator.level-0{background-color:#a0c3ef}.container .level-indicator.level-1{background-color:#e7c374}.container .level-indicator.level-2{background-color:#bfd596}.container .level-indicator.level-3{background-color:#fd998d}.container .level-indicator.level-4{background-color:#c6e8f5}.container .level-indicator.level-5{background-color:#fde3a4}.container .level-indicator.level-6{background-color:#dcbfe0}.side-content{display:flex;align-items:center;flex-grow:0}.labels{display:flex;flex-direction:column;justify-content:center;flex:1 1 0px;height:100%;line-height:normal;overflow:hidden;padding:var(--sd-list-item-label-content-padding, 0 8px)}.caption,.description{width:100%;font-family:var(--sd-list-item-font-family, "Segoe UI", "Lucida Sans", Arial, sans-serif);font-style:normal;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-webkit-user-select:none;user-select:none;text-decoration:var(--sd-list-item-text-decoration, inherit)}.caption em,.description em{font-weight:bolder}.caption{font-size:var(--sd-list-item-caption-font-size, 16px);color:var(--sd-list-item-caption-text-color, #111);font-weight:var(--sd-list-item-caption-font-weight, normal)}.description{font-size:var(--sd-list-item-description-font-size, 13px);color:var(--sd-list-item-description-text-color, #767676);font-weight:var(--sd-list-item-description-font-weight, normal)}.icon-wrapper{width:var(--sd-list-item-icon-wrapper-width, 45px);height:100%;display:flex;align-items:center;justify-content:center}.icon-wrapper .icon{min-height:var(--sd-list-item-icon-size, 24px);min-width:var(--sd-list-item-icon-size, 24px);background-repeat:no-repeat;background-position:center;background-size:cover}';var Ll=Object.defineProperty,Ne=(t,e,i,a)=>{for(var s=void 0,r=t.length-1,o;r>=0;r--)(o=t[r])&&(s=o(e,i,s)||s);return s&&Ll(e,i,s),s},ot;const he=(ot=class extends We{constructor(){super(...arguments),this.contentMode="text",this.role="option"}static get styles(){return[Gt`
1490
1494
  ${At($l)}
1491
1495
  `]}render(){return be`
1492
1496
  <div class="container">
@@ -1528,7 +1532,7 @@ function updateMandatory(combobox: ComboBox) {
1528
1532
  `,ql=`<svg xmlns="http://www.w3.org/2000/svg" class="clear-button" slot="suffix" viewBox="0 0 16 16">\r
1529
1533
  <path d="M12.96 4.46l-1.42-1.42-3.54 3.55-3.54-3.55-1.42 1.42 3.55 3.54-3.55 3.54 1.42 1.42 3.54-3.55 3.54 3.55 1.42-1.42-3.55-3.54 3.55-3.54z"/>\r
1530
1534
  </svg>\r
1531
- `;var Ul=Object.defineProperty,Je=(t,e,i,a)=>{for(var s=void 0,r=t.length-1,o;r>=0;r--)(o=t[r])&&(s=o(e,i,s)||s);return s&&Ul(e,i,s),s};const Wl="sd-combo-box";function xa(t,e){let i;return function(...a){i!=null&&clearTimeout(i),i=window.setTimeout(()=>t(...a),e)}}let Gl=0;var ge;const Ve=(ge=class extends hi{constructor(){super(),this.opened=!1,this.itemHeight=50,this.displayValuePath="caption",this.id=ge.ID+"_"+Gl++,this.inMemoryFilter=(e,i)=>{if(!e)return!0;const a=e.toLowerCase();return!!(typeof i.caption=="string"&&i.caption.toLowerCase().includes(a)||typeof i.description=="string"&&i.description.toLowerCase().includes(a))},this.minimumOverlayWidth=250,this._itemGenerator=gr,this._itemCache=[],this.debouncedFilterItemsInMemory=xa(this.filterItemsInMemory.bind(this),200),this.handleSelection=e=>{const i=this._dataProvider.items[e.detail.index];e.detail.selected||(this._list.selectedIndices=[e.detail.index]),this.comboBoxValue={index:this._itemCache.indexOf(i),item:i},this.dispatchSelectionChangeEvent(),this.opened=!1},this.handleWindowPointerDown=e=>{!(e.target instanceof Node&&this.contains(e.target))&&this.opened&&e.composedPath().indexOf(this._list)===-1&&(this.triggerOnly&&(this.value=null),this.opened=!1)},this.handleKeyDown=e=>{switch(e.key){case"Down":case"ArrowDown":{e.preventDefault(),this.navigateInList(1);break}case"Up":case"ArrowUp":{e.preventDefault(),this.navigateInList(-1);break}case"Enter":{this.opened&&(e.preventDefault(),e.stopPropagation(),this.opened=!1);break}case"Escape":{this.opened&&(e.preventDefault(),e.stopPropagation(),this._list.selectedIndices.indexOf(this._list.focusIndex)>-1&&this._dataProvider.items.length>this._list.focusIndex?this.opened=!1:(this.clearFilter(),this.updateInputValue(null),this.updateFocusAndSelectedIndexFromValue(),this._list.selectedIndices.includes(this._list.focusIndex)||this._list.selectedIndices.push(this._list.focusIndex)));break}case"Tab":{this.opened&&(this.triggerOnly&&(this.value=null),this.opened=!1);break}}},this.debouncedRequestData=xa(this.requestData.bind(this),250),this._dataProvider=new Tl,this._dataProvider.finalSizeIsKnown=!0}get clearFilterOnLazyLoadedSelection(){return this.triggerOnly}set clearFilterOnLazyLoadedSelection(e){console.warn("Using clearFilterOnLazyLoadedSelection setting on a combo-box is deprecated. Use triggerOnly instead."),this.triggerOnly=e}get itemGenerator(){return this._itemGenerator}set itemGenerator(e){this._itemGenerator=e,this._list&&(this._list.itemGenerator=this._itemGenerator)}get items(){return this._itemCache}set items(e){this._itemCache=e,this.isLazyLoadConfigured&&(this._dataProvider.items=e,this._lastRequestedPage=null),this.value&&!this.comboBoxValue&&this.updateComboBoxValueFromValue(),this.filterItemsInMemory(),this.opened&&this._popper&&this._popper.update()}get finalSizeIsKnown(){return this._dataProvider.finalSizeIsKnown}set finalSizeIsKnown(e){this._dataProvider.finalSizeIsKnown=e}configureLazyLoad(e){if(!e)throw new Error("It is not possible to configure lazy load without a given onDataRequest calback.");this._dataProvider.finalSizeIsKnown=!1,this._onDataRequest=e,this._dataProvider.onDataRequest=i=>{this.requestData(i,!1)}}get comboBoxValue(){return this._comboBoxValue}set comboBoxValue(e){this._comboBoxValue=e,this.updateInputValue(null),this.updateHasValue()}get selectedIndex(){return this.isCustomValue(this.comboBoxValue)||!this.comboBoxValue?-1:this.comboBoxValue.index}get displayValue(){return this.value}open(){this.opened=!0}static get styles(){return[Gt`
1535
+ `;var Ul=Object.defineProperty,Je=(t,e,i,a)=>{for(var s=void 0,r=t.length-1,o;r>=0;r--)(o=t[r])&&(s=o(e,i,s)||s);return s&&Ul(e,i,s),s};const Wl="sd-combo-box";function xa(t,e){let i;return function(...a){i!=null&&clearTimeout(i),i=window.setTimeout(()=>t(...a),e)}}let Gl=0;var ge;const Ve=(ge=class extends hi{constructor(){super(),this.opened=!1,this.itemHeight=50,this.displayValuePath="caption",this.id=ge.ID+"_"+Gl++,this.inMemoryFilter=(e,i)=>{if(!e)return!0;const a=e.toLowerCase();return!!(typeof i.caption=="string"&&i.caption.toLowerCase().includes(a)||typeof i.description=="string"&&i.description.toLowerCase().includes(a))},this.minimumOverlayWidth=250,this._itemGenerator=gr,this._itemCache=[],this.debouncedFilterItemsInMemory=xa(this.filterItemsInMemory.bind(this),200),this.handleSelection=e=>{const i=this._dataProvider.items[e.detail.index];e.detail.selected||(this._list.selectedIndices=[e.detail.index]),this.comboBoxValue={index:this._itemCache.indexOf(i),item:i},this.dispatchSelectionChangeEvent(),this.focus(),this.opened=!1},this.handleWindowPointerDown=e=>{!(e.target instanceof Node&&this.contains(e.target))&&this.opened&&e.composedPath().indexOf(this._list)===-1&&(this.triggerOnly&&(this.value=null),this.opened=!1)},this.handleKeyDown=e=>{switch(e.key){case"Down":case"ArrowDown":{e.preventDefault(),this.navigateInList(1);break}case"Up":case"ArrowUp":{e.preventDefault(),this.navigateInList(-1);break}case"Enter":{this.opened&&(e.preventDefault(),e.stopPropagation(),this.opened=!1);break}case"Escape":{this.opened&&(e.preventDefault(),e.stopPropagation(),this._list.selectedIndices.indexOf(this._list.focusIndex)>-1&&this._dataProvider.items.length>this._list.focusIndex?this.opened=!1:(this.clearFilter(),this.updateInputValue(null),this.updateFocusAndSelectedIndexFromValue(),this._list.selectedIndices.includes(this._list.focusIndex)||this._list.selectedIndices.push(this._list.focusIndex)));break}case"Tab":{this.opened&&(this.triggerOnly&&(this.value=null),this.opened=!1);break}}},this.debouncedRequestData=xa(this.requestData.bind(this),250),this._dataProvider=new Tl,this._dataProvider.finalSizeIsKnown=!0}get clearFilterOnLazyLoadedSelection(){return this.triggerOnly}set clearFilterOnLazyLoadedSelection(e){console.warn("Using clearFilterOnLazyLoadedSelection setting on a combo-box is deprecated. Use triggerOnly instead."),this.triggerOnly=e}get itemGenerator(){return this._itemGenerator}set itemGenerator(e){this._itemGenerator=e,this._list&&(this._list.itemGenerator=this._itemGenerator)}get items(){return this._itemCache}set items(e){this._itemCache=e,this.isLazyLoadConfigured&&(this._dataProvider.items=e,this._lastRequestedPage=null),this.value&&!this.comboBoxValue&&this.updateComboBoxValueFromValue(),this.filterItemsInMemory(),this.opened&&this._popper&&this._popper.update()}get finalSizeIsKnown(){return this._dataProvider.finalSizeIsKnown}set finalSizeIsKnown(e){this._dataProvider.finalSizeIsKnown=e}configureLazyLoad(e){if(!e)throw new Error("It is not possible to configure lazy load without a given onDataRequest calback.");this._dataProvider.finalSizeIsKnown=!1,this._onDataRequest=e,this._dataProvider.onDataRequest=i=>{this.requestData(i,!1)}}get comboBoxValue(){return this._comboBoxValue}set comboBoxValue(e){this._comboBoxValue=e,this.updateInputValue(null),this.updateHasValue()}get selectedIndex(){return this.isCustomValue(this.comboBoxValue)||!this.comboBoxValue?-1:this.comboBoxValue.index}get displayValue(){return this.value}open(){this.opened=!0}static get styles(){return[Gt`
1532
1536
  ${At(Fl)}
1533
1537
  `]}disconnectedCallback(){super.disconnectedCallback(),this._popper&&(this._popper.destroy(),this._popper=null)}render(){return be`
1534
1538
  ${super.render()}
@@ -64,6 +64,11 @@
64
64
  "repository": "https://github.com/cypress-io/cypress",
65
65
  "licenseUrl": "https://cypress.io"
66
66
  },
67
+ "d3-color@3.1.0": {
68
+ "licenses": "ISC",
69
+ "repository": "https://github.com/d3/d3-color",
70
+ "licenseUrl": "https://github.com/d3/d3-color/raw/HEAD/LICENSE"
71
+ },
67
72
  "esbuild@0.25.9": {
68
73
  "licenses": "MIT",
69
74
  "repository": "https://github.com/evanw/esbuild",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cas-smartdesign/combo-box",
3
- "version": "7.5.1",
3
+ "version": "7.5.3",
4
4
  "description": "A combo-box element with the look and feel of the SmartDesign inputs & list item layouts",
5
5
  "main": "dist/combo-box-with-externals.js",
6
6
  "module": "dist/combo-box.mjs",
@@ -9,15 +9,15 @@
9
9
  "dependencies": {
10
10
  "@popperjs/core": "^2.11.8",
11
11
  "lit": "^3.3.1",
12
- "@cas-smartdesign/image-tools": "^3.2.0",
13
- "@cas-smartdesign/lit-input": "^7.4.1",
14
- "@cas-smartdesign/list-item": "^7.4.0",
12
+ "@cas-smartdesign/image-tools": "^3.2.1",
13
+ "@cas-smartdesign/list-item": "^7.4.1",
14
+ "@cas-smartdesign/lit-input": "^7.4.2",
15
15
  "@cas-smartdesign/virtual-list": "^6.3.0"
16
16
  },
17
17
  "devDependencies": {
18
+ "@cas-smartdesign/field-validation-message": "^5.1.0",
18
19
  "@cas-smartdesign/element-preview": "^0.3.0",
19
20
  "@cas-smartdesign/license-generator": "^1.7.0",
20
- "@cas-smartdesign/field-validation-message": "^5.1.0",
21
21
  "@cas-smartdesign/styles": "^3.7.0"
22
22
  },
23
23
  "files": [