@getflip/swirl-components 0.360.0 → 0.361.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/components.json +1 -1
- package/dist/cjs/swirl-modal.cjs.entry.js +24 -19
- package/dist/collection/components/swirl-modal/swirl-modal.js +24 -19
- package/dist/components/assets/pdfjs/pdf.worker.min.mjs +28 -0
- package/dist/components/swirl-modal.js +24 -19
- package/dist/esm/swirl-modal.entry.js +24 -19
- package/dist/swirl-components/p-a6609f84.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-modal/swirl-modal.d.ts +1 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-c8e2dee8.entry.js +0 -1
|
@@ -2,6 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
|
2
2
|
import { d as disableBodyScroll, e as enableBodyScroll } from './bodyScrollLock.esm.js';
|
|
3
3
|
import { c as classNames } from './index2.js';
|
|
4
4
|
import { c as createFocusTrap } from './focus-trap.esm.js';
|
|
5
|
+
import { k as getActiveElement } from './utils.js';
|
|
5
6
|
import { d as defineCustomElement$5 } from './swirl-button2.js';
|
|
6
7
|
import { d as defineCustomElement$4 } from './swirl-button-group2.js';
|
|
7
8
|
import { d as defineCustomElement$3 } from './swirl-heading2.js';
|
|
@@ -100,17 +101,6 @@ const SwirlModal$1 = /*@__PURE__*/ proxyCustomElement(class SwirlModal extends H
|
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
103
|
componentDidLoad() {
|
|
103
|
-
this.focusTrap = createFocusTrap(this.modalEl, {
|
|
104
|
-
allowOutsideClick: true,
|
|
105
|
-
// We don't always close the modal when ESC is pressed. So we manage the
|
|
106
|
-
// deactivation of the focus trap manually.
|
|
107
|
-
escapeDeactivates: false,
|
|
108
|
-
tabbableOptions: {
|
|
109
|
-
getShadowRoot: (node) => {
|
|
110
|
-
return node.shadowRoot;
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
104
|
this.determineScrollStatus();
|
|
115
105
|
this.updateCustomFooterStatus();
|
|
116
106
|
this.updateCustomHeaderStatus();
|
|
@@ -135,6 +125,7 @@ const SwirlModal$1 = /*@__PURE__*/ proxyCustomElement(class SwirlModal extends H
|
|
|
135
125
|
async open() {
|
|
136
126
|
this.isOpen = true;
|
|
137
127
|
this.modalOpen.emit();
|
|
128
|
+
this.setupFocusTrap();
|
|
138
129
|
setTimeout(() => {
|
|
139
130
|
this.lockBodyScroll();
|
|
140
131
|
this.determineScrollStatus();
|
|
@@ -198,6 +189,20 @@ const SwirlModal$1 = /*@__PURE__*/ proxyCustomElement(class SwirlModal extends H
|
|
|
198
189
|
disableBodyScroll(this.scrollContainer);
|
|
199
190
|
disableBodyScroll(this.sidebarScrollContainer);
|
|
200
191
|
}
|
|
192
|
+
setupFocusTrap() {
|
|
193
|
+
this.focusTrap = createFocusTrap(this.modalEl, {
|
|
194
|
+
allowOutsideClick: true,
|
|
195
|
+
setReturnFocus: getActiveElement(),
|
|
196
|
+
// We don't always close the modal when ESC is pressed. So we manage the
|
|
197
|
+
// deactivation of the focus trap manually.
|
|
198
|
+
escapeDeactivates: false,
|
|
199
|
+
tabbableOptions: {
|
|
200
|
+
getShadowRoot: (node) => {
|
|
201
|
+
return node.shadowRoot;
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
}
|
|
201
206
|
unlockBodyScroll() {
|
|
202
207
|
if (this.scrollContainer) {
|
|
203
208
|
enableBodyScroll(this.scrollContainer);
|
|
@@ -233,29 +238,29 @@ const SwirlModal$1 = /*@__PURE__*/ proxyCustomElement(class SwirlModal extends H
|
|
|
233
238
|
"modal--sidebar-scrolled-down": this.sidebarScrolledDown,
|
|
234
239
|
"modal--sidebar-scrollable": this.sidebarScrollable,
|
|
235
240
|
});
|
|
236
|
-
return (h(Host, { key: '
|
|
241
|
+
return (h(Host, { key: 'c5c1e9d205414a6703f29de9cb94ca31d0b2e53e' }, h("section", { key: '147ee8b41dbb009b0c42cb0cbd47b4e4b2236ede', "aria-hidden": String(!this.isOpen), "aria-label": this.label, "aria-modal": "true", class: className, onKeyDown: this.onKeyDown, role: "dialog", ref: (el) => (this.modalEl = el) }, h("div", { key: 'c5581d8ad582064afbbeb131c1767de2665c4a0d', class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { key: '1cbd4e90ce8aea3452c1256af3869e69711ed470', class: "modal__body", style: !this.isFullscreen
|
|
237
242
|
? {
|
|
238
243
|
"--swirl-modal-max-height": this.maxHeight,
|
|
239
244
|
"--swirl-modal-height": this.height,
|
|
240
245
|
minHeight: this.minHeight,
|
|
241
246
|
maxWidth: this.maxWidth,
|
|
242
247
|
}
|
|
243
|
-
: {} }, h("aside", { key: '
|
|
248
|
+
: {} }, h("aside", { key: 'b5dc4279da991e8db9601e3a03bdb5d7d7519a3b', class: "modal__sidebar" }, this.sidebarLabel && (h("header", { key: '182b2e194d44bb34bc7208329f6c560bdc031a90', class: classNames("modal__sidebar-header", {
|
|
244
249
|
"modal__sidebar-header--has-close-button": this.hasSidebarCloseButton,
|
|
245
|
-
}) }, this.hasSidebarCloseButton && (h("swirl-button", { key: '
|
|
250
|
+
}) }, this.hasSidebarCloseButton && (h("swirl-button", { key: '3c8297ccb8edb389ccb1ba88e7ffdb2769837d72', hideLabel: true, icon: "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.sidebarCloseButtonLabel, onClick: this.onSidebarCloseButtonClick })), h("swirl-heading", { key: '02950b7a7d448fc7e77fea7d12ca073e367622b8', as: "h3", class: "modal__sidebar-heading", level: 5, text: this.sidebarLabel }))), h("div", { key: '73f7fd8f43bb72470e6eb9fefd32eee81234e7ff', class: "modal__sidebar-content", onScroll: this.determineSidebarScrollStatus, ref: (el) => (this.sidebarScrollContainer = el) }, h("slot", { key: '5004305bf8fecaf91a50907c07920fc44754362c', name: "sidebar-content" })), h("div", { key: '4f661235c09bb4b730d31a8159f44a3357adcaff', class: "modal__sidebar-footer" }, h("slot", { key: '4a566e09e71f6acb2c8431cec8985a4bb6185395', name: "sidebar-footer" }))), h("div", { key: '5e95bda60c880712cb063ae6ed67ea8964aabbe3', class: "modal__main-content" }, h("header", { key: '7b3f4be5bb206c96c517ad6dea314d35dda19fbb', class: "modal__custom-header" }, h("slot", { key: '802cb431d703e2dc5a6854716e00267518655cae', name: "custom-header" })), (!this.hideLabel || !this.hideCloseButton) && (h("header", { key: '05f41ca8a6f6c668e412bbd8b1a0f7c25f4a3ae5', class: "modal__header" }, h("div", { key: '5946fb4497f1be9d5d542ef721c419a7e988f10b', class: "modal__header-bar" }, !this.hideCloseButton && (h("swirl-button", { key: 'd631408b4ac4b107525d60649d7118144085f2c9', class: "modal__close-button", hideLabel: true, icon: this.variant === "default"
|
|
246
251
|
? "<swirl-icon-close></swirl-icon-close>"
|
|
247
|
-
: "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), this.showFullscreenButton && (h("swirl-button", { key: '
|
|
252
|
+
: "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), this.showFullscreenButton && (h("swirl-button", { key: 'efdbb168513ba5faded2a3e68792f29eea3a73cc', class: "modal__fullscreen-button", hideLabel: true, icon: this.isFullscreen
|
|
248
253
|
? "<swirl-icon-close-fullscreen></swirl-icon-close-fullscreen>"
|
|
249
254
|
: "<swirl-icon-open-in-full></swirl-icon-open-in-full>", label: this.isFullscreen
|
|
250
255
|
? this.fullscreenDisableButtonLabel
|
|
251
|
-
: this.fullscreenEnableButtonLabel, onClick: this.onFullscreenButtonClick })), !this.hideLabel && (h("swirl-heading", { key: '
|
|
256
|
+
: this.fullscreenEnableButtonLabel, onClick: this.onFullscreenButtonClick })), !this.hideLabel && (h("swirl-heading", { key: 'd9d93c08677a3c0a456b5d4c7a9d7fdcc44a6148', as: "h2", class: "modal__heading", level: 3, text: this.label }))))), h("div", { key: 'a9056a4b722d0a3891e5e902613e7054d557729c', class: "modal__content-container", style: {
|
|
252
257
|
gap: this.contentGap
|
|
253
258
|
? `var(--s-space-${this.contentGap})`
|
|
254
259
|
: undefined,
|
|
255
|
-
} }, h("div", { key: '
|
|
260
|
+
} }, h("div", { key: 'c1367de68040ff0b637efa7a7eb66b361320fca6', class: "modal__primary-content", style: {
|
|
256
261
|
maxWidth: this.primaryContentMaxWidth,
|
|
257
262
|
flex: this.primaryContentFlex,
|
|
258
|
-
} }, h("div", { key: '
|
|
263
|
+
} }, h("div", { key: '9c729f9350a144e8b7af8e07c1f0d69cd320c4a6', class: "modal__header-tools" }, h("slot", { key: '488d261460a865fd207acd9031ad3bf8e53e9899', name: "header-tools" })), h("div", { key: 'c960da07fa2190d4af907d05801f61ecaf4dae4e', class: "modal__content", onScroll: this.determineMainScrollStatus, ref: (el) => (this.scrollContainer = el) }, h("slot", { key: 'ff5be4e790eacffbce4ae3d67d43a1ba75f6a760' }))), h("div", { key: '89d368198cdc7156ca143ab9fcdbf9bf56cd7772', class: "modal__secondary-content", style: {
|
|
259
264
|
maxWidth: this.secondaryContentMaxWidth,
|
|
260
265
|
flex: this.secondaryContentFlex,
|
|
261
266
|
padding: Boolean(this.secondaryContentPadding)
|
|
@@ -273,7 +278,7 @@ const SwirlModal$1 = /*@__PURE__*/ proxyCustomElement(class SwirlModal extends H
|
|
|
273
278
|
paddingInlineStart: Boolean(this.secondaryContentPaddingInlineStart)
|
|
274
279
|
? `var(--s-space-${this.secondaryContentPaddingInlineStart})`
|
|
275
280
|
: undefined,
|
|
276
|
-
} }, h("slot", { key: '
|
|
281
|
+
} }, h("slot", { key: 'a4fc64dfed01d834f883ce21499178c60d5e8502', name: "secondary-content" }))), h("div", { key: '53044266cf7b39f383e28de0b33ff5d095bcb3bb', class: "modal__custom-footer" }, h("slot", { key: '25681e2fd02c846a8b9cdcfa951799730ef06f5b', name: "custom-footer" })), showControls && (h("footer", { key: 'a65853a33d5b554b18bcc141611d2470f22e6aad', class: "modal__controls" }, h("swirl-button-group", { key: '114cb44c508028261d83d958d3d7030c4f7d4771', wrap: true }, this.secondaryActionLabel && (h("swirl-button", { key: '7a6ef1b9e54a746ebba3d94ae11e56151c8bfa54', label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { key: '3e4a90e77da254714a95ee1e4f6c83193b17f6dc', intent: "primary", label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: "flat" }))))))))));
|
|
277
282
|
}
|
|
278
283
|
get el() { return this; }
|
|
279
284
|
static get style() { return swirlModalCss; }
|
|
@@ -2,6 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, d as getElement
|
|
|
2
2
|
import { d as disableBodyScroll, e as enableBodyScroll } from './bodyScrollLock.esm-B0kNlhKL.js';
|
|
3
3
|
import { c as classnames } from './index-orsBiyT_.js';
|
|
4
4
|
import { c as createFocusTrap } from './focus-trap.esm-DIdMBZfn.js';
|
|
5
|
+
import { k as getActiveElement } from './utils-D_MUFqkF.js';
|
|
5
6
|
|
|
6
7
|
const swirlModalCss = ":host{display:block}:host *{box-sizing:border-box}.modal{--swirl-ghost-button-background-default:var(--s-surface-overlay-default);--swirl-ghost-button-background-hovered:var(--s-surface-overlay-hovered);--swirl-ghost-button-background-pressed:var(--s-surface-overlay-pressed);--swirl-resource-list-item-background-default:var(\n --s-surface-overlay-default\n );--swirl-resource-list-item-background-hovered:var(\n --s-surface-overlay-hovered\n );--swirl-resource-list-item-background-pressed:var(\n --s-surface-overlay-pressed\n );--swirl-modal-height:auto;--swirl-modal-max-height:90vh;--swirl-modal-view-height:100vh;--swirl-modal-header-height:3.75rem;--swirl-modal-max-width:40rem;--swirl-modal-sidebar-width:25rem;--swirl-modal-max-secondary-content-width:24rem;--swirl-modal-footer-padding-small:var(--s-space-12) var(--s-space-16)\n var(--s-space-12) var(--s-space-16);--swirl-modal-footer-padding-large:var(--s-space-16) var(--s-space-24)\n var(--s-space-16) var(--s-space-24)}@supports (height: 100dvh){.modal{--swirl-modal-max-height:90dvh;--swirl-modal-view-height:100dvh}}.modal{position:fixed;z-index:var(--s-z-40);display:flex;justify-content:center;align-items:center;height:var(--swirl-modal-view-height);inset:0}.modal[aria-hidden=\"true\"]{display:none}.modal--variant-default.modal--closing{animation:0.15s modal-fade-out;animation-fill-mode:forwards}@media (prefers-reduced-motion){.modal--variant-default.modal--closing{animation:none}}.modal--variant-default:not(.modal--closing) .modal__backdrop{animation:0.15s modal-backdrop-fade-in}@media (prefers-reduced-motion){.modal--variant-default:not(.modal--closing) .modal__backdrop{animation:none}}.modal--variant-default:not(.modal--closing) .modal__body{animation:0.15s modal-scale-in}@media (prefers-reduced-motion){.modal--variant-default:not(.modal--closing) .modal__body{animation:none}}.modal--variant-drawer{justify-content:end;align-items:stretch}.modal--variant-drawer.modal--closing{animation:0.15s modal-drawer-slide-out;animation-fill-mode:forwards}@media (prefers-reduced-motion){.modal--variant-drawer.modal--closing{animation:none}}@media (min-width: 768px){.modal--variant-drawer.modal--hide-label .modal__header-bar{height:auto;padding-top:var(--s-space-4);padding-bottom:var(--s-space-4)}}.modal--variant-drawer .modal__backdrop{background-color:transparent;animation:none}.modal--variant-drawer .modal__body{height:100%;max-height:none;border-radius:0;animation:0.15s modal-drawer-slide-in;box-shadow:var(--s-shadow-level-3)}@media (prefers-reduced-motion){.modal--variant-drawer .modal__body{animation:none}}.modal--variant-drawer .modal__header-bar{background-color:var(--s-surface-overlay-default)}.modal--variant-drawer .modal__header-bar .modal__close-button{margin-left:calc(-1 * var(--s-space-8))}.modal--variant-drawer .modal__header-bar .modal__fullscreen-button{display:none}@media (min-width: 768px){.modal--variant-drawer .modal__header-bar{flex-direction:row}}@media (min-width: 768px){.modal--variant-drawer.modal--padded .modal__content{padding-top:var(--s-space-8)}}.modal--padded .modal__content{padding-top:var(--s-space-24);padding-right:var(--s-space-16);padding-bottom:var(--s-space-24);padding-left:var(--s-space-16)}@media (min-width: 768px){.modal--padded .modal__content{padding-top:0;padding-right:var(--s-space-24);padding-bottom:var(--s-space-16);padding-left:var(--s-space-24)}}@media (min-width: 768px){.modal--scrollable .modal__content{padding-bottom:0}}.modal--scrollable:not(.modal--scrolled-down).modal--has-custom-footer .modal__custom-footer{border-top:var(--s-border-width-default) solid var(--s-border-default)}.modal--scrollable:not(.modal--scrolled-down):not(.modal--has-custom-footer) .modal__controls{border-top:var(--s-border-width-default) solid var(--s-border-default)}.modal--has-custom-header .modal__custom-header{display:block}.modal--has-custom-header .modal__content{padding-top:var(--s-space-16)}.modal--has-custom-footer .modal__custom-footer{padding:var(--swirl-modal-footer-padding-small)}@media (min-width: 768px){.modal--has-custom-footer .modal__custom-footer{padding:var(--swirl-modal-footer-padding-large)}}.modal--has-header-tools .modal__header{border-bottom-color:transparent}.modal--has-header-tools .modal__header-tools{display:block}.modal--has-secondary-content.modal.modal--variant-default:not(.modal--fullscreen) .modal__body,.modal--has-secondary-content.modal.modal--variant-drawer:not(.modal--fullscreen) .modal__body{max-width:calc(\n var(--swirl-modal-max-width) +\n var(--swirl-modal-max-secondary-content-width)\n )}.modal--has-secondary-content:not(.modal--has-header-tools):not(.modal--hide-secondary-content-borders) .modal__header{border-bottom-color:var(--s-border-default)}.modal--has-secondary-content.modal--has-header-tools:not(.modal--hide-secondary-content-borders) .modal__header-tools{border-bottom-color:var(--s-border-default)}.modal--has-secondary-content.modal--has-custom-footer:not(.modal--hide-secondary-content-borders) .modal__custom-footer{border-top:var(--s-border-width-default) solid var(--s-border-default)}.modal--has-secondary-content:not(.modal--has-custom-footer):not(.modal--hide-secondary-content-borders) .modal__controls{border-top:var(--s-border-width-default) solid var(--s-border-default)}@media (min-width: 992px){.modal--has-secondary-content .modal__header-tools,.modal--has-secondary-content .modal__content{padding-right:0}}.modal--has-secondary-content .modal__primary-content{overflow:visible;max-height:60%;flex-basis:auto}@media (min-width: 992px){.modal--has-secondary-content .modal__primary-content{max-width:calc(100% - var(--swirl-modal-max-secondary-content-width));max-height:none;flex-basis:calc(100% - var(--swirl-modal-max-secondary-content-width))}}.modal--has-secondary-content .modal__secondary-content{display:block}.modal__main-content{display:flex;flex-direction:column;overflow-y:auto;flex-grow:1}.modal__sidebar{display:none}.modal.modal--has-sidebar-content.modal.modal--variant-default:not(.modal--fullscreen) .modal__body,.modal.modal--has-sidebar-content.modal.modal--variant-drawer:not(.modal--fullscreen) .modal__body{max-width:calc(\n var(--swirl-modal-max-width) + var(--swirl-modal-sidebar-width)\n )}@media (min-width: 768px){.modal.modal--has-sidebar-content .modal__sidebar{display:flex;flex-direction:column;overflow-y:auto;flex-shrink:0;width:var(--swirl-modal-sidebar-width);border-right:var(--s-border-width-default) solid var(--s-border-default)}.modal.modal--has-sidebar-content .modal__sidebar .modal__sidebar-header{border-bottom:var(--s-border-width-default) solid transparent;display:flex;align-items:center;gap:var(--s-space-8);padding-right:var(--s-space-24);padding-left:var(--s-space-24)}.modal.modal--has-sidebar-content .modal__sidebar .modal__sidebar-header.modal__sidebar-header--has-close-button{padding-left:var(--s-space-16)}.modal.modal--has-sidebar-content .modal__sidebar .modal__sidebar-header .modal__sidebar-heading{display:flex;align-items:center;height:var(--swirl-modal-header-height)}.modal.modal--has-sidebar-content .modal__sidebar .modal__sidebar-content{display:block;flex-grow:1;overflow-y:auto}}@media (min-width: 992px){.modal.modal--has-sidebar-content .modal__primary-content{flex-basis:calc(100% - 20rem)}}.modal--sidebar-padded .modal__sidebar .modal__sidebar-content{padding-left:var(--s-space-24);padding-right:var(--s-space-24);padding-bottom:var(--s-space-16);padding-top:var(--s-space-16)}@media (min-width: 768px){.modal--scrolled:not(.modal--hide-scrolled-header-border):not(.modal--has-header-tools) .modal__header{border-bottom-color:var(--s-border-default)}.modal--scrolled:not(.modal--hide-scrolled-header-border).modal--has-header-tools .modal__header-tools{border-bottom-color:var(--s-border-default)}.modal--scrolled:not(.modal--hide-scrolled-header-border) .modal__custom-header{border-bottom-color:var(--s-border-default)}}@media (min-width: 768px){.modal--sidebar-scrolled .modal__sidebar .modal__sidebar-header{border-bottom-color:var(--s-border-default)}}.modal--has-sidebar-footer.modal--sidebar-footer-padded .modal__sidebar-footer{padding:var(--swirl-modal-footer-padding-small)}@media (min-width: 768px){.modal--has-sidebar-footer.modal--sidebar-footer-padded .modal__sidebar-footer{padding:var(--swirl-modal-footer-padding-large)}}@media (min-width: 768px){.modal--sidebar-scrollable .modal__sidebar-content{padding-bottom:0 !important}}.modal--sidebar-scrollable:not(.modal--sidebar-scrolled-down).modal--has-sidebar-footer .modal__sidebar-footer{border-top:var(--s-border-width-default) solid var(--s-border-default)}.modal__backdrop{position:fixed;background-color:rgba(0, 0, 0, 0.2);inset:0}.modal__body{--swirl-card-background-default:var(--s-surface-overlay-default);--swirl-card-background-hovered:var(--s-surface-overlay-hovered);--swirl-card-background-pressed:var(--s-surface-overlay-pressed);--swirl-accordion-item-toggle-default:var(--s-surface-overlay-default);--swirl-accordion-item-toggle-hovered:var(--s-surface-overlay-hovered);--swirl-accordion-item-toggle-pressed:var(--s-surface-overlay-pressed);position:relative;z-index:var(--s-z-40);display:flex;flex-direction:row;overflow:hidden;width:100vw;max-width:100vw;height:var(--swirl-modal-view-height);max-height:var(--swirl-modal-view-height);background-color:var(--s-surface-overlay-default)}.modal--fullscreen .modal__body{min-height:var(--swirl-modal-view-height)}.modal--fullscreen-transitioning .modal__body{transition:width 0.15s ease-out, max-width 0.15s ease-out,\n max-height 0.15s ease-out, min-height 0.15s ease-out}@media (min-width: 768px){.modal.modal--variant-default:not(.modal--fullscreen) .modal__body{width:90vw;max-width:var(--swirl-modal-max-width);max-height:var(--swirl-modal-max-height);min-height:0;border-radius:var(--s-border-radius-base);box-shadow:var(--s-shadow-level-3)}}@media (min-width: 992px){.modal.modal--variant-default:not(.modal--fullscreen) .modal__body{height:var(--swirl-modal-height)}}.modal__header{border-bottom:var(--s-border-width-default) solid var(--s-border-default)}@media (min-width: 768px){.modal__header{border-bottom:var(--s-border-width-default) solid transparent}}.modal__header-bar{display:flex;height:3.5rem;padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);flex-shrink:0;align-items:center;gap:var(--s-space-8)}@media (min-width: 768px){.modal__header-bar{height:var(--swirl-modal-header-height);padding-top:var(--s-space-12);padding-right:var(--s-space-24);padding-bottom:var(--s-space-12);padding-left:var(--s-space-24);flex-direction:row-reverse}}.modal__fullscreen-button{display:none}@media (min-width: 768px){.modal__fullscreen-button{display:block}}.modal__header-tools{display:none;padding-right:var(--s-space-16);padding-left:var(--s-space-16);border-bottom:var(--s-border-width-default) solid var(--s-border-default)}@media (min-width: 768px){.modal__header-tools{padding-right:var(--s-space-24);padding-left:var(--s-space-24);border-bottom-color:transparent}}.modal__custom-header{display:none;flex-shrink:0;border-bottom:var(--s-border-width-default) solid var(--s-border-default)}@media (min-width: 768px){.modal__custom-header{border-bottom-color:transparent}}.modal__heading{overflow:hidden}.modal__heading .heading{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.modal__content-container{display:flex;overflow:hidden;flex-grow:1;flex-direction:column;gap:var(--s-space-24)}@media (min-width: 992px){.modal__content-container{flex-direction:row}}.modal__primary-content{display:flex;overflow:hidden;overflow-y:auto;flex-grow:1;flex-basis:100%;flex-direction:column}.modal__content{overflow-x:hidden;overflow-y:auto;height:100%}.modal__content ::slotted(*){margin:0}.modal__secondary-content{display:none;overflow:visible;overflow-x:hidden;overflow-y:auto;max-width:none;max-height:40%;padding-right:var(--s-space-16);padding-left:var(--s-space-16)}@media (min-width: 768px){.modal__secondary-content{padding-left:var(--s-space-24)}}@media (min-width: 992px){.modal__secondary-content{overflow-x:hidden;overflow-y:auto;max-width:var(--swirl-modal-max-secondary-content-width);max-height:none;padding-right:var(--s-space-24);padding-bottom:var(--s-space-16);padding-left:0;flex-basis:50%;flex-grow:1}}.modal__custom-footer{flex-shrink:0}.modal__controls{display:flex;padding:var(--swirl-modal-footer-padding-small);flex-shrink:0;justify-content:flex-end}@media (min-width: 768px){.modal__controls{padding:var(--swirl-modal-footer-padding-large)}}.modal--has-secondary-content.modal--has-sidebar-content:not(.modal--fullscreen) .modal__body{max-width:calc(\n var(--swirl-modal-max-width) + var(--swirl-modal-sidebar-width) +\n var(--swirl-modal-max-secondary-content-width)\n )}@keyframes modal-scale-in{from{transform:scale(0)}to{transform:scale(1)}}@keyframes modal-backdrop-fade-in{from{opacity:0}to{opacity:1}}@keyframes modal-fade-out{from{opacity:1}to{opacity:0}}@keyframes modal-drawer-slide-in{from{transform:translate3d(100%, 0, 0)}to{transform:translate3d(0, 0, 0)}}@keyframes modal-drawer-slide-out{from{transform:translate3d(0, 0, 0)}to{transform:translate3d(100%, 0, 0)}}";
|
|
7
8
|
|
|
@@ -95,17 +96,6 @@ const SwirlModal = class {
|
|
|
95
96
|
};
|
|
96
97
|
}
|
|
97
98
|
componentDidLoad() {
|
|
98
|
-
this.focusTrap = createFocusTrap(this.modalEl, {
|
|
99
|
-
allowOutsideClick: true,
|
|
100
|
-
// We don't always close the modal when ESC is pressed. So we manage the
|
|
101
|
-
// deactivation of the focus trap manually.
|
|
102
|
-
escapeDeactivates: false,
|
|
103
|
-
tabbableOptions: {
|
|
104
|
-
getShadowRoot: (node) => {
|
|
105
|
-
return node.shadowRoot;
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
99
|
this.determineScrollStatus();
|
|
110
100
|
this.updateCustomFooterStatus();
|
|
111
101
|
this.updateCustomHeaderStatus();
|
|
@@ -130,6 +120,7 @@ const SwirlModal = class {
|
|
|
130
120
|
async open() {
|
|
131
121
|
this.isOpen = true;
|
|
132
122
|
this.modalOpen.emit();
|
|
123
|
+
this.setupFocusTrap();
|
|
133
124
|
setTimeout(() => {
|
|
134
125
|
this.lockBodyScroll();
|
|
135
126
|
this.determineScrollStatus();
|
|
@@ -193,6 +184,20 @@ const SwirlModal = class {
|
|
|
193
184
|
disableBodyScroll(this.scrollContainer);
|
|
194
185
|
disableBodyScroll(this.sidebarScrollContainer);
|
|
195
186
|
}
|
|
187
|
+
setupFocusTrap() {
|
|
188
|
+
this.focusTrap = createFocusTrap(this.modalEl, {
|
|
189
|
+
allowOutsideClick: true,
|
|
190
|
+
setReturnFocus: getActiveElement(),
|
|
191
|
+
// We don't always close the modal when ESC is pressed. So we manage the
|
|
192
|
+
// deactivation of the focus trap manually.
|
|
193
|
+
escapeDeactivates: false,
|
|
194
|
+
tabbableOptions: {
|
|
195
|
+
getShadowRoot: (node) => {
|
|
196
|
+
return node.shadowRoot;
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
}
|
|
196
201
|
unlockBodyScroll() {
|
|
197
202
|
if (this.scrollContainer) {
|
|
198
203
|
enableBodyScroll(this.scrollContainer);
|
|
@@ -228,29 +233,29 @@ const SwirlModal = class {
|
|
|
228
233
|
"modal--sidebar-scrolled-down": this.sidebarScrolledDown,
|
|
229
234
|
"modal--sidebar-scrollable": this.sidebarScrollable,
|
|
230
235
|
});
|
|
231
|
-
return (h(Host, { key: '
|
|
236
|
+
return (h(Host, { key: 'c5c1e9d205414a6703f29de9cb94ca31d0b2e53e' }, h("section", { key: '147ee8b41dbb009b0c42cb0cbd47b4e4b2236ede', "aria-hidden": String(!this.isOpen), "aria-label": this.label, "aria-modal": "true", class: className, onKeyDown: this.onKeyDown, role: "dialog", ref: (el) => (this.modalEl = el) }, h("div", { key: 'c5581d8ad582064afbbeb131c1767de2665c4a0d', class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { key: '1cbd4e90ce8aea3452c1256af3869e69711ed470', class: "modal__body", style: !this.isFullscreen
|
|
232
237
|
? {
|
|
233
238
|
"--swirl-modal-max-height": this.maxHeight,
|
|
234
239
|
"--swirl-modal-height": this.height,
|
|
235
240
|
minHeight: this.minHeight,
|
|
236
241
|
maxWidth: this.maxWidth,
|
|
237
242
|
}
|
|
238
|
-
: {} }, h("aside", { key: '
|
|
243
|
+
: {} }, h("aside", { key: 'b5dc4279da991e8db9601e3a03bdb5d7d7519a3b', class: "modal__sidebar" }, this.sidebarLabel && (h("header", { key: '182b2e194d44bb34bc7208329f6c560bdc031a90', class: classnames("modal__sidebar-header", {
|
|
239
244
|
"modal__sidebar-header--has-close-button": this.hasSidebarCloseButton,
|
|
240
|
-
}) }, this.hasSidebarCloseButton && (h("swirl-button", { key: '
|
|
245
|
+
}) }, this.hasSidebarCloseButton && (h("swirl-button", { key: '3c8297ccb8edb389ccb1ba88e7ffdb2769837d72', hideLabel: true, icon: "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.sidebarCloseButtonLabel, onClick: this.onSidebarCloseButtonClick })), h("swirl-heading", { key: '02950b7a7d448fc7e77fea7d12ca073e367622b8', as: "h3", class: "modal__sidebar-heading", level: 5, text: this.sidebarLabel }))), h("div", { key: '73f7fd8f43bb72470e6eb9fefd32eee81234e7ff', class: "modal__sidebar-content", onScroll: this.determineSidebarScrollStatus, ref: (el) => (this.sidebarScrollContainer = el) }, h("slot", { key: '5004305bf8fecaf91a50907c07920fc44754362c', name: "sidebar-content" })), h("div", { key: '4f661235c09bb4b730d31a8159f44a3357adcaff', class: "modal__sidebar-footer" }, h("slot", { key: '4a566e09e71f6acb2c8431cec8985a4bb6185395', name: "sidebar-footer" }))), h("div", { key: '5e95bda60c880712cb063ae6ed67ea8964aabbe3', class: "modal__main-content" }, h("header", { key: '7b3f4be5bb206c96c517ad6dea314d35dda19fbb', class: "modal__custom-header" }, h("slot", { key: '802cb431d703e2dc5a6854716e00267518655cae', name: "custom-header" })), (!this.hideLabel || !this.hideCloseButton) && (h("header", { key: '05f41ca8a6f6c668e412bbd8b1a0f7c25f4a3ae5', class: "modal__header" }, h("div", { key: '5946fb4497f1be9d5d542ef721c419a7e988f10b', class: "modal__header-bar" }, !this.hideCloseButton && (h("swirl-button", { key: 'd631408b4ac4b107525d60649d7118144085f2c9', class: "modal__close-button", hideLabel: true, icon: this.variant === "default"
|
|
241
246
|
? "<swirl-icon-close></swirl-icon-close>"
|
|
242
|
-
: "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), this.showFullscreenButton && (h("swirl-button", { key: '
|
|
247
|
+
: "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), this.showFullscreenButton && (h("swirl-button", { key: 'efdbb168513ba5faded2a3e68792f29eea3a73cc', class: "modal__fullscreen-button", hideLabel: true, icon: this.isFullscreen
|
|
243
248
|
? "<swirl-icon-close-fullscreen></swirl-icon-close-fullscreen>"
|
|
244
249
|
: "<swirl-icon-open-in-full></swirl-icon-open-in-full>", label: this.isFullscreen
|
|
245
250
|
? this.fullscreenDisableButtonLabel
|
|
246
|
-
: this.fullscreenEnableButtonLabel, onClick: this.onFullscreenButtonClick })), !this.hideLabel && (h("swirl-heading", { key: '
|
|
251
|
+
: this.fullscreenEnableButtonLabel, onClick: this.onFullscreenButtonClick })), !this.hideLabel && (h("swirl-heading", { key: 'd9d93c08677a3c0a456b5d4c7a9d7fdcc44a6148', as: "h2", class: "modal__heading", level: 3, text: this.label }))))), h("div", { key: 'a9056a4b722d0a3891e5e902613e7054d557729c', class: "modal__content-container", style: {
|
|
247
252
|
gap: this.contentGap
|
|
248
253
|
? `var(--s-space-${this.contentGap})`
|
|
249
254
|
: undefined,
|
|
250
|
-
} }, h("div", { key: '
|
|
255
|
+
} }, h("div", { key: 'c1367de68040ff0b637efa7a7eb66b361320fca6', class: "modal__primary-content", style: {
|
|
251
256
|
maxWidth: this.primaryContentMaxWidth,
|
|
252
257
|
flex: this.primaryContentFlex,
|
|
253
|
-
} }, h("div", { key: '
|
|
258
|
+
} }, h("div", { key: '9c729f9350a144e8b7af8e07c1f0d69cd320c4a6', class: "modal__header-tools" }, h("slot", { key: '488d261460a865fd207acd9031ad3bf8e53e9899', name: "header-tools" })), h("div", { key: 'c960da07fa2190d4af907d05801f61ecaf4dae4e', class: "modal__content", onScroll: this.determineMainScrollStatus, ref: (el) => (this.scrollContainer = el) }, h("slot", { key: 'ff5be4e790eacffbce4ae3d67d43a1ba75f6a760' }))), h("div", { key: '89d368198cdc7156ca143ab9fcdbf9bf56cd7772', class: "modal__secondary-content", style: {
|
|
254
259
|
maxWidth: this.secondaryContentMaxWidth,
|
|
255
260
|
flex: this.secondaryContentFlex,
|
|
256
261
|
padding: Boolean(this.secondaryContentPadding)
|
|
@@ -268,7 +273,7 @@ const SwirlModal = class {
|
|
|
268
273
|
paddingInlineStart: Boolean(this.secondaryContentPaddingInlineStart)
|
|
269
274
|
? `var(--s-space-${this.secondaryContentPaddingInlineStart})`
|
|
270
275
|
: undefined,
|
|
271
|
-
} }, h("slot", { key: '
|
|
276
|
+
} }, h("slot", { key: 'a4fc64dfed01d834f883ce21499178c60d5e8502', name: "secondary-content" }))), h("div", { key: '53044266cf7b39f383e28de0b33ff5d095bcb3bb', class: "modal__custom-footer" }, h("slot", { key: '25681e2fd02c846a8b9cdcfa951799730ef06f5b', name: "custom-footer" })), showControls && (h("footer", { key: 'a65853a33d5b554b18bcc141611d2470f22e6aad', class: "modal__controls" }, h("swirl-button-group", { key: '114cb44c508028261d83d958d3d7030c4f7d4771', wrap: true }, this.secondaryActionLabel && (h("swirl-button", { key: '7a6ef1b9e54a746ebba3d94ae11e56151c8bfa54', label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { key: '3e4a90e77da254714a95ee1e4f6c83193b17f6dc', intent: "primary", label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: "flat" }))))))))));
|
|
272
277
|
}
|
|
273
278
|
get el() { return getElement(this); }
|
|
274
279
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,c as e,h as o,H as d,d as t}from"./p-CWOhMVtL.js";import{d as s,e as r}from"./p-B0kNlhKL.js";import{c as i}from"./p-orsBiyT_.js";import{c as l}from"./p-DIdMBZfn.js";import{k as n}from"./p-D_MUFqkF.js";const m=class{constructor(o){a(this,o),this.toggleFullscreen=e(this,"toggleFullscreen",7),this.modalClose=e(this,"modalClose",7),this.modalOpen=e(this,"modalOpen",7),this.primaryAction=e(this,"primaryAction",7),this.requestModalClose=e(this,"requestModalClose",7),this.secondaryAction=e(this,"secondaryAction",7),this.sidebarClose=e(this,"sidebarClose",7),this.closable=!0,this.closeButtonLabel="Close modal",this.fullscreenEnableButtonLabel="Full screen",this.fullscreenDisableButtonLabel="Exit full screen",this.padded=!0,this.variant="default",this.sidebarPadded=!0,this.sidebarFooterPadded=!0,this.sidebarCloseButtonLabel="Close sidebar",this.isOpen=!1,this.isFullscreen=!1,this.isFullscreenTransitioning=!1,this.closing=!1,this.scrollable=!1,this.scrolled=!1,this.scrolledDown=!1,this.sidebarScrolled=!1,this.sidebarScrolledDown=!1,this.sidebarScrollable=!1,this.onKeyDown=a=>{"Escape"===a.code&&(a.stopImmediatePropagation(),this.close())},this.onBackdropClick=()=>{this.close()},this.onCloseButtonClick=()=>{this.close()},this.onFullscreenButtonClick=()=>{this.setFullscreen(!this.isFullscreen)},this.onSidebarCloseButtonClick=()=>{this.hideSidebarContent=!0,this.sidebarClose.emit()},this.onPrimaryAction=a=>{this.primaryAction.emit(a)},this.onSecondaryAction=a=>{this.secondaryAction.emit(a)},this.determineScrollStatus=()=>{this.determineMainScrollStatus(),this.determineSidebarScrollStatus()},this.determineMainScrollStatus=()=>{const a=this.scrollContainer?.scrollTop>0,e=Math.ceil(this.scrollContainer?.scrollTop+this.scrollContainer?.offsetHeight)>=this.scrollContainer?.scrollHeight,o=this.scrollContainer?.scrollHeight>this.scrollContainer?.offsetHeight;a!==this.scrolled&&(this.scrolled=a),e!==this.scrolledDown&&(this.scrolledDown=e),o!==this.scrollable&&(this.scrollable=o)},this.determineSidebarScrollStatus=()=>{const a=this.sidebarScrollContainer?.scrollTop>0,e=Math.ceil(this.sidebarScrollContainer?.scrollTop+this.sidebarScrollContainer?.offsetHeight)>=this.sidebarScrollContainer?.scrollHeight,o=this.sidebarScrollContainer?.scrollHeight>this.sidebarScrollContainer?.offsetHeight;a!==this.sidebarScrolled&&(this.sidebarScrolled=a),e!==this.sidebarScrolledDown&&(this.sidebarScrolledDown=e),o!==this.sidebarScrollable&&(this.sidebarScrollable=o)}}componentDidLoad(){this.determineScrollStatus(),this.updateCustomFooterStatus(),this.updateCustomHeaderStatus(),this.updateHeaderToolsStatus(),this.updateSecondaryContentStatus(),this.updateSidebarContentStatus(),this.updateSidebarFooterStatus()}componentDidRender(){this.focusTrap?.updateContainerElements(this.modalEl)}disconnectedCallback(){this.focusTrap?.deactivate(),this.unlockBodyScroll()}onWindowResize(){this.determineScrollStatus()}async open(){this.isOpen=!0,this.modalOpen.emit(),this.setupFocusTrap(),setTimeout((()=>{this.lockBodyScroll(),this.determineScrollStatus()})),setTimeout((()=>{this.focusTrap.activate(),this.handleAutoFocus()}),200)}async close(a){this.closing||(this.requestModalClose.emit(),(this.closable||a)&&(this.closing=!0,this.unlockBodyScroll(),setTimeout((()=>{this.focusTrap.deactivate(),this.isOpen=!1,this.modalClose.emit(),this.closing=!1}),150)))}async setFullscreen(a){this.isFullscreen!==a&&(this.isFullscreenTransitioning=!0,this.isFullscreen=a,this.toggleFullscreen.emit(this.isFullscreen),setTimeout((()=>this.isFullscreenTransitioning=!1),150))}updateCustomFooterStatus(){this.hasCustomFooter=Boolean(this.el.querySelector('[slot="custom-footer"]'))}updateCustomHeaderStatus(){this.hasCustomHeader=Boolean(this.el.querySelector('[slot="custom-header"]'))}updateHeaderToolsStatus(){this.hasHeaderTools=Boolean(this.el.querySelector('[slot="header-tools"]'))}updateSecondaryContentStatus(){this.hasSecondaryContent=Boolean(this.el.querySelector('[slot="secondary-content"]'))}updateSidebarContentStatus(){this.hasSidebarContent=Boolean(this.el.querySelector('[slot="sidebar-content"]'))}updateSidebarFooterStatus(){this.hasSidebarFooter=Boolean(this.el.querySelector('[slot="sidebar-footer"]'))}handleAutoFocus(){this.modalEl.querySelector("input[autofocus]")?.focus()}lockBodyScroll(){s(this.scrollContainer),s(this.sidebarScrollContainer)}setupFocusTrap(){this.focusTrap=l(this.modalEl,{allowOutsideClick:!0,setReturnFocus:n(),escapeDeactivates:!1,tabbableOptions:{getShadowRoot:a=>a.shadowRoot}})}unlockBodyScroll(){this.scrollContainer&&r(this.scrollContainer),this.sidebarScrollContainer&&r(this.sidebarScrollContainer)}render(){const a=Boolean(this.primaryActionLabel)||Boolean(this.secondaryActionLabel),e=i("modal",`modal--variant-${this.variant}`,{"modal--closing":this.closing,"modal--fullscreen":this.isFullscreen,"modal--fullscreen-transitioning":this.isFullscreenTransitioning,"modal--has-custom-footer":this.hasCustomFooter,"modal--has-custom-header":this.hasCustomHeader,"modal--has-header-tools":this.hasHeaderTools,"modal--has-secondary-content":this.hasSecondaryContent&&!this.hideSecondaryContent,"modal--hide-label":this.hideLabel,"modal--padded":this.padded,"modal--scrollable":this.scrollable,"modal--scrolled":this.scrolled,"modal--hide-scrolled-header-border":this.hideScrolledHeaderBorder,"modal--scrolled-down":this.scrolledDown,"modal--hide-secondary-content-borders":this.hideSecondaryContentBorders,"modal--has-sidebar-content":this.hasSidebarContent&&!this.hideSidebarContent,"modal--sidebar-padded":this.sidebarPadded,"modal--has-sidebar-footer":this.hasSidebarFooter&&this.hasSidebarContent&&!this.hideSidebarContent,"modal--sidebar-footer-padded":this.sidebarFooterPadded,"modal--sidebar-scrolled":this.sidebarScrolled,"modal--sidebar-scrolled-down":this.sidebarScrolledDown,"modal--sidebar-scrollable":this.sidebarScrollable});return o(d,{key:"c5c1e9d205414a6703f29de9cb94ca31d0b2e53e"},o("section",{key:"147ee8b41dbb009b0c42cb0cbd47b4e4b2236ede","aria-hidden":String(!this.isOpen),"aria-label":this.label,"aria-modal":"true",class:e,onKeyDown:this.onKeyDown,role:"dialog",ref:a=>this.modalEl=a},o("div",{key:"c5581d8ad582064afbbeb131c1767de2665c4a0d",class:"modal__backdrop",onClick:this.onBackdropClick}),o("div",{key:"1cbd4e90ce8aea3452c1256af3869e69711ed470",class:"modal__body",style:this.isFullscreen?{}:{"--swirl-modal-max-height":this.maxHeight,"--swirl-modal-height":this.height,minHeight:this.minHeight,maxWidth:this.maxWidth}},o("aside",{key:"b5dc4279da991e8db9601e3a03bdb5d7d7519a3b",class:"modal__sidebar"},this.sidebarLabel&&o("header",{key:"182b2e194d44bb34bc7208329f6c560bdc031a90",class:i("modal__sidebar-header",{"modal__sidebar-header--has-close-button":this.hasSidebarCloseButton})},this.hasSidebarCloseButton&&o("swirl-button",{key:"3c8297ccb8edb389ccb1ba88e7ffdb2769837d72",hideLabel:!0,icon:"<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>",label:this.sidebarCloseButtonLabel,onClick:this.onSidebarCloseButtonClick}),o("swirl-heading",{key:"02950b7a7d448fc7e77fea7d12ca073e367622b8",as:"h3",class:"modal__sidebar-heading",level:5,text:this.sidebarLabel})),o("div",{key:"73f7fd8f43bb72470e6eb9fefd32eee81234e7ff",class:"modal__sidebar-content",onScroll:this.determineSidebarScrollStatus,ref:a=>this.sidebarScrollContainer=a},o("slot",{key:"5004305bf8fecaf91a50907c07920fc44754362c",name:"sidebar-content"})),o("div",{key:"4f661235c09bb4b730d31a8159f44a3357adcaff",class:"modal__sidebar-footer"},o("slot",{key:"4a566e09e71f6acb2c8431cec8985a4bb6185395",name:"sidebar-footer"}))),o("div",{key:"5e95bda60c880712cb063ae6ed67ea8964aabbe3",class:"modal__main-content"},o("header",{key:"7b3f4be5bb206c96c517ad6dea314d35dda19fbb",class:"modal__custom-header"},o("slot",{key:"802cb431d703e2dc5a6854716e00267518655cae",name:"custom-header"})),(!this.hideLabel||!this.hideCloseButton)&&o("header",{key:"05f41ca8a6f6c668e412bbd8b1a0f7c25f4a3ae5",class:"modal__header"},o("div",{key:"5946fb4497f1be9d5d542ef721c419a7e988f10b",class:"modal__header-bar"},!this.hideCloseButton&&o("swirl-button",{key:"d631408b4ac4b107525d60649d7118144085f2c9",class:"modal__close-button",hideLabel:!0,icon:"default"===this.variant?"<swirl-icon-close></swirl-icon-close>":"<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>",label:this.closeButtonLabel,onClick:this.onCloseButtonClick}),this.showFullscreenButton&&o("swirl-button",{key:"efdbb168513ba5faded2a3e68792f29eea3a73cc",class:"modal__fullscreen-button",hideLabel:!0,icon:this.isFullscreen?"<swirl-icon-close-fullscreen></swirl-icon-close-fullscreen>":"<swirl-icon-open-in-full></swirl-icon-open-in-full>",label:this.isFullscreen?this.fullscreenDisableButtonLabel:this.fullscreenEnableButtonLabel,onClick:this.onFullscreenButtonClick}),!this.hideLabel&&o("swirl-heading",{key:"d9d93c08677a3c0a456b5d4c7a9d7fdcc44a6148",as:"h2",class:"modal__heading",level:3,text:this.label}))),o("div",{key:"a9056a4b722d0a3891e5e902613e7054d557729c",class:"modal__content-container",style:{gap:this.contentGap?`var(--s-space-${this.contentGap})`:void 0}},o("div",{key:"c1367de68040ff0b637efa7a7eb66b361320fca6",class:"modal__primary-content",style:{maxWidth:this.primaryContentMaxWidth,flex:this.primaryContentFlex}},o("div",{key:"9c729f9350a144e8b7af8e07c1f0d69cd320c4a6",class:"modal__header-tools"},o("slot",{key:"488d261460a865fd207acd9031ad3bf8e53e9899",name:"header-tools"})),o("div",{key:"c960da07fa2190d4af907d05801f61ecaf4dae4e",class:"modal__content",onScroll:this.determineMainScrollStatus,ref:a=>this.scrollContainer=a},o("slot",{key:"ff5be4e790eacffbce4ae3d67d43a1ba75f6a760"}))),o("div",{key:"89d368198cdc7156ca143ab9fcdbf9bf56cd7772",class:"modal__secondary-content",style:{maxWidth:this.secondaryContentMaxWidth,flex:this.secondaryContentFlex,padding:Boolean(this.secondaryContentPadding)?`var(--s-space-${this.secondaryContentPadding})`:void 0,paddingBlockEnd:Boolean(this.secondaryContentPaddingBlockEnd)?`var(--s-space-${this.secondaryContentPaddingBlockEnd})`:void 0,paddingBlockStart:Boolean(this.secondaryContentPaddingBlockStart)?`var(--s-space-${this.secondaryContentPaddingBlockStart})`:void 0,paddingInlineEnd:Boolean(this.secondaryContentPaddingInlineEnd)?`var(--s-space-${this.secondaryContentPaddingInlineEnd})`:void 0,paddingInlineStart:Boolean(this.secondaryContentPaddingInlineStart)?`var(--s-space-${this.secondaryContentPaddingInlineStart})`:void 0}},o("slot",{key:"a4fc64dfed01d834f883ce21499178c60d5e8502",name:"secondary-content"}))),o("div",{key:"53044266cf7b39f383e28de0b33ff5d095bcb3bb",class:"modal__custom-footer"},o("slot",{key:"25681e2fd02c846a8b9cdcfa951799730ef06f5b",name:"custom-footer"})),a&&o("footer",{key:"a65853a33d5b554b18bcc141611d2470f22e6aad",class:"modal__controls"},o("swirl-button-group",{key:"114cb44c508028261d83d958d3d7030c4f7d4771",wrap:!0},this.secondaryActionLabel&&o("swirl-button",{key:"7a6ef1b9e54a746ebba3d94ae11e56151c8bfa54",label:this.secondaryActionLabel,onClick:this.onSecondaryAction}),this.primaryActionLabel&&o("swirl-button",{key:"3e4a90e77da254714a95ee1e4f6c83193b17f6dc",intent:"primary",label:this.primaryActionLabel,onClick:this.onPrimaryAction,variant:"flat"})))))))}get el(){return t(this)}};m.style=':host{display:block}:host *{box-sizing:border-box}.modal{--swirl-ghost-button-background-default:var(--s-surface-overlay-default);--swirl-ghost-button-background-hovered:var(--s-surface-overlay-hovered);--swirl-ghost-button-background-pressed:var(--s-surface-overlay-pressed);--swirl-resource-list-item-background-default:var(\n --s-surface-overlay-default\n );--swirl-resource-list-item-background-hovered:var(\n --s-surface-overlay-hovered\n );--swirl-resource-list-item-background-pressed:var(\n --s-surface-overlay-pressed\n );--swirl-modal-height:auto;--swirl-modal-max-height:90vh;--swirl-modal-view-height:100vh;--swirl-modal-header-height:3.75rem;--swirl-modal-max-width:40rem;--swirl-modal-sidebar-width:25rem;--swirl-modal-max-secondary-content-width:24rem;--swirl-modal-footer-padding-small:var(--s-space-12) var(--s-space-16)\n var(--s-space-12) var(--s-space-16);--swirl-modal-footer-padding-large:var(--s-space-16) var(--s-space-24)\n var(--s-space-16) var(--s-space-24)}@supports (height: 100dvh){.modal{--swirl-modal-max-height:90dvh;--swirl-modal-view-height:100dvh}}.modal{position:fixed;z-index:var(--s-z-40);display:flex;justify-content:center;align-items:center;height:var(--swirl-modal-view-height);inset:0}.modal[aria-hidden="true"]{display:none}.modal--variant-default.modal--closing{animation:0.15s modal-fade-out;animation-fill-mode:forwards}@media (prefers-reduced-motion){.modal--variant-default.modal--closing{animation:none}}.modal--variant-default:not(.modal--closing) .modal__backdrop{animation:0.15s modal-backdrop-fade-in}@media (prefers-reduced-motion){.modal--variant-default:not(.modal--closing) .modal__backdrop{animation:none}}.modal--variant-default:not(.modal--closing) .modal__body{animation:0.15s modal-scale-in}@media (prefers-reduced-motion){.modal--variant-default:not(.modal--closing) .modal__body{animation:none}}.modal--variant-drawer{justify-content:end;align-items:stretch}.modal--variant-drawer.modal--closing{animation:0.15s modal-drawer-slide-out;animation-fill-mode:forwards}@media (prefers-reduced-motion){.modal--variant-drawer.modal--closing{animation:none}}@media (min-width: 768px){.modal--variant-drawer.modal--hide-label .modal__header-bar{height:auto;padding-top:var(--s-space-4);padding-bottom:var(--s-space-4)}}.modal--variant-drawer .modal__backdrop{background-color:transparent;animation:none}.modal--variant-drawer .modal__body{height:100%;max-height:none;border-radius:0;animation:0.15s modal-drawer-slide-in;box-shadow:var(--s-shadow-level-3)}@media (prefers-reduced-motion){.modal--variant-drawer .modal__body{animation:none}}.modal--variant-drawer .modal__header-bar{background-color:var(--s-surface-overlay-default)}.modal--variant-drawer .modal__header-bar .modal__close-button{margin-left:calc(-1 * var(--s-space-8))}.modal--variant-drawer .modal__header-bar .modal__fullscreen-button{display:none}@media (min-width: 768px){.modal--variant-drawer .modal__header-bar{flex-direction:row}}@media (min-width: 768px){.modal--variant-drawer.modal--padded .modal__content{padding-top:var(--s-space-8)}}.modal--padded .modal__content{padding-top:var(--s-space-24);padding-right:var(--s-space-16);padding-bottom:var(--s-space-24);padding-left:var(--s-space-16)}@media (min-width: 768px){.modal--padded .modal__content{padding-top:0;padding-right:var(--s-space-24);padding-bottom:var(--s-space-16);padding-left:var(--s-space-24)}}@media (min-width: 768px){.modal--scrollable .modal__content{padding-bottom:0}}.modal--scrollable:not(.modal--scrolled-down).modal--has-custom-footer .modal__custom-footer{border-top:var(--s-border-width-default) solid var(--s-border-default)}.modal--scrollable:not(.modal--scrolled-down):not(.modal--has-custom-footer) .modal__controls{border-top:var(--s-border-width-default) solid var(--s-border-default)}.modal--has-custom-header .modal__custom-header{display:block}.modal--has-custom-header .modal__content{padding-top:var(--s-space-16)}.modal--has-custom-footer .modal__custom-footer{padding:var(--swirl-modal-footer-padding-small)}@media (min-width: 768px){.modal--has-custom-footer .modal__custom-footer{padding:var(--swirl-modal-footer-padding-large)}}.modal--has-header-tools .modal__header{border-bottom-color:transparent}.modal--has-header-tools .modal__header-tools{display:block}.modal--has-secondary-content.modal.modal--variant-default:not(.modal--fullscreen) .modal__body,.modal--has-secondary-content.modal.modal--variant-drawer:not(.modal--fullscreen) .modal__body{max-width:calc(\n var(--swirl-modal-max-width) +\n var(--swirl-modal-max-secondary-content-width)\n )}.modal--has-secondary-content:not(.modal--has-header-tools):not(.modal--hide-secondary-content-borders) .modal__header{border-bottom-color:var(--s-border-default)}.modal--has-secondary-content.modal--has-header-tools:not(.modal--hide-secondary-content-borders) .modal__header-tools{border-bottom-color:var(--s-border-default)}.modal--has-secondary-content.modal--has-custom-footer:not(.modal--hide-secondary-content-borders) .modal__custom-footer{border-top:var(--s-border-width-default) solid var(--s-border-default)}.modal--has-secondary-content:not(.modal--has-custom-footer):not(.modal--hide-secondary-content-borders) .modal__controls{border-top:var(--s-border-width-default) solid var(--s-border-default)}@media (min-width: 992px){.modal--has-secondary-content .modal__header-tools,.modal--has-secondary-content .modal__content{padding-right:0}}.modal--has-secondary-content .modal__primary-content{overflow:visible;max-height:60%;flex-basis:auto}@media (min-width: 992px){.modal--has-secondary-content .modal__primary-content{max-width:calc(100% - var(--swirl-modal-max-secondary-content-width));max-height:none;flex-basis:calc(100% - var(--swirl-modal-max-secondary-content-width))}}.modal--has-secondary-content .modal__secondary-content{display:block}.modal__main-content{display:flex;flex-direction:column;overflow-y:auto;flex-grow:1}.modal__sidebar{display:none}.modal.modal--has-sidebar-content.modal.modal--variant-default:not(.modal--fullscreen) .modal__body,.modal.modal--has-sidebar-content.modal.modal--variant-drawer:not(.modal--fullscreen) .modal__body{max-width:calc(\n var(--swirl-modal-max-width) + var(--swirl-modal-sidebar-width)\n )}@media (min-width: 768px){.modal.modal--has-sidebar-content .modal__sidebar{display:flex;flex-direction:column;overflow-y:auto;flex-shrink:0;width:var(--swirl-modal-sidebar-width);border-right:var(--s-border-width-default) solid var(--s-border-default)}.modal.modal--has-sidebar-content .modal__sidebar .modal__sidebar-header{border-bottom:var(--s-border-width-default) solid transparent;display:flex;align-items:center;gap:var(--s-space-8);padding-right:var(--s-space-24);padding-left:var(--s-space-24)}.modal.modal--has-sidebar-content .modal__sidebar .modal__sidebar-header.modal__sidebar-header--has-close-button{padding-left:var(--s-space-16)}.modal.modal--has-sidebar-content .modal__sidebar .modal__sidebar-header .modal__sidebar-heading{display:flex;align-items:center;height:var(--swirl-modal-header-height)}.modal.modal--has-sidebar-content .modal__sidebar .modal__sidebar-content{display:block;flex-grow:1;overflow-y:auto}}@media (min-width: 992px){.modal.modal--has-sidebar-content .modal__primary-content{flex-basis:calc(100% - 20rem)}}.modal--sidebar-padded .modal__sidebar .modal__sidebar-content{padding-left:var(--s-space-24);padding-right:var(--s-space-24);padding-bottom:var(--s-space-16);padding-top:var(--s-space-16)}@media (min-width: 768px){.modal--scrolled:not(.modal--hide-scrolled-header-border):not(.modal--has-header-tools) .modal__header{border-bottom-color:var(--s-border-default)}.modal--scrolled:not(.modal--hide-scrolled-header-border).modal--has-header-tools .modal__header-tools{border-bottom-color:var(--s-border-default)}.modal--scrolled:not(.modal--hide-scrolled-header-border) .modal__custom-header{border-bottom-color:var(--s-border-default)}}@media (min-width: 768px){.modal--sidebar-scrolled .modal__sidebar .modal__sidebar-header{border-bottom-color:var(--s-border-default)}}.modal--has-sidebar-footer.modal--sidebar-footer-padded .modal__sidebar-footer{padding:var(--swirl-modal-footer-padding-small)}@media (min-width: 768px){.modal--has-sidebar-footer.modal--sidebar-footer-padded .modal__sidebar-footer{padding:var(--swirl-modal-footer-padding-large)}}@media (min-width: 768px){.modal--sidebar-scrollable .modal__sidebar-content{padding-bottom:0 !important}}.modal--sidebar-scrollable:not(.modal--sidebar-scrolled-down).modal--has-sidebar-footer .modal__sidebar-footer{border-top:var(--s-border-width-default) solid var(--s-border-default)}.modal__backdrop{position:fixed;background-color:rgba(0, 0, 0, 0.2);inset:0}.modal__body{--swirl-card-background-default:var(--s-surface-overlay-default);--swirl-card-background-hovered:var(--s-surface-overlay-hovered);--swirl-card-background-pressed:var(--s-surface-overlay-pressed);--swirl-accordion-item-toggle-default:var(--s-surface-overlay-default);--swirl-accordion-item-toggle-hovered:var(--s-surface-overlay-hovered);--swirl-accordion-item-toggle-pressed:var(--s-surface-overlay-pressed);position:relative;z-index:var(--s-z-40);display:flex;flex-direction:row;overflow:hidden;width:100vw;max-width:100vw;height:var(--swirl-modal-view-height);max-height:var(--swirl-modal-view-height);background-color:var(--s-surface-overlay-default)}.modal--fullscreen .modal__body{min-height:var(--swirl-modal-view-height)}.modal--fullscreen-transitioning .modal__body{transition:width 0.15s ease-out, max-width 0.15s ease-out,\n max-height 0.15s ease-out, min-height 0.15s ease-out}@media (min-width: 768px){.modal.modal--variant-default:not(.modal--fullscreen) .modal__body{width:90vw;max-width:var(--swirl-modal-max-width);max-height:var(--swirl-modal-max-height);min-height:0;border-radius:var(--s-border-radius-base);box-shadow:var(--s-shadow-level-3)}}@media (min-width: 992px){.modal.modal--variant-default:not(.modal--fullscreen) .modal__body{height:var(--swirl-modal-height)}}.modal__header{border-bottom:var(--s-border-width-default) solid var(--s-border-default)}@media (min-width: 768px){.modal__header{border-bottom:var(--s-border-width-default) solid transparent}}.modal__header-bar{display:flex;height:3.5rem;padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);flex-shrink:0;align-items:center;gap:var(--s-space-8)}@media (min-width: 768px){.modal__header-bar{height:var(--swirl-modal-header-height);padding-top:var(--s-space-12);padding-right:var(--s-space-24);padding-bottom:var(--s-space-12);padding-left:var(--s-space-24);flex-direction:row-reverse}}.modal__fullscreen-button{display:none}@media (min-width: 768px){.modal__fullscreen-button{display:block}}.modal__header-tools{display:none;padding-right:var(--s-space-16);padding-left:var(--s-space-16);border-bottom:var(--s-border-width-default) solid var(--s-border-default)}@media (min-width: 768px){.modal__header-tools{padding-right:var(--s-space-24);padding-left:var(--s-space-24);border-bottom-color:transparent}}.modal__custom-header{display:none;flex-shrink:0;border-bottom:var(--s-border-width-default) solid var(--s-border-default)}@media (min-width: 768px){.modal__custom-header{border-bottom-color:transparent}}.modal__heading{overflow:hidden}.modal__heading .heading{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.modal__content-container{display:flex;overflow:hidden;flex-grow:1;flex-direction:column;gap:var(--s-space-24)}@media (min-width: 992px){.modal__content-container{flex-direction:row}}.modal__primary-content{display:flex;overflow:hidden;overflow-y:auto;flex-grow:1;flex-basis:100%;flex-direction:column}.modal__content{overflow-x:hidden;overflow-y:auto;height:100%}.modal__content ::slotted(*){margin:0}.modal__secondary-content{display:none;overflow:visible;overflow-x:hidden;overflow-y:auto;max-width:none;max-height:40%;padding-right:var(--s-space-16);padding-left:var(--s-space-16)}@media (min-width: 768px){.modal__secondary-content{padding-left:var(--s-space-24)}}@media (min-width: 992px){.modal__secondary-content{overflow-x:hidden;overflow-y:auto;max-width:var(--swirl-modal-max-secondary-content-width);max-height:none;padding-right:var(--s-space-24);padding-bottom:var(--s-space-16);padding-left:0;flex-basis:50%;flex-grow:1}}.modal__custom-footer{flex-shrink:0}.modal__controls{display:flex;padding:var(--swirl-modal-footer-padding-small);flex-shrink:0;justify-content:flex-end}@media (min-width: 768px){.modal__controls{padding:var(--swirl-modal-footer-padding-large)}}.modal--has-secondary-content.modal--has-sidebar-content:not(.modal--fullscreen) .modal__body{max-width:calc(\n var(--swirl-modal-max-width) + var(--swirl-modal-sidebar-width) +\n var(--swirl-modal-max-secondary-content-width)\n )}@keyframes modal-scale-in{from{transform:scale(0)}to{transform:scale(1)}}@keyframes modal-backdrop-fade-in{from{opacity:0}to{opacity:1}}@keyframes modal-fade-out{from{opacity:1}to{opacity:0}}@keyframes modal-drawer-slide-in{from{transform:translate3d(100%, 0, 0)}to{transform:translate3d(0, 0, 0)}}@keyframes modal-drawer-slide-out{from{transform:translate3d(0, 0, 0)}to{transform:translate3d(100%, 0, 0)}}';export{m as swirl_modal}
|