@maggioli-design-system/mds-modal 5.0.0 → 5.1.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/mds-modal.cjs.entry.js +5 -3
- package/dist/collection/common/aria.js +17 -1
- package/dist/collection/common/device.js +6 -0
- package/dist/collection/common/keyboard-manager.js +2 -2
- package/dist/collection/components/mds-modal/mds-modal.js +5 -3
- package/dist/collection/components/mds-modal/test/mds-modal.stories.js +8 -4
- package/dist/collection/dictionary/file-extensions.js +114 -56
- package/dist/collection/dictionary/text.js +60 -1
- package/dist/components/mds-modal.js +5 -3
- package/dist/documentation.json +1 -1
- package/dist/esm/mds-modal.entry.js +5 -3
- package/dist/esm-es5/mds-modal.entry.js +1 -1
- package/dist/mds-modal/mds-modal.esm.js +1 -1
- package/dist/mds-modal/{p-63a918d2.system.entry.js → p-2bf0fd79.system.entry.js} +1 -1
- package/dist/mds-modal/p-67c6f337.system.js +1 -1
- package/dist/mds-modal/p-fbfe7e2e.entry.js +1 -0
- package/dist/stats.json +19 -17
- package/dist/types/common/aria.d.ts +3 -1
- package/dist/types/common/device.d.ts +2 -0
- package/dist/types/components/mds-modal/test/mds-modal.stories.d.ts +1 -2
- package/dist/types/dictionary/text.d.ts +3 -1
- package/dist/types/type/text.d.ts +2 -0
- package/documentation.json +9 -4
- package/package.json +2 -2
- package/src/common/aria.ts +22 -2
- package/src/common/device.ts +9 -0
- package/src/common/keyboard-manager.ts +2 -2
- package/src/components/mds-modal/mds-modal.tsx +2 -1
- package/src/components/mds-modal/test/mds-modal.stories.tsx +8 -4
- package/src/dictionary/file-extensions.ts +115 -56
- package/src/dictionary/text.ts +64 -0
- package/src/fixtures/icons.json +8 -0
- package/src/fixtures/iconsauce.json +5 -0
- package/src/meta/file-format/locale.el.json +39 -0
- package/src/meta/file-format/locale.en.json +39 -0
- package/src/meta/file-format/locale.es.json +39 -0
- package/src/meta/file-format/locale.it.json +39 -0
- package/src/type/text.ts +59 -0
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/{p-63a918d2.system.entry.js → p-2bf0fd79.system.entry.js} +1 -1
- package/www/build/p-67c6f337.system.js +1 -1
- package/www/build/p-fbfe7e2e.entry.js +1 -0
- package/dist/mds-modal/p-67200987.entry.js +0 -1
- package/www/build/p-67200987.entry.js +0 -1
|
@@ -29,6 +29,8 @@ const MdsModal = class {
|
|
|
29
29
|
this.bottom = false;
|
|
30
30
|
this.updateCSSCustomProps = () => {
|
|
31
31
|
var _a;
|
|
32
|
+
if (typeof window === 'undefined')
|
|
33
|
+
return;
|
|
32
34
|
const elementStyles = window.getComputedStyle(this.host);
|
|
33
35
|
this.cssTransitionDuration = (_a = elementStyles.getPropertyValue('--mds-modal-transition-duration')) !== null && _a !== void 0 ? _a : '500';
|
|
34
36
|
};
|
|
@@ -73,7 +75,7 @@ const MdsModal = class {
|
|
|
73
75
|
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
74
76
|
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
75
77
|
if (this.window) {
|
|
76
|
-
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', '
|
|
78
|
+
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'dialog');
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
componentWillRender() {
|
|
@@ -96,11 +98,11 @@ const MdsModal = class {
|
|
|
96
98
|
this.opened = false;
|
|
97
99
|
}
|
|
98
100
|
render() {
|
|
99
|
-
return (index.h(index.Host, { key: '
|
|
101
|
+
return (index.h(index.Host, { key: '1d00f0a817af0b0a82eae1c790cc7e312165a46e', "aria-modal": clsx(this.opened ? 'true' : 'false'), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
100
102
|
? index.h("slot", { name: "window" })
|
|
101
103
|
: index.h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog", part: "window" }, this.top &&
|
|
102
104
|
index.h("slot", { name: "top" }), index.h("slot", null), this.bottom &&
|
|
103
|
-
index.h("slot", { name: "bottom" })), !this.window && index.h("mds-button", { key: '
|
|
105
|
+
index.h("slot", { name: "bottom" })), !this.window && index.h("mds-button", { key: 'a6435d754aec81eb79699dd693783de606d8d2ee', class: "action-close", icon: "mi/baseline/close", variant: "light", tone: "quiet", size: "xl", onClick: (e) => { this.closeModal(e); } })));
|
|
104
106
|
}
|
|
105
107
|
get host() { return index.getElement(this); }
|
|
106
108
|
static get watchers() { return {
|
|
@@ -18,6 +18,22 @@ const setAttributeIfEmpty = (element, attribute, value) => {
|
|
|
18
18
|
element.setAttribute(attribute, value);
|
|
19
19
|
return value;
|
|
20
20
|
};
|
|
21
|
+
const removeAttributesIf = (element, attribute, valueCheck = 'true', cleanAttributes) => {
|
|
22
|
+
if (ifAttribute(element, attribute, valueCheck)) {
|
|
23
|
+
const attributesList = Array.isArray(cleanAttributes) ? cleanAttributes : [cleanAttributes];
|
|
24
|
+
attributesList.forEach(attributeToRemove => {
|
|
25
|
+
element.removeAttribute(attributeToRemove);
|
|
26
|
+
});
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
const ifAttribute = (element, attribute, valueCheck = 'true') => {
|
|
32
|
+
if (element.hasAttribute(attribute) && element.getAttribute(attribute) === valueCheck) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
21
37
|
const hashValue = (value) => `${value}-${hash(value)}`;
|
|
22
38
|
const hashRandomValue = (value) => {
|
|
23
39
|
const randomValue = randomInt(1000000);
|
|
@@ -26,4 +42,4 @@ const hashRandomValue = (value) => {
|
|
|
26
42
|
}
|
|
27
43
|
return hash(randomValue.toString());
|
|
28
44
|
};
|
|
29
|
-
export {
|
|
45
|
+
export { hashRandomValue, hashValue, removeAttributesIf, setAttributeIfEmpty, ifAttribute, unslugName, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const isMobileDevice = () => {
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
|
+
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
4
|
+
return /android|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent);
|
|
5
|
+
};
|
|
6
|
+
export { isMobileDevice, };
|
|
@@ -31,13 +31,13 @@ export class KeyboardManager {
|
|
|
31
31
|
};
|
|
32
32
|
this.attachEscapeBehavior = (callback) => {
|
|
33
33
|
this.escapeCallback = callback;
|
|
34
|
-
if (window !== undefined) {
|
|
34
|
+
if (typeof window !== 'undefined') {
|
|
35
35
|
window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
this.detachEscapeBehavior = () => {
|
|
39
39
|
this.escapeCallback = () => { return; };
|
|
40
|
-
if (window !== undefined) {
|
|
40
|
+
if (typeof window !== 'undefined') {
|
|
41
41
|
window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
42
42
|
}
|
|
43
43
|
};
|
|
@@ -14,6 +14,8 @@ export class MdsModal {
|
|
|
14
14
|
this.bottom = false;
|
|
15
15
|
this.updateCSSCustomProps = () => {
|
|
16
16
|
var _a;
|
|
17
|
+
if (typeof window === 'undefined')
|
|
18
|
+
return;
|
|
17
19
|
const elementStyles = window.getComputedStyle(this.host);
|
|
18
20
|
this.cssTransitionDuration = (_a = elementStyles.getPropertyValue('--mds-modal-transition-duration')) !== null && _a !== void 0 ? _a : '500';
|
|
19
21
|
};
|
|
@@ -58,7 +60,7 @@ export class MdsModal {
|
|
|
58
60
|
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
59
61
|
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
60
62
|
if (this.window) {
|
|
61
|
-
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', '
|
|
63
|
+
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'dialog');
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
componentWillRender() {
|
|
@@ -81,11 +83,11 @@ export class MdsModal {
|
|
|
81
83
|
this.opened = false;
|
|
82
84
|
}
|
|
83
85
|
render() {
|
|
84
|
-
return (h(Host, { key: '
|
|
86
|
+
return (h(Host, { key: '1d00f0a817af0b0a82eae1c790cc7e312165a46e', "aria-modal": clsx(this.opened ? 'true' : 'false'), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
85
87
|
? h("slot", { name: "window" })
|
|
86
88
|
: h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog", part: "window" }, this.top &&
|
|
87
89
|
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
88
|
-
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: '
|
|
90
|
+
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: 'a6435d754aec81eb79699dd693783de606d8d2ee', class: "action-close", icon: "mi/baseline/close", variant: "light", tone: "quiet", size: "xl", onClick: (e) => { this.closeModal(e); } })));
|
|
89
91
|
}
|
|
90
92
|
static get is() { return "mds-modal"; }
|
|
91
93
|
static get encapsulation() { return "shadow"; }
|
|
@@ -6,13 +6,13 @@ export default {
|
|
|
6
6
|
argTypes: {
|
|
7
7
|
opened: {
|
|
8
8
|
description: 'Specifies if the modal is opened or not',
|
|
9
|
-
type: { name: 'boolean'
|
|
9
|
+
type: { name: 'boolean' },
|
|
10
10
|
},
|
|
11
11
|
position: {
|
|
12
12
|
control: { type: 'select' },
|
|
13
13
|
description: 'Specifies the animation position of the modal window',
|
|
14
14
|
options: modalPositionDictionary,
|
|
15
|
-
type: { name: 'string'
|
|
15
|
+
type: { name: 'string' },
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
};
|
|
@@ -22,7 +22,7 @@ const fullName = `${firstName} ${lastName}`;
|
|
|
22
22
|
const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}@nintendo.com`;
|
|
23
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" }, 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" }, 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" }, 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
24
|
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
|
-
const
|
|
25
|
+
const InteractiveTemplate = () => {
|
|
26
26
|
// Click not working with reader
|
|
27
27
|
const [opened, setOpened] = useState(false);
|
|
28
28
|
window.addEventListener('mdsModalClose', () => { setOpened(false); });
|
|
@@ -33,4 +33,8 @@ Default.args = {
|
|
|
33
33
|
position: 'right',
|
|
34
34
|
};
|
|
35
35
|
export const CustomWindow = CustomTemplate.bind({});
|
|
36
|
-
export const
|
|
36
|
+
export const Interactive = InteractiveTemplate.bind({});
|
|
37
|
+
export const ARIATest = CustomTemplate.bind({});
|
|
38
|
+
ARIATest.args = {
|
|
39
|
+
opened: true,
|
|
40
|
+
};
|
|
@@ -1,61 +1,119 @@
|
|
|
1
1
|
const fileExtensionsDictionary = {
|
|
2
|
-
'7z': { format: 'archive', description: '
|
|
3
|
-
ace: { format: 'archive', description: '
|
|
4
|
-
ai: { format: 'vector', description: '
|
|
5
|
-
dart: { format: 'code', description: '
|
|
6
|
-
db: { format: 'data', description: '
|
|
7
|
-
default: { format: 'attachment', description: '
|
|
8
|
-
dmg: { format: 'executable', description: '
|
|
9
|
-
doc: { format: 'text', description: '
|
|
10
|
-
docm: { format: 'text', description: '
|
|
11
|
-
docx: { format: 'text', description: '
|
|
12
|
-
eml: { format: 'email', description: '
|
|
13
|
-
eps: { format: 'vector', description: '
|
|
14
|
-
exe: { format: 'executable', description: '
|
|
15
|
-
flac: { format: 'audio', description: '
|
|
16
|
-
gif: { format: 'image', description: '
|
|
17
|
-
htm: { format: 'markup', description: '
|
|
18
|
-
heic: { format: 'image', description: '
|
|
19
|
-
html: { format: 'markup', description: '
|
|
20
|
-
jpe: { format: 'image', description: '
|
|
21
|
-
jpeg: { format: 'image', description: '
|
|
22
|
-
jpg: { format: 'image', description: '
|
|
23
|
-
js: { format: 'code', description: '
|
|
24
|
-
json: { format: 'data', description: '
|
|
25
|
-
jsx: { format: 'code', description: '
|
|
26
|
-
m2v: { format: 'video', description: '
|
|
27
|
-
mp2: { format: 'audio', description: '
|
|
28
|
-
mp3: { format: 'audio', description: '
|
|
29
|
-
mp4: { format: 'video', description: '
|
|
30
|
-
mp4v: { format: 'video', description: '
|
|
31
|
-
mpeg: { format: 'video', description: '
|
|
32
|
-
mpg4: { format: 'video', description: '
|
|
33
|
-
mpg: { format: 'video', description: '
|
|
34
|
-
mpga: { format: 'audio', description: '
|
|
35
|
-
odp: { format: 'slide', description: '
|
|
36
|
-
ods: { format: 'spreadsheet', description: '
|
|
37
|
-
odt: { format: 'text', description: '
|
|
38
|
-
pdf: { format: 'document', description: '
|
|
39
|
-
php: { format: 'code', description: '
|
|
40
|
-
png: { format: 'image', description: '
|
|
41
|
-
ppt: { format: 'slide', description: '
|
|
42
|
-
rar: { format: 'archive', description: '
|
|
43
|
-
rtf: { format: 'text', description: '
|
|
44
|
-
sass: { format: 'code', description: '
|
|
45
|
-
shtml: { format: 'markup', description: '
|
|
46
|
-
svg: { format: 'vector', description: '
|
|
47
|
-
tar: { format: 'archive', description: '
|
|
48
|
-
tiff: { format: 'image', description: '
|
|
49
|
-
ts: { format: 'code', description: '
|
|
50
|
-
tsx: { format: 'code', description: '
|
|
51
|
-
txt: { format: 'text', description: '
|
|
52
|
-
wav: { format: 'audio', description: '
|
|
53
|
-
webp: { format: 'image', description: '
|
|
54
|
-
xar: { format: 'archive', description: '
|
|
55
|
-
xls: { format: 'spreadsheet', description: '
|
|
56
|
-
xlsx: { format: 'spreadsheet', description: '
|
|
57
|
-
zip: { format: 'archive', description: '
|
|
2
|
+
'7z': { format: 'archive', description: 'compressedArchive' },
|
|
3
|
+
ace: { format: 'archive', description: 'compressedArchive' },
|
|
4
|
+
ai: { format: 'vector', description: 'fileAI' },
|
|
5
|
+
dart: { format: 'code', description: 'dart' },
|
|
6
|
+
db: { format: 'data', description: 'fileDB' },
|
|
7
|
+
default: { format: 'attachment', description: 'unknown' },
|
|
8
|
+
dmg: { format: 'executable', description: 'appleDiskImage' },
|
|
9
|
+
doc: { format: 'text', description: 'documentMS' },
|
|
10
|
+
docm: { format: 'text', description: 'documentMS' },
|
|
11
|
+
docx: { format: 'text', description: 'compressedDocumentMS' },
|
|
12
|
+
eml: { format: 'email', description: 'email' },
|
|
13
|
+
eps: { format: 'vector', description: 'fileEPS' },
|
|
14
|
+
exe: { format: 'executable', description: 'fileEXE' },
|
|
15
|
+
flac: { format: 'audio', description: 'uncompressedAudio' },
|
|
16
|
+
gif: { format: 'image', description: 'compressedImage', preview: true },
|
|
17
|
+
htm: { format: 'markup', description: 'documentWeb' },
|
|
18
|
+
heic: { format: 'image', description: 'imageHEFF' },
|
|
19
|
+
html: { format: 'markup', description: 'documentWeb' },
|
|
20
|
+
jpe: { format: 'image', description: 'compressedImage', preview: true },
|
|
21
|
+
jpeg: { format: 'image', description: 'compressedImage', preview: true },
|
|
22
|
+
jpg: { format: 'image', description: 'compressedImage', preview: true },
|
|
23
|
+
js: { format: 'code', description: 'fileJS' },
|
|
24
|
+
json: { format: 'data', description: 'fileJSON' },
|
|
25
|
+
jsx: { format: 'code', description: 'fileJS' },
|
|
26
|
+
m2v: { format: 'video', description: 'videoSD' },
|
|
27
|
+
mp2: { format: 'audio', description: 'compressedAudio' },
|
|
28
|
+
mp3: { format: 'audio', description: 'compressedAudio' },
|
|
29
|
+
mp4: { format: 'video', description: 'videoHD' },
|
|
30
|
+
mp4v: { format: 'video', description: 'videoHD' },
|
|
31
|
+
mpeg: { format: 'video', description: 'videoSD' },
|
|
32
|
+
mpg4: { format: 'video', description: 'videoSD' },
|
|
33
|
+
mpg: { format: 'video', description: 'videoSD' },
|
|
34
|
+
mpga: { format: 'audio', description: 'compressedAudio' },
|
|
35
|
+
odp: { format: 'slide', description: 'slideLO' },
|
|
36
|
+
ods: { format: 'spreadsheet', description: 'spreadsheetLO' },
|
|
37
|
+
odt: { format: 'text', description: 'documentLO' },
|
|
38
|
+
pdf: { format: 'document', description: 'documentAdobe' },
|
|
39
|
+
php: { format: 'code', description: 'filePHP' },
|
|
40
|
+
png: { format: 'image', description: 'imagePNG', preview: true },
|
|
41
|
+
ppt: { format: 'slide', description: 'slidePowerPoint' },
|
|
42
|
+
rar: { format: 'archive', description: 'compressedArchive' },
|
|
43
|
+
rtf: { format: 'text', description: 'documentRTF' },
|
|
44
|
+
sass: { format: 'code', description: 'fileSASS' },
|
|
45
|
+
shtml: { format: 'markup', description: 'documentWeb' },
|
|
46
|
+
svg: { format: 'vector', description: 'imageSVG', preview: true },
|
|
47
|
+
tar: { format: 'archive', description: 'uncompressedArchive' },
|
|
48
|
+
tiff: { format: 'image', description: 'imageTIFF' },
|
|
49
|
+
ts: { format: 'code', description: 'fileTS' },
|
|
50
|
+
tsx: { format: 'code', description: 'fileTSX' },
|
|
51
|
+
txt: { format: 'text', description: 'documentTXT' },
|
|
52
|
+
wav: { format: 'audio', description: 'uncompressedAudio' },
|
|
53
|
+
webp: { format: 'image', description: 'imageWEBP', preview: true },
|
|
54
|
+
xar: { format: 'archive', description: 'compressedArchive' },
|
|
55
|
+
xls: { format: 'spreadsheet', description: 'spreadsheetMS' },
|
|
56
|
+
xlsx: { format: 'spreadsheet', description: 'spreadsheetMS' },
|
|
57
|
+
zip: { format: 'archive', description: 'compressedArchive' },
|
|
58
58
|
};
|
|
59
|
+
// const fileExtensionsDictionary: FileExtenstion = {
|
|
60
|
+
// '7z': { format: 'archive', description: 'Archivio compresso' },
|
|
61
|
+
// ace: { format: 'archive', description: 'Archivio compresso' },
|
|
62
|
+
// ai: { format: 'vector', description: 'Vettoriale Adobe Illustrator' },
|
|
63
|
+
// dart: { format: 'code', description: 'Dart' },
|
|
64
|
+
// db: { format: 'data', description: 'File di database' },
|
|
65
|
+
// default: { format: 'attachment', description: 'Formato sconosciuto' },
|
|
66
|
+
// dmg: { format: 'executable', description: 'Apple Disk Image' },
|
|
67
|
+
// doc: { format: 'text', description: 'Documento Microsoft Word' },
|
|
68
|
+
// docm: { format: 'text', description: 'Documento Microsoft Word' },
|
|
69
|
+
// docx: { format: 'text', description: 'Documento Microsoft Word Compresso' },
|
|
70
|
+
// eml: { format: 'email', description: 'E-mail di posta elettronica' },
|
|
71
|
+
// eps: { format: 'vector', description: 'Vettoriale Corel Draw' },
|
|
72
|
+
// exe: { format: 'executable', description: 'File eseguibile Windows' },
|
|
73
|
+
// flac: { format: 'audio', description: 'Audio non compresso' },
|
|
74
|
+
// gif: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
75
|
+
// htm: { format: 'markup', description: 'Pagina web' },
|
|
76
|
+
// heic: { format: 'image', description: 'High Efficiency Image File Format' },
|
|
77
|
+
// html: { format: 'markup', description: 'Pagina web' },
|
|
78
|
+
// jpe: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
79
|
+
// jpeg: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
80
|
+
// jpg: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
81
|
+
// js: { format: 'code', description: 'JavaScript' },
|
|
82
|
+
// json: { format: 'data', description: 'JavaScript Object Notation' },
|
|
83
|
+
// jsx: { format: 'code', description: 'JavaScript' },
|
|
84
|
+
// m2v: { format: 'video', description: 'Filmato SD' },
|
|
85
|
+
// mp2: { format: 'audio', description: 'Audio compresso' },
|
|
86
|
+
// mp3: { format: 'audio', description: 'Audio compresso' },
|
|
87
|
+
// mp4: { format: 'video', description: 'Filmato HD' },
|
|
88
|
+
// mp4v: { format: 'video', description: 'Filmato HD' },
|
|
89
|
+
// mpeg: { format: 'video', description: 'Filmato SD' },
|
|
90
|
+
// mpg4: { format: 'video', description: 'Filmato SD' },
|
|
91
|
+
// mpg: { format: 'video', description: 'Filmato SD' },
|
|
92
|
+
// mpga: { format: 'audio', description: 'Audio compresso' },
|
|
93
|
+
// odp: { format: 'slide', description: 'Slide di presentazione LibreOffice' },
|
|
94
|
+
// ods: { format: 'spreadsheet', description: 'Foglio di calcolo LibreOffice' },
|
|
95
|
+
// odt: { format: 'text', description: 'File di testo LibreOffice' },
|
|
96
|
+
// pdf: { format: 'document', description: 'Documento Adobe' },
|
|
97
|
+
// php: { format: 'code', description: 'Hypertext Preprocessor' },
|
|
98
|
+
// png: { format: 'image', description: 'Immagine Portable Network Graphics', preview: true },
|
|
99
|
+
// ppt: { format: 'slide', description: 'Slide di presentazione PowerPoint' },
|
|
100
|
+
// rar: { format: 'archive', description: 'Archivio compresso' },
|
|
101
|
+
// rtf: { format: 'text', description: 'Documento di testo Rich Text Format' },
|
|
102
|
+
// sass: { format: 'code', description: 'Syntactically Awesome StyleSheets' },
|
|
103
|
+
// shtml: { format: 'markup', description: 'Pagina web' },
|
|
104
|
+
// svg: { format: 'vector', description: 'Scalable Vector Graphics', preview: true },
|
|
105
|
+
// tar: { format: 'archive', description: 'Archivio non compresso' },
|
|
106
|
+
// tiff: { format: 'image', description: 'Tag Image File Format' },
|
|
107
|
+
// ts: { format: 'code', description: 'TypeScript' },
|
|
108
|
+
// tsx: { format: 'code', description: 'TypeScript Extended Syntax' },
|
|
109
|
+
// txt: { format: 'text', description: 'Documento di testo non formattato' },
|
|
110
|
+
// wav: { format: 'audio', description: 'Audio non compresso' },
|
|
111
|
+
// webp: { format: 'image', description: 'Immagine Web Picture', preview: true },
|
|
112
|
+
// xar: { format: 'archive', description: 'Archivio compresso' },
|
|
113
|
+
// xls: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
|
|
114
|
+
// xlsx: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
|
|
115
|
+
// zip: { format: 'archive', description: 'Archivio compresso' },
|
|
116
|
+
// }
|
|
59
117
|
const genericMimeToExt = new Map([
|
|
60
118
|
['image', ['.png', '.jpg', '.jpeg', '.tiff', '.webp', '.jpe', '.gif', '.heic']],
|
|
61
119
|
['audio', ['.mp2', '.mp3', '.mpga', '.wav', '.flac']],
|
|
@@ -1,6 +1,65 @@
|
|
|
1
|
+
const typographyTagDictionary = [
|
|
2
|
+
'abbr',
|
|
3
|
+
'address',
|
|
4
|
+
'article',
|
|
5
|
+
'b',
|
|
6
|
+
'bdo',
|
|
7
|
+
'blockquote',
|
|
8
|
+
'cite',
|
|
9
|
+
'code',
|
|
10
|
+
'dd',
|
|
11
|
+
'del',
|
|
12
|
+
'details',
|
|
13
|
+
'dfn',
|
|
14
|
+
'div',
|
|
15
|
+
'dl',
|
|
16
|
+
'dt',
|
|
17
|
+
'em',
|
|
18
|
+
'figcaption',
|
|
19
|
+
'h1',
|
|
20
|
+
'h2',
|
|
21
|
+
'h3',
|
|
22
|
+
'h4',
|
|
23
|
+
'h5',
|
|
24
|
+
'h6',
|
|
25
|
+
'i',
|
|
26
|
+
'ins',
|
|
27
|
+
'kbd',
|
|
28
|
+
'label',
|
|
29
|
+
'legend',
|
|
30
|
+
'li',
|
|
31
|
+
'mark',
|
|
32
|
+
'ol',
|
|
33
|
+
'p',
|
|
34
|
+
'pre',
|
|
35
|
+
'q',
|
|
36
|
+
'rb',
|
|
37
|
+
'rt',
|
|
38
|
+
'ruby',
|
|
39
|
+
's',
|
|
40
|
+
'samp',
|
|
41
|
+
'small',
|
|
42
|
+
'span',
|
|
43
|
+
'strong',
|
|
44
|
+
'sub',
|
|
45
|
+
'summary',
|
|
46
|
+
'sup',
|
|
47
|
+
'time',
|
|
48
|
+
'u',
|
|
49
|
+
'ul',
|
|
50
|
+
'var',
|
|
51
|
+
];
|
|
52
|
+
const typographyHeadingTagDictionary = [
|
|
53
|
+
'h1',
|
|
54
|
+
'h2',
|
|
55
|
+
'h3',
|
|
56
|
+
'h4',
|
|
57
|
+
'h5',
|
|
58
|
+
'h6',
|
|
59
|
+
];
|
|
1
60
|
const truncateDictionary = [
|
|
2
61
|
'all',
|
|
3
62
|
'none',
|
|
4
63
|
'word',
|
|
5
64
|
];
|
|
6
|
-
export { truncateDictionary, };
|
|
65
|
+
export { truncateDictionary, typographyHeadingTagDictionary, typographyTagDictionary, };
|
|
@@ -27,6 +27,8 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
27
27
|
this.bottom = false;
|
|
28
28
|
this.updateCSSCustomProps = () => {
|
|
29
29
|
var _a;
|
|
30
|
+
if (typeof window === 'undefined')
|
|
31
|
+
return;
|
|
30
32
|
const elementStyles = window.getComputedStyle(this.host);
|
|
31
33
|
this.cssTransitionDuration = (_a = elementStyles.getPropertyValue('--mds-modal-transition-duration')) !== null && _a !== void 0 ? _a : '500';
|
|
32
34
|
};
|
|
@@ -71,7 +73,7 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
71
73
|
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
72
74
|
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
73
75
|
if (this.window) {
|
|
74
|
-
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', '
|
|
76
|
+
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'dialog');
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
componentWillRender() {
|
|
@@ -94,11 +96,11 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
94
96
|
this.opened = false;
|
|
95
97
|
}
|
|
96
98
|
render() {
|
|
97
|
-
return (h(Host, { key: '
|
|
99
|
+
return (h(Host, { key: '1d00f0a817af0b0a82eae1c790cc7e312165a46e', "aria-modal": clsx(this.opened ? 'true' : 'false'), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
98
100
|
? h("slot", { name: "window" })
|
|
99
101
|
: h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog", part: "window" }, this.top &&
|
|
100
102
|
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
101
|
-
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: '
|
|
103
|
+
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: 'a6435d754aec81eb79699dd693783de606d8d2ee', class: "action-close", icon: "mi/baseline/close", variant: "light", tone: "quiet", size: "xl", onClick: (e) => { this.closeModal(e); } })));
|
|
102
104
|
}
|
|
103
105
|
get host() { return this; }
|
|
104
106
|
static get watchers() { return {
|
package/dist/documentation.json
CHANGED
|
@@ -25,6 +25,8 @@ const MdsModal = class {
|
|
|
25
25
|
this.bottom = false;
|
|
26
26
|
this.updateCSSCustomProps = () => {
|
|
27
27
|
var _a;
|
|
28
|
+
if (typeof window === 'undefined')
|
|
29
|
+
return;
|
|
28
30
|
const elementStyles = window.getComputedStyle(this.host);
|
|
29
31
|
this.cssTransitionDuration = (_a = elementStyles.getPropertyValue('--mds-modal-transition-duration')) !== null && _a !== void 0 ? _a : '500';
|
|
30
32
|
};
|
|
@@ -69,7 +71,7 @@ const MdsModal = class {
|
|
|
69
71
|
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
70
72
|
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
71
73
|
if (this.window) {
|
|
72
|
-
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', '
|
|
74
|
+
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'dialog');
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
componentWillRender() {
|
|
@@ -92,11 +94,11 @@ const MdsModal = class {
|
|
|
92
94
|
this.opened = false;
|
|
93
95
|
}
|
|
94
96
|
render() {
|
|
95
|
-
return (h(Host, { key: '
|
|
97
|
+
return (h(Host, { key: '1d00f0a817af0b0a82eae1c790cc7e312165a46e', "aria-modal": clsx(this.opened ? 'true' : 'false'), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
96
98
|
? h("slot", { name: "window" })
|
|
97
99
|
: h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog", part: "window" }, this.top &&
|
|
98
100
|
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
99
|
-
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: '
|
|
101
|
+
h("slot", { name: "bottom" })), !this.window && h("mds-button", { key: 'a6435d754aec81eb79699dd693783de606d8d2ee', class: "action-close", icon: "mi/baseline/close", variant: "light", tone: "quiet", size: "xl", onClick: (e) => { this.closeModal(e); } })));
|
|
100
102
|
}
|
|
101
103
|
get host() { return getElement(this); }
|
|
102
104
|
static get watchers() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-1c34ac95.js";function r(n){var t,o,e="";if("string"==typeof n||"number"==typeof n)e+=n;else if("object"==typeof n)if(Array.isArray(n)){var i=n.length;for(t=0;t<i;t++)n[t]&&(o=r(n[t]))&&(e&&(e+=" "),e+=o)}else for(o in n)n[o]&&(e&&(e+=" "),e+=o);return e}function clsx(){for(var n,t,o=0,e="",i=arguments.length;o<i;o++)(n=arguments[o])&&(t=r(n))&&(e&&(e+=" "),e+=t);return e}var cssDurationToMilliseconds=function(n,t){if(t===void 0){t=1e3}if(n.includes("ms")){return Number(n.replace("ms",""))}if(n.includes("s")){return Number(n.replace("s",""))*1e3}return t};var 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-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-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);\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 -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 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 {\n padding: 2rem;\n}\n\n@media (max-width: 767px) {\n :host {\n padding: 1rem;\n }\n}\n\n:host .window {\n margin: -2rem;\n}\n\n@media (max-width: 767px) {\n :host .window {\n margin: -1rem;\n }\n}\n\n:host .window {\n\n -webkit-transition-delay: 0s, calc(var(--mds-modal-transition-duration) / 2);\n\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: 100dvh;\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: 100dvh;\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';var MdsModalStyle0=mdsModalCss;var MdsModal=function(){function n(n){var t=this;registerInstance(this,n);this.closeEvent=createEvent(this,"mdsModalClose",7);this.hideEvent=createEvent(this,"mdsModalHide",7);this.window=false;this.top=false;this.bottom=false;this.updateCSSCustomProps=function(){var n;var o=window.getComputedStyle(t.host);t.cssTransitionDuration=(n=o.getPropertyValue("--mds-modal-transition-duration"))!==null&&n!==void 0?n:"500"};this.stopIntroAnimationWindow=function(){t.animating="none";t.host.setAttribute("animating","none");clearTimeout(t.animationDelayTimeout)};this.stopOutroAnimationWindow=function(){t.animating="none";t.host.setAttribute("animating","none");t.hideEvent.emit();clearTimeout(t.animationDelayTimeout)};this.animateOpenWindow=function(){t.animating="intro";clearTimeout(t.animationDelayTimeout);t.animationDelayTimeout=setTimeout(t.stopIntroAnimationWindow.bind(t),cssDurationToMilliseconds(t.cssTransitionDuration))};this.animateCloseWindow=function(){t.animating="outro";clearTimeout(t.animationDelayTimeout);t.animationDelayTimeout=setTimeout(t.stopOutroAnimationWindow.bind(t),cssDurationToMilliseconds(t.cssTransitionDuration))};this.closeModal=function(n){var o;if(((o=n.target)===null||o===void 0?void 0:o.localName)!=="mds-modal"){return}t.opened=n.target!==n.currentTarget;if(!t.opened){t.closeEvent.emit()}};this.opened=false;this.position="center";this.animating="none"}n.prototype.componentWillLoad=function(){var n;this.bottom=this.host.querySelector('[slot="bottom"]')!==null;this.top=this.host.querySelector('[slot="top"]')!==null;this.window=this.host.querySelector('[slot="window"]')!==null;if(this.window){(n=this.host.querySelector('[slot="window"]'))===null||n===void 0?void 0:n.setAttribute("role","modal")}};n.prototype.componentWillRender=function(){this.animating=this.opened?"intro":"outro"};n.prototype.componentDidLoad=function(){this.updateCSSCustomProps()};n.prototype.handleOpenProp=function(n){if(n){this.animateOpenWindow();return}this.animateCloseWindow()};n.prototype.onModalCloseListener=function(){this.opened=false};n.prototype.onBannerCloseListener=function(){this.opened=false};n.prototype.render=function(){var n=this;return h(Host,{key:"b47115bdc428fd9d0d7357ed96efd09ed7cf034f","aria-modal":clsx(this.opened?"true":"false"),onClick:function(t){n.closeModal(t)}},this.window?h("slot",{name:"window"}):h("div",{class:clsx("window",(this.top||this.bottom)&&"window-".concat(this.top?"-top":"").concat(this.bottom?"-bottom":"")),role:"dialog",part:"window"},this.top&&h("slot",{name:"top"}),h("slot",null),this.bottom&&h("slot",{name:"bottom"})),!this.window&&h("mds-button",{key:"f53c045a86dd3db6d1ca7cfdf07aa448b6278e9f",class:"action-close",icon:"mi/baseline/close",variant:"light",tone:"quiet",size:"xl",onClick:function(t){n.closeModal(t)}}))};Object.defineProperty(n.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{opened:["handleOpenProp"]}},enumerable:false,configurable:true});return n}();MdsModal.style=MdsModalStyle0;export{MdsModal as mds_modal};
|
|
1
|
+
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-1c34ac95.js";function r(n){var t,o,e="";if("string"==typeof n||"number"==typeof n)e+=n;else if("object"==typeof n)if(Array.isArray(n)){var i=n.length;for(t=0;t<i;t++)n[t]&&(o=r(n[t]))&&(e&&(e+=" "),e+=o)}else for(o in n)n[o]&&(e&&(e+=" "),e+=o);return e}function clsx(){for(var n,t,o=0,e="",i=arguments.length;o<i;o++)(n=arguments[o])&&(t=r(n))&&(e&&(e+=" "),e+=t);return e}var cssDurationToMilliseconds=function(n,t){if(t===void 0){t=1e3}if(n.includes("ms")){return Number(n.replace("ms",""))}if(n.includes("s")){return Number(n.replace("s",""))*1e3}return t};var 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-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-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);\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 -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 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 {\n padding: 2rem;\n}\n\n@media (max-width: 767px) {\n :host {\n padding: 1rem;\n }\n}\n\n:host .window {\n margin: -2rem;\n}\n\n@media (max-width: 767px) {\n :host .window {\n margin: -1rem;\n }\n}\n\n:host .window {\n\n -webkit-transition-delay: 0s, calc(var(--mds-modal-transition-duration) / 2);\n\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: 100dvh;\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: 100dvh;\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';var MdsModalStyle0=mdsModalCss;var MdsModal=function(){function n(n){var t=this;registerInstance(this,n);this.closeEvent=createEvent(this,"mdsModalClose",7);this.hideEvent=createEvent(this,"mdsModalHide",7);this.window=false;this.top=false;this.bottom=false;this.updateCSSCustomProps=function(){var n;if(typeof window==="undefined")return;var o=window.getComputedStyle(t.host);t.cssTransitionDuration=(n=o.getPropertyValue("--mds-modal-transition-duration"))!==null&&n!==void 0?n:"500"};this.stopIntroAnimationWindow=function(){t.animating="none";t.host.setAttribute("animating","none");clearTimeout(t.animationDelayTimeout)};this.stopOutroAnimationWindow=function(){t.animating="none";t.host.setAttribute("animating","none");t.hideEvent.emit();clearTimeout(t.animationDelayTimeout)};this.animateOpenWindow=function(){t.animating="intro";clearTimeout(t.animationDelayTimeout);t.animationDelayTimeout=setTimeout(t.stopIntroAnimationWindow.bind(t),cssDurationToMilliseconds(t.cssTransitionDuration))};this.animateCloseWindow=function(){t.animating="outro";clearTimeout(t.animationDelayTimeout);t.animationDelayTimeout=setTimeout(t.stopOutroAnimationWindow.bind(t),cssDurationToMilliseconds(t.cssTransitionDuration))};this.closeModal=function(n){var o;if(((o=n.target)===null||o===void 0?void 0:o.localName)!=="mds-modal"){return}t.opened=n.target!==n.currentTarget;if(!t.opened){t.closeEvent.emit()}};this.opened=false;this.position="center";this.animating="none"}n.prototype.componentWillLoad=function(){var n;this.bottom=this.host.querySelector('[slot="bottom"]')!==null;this.top=this.host.querySelector('[slot="top"]')!==null;this.window=this.host.querySelector('[slot="window"]')!==null;if(this.window){(n=this.host.querySelector('[slot="window"]'))===null||n===void 0?void 0:n.setAttribute("role","dialog")}};n.prototype.componentWillRender=function(){this.animating=this.opened?"intro":"outro"};n.prototype.componentDidLoad=function(){this.updateCSSCustomProps()};n.prototype.handleOpenProp=function(n){if(n){this.animateOpenWindow();return}this.animateCloseWindow()};n.prototype.onModalCloseListener=function(){this.opened=false};n.prototype.onBannerCloseListener=function(){this.opened=false};n.prototype.render=function(){var n=this;return h(Host,{key:"1d00f0a817af0b0a82eae1c790cc7e312165a46e","aria-modal":clsx(this.opened?"true":"false"),onClick:function(t){n.closeModal(t)}},this.window?h("slot",{name:"window"}):h("div",{class:clsx("window",(this.top||this.bottom)&&"window-".concat(this.top?"-top":"").concat(this.bottom?"-bottom":"")),role:"dialog",part:"window"},this.top&&h("slot",{name:"top"}),h("slot",null),this.bottom&&h("slot",{name:"bottom"})),!this.window&&h("mds-button",{key:"a6435d754aec81eb79699dd693783de606d8d2ee",class:"action-close",icon:"mi/baseline/close",variant:"light",tone:"quiet",size:"xl",onClick:function(t){n.closeModal(t)}}))};Object.defineProperty(n.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{opened:["handleOpenProp"]}},enumerable:false,configurable:true});return n}();MdsModal.style=MdsModalStyle0;export{MdsModal as mds_modal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-0ed6e0c8.js";export{s as setNonce}from"./p-0ed6e0c8.js";import{g as n}from"./p-e1255160.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((async e=>(await n(),o([["p-
|
|
1
|
+
import{p as e,b as o}from"./p-0ed6e0c8.js";export{s as setNonce}from"./p-0ed6e0c8.js";import{g as n}from"./p-e1255160.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((async e=>(await n(),o([["p-fbfe7e2e",[[1,"mds-modal",{opened:[1540],position:[1537],animating:[1537]},[[4,"mdsModalClose","onModalCloseListener"],[4,"mdsBannerClose","onBannerCloseListener"]],{opened:["handleOpenProp"]}]]]],e))));
|