@maggioli-design-system/mds-modal 1.0.0 → 1.1.1
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-ced1b9b6.js → index-5643c33e.js} +6 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/mds-modal.cjs.entry.js +11 -5
- package/dist/cjs/mds-modal.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/mds-modal/mds-modal.css +9 -18
- package/dist/collection/components/mds-modal/mds-modal.js +14 -5
- package/dist/collection/components/mds-modal/test/mds-modal.stories.js +5 -9
- package/dist/collection/dictionary/icon.js +1 -1
- package/dist/collection/dictionary/typography.js +7 -1
- package/dist/collection/dictionary/variant.js +1 -0
- package/dist/{custom-elements → components}/index.d.ts +1 -20
- package/dist/components/index.js +1 -0
- package/dist/components/mds-modal.d.ts +11 -0
- package/dist/components/mds-modal.js +149 -0
- package/dist/esm/{index-7d5b7d79.js → index-75ff1533.js} +6 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mds-modal.entry.js +11 -5
- package/dist/esm/mds-modal.js +3 -3
- package/dist/esm-es5/index-75ff1533.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-3f2aad3d.system.js +1 -0
- package/dist/mds-modal/p-a4d22860.entry.js +1 -0
- package/dist/mds-modal/p-bc66d772.js +1 -0
- package/dist/mds-modal/p-bfbfd9ea.system.js +1 -0
- package/dist/mds-modal/p-f3ef788d.system.entry.js +1 -0
- package/dist/stats.json +53 -41
- package/dist/types/dictionary/typography.d.ts +2 -1
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/types/typography.d.ts +3 -2
- package/dist/types/types/variant.d.ts +1 -1
- package/package.json +15 -19
- package/src/components/mds-modal/mds-modal.css +0 -1
- package/src/components/mds-modal/mds-modal.tsx +12 -6
- package/src/components/mds-modal/test/mds-modal.stories.js +5 -9
- package/src/components/mds-modal/test/mds-modal.stories.mdx +14 -0
- package/src/dictionary/icon.ts +1 -1
- package/src/dictionary/typography.ts +8 -0
- package/src/dictionary/variant.ts +1 -0
- package/src/types/typography.ts +6 -0
- package/src/types/variant.ts +2 -1
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/mds-modal.js +1 -1
- package/www/build/p-3f2aad3d.system.js +1 -0
- package/www/build/p-a4d22860.entry.js +1 -0
- package/www/build/p-bc66d772.js +1 -0
- package/www/build/p-bfbfd9ea.system.js +1 -0
- package/www/build/p-f3ef788d.system.entry.js +1 -0
- package/dist/custom-elements/index.js +0 -136
- package/dist/esm-es5/index-7d5b7d79.js +0 -1
- package/dist/mds-modal/p-0fa95990.system.js +0 -1
- package/dist/mds-modal/p-818ca69a.js +0 -1
- package/dist/mds-modal/p-c8003e96.system.js +0 -1
- package/dist/mds-modal/p-d10799a8.entry.js +0 -1
- package/dist/mds-modal/p-fda9967b.system.entry.js +0 -1
- package/www/build/p-0fa95990.system.js +0 -1
- package/www/build/p-818ca69a.js +0 -1
- package/www/build/p-c8003e96.system.js +0 -1
- package/www/build/p-d10799a8.entry.js +0 -1
- package/www/build/p-fda9967b.system.entry.js +0 -1
|
@@ -50,7 +50,7 @@ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
|
50
50
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
51
51
|
if (listeners) {
|
|
52
52
|
listeners.map(([flags, name, method]) => {
|
|
53
|
-
const target = elm;
|
|
53
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
54
54
|
const handler = hostListenerProxy(hostRef, method);
|
|
55
55
|
const opts = hostListenerOpts(flags);
|
|
56
56
|
plt.ael(target, name, handler, opts);
|
|
@@ -74,6 +74,11 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
74
74
|
consoleError(e);
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
78
|
+
if (flags & 4 /* TargetDocument */)
|
|
79
|
+
return doc;
|
|
80
|
+
return elm;
|
|
81
|
+
};
|
|
77
82
|
// prettier-ignore
|
|
78
83
|
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
79
84
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-5643c33e.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Esm v2.
|
|
8
|
+
Stencil Client Patch Esm v2.13.0 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchEsm = () => {
|
|
11
11
|
return index.promiseResolve();
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537]},[[
|
|
17
|
+
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537],"stateOpened":[32]},[[4,"close","onCloseListener"]]]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-5643c33e.js');
|
|
6
6
|
|
|
7
7
|
function toVal(mix) {
|
|
8
8
|
var k, y, str='';
|
|
@@ -45,7 +45,7 @@ function clsx () {
|
|
|
45
45
|
return str;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const mdsModalCss = ".animate-left,.animate-right{opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:
|
|
48
|
+
const mdsModalCss = ".animate-left,.animate-right{opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}.animate-right-intro,.animate-right-outro{-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{pointer-events:none;position:fixed;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:rgba(var(--adjust-tone-01), var(--tw-bg-opacity));--tw-bg-opacity:0;-webkit-transition-duration:700ms;transition-duration:700ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1);-webkit-perspective:600px;perspective:600px}:host(.animate-center-opened),:host(.animate-left-opened),:host(.animate-right-opened){pointer-events:auto;--tw-bg-opacity:0.5;-webkit-transition-duration:500ms;transition-duration:500ms}.close{position:absolute;top:0px;height:2.25rem;width:2.25rem;-webkit-transform-origin:center;transform-origin:center;cursor:pointer;font-size:2.25rem;line-height:2.5rem;--tw-text-opacity:1;color:rgba(var(--adjust-tone-10), var(--tw-text-opacity));opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(0.77, 0, 0.175, 1);transition-timing-function:cubic-bezier(0.77, 0, 0.175, 1);-webkit-transform:translate(0, 24px) rotate(90deg);transform:translate(0, 24px) rotate(90deg)}.window{display:grid;height:100%;gap:0px;overflow:auto;background-color:var(--window-background, rgb(var(--adjust-tone)));-webkit-box-shadow:var(--window-shadow, 0 25px 50px -12px rgb(0 0 0 / 0.25));box-shadow:var(--window-shadow, 0 25px 50px -12px rgb(0 0 0 / 0.25));grid-template-rows:1fr;max-width:calc(100vw - 80px)}.window--top{grid-template-rows:auto 1fr}.window--bottom{grid-template-rows:1fr auto}.window--top-bottom{grid-template-rows:auto 1fr auto}:host(.animate-center){-ms-flex-pack:center;justify-content:center;padding:2rem}@media (max-width: 767px){:host(.animate-center){padding:1rem}}:host(.animate-center) .window,:host(.animate-center)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-center-intro) .window,:host(.animate-center-intro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(40%);transform:rotateX(-22deg) scale(0.5) translateY(40%)}:host(.animate-center-opened.animate-center-outro) .window,:host(.animate-center-opened.animate-center-outro)>::slotted([slot=window]),:host(.animate-center-opened) .window,:host(.animate-center-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:rotateX(0) scale(1) translateY(0);transform:rotateX(0) scale(1) translateY(0)}:host(.animate-center-outro) .window,:host(.animate-center-outro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(-40%);transform:rotateX(-22deg) scale(0.5) translateY(-40%)}:host(.animate-right){-ms-flex-pack:end;justify-content:flex-end}:host(.animate-right) .window,:host(.animate-right)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-right-intro) .window,:host(.animate-right-intro)>::slotted([slot=window]){-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}:host(.animate-right-opened.animate-right-outro) .window,:host(.animate-right-opened.animate-right-outro)>::slotted([slot=window]),:host(.animate-right-opened) .window,:host(.animate-right-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}:host(.animate-right-opened) .close,:host(.animate-right-opened.animate-right-outro) .close{opacity:1;-webkit-transform:translate(24px, 24px) rotate(0);transform:translate(24px, 24px) rotate(0)}:host(.animate-right-outro) .window,:host(.animate-right-outro)>::slotted([slot=window]){-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}:host(.animate-right-outro) .close{-webkit-transform:translate(-24px, 24px) rotate(90deg);transform:translate(-24px, 24px) rotate(90deg)}:host(.animate-right) .close{left:0px;-webkit-transform:translate(-36px, 24px) rotate(-90deg);transform:translate(-36px, 24px) rotate(-90deg)}:host(.animate-left){-ms-flex-pack:start;justify-content:flex-start}:host(.animate-left) .window,:host(.animate-left)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-left-intro) .window,:host(.animate-left-intro)>::slotted([slot=window]){-webkit-transform:translateX(calc(-100% - 50px));transform:translateX(calc(-100% - 50px))}:host(.animate-left-opened.animate-left-outro) .window,:host(.animate-left-opened.animate-left-outro)>::slotted([slot=window]),:host(.animate-left-opened) .window,:host(.animate-left-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}:host(.animate-left-opened) .close,:host(.animate-left-opened.animate-left-outro) .close{opacity:1;-webkit-transform:translate(-24px, 24px) rotate(0);transform:translate(-24px, 24px) rotate(0)}:host(.animate-left-outro) .window,:host(.animate-left-outro)>::slotted([slot=window]){-webkit-transform:translateX(calc(-100% - 50px));transform:translateX(calc(-100% - 50px))}:host(.animate-left-outro) .close{-webkit-transform:translate(24px, 24px) rotate(-90deg);transform:translate(24px, 24px) rotate(-90deg)}:host(.animate-left) .close{right:0px;-webkit-transform:translate(36px, 24px) rotate(90deg);transform:translate(36px, 24px) rotate(90deg)}";
|
|
49
49
|
|
|
50
50
|
let MdsModal = class {
|
|
51
51
|
constructor(hostRef) {
|
|
@@ -63,6 +63,10 @@ let MdsModal = class {
|
|
|
63
63
|
return `animate-${customPosition !== null ? customPosition : this.position}${customState !== null ? '-' + customState : ''}`;
|
|
64
64
|
};
|
|
65
65
|
this.closeModal = (e = null) => {
|
|
66
|
+
var _a;
|
|
67
|
+
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.localName) !== 'mds-modal') {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
66
70
|
this.opened = e.target !== e.currentTarget;
|
|
67
71
|
if (!this.opened) {
|
|
68
72
|
this.close.emit();
|
|
@@ -73,6 +77,7 @@ let MdsModal = class {
|
|
|
73
77
|
this.bottom = this.hostElement.querySelector('[slot="bottom"]') !== null;
|
|
74
78
|
this.top = this.hostElement.querySelector('[slot="top"]') !== null;
|
|
75
79
|
this.window = this.hostElement.querySelector('[slot="window"]') !== null;
|
|
80
|
+
this.stateOpened = this.opened;
|
|
76
81
|
if (this.window && this.position === null) {
|
|
77
82
|
this.position = 'center';
|
|
78
83
|
}
|
|
@@ -92,20 +97,21 @@ let MdsModal = class {
|
|
|
92
97
|
window.clearTimeout(this.animationDeelay);
|
|
93
98
|
}, 500);
|
|
94
99
|
}
|
|
95
|
-
positionChange(
|
|
100
|
+
positionChange(_newValue, oldValue) {
|
|
96
101
|
window.clearTimeout(this.animationDeelay);
|
|
97
102
|
this.hostElement.classList.remove(this.animationName(null, oldValue));
|
|
98
103
|
this.hostElement.classList.remove(this.animationName('intro', oldValue));
|
|
99
104
|
this.hostElement.classList.remove(this.animationName('outro', oldValue));
|
|
100
105
|
}
|
|
101
|
-
openedChange() {
|
|
106
|
+
openedChange(newValue) {
|
|
107
|
+
this.stateOpened = newValue;
|
|
102
108
|
window.clearTimeout(this.animationDeelay);
|
|
103
109
|
}
|
|
104
110
|
onCloseListener() {
|
|
105
111
|
this.opened = false;
|
|
106
112
|
}
|
|
107
113
|
render() {
|
|
108
|
-
return (index.h(index.Host, { class: clsx(this.
|
|
114
|
+
return (index.h(index.Host, { class: clsx(this.stateOpened && this.animationName('opened')), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
109
115
|
?
|
|
110
116
|
index.h("slot", { name: "window" })
|
|
111
117
|
:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-5643c33e.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
|
-
Stencil Client Patch Browser v2.
|
|
6
|
+
Stencil Client Patch Browser v2.13.0 | MIT Licensed | https://stenciljs.com
|
|
7
7
|
*/
|
|
8
8
|
const patchBrowser = () => {
|
|
9
9
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mds-modal.cjs.js', document.baseURI).href));
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537]},[[
|
|
18
|
+
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537],"stateOpened":[32]},[[4,"close","onCloseListener"]]]]]], options);
|
|
19
19
|
});
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
.animate-left, .animate-right {
|
|
4
4
|
opacity: 0;
|
|
5
5
|
transition-property: background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;
|
|
6
|
-
transition-duration: 150ms;
|
|
7
6
|
transition-duration: 500ms;
|
|
8
7
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
9
8
|
}
|
|
@@ -16,7 +15,8 @@
|
|
|
16
15
|
border-width: 1px;
|
|
17
16
|
}
|
|
18
17
|
.shadow {
|
|
19
|
-
--tw-shadow: 0 1px 3px 0
|
|
18
|
+
--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
19
|
+
--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
|
|
20
20
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
display: flex;
|
|
31
31
|
align-items: center;
|
|
32
32
|
justify-content: center;
|
|
33
|
-
--tw-bg-opacity: 1;
|
|
34
33
|
background-color: rgba(var(--adjust-tone-01), var(--tw-bg-opacity));
|
|
35
34
|
--tw-bg-opacity: 0;
|
|
36
35
|
transition-duration: 700ms;
|
|
@@ -58,10 +57,8 @@
|
|
|
58
57
|
color: rgba(var(--adjust-tone-10), var(--tw-text-opacity));
|
|
59
58
|
opacity: 0;
|
|
60
59
|
transition-property: background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;
|
|
61
|
-
transition-duration: 150ms;
|
|
62
60
|
transition-duration: 500ms;
|
|
63
61
|
transition-timing-function: cubic-bezier(0.77, 0, 0.175, 1);
|
|
64
|
-
text-shadow: 0px 0px 1px rgb(0 0 0 / 20%), 0px 0px 1px rgb(1 0 5 / 10%);
|
|
65
62
|
|
|
66
63
|
transform: translate(0, 24px) rotate(90deg);
|
|
67
64
|
}
|
|
@@ -73,7 +70,7 @@
|
|
|
73
70
|
overflow: auto;
|
|
74
71
|
|
|
75
72
|
background-color: var(--window-background, rgb(var(--adjust-tone)));
|
|
76
|
-
box-shadow: var(--window-shadow, 0 25px 50px -12px
|
|
73
|
+
box-shadow: var(--window-shadow, 0 25px 50px -12px rgb(0 0 0 / 0.25));
|
|
77
74
|
grid-template-rows: 1fr;
|
|
78
75
|
|
|
79
76
|
/* grid-template-rows: var(--grid-template-rows, auto 1fr auto); */
|
|
@@ -107,7 +104,6 @@
|
|
|
107
104
|
:host ( .animate-center ) .window, :host ( .animate-center ) > ::slotted ( [slot=window] ) {
|
|
108
105
|
opacity: 0;
|
|
109
106
|
transition-property: background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;
|
|
110
|
-
transition-duration: 150ms;
|
|
111
107
|
transition-duration: 500ms;
|
|
112
108
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
113
109
|
}
|
|
@@ -117,11 +113,10 @@
|
|
|
117
113
|
}
|
|
118
114
|
|
|
119
115
|
:host ( .animate-center-opened.animate-center-outro ) .window, :host ( .animate-center-opened.animate-center-outro ) > ::slotted ( [slot=window] ), :host ( .animate-center-opened ) .window, :host ( .animate-center-opened ) > ::slotted ( [slot=window] ) {
|
|
116
|
+
opacity: 1;
|
|
120
117
|
|
|
121
118
|
transform: rotateX(0) scale(1) translateY(0);
|
|
122
|
-
|
|
123
|
-
opacity: 1;
|
|
124
|
-
}
|
|
119
|
+
}
|
|
125
120
|
|
|
126
121
|
:host ( .animate-center-outro ) .window, :host ( .animate-center-outro ) > ::slotted ( [slot=window] ) {
|
|
127
122
|
transform: rotateX(-22deg) scale(0.5) translateY(-40%);
|
|
@@ -134,7 +129,6 @@
|
|
|
134
129
|
:host ( .animate-right ) .window, :host ( .animate-right ) > ::slotted ( [slot=window] ) {
|
|
135
130
|
opacity: 0;
|
|
136
131
|
transition-property: background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;
|
|
137
|
-
transition-duration: 150ms;
|
|
138
132
|
transition-duration: 500ms;
|
|
139
133
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
140
134
|
}
|
|
@@ -144,11 +138,10 @@
|
|
|
144
138
|
}
|
|
145
139
|
|
|
146
140
|
:host ( .animate-right-opened.animate-right-outro ) .window, :host ( .animate-right-opened.animate-right-outro ) > ::slotted ( [slot=window] ), :host ( .animate-right-opened ) .window, :host ( .animate-right-opened ) > ::slotted ( [slot=window] ) {
|
|
141
|
+
opacity: 1;
|
|
147
142
|
|
|
148
143
|
transform: translateX(0);
|
|
149
|
-
|
|
150
|
-
opacity: 1;
|
|
151
|
-
}
|
|
144
|
+
}
|
|
152
145
|
|
|
153
146
|
:host ( .animate-right-opened ) .close, :host ( .animate-right-opened.animate-right-outro ) .close {
|
|
154
147
|
opacity: 1;
|
|
@@ -177,7 +170,6 @@
|
|
|
177
170
|
:host ( .animate-left ) .window, :host ( .animate-left ) > ::slotted ( [slot=window] ) {
|
|
178
171
|
opacity: 0;
|
|
179
172
|
transition-property: background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;
|
|
180
|
-
transition-duration: 150ms;
|
|
181
173
|
transition-duration: 500ms;
|
|
182
174
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
183
175
|
}
|
|
@@ -187,11 +179,10 @@
|
|
|
187
179
|
}
|
|
188
180
|
|
|
189
181
|
:host ( .animate-left-opened.animate-left-outro ) .window, :host ( .animate-left-opened.animate-left-outro ) > ::slotted ( [slot=window] ), :host ( .animate-left-opened ) .window, :host ( .animate-left-opened ) > ::slotted ( [slot=window] ) {
|
|
182
|
+
opacity: 1;
|
|
190
183
|
|
|
191
184
|
transform: translateX(0);
|
|
192
|
-
|
|
193
|
-
opacity: 1;
|
|
194
|
-
}
|
|
185
|
+
}
|
|
195
186
|
|
|
196
187
|
:host ( .animate-left-opened ) .close, :host ( .animate-left-opened.animate-left-outro ) .close {
|
|
197
188
|
opacity: 1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Element, Event, Host, h, Listen, Prop, Watch } from '@stencil/core';
|
|
1
|
+
import { Component, Element, Event, Host, h, Listen, Prop, Watch, State } from '@stencil/core';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
export class MdsModal {
|
|
4
4
|
constructor() {
|
|
@@ -14,6 +14,10 @@ export class MdsModal {
|
|
|
14
14
|
return `animate-${customPosition !== null ? customPosition : this.position}${customState !== null ? '-' + customState : ''}`;
|
|
15
15
|
};
|
|
16
16
|
this.closeModal = (e = null) => {
|
|
17
|
+
var _a;
|
|
18
|
+
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.localName) !== 'mds-modal') {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
17
21
|
this.opened = e.target !== e.currentTarget;
|
|
18
22
|
if (!this.opened) {
|
|
19
23
|
this.close.emit();
|
|
@@ -24,6 +28,7 @@ export class MdsModal {
|
|
|
24
28
|
this.bottom = this.hostElement.querySelector('[slot="bottom"]') !== null;
|
|
25
29
|
this.top = this.hostElement.querySelector('[slot="top"]') !== null;
|
|
26
30
|
this.window = this.hostElement.querySelector('[slot="window"]') !== null;
|
|
31
|
+
this.stateOpened = this.opened;
|
|
27
32
|
if (this.window && this.position === null) {
|
|
28
33
|
this.position = 'center';
|
|
29
34
|
}
|
|
@@ -43,20 +48,21 @@ export class MdsModal {
|
|
|
43
48
|
window.clearTimeout(this.animationDeelay);
|
|
44
49
|
}, 500);
|
|
45
50
|
}
|
|
46
|
-
positionChange(
|
|
51
|
+
positionChange(_newValue, oldValue) {
|
|
47
52
|
window.clearTimeout(this.animationDeelay);
|
|
48
53
|
this.hostElement.classList.remove(this.animationName(null, oldValue));
|
|
49
54
|
this.hostElement.classList.remove(this.animationName('intro', oldValue));
|
|
50
55
|
this.hostElement.classList.remove(this.animationName('outro', oldValue));
|
|
51
56
|
}
|
|
52
|
-
openedChange() {
|
|
57
|
+
openedChange(newValue) {
|
|
58
|
+
this.stateOpened = newValue;
|
|
53
59
|
window.clearTimeout(this.animationDeelay);
|
|
54
60
|
}
|
|
55
61
|
onCloseListener() {
|
|
56
62
|
this.opened = false;
|
|
57
63
|
}
|
|
58
64
|
render() {
|
|
59
|
-
return (h(Host, { class: clsx(this.
|
|
65
|
+
return (h(Host, { class: clsx(this.stateOpened && this.animationName('opened')), onClick: (e) => { this.closeModal(e); } },
|
|
60
66
|
this.window
|
|
61
67
|
?
|
|
62
68
|
h("slot", { name: "window" })
|
|
@@ -119,6 +125,9 @@ export class MdsModal {
|
|
|
119
125
|
"defaultValue": "null"
|
|
120
126
|
}
|
|
121
127
|
}; }
|
|
128
|
+
static get states() { return {
|
|
129
|
+
"stateOpened": {}
|
|
130
|
+
}; }
|
|
122
131
|
static get events() { return [{
|
|
123
132
|
"method": "close",
|
|
124
133
|
"name": "close",
|
|
@@ -146,7 +155,7 @@ export class MdsModal {
|
|
|
146
155
|
static get listeners() { return [{
|
|
147
156
|
"name": "close",
|
|
148
157
|
"method": "onCloseListener",
|
|
149
|
-
"target":
|
|
158
|
+
"target": "document",
|
|
150
159
|
"capture": false,
|
|
151
160
|
"passive": false
|
|
152
161
|
}]; }
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import faker from 'faker'
|
|
3
2
|
import MdsModal from '@component/mds-modal/mds-modal'
|
|
4
3
|
|
|
5
4
|
import { modalPositionDictionary } from '../meta/dictionary'
|
|
@@ -21,13 +20,10 @@ export default {
|
|
|
21
20
|
},
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const text = faker.lorem.paragraphs(3)
|
|
27
|
-
const firstName = faker.name.firstName(1)
|
|
28
|
-
const lastName = faker.name.lastName(1)
|
|
23
|
+
const firstName = 'Mario'
|
|
24
|
+
const lastName = 'Rossi'
|
|
29
25
|
const fullName = `${firstName} ${lastName}`
|
|
30
|
-
const email =
|
|
26
|
+
const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}@nintendo.com`
|
|
31
27
|
|
|
32
28
|
const Template = args =>
|
|
33
29
|
<mds-modal {...args}>
|
|
@@ -40,7 +36,7 @@ const Template = args =>
|
|
|
40
36
|
</header>
|
|
41
37
|
<div className="p-8 max-w-lg">
|
|
42
38
|
<mds-text>
|
|
43
|
-
|
|
39
|
+
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’re future-proofing our components as more brands adopt NewsKit.
|
|
44
40
|
</mds-text>
|
|
45
41
|
</div>
|
|
46
42
|
<footer slot="bottom" className="p-8 max-w-lg flex gap-4 text-adjust-tone-02 border-t border-adjust-tone-09">
|
|
@@ -57,7 +53,7 @@ const CustomTemplate = args =>
|
|
|
57
53
|
<mds-modal {...args}>
|
|
58
54
|
<mds-banner slot="window" class="max-w-xl" deletable headline="Action required">
|
|
59
55
|
<mds-text typography="detail">
|
|
60
|
-
|
|
56
|
+
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’re future-proofing our components as more brands adopt NewsKit.
|
|
61
57
|
</mds-text>
|
|
62
58
|
<mds-button slot="actions" variant="primary" tone="quiet">Cancel</mds-button>
|
|
63
59
|
<mds-button slot="actions" variant="primary">Confirm</mds-button>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import mggIconsDictionary from '@maggioli-design-system/icons/original/dictionary.json';
|
|
1
|
+
import mggIconsDictionary from '@maggioli-design-system/icons/dist/original/dictionary.json';
|
|
2
2
|
const iconsDictionary = Object.keys(mggIconsDictionary).sort();
|
|
3
3
|
export { iconsDictionary, };
|
|
@@ -13,6 +13,7 @@ const typographyDictionary = [
|
|
|
13
13
|
'label',
|
|
14
14
|
'option',
|
|
15
15
|
'paragraph',
|
|
16
|
+
'tip',
|
|
16
17
|
];
|
|
17
18
|
const typographyMonoDictionary = [
|
|
18
19
|
'code',
|
|
@@ -33,5 +34,10 @@ const typographySecondaryDictionary = [
|
|
|
33
34
|
'label',
|
|
34
35
|
'option',
|
|
35
36
|
'paragraph',
|
|
37
|
+
'tip',
|
|
36
38
|
];
|
|
37
|
-
|
|
39
|
+
const typographySmallerDictionary = [
|
|
40
|
+
'option',
|
|
41
|
+
'tip',
|
|
42
|
+
];
|
|
43
|
+
export { typographyDictionary, typographyMonoDictionary, typographyPrimaryDictionary, typographySecondaryDictionary, typographySmallerDictionary, };
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
/* MdsModal custom elements
|
|
1
|
+
/* MdsModal custom elements */
|
|
2
2
|
|
|
3
3
|
import type { Components, JSX } from "../types/components";
|
|
4
4
|
|
|
5
|
-
interface MdsModal extends Components.MdsModal, HTMLElement {}
|
|
6
|
-
export const MdsModal: {
|
|
7
|
-
prototype: MdsModal;
|
|
8
|
-
new (): MdsModal;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Utility to define all custom elements within this package using the tag name provided in the component's source.
|
|
13
|
-
* When defining each custom element, it will also check it's safe to define by:
|
|
14
|
-
*
|
|
15
|
-
* 1. Ensuring the "customElements" registry is available in the global context (window).
|
|
16
|
-
* 2. The component tag name is not already defined.
|
|
17
|
-
*
|
|
18
|
-
* Use the standard [customElements.define()](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define)
|
|
19
|
-
* method instead to define custom elements individually, or to provide a different tag name.
|
|
20
|
-
*/
|
|
21
|
-
export declare const defineCustomElements: (opts?: any) => void;
|
|
22
|
-
|
|
23
5
|
/**
|
|
24
6
|
* Used to manually set the base path where assets can be found.
|
|
25
7
|
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
@@ -36,7 +18,6 @@ export interface SetPlatformOptions {
|
|
|
36
18
|
raf?: (c: FrameRequestCallback) => number;
|
|
37
19
|
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
38
20
|
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
39
|
-
ce?: (eventName: string, opts?: any) => CustomEvent;
|
|
40
21
|
}
|
|
41
22
|
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
42
23
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MdsModal extends Components.MdsModal, HTMLElement {}
|
|
4
|
+
export const MdsModal: {
|
|
5
|
+
prototype: MdsModal;
|
|
6
|
+
new (): MdsModal;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
function toVal(mix) {
|
|
4
|
+
var k, y, str='';
|
|
5
|
+
|
|
6
|
+
if (typeof mix === 'string' || typeof mix === 'number') {
|
|
7
|
+
str += mix;
|
|
8
|
+
} else if (typeof mix === 'object') {
|
|
9
|
+
if (Array.isArray(mix)) {
|
|
10
|
+
for (k=0; k < mix.length; k++) {
|
|
11
|
+
if (mix[k]) {
|
|
12
|
+
if (y = toVal(mix[k])) {
|
|
13
|
+
str && (str += ' ');
|
|
14
|
+
str += y;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
for (k in mix) {
|
|
20
|
+
if (mix[k]) {
|
|
21
|
+
str && (str += ' ');
|
|
22
|
+
str += k;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return str;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function clsx () {
|
|
32
|
+
var i=0, tmp, x, str='';
|
|
33
|
+
while (i < arguments.length) {
|
|
34
|
+
if (tmp = arguments[i++]) {
|
|
35
|
+
if (x = toVal(tmp)) {
|
|
36
|
+
str && (str += ' ');
|
|
37
|
+
str += x;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return str;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const mdsModalCss = ".animate-left,.animate-right{opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}.animate-right-intro,.animate-right-outro{-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{pointer-events:none;position:fixed;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:rgba(var(--adjust-tone-01), var(--tw-bg-opacity));--tw-bg-opacity:0;-webkit-transition-duration:700ms;transition-duration:700ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1);-webkit-perspective:600px;perspective:600px}:host(.animate-center-opened),:host(.animate-left-opened),:host(.animate-right-opened){pointer-events:auto;--tw-bg-opacity:0.5;-webkit-transition-duration:500ms;transition-duration:500ms}.close{position:absolute;top:0px;height:2.25rem;width:2.25rem;-webkit-transform-origin:center;transform-origin:center;cursor:pointer;font-size:2.25rem;line-height:2.5rem;--tw-text-opacity:1;color:rgba(var(--adjust-tone-10), var(--tw-text-opacity));opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(0.77, 0, 0.175, 1);transition-timing-function:cubic-bezier(0.77, 0, 0.175, 1);-webkit-transform:translate(0, 24px) rotate(90deg);transform:translate(0, 24px) rotate(90deg)}.window{display:grid;height:100%;gap:0px;overflow:auto;background-color:var(--window-background, rgb(var(--adjust-tone)));-webkit-box-shadow:var(--window-shadow, 0 25px 50px -12px rgb(0 0 0 / 0.25));box-shadow:var(--window-shadow, 0 25px 50px -12px rgb(0 0 0 / 0.25));grid-template-rows:1fr;max-width:calc(100vw - 80px)}.window--top{grid-template-rows:auto 1fr}.window--bottom{grid-template-rows:1fr auto}.window--top-bottom{grid-template-rows:auto 1fr auto}:host(.animate-center){-ms-flex-pack:center;justify-content:center;padding:2rem}@media (max-width: 767px){:host(.animate-center){padding:1rem}}:host(.animate-center) .window,:host(.animate-center)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-center-intro) .window,:host(.animate-center-intro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(40%);transform:rotateX(-22deg) scale(0.5) translateY(40%)}:host(.animate-center-opened.animate-center-outro) .window,:host(.animate-center-opened.animate-center-outro)>::slotted([slot=window]),:host(.animate-center-opened) .window,:host(.animate-center-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:rotateX(0) scale(1) translateY(0);transform:rotateX(0) scale(1) translateY(0)}:host(.animate-center-outro) .window,:host(.animate-center-outro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(-40%);transform:rotateX(-22deg) scale(0.5) translateY(-40%)}:host(.animate-right){-ms-flex-pack:end;justify-content:flex-end}:host(.animate-right) .window,:host(.animate-right)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-right-intro) .window,:host(.animate-right-intro)>::slotted([slot=window]){-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}:host(.animate-right-opened.animate-right-outro) .window,:host(.animate-right-opened.animate-right-outro)>::slotted([slot=window]),:host(.animate-right-opened) .window,:host(.animate-right-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}:host(.animate-right-opened) .close,:host(.animate-right-opened.animate-right-outro) .close{opacity:1;-webkit-transform:translate(24px, 24px) rotate(0);transform:translate(24px, 24px) rotate(0)}:host(.animate-right-outro) .window,:host(.animate-right-outro)>::slotted([slot=window]){-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}:host(.animate-right-outro) .close{-webkit-transform:translate(-24px, 24px) rotate(90deg);transform:translate(-24px, 24px) rotate(90deg)}:host(.animate-right) .close{left:0px;-webkit-transform:translate(-36px, 24px) rotate(-90deg);transform:translate(-36px, 24px) rotate(-90deg)}:host(.animate-left){-ms-flex-pack:start;justify-content:flex-start}:host(.animate-left) .window,:host(.animate-left)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-left-intro) .window,:host(.animate-left-intro)>::slotted([slot=window]){-webkit-transform:translateX(calc(-100% - 50px));transform:translateX(calc(-100% - 50px))}:host(.animate-left-opened.animate-left-outro) .window,:host(.animate-left-opened.animate-left-outro)>::slotted([slot=window]),:host(.animate-left-opened) .window,:host(.animate-left-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}:host(.animate-left-opened) .close,:host(.animate-left-opened.animate-left-outro) .close{opacity:1;-webkit-transform:translate(-24px, 24px) rotate(0);transform:translate(-24px, 24px) rotate(0)}:host(.animate-left-outro) .window,:host(.animate-left-outro)>::slotted([slot=window]){-webkit-transform:translateX(calc(-100% - 50px));transform:translateX(calc(-100% - 50px))}:host(.animate-left-outro) .close{-webkit-transform:translate(24px, 24px) rotate(-90deg);transform:translate(24px, 24px) rotate(-90deg)}:host(.animate-left) .close{right:0px;-webkit-transform:translate(36px, 24px) rotate(90deg);transform:translate(36px, 24px) rotate(90deg)}";
|
|
45
|
+
|
|
46
|
+
let MdsModal$1 = class extends HTMLElement {
|
|
47
|
+
constructor() {
|
|
48
|
+
super();
|
|
49
|
+
this.__registerHost();
|
|
50
|
+
this.__attachShadow();
|
|
51
|
+
this.close = createEvent(this, "close", 7);
|
|
52
|
+
this.window = null;
|
|
53
|
+
this.top = null;
|
|
54
|
+
this.bottom = null;
|
|
55
|
+
this.animationState = 'intro';
|
|
56
|
+
/**
|
|
57
|
+
* Specifies the animation position of the modal window
|
|
58
|
+
*/
|
|
59
|
+
this.position = null;
|
|
60
|
+
this.animationName = (customState = null, customPosition = null) => {
|
|
61
|
+
return `animate-${customPosition !== null ? customPosition : this.position}${customState !== null ? '-' + customState : ''}`;
|
|
62
|
+
};
|
|
63
|
+
this.closeModal = (e = null) => {
|
|
64
|
+
var _a;
|
|
65
|
+
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.localName) !== 'mds-modal') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.opened = e.target !== e.currentTarget;
|
|
69
|
+
if (!this.opened) {
|
|
70
|
+
this.close.emit();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
componentWillLoad() {
|
|
75
|
+
this.bottom = this.hostElement.querySelector('[slot="bottom"]') !== null;
|
|
76
|
+
this.top = this.hostElement.querySelector('[slot="top"]') !== null;
|
|
77
|
+
this.window = this.hostElement.querySelector('[slot="window"]') !== null;
|
|
78
|
+
this.stateOpened = this.opened;
|
|
79
|
+
if (this.window && this.position === null) {
|
|
80
|
+
this.position = 'center';
|
|
81
|
+
}
|
|
82
|
+
if (this.position === null) {
|
|
83
|
+
this.position = 'right';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
componentWillRender() {
|
|
87
|
+
this.animationState = this.opened ? 'intro' : 'outro';
|
|
88
|
+
this.hostElement.classList.add(this.animationName());
|
|
89
|
+
}
|
|
90
|
+
componentDidRender() {
|
|
91
|
+
this.animationDeelay = window.setTimeout(() => {
|
|
92
|
+
this.animationState = this.animationState === 'intro' ? 'outro' : 'intro';
|
|
93
|
+
this.hostElement.classList.remove(this.animationName(this.animationState === 'intro' ? 'outro' : 'intro'));
|
|
94
|
+
this.hostElement.classList.add(this.animationName(this.animationState));
|
|
95
|
+
window.clearTimeout(this.animationDeelay);
|
|
96
|
+
}, 500);
|
|
97
|
+
}
|
|
98
|
+
positionChange(_newValue, oldValue) {
|
|
99
|
+
window.clearTimeout(this.animationDeelay);
|
|
100
|
+
this.hostElement.classList.remove(this.animationName(null, oldValue));
|
|
101
|
+
this.hostElement.classList.remove(this.animationName('intro', oldValue));
|
|
102
|
+
this.hostElement.classList.remove(this.animationName('outro', oldValue));
|
|
103
|
+
}
|
|
104
|
+
openedChange(newValue) {
|
|
105
|
+
this.stateOpened = newValue;
|
|
106
|
+
window.clearTimeout(this.animationDeelay);
|
|
107
|
+
}
|
|
108
|
+
onCloseListener() {
|
|
109
|
+
this.opened = false;
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
return (h(Host, { class: clsx(this.stateOpened && this.animationName('opened')), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
113
|
+
?
|
|
114
|
+
h("slot", { name: "window" })
|
|
115
|
+
:
|
|
116
|
+
h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`) }, this.top &&
|
|
117
|
+
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
118
|
+
h("slot", { name: "bottom" })), !this.window && h("mds-icon", { name: "close", class: "close" })));
|
|
119
|
+
}
|
|
120
|
+
get hostElement() { return this; }
|
|
121
|
+
static get watchers() { return {
|
|
122
|
+
"position": ["positionChange"],
|
|
123
|
+
"opened": ["openedChange"]
|
|
124
|
+
}; }
|
|
125
|
+
static get style() { return mdsModalCss; }
|
|
126
|
+
};
|
|
127
|
+
MdsModal$1 = /*@__PURE__*/ proxyCustomElement(MdsModal$1, [1, "mds-modal", {
|
|
128
|
+
"opened": [1540],
|
|
129
|
+
"position": [1537],
|
|
130
|
+
"stateOpened": [32]
|
|
131
|
+
}, [[4, "close", "onCloseListener"]]]);
|
|
132
|
+
function defineCustomElement$1() {
|
|
133
|
+
if (typeof customElements === "undefined") {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const components = ["mds-modal"];
|
|
137
|
+
components.forEach(tagName => { switch (tagName) {
|
|
138
|
+
case "mds-modal":
|
|
139
|
+
if (!customElements.get(tagName)) {
|
|
140
|
+
customElements.define(tagName, MdsModal$1);
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
} });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const MdsModal = MdsModal$1;
|
|
147
|
+
const defineCustomElement = defineCustomElement$1;
|
|
148
|
+
|
|
149
|
+
export { MdsModal, defineCustomElement };
|