@maggioli-design-system/mds-modal 5.3.0 → 5.4.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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mds-modal.cjs.entry.js +34 -3
- package/dist/cjs/mds-modal.cjs.js +1 -1
- package/dist/collection/common/floating-controller.js +3 -3
- package/dist/collection/common/slot.js +10 -1
- package/dist/collection/common/string.js +30 -0
- package/dist/collection/components/mds-modal/mds-modal.css +124 -0
- package/dist/collection/components/mds-modal/mds-modal.js +59 -2
- package/dist/collection/components/mds-modal/meta/dictionary.js +5 -1
- package/dist/collection/components/mds-modal/test/mds-modal.stories.js +20 -2
- package/dist/collection/dictionary/keyboard.js +84 -0
- package/dist/collection/type/keyboard.js +1 -0
- package/dist/components/mds-modal.js +36 -4
- package/dist/documentation.json +46 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mds-modal.entry.js +34 -3
- package/dist/esm/mds-modal.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-modal.entry.js +1 -1
- package/dist/esm-es5/mds-modal.js +1 -1
- package/dist/mds-modal/mds-modal.esm.js +1 -1
- package/dist/mds-modal/p-2c91cf1f.entry.js +1 -0
- package/dist/mds-modal/p-69576bb4.system.entry.js +1 -0
- package/dist/mds-modal/p-c6899cb0.system.js +1 -1
- package/dist/stats.json +84 -16
- package/dist/types/common/slot.d.ts +2 -1
- package/dist/types/common/string.d.ts +4 -0
- package/dist/types/components/mds-modal/mds-modal.d.ts +8 -1
- package/dist/types/components/mds-modal/meta/dictionary.d.ts +2 -1
- package/dist/types/components/mds-modal/meta/types.d.ts +1 -0
- package/dist/types/components/mds-modal/test/mds-modal.stories.d.ts +11 -0
- package/dist/types/components.d.ts +10 -2
- package/dist/types/dictionary/keyboard.d.ts +2 -0
- package/dist/types/type/keyboard.d.ts +12 -0
- package/documentation.json +61 -1
- package/package.json +3 -3
- package/readme.md +18 -16
- package/src/common/floating-controller.ts +6 -6
- package/src/common/slot.ts +11 -0
- package/src/common/string.ts +42 -0
- package/src/components/mds-modal/mds-modal.css +7 -1
- package/src/components/mds-modal/mds-modal.tsx +36 -1
- package/src/components/mds-modal/meta/dictionary.ts +6 -0
- package/src/components/mds-modal/meta/types.ts +4 -0
- package/src/components/mds-modal/readme.md +18 -16
- package/src/components/mds-modal/test/mds-modal.stories.tsx +57 -3
- package/src/components.d.ts +10 -2
- package/src/dictionary/keyboard.ts +87 -0
- package/src/fixtures/icons.json +18 -1
- package/src/meta/keyboard/keys.json +83 -0
- package/src/tailwind/components.css +11 -0
- package/src/tailwind/fouc.css +118 -0
- package/src/type/keyboard.ts +93 -0
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/p-2c91cf1f.entry.js +1 -0
- package/www/build/p-69576bb4.system.entry.js +1 -0
- package/www/build/p-c6899cb0.system.js +1 -1
- package/dist/mds-modal/p-413a00c5.entry.js +0 -1
- package/dist/mds-modal/p-96958acc.system.entry.js +0 -1
- package/www/build/p-413a00c5.entry.js +0 -1
- package/www/build/p-96958acc.system.entry.js +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537],"animating":[1537]},[[4,"mdsModalClose","onModalCloseListener"],[4,"mdsBannerClose","onBannerCloseListener"]],{"opened":["handleOpenProp"]}]]]], options);
|
|
11
|
+
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537],"animating":[1537],"overflow":[513]},[[4,"mdsModalClose","onModalCloseListener"],[4,"mdsBannerClose","onBannerCloseListener"]],{"opened":["handleOpenProp"]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -16,7 +16,7 @@ const cssDurationToMilliseconds = (duration, defaultValue = 1000) => {
|
|
|
16
16
|
return defaultValue;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const mdsModalCss = "@-webkit-keyframes focus-bounce {\n 0%, 75%, 100% {\n outline-offset: var(--magma-outline-focus-offset, 6px);\n }\n\n 50% {\n outline-offset: var(--magma-outline-blur-offset, 2px);\n }\n}\n @keyframes focus-bounce {\n 0%, 75%, 100% {\n outline-offset: var(--magma-outline-focus-offset, 6px);\n }\n\n 50% {\n outline-offset: var(--magma-outline-blur-offset, 2px);\n }\n}\n /* included for focus effect */\n@tailwind components;\n@tailwind utilities;\n\n/**\n * @prop --mds-modal-close-icon-color: Set the color of the close icon button to the top left.\n * @prop --mds-modal-overlay-color: Set the overlay color of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`.\n * @prop --mds-modal-overlay-opacity: Set the overlay color opacity of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`.\n * @prop --mds-modal-window-background: Set the background color of the window\n * @prop --mds-modal-window-overflow: Set the overflow of the window\n * @prop --mds-modal-window-radius: Set the border radius of the window\n * @prop --mds-modal-window-distance: Set the distance between the modal window and the screen bounds\n * @prop --mds-modal-window-shadow: Set the box shadow of the window\n * @prop --mds-modal-z-index: Set the z-index of the window when the component is opened\n */\n\n:host {\n\n --mds-modal-overlay-color: var(--magma-overlay-color, 0 0 0);\n --mds-modal-overlay-opacity: var(--magma-overlay-opacity, 0.5);\n --mds-modal-transition-duration: 500ms;\n --mds-modal-transition-intro-ease: cubic-bezier(0.19, 1, 0.22, 1);\n --mds-modal-transition-outro-ease: cubic-bezier(0.86, 0, 0.07, 1);\n --mds-modal-window-background: rgb(var(--tone-neutral));\n --mds-modal-window-overflow: auto;\n --mds-modal-window-radius: 0;\n --mds-modal-window-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --mds-modal-window-distance: 0;\n --mds-modal-z-index: var(--magma-modal-z-index);\n -webkit-transition-timing-function: cubic-bezier(1, 0, 0, 1);\n transition-timing-function: cubic-bezier(1, 0, 0, 1);\n\n -ms-flex-align: center;\n\n align-items: center;\n background-color: rgba(var(--mds-modal-overlay-color) / 0);\n display: -ms-flexbox;\n display: flex;\n fill: rgb(var(--tone-neutral));\n inset: 0;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-perspective: 600px;\n perspective: 600px;\n pointer-events: none;\n position: fixed;\n -webkit-transition-duration: var(--mds-modal-transition-duration);\n transition-duration: var(--mds-modal-transition-duration);\n -webkit-transition-property: background-color;\n transition-property: background-color;\n z-index: var(--mds-modal-z-index, 1000);\n}\n\n:host( [position=\"top\"] ) {\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n:host( [position=\"bottom\"] ) {\n -ms-flex-align: end;\n align-items: flex-end;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.action-close {\n border-radius: 100px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n -webkit-transition-duration: var(--mds-modal-transition-duration);\n transition-duration: var(--mds-modal-transition-duration);\n -webkit-transition-property: bottom, opacity, top, -webkit-transform;\n transition-property: bottom, opacity, top, -webkit-transform;\n transition-property: bottom, opacity, top, transform;\n transition-property: bottom, opacity, top, transform, -webkit-transform;\n -webkit-transition-timing-function: cubic-bezier(1, 0, 0, 1);\n transition-timing-function: cubic-bezier(1, 0, 0, 1);\n}\n\n:host([opened]:not([opened=\"false\"])) .action-close {\n opacity: 1;\n pointer-events: auto;\n}\n\n.action-close::part(icon) {\n height: 2.25rem;\n width: 2.25rem;\n}\n\n.window {\n gap: 0rem;\n\n background-color: var(--mds-modal-window-background);\n border-radius: var(--mds-modal-window-radius);\n -webkit-box-shadow: var(--mds-modal-window-shadow);\n box-shadow: var(--mds-modal-window-shadow);\n display: grid;\n grid-template-rows: 1fr;\n margin: var(--mds-modal-window-distance);\n overflow: var(--mds-modal-window-overflow);\n}\n\n.window--top {\n grid-template-rows: auto 1fr;\n}\n\n.window--bottom {\n grid-template-rows: 1fr auto;\n}\n\n.window--top-bottom {\n grid-template-rows: auto 1fr auto;\n}\n\n:host .window {\n -webkit-transition-delay: 0s, calc(var(--mds-modal-transition-duration) / 2);\n transition-delay: 0s, calc(var(--mds-modal-transition-duration) / 2);\n}\n\n\n:host([opened]:not([opened=\"false\"]) ) {\n background-color: rgba(var(--mds-modal-overlay-color) / var(--mds-modal-overlay-opacity));\n pointer-events: auto;\n}\n\n:host .window,\n:host > ::slotted( [slot=\"window\"] ) {\n opacity: 0;\n -webkit-transition-duration: var(--mds-modal-transition-duration);\n transition-duration: var(--mds-modal-transition-duration);\n -webkit-transition-property: opacity, -webkit-transform;\n transition-property: opacity, -webkit-transform;\n transition-property: transform, opacity;\n transition-property: transform, opacity, -webkit-transform;\n -webkit-transition-timing-function: var(--mds-modal-transition-outro-ease);\n transition-timing-function: var(--mds-modal-transition-outro-ease);\n}\n\n:host([opened]:not([opened=\"false\"]) ) .window,\n:host([opened]:not([opened=\"false\"]) ) > ::slotted( [slot=\"window\"] ) {\n opacity: 1;\n -webkit-transform: rotate(0) scale(1) translateY(0);\n transform: rotate(0) scale(1) translateY(0);\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-timing-function: var(--mds-modal-transition-intro-ease);\n transition-timing-function: var(--mds-modal-transition-intro-ease);\n}\n\n:host([position=\"bottom-left\"]) {\n -ms-flex-align: end;\n align-items: flex-end;\n -ms-flex-pack: start;\n justify-content: flex-start;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"bottom-left\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"bottom-left\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);\n transform: rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);\n}\n\n:host([position=\"bottom-left\"][opened=\"false\"]) .window,\n:host([position=\"bottom-left\"]:not([opened])) .window {\n -webkit-transform: translate(0, 100%);\n transform: translate(0, 100%);\n}\n\n:host([position=\"bottom-right\"]) {\n -ms-flex-align: end;\n align-items: flex-end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"bottom-right\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"bottom-right\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);\n transform: rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);\n}\n\n:host([position=\"bottom-right\"][opened=\"false\"]) .window,\n:host([position=\"bottom-right\"]:not([opened])) .window {\n -webkit-transform: translate(0, 100%);\n transform: translate(0, 100%);\n}\n\n:host([position=\"bottom\"]) {\n -ms-flex-align: end;\n align-items: flex-end;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"bottom\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"bottom\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(22deg) rotateY(0) scale(0.5) translate(0, 80%);\n transform: rotateX(22deg) rotateY(0) scale(0.5) translate(0, 80%);\n}\n\n:host([position=\"bottom\"][opened=\"false\"]) .window,\n:host([position=\"bottom\"]:not([opened])) .window {\n -webkit-transform: translate(0, 100%);\n transform: translate(0, 100%);\n}\n\n:host([position=\"center\"]) {\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n:host([position=\"center\"]) .window {\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n:host([position=\"center\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"center\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(0) rotateY(22deg) scale(0.5) translate(0, 40%);\n transform: rotateX(0) rotateY(22deg) scale(0.5) translate(0, 40%);\n}\n\n:host([position=\"center\"][opened=\"false\"]) .window,\n:host([position=\"center\"]:not([opened])) .window {\n -webkit-transform: rotateX(0) rotateY(0) scale(0.5) translate(0, 0);\n transform: rotateX(0) rotateY(0) scale(0.5) translate(0, 0);\n}\n\n:host([position=\"left\"]) {\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: start;\n justify-content: flex-start;\n}\n\n:host([position=\"left\"]) .window {\n height: 100%;\n max-height: calc(100dvh - calc(var(--mds-modal-window-distance) * 2));\n max-width: calc(100vw - 80px);\n}\n\n:host([position=\"left\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"left\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(0) rotateY(22deg) rotateZ(0) scale(0.5) translate(-100%, 0%);\n transform: rotateX(0) rotateY(22deg) rotateZ(0) scale(0.5) translate(-100%, 0%);\n}\n\n:host([position=\"left\"][opened=\"false\"]) .window,\n:host([position=\"left\"]:not([opened])) .window {\n -webkit-transform: translate(-100%, 0%);\n transform: translate(-100%, 0%);\n}\n\n:host([position=\"left\"]) .action-close {\n right: 0.75rem;\n top: 0.75rem;\n -webkit-transform: translateX(-120%) rotate(-45deg);\n transform: translateX(-120%) rotate(-45deg);\n}\n\n:host([position=\"left\"][opened]:not([opened=\"false\"])) .action-close {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n}\n\n:host([position=\"right\"]) {\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n\n:host([position=\"right\"]) .window {\n height: 100%;\n max-height: calc(100dvh - calc(var(--mds-modal-window-distance) * 2));\n max-width: calc(100vw - 80px);\n}\n\n:host([position=\"right\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"right\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(0) rotateY(-22deg) rotateZ(0) scale(0.5) translate(100%, 0%);\n transform: rotateX(0) rotateY(-22deg) rotateZ(0) scale(0.5) translate(100%, 0%);\n}\n\n:host([position=\"right\"][opened=\"false\"]) .window,\n:host([position=\"right\"]:not([opened])) .window {\n -webkit-transform: translate(100%, 0%);\n transform: translate(100%, 0%);\n}\n\n:host([position=\"right\"]) .action-close {\n left: 0.75rem;\n top: 0.75rem;\n -webkit-transform: translateX(120%) rotate(45deg);\n transform: translateX(120%) rotate(45deg);\n}\n\n:host([position=\"right\"][opened]:not([opened=\"false\"])) .action-close {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n}\n\n:host([position=\"top-left\"]) {\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"top-left\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"top-left\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);\n transform: rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);\n}\n\n:host([position=\"top-left\"][opened=\"false\"]) .window,\n:host([position=\"top-left\"]:not([opened])) .window {\n -webkit-transform: translate(0, -100%);\n transform: translate(0, -100%);\n}\n\n:host([position=\"top-right\"]) {\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"top-right\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"top-right\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);\n transform: rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);\n}\n\n:host([position=\"top-right\"][opened=\"false\"]) .window,\n:host([position=\"top-right\"]:not([opened])) .window {\n -webkit-transform: translate(0, 100%);\n transform: translate(0, 100%);\n}\n\n:host([position=\"top\"]) {\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"top\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"top\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(-22deg) rotateY(0) scale(0.5) translate(0, -80%);\n transform: rotateX(-22deg) rotateY(0) scale(0.5) translate(0, -80%);\n}\n\n:host([position=\"top\"][opened=\"false\"]) .window,\n:host([position=\"top\"]:not([opened])) .window {\n -webkit-transform: translate(0, -100%);\n transform: translate(0, -100%);\n}\n\n@tailwind utilities;\n\n@container style(--magma-pref-animation: reduce) {\n :host,\n .action-close,\n .window {\n -webkit-transition-duration: 0s !important;\n transition-duration: 0s !important;\n }\n\n :host {\n\n --mds-modal-transition-duration: 0s;\n }\n}\n\n@container style(--magma-pref-animation: system) {\n\n @media (prefers-reduced-motion) {\n :host,\n .action-close,\n .window {\n -webkit-transition-duration: 0s !important;\n transition-duration: 0s !important;\n }\n\n :host {\n\n --mds-modal-transition-duration: 0s;\n }\n }\n}\n\n@tailwind utilities;\n\n@container style(--magma-pref-contrast: more) {\n :host {\n\n --mds-modal-window-shadow: 0 0 0 2px rgb(var(--tone-neutral-01) / 0.6), 0 25px 50px -12px rgb(0 0 0 / 0.25);\n }\n}\n\n@container style(--magma-pref-contrast: system) {\n\n @media (prefers-contrast: more) {\n :host {\n\n --mds-modal-window-shadow: 0 0 0 2px rgb(var(--tone-neutral-01) / 0.6), 0 25px 50px -12px rgb(0 0 0 / 0.25);\n }\n }\n}\n\n@container style(--magma-pref-theme: dark) {\n :host {\n\n --mds-modal-window-background: rgb(var(--tone-neutral-09));\n --mds-modal-window-shadow: 0 0 0 1px rgb(var(--tone-neutral-01) / 0.3), 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n }\n}\n\n@container style(--magma-pref-theme: system) {\n\n @media (prefers-color-scheme: dark) {\n :host {\n\n --mds-modal-window-background: rgb(var(--tone-neutral-09));\n --mds-modal-window-shadow: 0 0 0 1px rgb(var(--tone-neutral-01) / 0.3), 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n }\n }\n}\n\n\n";
|
|
19
|
+
const mdsModalCss = "@-webkit-keyframes focus-bounce {\n 0%, 75%, 100% {\n outline-offset: var(--magma-outline-focus-offset, 6px);\n }\n\n 50% {\n outline-offset: var(--magma-outline-blur-offset, 2px);\n }\n}\n @keyframes focus-bounce {\n 0%, 75%, 100% {\n outline-offset: var(--magma-outline-focus-offset, 6px);\n }\n\n 50% {\n outline-offset: var(--magma-outline-blur-offset, 2px);\n }\n}\n /* included for focus effect */\n@tailwind components;\n@tailwind utilities;\n\n/**\n * @prop --mds-modal-close-icon-color: Set the color of the close icon button to the top left.\n * @prop --mds-modal-overlay-color: Set the overlay color of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`.\n * @prop --mds-modal-overlay-opacity: Set the overlay color opacity of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`.\n * @prop --mds-modal-window-background: Set the background color of the window\n * @prop --mds-modal-window-overflow: Set the overflow of the window\n * @prop --mds-modal-window-radius: Set the border radius of the window\n * @prop --mds-modal-window-distance: Set the distance between the modal window and the screen bounds\n * @prop --mds-modal-custom-window-distance: Set the distance between the slotted modal window and the screen bounds\n * @prop --mds-modal-window-shadow: Set the box shadow of the window\n * @prop --mds-modal-z-index: Set the z-index of the window when the component is opened\n */\n\n:host {\n\n --mds-modal-overlay-color: var(--magma-overlay-color, 0 0 0);\n --mds-modal-overlay-opacity: var(--magma-overlay-opacity, 0.5);\n --mds-modal-transition-duration: 500ms;\n --mds-modal-transition-intro-ease: cubic-bezier(0.19, 1, 0.22, 1);\n --mds-modal-transition-outro-ease: cubic-bezier(0.86, 0, 0.07, 1);\n --mds-modal-window-background: rgb(var(--tone-neutral));\n --mds-modal-window-overflow: auto;\n --mds-modal-window-radius: 0;\n --mds-modal-window-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --mds-modal-window-distance: 0;\n --mds-modal-custom-window-distance: 1.5rem;\n --mds-modal-z-index: var(--magma-modal-z-index);\n -webkit-transition-timing-function: cubic-bezier(1, 0, 0, 1);\n transition-timing-function: cubic-bezier(1, 0, 0, 1);\n\n -ms-flex-align: center;\n\n align-items: center;\n background-color: rgba(var(--mds-modal-overlay-color) / 0);\n display: -ms-flexbox;\n display: flex;\n fill: rgb(var(--tone-neutral));\n inset: 0;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-perspective: 600px;\n perspective: 600px;\n pointer-events: none;\n position: fixed;\n -webkit-transition-duration: var(--mds-modal-transition-duration);\n transition-duration: var(--mds-modal-transition-duration);\n -webkit-transition-property: background-color;\n transition-property: background-color;\n z-index: var(--mds-modal-z-index, 1000);\n}\n\n:host ::slotted([slot=\"window\"]) {\n margin: var(--mds-modal-custom-window-distance);\n}\n\n:host( [position=\"top\"] ) {\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n:host( [position=\"bottom\"] ) {\n -ms-flex-align: end;\n align-items: flex-end;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.action-close {\n border-radius: 100px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n -webkit-transition-duration: var(--mds-modal-transition-duration);\n transition-duration: var(--mds-modal-transition-duration);\n -webkit-transition-property: bottom, opacity, top, -webkit-transform;\n transition-property: bottom, opacity, top, -webkit-transform;\n transition-property: bottom, opacity, top, transform;\n transition-property: bottom, opacity, top, transform, -webkit-transform;\n -webkit-transition-timing-function: cubic-bezier(1, 0, 0, 1);\n transition-timing-function: cubic-bezier(1, 0, 0, 1);\n}\n\n:host([opened]:not([opened=\"false\"])) .action-close {\n opacity: 1;\n pointer-events: auto;\n}\n\n.action-close::part(icon) {\n height: 2.25rem;\n width: 2.25rem;\n}\n\n.window {\n gap: 0rem;\n\n background-color: var(--mds-modal-window-background);\n border-radius: var(--mds-modal-window-radius);\n -webkit-box-shadow: var(--mds-modal-window-shadow);\n box-shadow: var(--mds-modal-window-shadow);\n display: grid;\n grid-template-rows: 1fr;\n margin: var(--mds-modal-window-distance);\n overflow: var(--mds-modal-window-overflow);\n}\n\n.window--top {\n grid-template-rows: auto 1fr;\n}\n\n.window--bottom {\n grid-template-rows: 1fr auto;\n}\n\n.window--top-bottom {\n grid-template-rows: auto 1fr auto;\n}\n\n:host .window {\n -webkit-transition-delay: 0s, calc(var(--mds-modal-transition-duration) / 2);\n transition-delay: 0s, calc(var(--mds-modal-transition-duration) / 2);\n}\n\n\n:host([opened]:not([opened=\"false\"]) ) {\n background-color: rgba(var(--mds-modal-overlay-color) / var(--mds-modal-overlay-opacity));\n pointer-events: auto;\n}\n\n:host .window,\n:host > ::slotted( [slot=\"window\"] ) {\n opacity: 0;\n -webkit-transition-duration: var(--mds-modal-transition-duration);\n transition-duration: var(--mds-modal-transition-duration);\n -webkit-transition-property: opacity, -webkit-transform;\n transition-property: opacity, -webkit-transform;\n transition-property: transform, opacity;\n transition-property: transform, opacity, -webkit-transform;\n -webkit-transition-timing-function: var(--mds-modal-transition-outro-ease);\n transition-timing-function: var(--mds-modal-transition-outro-ease);\n}\n\n:host([opened]:not([opened=\"false\"]) ) .window,\n:host([opened]:not([opened=\"false\"]) ) > ::slotted( [slot=\"window\"] ) {\n opacity: 1;\n -webkit-transform: rotate(0) scale(1) translateY(0);\n transform: rotate(0) scale(1) translateY(0);\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-timing-function: var(--mds-modal-transition-intro-ease);\n transition-timing-function: var(--mds-modal-transition-intro-ease);\n}\n\n:host([position=\"bottom-left\"]) {\n -ms-flex-align: end;\n align-items: flex-end;\n -ms-flex-pack: start;\n justify-content: flex-start;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"bottom-left\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"bottom-left\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);\n transform: rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);\n}\n\n:host([position=\"bottom-left\"][opened=\"false\"]) .window,\n:host([position=\"bottom-left\"]:not([opened])) .window {\n -webkit-transform: translate(0, 100%);\n transform: translate(0, 100%);\n}\n\n:host([position=\"bottom-right\"]) {\n -ms-flex-align: end;\n align-items: flex-end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"bottom-right\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"bottom-right\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);\n transform: rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);\n}\n\n:host([position=\"bottom-right\"][opened=\"false\"]) .window,\n:host([position=\"bottom-right\"]:not([opened])) .window {\n -webkit-transform: translate(0, 100%);\n transform: translate(0, 100%);\n}\n\n:host([position=\"bottom\"]) {\n -ms-flex-align: end;\n align-items: flex-end;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"bottom\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"bottom\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(22deg) rotateY(0) scale(0.5) translate(0, 80%);\n transform: rotateX(22deg) rotateY(0) scale(0.5) translate(0, 80%);\n}\n\n:host([position=\"bottom\"][opened=\"false\"]) .window,\n:host([position=\"bottom\"]:not([opened])) .window {\n -webkit-transform: translate(0, 100%);\n transform: translate(0, 100%);\n}\n\n:host([position=\"center\"]) {\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n:host([position=\"center\"]) .window {\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n:host([position=\"center\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"center\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(0) rotateY(22deg) scale(0.5) translate(0, 40%);\n transform: rotateX(0) rotateY(22deg) scale(0.5) translate(0, 40%);\n}\n\n:host([position=\"center\"][opened=\"false\"]) .window,\n:host([position=\"center\"]:not([opened])) .window {\n -webkit-transform: rotateX(0) rotateY(0) scale(0.5) translate(0, 0);\n transform: rotateX(0) rotateY(0) scale(0.5) translate(0, 0);\n}\n\n:host([position=\"left\"]) {\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: start;\n justify-content: flex-start;\n}\n\n:host([position=\"left\"]) .window {\n height: 100%;\n max-height: calc(100dvh - calc(var(--mds-modal-window-distance) * 2));\n max-width: calc(100vw - 80px);\n}\n\n:host([position=\"left\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"left\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(0) rotateY(22deg) rotateZ(0) scale(0.5) translate(-100%, 0%);\n transform: rotateX(0) rotateY(22deg) rotateZ(0) scale(0.5) translate(-100%, 0%);\n}\n\n:host([position=\"left\"][opened=\"false\"]) .window,\n:host([position=\"left\"]:not([opened])) .window {\n -webkit-transform: translate(-100%, 0%);\n transform: translate(-100%, 0%);\n}\n\n:host([position=\"left\"]) .action-close {\n right: 0.75rem;\n top: 0.75rem;\n -webkit-transform: translateX(-120%) rotate(-45deg);\n transform: translateX(-120%) rotate(-45deg);\n}\n\n:host([position=\"left\"][opened]:not([opened=\"false\"])) .action-close {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n}\n\n:host([position=\"right\"]) {\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n\n:host([position=\"right\"]) .window {\n height: 100%;\n max-height: calc(100dvh - calc(var(--mds-modal-window-distance) * 2));\n max-width: calc(100vw - 80px);\n}\n\n:host([position=\"right\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"right\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(0) rotateY(-22deg) rotateZ(0) scale(0.5) translate(100%, 0%);\n transform: rotateX(0) rotateY(-22deg) rotateZ(0) scale(0.5) translate(100%, 0%);\n}\n\n:host([position=\"right\"][opened=\"false\"]) .window,\n:host([position=\"right\"]:not([opened])) .window {\n -webkit-transform: translate(100%, 0%);\n transform: translate(100%, 0%);\n}\n\n:host([position=\"right\"]) .action-close {\n left: 0.75rem;\n top: 0.75rem;\n -webkit-transform: translateX(120%) rotate(45deg);\n transform: translateX(120%) rotate(45deg);\n}\n\n:host([position=\"right\"][opened]:not([opened=\"false\"])) .action-close {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n}\n\n:host([position=\"top-left\"]) {\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"top-left\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"top-left\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);\n transform: rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);\n}\n\n:host([position=\"top-left\"][opened=\"false\"]) .window,\n:host([position=\"top-left\"]:not([opened])) .window {\n -webkit-transform: translate(0, -100%);\n transform: translate(0, -100%);\n}\n\n:host([position=\"top-right\"]) {\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"top-right\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"top-right\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);\n transform: rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);\n}\n\n:host([position=\"top-right\"][opened=\"false\"]) .window,\n:host([position=\"top-right\"]:not([opened])) .window {\n -webkit-transform: translate(0, 100%);\n transform: translate(0, 100%);\n}\n\n:host([position=\"top\"]) {\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n:host([position=\"bottom\"]) .window {\n height: auto;\n width: 100vw;\n}\n\n:host([position=\"top\"][opened=\"false\"]) > ::slotted( [slot=\"window\"] ),\n:host([position=\"top\"]:not([opened])) > ::slotted( [slot=\"window\"] ) {\n -webkit-transform: rotateX(-22deg) rotateY(0) scale(0.5) translate(0, -80%);\n transform: rotateX(-22deg) rotateY(0) scale(0.5) translate(0, -80%);\n}\n\n:host([position=\"top\"][opened=\"false\"]) .window,\n:host([position=\"top\"]:not([opened])) .window {\n -webkit-transform: translate(0, -100%);\n transform: translate(0, -100%);\n}\n\n@tailwind utilities;\n\n@container style(--magma-pref-animation: reduce) {\n :host,\n .action-close,\n .window {\n -webkit-transition-duration: 0s !important;\n transition-duration: 0s !important;\n }\n\n :host {\n\n --mds-modal-transition-duration: 0s;\n }\n}\n\n@container style(--magma-pref-animation: system) {\n\n @media (prefers-reduced-motion) {\n :host,\n .action-close,\n .window {\n -webkit-transition-duration: 0s !important;\n transition-duration: 0s !important;\n }\n\n :host {\n\n --mds-modal-transition-duration: 0s;\n }\n }\n}\n\n@tailwind utilities;\n\n@container style(--magma-pref-contrast: more) {\n :host {\n\n --mds-modal-window-shadow: 0 0 0 2px rgb(var(--tone-neutral-01) / 0.6), 0 25px 50px -12px rgb(0 0 0 / 0.25);\n }\n}\n\n@container style(--magma-pref-contrast: system) {\n\n @media (prefers-contrast: more) {\n :host {\n\n --mds-modal-window-shadow: 0 0 0 2px rgb(var(--tone-neutral-01) / 0.6), 0 25px 50px -12px rgb(0 0 0 / 0.25);\n }\n }\n}\n\n@container style(--magma-pref-theme: dark) {\n :host {\n\n --mds-modal-window-background: rgb(var(--tone-neutral-09));\n --mds-modal-window-shadow: 0 0 0 1px rgb(var(--tone-neutral-01) / 0.3), 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n }\n}\n\n@container style(--magma-pref-theme: system) {\n\n @media (prefers-color-scheme: dark) {\n :host {\n\n --mds-modal-window-background: rgb(var(--tone-neutral-09));\n --mds-modal-window-shadow: 0 0 0 1px rgb(var(--tone-neutral-01) / 0.3), 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n }\n }\n}\n\n:host(:not(:is([hydrated], .hydrated))) {\n -webkit-animation-duration: 0s;\n animation-duration: 0s;\n border-color: transparent;\n -webkit-box-shadow: 0 0 0 transparent;\n box-shadow: 0 0 0 transparent;\n opacity: 0;\n outline-color: transparent;\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n visibility: hidden;\n}\n\n/* TODO refact(stencil): Uses only used selector from parent shadowDOM component */\n\nmds-accordion:not(:is([hydrated], .hydrated)),\nmds-accordion-item:not(:is([hydrated], .hydrated)),\nmds-accordion-timer:not(:is([hydrated], .hydrated)),\nmds-accordion-timer-item:not(:is([hydrated], .hydrated)),\nmds-author:not(:is([hydrated], .hydrated)),\nmds-avatar:not(:is([hydrated], .hydrated)),\nmds-badge:not(:is([hydrated], .hydrated)),\nmds-banner:not(:is([hydrated], .hydrated)),\nmds-benchmark-bar:not(:is([hydrated], .hydrated)),\nmds-bibliography:not(:is([hydrated], .hydrated)),\nmds-breadcrumb:not(:is([hydrated], .hydrated)),\nmds-breadcrumb-item:not(:is([hydrated], .hydrated)),\nmds-button:not(:is([hydrated], .hydrated)),\nmds-card:not(:is([hydrated], .hydrated)),\nmds-card-content:not(:is([hydrated], .hydrated)),\nmds-card-footer:not(:is([hydrated], .hydrated)),\nmds-card-header:not(:is([hydrated], .hydrated)),\nmds-card-media:not(:is([hydrated], .hydrated)),\nmds-chip:not(:is([hydrated], .hydrated)),\nmds-details:not(:is([hydrated], .hydrated)),\nmds-dropdown:not(:is([hydrated], .hydrated)),\nmds-entity:not(:is([hydrated], .hydrated)),\nmds-file:not(:is([hydrated], .hydrated)),\nmds-file-preview:not(:is([hydrated], .hydrated)),\nmds-filter:not(:is([hydrated], .hydrated)),\nmds-filter-item:not(:is([hydrated], .hydrated)),\nmds-header:not(:is([hydrated], .hydrated)),\nmds-header-bar:not(:is([hydrated], .hydrated)),\nmds-help:not(:is([hydrated], .hydrated)),\nmds-horizontal-scroll:not(:is([hydrated], .hydrated)),\nmds-hr:not(:is([hydrated], .hydrated)),\nmds-icon:not(:is([hydrated], .hydrated)),\nmds-img:not(:is([hydrated], .hydrated)),\nmds-input:not(:is([hydrated], .hydrated)),\nmds-input-field:not(:is([hydrated], .hydrated)),\nmds-input-range:not(:is([hydrated], .hydrated)),\nmds-input-select:not(:is([hydrated], .hydrated)),\nmds-input-switch:not(:is([hydrated], .hydrated)),\nmds-input-tip:not(:is([hydrated], .hydrated)),\nmds-input-tip-item:not(:is([hydrated], .hydrated)),\nmds-input-upload:not(:is([hydrated], .hydrated)),\nmds-keyboard:not(:is([hydrated], .hydrated)),\nmds-keyboard-key:not(:is([hydrated], .hydrated)),\nmds-kpi:not(:is([hydrated], .hydrated)),\nmds-kpi-item:not(:is([hydrated], .hydrated)),\nmds-label:not(:is([hydrated], .hydrated)),\nmds-list:not(:is([hydrated], .hydrated)),\nmds-list-item:not(:is([hydrated], .hydrated)),\nmds-modal:not(:is([hydrated], .hydrated)),\nmds-note:not(:is([hydrated], .hydrated)),\nmds-notification:not(:is([hydrated], .hydrated)),\nmds-paginator:not(:is([hydrated], .hydrated)),\nmds-paginator-item:not(:is([hydrated], .hydrated)),\nmds-pref:not(:is([hydrated], .hydrated)),\nmds-pref-animation:not(:is([hydrated], .hydrated)),\nmds-pref-consumption:not(:is([hydrated], .hydrated)),\nmds-pref-contrast:not(:is([hydrated], .hydrated)),\nmds-pref-language:not(:is([hydrated], .hydrated)),\nmds-pref-language-item:not(:is([hydrated], .hydrated)),\nmds-pref-theme:not(:is([hydrated], .hydrated)),\nmds-price-table:not(:is([hydrated], .hydrated)),\nmds-price-table-features:not(:is([hydrated], .hydrated)),\nmds-price-table-features-cell:not(:is([hydrated], .hydrated)),\nmds-price-table-features-row:not(:is([hydrated], .hydrated)),\nmds-price-table-header:not(:is([hydrated], .hydrated)),\nmds-price-table-list:not(:is([hydrated], .hydrated)),\nmds-price-table-list-item:not(:is([hydrated], .hydrated)),\nmds-progress:not(:is([hydrated], .hydrated)),\nmds-push-notification:not(:is([hydrated], .hydrated)),\nmds-push-notifications:not(:is([hydrated], .hydrated)),\nmds-quote:not(:is([hydrated], .hydrated)),\nmds-separator:not(:is([hydrated], .hydrated)),\nmds-spinner:not(:is([hydrated], .hydrated)),\nmds-stepper-bar:not(:is([hydrated], .hydrated)),\nmds-stepper-bar-item:not(:is([hydrated], .hydrated)),\nmds-tab:not(:is([hydrated], .hydrated)),\nmds-tab-bar:not(:is([hydrated], .hydrated)),\nmds-tab-bar-item:not(:is([hydrated], .hydrated)),\nmds-tab-item:not(:is([hydrated], .hydrated)),\nmds-table:not(:is([hydrated], .hydrated)),\nmds-table-body:not(:is([hydrated], .hydrated)),\nmds-table-cell:not(:is([hydrated], .hydrated)),\nmds-table-footer:not(:is([hydrated], .hydrated)),\nmds-table-header:not(:is([hydrated], .hydrated)),\nmds-table-header-cell:not(:is([hydrated], .hydrated)),\nmds-table-row:not(:is([hydrated], .hydrated)),\nmds-text:not(:is([hydrated], .hydrated)),\nmds-toast:not(:is([hydrated], .hydrated)),\nmds-tooltip:not(:is([hydrated], .hydrated)),\nmds-tree:not(:is([hydrated], .hydrated)),\nmds-tree-item:not(:is([hydrated], .hydrated)),\nmds-url-view:not(:is([hydrated], .hydrated)),\nmds-usage:not(:is([hydrated], .hydrated)),\nmds-video-wall:not(:is([hydrated], .hydrated)),\nmds-zero:not(:is([hydrated], .hydrated))\n{\n -webkit-animation-duration: 0s;\n animation-duration: 0s;\n border-color: transparent;\n -webkit-box-shadow: 0 0 0 transparent;\n box-shadow: 0 0 0 transparent;\n opacity: 0;\n outline-color: transparent;\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n visibility: hidden;\n}\n\n";
|
|
20
20
|
const MdsModalStyle0 = mdsModalCss;
|
|
21
21
|
|
|
22
22
|
const MdsModal = class {
|
|
@@ -39,6 +39,10 @@ const MdsModal = class {
|
|
|
39
39
|
* Specifies if the component is animating itself or not
|
|
40
40
|
*/
|
|
41
41
|
this.animating = 'none';
|
|
42
|
+
/**
|
|
43
|
+
* Specifies if the component prevents the body from scrolling when modal window is opened
|
|
44
|
+
*/
|
|
45
|
+
this.overflow = 'auto';
|
|
42
46
|
this.updateCSSCustomProps = () => {
|
|
43
47
|
var _a;
|
|
44
48
|
if (typeof window === 'undefined')
|
|
@@ -57,6 +61,24 @@ const MdsModal = class {
|
|
|
57
61
|
this.hideEvent.emit();
|
|
58
62
|
clearTimeout(this.animationDelayTimeout);
|
|
59
63
|
};
|
|
64
|
+
this.disableOverflow = () => {
|
|
65
|
+
if (document) {
|
|
66
|
+
if (document.body.style.overflow) {
|
|
67
|
+
this.bodyOverflow = document.body.style.overflow;
|
|
68
|
+
}
|
|
69
|
+
document.body.style.overflow = 'hidden';
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
this.enableOverflow = () => {
|
|
73
|
+
if (document) {
|
|
74
|
+
if (this.bodyOverflow) {
|
|
75
|
+
document.body.style.overflow = this.bodyOverflow;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
document.body.style.removeProperty('overflow');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
60
82
|
this.animateOpenWindow = () => {
|
|
61
83
|
this.animating = 'intro';
|
|
62
84
|
clearTimeout(this.animationDelayTimeout);
|
|
@@ -83,6 +105,9 @@ const MdsModal = class {
|
|
|
83
105
|
this.bottom = this.host.querySelector('[slot="bottom"]') !== null;
|
|
84
106
|
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
85
107
|
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
108
|
+
if (this.overflow === 'auto' && this.opened) {
|
|
109
|
+
this.disableOverflow();
|
|
110
|
+
}
|
|
86
111
|
if (this.window) {
|
|
87
112
|
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'dialog');
|
|
88
113
|
}
|
|
@@ -95,9 +120,15 @@ const MdsModal = class {
|
|
|
95
120
|
}
|
|
96
121
|
handleOpenProp(newValue) {
|
|
97
122
|
if (newValue) {
|
|
123
|
+
if (this.overflow === 'auto') {
|
|
124
|
+
this.disableOverflow();
|
|
125
|
+
}
|
|
98
126
|
this.animateOpenWindow();
|
|
99
127
|
return;
|
|
100
128
|
}
|
|
129
|
+
if (this.overflow === 'auto') {
|
|
130
|
+
this.enableOverflow();
|
|
131
|
+
}
|
|
101
132
|
this.animateCloseWindow();
|
|
102
133
|
}
|
|
103
134
|
onModalCloseListener() {
|
|
@@ -107,11 +138,11 @@ const MdsModal = class {
|
|
|
107
138
|
this.opened = false;
|
|
108
139
|
}
|
|
109
140
|
render() {
|
|
110
|
-
return (index.h(index.Host, { key: '
|
|
141
|
+
return (index.h(index.Host, { key: '7c55fe13070b89c43efcc7168dbdb8d07b749b8a', "aria-modal": clsx(this.opened ? 'true' : 'false'), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
111
142
|
? index.h("slot", { name: "window" })
|
|
112
143
|
: index.h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), part: "window" }, this.top &&
|
|
113
144
|
index.h("slot", { name: "top" }), index.h("slot", null), this.bottom &&
|
|
114
|
-
index.h("slot", { name: "bottom" })), !this.window && index.h("mds-button", { key: '
|
|
145
|
+
index.h("slot", { name: "bottom" })), !this.window && index.h("mds-button", { key: 'e9b3c0037f8a0cf2fc3b284dc02b2f7b16bbe205', class: "action-close", icon: "mi/baseline/close", variant: "light", tone: "quiet", size: "xl", onClick: (e) => { this.closeModal(e); } })));
|
|
115
146
|
}
|
|
116
147
|
get host() { return index.getElement(this); }
|
|
117
148
|
static get watchers() { return {
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537],"animating":[1537]},[[4,"mdsModalClose","onModalCloseListener"],[4,"mdsBannerClose","onBannerCloseListener"]],{"opened":["handleOpenProp"]}]]]], options);
|
|
22
|
+
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537],"animating":[1537],"overflow":[513]},[[4,"mdsModalClose","onModalCloseListener"],[4,"mdsBannerClose","onBannerCloseListener"]],{"opened":["handleOpenProp"]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -143,12 +143,12 @@ export class FloatingController {
|
|
|
143
143
|
}
|
|
144
144
|
export class Backdrop {
|
|
145
145
|
constructor(backdropId) {
|
|
146
|
-
this.defaultBackdropId = '
|
|
146
|
+
this.defaultBackdropId = 'magma-backdrop';
|
|
147
147
|
this.backdropBackgroundVisible = 'rgba(var(--magma-backdrop-color, 0 0 0) / var(--magma-backdrop-opacity, 0.1))';
|
|
148
148
|
this.backdropBackgroundHidden = 'rgba(var(--magma-backdrop-color, 0 0 0) / 0)';
|
|
149
149
|
this.backdropId = backdropId !== null && backdropId !== void 0 ? backdropId : this.defaultBackdropId;
|
|
150
|
-
this.cssBackdropZIndex = `var(--${this.backdropId}-z-index)`;
|
|
151
|
-
this.cssBackdropDuration = `var(--${this.backdropId}-duration)`;
|
|
150
|
+
this.cssBackdropZIndex = `var(--${this.backdropId}-z-index, 4000)`;
|
|
151
|
+
this.cssBackdropDuration = `var(--${this.backdropId}-animation-duration, 300ms)`;
|
|
152
152
|
}
|
|
153
153
|
attachBackdrop() {
|
|
154
154
|
if (!this.backdropEl) {
|
|
@@ -16,4 +16,13 @@ const hasSlottedNodes = (el, name) => {
|
|
|
16
16
|
}
|
|
17
17
|
return false;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
const hasSlotted = (el, name) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
|
|
22
|
+
const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
|
|
23
|
+
if (slot) {
|
|
24
|
+
return slot.assignedNodes().length > 0 || slot.assignedElements().length > 0;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
export { hasSlottedElements, hasSlottedNodes, hasSlotted, };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const levenshteinDistance = (a, b) => {
|
|
2
|
+
const dp = Array.from({ length: a.length + 1 }, (_, i) =>
|
|
3
|
+
// eslint-disable-next-line no-nested-ternary
|
|
4
|
+
Array.from({ length: b.length + 1 }, (_, j) => (i === 0 ? j : j === 0 ? i : 0)));
|
|
5
|
+
for (let i = 1; i <= a.length; i++) {
|
|
6
|
+
for (let j = 1; j <= b.length; j++) {
|
|
7
|
+
if (a[i - 1] === b[j - 1]) {
|
|
8
|
+
dp[i][j] = dp[i - 1][j - 1];
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
dp[i][j] = 1 + Math.min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return dp[a.length][b.length];
|
|
16
|
+
};
|
|
17
|
+
const closest = (input, validCodes) => {
|
|
18
|
+
let [closest] = validCodes;
|
|
19
|
+
let minDistance = levenshteinDistance(input, closest);
|
|
20
|
+
for (const code of validCodes) {
|
|
21
|
+
const distance = levenshteinDistance(input, code);
|
|
22
|
+
if (distance < minDistance) {
|
|
23
|
+
minDistance = distance;
|
|
24
|
+
closest = code;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return closest;
|
|
28
|
+
};
|
|
29
|
+
const firstLetterUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
30
|
+
export { closest, firstLetterUppercase, levenshteinDistance, };
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* @prop --mds-modal-window-overflow: Set the overflow of the window
|
|
20
20
|
* @prop --mds-modal-window-radius: Set the border radius of the window
|
|
21
21
|
* @prop --mds-modal-window-distance: Set the distance between the modal window and the screen bounds
|
|
22
|
+
* @prop --mds-modal-custom-window-distance: Set the distance between the slotted modal window and the screen bounds
|
|
22
23
|
* @prop --mds-modal-window-shadow: Set the box shadow of the window
|
|
23
24
|
* @prop --mds-modal-z-index: Set the z-index of the window when the component is opened
|
|
24
25
|
*/
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
--mds-modal-window-radius: 0;
|
|
36
37
|
--mds-modal-window-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
|
|
37
38
|
--mds-modal-window-distance: 0;
|
|
39
|
+
--mds-modal-custom-window-distance: 1.5rem;
|
|
38
40
|
--mds-modal-z-index: var(--magma-modal-z-index);
|
|
39
41
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
40
42
|
|
|
@@ -52,6 +54,10 @@
|
|
|
52
54
|
z-index: var(--mds-modal-z-index, 1000);
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
:host ::slotted([slot="window"]) {
|
|
58
|
+
margin: var(--mds-modal-custom-window-distance);
|
|
59
|
+
}
|
|
60
|
+
|
|
55
61
|
:host( [position="top"] ) {
|
|
56
62
|
align-items: flex-start;
|
|
57
63
|
justify-content: center;
|
|
@@ -402,4 +408,122 @@
|
|
|
402
408
|
}
|
|
403
409
|
}
|
|
404
410
|
|
|
411
|
+
:host(:not(:is([hydrated], .hydrated))) {
|
|
412
|
+
animation-duration: 0s;
|
|
413
|
+
border-color: transparent;
|
|
414
|
+
box-shadow: 0 0 0 transparent;
|
|
415
|
+
opacity: 0;
|
|
416
|
+
outline-color: transparent;
|
|
417
|
+
transition-delay: 0s;
|
|
418
|
+
transition-duration: 0s;
|
|
419
|
+
visibility: hidden;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/* TODO refact(stencil): Uses only used selector from parent shadowDOM component */
|
|
423
|
+
|
|
424
|
+
mds-accordion:not(:is([hydrated], .hydrated)),
|
|
425
|
+
mds-accordion-item:not(:is([hydrated], .hydrated)),
|
|
426
|
+
mds-accordion-timer:not(:is([hydrated], .hydrated)),
|
|
427
|
+
mds-accordion-timer-item:not(:is([hydrated], .hydrated)),
|
|
428
|
+
mds-author:not(:is([hydrated], .hydrated)),
|
|
429
|
+
mds-avatar:not(:is([hydrated], .hydrated)),
|
|
430
|
+
mds-badge:not(:is([hydrated], .hydrated)),
|
|
431
|
+
mds-banner:not(:is([hydrated], .hydrated)),
|
|
432
|
+
mds-benchmark-bar:not(:is([hydrated], .hydrated)),
|
|
433
|
+
mds-bibliography:not(:is([hydrated], .hydrated)),
|
|
434
|
+
mds-breadcrumb:not(:is([hydrated], .hydrated)),
|
|
435
|
+
mds-breadcrumb-item:not(:is([hydrated], .hydrated)),
|
|
436
|
+
mds-button:not(:is([hydrated], .hydrated)),
|
|
437
|
+
mds-card:not(:is([hydrated], .hydrated)),
|
|
438
|
+
mds-card-content:not(:is([hydrated], .hydrated)),
|
|
439
|
+
mds-card-footer:not(:is([hydrated], .hydrated)),
|
|
440
|
+
mds-card-header:not(:is([hydrated], .hydrated)),
|
|
441
|
+
mds-card-media:not(:is([hydrated], .hydrated)),
|
|
442
|
+
mds-chip:not(:is([hydrated], .hydrated)),
|
|
443
|
+
mds-details:not(:is([hydrated], .hydrated)),
|
|
444
|
+
mds-dropdown:not(:is([hydrated], .hydrated)),
|
|
445
|
+
mds-entity:not(:is([hydrated], .hydrated)),
|
|
446
|
+
mds-file:not(:is([hydrated], .hydrated)),
|
|
447
|
+
mds-file-preview:not(:is([hydrated], .hydrated)),
|
|
448
|
+
mds-filter:not(:is([hydrated], .hydrated)),
|
|
449
|
+
mds-filter-item:not(:is([hydrated], .hydrated)),
|
|
450
|
+
mds-header:not(:is([hydrated], .hydrated)),
|
|
451
|
+
mds-header-bar:not(:is([hydrated], .hydrated)),
|
|
452
|
+
mds-help:not(:is([hydrated], .hydrated)),
|
|
453
|
+
mds-horizontal-scroll:not(:is([hydrated], .hydrated)),
|
|
454
|
+
mds-hr:not(:is([hydrated], .hydrated)),
|
|
455
|
+
mds-icon:not(:is([hydrated], .hydrated)),
|
|
456
|
+
mds-img:not(:is([hydrated], .hydrated)),
|
|
457
|
+
mds-input:not(:is([hydrated], .hydrated)),
|
|
458
|
+
mds-input-field:not(:is([hydrated], .hydrated)),
|
|
459
|
+
mds-input-range:not(:is([hydrated], .hydrated)),
|
|
460
|
+
mds-input-select:not(:is([hydrated], .hydrated)),
|
|
461
|
+
mds-input-switch:not(:is([hydrated], .hydrated)),
|
|
462
|
+
mds-input-tip:not(:is([hydrated], .hydrated)),
|
|
463
|
+
mds-input-tip-item:not(:is([hydrated], .hydrated)),
|
|
464
|
+
mds-input-upload:not(:is([hydrated], .hydrated)),
|
|
465
|
+
mds-keyboard:not(:is([hydrated], .hydrated)),
|
|
466
|
+
mds-keyboard-key:not(:is([hydrated], .hydrated)),
|
|
467
|
+
mds-kpi:not(:is([hydrated], .hydrated)),
|
|
468
|
+
mds-kpi-item:not(:is([hydrated], .hydrated)),
|
|
469
|
+
mds-label:not(:is([hydrated], .hydrated)),
|
|
470
|
+
mds-list:not(:is([hydrated], .hydrated)),
|
|
471
|
+
mds-list-item:not(:is([hydrated], .hydrated)),
|
|
472
|
+
mds-modal:not(:is([hydrated], .hydrated)),
|
|
473
|
+
mds-note:not(:is([hydrated], .hydrated)),
|
|
474
|
+
mds-notification:not(:is([hydrated], .hydrated)),
|
|
475
|
+
mds-paginator:not(:is([hydrated], .hydrated)),
|
|
476
|
+
mds-paginator-item:not(:is([hydrated], .hydrated)),
|
|
477
|
+
mds-pref:not(:is([hydrated], .hydrated)),
|
|
478
|
+
mds-pref-animation:not(:is([hydrated], .hydrated)),
|
|
479
|
+
mds-pref-consumption:not(:is([hydrated], .hydrated)),
|
|
480
|
+
mds-pref-contrast:not(:is([hydrated], .hydrated)),
|
|
481
|
+
mds-pref-language:not(:is([hydrated], .hydrated)),
|
|
482
|
+
mds-pref-language-item:not(:is([hydrated], .hydrated)),
|
|
483
|
+
mds-pref-theme:not(:is([hydrated], .hydrated)),
|
|
484
|
+
mds-price-table:not(:is([hydrated], .hydrated)),
|
|
485
|
+
mds-price-table-features:not(:is([hydrated], .hydrated)),
|
|
486
|
+
mds-price-table-features-cell:not(:is([hydrated], .hydrated)),
|
|
487
|
+
mds-price-table-features-row:not(:is([hydrated], .hydrated)),
|
|
488
|
+
mds-price-table-header:not(:is([hydrated], .hydrated)),
|
|
489
|
+
mds-price-table-list:not(:is([hydrated], .hydrated)),
|
|
490
|
+
mds-price-table-list-item:not(:is([hydrated], .hydrated)),
|
|
491
|
+
mds-progress:not(:is([hydrated], .hydrated)),
|
|
492
|
+
mds-push-notification:not(:is([hydrated], .hydrated)),
|
|
493
|
+
mds-push-notifications:not(:is([hydrated], .hydrated)),
|
|
494
|
+
mds-quote:not(:is([hydrated], .hydrated)),
|
|
495
|
+
mds-separator:not(:is([hydrated], .hydrated)),
|
|
496
|
+
mds-spinner:not(:is([hydrated], .hydrated)),
|
|
497
|
+
mds-stepper-bar:not(:is([hydrated], .hydrated)),
|
|
498
|
+
mds-stepper-bar-item:not(:is([hydrated], .hydrated)),
|
|
499
|
+
mds-tab:not(:is([hydrated], .hydrated)),
|
|
500
|
+
mds-tab-bar:not(:is([hydrated], .hydrated)),
|
|
501
|
+
mds-tab-bar-item:not(:is([hydrated], .hydrated)),
|
|
502
|
+
mds-tab-item:not(:is([hydrated], .hydrated)),
|
|
503
|
+
mds-table:not(:is([hydrated], .hydrated)),
|
|
504
|
+
mds-table-body:not(:is([hydrated], .hydrated)),
|
|
505
|
+
mds-table-cell:not(:is([hydrated], .hydrated)),
|
|
506
|
+
mds-table-footer:not(:is([hydrated], .hydrated)),
|
|
507
|
+
mds-table-header:not(:is([hydrated], .hydrated)),
|
|
508
|
+
mds-table-header-cell:not(:is([hydrated], .hydrated)),
|
|
509
|
+
mds-table-row:not(:is([hydrated], .hydrated)),
|
|
510
|
+
mds-text:not(:is([hydrated], .hydrated)),
|
|
511
|
+
mds-toast:not(:is([hydrated], .hydrated)),
|
|
512
|
+
mds-tooltip:not(:is([hydrated], .hydrated)),
|
|
513
|
+
mds-tree:not(:is([hydrated], .hydrated)),
|
|
514
|
+
mds-tree-item:not(:is([hydrated], .hydrated)),
|
|
515
|
+
mds-url-view:not(:is([hydrated], .hydrated)),
|
|
516
|
+
mds-usage:not(:is([hydrated], .hydrated)),
|
|
517
|
+
mds-video-wall:not(:is([hydrated], .hydrated)),
|
|
518
|
+
mds-zero:not(:is([hydrated], .hydrated))
|
|
519
|
+
{
|
|
520
|
+
animation-duration: 0s;
|
|
521
|
+
border-color: transparent;
|
|
522
|
+
box-shadow: 0 0 0 transparent;
|
|
523
|
+
opacity: 0;
|
|
524
|
+
outline-color: transparent;
|
|
525
|
+
transition-delay: 0s;
|
|
526
|
+
transition-duration: 0s;
|
|
527
|
+
visibility: hidden;
|
|
528
|
+
}
|
|
405
529
|
|
|
@@ -24,6 +24,10 @@ export class MdsModal {
|
|
|
24
24
|
* Specifies if the component is animating itself or not
|
|
25
25
|
*/
|
|
26
26
|
this.animating = 'none';
|
|
27
|
+
/**
|
|
28
|
+
* Specifies if the component prevents the body from scrolling when modal window is opened
|
|
29
|
+
*/
|
|
30
|
+
this.overflow = 'auto';
|
|
27
31
|
this.updateCSSCustomProps = () => {
|
|
28
32
|
var _a;
|
|
29
33
|
if (typeof window === 'undefined')
|
|
@@ -42,6 +46,24 @@ export class MdsModal {
|
|
|
42
46
|
this.hideEvent.emit();
|
|
43
47
|
clearTimeout(this.animationDelayTimeout);
|
|
44
48
|
};
|
|
49
|
+
this.disableOverflow = () => {
|
|
50
|
+
if (document) {
|
|
51
|
+
if (document.body.style.overflow) {
|
|
52
|
+
this.bodyOverflow = document.body.style.overflow;
|
|
53
|
+
}
|
|
54
|
+
document.body.style.overflow = 'hidden';
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
this.enableOverflow = () => {
|
|
58
|
+
if (document) {
|
|
59
|
+
if (this.bodyOverflow) {
|
|
60
|
+
document.body.style.overflow = this.bodyOverflow;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
document.body.style.removeProperty('overflow');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
45
67
|
this.animateOpenWindow = () => {
|
|
46
68
|
this.animating = 'intro';
|
|
47
69
|
clearTimeout(this.animationDelayTimeout);
|
|
@@ -68,6 +90,9 @@ export class MdsModal {
|
|
|
68
90
|
this.bottom = this.host.querySelector('[slot="bottom"]') !== null;
|
|
69
91
|
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
70
92
|
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
93
|
+
if (this.overflow === 'auto' && this.opened) {
|
|
94
|
+
this.disableOverflow();
|
|
95
|
+
}
|
|
71
96
|
if (this.window) {
|
|
72
97
|
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'dialog');
|
|
73
98
|
}
|
|
@@ -80,9 +105,15 @@ export class MdsModal {
|
|
|
80
105
|
}
|
|
81
106
|
handleOpenProp(newValue) {
|
|
82
107
|
if (newValue) {
|
|
108
|
+
if (this.overflow === 'auto') {
|
|
109
|
+
this.disableOverflow();
|
|
110
|
+
}
|
|
83
111
|
this.animateOpenWindow();
|
|
84
112
|
return;
|
|
85
113
|
}
|
|
114
|
+
if (this.overflow === 'auto') {
|
|
115
|
+
this.enableOverflow();
|
|
116
|
+
}
|
|
86
117
|
this.animateCloseWindow();
|
|
87
118
|
}
|
|
88
119
|
onModalCloseListener() {
|
|
@@ -92,11 +123,11 @@ export class MdsModal {
|
|
|
92
123
|
this.opened = false;
|
|
93
124
|
}
|
|
94
125
|
render() {
|
|
95
|
-
return (h(Host, { key: '
|
|
126
|
+
return (h(Host, { key: '7c55fe13070b89c43efcc7168dbdb8d07b749b8a', "aria-modal": clsx(this.opened ? 'true' : 'false'), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
96
127
|
? h("slot", { name: "window" })
|
|
97
128
|
: h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), part: "window" }, this.top &&
|
|
98
129
|
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
99
|
-
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: '
|
|
130
|
+
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: 'e9b3c0037f8a0cf2fc3b284dc02b2f7b16bbe205', class: "action-close", icon: "mi/baseline/close", variant: "light", tone: "quiet", size: "xl", onClick: (e) => { this.closeModal(e); } })));
|
|
100
131
|
}
|
|
101
132
|
static get is() { return "mds-modal"; }
|
|
102
133
|
static get encapsulation() { return "shadow"; }
|
|
@@ -183,6 +214,32 @@ export class MdsModal {
|
|
|
183
214
|
"attribute": "animating",
|
|
184
215
|
"reflect": true,
|
|
185
216
|
"defaultValue": "'none'"
|
|
217
|
+
},
|
|
218
|
+
"overflow": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"mutable": false,
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "ModalOverflowType",
|
|
223
|
+
"resolved": "\"auto\" | \"manual\"",
|
|
224
|
+
"references": {
|
|
225
|
+
"ModalOverflowType": {
|
|
226
|
+
"location": "import",
|
|
227
|
+
"path": "./meta/types",
|
|
228
|
+
"id": "src/components/mds-modal/meta/types.ts::ModalOverflowType"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"required": false,
|
|
233
|
+
"optional": false,
|
|
234
|
+
"docs": {
|
|
235
|
+
"tags": [],
|
|
236
|
+
"text": "Specifies if the component prevents the body from scrolling when modal window is opened"
|
|
237
|
+
},
|
|
238
|
+
"getter": false,
|
|
239
|
+
"setter": false,
|
|
240
|
+
"attribute": "overflow",
|
|
241
|
+
"reflect": true,
|
|
242
|
+
"defaultValue": "'auto'"
|
|
186
243
|
}
|
|
187
244
|
};
|
|
188
245
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { modalPositionDictionary } from "../meta/dictionary";
|
|
3
|
+
import { modalPositionDictionary, modalOverflowDictionary } from "../meta/dictionary";
|
|
4
4
|
export default {
|
|
5
5
|
title: 'UI / Modal',
|
|
6
6
|
argTypes: {
|
|
@@ -8,6 +8,12 @@ export default {
|
|
|
8
8
|
description: 'Specifies if the modal is opened or not',
|
|
9
9
|
type: { name: 'boolean' },
|
|
10
10
|
},
|
|
11
|
+
overflow: {
|
|
12
|
+
description: 'Specifies if the component prevents the body from scrolling when modal window is opened',
|
|
13
|
+
control: { type: 'select' },
|
|
14
|
+
options: modalOverflowDictionary,
|
|
15
|
+
type: { name: 'string' },
|
|
16
|
+
},
|
|
11
17
|
position: {
|
|
12
18
|
control: { type: 'select' },
|
|
13
19
|
description: 'Specifies the animation position of the modal window',
|
|
@@ -20,7 +26,8 @@ const firstName = 'Mario';
|
|
|
20
26
|
const lastName = 'Rossi';
|
|
21
27
|
const fullName = `${firstName} ${lastName}`;
|
|
22
28
|
const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}@nintendo.com`;
|
|
23
|
-
const Template = args => h("mds-modal", Object.assign({}, args), h("header", { slot: "top", class: "p-800 flex gap-400 items-center border-b border-solid border-0 border-tone-neutral-09 max-w-[400px]" }, h("mds-img", { class: "w-1600", src: "
|
|
29
|
+
const Template = args => h("mds-modal", Object.assign({}, args), h("header", { slot: "top", class: "p-800 flex gap-400 items-center border-b border-solid border-0 border-tone-neutral-09 max-w-[400px]" }, h("mds-img", { class: "w-1600", src: "./logo-gruppo-maggioli-512w.webp" }), h("div", { class: "text-tone-neutral-02" }, h("mds-text", { typography: "h5", class: "truncate min-w-0" }, "Maggioli Editore"), h("mds-text", { typography: "detail", class: "truncate min-w-0" }, "Menu di servizio"))), h("div", { class: "p-800 max-w-[400px]" }, h("mds-text", null, "As a multi-brand design system, our components need to be flexible enough for any one of our brands to use them for multiple use cases. To achieve this, we ensure that all of the brands are involved in the specification stage, giving us more confidence that we\u2019re future-proofing our components as more brands adopt NewsKit.")), h("footer", { slot: "bottom", class: "p-800 flex gap-400 text-tone-neutral-02 border-t border-solid border-0 border-tone-neutral-09 max-w-[400px]" }, h("mds-author", { class: "flex-grow" }, h("mds-avatar", { slot: "avatar", class: "w-1600 mobile:w-1200", src: "./avatar-01-200x200.jpeg" }), h("mds-text", { typography: "h6" }, fullName), h("mds-text", { typography: "caption", class: "text-tone-neutral-04" }, email)), h("mds-button", { icon: "mdi/dots-vertical", variant: "light" })));
|
|
30
|
+
const TemplateOverflow = args => h("div", null, h("div", { class: "grid" }, Array(40).fill(null).map((_value, index) => (h("div", { key: index, class: "h-[100px] flex items-start justify-center text-center border-0 border-t border-solid border-t-tone-neutral-07" }, h("mds-text", { class: "px-200 py-100 rounded-b-lg bg-tone-neutral-10 border-t-0 border border-solid border-tone-neutral-07", typography: "snippet", tag: "div" }, index === 0 ? '0px' : index + '00px'))))), h("mds-modal", Object.assign({}, args), h("header", { slot: "top", class: "p-800 flex gap-400 items-center border-b border-solid border-0 border-tone-neutral-09 max-w-[400px]" }, h("mds-img", { class: "w-1600", src: "./logo-gruppo-maggioli-512w.webp" }), h("div", { class: "text-tone-neutral-02" }, h("mds-text", { typography: "h5", class: "truncate min-w-0" }, "Maggioli Editore"), h("mds-text", { typography: "detail", class: "truncate min-w-0" }, "Menu di servizio"))), h("div", { class: "p-800 max-w-[400px]" }, h("mds-text", null, "As a multi-brand design system, our components need to be flexible enough for any one of our brands to use them for multiple use cases. To achieve this, we ensure that all of the brands are involved in the specification stage, giving us more confidence that we\u2019re future-proofing our components as more brands adopt NewsKit.")), h("footer", { slot: "bottom", class: "p-800 flex gap-400 text-tone-neutral-02 border-t border-solid border-0 border-tone-neutral-09 max-w-[400px]" }, h("mds-author", { class: "flex-grow" }, h("mds-avatar", { slot: "avatar", class: "w-1600 mobile:w-1200", src: "./avatar-01-200x200.jpeg" }), h("mds-text", { typography: "h6" }, fullName), h("mds-text", { typography: "caption", class: "text-tone-neutral-04" }, email)), h("mds-button", { icon: "mdi/dots-vertical", variant: "light" }))));
|
|
24
31
|
const CustomTemplate = args => h("mds-modal", Object.assign({}, args), h("mds-banner", { slot: "window", class: "max-w-xl mx-6", deletable: true, headline: "Action required" }, h("mds-text", { typography: "detail" }, "As a multi-brand design system, our components need to be flexible enough for any one of our brands to use them for multiple use cases. To achieve this, we ensure that all of the brands are involved in the specification stage, giving us more confidence that we\u2019re future-proofing our components as more brands adopt NewsKit."), h("mds-button", { slot: "actions", variant: "primary", tone: "quiet" }, "Cancel"), h("mds-button", { slot: "actions", variant: "primary" }, "Confirm")));
|
|
25
32
|
const InteractiveTemplate = () => {
|
|
26
33
|
// Click not working with reader
|
|
@@ -31,13 +38,24 @@ const InteractiveTemplate = () => {
|
|
|
31
38
|
export const Default = Template.bind({});
|
|
32
39
|
Default.args = {
|
|
33
40
|
position: 'right',
|
|
41
|
+
opened: true,
|
|
42
|
+
};
|
|
43
|
+
export const BodyOverflowDisabled = TemplateOverflow.bind({});
|
|
44
|
+
BodyOverflowDisabled.args = {
|
|
45
|
+
overflow: 'auto',
|
|
46
|
+
opened: true,
|
|
47
|
+
position: 'right',
|
|
34
48
|
};
|
|
35
49
|
export const DefaultWindowCustomized = Template.bind({});
|
|
36
50
|
DefaultWindowCustomized.args = {
|
|
37
51
|
position: 'right',
|
|
52
|
+
opened: true,
|
|
38
53
|
style: { '--mds-modal-window-distance': '1rem', '--mds-modal-window-radius': '1rem' },
|
|
39
54
|
};
|
|
40
55
|
export const CustomWindowElement = CustomTemplate.bind({});
|
|
56
|
+
CustomWindowElement.args = {
|
|
57
|
+
opened: true,
|
|
58
|
+
};
|
|
41
59
|
export const Interactive = InteractiveTemplate.bind({});
|
|
42
60
|
export const ARIATest = CustomTemplate.bind({});
|
|
43
61
|
ARIATest.args = {
|