@maggioli-design-system/mds-modal 4.7.1 → 4.7.3
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-1c3a970e.js → index-b3e2062a.js} +51 -31
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mds-modal.cjs.entry.js +130 -130
- package/dist/cjs/mds-modal.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/common/aria.js +18 -18
- package/dist/collection/common/keyboard-manager.js +38 -38
- package/dist/collection/common/unit.js +7 -7
- package/dist/collection/components/mds-modal/mds-modal.css +7 -30
- package/dist/collection/components/mds-modal/mds-modal.js +188 -188
- package/dist/collection/components/mds-modal/meta/dictionary.js +5 -5
- package/dist/collection/components/mds-modal/test/mds-modal.e2e.js +34 -34
- package/dist/collection/components/mds-modal/test/mds-modal.stories.js +16 -16
- package/dist/collection/dictionary/autocomplete.js +56 -56
- package/dist/collection/dictionary/button.js +19 -19
- package/dist/collection/dictionary/color.js +14 -14
- package/dist/collection/dictionary/floating-ui.js +14 -14
- package/dist/collection/dictionary/input.js +31 -15
- package/dist/collection/dictionary/loading.js +2 -2
- package/dist/collection/dictionary/typography.js +46 -46
- package/dist/collection/dictionary/variant.js +54 -54
- package/dist/collection/fixtures/cities.js +107 -107
- package/dist/components/mds-modal.d.ts +2 -2
- package/dist/components/mds-modal.js +150 -150
- package/dist/documentation.d.ts +1 -21
- package/dist/documentation.json +2 -2
- package/dist/esm/{index-a33ffd58.js → index-fd30d325.js} +51 -31
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mds-modal.entry.js +130 -130
- package/dist/esm/mds-modal.js +3 -3
- package/dist/esm-es5/index-fd30d325.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 +15 -15
- package/dist/mds-modal/p-14f0bf74.system.js +2 -0
- package/dist/mds-modal/p-59a0095c.system.entry.js +1 -0
- package/dist/mds-modal/p-6086db8a.entry.js +1 -0
- package/dist/mds-modal/{p-7ead5b8b.system.js → p-88c57c56.system.js} +1 -1
- package/dist/mds-modal/p-aff993b4.js +2 -0
- package/dist/stats.json +37 -34
- package/dist/types/common/keyboard-manager.d.ts +9 -9
- package/dist/types/components/mds-modal/test/mds-modal.stories.d.ts +20 -20
- package/dist/types/dictionary/input.d.ts +2 -1
- package/dist/types/interface/input-value.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +8 -0
- package/documentation.json +14 -4
- package/package.json +4 -4
- package/src/components/mds-modal/css/mds-modal-animate-bottom.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-center.css +2 -2
- package/src/components/mds-modal/css/mds-modal-animate-top.css +2 -2
- package/src/components/mds-modal/mds-modal.css +2 -2
- package/src/dictionary/input.ts +18 -0
- package/src/fixtures/icons.json +3 -0
- package/src/fixtures/iconsauce.json +3 -0
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/mds-modal.js +15 -15
- package/www/build/p-14f0bf74.system.js +2 -0
- package/www/build/p-59a0095c.system.entry.js +1 -0
- package/www/build/p-6086db8a.entry.js +1 -0
- package/www/build/{p-7ead5b8b.system.js → p-88c57c56.system.js} +1 -1
- package/www/build/p-aff993b4.js +2 -0
- package/dist/esm-es5/index-a33ffd58.js +0 -1
- package/dist/mds-modal/p-506f8ff7.system.js +0 -2
- package/dist/mds-modal/p-602c50be.js +0 -2
- package/dist/mds-modal/p-a0636f54.system.entry.js +0 -1
- package/dist/mds-modal/p-c5a84e4d.entry.js +0 -1
- package/www/build/p-506f8ff7.system.js +0 -2
- package/www/build/p-602c50be.js +0 -2
- package/www/build/p-a0636f54.system.entry.js +0 -1
- package/www/build/p-c5a84e4d.entry.js +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
const hash = (s) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
let i, h;
|
|
3
|
+
for (i = 0, h = 0; i < s.length; i++) {
|
|
4
|
+
h = Math.imul(31, h) + s.charCodeAt(i) | 0;
|
|
5
|
+
}
|
|
6
|
+
return h.toString();
|
|
7
7
|
};
|
|
8
8
|
const randomInt = (max) => Math.floor(Math.random() * max);
|
|
9
9
|
const unslugName = (name) => {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
return (_c = (_b = (_a = name.split('/')) === null || _a === void 0 ? void 0 : _a.slice(-1).pop()) === null || _b === void 0 ? void 0 : _b.replace(/-/g, ' ')) !== null && _c !== void 0 ? _c : name;
|
|
12
12
|
};
|
|
13
13
|
const setAttributeIfEmpty = (element, attribute, value) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
var _a;
|
|
15
|
+
if (element.hasAttribute(attribute)) {
|
|
16
|
+
return (_a = element.getAttribute(attribute)) !== null && _a !== void 0 ? _a : '';
|
|
17
|
+
}
|
|
18
|
+
element.setAttribute(attribute, value);
|
|
19
|
+
return value;
|
|
20
20
|
};
|
|
21
21
|
const hashValue = (value) => `${value}-${hash(value)}`;
|
|
22
22
|
const hashRandomValue = (value) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const randomValue = randomInt(1000000);
|
|
24
|
+
if (value) {
|
|
25
|
+
return `${value}-${hash(randomValue.toString())}`;
|
|
26
|
+
}
|
|
27
|
+
return hash(randomValue.toString());
|
|
28
28
|
};
|
|
29
29
|
export { unslugName, setAttributeIfEmpty, hashRandomValue, hashValue, };
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
export class KeyboardManager {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
constructor() {
|
|
3
|
+
this.elements = [];
|
|
4
|
+
this.handleClickBehaviorDispatchEvent = (event) => {
|
|
5
|
+
if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {
|
|
6
|
+
event.target.click();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
this.handleEscapeBehaviorDispatchEvent = (event) => {
|
|
10
|
+
if (event.code === 'Escape' && this.escapeCallback) {
|
|
11
|
+
this.escapeCallback();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
this.addElement = (el, name = 'element') => {
|
|
15
|
+
this.elements[name] = el;
|
|
16
|
+
};
|
|
17
|
+
this.attachClickBehavior = (name = 'element') => {
|
|
18
|
+
if (this.elements[name]) {
|
|
19
|
+
this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
this.detachClickBehavior = (name = 'element') => {
|
|
23
|
+
if (this.elements[name]) {
|
|
24
|
+
this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
this.attachEscapeBehavior = (callBack) => {
|
|
28
|
+
this.escapeCallback = callBack;
|
|
29
|
+
if (window !== undefined) {
|
|
30
|
+
window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this.detachEscapeBehavior = () => {
|
|
34
|
+
this.escapeCallback = () => { return; };
|
|
35
|
+
if (window !== undefined) {
|
|
36
|
+
window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
40
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const cssDurationToMilliseconds = (duration, defaultValue = 1000) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
if (duration.includes('s')) {
|
|
3
|
+
return Number(duration.replace('s', '')) * 1000;
|
|
4
|
+
}
|
|
5
|
+
if (duration.includes('ms')) {
|
|
6
|
+
return Number(duration.replace('s', ''));
|
|
7
|
+
}
|
|
8
|
+
return defaultValue;
|
|
9
9
|
};
|
|
10
10
|
export { cssDurationToMilliseconds, };
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
.svg svg {
|
|
21
|
-
aspect-ratio: 1
|
|
21
|
+
aspect-ratio: 1/1;
|
|
22
22
|
height: 100%;
|
|
23
23
|
width: 100%;
|
|
24
24
|
}
|
|
@@ -34,21 +34,14 @@
|
|
|
34
34
|
.absolute {
|
|
35
35
|
position: absolute;
|
|
36
36
|
}
|
|
37
|
-
.mx-6 {
|
|
38
|
-
margin-left: 1.5rem;
|
|
39
|
-
margin-right: 1.5rem;
|
|
40
|
-
}
|
|
41
37
|
.ml-auto {
|
|
42
38
|
margin-left: auto;
|
|
43
39
|
}
|
|
44
40
|
.flex {
|
|
45
41
|
display: flex;
|
|
46
42
|
}
|
|
47
|
-
.w-16 {
|
|
48
|
-
width: 4rem;
|
|
49
|
-
}
|
|
50
43
|
.min-w-0 {
|
|
51
|
-
min-width:
|
|
44
|
+
min-width: 0rem;
|
|
52
45
|
}
|
|
53
46
|
.max-w-lg {
|
|
54
47
|
max-width: 32rem;
|
|
@@ -59,9 +52,6 @@
|
|
|
59
52
|
.items-center {
|
|
60
53
|
align-items: center;
|
|
61
54
|
}
|
|
62
|
-
.gap-4 {
|
|
63
|
-
gap: 1rem;
|
|
64
|
-
}
|
|
65
55
|
.truncate {
|
|
66
56
|
overflow: hidden;
|
|
67
57
|
text-overflow: ellipsis;
|
|
@@ -86,12 +76,6 @@
|
|
|
86
76
|
.bg-transparent {
|
|
87
77
|
background-color: transparent;
|
|
88
78
|
}
|
|
89
|
-
.p-4 {
|
|
90
|
-
padding: 1rem;
|
|
91
|
-
}
|
|
92
|
-
.p-8 {
|
|
93
|
-
padding: 2rem;
|
|
94
|
-
}
|
|
95
79
|
.text-tone-neutral-02 {
|
|
96
80
|
--tw-text-opacity: 1;
|
|
97
81
|
color: rgb(var(--tone-neutral-02) / var(--tw-text-opacity));
|
|
@@ -160,12 +144,11 @@
|
|
|
160
144
|
}
|
|
161
145
|
|
|
162
146
|
.close {
|
|
163
|
-
top:
|
|
147
|
+
top: 0rem;
|
|
164
148
|
height: 2.25rem;
|
|
165
149
|
width: 2.25rem;
|
|
166
150
|
border-radius: 9999px;
|
|
167
|
-
font-size:
|
|
168
|
-
line-height: 2.5rem;
|
|
151
|
+
font-size: 3rem;
|
|
169
152
|
opacity: 0;
|
|
170
153
|
transition-duration: 500ms;
|
|
171
154
|
transition-timing-function: cubic-bezier(0.77, 0, 0.175, 1);
|
|
@@ -180,7 +163,7 @@
|
|
|
180
163
|
|
|
181
164
|
.window {
|
|
182
165
|
height: 100%;
|
|
183
|
-
gap:
|
|
166
|
+
gap: 0rem;
|
|
184
167
|
|
|
185
168
|
background-color: var(--mds-modal-window-background);
|
|
186
169
|
box-shadow: var(--mds-modal-window-shadow);
|
|
@@ -332,7 +315,7 @@
|
|
|
332
315
|
}
|
|
333
316
|
|
|
334
317
|
:host( .to-left ) .close {
|
|
335
|
-
right:
|
|
318
|
+
right: 0rem;
|
|
336
319
|
|
|
337
320
|
transform: translate(36px, 24px) rotate(90deg);
|
|
338
321
|
}
|
|
@@ -381,7 +364,7 @@
|
|
|
381
364
|
}
|
|
382
365
|
|
|
383
366
|
:host( .to-right ) .close {
|
|
384
|
-
left:
|
|
367
|
+
left: 0rem;
|
|
385
368
|
|
|
386
369
|
transform: translate(-36px, 24px) rotate(-90deg);
|
|
387
370
|
}
|
|
@@ -429,10 +412,4 @@
|
|
|
429
412
|
transform: rotateX(-22deg) scale(0.5) translateY(-40%);
|
|
430
413
|
}
|
|
431
414
|
|
|
432
|
-
@media (max-width: 767px) {
|
|
433
|
-
.mobile\:w-12 {
|
|
434
|
-
width: 3rem;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
415
|
|
|
@@ -9,194 +9,194 @@ import { KeyboardManager } from "../../common/keyboard-manager";
|
|
|
9
9
|
* @slot window - Use directly a window component if you need it. Add `text string`, `HTML elements` or `components` to this slot.
|
|
10
10
|
*/
|
|
11
11
|
export class MdsModal {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
this.opened = e.target !== e.currentTarget;
|
|
36
|
-
if (!this.opened) {
|
|
37
|
-
this.closeEvent.emit();
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
this.stateOpened = undefined;
|
|
41
|
-
this.opened = false;
|
|
42
|
-
this.position = 'center';
|
|
43
|
-
}
|
|
44
|
-
componentWillLoad() {
|
|
45
|
-
var _a;
|
|
46
|
-
this.bottom = this.host.querySelector('[slot="bottom"]') !== null;
|
|
47
|
-
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
48
|
-
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
49
|
-
this.stateOpened = this.opened;
|
|
50
|
-
if (!this.window) {
|
|
51
|
-
this.position = 'right';
|
|
52
|
-
}
|
|
53
|
-
if (this.window) {
|
|
54
|
-
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'modal');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
componentWillRender() {
|
|
58
|
-
this.animationState = this.opened ? 'intro' : 'outro';
|
|
59
|
-
this.host.classList.add(this.animationName());
|
|
60
|
-
}
|
|
61
|
-
componentDidRender() {
|
|
62
|
-
this.animationDeelay = window.setTimeout(() => {
|
|
63
|
-
this.animationState = this.animationState === 'intro' ? 'outro' : 'intro';
|
|
64
|
-
this.host.classList.remove(this.animationName(this.animationState === 'intro' ? 'outro' : 'intro'));
|
|
65
|
-
this.host.classList.add(this.animationName(this.animationState));
|
|
66
|
-
window.clearTimeout(this.animationDeelay);
|
|
67
|
-
}, 500);
|
|
68
|
-
}
|
|
69
|
-
disconnectedCallback() {
|
|
70
|
-
this.km.detachEscapeBehavior();
|
|
71
|
-
this.km.detachClickBehavior('close');
|
|
72
|
-
}
|
|
73
|
-
positionChange(_newValue, oldValue) {
|
|
74
|
-
window.clearTimeout(this.animationDeelay);
|
|
75
|
-
this.host.classList.remove(this.animationName('', oldValue));
|
|
76
|
-
this.host.classList.remove(this.animationName('intro', oldValue));
|
|
77
|
-
this.host.classList.remove(this.animationName('outro', oldValue));
|
|
78
|
-
}
|
|
79
|
-
openedChange(newValue) {
|
|
80
|
-
this.stateOpened = newValue;
|
|
81
|
-
window.clearTimeout(this.animationDeelay);
|
|
82
|
-
}
|
|
83
|
-
onModalCloseListener() {
|
|
84
|
-
this.opened = false;
|
|
85
|
-
}
|
|
86
|
-
onBannerCloseListener() {
|
|
87
|
-
this.opened = false;
|
|
88
|
-
}
|
|
89
|
-
render() {
|
|
90
|
-
return (h(Host, { "aria-modal": clsx(this.opened ? 'true' : 'false'), class: clsx(this.stateOpened && this.animationName('opened')), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
91
|
-
? h("slot", { name: "window" })
|
|
92
|
-
: h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog", part: "window" }, this.top &&
|
|
93
|
-
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
94
|
-
h("slot", { name: "bottom" })), !this.window && h("i", { innerHTML: miBaselineClose, tabindex: "0", onClick: (e) => { this.closeModal(e); }, class: "svg close focus-bounce-light" })));
|
|
95
|
-
}
|
|
96
|
-
static get is() { return "mds-modal"; }
|
|
97
|
-
static get encapsulation() { return "shadow"; }
|
|
98
|
-
static get originalStyleUrls() {
|
|
99
|
-
return {
|
|
100
|
-
"$": ["mds-modal.css"]
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
static get styleUrls() {
|
|
104
|
-
return {
|
|
105
|
-
"$": ["mds-modal.css"]
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
static get properties() {
|
|
109
|
-
return {
|
|
110
|
-
"opened": {
|
|
111
|
-
"type": "boolean",
|
|
112
|
-
"mutable": true,
|
|
113
|
-
"complexType": {
|
|
114
|
-
"original": "boolean",
|
|
115
|
-
"resolved": "boolean",
|
|
116
|
-
"references": {}
|
|
117
|
-
},
|
|
118
|
-
"required": false,
|
|
119
|
-
"optional": false,
|
|
120
|
-
"docs": {
|
|
121
|
-
"tags": [],
|
|
122
|
-
"text": "Specifies if the modal is opened or not"
|
|
123
|
-
},
|
|
124
|
-
"attribute": "opened",
|
|
125
|
-
"reflect": true,
|
|
126
|
-
"defaultValue": "false"
|
|
127
|
-
},
|
|
128
|
-
"position": {
|
|
129
|
-
"type": "string",
|
|
130
|
-
"mutable": true,
|
|
131
|
-
"complexType": {
|
|
132
|
-
"original": "ModalPositionType",
|
|
133
|
-
"resolved": "\"bottom\" | \"center\" | \"left\" | \"right\" | \"top\" | undefined",
|
|
134
|
-
"references": {
|
|
135
|
-
"ModalPositionType": {
|
|
136
|
-
"location": "import",
|
|
137
|
-
"path": "./meta/types",
|
|
138
|
-
"id": "src/components/mds-modal/meta/types.ts::ModalPositionType"
|
|
12
|
+
constructor() {
|
|
13
|
+
this.window = false;
|
|
14
|
+
this.top = false;
|
|
15
|
+
this.bottom = false;
|
|
16
|
+
this.animationState = 'intro';
|
|
17
|
+
this.km = new KeyboardManager();
|
|
18
|
+
this.componentDidLoad = () => {
|
|
19
|
+
var _a;
|
|
20
|
+
this.km.addElement(this.host, 'host');
|
|
21
|
+
const close = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.close');
|
|
22
|
+
if (close)
|
|
23
|
+
this.km.addElement(close, 'close');
|
|
24
|
+
this.km.attachEscapeBehavior(() => this.closeEvent.emit());
|
|
25
|
+
this.km.attachClickBehavior('close');
|
|
26
|
+
};
|
|
27
|
+
this.animationName = (customState = '', customPosition = '') => {
|
|
28
|
+
return `to-${customPosition !== '' ? customPosition : this.position}${customState !== '' ? '-' + customState : ''}`;
|
|
29
|
+
};
|
|
30
|
+
this.closeModal = (e) => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.localName) !== 'mds-modal') {
|
|
33
|
+
return;
|
|
139
34
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return [{
|
|
161
|
-
"method": "closeEvent",
|
|
162
|
-
"name": "mdsModalClose",
|
|
163
|
-
"bubbles": true,
|
|
164
|
-
"cancelable": true,
|
|
165
|
-
"composed": true,
|
|
166
|
-
"docs": {
|
|
167
|
-
"tags": [],
|
|
168
|
-
"text": "Emits when a modal is closed"
|
|
169
|
-
},
|
|
170
|
-
"complexType": {
|
|
171
|
-
"original": "void",
|
|
172
|
-
"resolved": "void",
|
|
173
|
-
"references": {}
|
|
35
|
+
this.opened = e.target !== e.currentTarget;
|
|
36
|
+
if (!this.opened) {
|
|
37
|
+
this.closeEvent.emit();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this.stateOpened = undefined;
|
|
41
|
+
this.opened = false;
|
|
42
|
+
this.position = 'center';
|
|
43
|
+
}
|
|
44
|
+
componentWillLoad() {
|
|
45
|
+
var _a;
|
|
46
|
+
this.bottom = this.host.querySelector('[slot="bottom"]') !== null;
|
|
47
|
+
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
48
|
+
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
49
|
+
this.stateOpened = this.opened;
|
|
50
|
+
if (!this.window) {
|
|
51
|
+
this.position = 'right';
|
|
52
|
+
}
|
|
53
|
+
if (this.window) {
|
|
54
|
+
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'modal');
|
|
174
55
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
56
|
+
}
|
|
57
|
+
componentWillRender() {
|
|
58
|
+
this.animationState = this.opened ? 'intro' : 'outro';
|
|
59
|
+
this.host.classList.add(this.animationName());
|
|
60
|
+
}
|
|
61
|
+
componentDidRender() {
|
|
62
|
+
this.animationDeelay = window.setTimeout(() => {
|
|
63
|
+
this.animationState = this.animationState === 'intro' ? 'outro' : 'intro';
|
|
64
|
+
this.host.classList.remove(this.animationName(this.animationState === 'intro' ? 'outro' : 'intro'));
|
|
65
|
+
this.host.classList.add(this.animationName(this.animationState));
|
|
66
|
+
window.clearTimeout(this.animationDeelay);
|
|
67
|
+
}, 500);
|
|
68
|
+
}
|
|
69
|
+
disconnectedCallback() {
|
|
70
|
+
this.km.detachEscapeBehavior();
|
|
71
|
+
this.km.detachClickBehavior('close');
|
|
72
|
+
}
|
|
73
|
+
positionChange(_newValue, oldValue) {
|
|
74
|
+
window.clearTimeout(this.animationDeelay);
|
|
75
|
+
this.host.classList.remove(this.animationName('', oldValue));
|
|
76
|
+
this.host.classList.remove(this.animationName('intro', oldValue));
|
|
77
|
+
this.host.classList.remove(this.animationName('outro', oldValue));
|
|
78
|
+
}
|
|
79
|
+
openedChange(newValue) {
|
|
80
|
+
this.stateOpened = newValue;
|
|
81
|
+
window.clearTimeout(this.animationDeelay);
|
|
82
|
+
}
|
|
83
|
+
onModalCloseListener() {
|
|
84
|
+
this.opened = false;
|
|
85
|
+
}
|
|
86
|
+
onBannerCloseListener() {
|
|
87
|
+
this.opened = false;
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
return (h(Host, { "aria-modal": clsx(this.opened ? 'true' : 'false'), class: clsx(this.stateOpened && this.animationName('opened')), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
91
|
+
? h("slot", { name: "window" })
|
|
92
|
+
: h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog", part: "window" }, this.top &&
|
|
93
|
+
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
94
|
+
h("slot", { name: "bottom" })), !this.window && h("i", { innerHTML: miBaselineClose, tabindex: "0", onClick: (e) => { this.closeModal(e); }, class: "svg close focus-bounce-light" })));
|
|
95
|
+
}
|
|
96
|
+
static get is() { return "mds-modal"; }
|
|
97
|
+
static get encapsulation() { return "shadow"; }
|
|
98
|
+
static get originalStyleUrls() {
|
|
99
|
+
return {
|
|
100
|
+
"$": ["mds-modal.css"]
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
static get styleUrls() {
|
|
104
|
+
return {
|
|
105
|
+
"$": ["mds-modal.css"]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
static get properties() {
|
|
109
|
+
return {
|
|
110
|
+
"opened": {
|
|
111
|
+
"type": "boolean",
|
|
112
|
+
"mutable": true,
|
|
113
|
+
"complexType": {
|
|
114
|
+
"original": "boolean",
|
|
115
|
+
"resolved": "boolean",
|
|
116
|
+
"references": {}
|
|
117
|
+
},
|
|
118
|
+
"required": false,
|
|
119
|
+
"optional": false,
|
|
120
|
+
"docs": {
|
|
121
|
+
"tags": [],
|
|
122
|
+
"text": "Specifies if the modal is opened or not"
|
|
123
|
+
},
|
|
124
|
+
"attribute": "opened",
|
|
125
|
+
"reflect": true,
|
|
126
|
+
"defaultValue": "false"
|
|
127
|
+
},
|
|
128
|
+
"position": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"mutable": true,
|
|
131
|
+
"complexType": {
|
|
132
|
+
"original": "ModalPositionType",
|
|
133
|
+
"resolved": "\"bottom\" | \"center\" | \"left\" | \"right\" | \"top\" | undefined",
|
|
134
|
+
"references": {
|
|
135
|
+
"ModalPositionType": {
|
|
136
|
+
"location": "import",
|
|
137
|
+
"path": "./meta/types",
|
|
138
|
+
"id": "src/components/mds-modal/meta/types.ts::ModalPositionType"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"required": false,
|
|
143
|
+
"optional": true,
|
|
144
|
+
"docs": {
|
|
145
|
+
"tags": [],
|
|
146
|
+
"text": "Specifies the animation position of the modal window"
|
|
147
|
+
},
|
|
148
|
+
"attribute": "position",
|
|
149
|
+
"reflect": true,
|
|
150
|
+
"defaultValue": "'center'"
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
static get states() {
|
|
155
|
+
return {
|
|
156
|
+
"stateOpened": {}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
static get events() {
|
|
160
|
+
return [{
|
|
161
|
+
"method": "closeEvent",
|
|
162
|
+
"name": "mdsModalClose",
|
|
163
|
+
"bubbles": true,
|
|
164
|
+
"cancelable": true,
|
|
165
|
+
"composed": true,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": "Emits when a modal is closed"
|
|
169
|
+
},
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "void",
|
|
172
|
+
"resolved": "void",
|
|
173
|
+
"references": {}
|
|
174
|
+
}
|
|
175
|
+
}];
|
|
176
|
+
}
|
|
177
|
+
static get elementRef() { return "host"; }
|
|
178
|
+
static get watchers() {
|
|
179
|
+
return [{
|
|
180
|
+
"propName": "position",
|
|
181
|
+
"methodName": "positionChange"
|
|
182
|
+
}, {
|
|
183
|
+
"propName": "opened",
|
|
184
|
+
"methodName": "openedChange"
|
|
185
|
+
}];
|
|
186
|
+
}
|
|
187
|
+
static get listeners() {
|
|
188
|
+
return [{
|
|
189
|
+
"name": "mdsModalClose",
|
|
190
|
+
"method": "onModalCloseListener",
|
|
191
|
+
"target": "document",
|
|
192
|
+
"capture": false,
|
|
193
|
+
"passive": false
|
|
194
|
+
}, {
|
|
195
|
+
"name": "mdsBannerClose",
|
|
196
|
+
"method": "onBannerCloseListener",
|
|
197
|
+
"target": "document",
|
|
198
|
+
"capture": false,
|
|
199
|
+
"passive": false
|
|
200
|
+
}];
|
|
201
|
+
}
|
|
202
202
|
}
|