@govtechsg/sgds-web-component 3.28.1-rc.0 → 3.29.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/button.js +1 -1
- package/base/button.js.map +1 -1
- package/components/Alert/alert.js +1 -1
- package/components/Alert/alert.js.map +1 -1
- package/components/Alert/index.umd.min.js +3 -3
- package/components/Alert/index.umd.min.js.map +1 -1
- package/components/Alert/sgds-alert.js +1 -1
- package/components/Alert/sgds-alert.js.map +1 -1
- package/components/Appnav/index.umd.min.js +3 -3
- package/components/Appnav/index.umd.min.js.map +1 -1
- package/components/Appnav/sgds-appnav.js +1 -1
- package/components/Appnav/sgds-appnav.js.map +1 -1
- package/components/Badge/index.umd.min.js +1 -1
- package/components/Badge/index.umd.min.js.map +1 -1
- package/components/Breadcrumb/index.umd.min.js +3 -3
- package/components/Breadcrumb/index.umd.min.js.map +1 -1
- package/components/Breadcrumb/sgds-breadcrumb.js +2 -2
- package/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
- package/components/Button/index.umd.min.js +2 -2
- package/components/Button/index.umd.min.js.map +1 -1
- package/components/Button/sgds-button.js +1 -1
- package/components/Button/sgds-button.js.map +1 -1
- package/components/Checkbox/index.umd.min.js +3 -2
- package/components/Checkbox/index.umd.min.js.map +1 -1
- package/components/Checkbox/sgds-checkbox.d.ts +2 -0
- package/components/Checkbox/sgds-checkbox.js +3 -0
- package/components/Checkbox/sgds-checkbox.js.map +1 -1
- package/components/CloseButton/close-button.js +1 -1
- package/components/CloseButton/close-button.js.map +1 -1
- package/components/CloseButton/index.umd.min.js +1 -1
- package/components/CloseButton/index.umd.min.js.map +1 -1
- package/components/ComboBox/index.umd.min.js +4 -3
- package/components/ComboBox/index.umd.min.js.map +1 -1
- package/components/DataTable/data-table.js +1 -1
- package/components/DataTable/data-table.js.map +1 -1
- package/components/DataTable/index.umd.min.js +20 -11
- package/components/DataTable/index.umd.min.js.map +1 -1
- package/components/DataTable/sgds-data-table-row.js +12 -4
- package/components/DataTable/sgds-data-table-row.js.map +1 -1
- package/components/DataTable/sgds-data-table.js +1 -2
- package/components/DataTable/sgds-data-table.js.map +1 -1
- package/components/Datepicker/index.umd.min.js +3 -2
- package/components/Datepicker/index.umd.min.js.map +1 -1
- package/components/Drawer/index.umd.min.js +1 -1
- package/components/Drawer/index.umd.min.js.map +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/FileUpload/index.umd.min.js +3 -3
- package/components/FileUpload/index.umd.min.js.map +1 -1
- package/components/IconButton/index.umd.min.js +1 -1
- package/components/IconButton/index.umd.min.js.map +1 -1
- package/components/Input/index.umd.min.js +1 -0
- package/components/Input/index.umd.min.js.map +1 -1
- package/components/Input/sgds-input.js +1 -0
- package/components/Input/sgds-input.js.map +1 -1
- package/components/Mainnav/index.umd.min.js +3 -3
- package/components/Mainnav/index.umd.min.js.map +1 -1
- package/components/Mainnav/sgds-mainnav.js +1 -1
- package/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/components/Modal/index.umd.min.js +3 -3
- package/components/Modal/index.umd.min.js.map +1 -1
- package/components/Modal/modal.js +1 -1
- package/components/Modal/modal.js.map +1 -1
- package/components/Modal/sgds-modal.js +1 -1
- package/components/Modal/sgds-modal.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/Pagination/index.umd.min.js +2 -2
- package/components/Pagination/index.umd.min.js.map +1 -1
- package/components/QuantityToggle/index.umd.min.js +2 -1
- package/components/QuantityToggle/index.umd.min.js.map +1 -1
- package/components/Select/index.umd.min.js +1 -1
- package/components/Select/index.umd.min.js.map +1 -1
- package/components/Select/sgds-select.js +1 -1
- package/components/Select/sgds-select.js.map +1 -1
- package/components/Sidebar/index.umd.min.js +1 -1
- package/components/Sidebar/index.umd.min.js.map +1 -1
- package/components/Sidenav/index.umd.min.js +1 -1
- package/components/Sidenav/index.umd.min.js.map +1 -1
- package/components/Sidenav/sgds-sidenav.js +1 -1
- package/components/Sidenav/sgds-sidenav.js.map +1 -1
- package/components/SystemBanner/index.umd.min.js +4 -2
- package/components/SystemBanner/index.umd.min.js.map +1 -1
- package/components/SystemBanner/sgds-system-banner.js +2 -0
- package/components/SystemBanner/sgds-system-banner.js.map +1 -1
- package/components/Toast/index.umd.min.js +1 -1
- package/components/Toast/index.umd.min.js.map +1 -1
- package/components/index.umd.min.js +68 -56
- package/components/index.umd.min.js.map +1 -1
- package/custom-elements.json +20 -1
- package/index.umd.min.js +49 -37
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/react/base/button.cjs.js +1 -1
- package/react/base/button.cjs.js.map +1 -1
- package/react/base/button.js +1 -1
- package/react/base/button.js.map +1 -1
- package/react/components/Alert/alert.cjs.js +1 -1
- package/react/components/Alert/alert.cjs.js.map +1 -1
- package/react/components/Alert/alert.js +1 -1
- package/react/components/Alert/alert.js.map +1 -1
- package/react/components/Alert/sgds-alert.cjs.js +1 -1
- package/react/components/Alert/sgds-alert.cjs.js.map +1 -1
- package/react/components/Alert/sgds-alert.js +1 -1
- package/react/components/Alert/sgds-alert.js.map +1 -1
- package/react/components/Appnav/sgds-appnav.cjs.js +1 -1
- package/react/components/Appnav/sgds-appnav.cjs.js.map +1 -1
- package/react/components/Appnav/sgds-appnav.js +1 -1
- package/react/components/Appnav/sgds-appnav.js.map +1 -1
- package/react/components/Breadcrumb/sgds-breadcrumb.cjs.js +2 -2
- package/react/components/Breadcrumb/sgds-breadcrumb.cjs.js.map +1 -1
- package/react/components/Breadcrumb/sgds-breadcrumb.js +2 -2
- package/react/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
- package/react/components/Button/sgds-button.cjs.js +1 -1
- package/react/components/Button/sgds-button.cjs.js.map +1 -1
- package/react/components/Button/sgds-button.js +1 -1
- package/react/components/Button/sgds-button.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox.cjs.js +3 -0
- package/react/components/Checkbox/sgds-checkbox.cjs.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox.js +3 -0
- package/react/components/Checkbox/sgds-checkbox.js.map +1 -1
- package/react/components/CloseButton/close-button.cjs.js +1 -1
- package/react/components/CloseButton/close-button.cjs.js.map +1 -1
- package/react/components/CloseButton/close-button.js +1 -1
- package/react/components/CloseButton/close-button.js.map +1 -1
- package/react/components/DataTable/data-table.cjs.js +1 -1
- package/react/components/DataTable/data-table.cjs.js.map +1 -1
- package/react/components/DataTable/data-table.js +1 -1
- package/react/components/DataTable/data-table.js.map +1 -1
- package/react/components/DataTable/sgds-data-table-row.cjs.js +12 -4
- package/react/components/DataTable/sgds-data-table-row.cjs.js.map +1 -1
- package/react/components/DataTable/sgds-data-table-row.js +12 -4
- package/react/components/DataTable/sgds-data-table-row.js.map +1 -1
- package/react/components/DataTable/sgds-data-table.cjs.js +1 -2
- package/react/components/DataTable/sgds-data-table.cjs.js.map +1 -1
- package/react/components/DataTable/sgds-data-table.js +1 -2
- package/react/components/DataTable/sgds-data-table.js.map +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/Input/sgds-input.cjs.js +1 -0
- package/react/components/Input/sgds-input.cjs.js.map +1 -1
- package/react/components/Input/sgds-input.js +1 -0
- package/react/components/Input/sgds-input.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav.cjs.js +1 -1
- package/react/components/Mainnav/sgds-mainnav.cjs.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav.js +1 -1
- package/react/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/react/components/Modal/modal.cjs.js +1 -1
- package/react/components/Modal/modal.cjs.js.map +1 -1
- package/react/components/Modal/modal.js +1 -1
- package/react/components/Modal/modal.js.map +1 -1
- package/react/components/Modal/sgds-modal.cjs.js +1 -1
- package/react/components/Modal/sgds-modal.cjs.js.map +1 -1
- package/react/components/Modal/sgds-modal.js +1 -1
- package/react/components/Modal/sgds-modal.js.map +1 -1
- package/react/components/Select/sgds-select.cjs.js +1 -1
- package/react/components/Select/sgds-select.cjs.js.map +1 -1
- package/react/components/Select/sgds-select.js +1 -1
- package/react/components/Select/sgds-select.js.map +1 -1
- package/react/components/Sidenav/sgds-sidenav.cjs.js +1 -1
- package/react/components/Sidenav/sgds-sidenav.cjs.js.map +1 -1
- package/react/components/Sidenav/sgds-sidenav.js +1 -1
- package/react/components/Sidenav/sgds-sidenav.js.map +1 -1
- package/react/components/SystemBanner/sgds-system-banner.cjs.js +2 -0
- package/react/components/SystemBanner/sgds-system-banner.cjs.js.map +1 -1
- package/react/components/SystemBanner/sgds-system-banner.js +2 -0
- package/react/components/SystemBanner/sgds-system-banner.js.map +1 -1
- package/themes/night.css +8 -8
- package/types/react.d.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-modal.js","names":["headerStyles","svgStyles","modalStyle"],"sources":["../../../src/components/Modal/sgds-modal.ts"],"sourcesContent":["import { html, nothing, PropertyValueMap } from \"lit\";\nimport { property, query } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { watch } from \"../../utils/watch\";\nimport { animateTo, stopAnimations } from \"../../utils/animate\";\nimport { getAnimation, setDefaultAnimation } from \"../../utils/animation-registry\";\nimport { waitForEvent } from \"../../utils/event\";\nimport Modal from \"../../utils/modal\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport { lockBodyScrolling, unlockBodyScrolling } from \"../../utils/scroll\";\nimport { SM_BREAKPOINT, MD_BREAKPOINT } from \"../../utils/breakpoints\";\nimport SgdsButton from \"../Button/sgds-button\";\nimport SgdsCloseButton from \"../CloseButton/sgds-close-button\";\nimport modalStyle from \"./modal.css\";\nimport headerStyles from \"../../styles/header-class.css\";\nimport svgStyles from \"../../styles/svg.css\";\n/**\n * @summary The modal component inform users about a specific task and may contain critical information which users then have to make a decision.\n *\n * @slot default - The content of the Modal's body.\n * @slot title - The title of the Modal.\n * @slot description - The description of the Modal.\n * @slot footer - The content of the Modal's footer, typically used to pass in buttons for call to action.\n *\n * @event sgds-close - Emitted when the modal is called to close via mouseclick of close button, overlay or via keyboard esc key. This event is cancelable; use `event.preventDefault()` to prevent the modal from closing. `event.detail.source` indicates the trigger source: 'close-button', 'overlay', or 'keyboard'.\n * @event sgds-show - Emitted when the modal opens\n * @event sgds-hide - Emitted when the modal closes\n * @event sgds-after-show - Emitted after modal opens and the animations has completed\n * @event sgds-after-hide - Emitted after modal closes and the animations has completed\n *\n */\nexport class SgdsModal extends SgdsElement {\n static styles = [...SgdsElement.styles, headerStyles, svgStyles, modalStyle];\n /**@internal */\n static dependencies = {\n \"sgds-close-button\": SgdsCloseButton\n };\n /**@internal */\n @query(\".modal\") dialog: HTMLElement;\n /**@internal */\n @query(\".modal-panel\") panel: HTMLElement;\n /**@internal */\n @query(\".modal-overlay\") overlay: HTMLElement;\n /**@internal */\n @query(\".modal-title\") heading: HTMLElement;\n /**@internal */\n private readonly hasSlotController = new HasSlotController(this, \"footer\");\n /**@internal */\n private modal: Modal;\n /**@internal */\n private originalTrigger: HTMLElement | null;\n private _resizeHandler: () => void;\n\n /**Indicates whether or not the modal is open. You can use this in lieu of the show/hide methods. */\n @property({ type: Boolean, reflect: true }) open = false;\n\n /** Removes the default animation when opening and closing of modal */\n @property({ type: Boolean, reflect: true }) noAnimation = false;\n\n /** Specifies a small, medium, large or fullscreen modal, the size is medium by default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"fullscreen\" = \"md\";\n\n /** Used only for SSR to indicate the presence of the `footer` slot. */\n @property({ type: Boolean }) hasFooterSlot = false;\n\n /** Removes the close button in the modal header. */\n @property({ type: Boolean, reflect: true }) noCloseButton = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.modal = new Modal(this);\n this._resizeHandler = this._debounce(this._onWindowResize.bind(this), 200);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this._removeResizeListener();\n unlockBodyScrolling(this);\n }\n\n firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n this._onWindowResize();\n this.dialog.hidden = !this.open;\n\n if (this.open) {\n this.addOpenListeners();\n this.modal.activate();\n lockBodyScrolling(this);\n }\n }\n\n updated() {\n if (!this.hasFooterSlot) this.hasFooterSlot = this.hasSlotController.test(\"footer\");\n }\n\n private _debounce(func: (...args: any[]) => void, wait: number) {\n let timeout: number;\n return (...args: any[]) => {\n clearTimeout(timeout);\n timeout = window.setTimeout(() => func(...args), wait);\n };\n }\n\n /** Handle the window resize event. */\n private _onWindowResize() {\n const panel = this.panel.getBoundingClientRect();\n const panelWidth = panel.width;\n const buttonElements = this.querySelectorAll(\"sgds-button[slot='footer']\");\n\n if (!this.panel) return;\n\n if (buttonElements.length <= 1) return;\n\n if (panelWidth < SM_BREAKPOINT || (this.size === \"fullscreen\" && panelWidth < MD_BREAKPOINT)) {\n buttonElements.forEach(buttonElement => {\n const button = buttonElement as SgdsButton;\n button.fullWidth = true;\n });\n } else {\n buttonElements.forEach(buttonElement => {\n const button = buttonElement as SgdsButton;\n button.fullWidth = false;\n });\n }\n }\n\n /** Add the resize event listener. */\n private _addResizeListener() {\n window.addEventListener(\"resize\", this._resizeHandler);\n }\n\n /** Remove the resize event listener. */\n private _removeResizeListener() {\n window.removeEventListener(\"resize\", this._resizeHandler);\n }\n\n /** Shows the dialog. */\n public async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, \"sgds-after-show\");\n }\n\n /** Hides the dialog */\n public async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, \"sgds-after-hide\");\n }\n\n private requestClose(source: \"close-button\" | \"keyboard\" | \"overlay\") {\n const sgdsRequestClose = this.emit(\"sgds-close\", {\n cancelable: true,\n detail: { source }\n });\n\n if (sgdsRequestClose.defaultPrevented) {\n const animation = getAnimation(this, \"modal.denyClose\");\n animateTo(this.panel, animation.keyframes);\n return;\n }\n\n this.hide();\n }\n\n addOpenListeners() {\n document.addEventListener(\"keydown\", this.handleDocumentKeyDown);\n }\n\n removeOpenListeners() {\n document.removeEventListener(\"keydown\", this.handleDocumentKeyDown);\n }\n\n handleDocumentKeyDown(event: KeyboardEvent) {\n if (this.open && event.key === \"Escape\") {\n event.stopPropagation();\n this.requestClose(\"keyboard\");\n }\n }\n\n private _overlayClickHandler() {\n if (this.size === \"fullscreen\") {\n return;\n }\n\n this.requestClose(\"overlay\");\n }\n\n @watch(\"open\", { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.emit(\"sgds-show\");\n this.addOpenListeners();\n this.originalTrigger = document.activeElement as HTMLElement;\n this.modal.activate();\n\n lockBodyScrolling(this);\n\n await Promise.all([stopAnimations(this.dialog), stopAnimations(this.overlay)]);\n this.dialog.hidden = false;\n\n const panelAnimation = getAnimation(this, \"modal.show\");\n const overlayAnimation = getAnimation(this, \"modal.overlay.show\");\n !this.noAnimation &&\n (await Promise.all([\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options),\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)\n ]));\n\n this.emit(\"sgds-after-show\");\n\n // Add focus on modal heading after opening it\n this.heading.focus();\n\n // Add resize listener only when the modal is shown\n this._addResizeListener();\n } else {\n // Hide\n this.emit(\"sgds-hide\");\n this.removeOpenListeners();\n this.modal.deactivate();\n\n await Promise.all([stopAnimations(this.dialog), stopAnimations(this.overlay)]);\n const panelAnimation = getAnimation(this, \"modal.hide\");\n const overlayAnimation = getAnimation(this, \"modal.overlay.hide\");\n\n // Animate the overlay and the panel at the same time. Because animation durations might be different, we need to\n // hide each one individually when the animation finishes, otherwise the first one that finishes will reappear\n // unexpectedly. We'll unhide them after all animations have completed.\n !this.noAnimation &&\n (await Promise.all([\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options).then(() => {\n this.overlay.hidden = true;\n }),\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options).then(() => {\n this.panel.hidden = true;\n })\n ]));\n\n this.dialog.hidden = true;\n\n // Now that the dialog is hidden, restore the overlay and panel for next time\n this.overlay.hidden = false;\n this.panel.hidden = false;\n\n unlockBodyScrolling(this);\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (typeof trigger?.focus === \"function\") {\n setTimeout(() => trigger.focus());\n }\n\n this.emit(\"sgds-after-hide\");\n\n // Remove resize listener when the modal is hidden\n this._removeResizeListener();\n }\n }\n\n render() {\n return html`\n <div\n class=${classMap({\n modal: true,\n show: this.open,\n \"has-footer\": this.hasFooterSlot\n })}\n >\n <div class=\"modal-overlay\" @click=${this._overlayClickHandler}></div>\n\n <div\n class=\"modal-panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden=${this.open ? \"false\" : \"true\"}\n aria-labelledby=\"title\"\n tabindex=\"-1\"\n >\n <div class=\"modal-content\">\n ${\n !this.noCloseButton\n ? html`<sgds-close-button\n class=\"modal-header__close\"\n @click=\"${() => this.requestClose(\"close-button\")}\"\n aria-label=\"close modal\"\n ></sgds-close-button>`\n : nothing\n }\n <div class=\"modal-header\">\n <div class=\"modal-header__title-description\">\n <div id=\"title\"><slot class=\"modal-title\" name=\"title\"></slot></div>\n <slot name=\"description\"></slot>\n </div>\n </div>\n <div class=\"modal-body\">\n <slot></slot>\n </div>\n </div class=\"modal-content\">\n <div class=\"modal-footer\">\n <slot name=\"footer\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n\nsetDefaultAnimation(\"modal.show\", {\n keyframes: [\n { opacity: 0, transform: \"scale(1) translate(0, -100%)\" },\n { opacity: 1, transform: \"scale(1) translate(0, 0%)\" }\n ],\n options: { duration: 400, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"modal.hide\", {\n keyframes: [\n { opacity: 1, transform: \"scale(1) translate(0, 0)\" },\n { opacity: 0, transform: \"scale(1) translate(0, -100%)\" }\n ],\n options: { duration: 400, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"modal.denyClose\", {\n keyframes: [{ transform: \"scale(1)\" }, { transform: \"scale(1.02)\" }, { transform: \"scale(1)\" }],\n options: { duration: 400 }\n});\n\nsetDefaultAnimation(\"modal.overlay.show\", {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n options: { duration: 400 }\n});\n\nsetDefaultAnimation(\"modal.overlay.hide\", {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n options: { duration: 400 }\n});\n\nexport default SgdsModal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,YAAb,cAA+B,YAAY;;;EAeJ,KAAA,oBAAA,IAAI,kBAAkB,MAAM,QAAQ;EAQtB,KAAA,OAAA;EAGO,KAAA,cAAA;EAGoB,KAAA,OAAA;EAGjC,KAAA,gBAAA;EAGe,KAAA,gBAAA;;;EAlC5C,KAAA,SAAA;GAAC,GAAG,YAAY;GAAQA;GAAcC;GAAWC;EAAU;;;EAErD,KAAA,eAAA,EACpB,qBAAqB,gBACvB;;CAgCA,oBAAoB;EAClB,MAAM,kBAAkB;EACxB,KAAK,wBAAwB,KAAK,sBAAsB,KAAK,IAAI;EACjE,KAAK,QAAQ,IAAI,MAAM,IAAI;EAC3B,KAAK,iBAAiB,KAAK,UAAU,KAAK,gBAAgB,KAAK,IAAI,GAAG,GAAG;CAC3E;CAEA,uBAAuB;EACrB,MAAM,qBAAqB;EAC3B,KAAK,sBAAsB;EAC3B,oBAAoB,IAAI;CAC1B;CAEA,aAAa,mBAA2C;EACtD,MAAM,aAAa,iBAAiB;EACpC,KAAK,gBAAgB;EACrB,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3,"file":"sgds-modal.js","names":["headerStyles","svgStyles","modalStyle"],"sources":["../../../src/components/Modal/sgds-modal.ts"],"sourcesContent":["import { html, nothing, PropertyValueMap } from \"lit\";\nimport { property, query } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { watch } from \"../../utils/watch\";\nimport { animateTo, stopAnimations } from \"../../utils/animate\";\nimport { getAnimation, setDefaultAnimation } from \"../../utils/animation-registry\";\nimport { waitForEvent } from \"../../utils/event\";\nimport Modal from \"../../utils/modal\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport { lockBodyScrolling, unlockBodyScrolling } from \"../../utils/scroll\";\nimport { SM_BREAKPOINT, MD_BREAKPOINT } from \"../../utils/breakpoints\";\nimport SgdsButton from \"../Button/sgds-button\";\nimport SgdsCloseButton from \"../CloseButton/sgds-close-button\";\nimport modalStyle from \"./modal.css\";\nimport headerStyles from \"../../styles/header-class.css\";\nimport svgStyles from \"../../styles/svg.css\";\n/**\n * @summary The modal component inform users about a specific task and may contain critical information which users then have to make a decision.\n *\n * @slot default - The content of the Modal's body.\n * @slot title - The title of the Modal.\n * @slot description - The description of the Modal.\n * @slot footer - The content of the Modal's footer, typically used to pass in buttons for call to action.\n *\n * @event sgds-close - Emitted when the modal is called to close via mouseclick of close button, overlay or via keyboard esc key. This event is cancelable; use `event.preventDefault()` to prevent the modal from closing. `event.detail.source` indicates the trigger source: 'close-button', 'overlay', or 'keyboard'.\n * @event sgds-show - Emitted when the modal opens\n * @event sgds-hide - Emitted when the modal closes\n * @event sgds-after-show - Emitted after modal opens and the animations has completed\n * @event sgds-after-hide - Emitted after modal closes and the animations has completed\n *\n */\nexport class SgdsModal extends SgdsElement {\n static styles = [...SgdsElement.styles, headerStyles, svgStyles, modalStyle];\n /**@internal */\n static dependencies = {\n \"sgds-close-button\": SgdsCloseButton\n };\n /**@internal */\n @query(\".modal\") dialog: HTMLElement;\n /**@internal */\n @query(\".modal-panel\") panel: HTMLElement;\n /**@internal */\n @query(\".modal-overlay\") overlay: HTMLElement;\n /**@internal */\n @query(\".modal-title\") heading: HTMLElement;\n /**@internal */\n private readonly hasSlotController = new HasSlotController(this, \"footer\");\n /**@internal */\n private modal: Modal;\n /**@internal */\n private originalTrigger: HTMLElement | null;\n private _resizeHandler: () => void;\n\n /**Indicates whether or not the modal is open. You can use this in lieu of the show/hide methods. */\n @property({ type: Boolean, reflect: true }) open = false;\n\n /** Removes the default animation when opening and closing of modal */\n @property({ type: Boolean, reflect: true }) noAnimation = false;\n\n /** Specifies a small, medium, large or fullscreen modal, the size is medium by default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"fullscreen\" = \"md\";\n\n /** Used only for SSR to indicate the presence of the `footer` slot. */\n @property({ type: Boolean }) hasFooterSlot = false;\n\n /** Removes the close button in the modal header. */\n @property({ type: Boolean, reflect: true }) noCloseButton = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.modal = new Modal(this);\n this._resizeHandler = this._debounce(this._onWindowResize.bind(this), 200);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this._removeResizeListener();\n unlockBodyScrolling(this);\n }\n\n firstUpdated(changedProperties: PropertyValueMap<this>) {\n super.firstUpdated(changedProperties);\n this._onWindowResize();\n this.dialog.hidden = !this.open;\n\n if (this.open) {\n this.addOpenListeners();\n this.modal.activate();\n lockBodyScrolling(this);\n }\n }\n\n updated() {\n if (!this.hasFooterSlot) this.hasFooterSlot = this.hasSlotController.test(\"footer\");\n }\n\n private _debounce(func: (...args: any[]) => void, wait: number) {\n let timeout: number;\n return (...args: any[]) => {\n clearTimeout(timeout);\n timeout = window.setTimeout(() => func(...args), wait);\n };\n }\n\n /** Handle the window resize event. */\n private _onWindowResize() {\n const panel = this.panel.getBoundingClientRect();\n const panelWidth = panel.width;\n const buttonElements = this.querySelectorAll(\"sgds-button[slot='footer']\");\n\n if (!this.panel) return;\n\n if (buttonElements.length <= 1) return;\n\n if (panelWidth < SM_BREAKPOINT || (this.size === \"fullscreen\" && panelWidth < MD_BREAKPOINT)) {\n buttonElements.forEach(buttonElement => {\n const button = buttonElement as SgdsButton;\n button.fullWidth = true;\n });\n } else {\n buttonElements.forEach(buttonElement => {\n const button = buttonElement as SgdsButton;\n button.fullWidth = false;\n });\n }\n }\n\n /** Add the resize event listener. */\n private _addResizeListener() {\n window.addEventListener(\"resize\", this._resizeHandler);\n }\n\n /** Remove the resize event listener. */\n private _removeResizeListener() {\n window.removeEventListener(\"resize\", this._resizeHandler);\n }\n\n /** Shows the dialog. */\n public async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, \"sgds-after-show\");\n }\n\n /** Hides the dialog */\n public async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, \"sgds-after-hide\");\n }\n\n private requestClose(source: \"close-button\" | \"keyboard\" | \"overlay\") {\n const sgdsRequestClose = this.emit(\"sgds-close\", {\n cancelable: true,\n detail: { source }\n });\n\n if (sgdsRequestClose.defaultPrevented) {\n const animation = getAnimation(this, \"modal.denyClose\");\n animateTo(this.panel, animation.keyframes);\n return;\n }\n\n this.hide();\n }\n\n addOpenListeners() {\n document.addEventListener(\"keydown\", this.handleDocumentKeyDown);\n }\n\n removeOpenListeners() {\n document.removeEventListener(\"keydown\", this.handleDocumentKeyDown);\n }\n\n handleDocumentKeyDown(event: KeyboardEvent) {\n if (this.open && event.key === \"Escape\") {\n event.stopPropagation();\n this.requestClose(\"keyboard\");\n }\n }\n\n private _overlayClickHandler() {\n if (this.size === \"fullscreen\") {\n return;\n }\n\n this.requestClose(\"overlay\");\n }\n\n @watch(\"open\", { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.emit(\"sgds-show\");\n this.addOpenListeners();\n this.originalTrigger = document.activeElement as HTMLElement;\n this.modal.activate();\n\n lockBodyScrolling(this);\n\n await Promise.all([stopAnimations(this.dialog), stopAnimations(this.overlay)]);\n this.dialog.hidden = false;\n\n const panelAnimation = getAnimation(this, \"modal.show\");\n const overlayAnimation = getAnimation(this, \"modal.overlay.show\");\n !this.noAnimation &&\n (await Promise.all([\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options),\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)\n ]));\n\n this.emit(\"sgds-after-show\");\n\n // Add focus on modal heading after opening it\n this.heading.focus();\n\n // Add resize listener only when the modal is shown\n this._addResizeListener();\n } else {\n // Hide\n this.emit(\"sgds-hide\");\n this.removeOpenListeners();\n this.modal.deactivate();\n\n await Promise.all([stopAnimations(this.dialog), stopAnimations(this.overlay)]);\n const panelAnimation = getAnimation(this, \"modal.hide\");\n const overlayAnimation = getAnimation(this, \"modal.overlay.hide\");\n\n // Animate the overlay and the panel at the same time. Because animation durations might be different, we need to\n // hide each one individually when the animation finishes, otherwise the first one that finishes will reappear\n // unexpectedly. We'll unhide them after all animations have completed.\n !this.noAnimation &&\n (await Promise.all([\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options).then(() => {\n this.overlay.hidden = true;\n }),\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options).then(() => {\n this.panel.hidden = true;\n })\n ]));\n\n this.dialog.hidden = true;\n\n // Now that the dialog is hidden, restore the overlay and panel for next time\n this.overlay.hidden = false;\n this.panel.hidden = false;\n\n unlockBodyScrolling(this);\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (typeof trigger?.focus === \"function\") {\n setTimeout(() => trigger.focus());\n }\n\n this.emit(\"sgds-after-hide\");\n\n // Remove resize listener when the modal is hidden\n this._removeResizeListener();\n }\n }\n\n render() {\n return html`\n <div\n class=${classMap({\n modal: true,\n show: this.open,\n \"has-footer\": this.hasFooterSlot\n })}\n >\n <div class=\"modal-overlay\" @click=${this._overlayClickHandler}></div>\n\n <div\n class=\"modal-panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden=${this.open ? \"false\" : \"true\"}\n aria-labelledby=\"title\"\n tabindex=\"-1\"\n >\n <div class=\"modal-content\">\n ${\n !this.noCloseButton\n ? html`<sgds-close-button\n class=\"modal-header__close\"\n @click=\"${() => this.requestClose(\"close-button\")}\"\n aria-label=\"close modal\"\n ></sgds-close-button>`\n : nothing\n }\n <div class=\"modal-header\">\n <div class=\"modal-header__title-description\">\n <div id=\"title\"><slot class=\"modal-title\" name=\"title\"></slot></div>\n <slot name=\"description\"></slot>\n </div>\n </div>\n <div class=\"modal-body\" tabindex=\"0\">\n <slot></slot>\n </div>\n </div class=\"modal-content\">\n <div class=\"modal-footer\">\n <slot name=\"footer\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n\nsetDefaultAnimation(\"modal.show\", {\n keyframes: [\n { opacity: 0, transform: \"scale(1) translate(0, -100%)\" },\n { opacity: 1, transform: \"scale(1) translate(0, 0%)\" }\n ],\n options: { duration: 400, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"modal.hide\", {\n keyframes: [\n { opacity: 1, transform: \"scale(1) translate(0, 0)\" },\n { opacity: 0, transform: \"scale(1) translate(0, -100%)\" }\n ],\n options: { duration: 400, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"modal.denyClose\", {\n keyframes: [{ transform: \"scale(1)\" }, { transform: \"scale(1.02)\" }, { transform: \"scale(1)\" }],\n options: { duration: 400 }\n});\n\nsetDefaultAnimation(\"modal.overlay.show\", {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n options: { duration: 400 }\n});\n\nsetDefaultAnimation(\"modal.overlay.hide\", {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n options: { duration: 400 }\n});\n\nexport default SgdsModal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,YAAb,cAA+B,YAAY;;;EAeJ,KAAA,oBAAA,IAAI,kBAAkB,MAAM,QAAQ;EAQtB,KAAA,OAAA;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CAA2B,GACpD;EAAE,SAAS;EAAG,WAAW;CAA+B,CAC1D;CACA,SAAS;EAAE,UAAU;EAAK,QAAQ;CAAO;AAC3C,CAAC;AAED,oBAAoB,mBAAmB;CACrC,WAAW;EAAC,EAAE,WAAW,WAAW;EAAG,EAAE,WAAW,cAAc;EAAG,EAAE,WAAW,WAAW;CAAC;CAC9F,SAAS,EAAE,UAAU,IAAI;AAC3B,CAAC;AAED,oBAAoB,sBAAsB;CACxC,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;CAC1C,SAAS,EAAE,UAAU,IAAI;AAC3B,CAAC;AAED,oBAAoB,sBAAsB;CACxC,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;CAC1C,SAAS,EAAE,UAAU,IAAI;AAC3B,CAAC"}
|
|
@@ -76,7 +76,7 @@ let Ue=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`
|
|
|
76
76
|
* @license
|
|
77
77
|
* Copyright 2020 Google LLC
|
|
78
78
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
79
|
-
*/let at=()=>new ot;var ot=class{};let st=/* @__PURE__ */ new WeakMap,ct=Xe(class extends it{render(e){return M}update(e,[t]){let n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),M}rt(e){if(this.isConnected||(e=void 0),typeof this.G==`function`){let t=this.ht??globalThis,n=st.get(t);n===void 0&&(n=/* @__PURE__ */ new WeakMap,st.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G==`function`?st.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),lt=Math.min,V=Math.max,ut=Math.round,dt=Math.floor,H=e=>({x:e,y:e}),ft={left:`right`,right:`left`,bottom:`top`,top:`bottom`},pt={start:`end`,end:`start`};function mt(e,t,n){return V(e,lt(t,n))}function ht(e,t){return typeof e==`function`?e(t):e}function U(e){return e.split(`-`)[0]}function gt(e){return e.split(`-`)[1]}function _t(e){return e===`x`?`y`:`x`}function vt(e){return e===`y`?`height`:`width`}let yt=/*#__PURE__*/ new Set([`top`,`bottom`]);function W(e){return yt.has(U(e))?`y`:`x`}function bt(e){return _t(W(e))}function xt(e,t,n){n===void 0&&(n=!1);let r=gt(e),i=bt(e),a=vt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=At(o)),[o,At(o)]}function St(e){let t=At(e);return[Ct(e),t,Ct(t)]}function Ct(e){return e.replace(/start|end/g,e=>pt[e])}let wt=[`left`,`right`],Tt=[`right`,`left`],Et=[`top`,`bottom`],Dt=[`bottom`,`top`];function Ot(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Tt:wt:t?wt:Tt;case`left`:case`right`:return t?Et:Dt;default:return[]}}function kt(e,t,n,r){let i=gt(e),a=Ot(U(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ct)))),a}function At(e){return e.replace(/left|right|bottom|top/g,e=>ft[e])}function jt(e){return{top:0,right:0,bottom:0,left:0,...e}}function Mt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:jt(e)}function Nt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Pt(e,t,n){let{reference:r,floating:i}=e,a=W(t),o=bt(t),s=vt(o),c=U(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(gt(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1)}return p}let Ft=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Pt(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Pt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function It(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ht(t,e),p=Mt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Nt(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Nt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}let Lt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ht(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=U(r),_=W(o),v=U(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[At(o)]:St(o)),ee=p!==`none`;!d&&ee&&b.push(...kt(o,m,p,y));let te=[o,...b],x=await It(t,h),S=[],C=i.flip?.overflows||[];if(l&&S.push(x[g]),u){let e=xt(r,a,y);S.push(x[e[0]],x[e[1]])}if(C=[...C,{placement:r,overflows:S}],!S.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=te[e];if(t&&(u!==`alignment`||_===W(t)||C.every(e=>W(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let n=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=C.filter(e=>{if(ee){let t=W(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},Rt=/*#__PURE__*/ new Set([`left`,`top`]);async function zt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=U(n),s=gt(n),c=W(n)===`y`,l=Rt.has(o)?-1:1,u=a&&c?-1:1,d=ht(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}let Bt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await zt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Vt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=ht(e,t),l={x:n,y:r},u=await It(t,c),d=W(U(i)),f=_t(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=mt(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=mt(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}};function Ht(){return typeof window<`u`}function Ut(e){return Wt(e)?(e.nodeName||``).toLowerCase():`#document`}function G(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function K(e){return((Wt(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Wt(e){return Ht()?e instanceof Node||e instanceof G(e).Node:!1}function q(e){return Ht()?e instanceof Element||e instanceof G(e).Element:!1}function J(e){return Ht()?e instanceof HTMLElement||e instanceof G(e).HTMLElement:!1}function Gt(e){return!Ht()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof G(e).ShadowRoot}let Kt=/*#__PURE__*/ new Set([`inline`,`contents`]);function qt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Kt.has(i)}let Jt=/*#__PURE__*/ new Set([`table`,`td`,`th`]);function Yt(e){return Jt.has(Ut(e))}let Xt=[`:popover-open`,`:modal`];function Zt(e){return Xt.some(t=>{try{return e.matches(t)}catch{return!1}})}let Qt=[`transform`,`translate`,`scale`,`rotate`,`perspective`],$t=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],en=[`paint`,`layout`,`strict`,`content`];function tn(e){let t=rn(),n=q(e)?Y(e):e;return Qt.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||$t.some(e=>(n.willChange||``).includes(e))||en.some(e=>(n.contain||``).includes(e))}function nn(e){let t=X(e);for(;J(t)&&!on(t);){if(tn(t))return t;if(Zt(t))return null;t=X(t)}return null}function rn(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}let an=/*#__PURE__*/ new Set([`html`,`body`,`#document`]);function on(e){return an.has(Ut(e))}function Y(e){return G(e).getComputedStyle(e)}function sn(e){return q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function X(e){if(Ut(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Gt(e)&&e.host||K(e);return Gt(t)?t.host:t}function cn(e){let t=X(e);return on(t)?e.ownerDocument?e.ownerDocument.body:e.body:J(t)&&qt(t)?t:cn(t)}function ln(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=cn(e),i=r===e.ownerDocument?.body,a=G(r);if(i){let e=un(a);return t.concat(a,a.visualViewport||[],qt(r)?r:[],e&&n?ln(e):[])}return t.concat(r,ln(r,[],n))}function un(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dn(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=J(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ut(n)!==a||ut(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fn(e){return q(e)?e:e.contextElement}function pn(e){let t=fn(e);if(!J(t))return H(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dn(t),o=(a?ut(n.width):n.width)/r,s=(a?ut(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let mn=/*#__PURE__*/ H(0);function hn(e){let t=G(e);return!rn()||!t.visualViewport?mn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==G(e)?!1:t}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fn(e),o=H(1);t&&(r?q(r)&&(o=pn(r)):o=pn(e));let s=gn(a,n,r)?hn(a):H(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=G(a),t=r&&q(r)?G(r):r,n=e,i=un(n);for(;i&&r&&t!==n;){let e=pn(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=G(i),i=un(n)}}return Nt({width:u,height:d,x:c,y:l})}function _n(e,t){let n=sn(e).scrollLeft;return t?t.left+n:Z(K(e)).left+n}function vn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-_n(e,n),y:n.top+t.scrollTop}}function yn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=K(r),s=t?Zt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=H(1),u=H(0),d=J(r);if((d||!d&&!a)&&((Ut(r)!==`body`||qt(o))&&(c=sn(r)),J(r))){let e=Z(r);l=pn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?vn(o,c):H(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function bn(e){return Array.from(e.getClientRects())}function xn(e){let t=K(e),n=sn(e),r=e.ownerDocument.body,i=V(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=V(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+_n(e),s=-n.scrollTop;return Y(r).direction===`rtl`&&(o+=V(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Sn(e,t){let n=G(e),r=K(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=rn();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=_n(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}let Cn=/*#__PURE__*/ new Set([`absolute`,`fixed`]);function wn(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=J(e)?pn(e):H(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Tn(e,t,n){let r;if(t===`viewport`)r=Sn(e,n);else if(t===`document`)r=xn(K(e));else if(q(t))r=wn(t,n);else{let n=hn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Nt(r)}function En(e,t){let n=X(e);return n===t||!q(n)||on(n)?!1:Y(n).position===`fixed`||En(n,t)}function Dn(e,t){let n=t.get(e);if(n)return n;let r=ln(e,[],!1).filter(e=>q(e)&&Ut(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?X(e):e;for(;q(o)&&!on(o);){let t=Y(o),n=tn(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Cn.has(i.position)||qt(o)&&!n&&En(e,o))?r=r.filter(e=>e!==o):i=t,o=X(o)}return t.set(e,r),r}function On(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Zt(t)?[]:Dn(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Tn(t,n,i);return e.top=V(r.top,e.top),e.right=lt(r.right,e.right),e.bottom=lt(r.bottom,e.bottom),e.left=V(r.left,e.left),e},Tn(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function kn(e){let{width:t,height:n}=dn(e);return{width:t,height:n}}function An(e,t,n){let r=J(t),i=K(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=H(0);function l(){c.x=_n(i)}if(r||!r&&!a){if((Ut(t)!==`body`||qt(i))&&(s=sn(t)),r){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l()}a&&!r&&i&&l();let u=i&&!r&&!a?vn(i,s):H(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function jn(e){return Y(e).position===`static`}function Mn(e,t){if(!J(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function Nn(e,t){let n=G(e);if(Zt(e))return n;if(!J(e)){let t=X(e);for(;t&&!on(t);){if(q(t)&&!jn(t))return t;t=X(t)}return n}let r=Mn(e,t);for(;r&&Yt(r)&&jn(r);)r=Mn(r,t);return r&&on(r)&&jn(r)&&!tn(r)?n:r||nn(e)||n}let Pn=async function(e){let t=this.getOffsetParent||Nn,n=this.getDimensions,r=await n(e.floating);return{reference:An(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Fn(e){return Y(e).direction===`rtl`}let In={convertOffsetParentRelativeRectToViewportRelativeRect:yn,getDocumentElement:K,getClippingRect:On,getOffsetParent:Nn,getElementRects:Pn,getClientRects:bn,getDimensions:kn,getScale:pn,isElement:q,isRTL:Fn};function Ln(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rn(e,t){let n=null,r,i=K(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=dt(d),h=dt(i.clientWidth-(u+f)),g=dt(i.clientHeight-(d+p)),_=dt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:V(0,lt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Ln(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function zn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=fn(e),u=i||a?[...l?ln(l):[],...ln(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Rn(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!Ln(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Bn=Bt,Vn=Vt,Hn=Lt,Un=(e,t,n)=>{let r=/* @__PURE__ */ new Map,i={platform:In,...n},a={...i.platform,_c:r};return Ft(e,t,{...i,platform:a})};function Wn(e=``,t=``){return`id-${Math.random().toString().substring(2,6)}-sgds-${e}-${t}`}function Gn(e,t,n){return new Promise(r=>{if(n?.duration===1/0)throw Error(`Promise-based animations must be finite.`);let i=e.animate(t,{...n,duration:Kn()?0:n?.duration});i.addEventListener(`cancel`,r,{once:!0}),i.addEventListener(`finish`,r,{once:!0})})}function Kn(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}let qn=/* @__PURE__ */ new Map,Jn=/* @__PURE__ */ new WeakMap;function Yn(e){return e??{keyframes:[],options:{duration:0}}}function Xn(e){return e}function Zn(e,t){let n=Jn.get(e);if(n?.[t])return Xn(n[t]);let r=qn.get(t);return r?Xn(r):{keyframes:[],options:{duration:0}}}function Qn(e,t){qn.set(e,Yn(t))}var Q=class extends B{constructor(...e){super(...e),this.myDropdown=at(),this.dropdownMenuId=Wn(`dropdown-menu`,`div`),this.noFlip=!1,this.menuAlignRight=!1,this.drop=`down`,this.floatingOpts={},this.menuIsOpen=!1,this.close=`default`,this.disabled=!1,this.readonly=!1,this.menuRef=at(),this._handleClickOutOfElement=e=>{this.menuIsOpen&&(e.composedPath().includes(this)||this.hideMenu(!0))}}connectedCallback(){super.connectedCallback(),this.close!==`inside`&&document.addEventListener(`click`,this._handleClickOutOfElement),this.addEventListener(`keydown`,this._handleKeyboardMenuEvent)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`click`,this._handleClickOutOfElement),this.removeEventListener(`keydown`,this._handleKeyboardMenuEvent),this._cleanupAutoUpdate&&=(this._cleanupAutoUpdate(),void 0)}firstUpdated(e){super.firstUpdated(e),this.menuIsOpen&&requestAnimationFrame(async()=>{await this.updateFloatingPosition(),this._startAutoUpdate()})}async showMenu(){if(!(this.disabled||this.menuIsOpen)){if(this.menuIsOpen=!0,this.emit(`sgds-show`),await this.updateFloatingPosition(),this._startAutoUpdate(),this.menuRef.value){let e=(this.menuRef.value.getAttribute(`data-placement`)||``).startsWith(`top`)?`4px`:`-4px`,{options:t}=Zn(this,`dropdown.show`);await Gn(this.menuRef.value,[{opacity:0,transform:`translateY(${e})`},{opacity:1,transform:`translateY(0)`}],t)}this.emit(`sgds-after-show`)}}_startAutoUpdate(){this.myDropdown.value&&this.menuRef.value&&(this._cleanupAutoUpdate=zn(this.myDropdown.value,this.menuRef.value,()=>this.updateFloatingPosition()))}async hideMenu(e){if(this.menuIsOpen){if(this.emit(`sgds-hide`,{detail:{isOutside:e}}),this.menuRef.value){let e=(this.menuRef.value.getAttribute(`data-placement`)||``).startsWith(`top`)?`4px`:`-4px`,{options:t}=Zn(this,`dropdown.hide`);await Gn(this.menuRef.value,[{opacity:1,transform:`translateY(0)`},{opacity:0,transform:`translateY(${e})`}],t)}this.menuIsOpen=!1,this.emit(`sgds-after-hide`),this._cleanupAutoUpdate&&=(this._cleanupAutoUpdate(),void 0)}}toggleMenu(){this.menuIsOpen?this.hideMenu():this.showMenu()}_handleKeyboardMenuEvent(e){if(!this.readonly)switch(e.key){case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this.menuIsOpen||this.showMenu();break;case`Escape`:this.hideMenu()}}mergeMiddleware(e,t){let n=e=>e?.name||e?.constructor?.name,r=t.map(n);return e.map(e=>{let i=n(e),a=r.indexOf(i);return a===-1?e:t[a]}).concat(t.filter(t=>!e.some(e=>n(e)===n(t))))}async updateFloatingPosition(){if(!this.myDropdown.value||!this.menuRef.value)return;let e=`bottom-start`;switch(this.drop){case`up`:e=this.menuAlignRight?`top-end`:`top-start`;break;case`right`:e=`right-start`;break;case`left`:e=`left-start`;break;case`down`:e=this.menuAlignRight?`bottom-end`:`bottom-start`;break;default:e=`bottom-start`}let t=[Bn(8),this.noFlip?void 0:Hn(),Vn()].filter(Boolean),n=t;Array.isArray(this.floatingOpts.middleware)&&this.floatingOpts.middleware.length>0&&(n=this.mergeMiddleware(t,this.floatingOpts.middleware.filter(Boolean)));let r={strategy:`fixed`,placement:e,...this.floatingOpts,middleware:n},{x:i,y:a,strategy:o,placement:s}=await Un(this.myDropdown.value,this.menuRef.value,r);this.menuRef.value.setAttribute(`data-placement`,s),Object.assign(this.menuRef.value.style,{position:o,left:`${i}px`,top:`${a}px`})}};z([R({type:Boolean,state:!0})],Q.prototype,`noFlip`,void 0),z([R({type:Boolean,reflect:!0,state:!0})],Q.prototype,`menuAlignRight`,void 0),z([R({type:String,reflect:!0,state:!0})],Q.prototype,`drop`,void 0),z([R({type:Object})],Q.prototype,`floatingOpts`,void 0),z([R({type:Boolean,reflect:!0})],Q.prototype,`menuIsOpen`,void 0),z([R({type:Boolean,reflect:!0})],Q.prototype,`disabled`,void 0),z([R({type:Boolean,reflect:!0})],Q.prototype,`readonly`,void 0),Qn(`dropdown.show`,{keyframes:[],options:{duration:200,easing:`cubic-bezier(0.1, 0, 0.5, 0)`}}),Qn(`dropdown.hide`,{keyframes:[],options:{duration:200,easing:`cubic-bezier(0.15, 0.6, 0.6, 1)`}});var $n=class extends Q{constructor(...e){super(...e),this.nextDropdownItemNo=0,this.prevDropdownItemNo=-1,this.hidden=!1}static{this.styles=Q.styles}connectedCallback(){super.connectedCallback(),this.addEventListener(`sgds-hide`,this._resetMenu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`sgds-hide`,this._resetMenu)}firstUpdated(e){super.firstUpdated(e),this.addEventListener(`keydown`,this._handleKeyboardMenuItemsEvent)}handleSelectSlot(e){let t=this._getActiveMenuItems(),n=t.find(t=>e.composedPath().includes(t));if(!n)return;let r=t.indexOf(n);this.nextDropdownItemNo=r+1,this.prevDropdownItemNo=r<=0?t.length-1:r-1,n.disabled||(this.emit(`sgds-select`,{detail:{item:n}}),this.close!==`outside`&&this.hideMenu())}_resetMenu(){this.nextDropdownItemNo=0,this.prevDropdownItemNo=-1,this._getMenuItems().forEach(e=>{let t=e?.shadowRoot?.querySelector(`.dropdown-item`);t&&t.removeAttribute(`tabindex`)})}_handleKeyboardMenuItemsEvent(e){if(this.readonly)return;let t=this._getActiveMenuItems();if(t.length!==0)switch(e.key){case`ArrowDown`:e.preventDefault(),this._setMenuItem(this.nextDropdownItemNo);break;case`ArrowUp`:e.preventDefault(),this._setMenuItem(this.prevDropdownItemNo);break;case`Tab`:if(!this.menuIsOpen)return;e.preventDefault(),e.shiftKey?this._setMenuItem(this.prevDropdownItemNo):this._setMenuItem(this.nextDropdownItemNo);break;case`Escape`:this.menuIsOpen&&(e.preventDefault(),this.hideMenu());break;case`Enter`:t.find(t=>e.composedPath().includes(t))&&this.handleSelectSlot(e)}}_getMenuItems(){return this.shadowRoot.querySelector(`slot#default`)?this.shadowRoot.querySelector(`slot#default`)?.assignedElements({flatten:!0}).filter(e=>e.getAttribute(`role`)===`menuitem`&&!e.classList.contains(`empty-menu`)&&!e.hasAttribute(`hidden`)):this.menu?.hasChildNodes()?[...Array.from(this.menu.children)]:[]}_getActiveMenuItems(){return this._getMenuItems().filter(e=>!e.disabled&&!e.hidden&&!e.readonly)}_setMenuItem(e){let t=this._getActiveMenuItems();if(t.length===0)return;let n=(e%t.length+t.length)%t.length,r=t[n];this.emit(`i-sgds-option-focus`,{detail:{option:r}}),this.nextDropdownItemNo=(n+1)%t.length,this.prevDropdownItemNo=(n-1+t.length)%t.length,t.forEach(e=>{let t=e.shadowRoot.querySelector(`.dropdown-item`);t.setAttribute(`tabindex`,e===r?`0`:`-1`),e===r&&t.focus()})}};z([We(`ul.dropdown-menu`)],$n.prototype,`menu`,void 0),z([He()],$n.prototype,`nextDropdownItemNo`,void 0),z([He()],$n.prototype,`prevDropdownItemNo`,void 0),z([R({type:Boolean,reflect:!0})],$n.prototype,`hidden`,void 0);function er(e,t){let n={waitUntilFirstUpdate:!1,...t};return(t,r)=>{let{update:i}=t;if(e in t){let a=e;t.update=function(e){if(e.has(a)){let t=e.get(a),i=this[a];t!==i&&(!n.waitUntilFirstUpdate||this.hasUpdated)&&this[r](t,i)}i.call(this,e)}}}}L();var tr=l`:host([menuisopen]:not([disabled]):not([readonly])) .dropdown-menu{display:block}.dropdown-menu{background-clip:padding-box;background-color:var(--sgds-surface-default);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 1px 0 hsla(0,0%,5%,.12),0 4px 8px 0 hsla(0,0%,5%,.12);color:var(--sgds-color-default);display:none;list-style:none;margin:0;max-height:var(--sgds-dimension-480);min-width:var(--sgds-dimension-192);overflow-y:auto;padding:var(--sgds-padding-xs) 0;position:absolute;text-align:left;z-index:var(--sgds-z-index-floating)}.nav-tabs .dropdown-menu{border-top-left-radius:0;border-top-right-radius:0;margin-top:calc(var(--sgds-nav-tabs-border-width)*-1)}@media (min-width:512px){.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:768px){.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1024px){.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1280px){.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1440px){.navbar-expand-xxl .navbar-nav .dropdown-menu{position:absolute}}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.sgds.navbar .dropdown-menu.megamenu{left:0;right:0;width:100%}.sgds.combobox>.dropdown-menu{min-width:100%}`;L();var nr=l`.dropdown{display:flex;height:inherit;position:relative}.dropdown-menu{max-width:var(--sgds-dimension-320)}.toggler-container{flex:1;pointer-events:none}.toggler-container ::slotted(*){pointer-events:auto}`;L();var $=class extends $n{static{this.styles=[...$n.styles,nr,tr]}constructor(){super(),this.noFlip=!1,this.menuAlignRight=!1,this.drop=`down`,this.close=`default`,this.menuRef=ct()}async _handleClick(e){if(this.disabled)return;let t=this._toggler[0];if(!t){this.toggleMenu();return}if(e.composedPath().includes(t)){this.toggleMenu();return}if(!this.menuIsOpen)return;let n=this.menuRef.value;n&&e.composedPath().includes(n)||this.hideMenu()}_handleCloseMenu(){this._toggler[0]?.focus()}async connectedCallback(){super.connectedCallback(),this.addEventListener(`sgds-hide`,this._handleCloseMenu)}async disconnectedCallback(){this.removeEventListener(`sgds-hide`,this._handleCloseMenu)}async firstUpdated(e){super.firstUpdated(e),this.menuIsOpen&&await this.updateFloatingPosition(),this._handleDisabled()}_handleTogglerSlotChange(e){let t=e.target.assignedElements({flatten:!0})[0];t&&(t.setAttribute(`aria-haspopup`,`menu`),t.setAttribute(`aria-expanded`,String(this.menuIsOpen)))}_handleMenuIsOpenChange(){let e=this._toggler[0];e&&e.setAttribute(`aria-expanded`,String(this.menuIsOpen))}_handleDisabled(){let e=this._toggler[0];e&&(this.disabled?e.setAttribute(`disabled`,`true`):e.hasAttribute(`disabled`)&&e.removeAttribute(`disabled`))}render(){return A`
|
|
79
|
+
*/let at=()=>new ot;var ot=class{};let st=/* @__PURE__ */ new WeakMap,ct=Xe(class extends it{render(e){return M}update(e,[t]){let n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),M}rt(e){if(this.isConnected||(e=void 0),typeof this.G==`function`){let t=this.ht??globalThis,n=st.get(t);n===void 0&&(n=/* @__PURE__ */ new WeakMap,st.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G==`function`?st.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),lt=Math.min,V=Math.max,ut=Math.round,dt=Math.floor,H=e=>({x:e,y:e}),ft={left:`right`,right:`left`,bottom:`top`,top:`bottom`},pt={start:`end`,end:`start`};function mt(e,t,n){return V(e,lt(t,n))}function ht(e,t){return typeof e==`function`?e(t):e}function U(e){return e.split(`-`)[0]}function gt(e){return e.split(`-`)[1]}function _t(e){return e===`x`?`y`:`x`}function vt(e){return e===`y`?`height`:`width`}let yt=/*#__PURE__*/ new Set([`top`,`bottom`]);function W(e){return yt.has(U(e))?`y`:`x`}function bt(e){return _t(W(e))}function xt(e,t,n){n===void 0&&(n=!1);let r=gt(e),i=bt(e),a=vt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=At(o)),[o,At(o)]}function St(e){let t=At(e);return[Ct(e),t,Ct(t)]}function Ct(e){return e.replace(/start|end/g,e=>pt[e])}let wt=[`left`,`right`],Tt=[`right`,`left`],Et=[`top`,`bottom`],Dt=[`bottom`,`top`];function Ot(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Tt:wt:t?wt:Tt;case`left`:case`right`:return t?Et:Dt;default:return[]}}function kt(e,t,n,r){let i=gt(e),a=Ot(U(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ct)))),a}function At(e){return e.replace(/left|right|bottom|top/g,e=>ft[e])}function jt(e){return{top:0,right:0,bottom:0,left:0,...e}}function Mt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:jt(e)}function Nt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Pt(e,t,n){let{reference:r,floating:i}=e,a=W(t),o=bt(t),s=vt(o),c=U(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(gt(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1)}return p}let Ft=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Pt(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Pt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function It(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ht(t,e),p=Mt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Nt(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Nt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}let Lt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ht(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=U(r),_=W(o),v=U(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[At(o)]:St(o)),ee=p!==`none`;!d&&ee&&b.push(...kt(o,m,p,y));let te=[o,...b],x=await It(t,h),S=[],C=i.flip?.overflows||[];if(l&&S.push(x[g]),u){let e=xt(r,a,y);S.push(x[e[0]],x[e[1]])}if(C=[...C,{placement:r,overflows:S}],!S.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=te[e];if(t&&(u!==`alignment`||_===W(t)||C.every(e=>W(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let n=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=C.filter(e=>{if(ee){let t=W(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},Rt=/*#__PURE__*/ new Set([`left`,`top`]);async function zt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=U(n),s=gt(n),c=W(n)===`y`,l=Rt.has(o)?-1:1,u=a&&c?-1:1,d=ht(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}let Bt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await zt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Vt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=ht(e,t),l={x:n,y:r},u=await It(t,c),d=W(U(i)),f=_t(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=mt(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=mt(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}};function Ht(){return typeof window<`u`}function Ut(e){return Wt(e)?(e.nodeName||``).toLowerCase():`#document`}function G(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function K(e){return((Wt(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Wt(e){return Ht()?e instanceof Node||e instanceof G(e).Node:!1}function q(e){return Ht()?e instanceof Element||e instanceof G(e).Element:!1}function J(e){return Ht()?e instanceof HTMLElement||e instanceof G(e).HTMLElement:!1}function Gt(e){return!Ht()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof G(e).ShadowRoot}let Kt=/*#__PURE__*/ new Set([`inline`,`contents`]);function qt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Kt.has(i)}let Jt=/*#__PURE__*/ new Set([`table`,`td`,`th`]);function Yt(e){return Jt.has(Ut(e))}let Xt=[`:popover-open`,`:modal`];function Zt(e){return Xt.some(t=>{try{return e.matches(t)}catch{return!1}})}let Qt=[`transform`,`translate`,`scale`,`rotate`,`perspective`],$t=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],en=[`paint`,`layout`,`strict`,`content`];function tn(e){let t=rn(),n=q(e)?Y(e):e;return Qt.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||$t.some(e=>(n.willChange||``).includes(e))||en.some(e=>(n.contain||``).includes(e))}function nn(e){let t=X(e);for(;J(t)&&!on(t);){if(tn(t))return t;if(Zt(t))return null;t=X(t)}return null}function rn(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}let an=/*#__PURE__*/ new Set([`html`,`body`,`#document`]);function on(e){return an.has(Ut(e))}function Y(e){return G(e).getComputedStyle(e)}function sn(e){return q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function X(e){if(Ut(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Gt(e)&&e.host||K(e);return Gt(t)?t.host:t}function cn(e){let t=X(e);return on(t)?e.ownerDocument?e.ownerDocument.body:e.body:J(t)&&qt(t)?t:cn(t)}function ln(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=cn(e),i=r===e.ownerDocument?.body,a=G(r);if(i){let e=un(a);return t.concat(a,a.visualViewport||[],qt(r)?r:[],e&&n?ln(e):[])}return t.concat(r,ln(r,[],n))}function un(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dn(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=J(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ut(n)!==a||ut(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fn(e){return q(e)?e:e.contextElement}function pn(e){let t=fn(e);if(!J(t))return H(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dn(t),o=(a?ut(n.width):n.width)/r,s=(a?ut(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let mn=/*#__PURE__*/ H(0);function hn(e){let t=G(e);return!rn()||!t.visualViewport?mn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==G(e)?!1:t}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fn(e),o=H(1);t&&(r?q(r)&&(o=pn(r)):o=pn(e));let s=gn(a,n,r)?hn(a):H(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=G(a),t=r&&q(r)?G(r):r,n=e,i=un(n);for(;i&&r&&t!==n;){let e=pn(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=G(i),i=un(n)}}return Nt({width:u,height:d,x:c,y:l})}function _n(e,t){let n=sn(e).scrollLeft;return t?t.left+n:Z(K(e)).left+n}function vn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-_n(e,n),y:n.top+t.scrollTop}}function yn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=K(r),s=t?Zt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=H(1),u=H(0),d=J(r);if((d||!d&&!a)&&((Ut(r)!==`body`||qt(o))&&(c=sn(r)),J(r))){let e=Z(r);l=pn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?vn(o,c):H(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function bn(e){return Array.from(e.getClientRects())}function xn(e){let t=K(e),n=sn(e),r=e.ownerDocument.body,i=V(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=V(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+_n(e),s=-n.scrollTop;return Y(r).direction===`rtl`&&(o+=V(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Sn(e,t){let n=G(e),r=K(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=rn();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=_n(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}let Cn=/*#__PURE__*/ new Set([`absolute`,`fixed`]);function wn(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=J(e)?pn(e):H(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Tn(e,t,n){let r;if(t===`viewport`)r=Sn(e,n);else if(t===`document`)r=xn(K(e));else if(q(t))r=wn(t,n);else{let n=hn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Nt(r)}function En(e,t){let n=X(e);return n===t||!q(n)||on(n)?!1:Y(n).position===`fixed`||En(n,t)}function Dn(e,t){let n=t.get(e);if(n)return n;let r=ln(e,[],!1).filter(e=>q(e)&&Ut(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?X(e):e;for(;q(o)&&!on(o);){let t=Y(o),n=tn(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Cn.has(i.position)||qt(o)&&!n&&En(e,o))?r=r.filter(e=>e!==o):i=t,o=X(o)}return t.set(e,r),r}function On(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Zt(t)?[]:Dn(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Tn(t,n,i);return e.top=V(r.top,e.top),e.right=lt(r.right,e.right),e.bottom=lt(r.bottom,e.bottom),e.left=V(r.left,e.left),e},Tn(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function kn(e){let{width:t,height:n}=dn(e);return{width:t,height:n}}function An(e,t,n){let r=J(t),i=K(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=H(0);function l(){c.x=_n(i)}if(r||!r&&!a){if((Ut(t)!==`body`||qt(i))&&(s=sn(t)),r){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l()}a&&!r&&i&&l();let u=i&&!r&&!a?vn(i,s):H(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function jn(e){return Y(e).position===`static`}function Mn(e,t){if(!J(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function Nn(e,t){let n=G(e);if(Zt(e))return n;if(!J(e)){let t=X(e);for(;t&&!on(t);){if(q(t)&&!jn(t))return t;t=X(t)}return n}let r=Mn(e,t);for(;r&&Yt(r)&&jn(r);)r=Mn(r,t);return r&&on(r)&&jn(r)&&!tn(r)?n:r||nn(e)||n}let Pn=async function(e){let t=this.getOffsetParent||Nn,n=this.getDimensions,r=await n(e.floating);return{reference:An(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Fn(e){return Y(e).direction===`rtl`}let In={convertOffsetParentRelativeRectToViewportRelativeRect:yn,getDocumentElement:K,getClippingRect:On,getOffsetParent:Nn,getElementRects:Pn,getClientRects:bn,getDimensions:kn,getScale:pn,isElement:q,isRTL:Fn};function Ln(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rn(e,t){let n=null,r,i=K(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=dt(d),h=dt(i.clientWidth-(u+f)),g=dt(i.clientHeight-(d+p)),_=dt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:V(0,lt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Ln(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function zn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=fn(e),u=i||a?[...l?ln(l):[],...ln(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Rn(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!Ln(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Bn=Bt,Vn=Vt,Hn=Lt,Un=(e,t,n)=>{let r=/* @__PURE__ */ new Map,i={platform:In,...n},a={...i.platform,_c:r};return Ft(e,t,{...i,platform:a})};function Wn(e=``,t=``){return`id-${Math.random().toString().substring(2,6)}-sgds-${e}-${t}`}function Gn(e,t,n){return new Promise(r=>{if(n?.duration===1/0)throw Error(`Promise-based animations must be finite.`);let i=e.animate(t,{...n,duration:Kn()?0:n?.duration});i.addEventListener(`cancel`,r,{once:!0}),i.addEventListener(`finish`,r,{once:!0})})}function Kn(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}let qn=/* @__PURE__ */ new Map,Jn=/* @__PURE__ */ new WeakMap;function Yn(e){return e??{keyframes:[],options:{duration:0}}}function Xn(e){return e}function Zn(e,t){let n=Jn.get(e);if(n?.[t])return Xn(n[t]);let r=qn.get(t);return r?Xn(r):{keyframes:[],options:{duration:0}}}function Qn(e,t){qn.set(e,Yn(t))}var Q=class extends B{constructor(...e){super(...e),this.myDropdown=at(),this.dropdownMenuId=Wn(`dropdown-menu`,`div`),this.noFlip=!1,this.menuAlignRight=!1,this.drop=`down`,this.floatingOpts={},this.menuIsOpen=!1,this.close=`default`,this.disabled=!1,this.readonly=!1,this.menuRef=at(),this._handleClickOutOfElement=e=>{this.menuIsOpen&&(e.composedPath().includes(this)||this.hideMenu(!0))}}connectedCallback(){super.connectedCallback(),this.close!==`inside`&&document.addEventListener(`click`,this._handleClickOutOfElement),this.addEventListener(`keydown`,this._handleKeyboardMenuEvent)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`click`,this._handleClickOutOfElement),this.removeEventListener(`keydown`,this._handleKeyboardMenuEvent),this._cleanupAutoUpdate&&=(this._cleanupAutoUpdate(),void 0)}firstUpdated(e){super.firstUpdated(e),this.menuIsOpen&&requestAnimationFrame(async()=>{await this.updateFloatingPosition(),this._startAutoUpdate()})}async showMenu(){if(!(this.disabled||this.menuIsOpen)){if(this.menuIsOpen=!0,this.emit(`sgds-show`),await this.updateFloatingPosition(),this._startAutoUpdate(),this.menuRef.value){let e=(this.menuRef.value.getAttribute(`data-placement`)||``).startsWith(`top`)?`4px`:`-4px`,{options:t}=Zn(this,`dropdown.show`);await Gn(this.menuRef.value,[{opacity:0,transform:`translateY(${e})`},{opacity:1,transform:`translateY(0)`}],t)}this.emit(`sgds-after-show`)}}_startAutoUpdate(){this.myDropdown.value&&this.menuRef.value&&(this._cleanupAutoUpdate=zn(this.myDropdown.value,this.menuRef.value,()=>this.updateFloatingPosition()))}async hideMenu(e){if(this.menuIsOpen){if(this.emit(`sgds-hide`,{detail:{isOutside:e}}),this.menuRef.value){let e=(this.menuRef.value.getAttribute(`data-placement`)||``).startsWith(`top`)?`4px`:`-4px`,{options:t}=Zn(this,`dropdown.hide`);await Gn(this.menuRef.value,[{opacity:1,transform:`translateY(0)`},{opacity:0,transform:`translateY(${e})`}],t)}this.menuIsOpen=!1,this.emit(`sgds-after-hide`),this._cleanupAutoUpdate&&=(this._cleanupAutoUpdate(),void 0)}}toggleMenu(){this.menuIsOpen?this.hideMenu():this.showMenu()}_handleKeyboardMenuEvent(e){if(!this.readonly)switch(e.key){case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this.menuIsOpen||this.showMenu();break;case`Escape`:this.hideMenu()}}mergeMiddleware(e,t){let n=e=>e?.name||e?.constructor?.name,r=t.map(n);return e.map(e=>{let i=n(e),a=r.indexOf(i);return a===-1?e:t[a]}).concat(t.filter(t=>!e.some(e=>n(e)===n(t))))}async updateFloatingPosition(){if(!this.myDropdown.value||!this.menuRef.value)return;let e=`bottom-start`;switch(this.drop){case`up`:e=this.menuAlignRight?`top-end`:`top-start`;break;case`right`:e=`right-start`;break;case`left`:e=`left-start`;break;case`down`:e=this.menuAlignRight?`bottom-end`:`bottom-start`;break;default:e=`bottom-start`}let t=[Bn(8),this.noFlip?void 0:Hn(),Vn()].filter(Boolean),n=t;Array.isArray(this.floatingOpts.middleware)&&this.floatingOpts.middleware.length>0&&(n=this.mergeMiddleware(t,this.floatingOpts.middleware.filter(Boolean)));let r={strategy:`fixed`,placement:e,...this.floatingOpts,middleware:n},{x:i,y:a,strategy:o,placement:s}=await Un(this.myDropdown.value,this.menuRef.value,r);this.menuRef.value.setAttribute(`data-placement`,s),Object.assign(this.menuRef.value.style,{position:o,left:`${i}px`,top:`${a}px`})}};z([R({type:Boolean,state:!0})],Q.prototype,`noFlip`,void 0),z([R({type:Boolean,reflect:!0,state:!0})],Q.prototype,`menuAlignRight`,void 0),z([R({type:String,reflect:!0,state:!0})],Q.prototype,`drop`,void 0),z([R({type:Object})],Q.prototype,`floatingOpts`,void 0),z([R({type:Boolean,reflect:!0})],Q.prototype,`menuIsOpen`,void 0),z([R({type:Boolean,reflect:!0})],Q.prototype,`disabled`,void 0),z([R({type:Boolean,reflect:!0})],Q.prototype,`readonly`,void 0),Qn(`dropdown.show`,{keyframes:[],options:{duration:200,easing:`cubic-bezier(0.1, 0, 0.5, 0)`}}),Qn(`dropdown.hide`,{keyframes:[],options:{duration:200,easing:`cubic-bezier(0.15, 0.6, 0.6, 1)`}});var $n=class extends Q{constructor(...e){super(...e),this.nextDropdownItemNo=0,this.prevDropdownItemNo=-1,this.hidden=!1}static{this.styles=Q.styles}connectedCallback(){super.connectedCallback(),this.addEventListener(`sgds-hide`,this._resetMenu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`sgds-hide`,this._resetMenu)}firstUpdated(e){super.firstUpdated(e),this.addEventListener(`keydown`,this._handleKeyboardMenuItemsEvent)}handleSelectSlot(e){let t=this._getActiveMenuItems(),n=t.find(t=>e.composedPath().includes(t));if(!n)return;let r=t.indexOf(n);this.nextDropdownItemNo=r+1,this.prevDropdownItemNo=r<=0?t.length-1:r-1,n.disabled||(this.emit(`sgds-select`,{detail:{item:n}}),this.close!==`outside`&&this.hideMenu())}_resetMenu(){this.nextDropdownItemNo=0,this.prevDropdownItemNo=-1,this._getMenuItems().forEach(e=>{let t=e?.shadowRoot?.querySelector(`.dropdown-item`);t&&t.removeAttribute(`tabindex`)})}_handleKeyboardMenuItemsEvent(e){if(this.readonly)return;let t=this._getActiveMenuItems();if(t.length!==0)switch(e.key){case`ArrowDown`:e.preventDefault(),this._setMenuItem(this.nextDropdownItemNo);break;case`ArrowUp`:e.preventDefault(),this._setMenuItem(this.prevDropdownItemNo);break;case`Tab`:if(!this.menuIsOpen)return;e.preventDefault(),e.shiftKey?this._setMenuItem(this.prevDropdownItemNo):this._setMenuItem(this.nextDropdownItemNo);break;case`Escape`:this.menuIsOpen&&(e.preventDefault(),this.hideMenu());break;case`Enter`:t.find(t=>e.composedPath().includes(t))&&this.handleSelectSlot(e)}}_getMenuItems(){return this.shadowRoot.querySelector(`slot#default`)?this.shadowRoot.querySelector(`slot#default`)?.assignedElements({flatten:!0}).filter(e=>e.getAttribute(`role`)===`menuitem`&&!e.classList.contains(`empty-menu`)&&!e.hasAttribute(`hidden`)):this.menu?.hasChildNodes()?[...Array.from(this.menu.children)]:[]}_getActiveMenuItems(){return this._getMenuItems().filter(e=>!e.disabled&&!e.hidden&&!e.readonly)}_setMenuItem(e){let t=this._getActiveMenuItems();if(t.length===0)return;let n=(e%t.length+t.length)%t.length,r=t[n];this.emit(`i-sgds-option-focus`,{detail:{option:r}}),this.nextDropdownItemNo=(n+1)%t.length,this.prevDropdownItemNo=(n-1+t.length)%t.length,t.forEach(e=>{let t=e.shadowRoot.querySelector(`.dropdown-item`);t.setAttribute(`tabindex`,e===r?`0`:`-1`),e===r&&t.focus()})}};z([We(`ul.dropdown-menu`)],$n.prototype,`menu`,void 0),z([He()],$n.prototype,`nextDropdownItemNo`,void 0),z([He()],$n.prototype,`prevDropdownItemNo`,void 0),z([R({type:Boolean,reflect:!0})],$n.prototype,`hidden`,void 0);function er(e,t){let n={waitUntilFirstUpdate:!1,...t};return(t,r)=>{let{update:i}=t;if(e in t){let a=e;t.update=function(e){if(e.has(a)){let t=e.get(a),i=this[a];t!==i&&(!n.waitUntilFirstUpdate||this.hasUpdated)&&this[r](t,i)}i.call(this,e)}}}}L();var tr=l`:host([menuisopen]:not([disabled]):not([readonly])) .dropdown-menu{display:block}.dropdown-menu{background-clip:padding-box;background-color:var(--sgds-surface-default);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 1px 0 hsla(0,0%,5%,.12),0 4px 8px 0 hsla(0,0%,5%,.12);color:var(--sgds-color-default);display:none;list-style:none;margin:0;max-height:var(--sgds-dimension-480);min-width:var(--sgds-dimension-192);overflow-y:auto;padding:var(--sgds-padding-xs) 0;position:absolute;text-align:left;z-index:var(--sgds-z-index-floating)}.nav-tabs .dropdown-menu{border-top-left-radius:0;border-top-right-radius:0;margin-top:calc(var(--sgds-nav-tabs-border-width)*-1)}@media (min-width:512px){.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:768px){.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1024px){.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1280px){.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1440px){.navbar-expand-xxl .navbar-nav .dropdown-menu{position:absolute}}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.sgds.navbar .dropdown-menu.megamenu{left:0;right:0;width:100%}.sgds.combobox>.dropdown-menu{min-width:100%}`;L();var nr=l`.dropdown{display:flex;height:inherit;position:relative}.dropdown-menu{max-width:var(--sgds-dimension-320)}.toggler-container{flex:1;pointer-events:none}.toggler-container ::slotted(*){pointer-events:auto}`;L();var $=class extends $n{static{this.styles=[...$n.styles,nr,tr]}constructor(){super(),this.noFlip=!1,this.menuAlignRight=!1,this.drop=`down`,this.close=`default`,this.menuRef=ct()}async _handleClick(e){if(this.disabled)return;let t=this._toggler[0];if(!t){this.toggleMenu();return}if(e.composedPath().includes(t)){this.toggleMenu();return}if(!this.menuIsOpen)return;let n=this.menuRef.value;n&&e.composedPath().includes(n)||this.hideMenu()}_handleCloseMenu(){this._toggler[0]?.focus({preventScroll:!0})}async connectedCallback(){super.connectedCallback(),this.addEventListener(`sgds-hide`,this._handleCloseMenu)}async disconnectedCallback(){this.removeEventListener(`sgds-hide`,this._handleCloseMenu)}async firstUpdated(e){super.firstUpdated(e),this.menuIsOpen&&await this.updateFloatingPosition(),this._handleDisabled()}_handleTogglerSlotChange(e){let t=e.target.assignedElements({flatten:!0})[0];t&&(t.setAttribute(`aria-haspopup`,`menu`),t.setAttribute(`aria-expanded`,String(this.menuIsOpen)))}_handleMenuIsOpenChange(){let e=this._toggler[0];e&&e.setAttribute(`aria-expanded`,String(this.menuIsOpen))}_handleDisabled(){let e=this._toggler[0];e&&(this.disabled?e.setAttribute(`disabled`,`true`):e.hasAttribute(`disabled`)&&e.removeAttribute(`disabled`))}render(){return A`
|
|
80
80
|
<div class="dropdown" @click=${this._handleClick}>
|
|
81
81
|
<div class="toggler-container" ${ct(this.myDropdown)}>
|
|
82
82
|
<slot name="toggler" @slotchange=${this._handleTogglerSlotChange}></slot>
|