@govtechsg/sgds-web-component 3.29.0 → 3.29.1-rc.0
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.
- package/base/dropdown-list-element.d.ts +3 -3
- package/base/dropdown-list-element.js.map +1 -1
- package/components/Appnav/index.umd.min.js.map +1 -1
- package/components/Breadcrumb/index.umd.min.js.map +1 -1
- package/components/ComboBox/combo-box.js +1 -1
- package/components/ComboBox/combo-box.js.map +1 -1
- package/components/ComboBox/index.umd.min.js +28 -19
- package/components/ComboBox/index.umd.min.js.map +1 -1
- package/components/ComboBox/sgds-combo-box.d.ts +23 -2
- package/components/ComboBox/sgds-combo-box.js +95 -4
- package/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/components/ComboBox/types.d.ts +3 -0
- package/components/Dropdown/index.umd.min.js.map +1 -1
- package/components/Mainnav/index.umd.min.js.map +1 -1
- package/components/OverflowMenu/index.umd.min.js.map +1 -1
- package/components/Select/index.umd.min.js.map +1 -1
- package/components/index.umd.min.js +14 -5
- package/components/index.umd.min.js.map +1 -1
- package/custom-elements.json +155 -34
- package/index.umd.min.js +711 -702
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/react/base/dropdown-list-element.cjs.js.map +1 -1
- package/react/base/dropdown-list-element.js.map +1 -1
- package/react/combo-box/index.cjs.js +1 -0
- package/react/combo-box/index.cjs.js.map +1 -1
- package/react/combo-box/index.js +1 -0
- package/react/combo-box/index.js.map +1 -1
- package/react/components/ComboBox/combo-box.cjs.js +1 -1
- package/react/components/ComboBox/combo-box.cjs.js.map +1 -1
- package/react/components/ComboBox/combo-box.js +1 -1
- package/react/components/ComboBox/combo-box.js.map +1 -1
- package/react/components/ComboBox/sgds-combo-box.cjs.js +95 -4
- package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
- package/react/components/ComboBox/sgds-combo-box.js +95 -4
- package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/types/react.d.ts +7 -0
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-list-element.cjs.js","names":["DropdownElement","query","state","property"],"sources":["../../../src/base/dropdown-list-element.ts"],"sourcesContent":["import { property, query, state } from \"lit/decorators.js\";\nimport { DropdownElement } from \"./dropdown-element\";\nimport { SgdsDropdownItem } from \"../components\";\nimport { PropertyValueMap } from \"lit\";\n\nconst TAB = \"Tab\";\nconst ARROW_DOWN = \"ArrowDown\";\nconst ARROW_UP = \"ArrowUp\";\nconst ENTER = \"Enter\";\nconst ESCAPE = \"Escape\";\n\n/**\n * @event sgds-select - Emitted when a dropdown item is selected. `event.detail.item` is the clicked `SgdsDropdownItem` element.\n */\nexport class DropdownListElement extends DropdownElement {\n static styles = DropdownElement.styles;\n\n /**@internal */\n @query(\"ul.dropdown-menu\")\n private menu: HTMLUListElement;\n\n /** @internal */\n @state()\n nextDropdownItemNo = 0;\n\n /** @internal */\n @state()\n prevDropdownItemNo = -1;\n\n @property({ type: Boolean, reflect: true })\n hidden = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\"sgds-hide\", this._resetMenu);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"sgds-hide\", this._resetMenu);\n }\n\n firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n this.addEventListener(\"keydown\", this._handleKeyboardMenuItemsEvent);\n }\n\n protected handleSelectSlot(e: KeyboardEvent | MouseEvent) {\n const items = this._getActiveMenuItems();\n\n const selectedItem = items.find(item => e.composedPath().includes(item));\n if (!selectedItem) return;\n\n const currentItemNo = items.indexOf(selectedItem);\n this.nextDropdownItemNo = currentItemNo + 1;\n this.prevDropdownItemNo = currentItemNo <= 0 ? items.length - 1 : currentItemNo - 1;\n\n /** Emitted event from SgdsDropdown element when a slot item is selected */\n if (!selectedItem.disabled) {\n this.emit(\"sgds-select\", { detail: { item: selectedItem } });\n if (this.close !== \"outside\") {\n this.hideMenu(); // <-- Use new API\n }\n }\n }\n\n private _resetMenu() {\n this.nextDropdownItemNo = 0;\n this.prevDropdownItemNo = -1;\n // reset the tabindex\n const items = this._getMenuItems();\n items.forEach(item => {\n const dropdownItem = item?.shadowRoot?.querySelector(\".dropdown-item\") as HTMLAnchorElement;\n dropdownItem && dropdownItem.removeAttribute(\"tabindex\");\n });\n }\n protected _handleKeyboardMenuItemsEvent(e: KeyboardEvent) {\n if (this.readonly) return;\n const menuItems = this._getActiveMenuItems();\n if (menuItems.length === 0) return;\n\n switch (e.key) {\n case ARROW_DOWN:\n e.preventDefault();\n this._setMenuItem(this.nextDropdownItemNo);\n break;\n case ARROW_UP:\n e.preventDefault();\n this._setMenuItem(this.prevDropdownItemNo);\n break;\n case TAB:\n if (!this.menuIsOpen) return;\n e.preventDefault();\n if (e.shiftKey) {\n this._setMenuItem(this.prevDropdownItemNo);\n } else {\n this._setMenuItem(this.nextDropdownItemNo);\n }\n break;\n case ESCAPE:\n if (this.menuIsOpen) {\n e.preventDefault();\n this.hideMenu();\n }\n break;\n case ENTER: {\n const target = menuItems.find(item => e.composedPath().includes(item));\n if (target) {\n this.handleSelectSlot(e);\n }\n break;\n }\n default:\n break;\n }\n }\n\n
|
|
1
|
+
{"version":3,"file":"dropdown-list-element.cjs.js","names":["DropdownElement","query","state","property"],"sources":["../../../src/base/dropdown-list-element.ts"],"sourcesContent":["import { property, query, state } from \"lit/decorators.js\";\nimport { DropdownElement } from \"./dropdown-element\";\nimport { SgdsDropdownItem } from \"../components\";\nimport { PropertyValueMap } from \"lit\";\n\nconst TAB = \"Tab\";\nconst ARROW_DOWN = \"ArrowDown\";\nconst ARROW_UP = \"ArrowUp\";\nconst ENTER = \"Enter\";\nconst ESCAPE = \"Escape\";\n\n/**\n * @event sgds-select - Emitted when a dropdown item is selected. `event.detail.item` is the clicked `SgdsDropdownItem` element.\n */\nexport class DropdownListElement extends DropdownElement {\n static styles = DropdownElement.styles;\n\n /**@internal */\n @query(\"ul.dropdown-menu\")\n private menu: HTMLUListElement;\n\n /** @internal */\n @state()\n nextDropdownItemNo = 0;\n\n /** @internal */\n @state()\n prevDropdownItemNo = -1;\n\n @property({ type: Boolean, reflect: true })\n hidden = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\"sgds-hide\", this._resetMenu);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"sgds-hide\", this._resetMenu);\n }\n\n firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n this.addEventListener(\"keydown\", this._handleKeyboardMenuItemsEvent);\n }\n\n protected handleSelectSlot(e: KeyboardEvent | MouseEvent) {\n const items = this._getActiveMenuItems();\n\n const selectedItem = items.find(item => e.composedPath().includes(item));\n if (!selectedItem) return;\n\n const currentItemNo = items.indexOf(selectedItem);\n this.nextDropdownItemNo = currentItemNo + 1;\n this.prevDropdownItemNo = currentItemNo <= 0 ? items.length - 1 : currentItemNo - 1;\n\n /** Emitted event from SgdsDropdown element when a slot item is selected */\n if (!selectedItem.disabled) {\n this.emit(\"sgds-select\", { detail: { item: selectedItem } });\n if (this.close !== \"outside\") {\n this.hideMenu(); // <-- Use new API\n }\n }\n }\n\n private _resetMenu() {\n this.nextDropdownItemNo = 0;\n this.prevDropdownItemNo = -1;\n // reset the tabindex\n const items = this._getMenuItems();\n items.forEach(item => {\n const dropdownItem = item?.shadowRoot?.querySelector(\".dropdown-item\") as HTMLAnchorElement;\n dropdownItem && dropdownItem.removeAttribute(\"tabindex\");\n });\n }\n protected _handleKeyboardMenuItemsEvent(e: KeyboardEvent) {\n if (this.readonly) return;\n const menuItems = this._getActiveMenuItems();\n if (menuItems.length === 0) return;\n\n switch (e.key) {\n case ARROW_DOWN:\n e.preventDefault();\n this._setMenuItem(this.nextDropdownItemNo);\n break;\n case ARROW_UP:\n e.preventDefault();\n this._setMenuItem(this.prevDropdownItemNo);\n break;\n case TAB:\n if (!this.menuIsOpen) return;\n e.preventDefault();\n if (e.shiftKey) {\n this._setMenuItem(this.prevDropdownItemNo);\n } else {\n this._setMenuItem(this.nextDropdownItemNo);\n }\n break;\n case ESCAPE:\n if (this.menuIsOpen) {\n e.preventDefault();\n this.hideMenu();\n }\n break;\n case ENTER: {\n const target = menuItems.find(item => e.composedPath().includes(item));\n if (target) {\n this.handleSelectSlot(e);\n }\n break;\n }\n default:\n break;\n }\n }\n\n protected _getMenuItems(): SgdsDropdownItem[] {\n const defaultSlot = this.shadowRoot.querySelector(\"slot#default\");\n // for case when default slot is used e.g. dropdown, mainnavdropdown\n if (defaultSlot) {\n const defaultSlotItems = (this.shadowRoot.querySelector(\"slot#default\") as HTMLSlotElement)\n ?.assignedElements({\n flatten: true\n })\n .filter(\n el =>\n el.getAttribute(\"role\") === \"menuitem\" && !el.classList.contains(\"empty-menu\") && !el.hasAttribute(\"hidden\")\n ) as SgdsDropdownItem[];\n return defaultSlotItems;\n }\n // for case when there is no slot e.g. combobox\n if (this.menu?.hasChildNodes()) {\n const menuItems = Array.from(this.menu.children);\n return [...menuItems] as SgdsDropdownItem[];\n }\n\n return [];\n }\n\n protected _getActiveMenuItems(): SgdsDropdownItem[] {\n return this._getMenuItems().filter(item => !item.disabled && !item.hidden && !item.readonly);\n }\n protected _setMenuItem(currentItemIdx: number) {\n const items = this._getActiveMenuItems();\n if (items.length === 0) return;\n\n // Use modulo for looping\n const idx = ((currentItemIdx % items.length) + items.length) % items.length;\n const activeItem = items[idx];\n this.emit(\"i-sgds-option-focus\", { detail: { option: activeItem } });\n this.nextDropdownItemNo = (idx + 1) % items.length;\n this.prevDropdownItemNo = (idx - 1 + items.length) % items.length;\n\n items.forEach(item => {\n const dropdownItem = item.shadowRoot.querySelector(\".dropdown-item\") as HTMLAnchorElement;\n dropdownItem.setAttribute(\"tabindex\", item === activeItem ? \"0\" : \"-1\");\n if (item === activeItem) dropdownItem.focus();\n });\n }\n}\n\nexport interface IDropdownListElement {\n item: SgdsDropdownItem;\n}\n"],"mappings":";;;;;AAKA,MAAM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,WAAW,EAAE,CAAC;EACnE,KAAK,sBAAsB,MAAM,KAAK,MAAM;EAC5C,KAAK,sBAAsB,MAAM,IAAI,MAAM,UAAU,MAAM;EAE3D,MAAM,SAAQ,SAAQ;GACpB,MAAM,eAAe,KAAK,WAAW,cAAc,gBAAgB;GACnE,aAAa,aAAa,YAAY,SAAS,aAAa,MAAM,IAAI;GACtE,IAAI,SAAS,YAAY,aAAa,MAAM;EAC9C,CAAC;CACH;AACF;AA9IGC,iBAAAA,QAAAA,EAAAA,GAAAA,kBAAAA,MAAAA,CAAM,kBAAkB,CAAA,GAAA,oBAAA,WAAA,QAAA,KAAA,CAAA;AAIxBC,iBAAAA,QAAAA,EAAAA,GAAAA,kBAAAA,MAAAA,CAAM,CAAA,GAAA,oBAAA,WAAA,sBAAA,KAAA,CAAA;AAINA,iBAAAA,QAAAA,EAAAA,GAAAA,kBAAAA,MAAAA,CAAM,CAAA,GAAA,oBAAA,WAAA,sBAAA,KAAA,CAAA;AAGNC,iBAAAA,QAAAA,EAAAA,GAAAA,kBAAAA,SAAAA,CAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,oBAAA,WAAA,UAAA,KAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-list-element.js","names":[],"sources":["../../../src/base/dropdown-list-element.ts"],"sourcesContent":["import { property, query, state } from \"lit/decorators.js\";\nimport { DropdownElement } from \"./dropdown-element\";\nimport { SgdsDropdownItem } from \"../components\";\nimport { PropertyValueMap } from \"lit\";\n\nconst TAB = \"Tab\";\nconst ARROW_DOWN = \"ArrowDown\";\nconst ARROW_UP = \"ArrowUp\";\nconst ENTER = \"Enter\";\nconst ESCAPE = \"Escape\";\n\n/**\n * @event sgds-select - Emitted when a dropdown item is selected. `event.detail.item` is the clicked `SgdsDropdownItem` element.\n */\nexport class DropdownListElement extends DropdownElement {\n static styles = DropdownElement.styles;\n\n /**@internal */\n @query(\"ul.dropdown-menu\")\n private menu: HTMLUListElement;\n\n /** @internal */\n @state()\n nextDropdownItemNo = 0;\n\n /** @internal */\n @state()\n prevDropdownItemNo = -1;\n\n @property({ type: Boolean, reflect: true })\n hidden = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\"sgds-hide\", this._resetMenu);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"sgds-hide\", this._resetMenu);\n }\n\n firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n this.addEventListener(\"keydown\", this._handleKeyboardMenuItemsEvent);\n }\n\n protected handleSelectSlot(e: KeyboardEvent | MouseEvent) {\n const items = this._getActiveMenuItems();\n\n const selectedItem = items.find(item => e.composedPath().includes(item));\n if (!selectedItem) return;\n\n const currentItemNo = items.indexOf(selectedItem);\n this.nextDropdownItemNo = currentItemNo + 1;\n this.prevDropdownItemNo = currentItemNo <= 0 ? items.length - 1 : currentItemNo - 1;\n\n /** Emitted event from SgdsDropdown element when a slot item is selected */\n if (!selectedItem.disabled) {\n this.emit(\"sgds-select\", { detail: { item: selectedItem } });\n if (this.close !== \"outside\") {\n this.hideMenu(); // <-- Use new API\n }\n }\n }\n\n private _resetMenu() {\n this.nextDropdownItemNo = 0;\n this.prevDropdownItemNo = -1;\n // reset the tabindex\n const items = this._getMenuItems();\n items.forEach(item => {\n const dropdownItem = item?.shadowRoot?.querySelector(\".dropdown-item\") as HTMLAnchorElement;\n dropdownItem && dropdownItem.removeAttribute(\"tabindex\");\n });\n }\n protected _handleKeyboardMenuItemsEvent(e: KeyboardEvent) {\n if (this.readonly) return;\n const menuItems = this._getActiveMenuItems();\n if (menuItems.length === 0) return;\n\n switch (e.key) {\n case ARROW_DOWN:\n e.preventDefault();\n this._setMenuItem(this.nextDropdownItemNo);\n break;\n case ARROW_UP:\n e.preventDefault();\n this._setMenuItem(this.prevDropdownItemNo);\n break;\n case TAB:\n if (!this.menuIsOpen) return;\n e.preventDefault();\n if (e.shiftKey) {\n this._setMenuItem(this.prevDropdownItemNo);\n } else {\n this._setMenuItem(this.nextDropdownItemNo);\n }\n break;\n case ESCAPE:\n if (this.menuIsOpen) {\n e.preventDefault();\n this.hideMenu();\n }\n break;\n case ENTER: {\n const target = menuItems.find(item => e.composedPath().includes(item));\n if (target) {\n this.handleSelectSlot(e);\n }\n break;\n }\n default:\n break;\n }\n }\n\n
|
|
1
|
+
{"version":3,"file":"dropdown-list-element.js","names":[],"sources":["../../../src/base/dropdown-list-element.ts"],"sourcesContent":["import { property, query, state } from \"lit/decorators.js\";\nimport { DropdownElement } from \"./dropdown-element\";\nimport { SgdsDropdownItem } from \"../components\";\nimport { PropertyValueMap } from \"lit\";\n\nconst TAB = \"Tab\";\nconst ARROW_DOWN = \"ArrowDown\";\nconst ARROW_UP = \"ArrowUp\";\nconst ENTER = \"Enter\";\nconst ESCAPE = \"Escape\";\n\n/**\n * @event sgds-select - Emitted when a dropdown item is selected. `event.detail.item` is the clicked `SgdsDropdownItem` element.\n */\nexport class DropdownListElement extends DropdownElement {\n static styles = DropdownElement.styles;\n\n /**@internal */\n @query(\"ul.dropdown-menu\")\n private menu: HTMLUListElement;\n\n /** @internal */\n @state()\n nextDropdownItemNo = 0;\n\n /** @internal */\n @state()\n prevDropdownItemNo = -1;\n\n @property({ type: Boolean, reflect: true })\n hidden = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener(\"sgds-hide\", this._resetMenu);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"sgds-hide\", this._resetMenu);\n }\n\n firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n this.addEventListener(\"keydown\", this._handleKeyboardMenuItemsEvent);\n }\n\n protected handleSelectSlot(e: KeyboardEvent | MouseEvent) {\n const items = this._getActiveMenuItems();\n\n const selectedItem = items.find(item => e.composedPath().includes(item));\n if (!selectedItem) return;\n\n const currentItemNo = items.indexOf(selectedItem);\n this.nextDropdownItemNo = currentItemNo + 1;\n this.prevDropdownItemNo = currentItemNo <= 0 ? items.length - 1 : currentItemNo - 1;\n\n /** Emitted event from SgdsDropdown element when a slot item is selected */\n if (!selectedItem.disabled) {\n this.emit(\"sgds-select\", { detail: { item: selectedItem } });\n if (this.close !== \"outside\") {\n this.hideMenu(); // <-- Use new API\n }\n }\n }\n\n private _resetMenu() {\n this.nextDropdownItemNo = 0;\n this.prevDropdownItemNo = -1;\n // reset the tabindex\n const items = this._getMenuItems();\n items.forEach(item => {\n const dropdownItem = item?.shadowRoot?.querySelector(\".dropdown-item\") as HTMLAnchorElement;\n dropdownItem && dropdownItem.removeAttribute(\"tabindex\");\n });\n }\n protected _handleKeyboardMenuItemsEvent(e: KeyboardEvent) {\n if (this.readonly) return;\n const menuItems = this._getActiveMenuItems();\n if (menuItems.length === 0) return;\n\n switch (e.key) {\n case ARROW_DOWN:\n e.preventDefault();\n this._setMenuItem(this.nextDropdownItemNo);\n break;\n case ARROW_UP:\n e.preventDefault();\n this._setMenuItem(this.prevDropdownItemNo);\n break;\n case TAB:\n if (!this.menuIsOpen) return;\n e.preventDefault();\n if (e.shiftKey) {\n this._setMenuItem(this.prevDropdownItemNo);\n } else {\n this._setMenuItem(this.nextDropdownItemNo);\n }\n break;\n case ESCAPE:\n if (this.menuIsOpen) {\n e.preventDefault();\n this.hideMenu();\n }\n break;\n case ENTER: {\n const target = menuItems.find(item => e.composedPath().includes(item));\n if (target) {\n this.handleSelectSlot(e);\n }\n break;\n }\n default:\n break;\n }\n }\n\n protected _getMenuItems(): SgdsDropdownItem[] {\n const defaultSlot = this.shadowRoot.querySelector(\"slot#default\");\n // for case when default slot is used e.g. dropdown, mainnavdropdown\n if (defaultSlot) {\n const defaultSlotItems = (this.shadowRoot.querySelector(\"slot#default\") as HTMLSlotElement)\n ?.assignedElements({\n flatten: true\n })\n .filter(\n el =>\n el.getAttribute(\"role\") === \"menuitem\" && !el.classList.contains(\"empty-menu\") && !el.hasAttribute(\"hidden\")\n ) as SgdsDropdownItem[];\n return defaultSlotItems;\n }\n // for case when there is no slot e.g. combobox\n if (this.menu?.hasChildNodes()) {\n const menuItems = Array.from(this.menu.children);\n return [...menuItems] as SgdsDropdownItem[];\n }\n\n return [];\n }\n\n protected _getActiveMenuItems(): SgdsDropdownItem[] {\n return this._getMenuItems().filter(item => !item.disabled && !item.hidden && !item.readonly);\n }\n protected _setMenuItem(currentItemIdx: number) {\n const items = this._getActiveMenuItems();\n if (items.length === 0) return;\n\n // Use modulo for looping\n const idx = ((currentItemIdx % items.length) + items.length) % items.length;\n const activeItem = items[idx];\n this.emit(\"i-sgds-option-focus\", { detail: { option: activeItem } });\n this.nextDropdownItemNo = (idx + 1) % items.length;\n this.prevDropdownItemNo = (idx - 1 + items.length) % items.length;\n\n items.forEach(item => {\n const dropdownItem = item.shadowRoot.querySelector(\".dropdown-item\") as HTMLAnchorElement;\n dropdownItem.setAttribute(\"tabindex\", item === activeItem ? \"0\" : \"-1\");\n if (item === activeItem) dropdownItem.focus();\n });\n }\n}\n\nexport interface IDropdownListElement {\n item: SgdsDropdownItem;\n}\n"],"mappings":";;;;;AAKA,MAAM,MAAM;AACZ,MAAM,aAAa;AACnB,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,SAAS;;;;AAKf,IAAa,sBAAb,cAAyC,gBAAgB;;;EASlC,KAAA,qBAAA;EAIA,KAAA,qBAAA;EAGZ,KAAA,SAAA;;;EAfO,KAAA,SAAA,gBAAgB;;CAiBhC,oBAAoB;EAClB,MAAM,kBAAkB;EACxB,KAAK,iBAAiB,aAAa,KAAK,UAAU;CACpD;CAEA,uBAAuB;EACrB,MAAM,qBAAqB;EAC3B,KAAK,oBAAoB,aAAa,KAAK,UAAU;CACvD;CAEA,aAAa,mBAA2C;EACtD,MAAM,aAAa,iBAAiB;EACpC,KAAK,iBAAiB,WAAW,KAAK,6BAA6B;CACrE;CAEA,iBAA2B,GAA+B;EACxD,MAAM,QAAQ,KAAK,oBAAoB;EAEvC,MAAM,eAA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CAAC,CAAA,GAAA,oBAAA,WAAA,UAAA,KAAA,CAAA"}
|
|
@@ -20,6 +20,7 @@ var combo_box_default = (0, _lit_react.createComponent)({
|
|
|
20
20
|
onSgdsInvalid: "sgds-invalid",
|
|
21
21
|
onSgdsValid: "sgds-valid",
|
|
22
22
|
onSgdsScrollEnd: "sgds-scroll-end",
|
|
23
|
+
onSgdsCreateOption: "sgds-create-option",
|
|
23
24
|
onSgdsShow: "sgds-show",
|
|
24
25
|
onSgdsAfterShow: "sgds-after-show",
|
|
25
26
|
onSgdsHide: "sgds-hide",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","names":["register","Component","createComponent","React"],"sources":["../../../src/react/combo-box/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { createComponent } from \"@lit/react\";\nimport Component from \"../../components/ComboBox/sgds-combo-box\";\nimport { register } from \"../../utils/ce-registry\";\n\nregister(\"sgds-combo-box\", Component);\n\nexport default createComponent({\n react: React,\n tagName: \"sgds-combo-box\",\n elementClass: Component,\n events: {\n onSgdsSelect: \"sgds-select\",\n onSgdsChange: \"sgds-change\",\n onSgdsInput: \"sgds-input\",\n onSgdsFocus: \"sgds-focus\",\n onSgdsBlur: \"sgds-blur\",\n onSgdsInvalid: \"sgds-invalid\",\n onSgdsValid: \"sgds-valid\",\n onSgdsScrollEnd: \"sgds-scroll-end\",\n onSgdsShow: \"sgds-show\",\n onSgdsAfterShow: \"sgds-after-show\",\n onSgdsHide: \"sgds-hide\",\n onSgdsAfterHide: \"sgds-after-hide\"\n }\n});\n"],"mappings":";;;;;;;;AAKAA,oBAAAA,SAAS,kBAAkBC,uBAAAA,YAAS;AAEpC,IAAA,qBAAA,GAAeC,WAAAA,gBAAAA,CAAgB;CACtBC;CACP,SAAS;CACT,cAAcF,uBAAAA;CACd,QAAQ;EACN,cAAc;EACd,cAAc;EACd,aAAa;EACb,aAAa;EACb,YAAY;EACZ,eAAe;EACf,aAAa;EACb,iBAAiB;EACjB,YAAY;EACZ,iBAAiB;EACjB,YAAY;EACZ,iBAAiB;CACnB;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","names":["register","Component","createComponent","React"],"sources":["../../../src/react/combo-box/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { createComponent } from \"@lit/react\";\nimport Component from \"../../components/ComboBox/sgds-combo-box\";\nimport { register } from \"../../utils/ce-registry\";\n\nregister(\"sgds-combo-box\", Component);\n\nexport default createComponent({\n react: React,\n tagName: \"sgds-combo-box\",\n elementClass: Component,\n events: {\n onSgdsSelect: \"sgds-select\",\n onSgdsChange: \"sgds-change\",\n onSgdsInput: \"sgds-input\",\n onSgdsFocus: \"sgds-focus\",\n onSgdsBlur: \"sgds-blur\",\n onSgdsInvalid: \"sgds-invalid\",\n onSgdsValid: \"sgds-valid\",\n onSgdsScrollEnd: \"sgds-scroll-end\",\n onSgdsCreateOption: \"sgds-create-option\",\n onSgdsShow: \"sgds-show\",\n onSgdsAfterShow: \"sgds-after-show\",\n onSgdsHide: \"sgds-hide\",\n onSgdsAfterHide: \"sgds-after-hide\"\n }\n});\n"],"mappings":";;;;;;;;AAKAA,oBAAAA,SAAS,kBAAkBC,uBAAAA,YAAS;AAEpC,IAAA,qBAAA,GAAeC,WAAAA,gBAAAA,CAAgB;CACtBC;CACP,SAAS;CACT,cAAcF,uBAAAA;CACd,QAAQ;EACN,cAAc;EACd,cAAc;EACd,aAAa;EACb,aAAa;EACb,YAAY;EACZ,eAAe;EACf,aAAa;EACb,iBAAiB;EACjB,oBAAoB;EACpB,YAAY;EACZ,iBAAiB;EACjB,YAAY;EACZ,iBAAiB;CACnB;AACF,CAAC"}
|
package/react/combo-box/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var combo_box_default = createComponent({
|
|
|
18
18
|
onSgdsInvalid: "sgds-invalid",
|
|
19
19
|
onSgdsValid: "sgds-valid",
|
|
20
20
|
onSgdsScrollEnd: "sgds-scroll-end",
|
|
21
|
+
onSgdsCreateOption: "sgds-create-option",
|
|
21
22
|
onSgdsShow: "sgds-show",
|
|
22
23
|
onSgdsAfterShow: "sgds-after-show",
|
|
23
24
|
onSgdsHide: "sgds-hide",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Component"],"sources":["../../../src/react/combo-box/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { createComponent } from \"@lit/react\";\nimport Component from \"../../components/ComboBox/sgds-combo-box\";\nimport { register } from \"../../utils/ce-registry\";\n\nregister(\"sgds-combo-box\", Component);\n\nexport default createComponent({\n react: React,\n tagName: \"sgds-combo-box\",\n elementClass: Component,\n events: {\n onSgdsSelect: \"sgds-select\",\n onSgdsChange: \"sgds-change\",\n onSgdsInput: \"sgds-input\",\n onSgdsFocus: \"sgds-focus\",\n onSgdsBlur: \"sgds-blur\",\n onSgdsInvalid: \"sgds-invalid\",\n onSgdsValid: \"sgds-valid\",\n onSgdsScrollEnd: \"sgds-scroll-end\",\n onSgdsShow: \"sgds-show\",\n onSgdsAfterShow: \"sgds-after-show\",\n onSgdsHide: \"sgds-hide\",\n onSgdsAfterHide: \"sgds-after-hide\"\n }\n});\n"],"mappings":";;;;;;AAKA,SAAS,kBAAkBA,YAAS;AAEpC,IAAA,oBAAe,gBAAgB;CAC7B,OAAO;CACP,SAAS;CACT,cAAcA;CACd,QAAQ;EACN,cAAc;EACd,cAAc;EACd,aAAa;EACb,aAAa;EACb,YAAY;EACZ,eAAe;EACf,aAAa;EACb,iBAAiB;EACjB,YAAY;EACZ,iBAAiB;EACjB,YAAY;EACZ,iBAAiB;CACnB;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Component"],"sources":["../../../src/react/combo-box/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { createComponent } from \"@lit/react\";\nimport Component from \"../../components/ComboBox/sgds-combo-box\";\nimport { register } from \"../../utils/ce-registry\";\n\nregister(\"sgds-combo-box\", Component);\n\nexport default createComponent({\n react: React,\n tagName: \"sgds-combo-box\",\n elementClass: Component,\n events: {\n onSgdsSelect: \"sgds-select\",\n onSgdsChange: \"sgds-change\",\n onSgdsInput: \"sgds-input\",\n onSgdsFocus: \"sgds-focus\",\n onSgdsBlur: \"sgds-blur\",\n onSgdsInvalid: \"sgds-invalid\",\n onSgdsValid: \"sgds-valid\",\n onSgdsScrollEnd: \"sgds-scroll-end\",\n onSgdsCreateOption: \"sgds-create-option\",\n onSgdsShow: \"sgds-show\",\n onSgdsAfterShow: \"sgds-after-show\",\n onSgdsHide: \"sgds-hide\",\n onSgdsAfterHide: \"sgds-after-hide\"\n }\n});\n"],"mappings":";;;;;;AAKA,SAAS,kBAAkBA,YAAS;AAEpC,IAAA,oBAAe,gBAAgB;CAC7B,OAAO;CACP,SAAS;CACT,cAAcA;CACd,QAAQ;EACN,cAAc;EACd,cAAc;EACd,aAAa;EACb,aAAa;EACb,YAAY;EACZ,eAAe;EACf,aAAa;EACb,iBAAiB;EACjB,oBAAoB;EACpB,YAAY;EACZ,iBAAiB;EACjB,YAAY;EACZ,iBAAiB;CACnB;AACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/ComboBox/combo-box.css
|
|
3
|
-
var css_248z = require("lit").css`:host{display:block;position:relative}.dropdown{display:flex;height:100%}.dropdown-menu{box-sizing:border-box;max-height:10rem;overflow-x:hidden;overflow-y:auto}.visually-hidden{clip:rect(0,0,0,0)!important;border:0!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}.combobox .form-control-group{height:unset;min-height:var(--sgds-dimension-48)}.combobox-input-container{align-items:center;display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xs);padding:calc(var(--sgds-form-padding-y) - var(--sgds-form-border-width-default)) 0;width:calc(100% - var(--sgds-icon-size-md, 1.25rem))}.combobox-input-container .form-control{flex:1 1 0;min-width:10ch}slot[id=default].d-none,slot[id=default].d-none::slotted(*){display:none}.form-clearable:focus-visible{outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}`;
|
|
3
|
+
var css_248z = require("lit").css`:host{display:block;position:relative}.dropdown{display:flex;height:100%}.dropdown-menu{box-sizing:border-box;max-height:10rem;overflow-x:hidden;overflow-y:auto}.visually-hidden{clip:rect(0,0,0,0)!important;border:0!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}.combobox .form-control-group{height:unset;min-height:var(--sgds-dimension-48)}.combobox-input-container{align-items:center;display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xs);padding:calc(var(--sgds-form-padding-y) - var(--sgds-form-border-width-default)) 0;width:calc(100% - var(--sgds-icon-size-md, 1.25rem))}.combobox-input-container .form-control{flex:1 1 0;min-width:10ch}slot[id=default].d-none,slot[id=default].d-none::slotted(*){display:none}slot[name=create].d-none,slot[name=create].d-none::slotted(*){display:none}.create-option{color:var(--sgds-form-color-default);font-size:var(--sgds-font-size-label-md);overflow-wrap:anywhere;padding:var(--sgds-padding-sm) var(--sgds-padding-md);white-space:normal}.create-option:not(.slotted){cursor:pointer}.create-option:hover{background:var(--sgds-bg-translucent-subtle)}.create-option:focus-visible{background:var(--sgds-bg-translucent-subtle);outline:var(--sgds-form-outline-focus);outline-offset:var(--sgds-form-outline-offset-focus)}.form-clearable:focus-visible{outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}`;
|
|
4
4
|
//#endregion
|
|
5
5
|
exports.default = css_248z;
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.cjs.js","names":[],"sources":["../../../../src/components/ComboBox/combo-box.css"],"sourcesContent":[":host {\n display: block;\n position: relative;\n}\n\n.dropdown {\n display: flex;\n height: 100%;\n}\n\n.dropdown-menu {\n max-height: 10rem;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n}\n\n.visually-hidden {\n clip: rect(0, 0, 0, 0) !important;\n border: 0 !important;\n height: 1px !important;\n margin: -1px !important;\n overflow: hidden !important;\n padding: 0 !important;\n position: absolute !important;\n white-space: nowrap !important;\n width: 1px !important;\n}\n\n.combobox .form-control-group {\n min-height: var(--sgds-dimension-48);\n height: unset;\n}\n\n.combobox-input-container {\n display: flex;\n gap: var(--sgds-gap-xs);\n flex-wrap: wrap;\n align-items: center;\n width: calc(100% - var(--sgds-icon-size-md, 1.25rem));\n /* deduct 1px from top and bottom padding due to border */\n padding: calc(var(--sgds-form-padding-y) - var(--sgds-form-border-width-default)) 0;\n}\n\n.combobox-input-container .form-control {\n flex: 1 1 0;\n min-width: 10ch;\n}\n\nslot[id='default'].d-none::slotted(*),\nslot[id='default'].d-none{\n display: none;\n}\n\n.form-clearable:focus-visible {\n outline: var(--sgds-outline-focus);\n outline-offset: var(--sgds-outline-offset-focus);\n}"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"combo-box.cjs.js","names":[],"sources":["../../../../src/components/ComboBox/combo-box.css"],"sourcesContent":[":host {\n display: block;\n position: relative;\n}\n\n.dropdown {\n display: flex;\n height: 100%;\n}\n\n.dropdown-menu {\n max-height: 10rem;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n}\n\n.visually-hidden {\n clip: rect(0, 0, 0, 0) !important;\n border: 0 !important;\n height: 1px !important;\n margin: -1px !important;\n overflow: hidden !important;\n padding: 0 !important;\n position: absolute !important;\n white-space: nowrap !important;\n width: 1px !important;\n}\n\n.combobox .form-control-group {\n min-height: var(--sgds-dimension-48);\n height: unset;\n}\n\n.combobox-input-container {\n display: flex;\n gap: var(--sgds-gap-xs);\n flex-wrap: wrap;\n align-items: center;\n width: calc(100% - var(--sgds-icon-size-md, 1.25rem));\n /* deduct 1px from top and bottom padding due to border */\n padding: calc(var(--sgds-form-padding-y) - var(--sgds-form-border-width-default)) 0;\n}\n\n.combobox-input-container .form-control {\n flex: 1 1 0;\n min-width: 10ch;\n}\n\nslot[id='default'].d-none::slotted(*),\nslot[id='default'].d-none{\n display: none;\n}\n\nslot[name='create'].d-none::slotted(*),\nslot[name='create'].d-none {\n display: none;\n}\n\n.create-option {\n padding: var(--sgds-padding-sm) var(--sgds-padding-md);\n color: var(--sgds-form-color-default);\n font-size: var(--sgds-font-size-label-md);\n white-space: normal;\n overflow-wrap: anywhere;\n}\n\n.create-option:not(.slotted) {\n cursor: pointer;\n}\n\n.create-option:hover {\n background: var(--sgds-bg-translucent-subtle);\n}\n\n.create-option:focus-visible {\n background: var(--sgds-bg-translucent-subtle);\n outline: var(--sgds-form-outline-focus);\n outline-offset: var(--sgds-form-outline-offset-focus);\n}\n\n.form-clearable:focus-visible {\n outline: var(--sgds-outline-focus);\n outline-offset: var(--sgds-outline-offset-focus);\n}"],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { css } from "lit";
|
|
3
3
|
//#region src/components/ComboBox/combo-box.css
|
|
4
|
-
var css_248z = css`:host{display:block;position:relative}.dropdown{display:flex;height:100%}.dropdown-menu{box-sizing:border-box;max-height:10rem;overflow-x:hidden;overflow-y:auto}.visually-hidden{clip:rect(0,0,0,0)!important;border:0!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}.combobox .form-control-group{height:unset;min-height:var(--sgds-dimension-48)}.combobox-input-container{align-items:center;display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xs);padding:calc(var(--sgds-form-padding-y) - var(--sgds-form-border-width-default)) 0;width:calc(100% - var(--sgds-icon-size-md, 1.25rem))}.combobox-input-container .form-control{flex:1 1 0;min-width:10ch}slot[id=default].d-none,slot[id=default].d-none::slotted(*){display:none}.form-clearable:focus-visible{outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}`;
|
|
4
|
+
var css_248z = css`:host{display:block;position:relative}.dropdown{display:flex;height:100%}.dropdown-menu{box-sizing:border-box;max-height:10rem;overflow-x:hidden;overflow-y:auto}.visually-hidden{clip:rect(0,0,0,0)!important;border:0!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;white-space:nowrap!important;width:1px!important}.combobox .form-control-group{height:unset;min-height:var(--sgds-dimension-48)}.combobox-input-container{align-items:center;display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xs);padding:calc(var(--sgds-form-padding-y) - var(--sgds-form-border-width-default)) 0;width:calc(100% - var(--sgds-icon-size-md, 1.25rem))}.combobox-input-container .form-control{flex:1 1 0;min-width:10ch}slot[id=default].d-none,slot[id=default].d-none::slotted(*){display:none}slot[name=create].d-none,slot[name=create].d-none::slotted(*){display:none}.create-option{color:var(--sgds-form-color-default);font-size:var(--sgds-font-size-label-md);overflow-wrap:anywhere;padding:var(--sgds-padding-sm) var(--sgds-padding-md);white-space:normal}.create-option:not(.slotted){cursor:pointer}.create-option:hover{background:var(--sgds-bg-translucent-subtle)}.create-option:focus-visible{background:var(--sgds-bg-translucent-subtle);outline:var(--sgds-form-outline-focus);outline-offset:var(--sgds-form-outline-offset-focus)}.form-clearable:focus-visible{outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}`;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { css_248z as default };
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.js","names":[],"sources":["../../../../src/components/ComboBox/combo-box.css"],"sourcesContent":[":host {\n display: block;\n position: relative;\n}\n\n.dropdown {\n display: flex;\n height: 100%;\n}\n\n.dropdown-menu {\n max-height: 10rem;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n}\n\n.visually-hidden {\n clip: rect(0, 0, 0, 0) !important;\n border: 0 !important;\n height: 1px !important;\n margin: -1px !important;\n overflow: hidden !important;\n padding: 0 !important;\n position: absolute !important;\n white-space: nowrap !important;\n width: 1px !important;\n}\n\n.combobox .form-control-group {\n min-height: var(--sgds-dimension-48);\n height: unset;\n}\n\n.combobox-input-container {\n display: flex;\n gap: var(--sgds-gap-xs);\n flex-wrap: wrap;\n align-items: center;\n width: calc(100% - var(--sgds-icon-size-md, 1.25rem));\n /* deduct 1px from top and bottom padding due to border */\n padding: calc(var(--sgds-form-padding-y) - var(--sgds-form-border-width-default)) 0;\n}\n\n.combobox-input-container .form-control {\n flex: 1 1 0;\n min-width: 10ch;\n}\n\nslot[id='default'].d-none::slotted(*),\nslot[id='default'].d-none{\n display: none;\n}\n\n.form-clearable:focus-visible {\n outline: var(--sgds-outline-focus);\n outline-offset: var(--sgds-outline-offset-focus);\n}"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"combo-box.js","names":[],"sources":["../../../../src/components/ComboBox/combo-box.css"],"sourcesContent":[":host {\n display: block;\n position: relative;\n}\n\n.dropdown {\n display: flex;\n height: 100%;\n}\n\n.dropdown-menu {\n max-height: 10rem;\n overflow-y: auto;\n overflow-x: hidden;\n box-sizing: border-box;\n}\n\n.visually-hidden {\n clip: rect(0, 0, 0, 0) !important;\n border: 0 !important;\n height: 1px !important;\n margin: -1px !important;\n overflow: hidden !important;\n padding: 0 !important;\n position: absolute !important;\n white-space: nowrap !important;\n width: 1px !important;\n}\n\n.combobox .form-control-group {\n min-height: var(--sgds-dimension-48);\n height: unset;\n}\n\n.combobox-input-container {\n display: flex;\n gap: var(--sgds-gap-xs);\n flex-wrap: wrap;\n align-items: center;\n width: calc(100% - var(--sgds-icon-size-md, 1.25rem));\n /* deduct 1px from top and bottom padding due to border */\n padding: calc(var(--sgds-form-padding-y) - var(--sgds-form-border-width-default)) 0;\n}\n\n.combobox-input-container .form-control {\n flex: 1 1 0;\n min-width: 10ch;\n}\n\nslot[id='default'].d-none::slotted(*),\nslot[id='default'].d-none{\n display: none;\n}\n\nslot[name='create'].d-none::slotted(*),\nslot[name='create'].d-none {\n display: none;\n}\n\n.create-option {\n padding: var(--sgds-padding-sm) var(--sgds-padding-md);\n color: var(--sgds-form-color-default);\n font-size: var(--sgds-font-size-label-md);\n white-space: normal;\n overflow-wrap: anywhere;\n}\n\n.create-option:not(.slotted) {\n cursor: pointer;\n}\n\n.create-option:hover {\n background: var(--sgds-bg-translucent-subtle);\n}\n\n.create-option:focus-visible {\n background: var(--sgds-bg-translucent-subtle);\n outline: var(--sgds-form-outline-focus);\n outline-offset: var(--sgds-form-outline-offset-focus);\n}\n\n.form-clearable:focus-visible {\n outline: var(--sgds-outline-focus);\n outline-offset: var(--sgds-outline-offset-focus);\n}"],"mappings":""}
|
|
@@ -20,6 +20,7 @@ let lit_directives_repeat_js = require("lit/directives/repeat.js");
|
|
|
20
20
|
* @summary ComboBox component is used for users to make one or more selections from a list through user input, keyboard or mouse actions
|
|
21
21
|
*
|
|
22
22
|
* @slot default - default slot to pass in sgds-combo-box-option
|
|
23
|
+
* @slot create - Custom content for the "Create" option shown when `creatable` is true and no match is found. Use `sgds-input` event to dynamically update the slotted content with the current input value.
|
|
23
24
|
*
|
|
24
25
|
* @event sgds-select - Emitted when the combo box's selected value changes.
|
|
25
26
|
* @event sgds-change - Emitted when the combo box's value changes.
|
|
@@ -30,6 +31,8 @@ let lit_directives_repeat_js = require("lit/directives/repeat.js");
|
|
|
30
31
|
* @event sgds-invalid - Emitted when the combo box's invalid state is set to true.
|
|
31
32
|
* @event sgds-valid - Emitted when the combo box's invalid state is set to false.
|
|
32
33
|
* @event sgds-scroll-end - Emitted once when the menu is scrolled to within `scrollBottomOffset` pixels of the bottom. Resets when the user scrolls back up.
|
|
34
|
+
* @event sgds-create-option - Emitted when the user selects the "Create xxx" option. `event.detail = { value }`
|
|
35
|
+
* @eventDetail {ISgdsComboBoxCreateOptionEventDetail} sgds-create-option
|
|
33
36
|
*/
|
|
34
37
|
var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectElement {
|
|
35
38
|
constructor(..._args) {
|
|
@@ -40,6 +43,7 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
40
43
|
this.noValidate = false;
|
|
41
44
|
this.async = false;
|
|
42
45
|
this.emptyMenuAsync = false;
|
|
46
|
+
this.creatable = false;
|
|
43
47
|
this.scrollBottomOffset = 0;
|
|
44
48
|
this.filterFunction = (inputValue, item) => {
|
|
45
49
|
return item.label.toLowerCase().startsWith(inputValue.toLowerCase());
|
|
@@ -53,6 +57,9 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
53
57
|
size="md"
|
|
54
58
|
></sgds-icon>`;
|
|
55
59
|
this.prefixIconTemplate = lit.html`${lit.nothing}`;
|
|
60
|
+
this._createOptionSlotContent = [];
|
|
61
|
+
this._createOptionValue = "";
|
|
62
|
+
this._showCreateOption = false;
|
|
56
63
|
}
|
|
57
64
|
static {
|
|
58
65
|
this.styles = [
|
|
@@ -85,7 +92,9 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
85
92
|
});
|
|
86
93
|
this.addEventListener("sgds-hide", async (e) => {
|
|
87
94
|
if (!e.detail.isOutside) (await this._input).focus();
|
|
88
|
-
this.options.forEach((o) =>
|
|
95
|
+
this.options.forEach((o) => {
|
|
96
|
+
o.removeAttribute("hidden");
|
|
97
|
+
});
|
|
89
98
|
this.emptyMenuAfterFiltering = false;
|
|
90
99
|
});
|
|
91
100
|
}
|
|
@@ -125,7 +134,8 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
125
134
|
});
|
|
126
135
|
/** this will trigger _updateValueAndDisplayValue */
|
|
127
136
|
await this.updateComplete;
|
|
128
|
-
|
|
137
|
+
const realOptions = assignedElements;
|
|
138
|
+
this.optionList = await this._getMenuListFromOptions(realOptions);
|
|
129
139
|
this._setupValidation(this.optionList);
|
|
130
140
|
}
|
|
131
141
|
async _setupValidation(list) {
|
|
@@ -140,7 +150,9 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
140
150
|
this._mixinValidate(this.input);
|
|
141
151
|
}
|
|
142
152
|
async _handleValueChange() {
|
|
143
|
-
this.options.forEach((o) =>
|
|
153
|
+
this.options.forEach((o) => {
|
|
154
|
+
o.removeAttribute("hidden");
|
|
155
|
+
});
|
|
144
156
|
const sgdsInput = await this._input;
|
|
145
157
|
this._mixinSetFormValue();
|
|
146
158
|
if (this.multiSelect) this._mixinValidate(this.input);
|
|
@@ -202,6 +214,7 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
202
214
|
if (!filteredValues.includes(o.value)) o.hidden = true;
|
|
203
215
|
else o.hidden = false;
|
|
204
216
|
});
|
|
217
|
+
this._syncCreateOption();
|
|
205
218
|
}
|
|
206
219
|
/**
|
|
207
220
|
* Called whenever an <sgds-combo-box-option> dispatches sgds-select"
|
|
@@ -219,6 +232,7 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
219
232
|
if (!this.selectedItems.some((i) => i.value === foundItem.value)) this.selectedItems = [...this.selectedItems, foundItem];
|
|
220
233
|
this.value = this.selectedItems.map((i) => i.value).join(";");
|
|
221
234
|
itemEl.active = true;
|
|
235
|
+
this.displayValue = "";
|
|
222
236
|
} else if (this.selectedItems.length === 0 || this.selectedItems[0].value !== foundItem.value) {
|
|
223
237
|
this.options.forEach((o) => o.active = false);
|
|
224
238
|
itemEl.active = true;
|
|
@@ -269,6 +283,8 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
269
283
|
async _handleInputBlur(e) {
|
|
270
284
|
e.preventDefault();
|
|
271
285
|
this.emit("sgds-blur");
|
|
286
|
+
const relatedTarget = e.relatedTarget;
|
|
287
|
+
if ((this.creatable || this.multiSelect) && relatedTarget && (this.contains(relatedTarget) || this.shadowRoot?.contains(relatedTarget))) return;
|
|
272
288
|
if (this.multiSelect) {
|
|
273
289
|
if (this.selectedItems.filter(({ label }) => this.displayValue === label).length <= 0) this.displayValue = "";
|
|
274
290
|
} else if (this.selectedItems.length > 0) this.displayValue = this.selectedItems[0].label;
|
|
@@ -393,10 +409,68 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
393
409
|
</div>
|
|
394
410
|
`;
|
|
395
411
|
}
|
|
412
|
+
/** Updates visibility of the create-option container based on creatable + filter state. */
|
|
413
|
+
_syncCreateOption() {
|
|
414
|
+
this._showCreateOption = this.creatable && this.emptyMenuAfterFiltering && this.displayValue !== "";
|
|
415
|
+
if (this._showCreateOption) this._createOptionValue = this.displayValue;
|
|
416
|
+
}
|
|
417
|
+
/** Handles slotchange for the create-option named slot. */
|
|
418
|
+
_handleCreateOptionSlotChange(e) {
|
|
419
|
+
this._createOptionSlotContent = e.target.assignedElements({ flatten: true });
|
|
420
|
+
}
|
|
421
|
+
/** Click handler for the create-option container. Lets interactive slotted elements (links, buttons) pass through. */
|
|
422
|
+
_handleCreateOptionClick(evt) {
|
|
423
|
+
if (evt.composedPath()[0].closest?.("a, button")) return;
|
|
424
|
+
this.emit("sgds-create-option", { detail: { value: this._createOptionValue } });
|
|
425
|
+
this.emptyMenuAfterFiltering = false;
|
|
426
|
+
this._syncCreateOption();
|
|
427
|
+
this.hideMenu();
|
|
428
|
+
}
|
|
429
|
+
/** Keydown handler for the create-option container. */
|
|
430
|
+
_handleCreateOptionKeydown(evt) {
|
|
431
|
+
if (evt.key === "Enter") {
|
|
432
|
+
this._handleCreateOptionClick(evt);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
if (evt.key === "ArrowUp") {
|
|
436
|
+
evt.preventDefault();
|
|
437
|
+
const items = this._getActiveMenuItems();
|
|
438
|
+
if (items.length > 0) this._setMenuItem(items.length - 1);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (evt.key === "ArrowDown") {
|
|
442
|
+
evt.preventDefault();
|
|
443
|
+
if (this._getActiveMenuItems().length > 0) this._setMenuItem(0);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/** Override base keyboard handler to include create-option in ArrowDown/Tab navigation. */
|
|
447
|
+
_handleKeyboardMenuItemsEvent(e) {
|
|
448
|
+
const createDiv = this.shadowRoot?.querySelector(".create-option");
|
|
449
|
+
if (createDiv?.matches(":focus") && e.key === "Tab") return;
|
|
450
|
+
if (this._showCreateOption && (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey)) {
|
|
451
|
+
const items = this._getActiveMenuItems();
|
|
452
|
+
if (items.length > 0) {
|
|
453
|
+
if (items[items.length - 1].shadowRoot?.querySelector(".dropdown-item")?.matches(":focus")) {
|
|
454
|
+
e.preventDefault();
|
|
455
|
+
createDiv?.focus();
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
if (items.length === 0) {
|
|
460
|
+
e.preventDefault();
|
|
461
|
+
createDiv?.focus();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
super._handleKeyboardMenuItemsEvent(e);
|
|
466
|
+
}
|
|
396
467
|
_renderFeedbackMenu() {
|
|
397
468
|
if (this.loading) return this._renderLoadingMenu();
|
|
398
469
|
if (this.async) return this.emptyMenuAsync || this.optionList.length === 0 ? this._renderEmptyMenu() : lit.nothing;
|
|
399
|
-
else
|
|
470
|
+
else {
|
|
471
|
+
if (this.creatable && this.emptyMenuAfterFiltering && this.optionList.length > 0) return lit.nothing;
|
|
472
|
+
return this.optionList.length === 0 || this.emptyMenuAfterFiltering && this.optionList.length > 0 ? this._renderEmptyMenu() : lit.nothing;
|
|
473
|
+
}
|
|
400
474
|
}
|
|
401
475
|
render() {
|
|
402
476
|
const showClearButton = (this.isFocused || this.menuIsOpen) && this.value !== "" && this.clearable && !this.readonly;
|
|
@@ -428,6 +502,18 @@ var SgdsComboBox = class SgdsComboBox extends require_select_element.SelectEleme
|
|
|
428
502
|
class=${(0, lit_directives_class_map_js.classMap)({ "d-none": this.loading || this.emptyMenuAsync || this.optionList.length === 0 })}
|
|
429
503
|
@slotchange=${this._handleDefaultSlotChange}
|
|
430
504
|
></slot>
|
|
505
|
+
${this._showCreateOption ? lit.html`<div
|
|
506
|
+
class=${(0, lit_directives_class_map_js.classMap)({
|
|
507
|
+
"create-option": true,
|
|
508
|
+
slotted: this._createOptionSlotContent.length > 0
|
|
509
|
+
})}
|
|
510
|
+
tabindex="0"
|
|
511
|
+
role="option"
|
|
512
|
+
@click=${this._handleCreateOptionClick}
|
|
513
|
+
@keydown=${this._handleCreateOptionKeydown}
|
|
514
|
+
>
|
|
515
|
+
${this._createOptionSlotContent.length > 0 ? lit.html`<slot name="create" @slotchange=${this._handleCreateOptionSlotChange}></slot>` : `Create "${this.displayValue}"`}
|
|
516
|
+
</div>` : lit.html`<slot name="create" class="d-none" @slotchange=${this._handleCreateOptionSlotChange}></slot>`}
|
|
431
517
|
${this._renderFeedbackMenu()}
|
|
432
518
|
</div>
|
|
433
519
|
</div>
|
|
@@ -469,6 +555,10 @@ require_decorate.default([(0, lit_decorators_js.property)({
|
|
|
469
555
|
type: Boolean,
|
|
470
556
|
reflect: true
|
|
471
557
|
})], SgdsComboBox.prototype, "emptyMenuAsync", void 0);
|
|
558
|
+
require_decorate.default([(0, lit_decorators_js.property)({
|
|
559
|
+
type: Boolean,
|
|
560
|
+
reflect: true
|
|
561
|
+
})], SgdsComboBox.prototype, "creatable", void 0);
|
|
472
562
|
require_decorate.default([(0, lit_decorators_js.property)({
|
|
473
563
|
type: Number,
|
|
474
564
|
reflect: true
|
|
@@ -486,6 +576,7 @@ require_decorate.default([(0, lit_decorators_js.state)()], SgdsComboBox.prototyp
|
|
|
486
576
|
require_decorate.default([require_watch.watch("value", { waitUntilFirstUpdate: true })], SgdsComboBox.prototype, "_handleValueChange", null);
|
|
487
577
|
require_decorate.default([require_watch.watch("optionList", { waitUntilFirstUpdate: true })], SgdsComboBox.prototype, "_handleOptionListChange", null);
|
|
488
578
|
require_decorate.default([require_watch.watch("menuList", { waitUntilFirstUpdate: true })], SgdsComboBox.prototype, "_handleMenuListChange", null);
|
|
579
|
+
require_decorate.default([(0, lit_decorators_js.state)()], SgdsComboBox.prototype, "_showCreateOption", void 0);
|
|
489
580
|
//#endregion
|
|
490
581
|
exports.SgdsComboBox = SgdsComboBox;
|
|
491
582
|
exports.default = SgdsComboBox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-combo-box.cjs.js","names":["SelectElement","nothing","formTextControlStyle","comboBoxStyle","SgdsComboBoxOption","SgdsIcon","SgdsBadge","SgdsSpinner","ref","classMap","repeat","ifDefined","live","property","queryAsync","queryAssignedElements","state","watch"],"sources":["../../../../src/components/ComboBox/sgds-combo-box.ts"],"sourcesContent":["import { live } from \"lit/directives/live.js\";\nimport { html, nothing, PropertyValueMap, TemplateResult } from \"lit\";\nimport { property, queryAssignedElements, queryAsync, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\n\nimport { ref } from \"lit/directives/ref.js\";\nimport { SelectElement, SgdsOptionData } from \"../../base/select-element\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsBadge } from \"../Badge/sgds-badge\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport comboBoxStyle from \"./combo-box.css\";\nimport formTextControlStyle from \"../../styles/form-text-control.css\";\nimport { SgdsComboBoxOption } from \"./sgds-combo-box-option\";\n\nimport { repeat } from \"lit/directives/repeat.js\";\nimport SgdsSpinner from \"../Spinner/sgds-spinner\";\nimport { ISgdsComboBoxInputEventDetail } from \"./types\";\n\n/**\n * Each item in the ComboBox has a label to display\n * and a value (the actual data / ID).\n */\ntype SgdsComboBoxOptionData = SgdsOptionData;\n\nexport type { ISgdsComboBoxInputEventDetail };\n\n/**\n * @summary ComboBox component is used for users to make one or more selections from a list through user input, keyboard or mouse actions\n *\n * @slot default - default slot to pass in sgds-combo-box-option\n *\n * @event sgds-select - Emitted when the combo box's selected value changes.\n * @event sgds-change - Emitted when the combo box's value changes.\n * @event sgds-input - Emitted when user input is received and its value changes. `event.detail = { displayValue }`\n * @eventDetail {ISgdsComboBoxInputEventDetail} sgds-input\n * @event sgds-focus - Emitted when user input is focused.\n * @event sgds-blur - Emitted when user input is blurred.\n * @event sgds-invalid - Emitted when the combo box's invalid state is set to true.\n * @event sgds-valid - Emitted when the combo box's invalid state is set to false.\n * @event sgds-scroll-end - Emitted once when the menu is scrolled to within `scrollBottomOffset` pixels of the bottom. Resets when the user scrolls back up.\n */\nexport class SgdsComboBox extends SelectElement {\n static styles = [...SelectElement.styles, formTextControlStyle, comboBoxStyle];\n static childName = \"sgds-combo-box-option\";\n /** @internal */\n static dependencies = {\n [SgdsComboBox.childName]: SgdsComboBoxOption,\n \"sgds-icon\": SgdsIcon,\n \"sgds-badge\": SgdsBadge,\n \"sgds-spinner\": SgdsSpinner\n };\n\n /** If true, renders multiple checkbox selection items. If false, single-select. */\n @property({ type: Boolean, reflect: true }) multiSelect = false;\n\n /** If true, renders badge that fills width of combobox */\n @property({ type: Boolean, reflect: true }) badgeFullWidth = false;\n\n /** If true, a clear button will be enabled on focus */\n @property({ type: Boolean, reflect: true }) clearable = false;\n\n /** Disables native and sgds validation for the combo box. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /** Enables the asynchronous behaviour of a combo box. When true, filterFunction is ignored and filtering is done remotely. */\n @property({ type: Boolean, reflect: true }) async = false;\n\n /** When filtering remotely and there are no results, set this to true to enable no options feedback on the menu. Applicable for async combo box only. */\n @property({ type: Boolean, reflect: true }) emptyMenuAsync = false;\n\n /** Number of pixels from the bottom of the menu at which the sgds-scroll-end event fires. */\n @property({ type: Number, reflect: true }) scrollBottomOffset = 0;\n\n /** The function used to filter the menu list, given the user's input value. */\n @property()\n filterFunction: (inputValue: string, item: SgdsComboBoxOptionData) => boolean = (inputValue, item) => {\n return item.label.toLowerCase().startsWith(inputValue.toLowerCase());\n };\n\n @queryAsync(\"input#multi-select-input-tracker\") private _multiSelectInput: Promise<HTMLInputElement>;\n\n @queryAssignedElements({ flatten: true, selector: \"sgds-combo-box-option\" })\n protected options: SgdsComboBoxOption[];\n\n @state() private optionList: SgdsComboBoxOptionData[] = [];\n @state() private emptyMenuAfterFiltering = false;\n\n // Used to show and hide the clear button\n @state() protected isFocused = false;\n\n // Used to determine if the scroll reached the end with offset\n @state() protected isScrollEnd = false;\n\n connectedCallback(): void {\n super.connectedCallback();\n\n this.addEventListener(\"focus\", async () => {\n this.isFocused = true;\n });\n\n this.addEventListener(\"blur\", async () => {\n this.isFocused = false;\n });\n\n this.addEventListener(\"keydown\", (e: KeyboardEvent) => {\n if (\n e.key === \"Enter\" &&\n (e.target as HTMLElement).shadowRoot?.querySelector(\".form-clearable\")?.matches(\":focus\")\n ) {\n this._handleClear();\n }\n });\n\n this.addEventListener(\"sgds-hide\", async (e: CustomEvent) => {\n if (!e.detail.isOutside) {\n const sgdsInput = await this._input;\n sgdsInput.focus();\n }\n\n this.options.forEach(o => o.removeAttribute(\"hidden\"));\n // reset emptyMenu state\n this.emptyMenuAfterFiltering = false;\n });\n }\n\n async firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n if (this.async) this.filterFunction = () => true;\n this.menuList.forEach(o => {\n const comboBoxOption = document.createElement(\"sgds-combo-box-option\") as SgdsComboBoxOption;\n comboBoxOption.innerText = o.label;\n comboBoxOption.value = o.value;\n comboBoxOption.checkbox = this.multiSelect;\n comboBoxOption.active = this.value.includes(o.value);\n this.appendChild(comboBoxOption);\n });\n this._setupValidation(this.menuList);\n if (this.menuIsOpen) {\n await this.updateFloatingPosition();\n }\n }\n\n protected async _handleDefaultSlotChange(e: Event) {\n const assignedElements = (e.target as HTMLSlotElement).assignedElements({\n flatten: true\n }) as ComboBoxOptionWithFlag[];\n\n assignedElements.forEach(option => {\n // Handling of click events\n if (option.hasAttribute(\"disabled\")) return false;\n if (option.clickEventAdded) return false;\n option.addEventListener(\"click\", (evt: PointerEvent) => {\n evt.preventDefault();\n const optionTarget = evt.target as SgdsComboBoxOption;\n\n if (this.multiSelect) {\n optionTarget.active ? this._handleItemUnselect(evt) : this._handleItemSelected(evt);\n } else {\n this._handleItemSelected(evt);\n }\n\n return false;\n });\n option.clickEventAdded = true;\n option.addEventListener(\"keydown\", (evt: KeyboardEvent) => {\n if (evt.key === \"Enter\") {\n this.close = \"outside\";\n const optionTarget = evt.target as SgdsComboBoxOption;\n optionTarget.click();\n }\n });\n });\n\n /** this will trigger _updateValueAndDisplayValue */\n await this.updateComplete;\n this.optionList = await this._getMenuListFromOptions(assignedElements);\n this._setupValidation(this.optionList);\n }\n\n private async _setupValidation(list: SgdsComboBoxOptionData[]) {\n if (this.value && list.length > 0) {\n const valueArray = this.value.split(\";\");\n const initialSelectedItem = list.filter(({ value }) => valueArray.includes(value));\n this.selectedItems = [...initialSelectedItem, ...this.selectedItems];\n\n if (!this.multiSelect) {\n this.displayValue = initialSelectedItem[0]?.label;\n }\n }\n /** We want to run validation regardless of value or list present */\n this.multiSelect ? (this.input = await this._multiSelectInput) : (this.input = await this._input);\n this._mixinValidate(this.input);\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n async _handleValueChange() {\n this.options.forEach(o => o.removeAttribute(\"hidden\"));\n\n const sgdsInput = await this._input;\n this._mixinSetFormValue();\n\n if (this.multiSelect) {\n this._mixinValidate(this.input);\n } else {\n this._mixinValidate(sgdsInput);\n }\n\n // When value is updated by user and it doesn't map to selectedItems, we should re-map selectedItems\n const selectedItemVal = this.selectedItems.map(val => val.value).join(\";\");\n if (selectedItemVal !== this.value) {\n this._updateValueAndDisplayValue(this.optionList);\n }\n\n if (!this._isTouched && this.value === \"\") return;\n if (this._mixinShouldSkipSgdsValidation()) return;\n this.invalid = !this._mixinReportValidity();\n }\n\n /** Emits sgds-change and sgds-select events. Call after setting this.value from user interaction. */\n private _emitChangeEvents() {\n this._mixinSetFormValue();\n this.emit(\"sgds-change\");\n if (this.value) {\n this.emit(\"sgds-select\");\n }\n }\n\n @watch(\"optionList\", { waitUntilFirstUpdate: true })\n _handleOptionListChange() {\n this._updateValueAndDisplayValue(this.optionList);\n }\n\n @watch(\"menuList\", { waitUntilFirstUpdate: true })\n _handleMenuListChange() {\n const newMenu = this.menuList.map(o => {\n const comboBoxOption = document.createElement(\"sgds-combo-box-option\") as SgdsComboBoxOption;\n comboBoxOption.innerText = o.label;\n comboBoxOption.value = o.value;\n comboBoxOption.checkbox = this.multiSelect;\n comboBoxOption.active = this.value.includes(o.value);\n return comboBoxOption;\n });\n\n this.replaceChildren(...newMenu);\n }\n\n private _updateValueAndDisplayValue(list: SgdsComboBoxOptionData[]) {\n const valueArray = this.value.split(\";\");\n const initialSelectedItem = list.filter(({ value }) => valueArray.includes(value));\n this.selectedItems = [...initialSelectedItem];\n // When the new filtered items don't match value we update it\n const updatedValue = initialSelectedItem.map(item => item.value).join(\";\");\n if (updatedValue !== this.value) {\n this.value = updatedValue;\n }\n // Disabling this condition for async combobox so that the display value in the input will not clear when menu options changes\n if (!this.multiSelect && !this.async) {\n this.displayValue = initialSelectedItem[0]?.label || \"\";\n }\n\n this.options.forEach(o => (o.active = valueArray.includes(o.value)));\n }\n\n // Called each time the user types in the <sgds-input>, we set .value and show the menu\n protected async _handleInputChange(e: CustomEvent) {\n const input = e.target as HTMLInputElement;\n this.displayValue = input.value;\n this.emit<ISgdsComboBoxInputEventDetail>(\"sgds-input\", { detail: { displayValue: this.displayValue } });\n this.invalid = false;\n this.showMenu();\n // reset menu list when displayValue is cleared\n if (this.displayValue === \"\" && !this.multiSelect) {\n this.selectedItems = [];\n this.value = this.selectedItems.join(\";\");\n this.options.forEach(o => (o.active = false));\n this._emitChangeEvents();\n }\n // There is a race condition in certain situations where this.optionList is not fully updated during slotchange\n // Hence instead of using this.optionList, we have to perform a query on the <sgds-combo-box-option> elements\n const optionList = this.options.map(o => ({ value: o.value, label: o.textContent.trim() }));\n this.filteredList = optionList.filter(item => this.filterFunction(this.displayValue, item));\n\n // Filtering for slots\n this.emptyMenuAfterFiltering = this.filteredList.length === 0;\n const filteredValues = this.filteredList.map(l => l.value);\n\n this.options.forEach(o => {\n if (!filteredValues.includes(o.value)) {\n o.hidden = true;\n } else {\n o.hidden = false;\n }\n });\n }\n\n /**\n * Called whenever an <sgds-combo-box-option> dispatches sgds-select\"\n */\n protected async _handleItemSelected(e: Event) {\n const itemEl = e.target as SgdsComboBoxOption;\n if (itemEl.disabled) return;\n\n const itemLabel = itemEl.textContent?.trim() ?? \"\";\n const itemValueAttr = itemEl.getAttribute(\"value\") ?? itemLabel;\n const foundItem = this.filteredList.find(i => i.value.toString() === itemValueAttr) || {\n label: itemLabel,\n value: itemValueAttr\n };\n\n if (this.multiSelect) {\n if (!this.selectedItems.some(i => i.value === foundItem.value)) {\n this.selectedItems = [...this.selectedItems, foundItem];\n }\n\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n itemEl.active = true;\n } else {\n // Single-select\n // Only update active states if a new item is selected\n if (this.selectedItems.length === 0 || this.selectedItems[0].value !== foundItem.value) {\n // Remove active from all options\n this.options.forEach(o => (o.active = false));\n itemEl.active = true;\n\n this.selectedItems = [foundItem];\n this.value = foundItem.value.toString();\n this.displayValue = foundItem.label;\n this.hideMenu();\n }\n }\n this._emitChangeEvents();\n }\n\n private _handleItemUnselect(e: Event) {\n const itemEl = e.target as SgdsComboBoxOption;\n if (itemEl.disabled) return;\n\n itemEl.removeAttribute(\"active\");\n const itemLabel = itemEl.textContent?.trim() ?? \"\";\n const itemValueAttr = itemEl.getAttribute(\"value\") ?? itemLabel;\n const foundItem = this.filteredList.find(i => i.value.toString() === itemValueAttr) || {\n label: itemLabel,\n value: itemValueAttr\n };\n\n this.selectedItems = this.selectedItems.filter(i => i.value !== foundItem.value);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n this._emitChangeEvents();\n }\n\n private async _handleBadgeDismissed(e: CustomEvent, item: SgdsComboBoxOptionData) {\n e.preventDefault();\n const removedValue = item.value;\n this.options?.forEach(o => (o.value === removedValue ? (o.active = false) : null));\n this.selectedItems = this.selectedItems.filter(i => i.value !== item.value);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n this._emitChangeEvents();\n }\n\n private async _handleMultiSelectKeyDown(e: KeyboardEvent) {\n // Only do this in multi-select mode\n if (!this.multiSelect) {\n return;\n }\n\n if (e.key === \"Backspace\" && this.multiSelect) {\n if (this.displayValue.trim() === \"\" && this.selectedItems.length > 0) {\n const removedValue = this.selectedItems[this.selectedItems.length - 1].value;\n this.options?.forEach(o => (o.value === removedValue ? (o.active = false) : null));\n this.selectedItems = this.selectedItems.slice(0, -1);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n this._emitChangeEvents();\n }\n }\n }\n\n protected _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n protected async _handleInputBlur(e: Event) {\n e.preventDefault();\n\n this.emit(\"sgds-blur\");\n\n if (this.multiSelect) {\n const displayValueMatchedSelectedItems = this.selectedItems.filter(({ label }) => this.displayValue === label);\n if (displayValueMatchedSelectedItems.length <= 0) {\n this.displayValue = \"\";\n }\n } else {\n // Single select\n if (this.selectedItems.length > 0) {\n this.displayValue = this.selectedItems[0].label;\n } else {\n this.displayValue = \"\";\n }\n }\n }\n\n // For clearing the value\n protected async _handleClear() {\n this.value = this.displayValue = \"\";\n this.options?.forEach(o => (o.active = false));\n this._emitChangeEvents();\n\n const sgdsInput = await this._input;\n sgdsInput.focus();\n this.showMenu();\n }\n\n /** For form reset */\n protected async _mixinResetFormControl() {\n this.value = this.defaultValue;\n if (!this.multiSelect) {\n //reset menu\n this.options.forEach(o => {\n o.active = o.value === this.value;\n });\n const initialOption = this.options.filter(o => o.value === this.value);\n if (initialOption.length <= 0) {\n this.displayValue = \"\";\n } else {\n this.displayValue = initialOption[0].textContent.trim();\n }\n this._mixinResetValidity(await this._input);\n } else {\n const valueArray = this.value.split(\";\");\n // reset menu\n this.options.forEach(o => {\n o.active = valueArray.includes(o.value);\n });\n const initialOption = this.options.filter(o => valueArray.includes(o.value));\n this.selectedItems = initialOption.map(o => ({ value: o.value, label: o.textContent.trim() }));\n this._mixinResetValidity(await this._multiSelectInput);\n }\n }\n\n /**\n * Handles scroll events on the menu. Emits `sgds-scroll-end` once when the\n * scroll position reaches within `scrollBottomOffset` pixels of the bottom.\n * The event is suppressed until the user scrolls back up, preventing repeated\n * emissions while the menu stays at the bottom.\n */\n private async _handleScroll(e: MouseEvent) {\n const ele = e.target as HTMLElement;\n if (ele) {\n const endOfScroll = ele.scrollHeight - ele.clientHeight;\n const offset = Math.max(0, this.scrollBottomOffset);\n\n if (ele.scrollTop >= endOfScroll - offset) {\n if (!this.isScrollEnd) {\n this.emit(\"sgds-scroll-end\");\n }\n this.isScrollEnd = true;\n } else {\n this.isScrollEnd = false;\n }\n }\n }\n\n /** Template for the suffix icon */\n protected suffixIconTemplate: TemplateResult = html`<sgds-icon\n name=${this.menuIsOpen ? \"chevron-up\" : \"chevron-down\"}\n size=\"md\"\n ></sgds-icon>`;\n\n protected prefixIconTemplate: TemplateResult = html`${nothing}`;\n /**\n * Used `repeat` helper from Lit to render instead of .map:\n * The reassigning of value is affecting the truncation on badge as it is not triggering the slot change event.\n *\n * To compare this to lit-html's default handling for lists, consider reversing a large list of names:\n * For a list created using Array.map, lit-html maintains the DOM nodes for the list items, but reassigns the values\n * For a list created using repeat, the repeat directive reorders the existing DOM nodes, so the nodes representing the first list item move to the last position.\n */\n protected _renderInput(showClearButton: boolean): TemplateResult {\n const wantFeedbackStyle = this.hasFeedback;\n const showButton = showClearButton;\n\n return html`\n <div\n ${ref(this.myDropdown)}\n class=\"form-control-group ${classMap({\n disabled: this.disabled,\n readonly: this.readonly,\n \"is-invalid\": this.invalid && wantFeedbackStyle\n })}\"\n @click=${this._handleClick}\n >\n ${this.prefixIconTemplate}\n <div class=\"combobox-input-container\">\n ${this.multiSelect\n ? html`\n ${repeat(\n this.selectedItems,\n item => item.value,\n item =>\n html`<sgds-badge\n outlined\n variant=\"neutral\"\n show\n ?dismissible=${!(this.readonly || this.disabled)}\n ?fullwidth=${this.badgeFullWidth}\n @sgds-hide=${e => this._handleBadgeDismissed(e, item)}\n >${item.label}</sgds-badge\n >`\n )}\n `\n : nothing}\n <input\n class=\"form-control\"\n type=\"text\"\n id=${this._controlId}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n ?autofocus=${this.autofocus}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${this.displayValue ? this.displayValue.trim() : \"\"}\n @input=${this._handleInputChange}\n @blur=${this._handleInputBlur}\n @focus=${this._handleFocus}\n aria-describedby=${ifDefined(this.invalid && this.hasFeedback ? `${this._controlId}-invalid` : undefined)}\n aria-labelledby=\"${this._labelId} ${this._controlId}Help ${this.invalid && this.hasFeedback\n ? `${this._controlId}-invalid`\n : \"\"}\"\n .autocomplete=${this.autocomplete}\n />\n </div>\n\n ${showButton\n ? html`\n <sgds-icon\n id=${`${this._controlId}-combobox-clear-button`}\n tabindex=\"0\"\n class=\"form-clearable\"\n name=\"xcircle-fill\"\n size=\"md\"\n @click=${this._handleClear}\n aria-label=\"Clear selections\"\n role=\"button\"\n ></sgds-icon>\n `\n : nothing}\n ${this.suffixIconTemplate}\n </div>\n `;\n }\n\n protected _renderFeedbackMenu() {\n if (this.loading) {\n return this._renderLoadingMenu();\n }\n // When async, the filtering is done by remote server, so we do not check for emptyMenu of combobox filterFunction\n if (this.async) {\n return this.emptyMenuAsync || this.optionList.length === 0 ? this._renderEmptyMenu() : nothing;\n } else {\n return this.optionList.length === 0 || // no options at all\n (this.emptyMenuAfterFiltering && this.optionList.length > 0) // check if filtering results in empty menu\n ? this._renderEmptyMenu()\n : nothing;\n }\n }\n\n render() {\n const showClearButton =\n (this.isFocused || this.menuIsOpen) && this.value !== \"\" && this.clearable && !this.readonly;\n return html`\n <div\n class=${classMap({\n \"form-control-container\": true,\n \"m-width-256\": true,\n disabled: this.disabled,\n combobox: true\n })}\n @keydown=${this._handleMultiSelectKeyDown}\n >\n ${this._renderLabel()}\n <!-- The input -->\n ${this._renderInput(showClearButton)} ${this._renderFeedback()}\n\n <div\n id=${this.dropdownMenuId}\n class=\"dropdown-menu\"\n tabindex=\"-1\"\n role=\"menu\"\n aria-label=${this.label || \"Options\"}\n ${ref(this.menuRef)}\n @scroll=${this._handleScroll}\n >\n <slot\n id=\"default\"\n class=${classMap({ \"d-none\": this.loading || this.emptyMenuAsync || this.optionList.length === 0 })}\n @slotchange=${this._handleDefaultSlotChange}\n ></slot>\n ${this._renderFeedbackMenu()}\n </div>\n </div>\n\n <!-- Required an input element for constraint validation -->\n ${this.multiSelect\n ? html`<input\n .value=${live(this.value)}\n id=\"multi-select-input-tracker\"\n class=\"visually-hidden\"\n ?required=${this.required}\n tabindex=\"-1\"\n aria-hidden=\"true\"\n .autocomplete=${this.autocomplete}\n />`\n : nothing}\n `;\n }\n}\n\ninterface ComboBoxOptionWithFlag extends SgdsComboBoxOption {\n clickEventAdded?: boolean;\n}\n\nexport default SgdsComboBox;\n\n//TODO:\n// Replace this.optionList ?\n// During slotchange event _handleDefaultSlotChange, we try to populate this.optionList to obtain value attribute and textContent as label from <sgds-combo-box-option>\n// However, it has race conditions in certain situation like nextjs, where the last option's label (essentially the slot of <sgds-combo-box-option>) may not be available immediately.\n// To circumvent this, I avoid relying on this.optionList to perform filterFunction onInput handler and query this.options directly at the point of user typing.\n// To prevent confusion, this.optionList should ideally be removed in future iterations\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAa,eAAb,MAAa,qBAAqBA,uBAAAA,cAAc;;;EAYY,KAAA,cAAA;EAGG,KAAA,iBAAA;EAGL,KAAA,YAAA;EAGC,KAAA,aAAA;EAGL,KAAA,QAAA;EAGS,KAAA,iBAAA;EAGG,KAAA,qBAAA;EAIiB,KAAA,kBAAA,YAAY,SAAS;GACpG,OAAO,KAAK,MAAM,YAAY,CAAC,CAAC,WAAW,WAAW,YAAY,CAAC;EACrE;EAOwD,KAAA,aAAA,CAAC;EACd,KAAA,0BAAA;EAGZ,KAAA,YAAA;EAGE,KAA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E,sBAAsB,KAAK,CAAC,CAAA,GAAA,aAAA,WAAA,sBAAA,IAAA;AAiC7CA,iBAAAA,QAAAA,CAAAA,cAAAA,MAAM,cAAc,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,aAAA,WAAA,2BAAA,IAAA;AAKlDA,iBAAAA,QAAAA,CAAAA,cAAAA,MAAM,YAAY,EAAE,sBAAsB,KAAK,CAAC,CAAA,GAAA,aAAA,WAAA,yBAAA,IAAA"}
|
|
1
|
+
{"version":3,"file":"sgds-combo-box.cjs.js","names":["SelectElement","nothing","formTextControlStyle","comboBoxStyle","SgdsComboBoxOption","SgdsIcon","SgdsBadge","SgdsSpinner","ref","classMap","repeat","ifDefined","live","property","queryAsync","queryAssignedElements","state","watch"],"sources":["../../../../src/components/ComboBox/sgds-combo-box.ts"],"sourcesContent":["import { live } from \"lit/directives/live.js\";\nimport { html, nothing, PropertyValueMap, TemplateResult } from \"lit\";\nimport { property, queryAssignedElements, queryAsync, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\n\nimport { ref } from \"lit/directives/ref.js\";\nimport { SelectElement, SgdsOptionData } from \"../../base/select-element\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsBadge } from \"../Badge/sgds-badge\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport comboBoxStyle from \"./combo-box.css\";\nimport formTextControlStyle from \"../../styles/form-text-control.css\";\nimport { SgdsComboBoxOption } from \"./sgds-combo-box-option\";\n\nimport { repeat } from \"lit/directives/repeat.js\";\nimport SgdsSpinner from \"../Spinner/sgds-spinner\";\nimport { ISgdsComboBoxInputEventDetail, ISgdsComboBoxCreateOptionEventDetail } from \"./types\";\n\n/**\n * Each item in the ComboBox has a label to display\n * and a value (the actual data / ID).\n */\ntype SgdsComboBoxOptionData = SgdsOptionData;\n\nexport type { ISgdsComboBoxCreateOptionEventDetail, ISgdsComboBoxInputEventDetail };\n\n/**\n * @summary ComboBox component is used for users to make one or more selections from a list through user input, keyboard or mouse actions\n *\n * @slot default - default slot to pass in sgds-combo-box-option\n * @slot create - Custom content for the \"Create\" option shown when `creatable` is true and no match is found. Use `sgds-input` event to dynamically update the slotted content with the current input value.\n *\n * @event sgds-select - Emitted when the combo box's selected value changes.\n * @event sgds-change - Emitted when the combo box's value changes.\n * @event sgds-input - Emitted when user input is received and its value changes. `event.detail = { displayValue }`\n * @eventDetail {ISgdsComboBoxInputEventDetail} sgds-input\n * @event sgds-focus - Emitted when user input is focused.\n * @event sgds-blur - Emitted when user input is blurred.\n * @event sgds-invalid - Emitted when the combo box's invalid state is set to true.\n * @event sgds-valid - Emitted when the combo box's invalid state is set to false.\n * @event sgds-scroll-end - Emitted once when the menu is scrolled to within `scrollBottomOffset` pixels of the bottom. Resets when the user scrolls back up.\n * @event sgds-create-option - Emitted when the user selects the \"Create xxx\" option. `event.detail = { value }`\n * @eventDetail {ISgdsComboBoxCreateOptionEventDetail} sgds-create-option\n */\nexport class SgdsComboBox extends SelectElement {\n static styles = [...SelectElement.styles, formTextControlStyle, comboBoxStyle];\n static childName = \"sgds-combo-box-option\";\n /** @internal */\n static dependencies = {\n [SgdsComboBox.childName]: SgdsComboBoxOption,\n \"sgds-icon\": SgdsIcon,\n \"sgds-badge\": SgdsBadge,\n \"sgds-spinner\": SgdsSpinner\n };\n\n /** If true, renders multiple checkbox selection items. If false, single-select. */\n @property({ type: Boolean, reflect: true }) multiSelect = false;\n\n /** If true, renders badge that fills width of combobox */\n @property({ type: Boolean, reflect: true }) badgeFullWidth = false;\n\n /** If true, a clear button will be enabled on focus */\n @property({ type: Boolean, reflect: true }) clearable = false;\n\n /** Disables native and sgds validation for the combo box. */\n @property({ type: Boolean, reflect: true }) noValidate = false;\n\n /** Enables the asynchronous behaviour of a combo box. When true, filterFunction is ignored and filtering is done remotely. */\n @property({ type: Boolean, reflect: true }) async = false;\n\n /** When filtering remotely and there are no results, set this to true to enable no options feedback on the menu. Applicable for async combo box only. */\n @property({ type: Boolean, reflect: true }) emptyMenuAsync = false;\n\n /** When true, shows a \"Create xxx\" option when the typed value does not match any existing option. Selecting it emits the `sgds-create-option` event. */\n @property({ type: Boolean, reflect: true }) creatable = false;\n\n /** Number of pixels from the bottom of the menu at which the sgds-scroll-end event fires. */\n @property({ type: Number, reflect: true }) scrollBottomOffset = 0;\n\n /** The function used to filter the menu list, given the user's input value. */\n @property()\n filterFunction: (inputValue: string, item: SgdsComboBoxOptionData) => boolean = (inputValue, item) => {\n return item.label.toLowerCase().startsWith(inputValue.toLowerCase());\n };\n\n @queryAsync(\"input#multi-select-input-tracker\") private _multiSelectInput: Promise<HTMLInputElement>;\n\n @queryAssignedElements({ flatten: true, selector: \"sgds-combo-box-option\" })\n protected options: SgdsComboBoxOption[];\n\n @state() private optionList: SgdsComboBoxOptionData[] = [];\n @state() private emptyMenuAfterFiltering = false;\n\n // Used to show and hide the clear button\n @state() protected isFocused = false;\n\n // Used to determine if the scroll reached the end with offset\n @state() protected isScrollEnd = false;\n\n connectedCallback(): void {\n super.connectedCallback();\n\n this.addEventListener(\"focus\", async () => {\n this.isFocused = true;\n });\n\n this.addEventListener(\"blur\", async () => {\n this.isFocused = false;\n });\n\n this.addEventListener(\"keydown\", (e: KeyboardEvent) => {\n if (\n e.key === \"Enter\" &&\n (e.target as HTMLElement).shadowRoot?.querySelector(\".form-clearable\")?.matches(\":focus\")\n ) {\n this._handleClear();\n }\n });\n\n this.addEventListener(\"sgds-hide\", async (e: CustomEvent) => {\n if (!e.detail.isOutside) {\n const sgdsInput = await this._input;\n sgdsInput.focus();\n }\n\n this.options.forEach(o => {\n o.removeAttribute(\"hidden\");\n });\n // reset emptyMenu state\n this.emptyMenuAfterFiltering = false;\n });\n }\n\n async firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n if (this.async) this.filterFunction = () => true;\n this.menuList.forEach(o => {\n const comboBoxOption = document.createElement(\"sgds-combo-box-option\") as SgdsComboBoxOption;\n comboBoxOption.innerText = o.label;\n comboBoxOption.value = o.value;\n comboBoxOption.checkbox = this.multiSelect;\n comboBoxOption.active = this.value.includes(o.value);\n this.appendChild(comboBoxOption);\n });\n this._setupValidation(this.menuList);\n if (this.menuIsOpen) {\n await this.updateFloatingPosition();\n }\n }\n\n protected async _handleDefaultSlotChange(e: Event) {\n const assignedElements = (e.target as HTMLSlotElement).assignedElements({\n flatten: true\n }) as ComboBoxOptionWithFlag[];\n\n assignedElements.forEach(option => {\n // Handling of click events\n if (option.hasAttribute(\"disabled\")) return false;\n if (option.clickEventAdded) return false;\n\n option.addEventListener(\"click\", (evt: PointerEvent) => {\n evt.preventDefault();\n const optionTarget = evt.target as SgdsComboBoxOption;\n\n if (this.multiSelect) {\n optionTarget.active ? this._handleItemUnselect(evt) : this._handleItemSelected(evt);\n } else {\n this._handleItemSelected(evt);\n }\n\n return false;\n });\n option.clickEventAdded = true;\n option.addEventListener(\"keydown\", (evt: KeyboardEvent) => {\n if (evt.key === \"Enter\") {\n this.close = \"outside\";\n const optionTarget = evt.target as SgdsComboBoxOption;\n optionTarget.click();\n }\n });\n });\n\n /** this will trigger _updateValueAndDisplayValue */\n await this.updateComplete;\n const realOptions = assignedElements;\n this.optionList = await this._getMenuListFromOptions(realOptions);\n this._setupValidation(this.optionList);\n }\n\n private async _setupValidation(list: SgdsComboBoxOptionData[]) {\n if (this.value && list.length > 0) {\n const valueArray = this.value.split(\";\");\n const initialSelectedItem = list.filter(({ value }) => valueArray.includes(value));\n this.selectedItems = [...initialSelectedItem, ...this.selectedItems];\n\n if (!this.multiSelect) {\n this.displayValue = initialSelectedItem[0]?.label;\n }\n }\n /** We want to run validation regardless of value or list present */\n this.multiSelect ? (this.input = await this._multiSelectInput) : (this.input = await this._input);\n this._mixinValidate(this.input);\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n async _handleValueChange() {\n this.options.forEach(o => {\n o.removeAttribute(\"hidden\");\n });\n\n const sgdsInput = await this._input;\n this._mixinSetFormValue();\n\n if (this.multiSelect) {\n this._mixinValidate(this.input);\n } else {\n this._mixinValidate(sgdsInput);\n }\n\n // When value is updated by user and it doesn't map to selectedItems, we should re-map selectedItems\n const selectedItemVal = this.selectedItems.map(val => val.value).join(\";\");\n if (selectedItemVal !== this.value) {\n this._updateValueAndDisplayValue(this.optionList);\n }\n\n if (!this._isTouched && this.value === \"\") return;\n if (this._mixinShouldSkipSgdsValidation()) return;\n this.invalid = !this._mixinReportValidity();\n }\n\n /** Emits sgds-change and sgds-select events. Call after setting this.value from user interaction. */\n private _emitChangeEvents() {\n this._mixinSetFormValue();\n this.emit(\"sgds-change\");\n if (this.value) {\n this.emit(\"sgds-select\");\n }\n }\n\n @watch(\"optionList\", { waitUntilFirstUpdate: true })\n _handleOptionListChange() {\n this._updateValueAndDisplayValue(this.optionList);\n }\n\n @watch(\"menuList\", { waitUntilFirstUpdate: true })\n _handleMenuListChange() {\n const newMenu = this.menuList.map(o => {\n const comboBoxOption = document.createElement(\"sgds-combo-box-option\") as SgdsComboBoxOption;\n comboBoxOption.innerText = o.label;\n comboBoxOption.value = o.value;\n comboBoxOption.checkbox = this.multiSelect;\n comboBoxOption.active = this.value.includes(o.value);\n return comboBoxOption;\n });\n\n this.replaceChildren(...newMenu);\n }\n\n private _updateValueAndDisplayValue(list: SgdsComboBoxOptionData[]) {\n const valueArray = this.value.split(\";\");\n const initialSelectedItem = list.filter(({ value }) => valueArray.includes(value));\n this.selectedItems = [...initialSelectedItem];\n // When the new filtered items don't match value we update it\n const updatedValue = initialSelectedItem.map(item => item.value).join(\";\");\n if (updatedValue !== this.value) {\n this.value = updatedValue;\n }\n // Disabling this condition for async combobox so that the display value in the input will not clear when menu options changes\n if (!this.multiSelect && !this.async) {\n this.displayValue = initialSelectedItem[0]?.label || \"\";\n }\n\n this.options.forEach(o => (o.active = valueArray.includes(o.value)));\n }\n\n // Called each time the user types in the <sgds-input>, we set .value and show the menu\n protected async _handleInputChange(e: CustomEvent) {\n const input = e.target as HTMLInputElement;\n this.displayValue = input.value;\n this.emit<ISgdsComboBoxInputEventDetail>(\"sgds-input\", { detail: { displayValue: this.displayValue } });\n this.invalid = false;\n this.showMenu();\n // reset menu list when displayValue is cleared\n if (this.displayValue === \"\" && !this.multiSelect) {\n this.selectedItems = [];\n this.value = this.selectedItems.join(\";\");\n this.options.forEach(o => (o.active = false));\n this._emitChangeEvents();\n }\n // There is a race condition in certain situations where this.optionList is not fully updated during slotchange\n // Hence instead of using this.optionList, we have to perform a query on the <sgds-combo-box-option> elements\n const realOptions = this.options;\n const optionList = realOptions.map(o => ({ value: o.value, label: o.textContent.trim() }));\n this.filteredList = optionList.filter(item => this.filterFunction(this.displayValue, item));\n\n // Filtering for slots\n this.emptyMenuAfterFiltering = this.filteredList.length === 0;\n const filteredValues = this.filteredList.map(l => l.value);\n\n this.options.forEach(o => {\n if (!filteredValues.includes(o.value)) {\n o.hidden = true;\n } else {\n o.hidden = false;\n }\n });\n this._syncCreateOption();\n }\n\n /**\n * Called whenever an <sgds-combo-box-option> dispatches sgds-select\"\n */\n protected async _handleItemSelected(e: Event) {\n const itemEl = e.target as SgdsComboBoxOption;\n if (itemEl.disabled) return;\n\n const itemLabel = itemEl.textContent?.trim() ?? \"\";\n const itemValueAttr = itemEl.getAttribute(\"value\") ?? itemLabel;\n const foundItem = this.filteredList.find(i => i.value.toString() === itemValueAttr) || {\n label: itemLabel,\n value: itemValueAttr\n };\n\n if (this.multiSelect) {\n if (!this.selectedItems.some(i => i.value === foundItem.value)) {\n this.selectedItems = [...this.selectedItems, foundItem];\n }\n\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n itemEl.active = true;\n this.displayValue = \"\";\n } else {\n // Single-select\n // Only update active states if a new item is selected\n if (this.selectedItems.length === 0 || this.selectedItems[0].value !== foundItem.value) {\n // Remove active from all options\n this.options.forEach(o => (o.active = false));\n itemEl.active = true;\n\n this.selectedItems = [foundItem];\n this.value = foundItem.value.toString();\n this.displayValue = foundItem.label;\n this.hideMenu();\n }\n }\n this._emitChangeEvents();\n }\n\n private _handleItemUnselect(e: Event) {\n const itemEl = e.target as SgdsComboBoxOption;\n if (itemEl.disabled) return;\n\n itemEl.removeAttribute(\"active\");\n const itemLabel = itemEl.textContent?.trim() ?? \"\";\n const itemValueAttr = itemEl.getAttribute(\"value\") ?? itemLabel;\n const foundItem = this.filteredList.find(i => i.value.toString() === itemValueAttr) || {\n label: itemLabel,\n value: itemValueAttr\n };\n\n this.selectedItems = this.selectedItems.filter(i => i.value !== foundItem.value);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n this._emitChangeEvents();\n }\n\n private async _handleBadgeDismissed(e: CustomEvent, item: SgdsComboBoxOptionData) {\n e.preventDefault();\n const removedValue = item.value;\n this.options?.forEach(o => (o.value === removedValue ? (o.active = false) : null));\n this.selectedItems = this.selectedItems.filter(i => i.value !== item.value);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n this._emitChangeEvents();\n }\n\n private async _handleMultiSelectKeyDown(e: KeyboardEvent) {\n // Only do this in multi-select mode\n if (!this.multiSelect) {\n return;\n }\n\n if (e.key === \"Backspace\" && this.multiSelect) {\n if (this.displayValue.trim() === \"\" && this.selectedItems.length > 0) {\n const removedValue = this.selectedItems[this.selectedItems.length - 1].value;\n this.options?.forEach(o => (o.value === removedValue ? (o.active = false) : null));\n this.selectedItems = this.selectedItems.slice(0, -1);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n this._emitChangeEvents();\n }\n }\n }\n\n protected _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n protected async _handleInputBlur(e: Event) {\n e.preventDefault();\n\n this.emit(\"sgds-blur\");\n\n // When focus is moving to an element inside this component (e.g. keyboard nav to an option),\n // preserve the typed input. If focus moves outside, clear as usual.\n const relatedTarget = (e as FocusEvent).relatedTarget as Node | null;\n if (\n (this.creatable || this.multiSelect) &&\n relatedTarget &&\n (this.contains(relatedTarget) || this.shadowRoot?.contains(relatedTarget))\n )\n return;\n\n if (this.multiSelect) {\n const displayValueMatchedSelectedItems = this.selectedItems.filter(({ label }) => this.displayValue === label);\n if (displayValueMatchedSelectedItems.length <= 0) {\n this.displayValue = \"\";\n }\n } else {\n // Single select\n if (this.selectedItems.length > 0) {\n this.displayValue = this.selectedItems[0].label;\n } else {\n this.displayValue = \"\";\n }\n }\n }\n\n // For clearing the value\n protected async _handleClear() {\n this.value = this.displayValue = \"\";\n this.options?.forEach(o => (o.active = false));\n this._emitChangeEvents();\n\n const sgdsInput = await this._input;\n sgdsInput.focus();\n this.showMenu();\n }\n\n /** For form reset */\n protected async _mixinResetFormControl() {\n this.value = this.defaultValue;\n if (!this.multiSelect) {\n //reset menu\n this.options.forEach(o => {\n o.active = o.value === this.value;\n });\n const initialOption = this.options.filter(o => o.value === this.value);\n if (initialOption.length <= 0) {\n this.displayValue = \"\";\n } else {\n this.displayValue = initialOption[0].textContent.trim();\n }\n this._mixinResetValidity(await this._input);\n } else {\n const valueArray = this.value.split(\";\");\n // reset menu\n this.options.forEach(o => {\n o.active = valueArray.includes(o.value);\n });\n const initialOption = this.options.filter(o => valueArray.includes(o.value));\n this.selectedItems = initialOption.map(o => ({ value: o.value, label: o.textContent.trim() }));\n this._mixinResetValidity(await this._multiSelectInput);\n }\n }\n\n /**\n * Handles scroll events on the menu. Emits `sgds-scroll-end` once when the\n * scroll position reaches within `scrollBottomOffset` pixels of the bottom.\n * The event is suppressed until the user scrolls back up, preventing repeated\n * emissions while the menu stays at the bottom.\n */\n private async _handleScroll(e: MouseEvent) {\n const ele = e.target as HTMLElement;\n if (ele) {\n const endOfScroll = ele.scrollHeight - ele.clientHeight;\n const offset = Math.max(0, this.scrollBottomOffset);\n\n if (ele.scrollTop >= endOfScroll - offset) {\n if (!this.isScrollEnd) {\n this.emit(\"sgds-scroll-end\");\n }\n this.isScrollEnd = true;\n } else {\n this.isScrollEnd = false;\n }\n }\n }\n\n /** Template for the suffix icon */\n protected suffixIconTemplate: TemplateResult = html`<sgds-icon\n name=${this.menuIsOpen ? \"chevron-up\" : \"chevron-down\"}\n size=\"md\"\n ></sgds-icon>`;\n\n protected prefixIconTemplate: TemplateResult = html`${nothing}`;\n /**\n * Used `repeat` helper from Lit to render instead of .map:\n * The reassigning of value is affecting the truncation on badge as it is not triggering the slot change event.\n *\n * To compare this to lit-html's default handling for lists, consider reversing a large list of names:\n * For a list created using Array.map, lit-html maintains the DOM nodes for the list items, but reassigns the values\n * For a list created using repeat, the repeat directive reorders the existing DOM nodes, so the nodes representing the first list item move to the last position.\n */\n protected _renderInput(showClearButton: boolean): TemplateResult {\n const wantFeedbackStyle = this.hasFeedback;\n const showButton = showClearButton;\n\n return html`\n <div\n ${ref(this.myDropdown)}\n class=\"form-control-group ${classMap({\n disabled: this.disabled,\n readonly: this.readonly,\n \"is-invalid\": this.invalid && wantFeedbackStyle\n })}\"\n @click=${this._handleClick}\n >\n ${this.prefixIconTemplate}\n <div class=\"combobox-input-container\">\n ${this.multiSelect\n ? html`\n ${repeat(\n this.selectedItems,\n item => item.value,\n item =>\n html`<sgds-badge\n outlined\n variant=\"neutral\"\n show\n ?dismissible=${!(this.readonly || this.disabled)}\n ?fullwidth=${this.badgeFullWidth}\n @sgds-hide=${e => this._handleBadgeDismissed(e, item)}\n >${item.label}</sgds-badge\n >`\n )}\n `\n : nothing}\n <input\n class=\"form-control\"\n type=\"text\"\n id=${this._controlId}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n ?autofocus=${this.autofocus}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${this.displayValue ? this.displayValue.trim() : \"\"}\n @input=${this._handleInputChange}\n @blur=${this._handleInputBlur}\n @focus=${this._handleFocus}\n aria-describedby=${ifDefined(this.invalid && this.hasFeedback ? `${this._controlId}-invalid` : undefined)}\n aria-labelledby=\"${this._labelId} ${this._controlId}Help ${this.invalid && this.hasFeedback\n ? `${this._controlId}-invalid`\n : \"\"}\"\n .autocomplete=${this.autocomplete}\n />\n </div>\n\n ${showButton\n ? html`\n <sgds-icon\n id=${`${this._controlId}-combobox-clear-button`}\n tabindex=\"0\"\n class=\"form-clearable\"\n name=\"xcircle-fill\"\n size=\"md\"\n @click=${this._handleClear}\n aria-label=\"Clear selections\"\n role=\"button\"\n ></sgds-icon>\n `\n : nothing}\n ${this.suffixIconTemplate}\n </div>\n `;\n }\n\n /** Slotted elements from the `create-option` named slot. */\n private _createOptionSlotContent: Element[] = [];\n\n /** The typed value captured when the create option was last synced. */\n private _createOptionValue = \"\";\n\n /** Whether the shadow-DOM create-option container is visible. */\n @state() private _showCreateOption = false;\n\n /** Updates visibility of the create-option container based on creatable + filter state. */\n private _syncCreateOption() {\n this._showCreateOption = this.creatable && this.emptyMenuAfterFiltering && this.displayValue !== \"\";\n if (this._showCreateOption) {\n this._createOptionValue = this.displayValue;\n }\n }\n\n /** Handles slotchange for the create-option named slot. */\n private _handleCreateOptionSlotChange(e: Event) {\n this._createOptionSlotContent = (e.target as HTMLSlotElement).assignedElements({ flatten: true });\n }\n\n /** Click handler for the create-option container. Lets interactive slotted elements (links, buttons) pass through. */\n private _handleCreateOptionClick(evt: Event) {\n const target = evt.composedPath()[0] as HTMLElement;\n if (target.closest?.(\"a, button\")) return;\n\n this.emit<ISgdsComboBoxCreateOptionEventDetail>(\"sgds-create-option\", {\n detail: { value: this._createOptionValue }\n });\n this.emptyMenuAfterFiltering = false;\n this._syncCreateOption();\n this.hideMenu();\n }\n\n /** Keydown handler for the create-option container. */\n private _handleCreateOptionKeydown(evt: KeyboardEvent) {\n if (evt.key === \"Enter\") {\n this._handleCreateOptionClick(evt);\n return;\n }\n // ArrowUp from create option → focus last menu item\n if (evt.key === \"ArrowUp\") {\n evt.preventDefault();\n const items = this._getActiveMenuItems();\n if (items.length > 0) {\n this._setMenuItem(items.length - 1);\n }\n return;\n }\n // ArrowDown from create option → wrap to first menu item\n if (evt.key === \"ArrowDown\") {\n evt.preventDefault();\n const items = this._getActiveMenuItems();\n if (items.length > 0) {\n this._setMenuItem(0);\n }\n }\n }\n\n /** Override base keyboard handler to include create-option in ArrowDown/Tab navigation. */\n protected override _handleKeyboardMenuItemsEvent(e: KeyboardEvent) {\n // When create-option div is focused, let Tab pass through naturally so it can reach\n // interactive elements inside slotted content (e.g. links)\n const createDiv = this.shadowRoot?.querySelector(\".create-option\") as HTMLElement;\n if (createDiv?.matches(\":focus\") && e.key === \"Tab\") {\n return;\n }\n\n if (this._showCreateOption && (e.key === \"ArrowDown\" || (e.key === \"Tab\" && !e.shiftKey))) {\n const items = this._getActiveMenuItems();\n if (items.length > 0) {\n const lastItem = items[items.length - 1];\n const lastItemFocused = lastItem.shadowRoot?.querySelector(\".dropdown-item\")?.matches(\":focus\");\n if (lastItemFocused) {\n e.preventDefault();\n createDiv?.focus();\n return;\n }\n }\n // When no items exist but create option is visible (empty filter), focus it\n if (items.length === 0) {\n e.preventDefault();\n createDiv?.focus();\n return;\n }\n }\n super._handleKeyboardMenuItemsEvent(e);\n }\n\n protected _renderFeedbackMenu() {\n if (this.loading) {\n return this._renderLoadingMenu();\n }\n // When async, the filtering is done by remote server, so we do not check for emptyMenu of combobox filterFunction\n if (this.async) {\n return this.emptyMenuAsync || this.optionList.length === 0 ? this._renderEmptyMenu() : nothing;\n } else {\n // When creatable, the create option is a slotted element — skip \"No options\"\n if (this.creatable && this.emptyMenuAfterFiltering && this.optionList.length > 0) {\n return nothing;\n }\n return this.optionList.length === 0 || (this.emptyMenuAfterFiltering && this.optionList.length > 0)\n ? this._renderEmptyMenu()\n : nothing;\n }\n }\n\n render() {\n const showClearButton =\n (this.isFocused || this.menuIsOpen) && this.value !== \"\" && this.clearable && !this.readonly;\n return html`\n <div\n class=${classMap({\n \"form-control-container\": true,\n \"m-width-256\": true,\n disabled: this.disabled,\n combobox: true\n })}\n @keydown=${this._handleMultiSelectKeyDown}\n >\n ${this._renderLabel()}\n <!-- The input -->\n ${this._renderInput(showClearButton)} ${this._renderFeedback()}\n\n <div\n id=${this.dropdownMenuId}\n class=\"dropdown-menu\"\n tabindex=\"-1\"\n role=\"menu\"\n aria-label=${this.label || \"Options\"}\n ${ref(this.menuRef)}\n @scroll=${this._handleScroll}\n >\n <slot\n id=\"default\"\n class=${classMap({ \"d-none\": this.loading || this.emptyMenuAsync || this.optionList.length === 0 })}\n @slotchange=${this._handleDefaultSlotChange}\n ></slot>\n ${this._showCreateOption\n ? html`<div\n class=${classMap({ \"create-option\": true, slotted: this._createOptionSlotContent.length > 0 })}\n tabindex=\"0\"\n role=\"option\"\n @click=${this._handleCreateOptionClick}\n @keydown=${this._handleCreateOptionKeydown}\n >\n ${this._createOptionSlotContent.length > 0\n ? html`<slot name=\"create\" @slotchange=${this._handleCreateOptionSlotChange}></slot>`\n : `Create \"${this.displayValue}\"`}\n </div>`\n : html`<slot name=\"create\" class=\"d-none\" @slotchange=${this._handleCreateOptionSlotChange}></slot>`}\n ${this._renderFeedbackMenu()}\n </div>\n </div>\n\n <!-- Required an input element for constraint validation -->\n ${this.multiSelect\n ? html`<input\n .value=${live(this.value)}\n id=\"multi-select-input-tracker\"\n class=\"visually-hidden\"\n ?required=${this.required}\n tabindex=\"-1\"\n aria-hidden=\"true\"\n .autocomplete=${this.autocomplete}\n />`\n : nothing}\n `;\n }\n}\n\ninterface ComboBoxOptionWithFlag extends SgdsComboBoxOption {\n clickEventAdded?: boolean;\n}\n\nexport default SgdsComboBox;\n\n//TODO:\n// Replace this.optionList ?\n// During slotchange event _handleDefaultSlotChange, we try to populate this.optionList to obtain value attribute and textContent as label from <sgds-combo-box-option>\n// However, it has race conditions in certain situation like nextjs, where the last option's label (essentially the slot of <sgds-combo-box-option>) may not be available immediately.\n// To circumvent this, I avoid relying on this.optionList to perform filterFunction onInput handler and query this.options directly at the point of user typing.\n// To prevent confusion, this.optionList should ideally be removed in future iterations\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAa,eAAb,MAAa,qBA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