@govtechsg/sgds-web-component 3.14.1-rc.0 → 3.15.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-element.d.ts +2 -0
- package/base/dropdown-element.js +8 -2
- package/base/dropdown-element.js.map +1 -1
- package/components/Accordion/index.umd.min.js +8 -8
- package/components/Accordion/index.umd.min.js.map +1 -1
- package/components/Accordion/sgds-accordion.d.ts +1 -2
- package/components/Accordion/sgds-accordion.js +2 -3
- package/components/Accordion/sgds-accordion.js.map +1 -1
- package/components/Breadcrumb/index.umd.min.js +1 -1
- package/components/Breadcrumb/index.umd.min.js.map +1 -1
- package/components/ComboBox/index.umd.min.js +24 -24
- package/components/ComboBox/index.umd.min.js.map +1 -1
- package/components/ComboBox/sgds-combo-box.js +2 -2
- package/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/components/Datepicker/datepicker.js +1 -1
- package/components/Datepicker/index.umd.min.js +3 -3
- package/components/Datepicker/index.umd.min.js.map +1 -1
- package/components/Datepicker/sgds-datepicker.js +1 -1
- package/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/components/Dropdown/dropdown-menu.js +1 -1
- package/components/Dropdown/index.umd.min.js +1 -1
- package/components/Dropdown/index.umd.min.js.map +1 -1
- package/components/Dropdown/sgds-dropdown.js +1 -1
- package/components/Dropdown/sgds-dropdown.js.map +1 -1
- package/components/Mainnav/index.umd.min.js +8 -8
- package/components/Mainnav/index.umd.min.js.map +1 -1
- package/components/Mainnav/sgds-mainnav.d.ts +3 -1
- package/components/Mainnav/sgds-mainnav.js +9 -5
- package/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/components/OverflowMenu/index.umd.min.js +1 -1
- package/components/OverflowMenu/index.umd.min.js.map +1 -1
- package/components/Select/index.umd.min.js +7 -7
- package/components/Select/index.umd.min.js.map +1 -1
- package/components/Select/sgds-select.js +2 -2
- package/components/Select/sgds-select.js.map +1 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/components/index.js.map +1 -1
- package/components/index.umd.min.js +77 -130
- package/components/index.umd.min.js.map +1 -1
- package/css/fouc.css +0 -4
- package/css/sgds.css +2 -2
- package/css/utility.css +29 -18
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/index.js.map +1 -1
- package/index.umd.min.js +65 -196
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/react/base/dropdown-element.cjs.js +8 -2
- package/react/base/dropdown-element.cjs.js.map +1 -1
- package/react/base/dropdown-element.js +8 -2
- package/react/base/dropdown-element.js.map +1 -1
- package/react/components/Accordion/sgds-accordion.cjs.js +2 -3
- package/react/components/Accordion/sgds-accordion.cjs.js.map +1 -1
- package/react/components/Accordion/sgds-accordion.js +2 -3
- package/react/components/Accordion/sgds-accordion.js.map +1 -1
- package/react/components/ComboBox/sgds-combo-box.cjs.js +2 -2
- package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
- package/react/components/ComboBox/sgds-combo-box.js +2 -2
- package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/react/components/Datepicker/datepicker.cjs.js +1 -1
- package/react/components/Datepicker/datepicker.js +1 -1
- package/react/components/Datepicker/sgds-datepicker.cjs.js +1 -1
- package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
- package/react/components/Datepicker/sgds-datepicker.js +1 -1
- package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/react/components/Dropdown/dropdown-menu.cjs.js +1 -1
- package/react/components/Dropdown/dropdown-menu.js +1 -1
- package/react/components/Dropdown/sgds-dropdown.cjs.js +1 -1
- package/react/components/Dropdown/sgds-dropdown.cjs.js.map +1 -1
- package/react/components/Dropdown/sgds-dropdown.js +1 -1
- package/react/components/Dropdown/sgds-dropdown.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav.cjs.js +9 -5
- package/react/components/Mainnav/sgds-mainnav.cjs.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav.js +9 -5
- package/react/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/react/components/Select/sgds-select.cjs.js +2 -2
- package/react/components/Select/sgds-select.cjs.js.map +1 -1
- package/react/components/Select/sgds-select.js +2 -2
- package/react/components/Select/sgds-select.js.map +1 -1
- package/react/index.cjs.js +48 -56
- package/react/index.cjs.js.map +1 -1
- package/react/index.d.ts +0 -4
- package/react/index.js +0 -4
- package/react/index.js.map +1 -1
- package/themes/responsive.css +18 -0
- package/base/sidebar-element.d.ts +0 -112
- package/base/sidebar-element.js +0 -281
- package/base/sidebar-element.js.map +0 -1
- package/components/Sidebar/index.d.ts +0 -16
- package/components/Sidebar/index.js +0 -10
- package/components/Sidebar/index.js.map +0 -1
- package/components/Sidebar/index.umd.min.js +0 -2501
- package/components/Sidebar/index.umd.min.js.map +0 -1
- package/components/Sidebar/sgds-sidebar-group.d.ts +0 -51
- package/components/Sidebar/sgds-sidebar-group.js +0 -124
- package/components/Sidebar/sgds-sidebar-group.js.map +0 -1
- package/components/Sidebar/sgds-sidebar-item.d.ts +0 -25
- package/components/Sidebar/sgds-sidebar-item.js +0 -73
- package/components/Sidebar/sgds-sidebar-item.js.map +0 -1
- package/components/Sidebar/sgds-sidebar-section.d.ts +0 -56
- package/components/Sidebar/sgds-sidebar-section.js +0 -125
- package/components/Sidebar/sgds-sidebar-section.js.map +0 -1
- package/components/Sidebar/sgds-sidebar.d.ts +0 -156
- package/components/Sidebar/sgds-sidebar.js +0 -412
- package/components/Sidebar/sgds-sidebar.js.map +0 -1
- package/components/Sidebar/sidebar-context.d.ts +0 -51
- package/components/Sidebar/sidebar-context.js +0 -45
- package/components/Sidebar/sidebar-context.js.map +0 -1
- package/components/Sidebar/sidebar-item.js +0 -6
- package/components/Sidebar/sidebar-item.js.map +0 -1
- package/components/Sidebar/sidebar-section.js +0 -6
- package/components/Sidebar/sidebar-section.js.map +0 -1
- package/components/Sidebar/sidebar.js +0 -6
- package/components/Sidebar/sidebar.js.map +0 -1
- package/react/base/sidebar-element.cjs.js +0 -286
- package/react/base/sidebar-element.cjs.js.map +0 -1
- package/react/base/sidebar-element.js +0 -282
- package/react/base/sidebar-element.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-group.cjs.js +0 -130
- package/react/components/Sidebar/sgds-sidebar-group.cjs.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-group.js +0 -125
- package/react/components/Sidebar/sgds-sidebar-group.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-item.cjs.js +0 -79
- package/react/components/Sidebar/sgds-sidebar-item.cjs.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-item.js +0 -74
- package/react/components/Sidebar/sgds-sidebar-item.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-section.cjs.js +0 -131
- package/react/components/Sidebar/sgds-sidebar-section.cjs.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar-section.js +0 -126
- package/react/components/Sidebar/sgds-sidebar-section.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar.cjs.js +0 -418
- package/react/components/Sidebar/sgds-sidebar.cjs.js.map +0 -1
- package/react/components/Sidebar/sgds-sidebar.js +0 -413
- package/react/components/Sidebar/sgds-sidebar.js.map +0 -1
- package/react/components/Sidebar/sidebar-context.cjs.js +0 -54
- package/react/components/Sidebar/sidebar-context.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar-context.js +0 -46
- package/react/components/Sidebar/sidebar-context.js.map +0 -1
- package/react/components/Sidebar/sidebar-item.cjs.js +0 -11
- package/react/components/Sidebar/sidebar-item.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar-item.js +0 -7
- package/react/components/Sidebar/sidebar-item.js.map +0 -1
- package/react/components/Sidebar/sidebar-section.cjs.js +0 -11
- package/react/components/Sidebar/sidebar-section.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar-section.js +0 -7
- package/react/components/Sidebar/sidebar-section.js.map +0 -1
- package/react/components/Sidebar/sidebar.cjs.js +0 -11
- package/react/components/Sidebar/sidebar.cjs.js.map +0 -1
- package/react/components/Sidebar/sidebar.js +0 -7
- package/react/components/Sidebar/sidebar.js.map +0 -1
- package/react/sidebar/index.cjs.js +0 -42
- package/react/sidebar/index.cjs.js.map +0 -1
- package/react/sidebar/index.d.ts +0 -2
- package/react/sidebar/index.js +0 -18
- package/react/sidebar/index.js.map +0 -1
- package/react/sidebar-group/index.cjs.js +0 -40
- package/react/sidebar-group/index.cjs.js.map +0 -1
- package/react/sidebar-group/index.d.ts +0 -2
- package/react/sidebar-group/index.js +0 -16
- package/react/sidebar-group/index.js.map +0 -1
- package/react/sidebar-item/index.cjs.js +0 -40
- package/react/sidebar-item/index.cjs.js.map +0 -1
- package/react/sidebar-item/index.d.ts +0 -2
- package/react/sidebar-item/index.js +0 -16
- package/react/sidebar-item/index.js.map +0 -1
- package/react/sidebar-section/index.cjs.js +0 -40
- package/react/sidebar-section/index.cjs.js.map +0 -1
- package/react/sidebar-section/index.d.ts +0 -2
- package/react/sidebar-section/index.js +0 -16
- package/react/sidebar-section/index.js.map +0 -1
|
@@ -41,6 +41,8 @@ export declare class DropdownElement extends SgdsElement {
|
|
|
41
41
|
firstUpdated(changedProperties: PropertyValueMap<this>): void;
|
|
42
42
|
/** When invoked, opens the dropdown menu */
|
|
43
43
|
showMenu(): Promise<void>;
|
|
44
|
+
/** Starts Floating UI's autoUpdate loop, recomputing menu position on scroll, resize, or ancestor layout changes. Stores the cleanup function to stop tracking when the menu closes. */
|
|
45
|
+
private _startAutoUpdate;
|
|
44
46
|
/** When invoked, hides the dropdown menu */
|
|
45
47
|
hideMenu(isOutside?: boolean): void;
|
|
46
48
|
toggleMenu(): void;
|
package/base/dropdown-element.js
CHANGED
|
@@ -66,9 +66,11 @@ class DropdownElement extends SgdsElement {
|
|
|
66
66
|
}
|
|
67
67
|
firstUpdated(changedProperties) {
|
|
68
68
|
super.firstUpdated(changedProperties);
|
|
69
|
-
// Optionally open menu on first load
|
|
70
69
|
if (this.menuIsOpen) {
|
|
71
|
-
|
|
70
|
+
requestAnimationFrame(async () => {
|
|
71
|
+
await this.updateFloatingPosition();
|
|
72
|
+
this._startAutoUpdate();
|
|
73
|
+
});
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
/** When invoked, opens the dropdown menu */
|
|
@@ -79,6 +81,10 @@ class DropdownElement extends SgdsElement {
|
|
|
79
81
|
this.emit("sgds-show");
|
|
80
82
|
await this.updateFloatingPosition();
|
|
81
83
|
this.emit("sgds-after-show");
|
|
84
|
+
this._startAutoUpdate();
|
|
85
|
+
}
|
|
86
|
+
/** Starts Floating UI's autoUpdate loop, recomputing menu position on scroll, resize, or ancestor layout changes. Stores the cleanup function to stop tracking when the menu closes. */
|
|
87
|
+
_startAutoUpdate() {
|
|
82
88
|
if (this.myDropdown.value && this.menuRef.value) {
|
|
83
89
|
this._cleanupAutoUpdate = autoUpdate(this.myDropdown.value, this.menuRef.value, () => this.updateFloatingPosition());
|
|
84
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-element.js","sources":["../../src/base/dropdown-element.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\nimport { Ref, createRef } from \"lit/directives/ref.js\";\nimport { computePosition, flip, shift, offset, Placement, Middleware, autoUpdate, Strategy } from \"@floating-ui/dom\";\nimport SgdsElement from \"./sgds-element\";\nimport generateId from \"../utils/generateId\";\nimport { PropertyValueMap } from \"lit\";\n\nconst ARROW_DOWN = \"ArrowDown\";\nconst ARROW_UP = \"ArrowUp\";\nconst ESC = \"Escape\";\n\nexport type DropDirection = \"left\" | \"right\" | \"up\" | \"down\";\n\n/**\n * @event sgds-show - Emitted event when show instance is called\n * @event sgds-after-show - Emitted event when dropdown has been made visible to the user and CSS transitions have completed\n * @event sgds-hide - Emitted event when hide instance is called\n * @event sgds-after-hide - Emitted event when dropdown has hidden to the user and CSS transitions have completed\n */\n\nexport class DropdownElement extends SgdsElement {\n // static styles = SgdsElement.styles;\n\n /** @internal */\n protected myDropdown: Ref<HTMLElement> = createRef();\n\n /** @internal Unique id generated for the dropdown menu */\n protected dropdownMenuId: string = generateId(\"dropdown-menu\", \"div\");\n\n /** @internal Controls auto-flipping of menu */\n @property({ type: Boolean, state: true })\n protected noFlip = false;\n\n /** @internal When true, aligns right edge of menu with right edge of button */\n @property({ type: Boolean, reflect: true, state: true })\n protected menuAlignRight = false;\n\n /** @internal The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: true })\n protected drop: DropDirection = \"down\";\n\n /** Additional configuration to pass to Floating UI. */\n @property({ type: Object })\n floatingOpts: { placement?: Placement; middleware?: Array<Middleware> } = {};\n\n /** When true, dropdown menu shows on first load */\n @property({ type: Boolean, reflect: true })\n menuIsOpen = false;\n\n /** Controls the close behaviour of dropdown menu. By default menu auto-closes when SgdsDropdownItem or area outside dropdown is clicked */\n protected close: \"outside\" | \"default\" | \"inside\" = \"default\";\n\n /** Disables the dropdown toggle */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n private _cleanupAutoUpdate?: () => void;\n\n /** @internal Reference to the floating menu element */\n protected menuRef: Ref<HTMLElement> = createRef();\n\n connectedCallback() {\n super.connectedCallback();\n\n if (this.close !== \"inside\") {\n document.addEventListener(\"click\", this._handleClickOutOfElement);\n }\n this.addEventListener(\"keydown\", this._handleKeyboardMenuEvent);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener(\"click\", this._handleClickOutOfElement);\n this.removeEventListener(\"keydown\", this._handleKeyboardMenuEvent);\n if (this._cleanupAutoUpdate) {\n this._cleanupAutoUpdate();\n this._cleanupAutoUpdate = undefined;\n }\n }\n\n firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n // Optionally open menu on first load\n if (this.menuIsOpen) {\n this.updateFloatingPosition();\n }\n }\n\n /** When invoked, opens the dropdown menu */\n public async showMenu() {\n if (this.disabled || this.menuIsOpen) return;\n this.menuIsOpen = true;\n this.emit(\"sgds-show\");\n await this.updateFloatingPosition();\n this.emit(\"sgds-after-show\");\n\n if (this.myDropdown.value && this.menuRef.value) {\n this._cleanupAutoUpdate = autoUpdate(this.myDropdown.value, this.menuRef.value, () =>\n this.updateFloatingPosition()\n );\n }\n }\n\n /** When invoked, hides the dropdown menu */\n public hideMenu(isOutside?: boolean) {\n if (!this.menuIsOpen) return;\n this.emit(\"sgds-hide\", { detail: { isOutside } });\n\n this.menuIsOpen = false;\n setTimeout(() => this.emit(\"sgds-after-hide\"), 0);\n\n if (this._cleanupAutoUpdate) {\n this._cleanupAutoUpdate();\n this._cleanupAutoUpdate = undefined;\n }\n }\n\n toggleMenu() {\n if (this.menuIsOpen) {\n this.hideMenu();\n } else {\n this.showMenu();\n }\n }\n\n protected _handleKeyboardMenuEvent(e: KeyboardEvent) {\n if (this.readonly) return;\n switch (e.key) {\n case ARROW_DOWN:\n case ARROW_UP:\n e.preventDefault();\n if (!this.menuIsOpen) this.showMenu();\n break;\n case ESC:\n this.hideMenu();\n break;\n default:\n break;\n }\n }\n\n private _handleClickOutOfElement = (e: MouseEvent) => {\n if (!this.menuIsOpen) return;\n if (!e.composedPath().includes(this)) {\n this.hideMenu(true);\n }\n };\n\n protected mergeMiddleware(defaults: Middleware[], custom: Middleware[]): Middleware[] {\n const getType = (mw: Middleware) => mw?.name || mw?.constructor?.name;\n const customTypes = custom.map(getType);\n\n const merged = defaults\n .map(def => {\n const type = getType(def);\n const customIdx = customTypes.indexOf(type);\n return customIdx !== -1 ? custom[customIdx] : def;\n })\n\n .concat(custom.filter(c => !defaults.some(def => getType(def) === getType(c))));\n return merged;\n }\n\n protected async updateFloatingPosition() {\n if (!this.myDropdown.value || !this.menuRef.value) return;\n\n let placement: Placement = \"bottom-start\";\n switch (this.drop) {\n case \"up\":\n placement = this.menuAlignRight ? \"top-end\" : \"top-start\";\n break;\n case \"right\":\n placement = \"right-start\";\n break;\n case \"left\":\n placement = \"left-start\";\n break;\n case \"down\":\n placement = this.menuAlignRight ? \"bottom-end\" : \"bottom-start\";\n break;\n default:\n placement = \"bottom-start\";\n break;\n }\n\n const defaultMiddleware = [offset(8), !this.noFlip ? flip() : undefined, shift()].filter(Boolean);\n\n let middleware = defaultMiddleware;\n if (Array.isArray(this.floatingOpts.middleware) && this.floatingOpts.middleware.length > 0) {\n middleware = this.mergeMiddleware(defaultMiddleware, this.floatingOpts.middleware.filter(Boolean));\n }\n\n const opts = {\n strategy: \"fixed\" as Strategy,\n placement,\n ...this.floatingOpts,\n middleware\n };\n\n const {\n x,\n y,\n strategy,\n placement: computedPlacement\n } = await computePosition(this.myDropdown.value, this.menuRef.value, opts);\n\n this.menuRef.value.setAttribute(\"data-placement\", computedPlacement);\n\n Object.assign(this.menuRef.value.style, {\n position: strategy,\n left: `${x}px`,\n top: `${y}px`\n });\n }\n}\n"],"names":["generateId"],"mappings":";;;;;;;AAOA,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,GAAG,GAAG,QAAQ,CAAC;AAIrB;;;;;AAKG;AAEG,MAAO,eAAgB,SAAQ,WAAW,CAAA;AAAhD,IAAA,WAAA,GAAA;;;;QAIY,IAAU,CAAA,UAAA,GAAqB,SAAS,EAAE,CAAC;;AAG3C,QAAA,IAAA,CAAA,cAAc,GAAWA,KAAU,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;;QAI5D,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;QAIf,IAAc,CAAA,cAAA,GAAG,KAAK,CAAC;;QAIvB,IAAI,CAAA,IAAA,GAAkB,MAAM,CAAC;;QAIvC,IAAY,CAAA,YAAA,GAA8D,EAAE,CAAC;;QAI7E,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;;QAGT,IAAK,CAAA,KAAA,GAAqC,SAAS,CAAC;;QAI9D,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAG2B,IAAQ,CAAA,QAAA,GAAG,KA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AA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAIvC,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACkD,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,cAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAI7E,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACxB,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAOnB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG2B,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAkB,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"dropdown-element.js","sources":["../../src/base/dropdown-element.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\nimport { Ref, createRef } from \"lit/directives/ref.js\";\nimport { computePosition, flip, shift, offset, Placement, Middleware, autoUpdate, Strategy } from \"@floating-ui/dom\";\nimport SgdsElement from \"./sgds-element\";\nimport generateId from \"../utils/generateId\";\nimport { PropertyValueMap } from \"lit\";\n\nconst ARROW_DOWN = \"ArrowDown\";\nconst ARROW_UP = \"ArrowUp\";\nconst ESC = \"Escape\";\n\nexport type DropDirection = \"left\" | \"right\" | \"up\" | \"down\";\n\n/**\n * @event sgds-show - Emitted event when show instance is called\n * @event sgds-after-show - Emitted event when dropdown has been made visible to the user and CSS transitions have completed\n * @event sgds-hide - Emitted event when hide instance is called\n * @event sgds-after-hide - Emitted event when dropdown has hidden to the user and CSS transitions have completed\n */\n\nexport class DropdownElement extends SgdsElement {\n // static styles = SgdsElement.styles;\n\n /** @internal */\n protected myDropdown: Ref<HTMLElement> = createRef();\n\n /** @internal Unique id generated for the dropdown menu */\n protected dropdownMenuId: string = generateId(\"dropdown-menu\", \"div\");\n\n /** @internal Controls auto-flipping of menu */\n @property({ type: Boolean, state: true })\n protected noFlip = false;\n\n /** @internal When true, aligns right edge of menu with right edge of button */\n @property({ type: Boolean, reflect: true, state: true })\n protected menuAlignRight = false;\n\n /** @internal The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: true })\n protected drop: DropDirection = \"down\";\n\n /** Additional configuration to pass to Floating UI. */\n @property({ type: Object })\n floatingOpts: { placement?: Placement; middleware?: Array<Middleware> } = {};\n\n /** When true, dropdown menu shows on first load */\n @property({ type: Boolean, reflect: true })\n menuIsOpen = false;\n\n /** Controls the close behaviour of dropdown menu. By default menu auto-closes when SgdsDropdownItem or area outside dropdown is clicked */\n protected close: \"outside\" | \"default\" | \"inside\" = \"default\";\n\n /** Disables the dropdown toggle */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n private _cleanupAutoUpdate?: () => void;\n\n /** @internal Reference to the floating menu element */\n protected menuRef: Ref<HTMLElement> = createRef();\n\n connectedCallback() {\n super.connectedCallback();\n\n if (this.close !== \"inside\") {\n document.addEventListener(\"click\", this._handleClickOutOfElement);\n }\n this.addEventListener(\"keydown\", this._handleKeyboardMenuEvent);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener(\"click\", this._handleClickOutOfElement);\n this.removeEventListener(\"keydown\", this._handleKeyboardMenuEvent);\n if (this._cleanupAutoUpdate) {\n this._cleanupAutoUpdate();\n this._cleanupAutoUpdate = undefined;\n }\n }\n\n firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n if (this.menuIsOpen) {\n requestAnimationFrame(async () => {\n await this.updateFloatingPosition();\n this._startAutoUpdate();\n });\n }\n }\n\n /** When invoked, opens the dropdown menu */\n public async showMenu() {\n if (this.disabled || this.menuIsOpen) return;\n this.menuIsOpen = true;\n this.emit(\"sgds-show\");\n await this.updateFloatingPosition();\n this.emit(\"sgds-after-show\");\n this._startAutoUpdate();\n }\n\n /** Starts Floating UI's autoUpdate loop, recomputing menu position on scroll, resize, or ancestor layout changes. Stores the cleanup function to stop tracking when the menu closes. */\n private _startAutoUpdate() {\n if (this.myDropdown.value && this.menuRef.value) {\n this._cleanupAutoUpdate = autoUpdate(this.myDropdown.value, this.menuRef.value, () =>\n this.updateFloatingPosition()\n );\n }\n }\n\n /** When invoked, hides the dropdown menu */\n public hideMenu(isOutside?: boolean) {\n if (!this.menuIsOpen) return;\n this.emit(\"sgds-hide\", { detail: { isOutside } });\n\n this.menuIsOpen = false;\n setTimeout(() => this.emit(\"sgds-after-hide\"), 0);\n\n if (this._cleanupAutoUpdate) {\n this._cleanupAutoUpdate();\n this._cleanupAutoUpdate = undefined;\n }\n }\n\n toggleMenu() {\n if (this.menuIsOpen) {\n this.hideMenu();\n } else {\n this.showMenu();\n }\n }\n\n protected _handleKeyboardMenuEvent(e: KeyboardEvent) {\n if (this.readonly) return;\n switch (e.key) {\n case ARROW_DOWN:\n case ARROW_UP:\n e.preventDefault();\n if (!this.menuIsOpen) this.showMenu();\n break;\n case ESC:\n this.hideMenu();\n break;\n default:\n break;\n }\n }\n\n private _handleClickOutOfElement = (e: MouseEvent) => {\n if (!this.menuIsOpen) return;\n if (!e.composedPath().includes(this)) {\n this.hideMenu(true);\n }\n };\n\n protected mergeMiddleware(defaults: Middleware[], custom: Middleware[]): Middleware[] {\n const getType = (mw: Middleware) => mw?.name || mw?.constructor?.name;\n const customTypes = custom.map(getType);\n\n const merged = defaults\n .map(def => {\n const type = getType(def);\n const customIdx = customTypes.indexOf(type);\n return customIdx !== -1 ? custom[customIdx] : def;\n })\n\n .concat(custom.filter(c => !defaults.some(def => getType(def) === getType(c))));\n return merged;\n }\n\n protected async updateFloatingPosition() {\n if (!this.myDropdown.value || !this.menuRef.value) return;\n\n let placement: Placement = \"bottom-start\";\n switch (this.drop) {\n case \"up\":\n placement = this.menuAlignRight ? \"top-end\" : \"top-start\";\n break;\n case \"right\":\n placement = \"right-start\";\n break;\n case \"left\":\n placement = \"left-start\";\n break;\n case \"down\":\n placement = this.menuAlignRight ? \"bottom-end\" : \"bottom-start\";\n break;\n default:\n placement = \"bottom-start\";\n break;\n }\n\n const defaultMiddleware = [offset(8), !this.noFlip ? flip() : undefined, shift()].filter(Boolean);\n\n let middleware = defaultMiddleware;\n if (Array.isArray(this.floatingOpts.middleware) && this.floatingOpts.middleware.length > 0) {\n middleware = this.mergeMiddleware(defaultMiddleware, this.floatingOpts.middleware.filter(Boolean));\n }\n\n const opts = {\n strategy: \"fixed\" as Strategy,\n placement,\n ...this.floatingOpts,\n middleware\n };\n\n const {\n x,\n y,\n strategy,\n placement: computedPlacement\n } = await computePosition(this.myDropdown.value, this.menuRef.value, opts);\n\n this.menuRef.value.setAttribute(\"data-placement\", computedPlacement);\n\n Object.assign(this.menuRef.value.style, {\n position: strategy,\n left: `${x}px`,\n top: `${y}px`\n });\n }\n}\n"],"names":["generateId"],"mappings":";;;;;;;AAOA,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,GAAG,GAAG,QAAQ,CAAC;AAIrB;;;;;AAKG;AAEG,MAAO,eAAgB,SAAQ,WAAW,CAAA;AAAhD,IAAA,WAAA,GAAA;;;;QAIY,IAAU,CAAA,UAAA,GAAqB,SAAS,EAAE,CAAC;;AAG3C,QAAA,IAAA,CAAA,cAAc,GAAWA,KAAU,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;;QAI5D,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;QAIf,IAAc,CAAA,cAAA,GAAG,K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adyCSS||t.ShadyCSS.nativeShadow
|
|
|
10
10
|
* Copyright 2017 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
12
|
*/
|
|
13
|
-
const x=globalThis,E=e=>{x.emitLitDebugLogEvents&&x.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))};let C,k=0;x.litIssuedWarnings??=new Set,C=(e,t)=>{t+=e?` See https://lit.dev/msg/${e} for more information.`:"",x.litIssuedWarnings.has(t)||x.litIssuedWarnings.has(e)||(console.warn(t),x.litIssuedWarnings.add(t))},queueMicrotask(()=>{C("dev-mode","Lit is in dev mode. Not recommended for production!")});const T=x.ShadyDOM?.inUse&&!0===x.ShadyDOM?.noPatch?x.ShadyDOM.wrap:e=>e,N=x.trustedTypes,U=N?N.createPolicy("lit-html",{createHTML:e=>e}):void 0,O=e=>e,M=(e,t,s)=>O,V=e=>{if(oe!==M)throw new Error("Attempted to overwrite existing lit-html security policy. setSanitizeDOMValueFactory should be called at most once.");oe=e},z=()=>{oe=M},A=(e,t,s)=>oe(e,t,s),L="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,W="?"+R,D=`<${W}>`,I=document,j=()=>I.createComment(""),q=e=>null===e||"object"!=typeof e&&"function"!=typeof e,H=Array.isArray,F="[ \t\n\f\r]",B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Z=/-->/g,J=/>/g,K=new RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Y=/'/g,X=/"/g,G=/^(?:script|style|textarea|title)$/i,Q=(ee=1,(e,...t)=>(e.some(e=>void 0===e)&&console.warn("Some template strings are undefined.\nThis is probably caused by illegal octal escape sequences."),t.some(e=>e?._$litStatic$)&&C("","Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\nPlease use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions"),{_$litType$:ee,strings:e,values:t}));var ee;const te=Symbol.for("lit-noChange"),se=Symbol.for("lit-nothing"),ie=new WeakMap,ne=I.createTreeWalker(I,129);let oe=M;function re(e,t){if(!H(e)||!e.hasOwnProperty("raw")){let e="invalid template strings array";throw e="\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n ".trim().replace(/\n */g,"\n"),new Error(e)}return void 0!==U?U.createHTML(t):t}class ae{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const r=e.length-1,a=this.parts,[d,l]=((e,t)=>{const s=e.length-1,i=[];let n,o=2===t?"<svg>":3===t?"<math>":"",r=B;for(let t=0;t<s;t++){const s=e[t];let a,d,l=-1,c=0;for(;c<s.length&&(r.lastIndex=c,d=r.exec(s),null!==d);)if(c=r.lastIndex,r===B){if("!--"===d[1])r=Z;else if(void 0!==d[1])r=J;else if(void 0!==d[2])G.test(d[2])&&(n=new RegExp(`</${d[2]}`,"g")),r=K;else if(void 0!==d[3])throw new Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else r===K?">"===d[0]?(r=n??B,l=-1):void 0===d[1]?l=-2:(l=r.lastIndex-d[2].length,a=d[1],r=void 0===d[3]?K:'"'===d[3]?X:Y):r===X||r===Y?r=K:r===Z||r===J?r=B:(r=K,n=void 0);console.assert(-1===l||r===K||r===Y||r===X,"unexpected parse state B");const h=r===K&&e[t+1].startsWith("/>")?" ":"";o+=r===B?s+D:l>=0?(i.push(a),s.slice(0,l)+L+s.slice(l)+R+h):s+R+(-2===l?t:h)}return[re(e,o+(e[s]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(e,t);if(this.el=ae.createElement(d,s),ne.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=ne.nextNode())&&a.length<r;){if(1===i.nodeType){{const e=i.localName;if(/^(?:textarea|template)$/i.test(e)&&i.innerHTML.includes(R)){const t=`Expressions are not supported inside \`${e}\` elements. See https://lit.dev/msg/expression-in-${e} for more information.`;if("template"===e)throw new Error(t);C("",t)}}if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(L)){const t=l[o++],s=i.getAttribute(e).split(R),r=/([.?@])?(.*)/.exec(t);a.push({type:1,index:n,name:r[2],strings:s,ctor:"."===r[1]?pe:"?"===r[1]?ue:"@"===r[1]?me:he}),i.removeAttribute(e)}else e.startsWith(R)&&(a.push({type:6,index:n}),i.removeAttribute(e));if(G.test(i.tagName)){const e=i.textContent.split(R),t=e.length-1;if(t>0){i.textContent=N?N.emptyScript:"";for(let s=0;s<t;s++)i.append(e[s],j()),ne.nextNode(),a.push({type:2,index:++n});i.append(e[t],j())}}}else if(8===i.nodeType){if(i.data===W)a.push({type:2,index:n});else{let e=-1;for(;-1!==(e=i.data.indexOf(R,e+1));)a.push({type:7,index:n}),e+=R.length-1}}n++}if(l.length!==o)throw new Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+e.join("${...}")+"`");E&&E({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:e})}static createElement(e,t){const s=I.createElement("template");return s.innerHTML=e,s}}function de(e,t,s=e,i){if(t===te)return t;let n=void 0!==i?s.__directives?.[i]:s.__directive;const o=q(t)?void 0:t._$litDirective$;return n?.constructor!==o&&(n?._$notifyDirectiveConnectionChanged?.(!1),void 0===o?n=void 0:(n=new o(e),n._$initialize(e,s,i)),void 0!==i?(s.__directives??=[])[i]=n:s.__directive=n),void 0!==n&&(t=de(e,n._$resolve(e,t.values),n,i)),t}class le{constructor(e,t){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=e,this._$parent=t}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(e){const{el:{content:t},parts:s}=this._$template,i=(e?.creationScope??I).importNode(t,!0);ne.currentNode=i;let n=ne.nextNode(),o=0,r=0,a=s[0];for(;void 0!==a;){if(o===a.index){let t;2===a.type?t=new ce(n,n.nextSibling,this,e):1===a.type?t=new a.ctor(n,a.name,a.strings,this,e):6===a.type&&(t=new ge(n,this,e)),this._$parts.push(t),a=s[++r]}o!==a?.index&&(n=ne.nextNode(),o++)}return ne.currentNode=I,i}_update(e){let t=0;for(const s of this._$parts)void 0!==s&&(E&&E({kind:"set part",part:s,value:e[t],valueIndex:t,values:e,templateInstance:this}),void 0!==s.strings?(s._$setValue(e,s,t),t+=s.strings.length-2):s._$setValue(e[t])),t++}}class ce{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(e,t,s,i){this.type=2,this._$committedValue=se,this._$disconnectableChildren=void 0,this._$startNode=e,this._$endNode=t,this._$parent=s,this.options=i,this.__isConnected=i?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let e=T(this._$startNode).parentNode;const t=this._$parent;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(e,t=this){if(null===this.parentNode)throw new Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(e=de(this,e,t),q(e))e===se||null==e||""===e?(this._$committedValue!==se&&(E&&E({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear()),this._$committedValue=se):e!==this._$committedValue&&e!==te&&this._commitText(e);else if(void 0!==e._$litType$)this._commitTemplateResult(e);else if(void 0!==e.nodeType){if(this.options?.host===e)return this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),void console.warn("Attempted to render the template host",e,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");this._commitNode(e)}else(e=>H(e)||"function"==typeof e?.[Symbol.iterator])(e)?this._commitIterable(e):this._commitText(e)}_insert(e){return T(T(this._$startNode).parentNode).insertBefore(e,this._$endNode)}_commitNode(e){if(this._$committedValue!==e){if(this._$clear(),oe!==M){const e=this._$startNode.parentNode?.nodeName;if("STYLE"===e||"SCRIPT"===e){let t="Forbidden";throw t="STYLE"===e?"Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.":"Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.",new Error(t)}}E&&E({kind:"commit node",start:this._$startNode,parent:this._$parent,value:e,options:this.options}),this._$committedValue=this._insert(e)}}_commitText(e){if(this._$committedValue!==se&&q(this._$committedValue)){const t=T(this._$startNode).nextSibling;void 0===this._textSanitizer&&(this._textSanitizer=A(t,"data","property")),e=this._textSanitizer(e),E&&E({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}else{const t=I.createTextNode("");this._commitNode(t),void 0===this._textSanitizer&&(this._textSanitizer=A(t,"data","property")),e=this._textSanitizer(e),E&&E({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}this._$committedValue=e}_commitTemplateResult(e){const{values:t,_$litType$:s}=e,i="number"==typeof s?this._$getTemplate(e):(void 0===s.el&&(s.el=ae.createElement(re(s.h,s.h[0]),this.options)),s);if(this._$committedValue?._$template===i)E&&E({kind:"template updating",template:i,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:t}),this._$committedValue._update(t);else{const e=new le(i,this),s=e._clone(this.options);E&&E({kind:"template instantiated",template:i,instance:e,parts:e._$parts,options:this.options,fragment:s,values:t}),e._update(t),E&&E({kind:"template instantiated and updated",template:i,instance:e,parts:e._$parts,options:this.options,fragment:s,values:t}),this._commitNode(s),this._$committedValue=e}}_$getTemplate(e){let t=ie.get(e.strings);return void 0===t&&ie.set(e.strings,t=new ae(e)),t}_commitIterable(e){H(this._$committedValue)||(this._$committedValue=[],this._$clear());const t=this._$committedValue;let s,i=0;for(const n of e)i===t.length?t.push(s=new ce(this._insert(j()),this._insert(j()),this,this.options)):s=t[i],s._$setValue(n),i++;i<t.length&&(this._$clear(s&&T(s._$endNode).nextSibling,i),t.length=i)}_$clear(e=T(this._$startNode).nextSibling,t){for(this._$notifyConnectionChanged?.(!1,!0,t);e!==this._$endNode;){const t=T(e).nextSibling;T(e).remove(),e=t}}setConnected(e){if(void 0!==this._$parent)throw new Error("part.setConnected() may only be called on a RootPart returned from render().");this.__isConnected=e,this._$notifyConnectionChanged?.(e)}}class he{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(e,t,s,i,n){this.type=1,this._$committedValue=se,this._$disconnectableChildren=void 0,this.element=e,this.name=t,this._$parent=i,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$committedValue=new Array(s.length-1).fill(new String),this.strings=s):this._$committedValue=se,this._sanitizer=void 0}_$setValue(e,t=this,s,i){const n=this.strings;let o=!1;if(void 0===n)e=de(this,e,t,0),o=!q(e)||e!==this._$committedValue&&e!==te,o&&(this._$committedValue=e);else{const i=e;let r,a;for(e=n[0],r=0;r<n.length-1;r++)a=de(this,i[s+r],t,r),a===te&&(a=this._$committedValue[r]),o||=!q(a)||a!==this._$committedValue[r],a===se?e=se:e!==se&&(e+=(a??"")+n[r+1]),this._$committedValue[r]=a}o&&!i&&this._commitValue(e)}_commitValue(e){e===se?T(this.element).removeAttribute(this.name):(void 0===this._sanitizer&&(this._sanitizer=oe(this.element,this.name,"attribute")),e=this._sanitizer(e??""),E&&E({kind:"commit attribute",element:this.element,name:this.name,value:e,options:this.options}),T(this.element).setAttribute(this.name,e??""))}}class pe extends he{constructor(){super(...arguments),this.type=3}_commitValue(e){void 0===this._sanitizer&&(this._sanitizer=oe(this.element,this.name,"property")),e=this._sanitizer(e),E&&E({kind:"commit property",element:this.element,name:this.name,value:e,options:this.options}),this.element[this.name]=e===se?void 0:e}}class ue extends he{constructor(){super(...arguments),this.type=4}_commitValue(e){E&&E({kind:"commit boolean attribute",element:this.element,name:this.name,value:!(!e||e===se),options:this.options}),T(this.element).toggleAttribute(this.name,!!e&&e!==se)}}class me extends he{constructor(e,t,s,i,n){if(super(e,t,s,i,n),this.type=5,void 0!==this.strings)throw new Error(`A \`<${e.localName}>\` has a \`@${t}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(e,t=this){if((e=de(this,e,t,0)??se)===te)return;const s=this._$committedValue,i=e===se&&s!==se||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==se&&(s===se||i);E&&E({kind:"commit event listener",element:this.element,name:this.name,value:e,options:this.options,removeListener:i,addListener:n,oldListener:s}),i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$committedValue=e}handleEvent(e){"function"==typeof this._$committedValue?this._$committedValue.call(this.options?.host??this.element,e):this._$committedValue.handleEvent(e)}}class ge{constructor(e,t,s){this.element=e,this.type=6,this._$disconnectableChildren=void 0,this._$parent=t,this.options=s}get _$isConnected(){return this._$parent._$isConnected}_$setValue(e){E&&E({kind:"commit to element binding",element:this.element,value:e,options:this.options}),de(this,e)}}const fe=x.litHtmlPolyfillSupportDevMode;fe?.(ae,ce),(x.litHtmlVersions??=[]).push("3.3.2"),x.litHtmlVersions.length>1&&queueMicrotask(()=>{C("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});const ve=(e,t,s)=>{if(null==t)throw new TypeError(`The container to render into may not be ${t}`);const i=k++,n=s?.renderBefore??t;let o=n._$litPart$;if(E&&E({kind:"begin render",id:i,value:e,container:t,options:s,part:o}),void 0===o){const e=s?.renderBefore??null;n._$litPart$=o=new ce(t.insertBefore(j(),e),e,void 0,s??{})}return o._$setValue(e),E&&E({kind:"end render",id:i,value:e,container:t,options:s,part:o}),o};ve.setSanitizer=V,ve.createSanitizer=A,ve._testOnlyClearSanitizerFactoryDoNotCallOrElse=z;
|
|
13
|
+
const x=globalThis,C=e=>{x.emitLitDebugLogEvents&&x.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))};let E,k=0;x.litIssuedWarnings??=new Set,E=(e,t)=>{t+=e?` See https://lit.dev/msg/${e} for more information.`:"",x.litIssuedWarnings.has(t)||x.litIssuedWarnings.has(e)||(console.warn(t),x.litIssuedWarnings.add(t))},queueMicrotask(()=>{E("dev-mode","Lit is in dev mode. Not recommended for production!")});const T=x.ShadyDOM?.inUse&&!0===x.ShadyDOM?.noPatch?x.ShadyDOM.wrap:e=>e,N=x.trustedTypes,U=N?N.createPolicy("lit-html",{createHTML:e=>e}):void 0,O=e=>e,M=(e,t,s)=>O,V=e=>{if(oe!==M)throw new Error("Attempted to overwrite existing lit-html security policy. setSanitizeDOMValueFactory should be called at most once.");oe=e},z=()=>{oe=M},A=(e,t,s)=>oe(e,t,s),L="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,W="?"+R,D=`<${W}>`,I=document,j=()=>I.createComment(""),q=e=>null===e||"object"!=typeof e&&"function"!=typeof e,H=Array.isArray,F="[ \t\n\f\r]",B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Z=/-->/g,J=/>/g,K=new RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Y=/'/g,X=/"/g,G=/^(?:script|style|textarea|title)$/i,Q=(ee=1,(e,...t)=>(e.some(e=>void 0===e)&&console.warn("Some template strings are undefined.\nThis is probably caused by illegal octal escape sequences."),t.some(e=>e?._$litStatic$)&&E("","Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\nPlease use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions"),{_$litType$:ee,strings:e,values:t}));var ee;const te=Symbol.for("lit-noChange"),se=Symbol.for("lit-nothing"),ie=new WeakMap,ne=I.createTreeWalker(I,129);let oe=M;function re(e,t){if(!H(e)||!e.hasOwnProperty("raw")){let e="invalid template strings array";throw e="\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n ".trim().replace(/\n */g,"\n"),new Error(e)}return void 0!==U?U.createHTML(t):t}class ae{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const r=e.length-1,a=this.parts,[d,l]=((e,t)=>{const s=e.length-1,i=[];let n,o=2===t?"<svg>":3===t?"<math>":"",r=B;for(let t=0;t<s;t++){const s=e[t];let a,d,l=-1,c=0;for(;c<s.length&&(r.lastIndex=c,d=r.exec(s),null!==d);)if(c=r.lastIndex,r===B){if("!--"===d[1])r=Z;else if(void 0!==d[1])r=J;else if(void 0!==d[2])G.test(d[2])&&(n=new RegExp(`</${d[2]}`,"g")),r=K;else if(void 0!==d[3])throw new Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else r===K?">"===d[0]?(r=n??B,l=-1):void 0===d[1]?l=-2:(l=r.lastIndex-d[2].length,a=d[1],r=void 0===d[3]?K:'"'===d[3]?X:Y):r===X||r===Y?r=K:r===Z||r===J?r=B:(r=K,n=void 0);console.assert(-1===l||r===K||r===Y||r===X,"unexpected parse state B");const h=r===K&&e[t+1].startsWith("/>")?" ":"";o+=r===B?s+D:l>=0?(i.push(a),s.slice(0,l)+L+s.slice(l)+R+h):s+R+(-2===l?t:h)}return[re(e,o+(e[s]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]})(e,t);if(this.el=ae.createElement(d,s),ne.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=ne.nextNode())&&a.length<r;){if(1===i.nodeType){{const e=i.localName;if(/^(?:textarea|template)$/i.test(e)&&i.innerHTML.includes(R)){const t=`Expressions are not supported inside \`${e}\` elements. See https://lit.dev/msg/expression-in-${e} for more information.`;if("template"===e)throw new Error(t);E("",t)}}if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(L)){const t=l[o++],s=i.getAttribute(e).split(R),r=/([.?@])?(.*)/.exec(t);a.push({type:1,index:n,name:r[2],strings:s,ctor:"."===r[1]?pe:"?"===r[1]?ue:"@"===r[1]?me:he}),i.removeAttribute(e)}else e.startsWith(R)&&(a.push({type:6,index:n}),i.removeAttribute(e));if(G.test(i.tagName)){const e=i.textContent.split(R),t=e.length-1;if(t>0){i.textContent=N?N.emptyScript:"";for(let s=0;s<t;s++)i.append(e[s],j()),ne.nextNode(),a.push({type:2,index:++n});i.append(e[t],j())}}}else if(8===i.nodeType){if(i.data===W)a.push({type:2,index:n});else{let e=-1;for(;-1!==(e=i.data.indexOf(R,e+1));)a.push({type:7,index:n}),e+=R.length-1}}n++}if(l.length!==o)throw new Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+e.join("${...}")+"`");C&&C({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:e})}static createElement(e,t){const s=I.createElement("template");return s.innerHTML=e,s}}function de(e,t,s=e,i){if(t===te)return t;let n=void 0!==i?s.__directives?.[i]:s.__directive;const o=q(t)?void 0:t._$litDirective$;return n?.constructor!==o&&(n?._$notifyDirectiveConnectionChanged?.(!1),void 0===o?n=void 0:(n=new o(e),n._$initialize(e,s,i)),void 0!==i?(s.__directives??=[])[i]=n:s.__directive=n),void 0!==n&&(t=de(e,n._$resolve(e,t.values),n,i)),t}class le{constructor(e,t){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=e,this._$parent=t}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(e){const{el:{content:t},parts:s}=this._$template,i=(e?.creationScope??I).importNode(t,!0);ne.currentNode=i;let n=ne.nextNode(),o=0,r=0,a=s[0];for(;void 0!==a;){if(o===a.index){let t;2===a.type?t=new ce(n,n.nextSibling,this,e):1===a.type?t=new a.ctor(n,a.name,a.strings,this,e):6===a.type&&(t=new ge(n,this,e)),this._$parts.push(t),a=s[++r]}o!==a?.index&&(n=ne.nextNode(),o++)}return ne.currentNode=I,i}_update(e){let t=0;for(const s of this._$parts)void 0!==s&&(C&&C({kind:"set part",part:s,value:e[t],valueIndex:t,values:e,templateInstance:this}),void 0!==s.strings?(s._$setValue(e,s,t),t+=s.strings.length-2):s._$setValue(e[t])),t++}}class ce{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(e,t,s,i){this.type=2,this._$committedValue=se,this._$disconnectableChildren=void 0,this._$startNode=e,this._$endNode=t,this._$parent=s,this.options=i,this.__isConnected=i?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let e=T(this._$startNode).parentNode;const t=this._$parent;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(e,t=this){if(null===this.parentNode)throw new Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(e=de(this,e,t),q(e))e===se||null==e||""===e?(this._$committedValue!==se&&(C&&C({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear()),this._$committedValue=se):e!==this._$committedValue&&e!==te&&this._commitText(e);else if(void 0!==e._$litType$)this._commitTemplateResult(e);else if(void 0!==e.nodeType){if(this.options?.host===e)return this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),void console.warn("Attempted to render the template host",e,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");this._commitNode(e)}else(e=>H(e)||"function"==typeof e?.[Symbol.iterator])(e)?this._commitIterable(e):this._commitText(e)}_insert(e){return T(T(this._$startNode).parentNode).insertBefore(e,this._$endNode)}_commitNode(e){if(this._$committedValue!==e){if(this._$clear(),oe!==M){const e=this._$startNode.parentNode?.nodeName;if("STYLE"===e||"SCRIPT"===e){let t="Forbidden";throw t="STYLE"===e?"Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.":"Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.",new Error(t)}}C&&C({kind:"commit node",start:this._$startNode,parent:this._$parent,value:e,options:this.options}),this._$committedValue=this._insert(e)}}_commitText(e){if(this._$committedValue!==se&&q(this._$committedValue)){const t=T(this._$startNode).nextSibling;void 0===this._textSanitizer&&(this._textSanitizer=A(t,"data","property")),e=this._textSanitizer(e),C&&C({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}else{const t=I.createTextNode("");this._commitNode(t),void 0===this._textSanitizer&&(this._textSanitizer=A(t,"data","property")),e=this._textSanitizer(e),C&&C({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}this._$committedValue=e}_commitTemplateResult(e){const{values:t,_$litType$:s}=e,i="number"==typeof s?this._$getTemplate(e):(void 0===s.el&&(s.el=ae.createElement(re(s.h,s.h[0]),this.options)),s);if(this._$committedValue?._$template===i)C&&C({kind:"template updating",template:i,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:t}),this._$committedValue._update(t);else{const e=new le(i,this),s=e._clone(this.options);C&&C({kind:"template instantiated",template:i,instance:e,parts:e._$parts,options:this.options,fragment:s,values:t}),e._update(t),C&&C({kind:"template instantiated and updated",template:i,instance:e,parts:e._$parts,options:this.options,fragment:s,values:t}),this._commitNode(s),this._$committedValue=e}}_$getTemplate(e){let t=ie.get(e.strings);return void 0===t&&ie.set(e.strings,t=new ae(e)),t}_commitIterable(e){H(this._$committedValue)||(this._$committedValue=[],this._$clear());const t=this._$committedValue;let s,i=0;for(const n of e)i===t.length?t.push(s=new ce(this._insert(j()),this._insert(j()),this,this.options)):s=t[i],s._$setValue(n),i++;i<t.length&&(this._$clear(s&&T(s._$endNode).nextSibling,i),t.length=i)}_$clear(e=T(this._$startNode).nextSibling,t){for(this._$notifyConnectionChanged?.(!1,!0,t);e!==this._$endNode;){const t=T(e).nextSibling;T(e).remove(),e=t}}setConnected(e){if(void 0!==this._$parent)throw new Error("part.setConnected() may only be called on a RootPart returned from render().");this.__isConnected=e,this._$notifyConnectionChanged?.(e)}}class he{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(e,t,s,i,n){this.type=1,this._$committedValue=se,this._$disconnectableChildren=void 0,this.element=e,this.name=t,this._$parent=i,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$committedValue=new Array(s.length-1).fill(new String),this.strings=s):this._$committedValue=se,this._sanitizer=void 0}_$setValue(e,t=this,s,i){const n=this.strings;let o=!1;if(void 0===n)e=de(this,e,t,0),o=!q(e)||e!==this._$committedValue&&e!==te,o&&(this._$committedValue=e);else{const i=e;let r,a;for(e=n[0],r=0;r<n.length-1;r++)a=de(this,i[s+r],t,r),a===te&&(a=this._$committedValue[r]),o||=!q(a)||a!==this._$committedValue[r],a===se?e=se:e!==se&&(e+=(a??"")+n[r+1]),this._$committedValue[r]=a}o&&!i&&this._commitValue(e)}_commitValue(e){e===se?T(this.element).removeAttribute(this.name):(void 0===this._sanitizer&&(this._sanitizer=oe(this.element,this.name,"attribute")),e=this._sanitizer(e??""),C&&C({kind:"commit attribute",element:this.element,name:this.name,value:e,options:this.options}),T(this.element).setAttribute(this.name,e??""))}}class pe extends he{constructor(){super(...arguments),this.type=3}_commitValue(e){void 0===this._sanitizer&&(this._sanitizer=oe(this.element,this.name,"property")),e=this._sanitizer(e),C&&C({kind:"commit property",element:this.element,name:this.name,value:e,options:this.options}),this.element[this.name]=e===se?void 0:e}}class ue extends he{constructor(){super(...arguments),this.type=4}_commitValue(e){C&&C({kind:"commit boolean attribute",element:this.element,name:this.name,value:!(!e||e===se),options:this.options}),T(this.element).toggleAttribute(this.name,!!e&&e!==se)}}class me extends he{constructor(e,t,s,i,n){if(super(e,t,s,i,n),this.type=5,void 0!==this.strings)throw new Error(`A \`<${e.localName}>\` has a \`@${t}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(e,t=this){if((e=de(this,e,t,0)??se)===te)return;const s=this._$committedValue,i=e===se&&s!==se||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==se&&(s===se||i);C&&C({kind:"commit event listener",element:this.element,name:this.name,value:e,options:this.options,removeListener:i,addListener:n,oldListener:s}),i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$committedValue=e}handleEvent(e){"function"==typeof this._$committedValue?this._$committedValue.call(this.options?.host??this.element,e):this._$committedValue.handleEvent(e)}}class ge{constructor(e,t,s){this.element=e,this.type=6,this._$disconnectableChildren=void 0,this._$parent=t,this.options=s}get _$isConnected(){return this._$parent._$isConnected}_$setValue(e){C&&C({kind:"commit to element binding",element:this.element,value:e,options:this.options}),de(this,e)}}const fe=x.litHtmlPolyfillSupportDevMode;fe?.(ae,ce),(x.litHtmlVersions??=[]).push("3.3.2"),x.litHtmlVersions.length>1&&queueMicrotask(()=>{E("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});const ve=(e,t,s)=>{if(null==t)throw new TypeError(`The container to render into may not be ${t}`);const i=k++,n=s?.renderBefore??t;let o=n._$litPart$;if(C&&C({kind:"begin render",id:i,value:e,container:t,options:s,part:o}),void 0===o){const e=s?.renderBefore??null;n._$litPart$=o=new ce(t.insertBefore(j(),e),e,void 0,s??{})}return o._$setValue(e),C&&C({kind:"end render",id:i,value:e,container:t,options:s,part:o}),o};ve.setSanitizer=V,ve.createSanitizer=A,ve._testOnlyClearSanitizerFactoryDoNotCallOrElse=z;
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
16
16
|
* Copyright 2017 Google LLC
|
|
@@ -22,26 +22,26 @@ const ye=globalThis;let be;ye.litIssuedWarnings??=new Set,be=(e,t)=>{t+=` See ht
|
|
|
22
22
|
* Copyright 2017 Google LLC
|
|
23
23
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
24
24
|
*/
|
|
25
|
-
let Se;$e?.({LitElement:_e}),(ye.litElementVersions??=[]).push("4.2.2"),ye.litElementVersions.length>1&&queueMicrotask(()=>{be("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")}),globalThis.litIssuedWarnings??=new Set,Se=(e,t)=>{t+=` See https://lit.dev/msg/${e} for more information.`,globalThis.litIssuedWarnings.has(t)||globalThis.litIssuedWarnings.has(e)||(console.warn(t),globalThis.litIssuedWarnings.add(t))};const Pe={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:$},xe=(e=Pe,t,s)=>{const{kind:i,metadata:n}=s;null==n&&Se("missing-class-metadata",`The class ${t} is missing decorator metadata. This could mean that you're using a compiler that supports decorators but doesn't support decorator metadata, such as TypeScript 5.1. Please update your compiler.`);let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),o.set(s.name,e),"accessor"===i){const{name:i}=s;return{set(s){const n=t.get.call(this);t.set.call(this,s),this.requestUpdate(i,n,e,!0,s)},init(t){return void 0!==t&&this._$changeProperty(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=s;return function(s){const n=this[i];t.call(this,s),this.requestUpdate(i,n,e,!0,s)}}throw new Error(`Unsupported decorator location: ${i}`)};function
|
|
25
|
+
let Se;$e?.({LitElement:_e}),(ye.litElementVersions??=[]).push("4.2.2"),ye.litElementVersions.length>1&&queueMicrotask(()=>{be("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")}),globalThis.litIssuedWarnings??=new Set,Se=(e,t)=>{t+=` See https://lit.dev/msg/${e} for more information.`,globalThis.litIssuedWarnings.has(t)||globalThis.litIssuedWarnings.has(e)||(console.warn(t),globalThis.litIssuedWarnings.add(t))};const Pe={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:$},xe=(e=Pe,t,s)=>{const{kind:i,metadata:n}=s;null==n&&Se("missing-class-metadata",`The class ${t} is missing decorator metadata. This could mean that you're using a compiler that supports decorators but doesn't support decorator metadata, such as TypeScript 5.1. Please update your compiler.`);let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),o.set(s.name,e),"accessor"===i){const{name:i}=s;return{set(s){const n=t.get.call(this);t.set.call(this,s),this.requestUpdate(i,n,e,!0,s)},init(t){return void 0!==t&&this._$changeProperty(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=s;return function(s){const n=this[i];t.call(this,s),this.requestUpdate(i,n,e,!0,s)}}throw new Error(`Unsupported decorator location: ${i}`)};function Ce(e){return(t,s)=>"object"==typeof s?xe(e,t,s):((e,t,s)=>{const i=t.hasOwnProperty(s);return t.constructor.createProperty(s,e),i?Object.getOwnPropertyDescriptor(t,s):void 0})(e,t,s)}
|
|
26
26
|
/**
|
|
27
27
|
* @license
|
|
28
28
|
* Copyright 2017 Google LLC
|
|
29
29
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
30
|
-
*/const
|
|
30
|
+
*/const Ee=(e,t,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,s),s);
|
|
31
31
|
/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2017 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
-
*/let ke;function Te(e,t){return(s,i,n)=>{const o=s=>{const n=s.renderRoot?.querySelector(e)??null;if(null===n&&t&&!s.hasUpdated){const t="object"==typeof i?i.name:i;ke("",`@query'd field ${JSON.stringify(String(t))} with the 'cache' flag set for selector '${e}' has been accessed before the first update and returned null. This is expected if the renderRoot tree has not been provided beforehand (e.g. via Declarative Shadow DOM). Therefore the value hasn't been cached.`)}return n};if(t){const{get:e,set:t}="object"==typeof i?s:n??(()=>{const e=Symbol(`${String(i)} (@query() cache)`);return{get(){return this[e]},set(t){this[e]=t}}})();return
|
|
35
|
+
*/let ke;function Te(e,t){return(s,i,n)=>{const o=s=>{const n=s.renderRoot?.querySelector(e)??null;if(null===n&&t&&!s.hasUpdated){const t="object"==typeof i?i.name:i;ke("",`@query'd field ${JSON.stringify(String(t))} with the 'cache' flag set for selector '${e}' has been accessed before the first update and returned null. This is expected if the renderRoot tree has not been provided beforehand (e.g. via Declarative Shadow DOM). Therefore the value hasn't been cached.`)}return n};if(t){const{get:e,set:t}="object"==typeof i?s:n??(()=>{const e=Symbol(`${String(i)} (@query() cache)`);return{get(){return this[e]},set(t){this[e]=t}}})();return Ee(s,i,{get(){let s=e.call(this);return void 0===s&&(s=o(this),(null!==s||this.hasUpdated)&&t.call(this,s)),s}})}return Ee(s,i,{get(){return o(this)}})}}
|
|
36
36
|
/**
|
|
37
37
|
* @license
|
|
38
38
|
* Copyright 2021 Google LLC
|
|
39
39
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
-
*/globalThis.litIssuedWarnings??=new Set,ke=(e,t)=>{t+=e?` See https://lit.dev/msg/${e} for more information.`:"",globalThis.litIssuedWarnings.has(t)||globalThis.litIssuedWarnings.has(e)||(console.warn(t),globalThis.litIssuedWarnings.add(t))};var Ne=r`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color-default);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-16);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-24);margin:0;*,:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}::slotted(a[target=_blank]):after,a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;height:1em;-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.774 4.4H9.8a.6.6 0 1 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.861 6.91c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v4.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h4.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.468-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.774c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.525-.042-1.175-.042-1.993V9.774c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C8.305 4.4 8.956 4.4 9.774 4.4ZM12.4 5a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V6.449l-5.976 5.975a.6.6 0 0 1-.848-.848L17.55 5.6H13a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.774 4.4H9.8a.6.6 0 1 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.861 6.91c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v4.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h4.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.468-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.774c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.525-.042-1.175-.042-1.993V9.774c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C8.305 4.4 8.956 4.4 9.774 4.4ZM12.4 5a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V6.449l-5.976 5.975a.6.6 0 0 1-.848-.848L17.55 5.6H13a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;vertical-align:top;width:1em}::slotted(svg){vertical-align:middle}}`;class Ue extends _e{emit(e,t){const s=new CustomEvent(e,Object.assign({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(s),s}static define(e,t=this,s={}){if(customElements.get(e));else try{customElements.define(e,t,s)}catch(i){customElements.define(e,class extends t{},s)}}constructor(){super(),this.ssr=Boolean(this.shadowRoot),Object.entries(this.constructor.dependencies).forEach(([e,t])=>{this.constructor.define(e,t)})}firstUpdated(e){var t;super.firstUpdated(e),this.ssr&&(null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("slot").forEach(e=>{e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}))}}Ue.styles=[Ne],Ue.dependencies={},e([
|
|
40
|
+
*/globalThis.litIssuedWarnings??=new Set,ke=(e,t)=>{t+=e?` See https://lit.dev/msg/${e} for more information.`:"",globalThis.litIssuedWarnings.has(t)||globalThis.litIssuedWarnings.has(e)||(console.warn(t),globalThis.litIssuedWarnings.add(t))};var Ne=r`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color-default);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-16);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-24);margin:0;*,:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}::slotted(a[target=_blank]):after,a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;height:1em;-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.774 4.4H9.8a.6.6 0 1 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.861 6.91c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v4.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h4.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.468-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.774c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.525-.042-1.175-.042-1.993V9.774c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C8.305 4.4 8.956 4.4 9.774 4.4ZM12.4 5a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V6.449l-5.976 5.975a.6.6 0 0 1-.848-.848L17.55 5.6H13a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.774 4.4H9.8a.6.6 0 1 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.861 6.91c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v4.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h4.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.468-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.774c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.525-.042-1.175-.042-1.993V9.774c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C8.305 4.4 8.956 4.4 9.774 4.4ZM12.4 5a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V6.449l-5.976 5.975a.6.6 0 0 1-.848-.848L17.55 5.6H13a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;vertical-align:top;width:1em}::slotted(svg){vertical-align:middle}}`;class Ue extends _e{emit(e,t){const s=new CustomEvent(e,Object.assign({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(s),s}static define(e,t=this,s={}){if(customElements.get(e));else try{customElements.define(e,t,s)}catch(i){customElements.define(e,class extends t{},s)}}constructor(){super(),this.ssr=Boolean(this.shadowRoot),Object.entries(this.constructor.dependencies).forEach(([e,t])=>{this.constructor.define(e,t)})}firstUpdated(e){var t;super.firstUpdated(e),this.ssr&&(null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("slot").forEach(e=>{e.dispatchEvent(new Event("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}))}}Ue.styles=[Ne],Ue.dependencies={},e([Ce({type:Boolean,reflect:!0})],Ue.prototype,"ssr",void 0);var Oe=r`:host([variant=border]) .accordion{border:var(--sgds-border-width-1) solid var(--sgds-border-color-muted);border-radius:var(--sgds-border-radius-md)}`;const Me=["Enter","ArrowUp","ArrowLeft","ArrowDown","ArrowRight"];class Ve extends Ue{constructor(){super(...arguments),this.allowMultiple=!1,this.variant="default",this.density="default"}get items(){return[...this.defaultNodes||[]].filter(e=>void 0!==e.tagName)}_handleSlotChange(){const e=[...this.items];e.forEach((t,s)=>{if(e.length>1)switch(s){case 0:t.setAttribute("first-of-type","");break;case e.length-1:t.setAttribute("last-of-type","");break;default:t.setAttribute("nth-of-type","")}t.setAttribute("variant",this.variant),t.setAttribute("density",this.density)})}async _onToggle(e){if(this.allowMultiple)return;const t=[...this.items];t&&!t.length||t.forEach(t=>{e.composedPath().includes(t)||(t.open=!1)})}async _onKeyboardToggle(e){if(Me.includes(e.key))return this._onToggle(e)}render(){return Q`
|
|
41
41
|
<div class="accordion">
|
|
42
|
-
<slot @click=${this._onToggle} @keydown=${this._onKeyboardToggle}></slot>
|
|
42
|
+
<slot @slotchange=${this._handleSlotChange} @click=${this._onToggle} @keydown=${this._onKeyboardToggle}></slot>
|
|
43
43
|
</div>
|
|
44
|
-
`}}var ze;Ve.styles=[...Ue.styles,Oe],e([
|
|
44
|
+
`}}var ze;Ve.styles=[...Ue.styles,Oe],e([Ce({type:Boolean,reflect:!0})],Ve.prototype,"allowMultiple",void 0),e([Ce({type:String,reflect:!0})],Ve.prototype,"variant",void 0),e([Ce({type:String,reflect:!0})],Ve.prototype,"density",void 0),e([(e,t)=>{const{slot:s,selector:i}=ze??{},n="slot"+(s?`[name=${s}]`:":not([name])");return Ee(e,t,{get(){const e=this.renderRoot?.querySelector(n),t=e?.assignedElements(ze)??[];return void 0===i?t:t.filter(e=>e.matches(i))}})}],Ve.prototype,"defaultNodes",void 0);
|
|
45
45
|
/**
|
|
46
46
|
* @license
|
|
47
47
|
* Copyright 2017 Google LLC
|
|
@@ -76,5 +76,5 @@ const Ae=1;class Le{constructor(e){}get _$isConnected(){return this._$parent._$i
|
|
|
76
76
|
<slot id="content" name="content" class="content" role="region" aria-labelledby="header"></slot>
|
|
77
77
|
</div>
|
|
78
78
|
</div>
|
|
79
|
-
`}}function Xe(e,t){customElements.get(e)||customElements.define(e,t)}Ye.styles=[...Ue.styles,Ke],e([Te(".accordion-item")],Ye.prototype,"accordion",void 0),e([Te(".accordion-btn")],Ye.prototype,"header",void 0),e([Te(".accordion-body")],Ye.prototype,"body",void 0),e([
|
|
79
|
+
`}}function Xe(e,t){customElements.get(e)||customElements.define(e,t)}Ye.styles=[...Ue.styles,Ke],e([Te(".accordion-item")],Ye.prototype,"accordion",void 0),e([Te(".accordion-btn")],Ye.prototype,"header",void 0),e([Te(".accordion-body")],Ye.prototype,"body",void 0),e([Ce({type:Boolean,reflect:!0})],Ye.prototype,"open",void 0),e([Ce({type:Boolean,reflect:!0})],Ye.prototype,"disabled",void 0),e([function(e,t){const s=Object.assign({waitUntilFirstUpdate:!1},t);return(t,i)=>{const{update:n}=t;if(e in t){const o=e;t.update=function(e){if(e.has(o)){const t=e.get(o),n=this[o];t!==n&&(s.waitUntilFirstUpdate&&!this.hasUpdated||this[i](t,n))}n.call(this,e)}}}}("open",{waitUntilFirstUpdate:!0})],Ye.prototype,"handleOpenChange",null),Ze("accordion.show",{keyframes:[{height:"0",opacity:"0"},{height:"auto",opacity:"1"}],options:{duration:350,easing:"ease-in-out"}}),Ze("accordion.hide",{keyframes:[{height:"auto",opacity:"1"},{height:"0",opacity:"0"}],options:{duration:350,easing:"ease-in-out"}}),Xe("sgds-accordion",Ve),Xe("sgds-accordion-item",Ye)});
|
|
80
80
|
//# sourceMappingURL=index.umd.min.js.map
|