@maggioli-design-system/mds-modal 5.3.0 → 5.5.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/{index-6f236cfa.js → index-a263ff04.js} +139 -101
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mds-modal.cjs.entry.js +35 -4
- package/dist/cjs/mds-modal.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +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 +171 -73
- 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 +47 -2
- package/dist/esm/{index-f8d2dee4.js → index-efd0657a.js} +139 -101
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mds-modal.entry.js +35 -4
- package/dist/esm/mds-modal.js +4 -4
- package/dist/esm-es5/index-efd0657a.js +1 -0
- 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/mds-modal.js +1 -1
- package/dist/mds-modal/p-26971abb.js +2 -0
- package/dist/mds-modal/p-52bb21e4.system.entry.js +1 -0
- package/dist/mds-modal/p-785b3b47.system.js +2 -0
- package/dist/mds-modal/p-96b782c7.system.js +1 -0
- package/dist/mds-modal/p-df986a83.entry.js +1 -0
- package/dist/stats.json +100 -33
- 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 +62 -2
- package/package.json +4 -4
- 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/css/mds-modal-animate-bottom-left.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-bottom-right.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-bottom.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-center.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-left.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-right.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-top-left.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-top-right.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-top.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate.css +4 -4
- package/src/components/mds-modal/css/mds-modal-pref-animation.css +14 -23
- package/src/components/mds-modal/css/mds-modal-pref-contrast.css +5 -13
- package/src/components/mds-modal/css/mds-modal-pref-theme.css +6 -15
- package/src/components/mds-modal/mds-modal.css +9 -6
- 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 -46
- package/src/tailwind/fouc.css +118 -0
- package/src/tailwind/index.css +4 -0
- package/src/type/keyboard.ts +93 -0
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/mds-modal.js +1 -1
- package/www/build/p-26971abb.js +2 -0
- package/www/build/p-52bb21e4.system.entry.js +1 -0
- package/www/build/p-785b3b47.system.js +2 -0
- package/www/build/p-96b782c7.system.js +1 -0
- package/www/build/p-df986a83.entry.js +1 -0
- package/dist/esm-es5/index-f8d2dee4.js +0 -1
- package/dist/mds-modal/p-413a00c5.entry.js +0 -1
- package/dist/mds-modal/p-96958acc.system.entry.js +0 -1
- package/dist/mds-modal/p-bc1fa4e4.system.js +0 -2
- package/dist/mds-modal/p-c6899cb0.system.js +0 -1
- package/dist/mds-modal/p-ee90f86a.js +0 -2
- package/www/build/p-413a00c5.entry.js +0 -1
- package/www/build/p-96958acc.system.entry.js +0 -1
- package/www/build/p-bc1fa4e4.system.js +0 -2
- package/www/build/p-c6899cb0.system.js +0 -1
- package/www/build/p-ee90f86a.js +0 -2
|
@@ -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 = {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const keyboardKeyNameDictionary = [
|
|
2
|
+
'0',
|
|
3
|
+
'1',
|
|
4
|
+
'2',
|
|
5
|
+
'3',
|
|
6
|
+
'4',
|
|
7
|
+
'5',
|
|
8
|
+
'6',
|
|
9
|
+
'7',
|
|
10
|
+
'8',
|
|
11
|
+
'9',
|
|
12
|
+
'a',
|
|
13
|
+
'alt',
|
|
14
|
+
'altleft',
|
|
15
|
+
'altright',
|
|
16
|
+
'arrowdown',
|
|
17
|
+
'arrowleft',
|
|
18
|
+
'arrowright',
|
|
19
|
+
'arrowup',
|
|
20
|
+
'b',
|
|
21
|
+
'backspace',
|
|
22
|
+
'c',
|
|
23
|
+
'capslock',
|
|
24
|
+
'command',
|
|
25
|
+
'commandleft',
|
|
26
|
+
'commandright',
|
|
27
|
+
'control',
|
|
28
|
+
'controlleft',
|
|
29
|
+
'controlright',
|
|
30
|
+
'd',
|
|
31
|
+
'delete',
|
|
32
|
+
'e',
|
|
33
|
+
'end',
|
|
34
|
+
'enter',
|
|
35
|
+
'escape',
|
|
36
|
+
'f',
|
|
37
|
+
'f1',
|
|
38
|
+
'f10',
|
|
39
|
+
'f11',
|
|
40
|
+
'f12',
|
|
41
|
+
'f2',
|
|
42
|
+
'f3',
|
|
43
|
+
'f4',
|
|
44
|
+
'f5',
|
|
45
|
+
'f6',
|
|
46
|
+
'f7',
|
|
47
|
+
'f8',
|
|
48
|
+
'f9',
|
|
49
|
+
'g',
|
|
50
|
+
'h',
|
|
51
|
+
'home',
|
|
52
|
+
'i',
|
|
53
|
+
'j',
|
|
54
|
+
'k',
|
|
55
|
+
'l',
|
|
56
|
+
'm',
|
|
57
|
+
'n',
|
|
58
|
+
'o',
|
|
59
|
+
'option',
|
|
60
|
+
'optionleft',
|
|
61
|
+
'optionright',
|
|
62
|
+
'p',
|
|
63
|
+
'pagedown',
|
|
64
|
+
'pageup',
|
|
65
|
+
'q',
|
|
66
|
+
'r',
|
|
67
|
+
's',
|
|
68
|
+
'shift',
|
|
69
|
+
'shiftleft',
|
|
70
|
+
'shiftright',
|
|
71
|
+
'space',
|
|
72
|
+
't',
|
|
73
|
+
'tab',
|
|
74
|
+
'u',
|
|
75
|
+
'v',
|
|
76
|
+
'w',
|
|
77
|
+
'windows',
|
|
78
|
+
'windowsleft',
|
|
79
|
+
'windowsright',
|
|
80
|
+
'x',
|
|
81
|
+
'y',
|
|
82
|
+
'z',
|
|
83
|
+
];
|
|
84
|
+
export { keyboardKeyNameDictionary, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,7 +12,7 @@ const cssDurationToMilliseconds = (duration, defaultValue = 1000) => {
|
|
|
12
12
|
return defaultValue;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
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";
|
|
15
|
+
const mdsModalCss = "@-webkit-keyframes focus-bounce{0%,75%,100%{outline-offset:var(--magma-outline-focus-offset, 6px)}50%{outline-offset:var(--magma-outline-blur-offset, 2px)}}@keyframes focus-bounce{0%,75%,100%{outline-offset:var(--magma-outline-focus-offset, 6px)}50%{outline-offset:var(--magma-outline-blur-offset, 2px)}}@tailwind components; :host{--mds-modal-overlay-color:var(--magma-overlay-color, 0 0 0);--mds-modal-overlay-opacity:var(--magma-overlay-opacity, 0.5);--mds-modal-transition-duration:500ms;--mds-modal-transition-intro-ease:cubic-bezier(0.19, 1, 0.22, 1);--mds-modal-transition-outro-ease:cubic-bezier(0.86, 0, 0.07, 1);--mds-modal-window-background:rgb(var(--tone-neutral));--mds-modal-window-overflow:auto;--mds-modal-window-radius:0;--mds-modal-window-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);--mds-modal-window-distance:0;--mds-modal-custom-window-distance:1.5rem;--mds-modal-z-index:var(--magma-modal-z-index);-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1);-ms-flex-align:center;align-items:center;background-color:rgba(var(--mds-modal-overlay-color) / 0);display:-ms-flexbox;display:flex;fill:rgb(var(--tone-neutral));inset:0;-ms-flex-pack:center;justify-content:center;-webkit-perspective:600px;perspective:600px;pointer-events:none;position:fixed;-webkit-transition-duration:var(--mds-modal-transition-duration);transition-duration:var(--mds-modal-transition-duration);-webkit-transition-property:background-color;transition-property:background-color;z-index:var(--mds-modal-z-index, 1000)}:host ::slotted([slot=\"window\"]){margin:var(--mds-modal-custom-window-distance)}:host([position=\"top\"]){-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center}:host([position=\"bottom\"]){-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:center;justify-content:center}.action-close{border-radius:100px;opacity:0;pointer-events:none;position:absolute;-webkit-transition-duration:var(--mds-modal-transition-duration);transition-duration:var(--mds-modal-transition-duration);-webkit-transition-property:bottom, opacity, top, -webkit-transform;transition-property:bottom, opacity, top, -webkit-transform;transition-property:bottom, opacity, top, transform;transition-property:bottom, opacity, top, transform, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host([opened]:not([opened=\"false\"])) .action-close{opacity:1;pointer-events:auto}.action-close::part(icon){height:2.25rem;width:2.25rem}.window{gap:0rem;background-color:var(--mds-modal-window-background);border-radius:var(--mds-modal-window-radius);-webkit-box-shadow:var(--mds-modal-window-shadow);box-shadow:var(--mds-modal-window-shadow);display:grid;grid-template-rows:1fr;margin:var(--mds-modal-window-distance);overflow:var(--mds-modal-window-overflow)}.window--top{grid-template-rows:auto 1fr}.window--bottom{grid-template-rows:1fr auto}.window--top-bottom{grid-template-rows:auto 1fr auto}:host .window{-webkit-transition-delay:0s, calc(var(--mds-modal-transition-duration) / 2);transition-delay:0s, calc(var(--mds-modal-transition-duration) / 2)}:host([opened]:not([opened=\"false\"])){background-color:rgba(var(--mds-modal-overlay-color) / var(--mds-modal-overlay-opacity));pointer-events:auto}:host .window,:host>::slotted([slot=\"window\"]){opacity:0;-webkit-transition-duration:var(--mds-modal-transition-duration);transition-duration:var(--mds-modal-transition-duration);-webkit-transition-property:opacity, -webkit-transform;transition-property:opacity, -webkit-transform;transition-property:transform, opacity;transition-property:transform, opacity, -webkit-transform;-webkit-transition-timing-function:var(--mds-modal-transition-outro-ease);transition-timing-function:var(--mds-modal-transition-outro-ease)}:host([opened]:not([opened=\"false\"])) .window,:host([opened]:not([opened=\"false\"]))>::slotted([slot=\"window\"]){opacity:1;-webkit-transform:rotate(0) scale(1) translateY(0);transform:rotate(0) scale(1) translateY(0);-webkit-transition-delay:0s;transition-delay:0s;-webkit-transition-timing-function:var(--mds-modal-transition-intro-ease);transition-timing-function:var(--mds-modal-transition-intro-ease)}:host([position=\"bottom-left\"]){-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:start;justify-content:flex-start}:host([position=\"bottom\"]) .window{height:auto;width:100vw}:host([position=\"bottom-left\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"bottom-left\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);transform:rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%)}:host([position=\"bottom-left\"][opened=\"false\"]) .window,:host([position=\"bottom-left\"]:not([opened])) .window{-webkit-transform:translate(0, 100%);transform:translate(0, 100%)}:host([position=\"bottom-right\"]){-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:end;justify-content:flex-end}:host([position=\"bottom\"]) .window{height:auto;width:100vw}:host([position=\"bottom-right\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"bottom-right\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);transform:rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%)}:host([position=\"bottom-right\"][opened=\"false\"]) .window,:host([position=\"bottom-right\"]:not([opened])) .window{-webkit-transform:translate(0, 100%);transform:translate(0, 100%)}:host([position=\"bottom\"]){-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:center;justify-content:center}:host([position=\"bottom\"]) .window{height:auto;width:100vw}:host([position=\"bottom\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"bottom\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(22deg) rotateY(0) scale(0.5) translate(0, 80%);transform:rotateX(22deg) rotateY(0) scale(0.5) translate(0, 80%)}:host([position=\"bottom\"][opened=\"false\"]) .window,:host([position=\"bottom\"]:not([opened])) .window{-webkit-transform:translate(0, 100%);transform:translate(0, 100%)}:host([position=\"center\"]){-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host([position=\"center\"]) .window{-webkit-transition-delay:0s;transition-delay:0s}:host([position=\"center\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"center\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(0) rotateY(22deg) scale(0.5) translate(0, 40%);transform:rotateX(0) rotateY(22deg) scale(0.5) translate(0, 40%)}:host([position=\"center\"][opened=\"false\"]) .window,:host([position=\"center\"]:not([opened])) .window{-webkit-transform:rotateX(0) rotateY(0) scale(0.5) translate(0, 0);transform:rotateX(0) rotateY(0) scale(0.5) translate(0, 0)}:host([position=\"left\"]){-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start}:host([position=\"left\"]) .window{height:100%;max-height:calc(100dvh - calc(var(--mds-modal-window-distance) * 2));max-width:calc(100vw - 80px)}:host([position=\"left\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"left\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(0) rotateY(22deg) rotateZ(0) scale(0.5) translate(-100%, 0%);transform:rotateX(0) rotateY(22deg) rotateZ(0) scale(0.5) translate(-100%, 0%)}:host([position=\"left\"][opened=\"false\"]) .window,:host([position=\"left\"]:not([opened])) .window{-webkit-transform:translate(-100%, 0%);transform:translate(-100%, 0%)}:host([position=\"left\"]) .action-close{right:0.75rem;top:0.75rem;-webkit-transform:translateX(-120%) rotate(-45deg);transform:translateX(-120%) rotate(-45deg)}:host([position=\"left\"][opened]:not([opened=\"false\"])) .action-close{-webkit-transform:translateX(0);transform:translateX(0)}:host([position=\"right\"]){-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}:host([position=\"right\"]) .window{height:100%;max-height:calc(100dvh - calc(var(--mds-modal-window-distance) * 2));max-width:calc(100vw - 80px)}:host([position=\"right\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"right\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(0) rotateY(-22deg) rotateZ(0) scale(0.5) translate(100%, 0%);transform:rotateX(0) rotateY(-22deg) rotateZ(0) scale(0.5) translate(100%, 0%)}:host([position=\"right\"][opened=\"false\"]) .window,:host([position=\"right\"]:not([opened])) .window{-webkit-transform:translate(100%, 0%);transform:translate(100%, 0%)}:host([position=\"right\"]) .action-close{left:0.75rem;top:0.75rem;-webkit-transform:translateX(120%) rotate(45deg);transform:translateX(120%) rotate(45deg)}:host([position=\"right\"][opened]:not([opened=\"false\"])) .action-close{-webkit-transform:translateX(0);transform:translateX(0)}:host([position=\"top-left\"]){-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:start;justify-content:flex-start}:host([position=\"bottom\"]) .window{height:auto;width:100vw}:host([position=\"top-left\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"top-left\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%);transform:rotateX(22deg) rotateY(22deg) scale(0.5) translate(-80%, 80%)}:host([position=\"top-left\"][opened=\"false\"]) .window,:host([position=\"top-left\"]:not([opened])) .window{-webkit-transform:translate(0, -100%);transform:translate(0, -100%)}:host([position=\"top-right\"]){-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:end;justify-content:flex-end}:host([position=\"bottom\"]) .window{height:auto;width:100vw}:host([position=\"top-right\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"top-right\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%);transform:rotateX(-22deg) rotateY(-22deg) scale(0.5) translate(80%, 80%)}:host([position=\"top-right\"][opened=\"false\"]) .window,:host([position=\"top-right\"]:not([opened])) .window{-webkit-transform:translate(0, 100%);transform:translate(0, 100%)}:host([position=\"top\"]){-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center}:host([position=\"bottom\"]) .window{height:auto;width:100vw}:host([position=\"top\"][opened=\"false\"])>::slotted([slot=\"window\"]),:host([position=\"top\"]:not([opened]))>::slotted([slot=\"window\"]){-webkit-transform:rotateX(-22deg) rotateY(0) scale(0.5) translate(0, -80%);transform:rotateX(-22deg) rotateY(0) scale(0.5) translate(0, -80%)}:host([position=\"top\"][opened=\"false\"]) .window,:host([position=\"top\"]:not([opened])) .window{-webkit-transform:translate(0, -100%);transform:translate(0, -100%)}:host-context(.pref-animation-reduce){--mds-modal-transition-duration:0s}:host-context(.pref-animation-reduce),:host-context(.pref-animation-reduce) .action-close,:host-context(.pref-animation-reduce) .window{-webkit-transition-duration:0s !important;transition-duration:0s !important}@media (prefers-reduced-motion){:host-context(.pref-animation-system){--mds-modal-transition-duration:0s}:host-context(.pref-animation-system),:host-context(.pref-animation-system) .action-close,:host-context(.pref-animation-system) .window{-webkit-transition-duration:0s !important;transition-duration:0s !important}}:host-context(.pref-contrast-more){--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)}@media (prefers-contrast: more){:host-context(.pref-contrast-system){--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)}}:host-context(.pref-theme-dark){--mds-modal-window-background:rgb(var(--tone-neutral-09));--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)}@media (prefers-color-scheme: dark){:host-context(.pref-theme-system){--mds-modal-window-background:rgb(var(--tone-neutral-09));--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)}}:host(:not(:is([hydrated],.hydrated))){-webkit-animation-duration:0s;animation-duration:0s;border-color:transparent;-webkit-box-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;opacity:0;outline-color:transparent;-webkit-transition-delay:0s;transition-delay:0s;-webkit-transition-duration:0s;transition-duration:0s;visibility:hidden}mds-accordion:not(:is([hydrated],.hydrated)),mds-accordion-item:not(:is([hydrated],.hydrated)),mds-accordion-timer:not(:is([hydrated],.hydrated)),mds-accordion-timer-item:not(:is([hydrated],.hydrated)),mds-author:not(:is([hydrated],.hydrated)),mds-avatar:not(:is([hydrated],.hydrated)),mds-badge:not(:is([hydrated],.hydrated)),mds-banner:not(:is([hydrated],.hydrated)),mds-benchmark-bar:not(:is([hydrated],.hydrated)),mds-bibliography:not(:is([hydrated],.hydrated)),mds-breadcrumb:not(:is([hydrated],.hydrated)),mds-breadcrumb-item:not(:is([hydrated],.hydrated)),mds-button:not(:is([hydrated],.hydrated)),mds-card:not(:is([hydrated],.hydrated)),mds-card-content:not(:is([hydrated],.hydrated)),mds-card-footer:not(:is([hydrated],.hydrated)),mds-card-header:not(:is([hydrated],.hydrated)),mds-card-media:not(:is([hydrated],.hydrated)),mds-chip:not(:is([hydrated],.hydrated)),mds-details:not(:is([hydrated],.hydrated)),mds-dropdown:not(:is([hydrated],.hydrated)),mds-entity:not(:is([hydrated],.hydrated)),mds-file:not(:is([hydrated],.hydrated)),mds-file-preview:not(:is([hydrated],.hydrated)),mds-filter:not(:is([hydrated],.hydrated)),mds-filter-item:not(:is([hydrated],.hydrated)),mds-header:not(:is([hydrated],.hydrated)),mds-header-bar:not(:is([hydrated],.hydrated)),mds-help:not(:is([hydrated],.hydrated)),mds-horizontal-scroll:not(:is([hydrated],.hydrated)),mds-hr:not(:is([hydrated],.hydrated)),mds-icon:not(:is([hydrated],.hydrated)),mds-img:not(:is([hydrated],.hydrated)),mds-input:not(:is([hydrated],.hydrated)),mds-input-field:not(:is([hydrated],.hydrated)),mds-input-range:not(:is([hydrated],.hydrated)),mds-input-select:not(:is([hydrated],.hydrated)),mds-input-switch:not(:is([hydrated],.hydrated)),mds-input-tip:not(:is([hydrated],.hydrated)),mds-input-tip-item:not(:is([hydrated],.hydrated)),mds-input-upload:not(:is([hydrated],.hydrated)),mds-keyboard:not(:is([hydrated],.hydrated)),mds-keyboard-key:not(:is([hydrated],.hydrated)),mds-kpi:not(:is([hydrated],.hydrated)),mds-kpi-item:not(:is([hydrated],.hydrated)),mds-label:not(:is([hydrated],.hydrated)),mds-list:not(:is([hydrated],.hydrated)),mds-list-item:not(:is([hydrated],.hydrated)),mds-modal:not(:is([hydrated],.hydrated)),mds-note:not(:is([hydrated],.hydrated)),mds-notification:not(:is([hydrated],.hydrated)),mds-paginator:not(:is([hydrated],.hydrated)),mds-paginator-item:not(:is([hydrated],.hydrated)),mds-pref:not(:is([hydrated],.hydrated)),mds-pref-animation:not(:is([hydrated],.hydrated)),mds-pref-consumption:not(:is([hydrated],.hydrated)),mds-pref-contrast:not(:is([hydrated],.hydrated)),mds-pref-language:not(:is([hydrated],.hydrated)),mds-pref-language-item:not(:is([hydrated],.hydrated)),mds-pref-theme:not(:is([hydrated],.hydrated)),mds-price-table:not(:is([hydrated],.hydrated)),mds-price-table-features:not(:is([hydrated],.hydrated)),mds-price-table-features-cell:not(:is([hydrated],.hydrated)),mds-price-table-features-row:not(:is([hydrated],.hydrated)),mds-price-table-header:not(:is([hydrated],.hydrated)),mds-price-table-list:not(:is([hydrated],.hydrated)),mds-price-table-list-item:not(:is([hydrated],.hydrated)),mds-progress:not(:is([hydrated],.hydrated)),mds-push-notification:not(:is([hydrated],.hydrated)),mds-push-notifications:not(:is([hydrated],.hydrated)),mds-quote:not(:is([hydrated],.hydrated)),mds-separator:not(:is([hydrated],.hydrated)),mds-spinner:not(:is([hydrated],.hydrated)),mds-stepper-bar:not(:is([hydrated],.hydrated)),mds-stepper-bar-item:not(:is([hydrated],.hydrated)),mds-tab:not(:is([hydrated],.hydrated)),mds-tab-bar:not(:is([hydrated],.hydrated)),mds-tab-bar-item:not(:is([hydrated],.hydrated)),mds-tab-item:not(:is([hydrated],.hydrated)),mds-table:not(:is([hydrated],.hydrated)),mds-table-body:not(:is([hydrated],.hydrated)),mds-table-cell:not(:is([hydrated],.hydrated)),mds-table-footer:not(:is([hydrated],.hydrated)),mds-table-header:not(:is([hydrated],.hydrated)),mds-table-header-cell:not(:is([hydrated],.hydrated)),mds-table-row:not(:is([hydrated],.hydrated)),mds-text:not(:is([hydrated],.hydrated)),mds-toast:not(:is([hydrated],.hydrated)),mds-tooltip:not(:is([hydrated],.hydrated)),mds-tree:not(:is([hydrated],.hydrated)),mds-tree-item:not(:is([hydrated],.hydrated)),mds-url-view:not(:is([hydrated],.hydrated)),mds-usage:not(:is([hydrated],.hydrated)),mds-video-wall:not(:is([hydrated],.hydrated)),mds-zero:not(:is([hydrated],.hydrated)){-webkit-animation-duration:0s;animation-duration:0s;border-color:transparent;-webkit-box-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;opacity:0;outline-color:transparent;-webkit-transition-delay:0s;transition-delay:0s;-webkit-transition-duration:0s;transition-duration:0s;visibility:hidden}";
|
|
16
16
|
const MdsModalStyle0 = mdsModalCss;
|
|
17
17
|
|
|
18
18
|
const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLElement {
|
|
@@ -37,6 +37,10 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
37
37
|
* Specifies if the component is animating itself or not
|
|
38
38
|
*/
|
|
39
39
|
this.animating = 'none';
|
|
40
|
+
/**
|
|
41
|
+
* Specifies if the component prevents the body from scrolling when modal window is opened
|
|
42
|
+
*/
|
|
43
|
+
this.overflow = 'auto';
|
|
40
44
|
this.updateCSSCustomProps = () => {
|
|
41
45
|
var _a;
|
|
42
46
|
if (typeof window === 'undefined')
|
|
@@ -55,6 +59,24 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
55
59
|
this.hideEvent.emit();
|
|
56
60
|
clearTimeout(this.animationDelayTimeout);
|
|
57
61
|
};
|
|
62
|
+
this.disableOverflow = () => {
|
|
63
|
+
if (document) {
|
|
64
|
+
if (document.body.style.overflow) {
|
|
65
|
+
this.bodyOverflow = document.body.style.overflow;
|
|
66
|
+
}
|
|
67
|
+
document.body.style.overflow = 'hidden';
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
this.enableOverflow = () => {
|
|
71
|
+
if (document) {
|
|
72
|
+
if (this.bodyOverflow) {
|
|
73
|
+
document.body.style.overflow = this.bodyOverflow;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
document.body.style.removeProperty('overflow');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
58
80
|
this.animateOpenWindow = () => {
|
|
59
81
|
this.animating = 'intro';
|
|
60
82
|
clearTimeout(this.animationDelayTimeout);
|
|
@@ -81,6 +103,9 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
81
103
|
this.bottom = this.host.querySelector('[slot="bottom"]') !== null;
|
|
82
104
|
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
83
105
|
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
106
|
+
if (this.overflow === 'auto' && this.opened) {
|
|
107
|
+
this.disableOverflow();
|
|
108
|
+
}
|
|
84
109
|
if (this.window) {
|
|
85
110
|
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'dialog');
|
|
86
111
|
}
|
|
@@ -93,9 +118,15 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
93
118
|
}
|
|
94
119
|
handleOpenProp(newValue) {
|
|
95
120
|
if (newValue) {
|
|
121
|
+
if (this.overflow === 'auto') {
|
|
122
|
+
this.disableOverflow();
|
|
123
|
+
}
|
|
96
124
|
this.animateOpenWindow();
|
|
97
125
|
return;
|
|
98
126
|
}
|
|
127
|
+
if (this.overflow === 'auto') {
|
|
128
|
+
this.enableOverflow();
|
|
129
|
+
}
|
|
99
130
|
this.animateCloseWindow();
|
|
100
131
|
}
|
|
101
132
|
onModalCloseListener() {
|
|
@@ -105,11 +136,11 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
105
136
|
this.opened = false;
|
|
106
137
|
}
|
|
107
138
|
render() {
|
|
108
|
-
return (h(Host, { key: '
|
|
139
|
+
return (h(Host, { key: '7c55fe13070b89c43efcc7168dbdb8d07b749b8a', "aria-modal": clsx(this.opened ? 'true' : 'false'), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
109
140
|
? h("slot", { name: "window" })
|
|
110
141
|
: h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), part: "window" }, this.top &&
|
|
111
142
|
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
112
|
-
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: '
|
|
143
|
+
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); } })));
|
|
113
144
|
}
|
|
114
145
|
get host() { return this; }
|
|
115
146
|
static get watchers() { return {
|
|
@@ -119,7 +150,8 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
119
150
|
}, [1, "mds-modal", {
|
|
120
151
|
"opened": [1540],
|
|
121
152
|
"position": [1537],
|
|
122
|
-
"animating": [1537]
|
|
153
|
+
"animating": [1537],
|
|
154
|
+
"overflow": [513]
|
|
123
155
|
}, [[4, "mdsModalClose", "onModalCloseListener"], [4, "mdsBannerClose", "onBannerCloseListener"]], {
|
|
124
156
|
"opened": ["handleOpenProp"]
|
|
125
157
|
}]);
|
package/dist/documentation.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2025-
|
|
2
|
+
"timestamp": "2025-03-05T16:48:31",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.27.2",
|
|
6
6
|
"typescriptVersion": "5.5.4"
|
|
7
7
|
},
|
|
8
8
|
"components": [
|
|
@@ -97,6 +97,41 @@
|
|
|
97
97
|
"getter": false,
|
|
98
98
|
"setter": false
|
|
99
99
|
},
|
|
100
|
+
{
|
|
101
|
+
"name": "overflow",
|
|
102
|
+
"type": "\"auto\" | \"manual\"",
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "ModalOverflowType",
|
|
105
|
+
"resolved": "\"auto\" | \"manual\"",
|
|
106
|
+
"references": {
|
|
107
|
+
"ModalOverflowType": {
|
|
108
|
+
"location": "import",
|
|
109
|
+
"path": "./meta/types",
|
|
110
|
+
"id": "src/components/mds-modal/meta/types.ts::ModalOverflowType"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"mutable": false,
|
|
115
|
+
"attr": "overflow",
|
|
116
|
+
"reflectToAttr": true,
|
|
117
|
+
"docs": "Specifies if the component prevents the body from scrolling when modal window is opened",
|
|
118
|
+
"docsTags": [],
|
|
119
|
+
"default": "'auto'",
|
|
120
|
+
"values": [
|
|
121
|
+
{
|
|
122
|
+
"value": "auto",
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"value": "manual",
|
|
127
|
+
"type": "string"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"optional": false,
|
|
131
|
+
"required": false,
|
|
132
|
+
"getter": false,
|
|
133
|
+
"setter": false
|
|
134
|
+
},
|
|
100
135
|
{
|
|
101
136
|
"name": "position",
|
|
102
137
|
"type": "\"bottom\" | \"bottom-left\" | \"bottom-right\" | \"center\" | \"left\" | \"right\" | \"top\" | \"top-left\" | \"top-right\" | undefined",
|
|
@@ -215,6 +250,11 @@
|
|
|
215
250
|
"annotation": "prop",
|
|
216
251
|
"docs": "Set the color of the close icon button to the top left."
|
|
217
252
|
},
|
|
253
|
+
{
|
|
254
|
+
"name": "--mds-modal-custom-window-distance",
|
|
255
|
+
"annotation": "prop",
|
|
256
|
+
"docs": "Set the distance between the slotted modal window and the screen bounds"
|
|
257
|
+
},
|
|
218
258
|
{
|
|
219
259
|
"name": "--mds-modal-overlay-color",
|
|
220
260
|
"annotation": "prop",
|
|
@@ -295,6 +335,11 @@
|
|
|
295
335
|
"declaration": "export type ModalAnimationStateType =\n | 'intro'\n | 'none'\n | 'outro'",
|
|
296
336
|
"docstring": "",
|
|
297
337
|
"path": "src/components/mds-modal/meta/types.ts"
|
|
338
|
+
},
|
|
339
|
+
"src/components/mds-modal/meta/types.ts::ModalOverflowType": {
|
|
340
|
+
"declaration": "export type ModalOverflowType =\n | 'auto'\n | 'manual'",
|
|
341
|
+
"docstring": "",
|
|
342
|
+
"path": "src/components/mds-modal/meta/types.ts"
|
|
298
343
|
}
|
|
299
344
|
}
|
|
300
345
|
}
|