@maggioli-design-system/mds-modal 3.5.0 → 3.6.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 +63 -35
- package/dist/collection/common/keyboard-manager.js +40 -0
- package/dist/collection/components/mds-modal/mds-modal.css +164 -23
- package/dist/collection/components/mds-modal/mds-modal.js +22 -34
- package/dist/collection/dictionary/typography.js +5 -1
- package/dist/components/mds-modal.js +63 -35
- package/dist/esm/mds-modal.entry.js +63 -35
- 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-2a5d50d2.entry.js +1 -0
- package/dist/mds-modal/p-64ab5c19.system.entry.js +1 -0
- package/dist/mds-modal/p-f856db3e.system.js +1 -1
- package/dist/stats.json +22 -19
- package/dist/types/common/keyboard-manager.d.ts +11 -0
- package/dist/types/dictionary/typography.d.ts +2 -1
- package/dist/types/types/typography.d.ts +1 -0
- package/package.json +2 -2
- package/readme.md +2 -2
- package/src/common/keyboard-manager.ts +46 -0
- package/src/components/mds-modal/mds-modal.css +3 -2
- package/src/components/mds-modal/mds-modal.tsx +22 -40
- package/src/components/mds-modal/test/mds-modal.e2e.ts +2 -2
- package/src/dictionary/typography.ts +9 -3
- package/src/fixtures/icons.json +1 -0
- package/src/tailwind/components.css +1 -0
- package/src/types/typography.ts +4 -0
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/p-2a5d50d2.entry.js +1 -0
- package/www/build/p-64ab5c19.system.entry.js +1 -0
- package/www/build/p-f856db3e.system.js +1 -1
- package/dist/mds-modal/p-1a268c3b.system.entry.js +0 -1
- package/dist/mds-modal/p-a8cbce5a.entry.js +0 -1
- package/www/build/p-1a268c3b.system.entry.js +0 -1
- package/www/build/p-a8cbce5a.entry.js +0 -1
|
@@ -1,102 +1,171 @@
|
|
|
1
1
|
@tailwind components;
|
|
2
|
+
|
|
3
|
+
.focus-off,
|
|
4
|
+
.focusable,
|
|
5
|
+
.focusable-light,
|
|
6
|
+
.focusable-light-off{
|
|
7
|
+
|
|
8
|
+
transition-duration: 200ms;
|
|
9
|
+
|
|
10
|
+
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
11
|
+
|
|
12
|
+
outline-offset: var(--magma-outline-blur-offset);
|
|
13
|
+
outline: var(--magma-outline-blur);
|
|
14
|
+
transition-property: background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.focus-on,
|
|
18
|
+
.focusable-light:focus-visible,
|
|
19
|
+
.focusable:focus-visible {
|
|
20
|
+
--magma-outline-blur-offset: var(--magma-outline-focus-offset);
|
|
21
|
+
--magma-outline-blur: var(--magma-outline-focus);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.focus-light-on,
|
|
25
|
+
.focusable-light:focus-visible {
|
|
26
|
+
--magma-outline-blur: 2px solid rgb(var(--tone-neutral));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.svg{
|
|
30
|
+
|
|
31
|
+
display: flex;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.svg svg{
|
|
35
|
+
|
|
36
|
+
aspect-ratio: 1 / 1;
|
|
37
|
+
|
|
38
|
+
height: 100%;
|
|
39
|
+
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.animate-left,
|
|
44
|
+
.animate-right{
|
|
45
|
+
|
|
46
|
+
opacity: 0;
|
|
47
|
+
|
|
48
|
+
transition-property: background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;
|
|
49
|
+
|
|
50
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
51
|
+
|
|
52
|
+
transition-duration: 500ms;
|
|
53
|
+
|
|
54
|
+
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.animate-right-intro,
|
|
58
|
+
.animate-right-outro {
|
|
59
|
+
transform: translateX(calc(100% + 50px));
|
|
60
|
+
}
|
|
2
61
|
.fixed{
|
|
62
|
+
|
|
3
63
|
position: fixed;
|
|
4
64
|
}
|
|
5
65
|
.absolute{
|
|
66
|
+
|
|
6
67
|
position: absolute;
|
|
7
68
|
}
|
|
8
69
|
.mx-6{
|
|
70
|
+
|
|
9
71
|
margin-left: 1.5rem;
|
|
72
|
+
|
|
10
73
|
margin-right: 1.5rem;
|
|
11
74
|
}
|
|
12
75
|
.ml-auto{
|
|
76
|
+
|
|
13
77
|
margin-left: auto;
|
|
14
78
|
}
|
|
15
79
|
.flex{
|
|
80
|
+
|
|
16
81
|
display: flex;
|
|
17
82
|
}
|
|
18
83
|
.w-16{
|
|
84
|
+
|
|
19
85
|
width: 4rem;
|
|
20
86
|
}
|
|
21
87
|
.min-w-0{
|
|
88
|
+
|
|
22
89
|
min-width: 0px;
|
|
23
90
|
}
|
|
24
91
|
.max-w-lg{
|
|
92
|
+
|
|
25
93
|
max-width: 32rem;
|
|
26
94
|
}
|
|
27
95
|
.max-w-xl{
|
|
96
|
+
|
|
28
97
|
max-width: 36rem;
|
|
29
98
|
}
|
|
30
99
|
.items-center{
|
|
100
|
+
|
|
31
101
|
align-items: center;
|
|
32
102
|
}
|
|
33
103
|
.gap-4{
|
|
104
|
+
|
|
34
105
|
gap: 1rem;
|
|
35
106
|
}
|
|
36
107
|
.truncate{
|
|
108
|
+
|
|
37
109
|
overflow: hidden;
|
|
110
|
+
|
|
38
111
|
text-overflow: ellipsis;
|
|
112
|
+
|
|
39
113
|
white-space: nowrap;
|
|
40
114
|
}
|
|
41
115
|
.rounded-full{
|
|
116
|
+
|
|
42
117
|
border-radius: 9999px;
|
|
43
118
|
}
|
|
44
119
|
.border{
|
|
120
|
+
|
|
45
121
|
border-width: 1px;
|
|
46
122
|
}
|
|
47
123
|
.border-b{
|
|
124
|
+
|
|
48
125
|
border-bottom-width: 1px;
|
|
49
126
|
}
|
|
50
127
|
.border-t{
|
|
128
|
+
|
|
51
129
|
border-top-width: 1px;
|
|
52
130
|
}
|
|
53
131
|
.border-tone-neutral-09{
|
|
132
|
+
|
|
54
133
|
--tw-border-opacity: 1;
|
|
134
|
+
|
|
55
135
|
border-color: rgba(var(--tone-neutral-09), var(--tw-border-opacity));
|
|
56
136
|
}
|
|
57
137
|
.bg-transparent{
|
|
138
|
+
|
|
58
139
|
background-color: transparent;
|
|
59
140
|
}
|
|
60
141
|
.p-8{
|
|
142
|
+
|
|
61
143
|
padding: 2rem;
|
|
62
144
|
}
|
|
63
145
|
.p-4{
|
|
146
|
+
|
|
64
147
|
padding: 1rem;
|
|
65
148
|
}
|
|
66
149
|
.text-tone-neutral-02{
|
|
150
|
+
|
|
67
151
|
--tw-text-opacity: 1;
|
|
152
|
+
|
|
68
153
|
color: rgba(var(--tone-neutral-02), var(--tw-text-opacity));
|
|
69
154
|
}
|
|
70
155
|
.text-tone-neutral-04{
|
|
156
|
+
|
|
71
157
|
--tw-text-opacity: 1;
|
|
158
|
+
|
|
72
159
|
color: rgba(var(--tone-neutral-04), var(--tw-text-opacity));
|
|
73
160
|
}
|
|
74
161
|
.shadow{
|
|
162
|
+
|
|
75
163
|
--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
164
|
+
|
|
76
165
|
--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
|
|
166
|
+
|
|
77
167
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
78
168
|
}
|
|
79
|
-
.svg{
|
|
80
|
-
display: flex;
|
|
81
|
-
}
|
|
82
|
-
.svg svg{
|
|
83
|
-
aspect-ratio: 1 / 1;
|
|
84
|
-
height: 100%;
|
|
85
|
-
width: 100%;
|
|
86
|
-
}
|
|
87
|
-
.animate-left,
|
|
88
|
-
.animate-right{
|
|
89
|
-
opacity: 0;
|
|
90
|
-
transition-property: background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;
|
|
91
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
92
|
-
transition-duration: 500ms;
|
|
93
|
-
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
94
|
-
}
|
|
95
|
-
.animate-right-intro,
|
|
96
|
-
.animate-right-outro {
|
|
97
|
-
transform: translateX(calc(100% + 50px));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
169
|
|
|
101
170
|
/**
|
|
102
171
|
* @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`.
|
|
@@ -132,12 +201,16 @@
|
|
|
132
201
|
}
|
|
133
202
|
|
|
134
203
|
:host ( [position=top] ){
|
|
204
|
+
|
|
135
205
|
align-items: flex-start;
|
|
206
|
+
|
|
136
207
|
justify-content: center;
|
|
137
208
|
}
|
|
138
209
|
|
|
139
210
|
:host ( [position=bottom] ){
|
|
211
|
+
|
|
140
212
|
align-items: flex-end;
|
|
213
|
+
|
|
141
214
|
justify-content: center;
|
|
142
215
|
}
|
|
143
216
|
|
|
@@ -146,34 +219,52 @@
|
|
|
146
219
|
:host ( .animate-left-opened ),
|
|
147
220
|
:host ( .animate-right-opened ),
|
|
148
221
|
:host ( .animate-top-opened ){
|
|
222
|
+
|
|
149
223
|
pointer-events: auto;
|
|
224
|
+
|
|
150
225
|
transition-duration: 500ms;
|
|
151
226
|
|
|
152
227
|
background-color: rgba(var(--mds-modal-overlay-color) / var(--mds-modal-overlay-opacity));
|
|
153
228
|
}
|
|
154
229
|
|
|
155
230
|
.close{
|
|
231
|
+
|
|
156
232
|
position: absolute;
|
|
233
|
+
|
|
157
234
|
top: 0px;
|
|
235
|
+
|
|
158
236
|
height: 2.25rem;
|
|
237
|
+
|
|
159
238
|
width: 2.25rem;
|
|
239
|
+
|
|
160
240
|
transform-origin: center;
|
|
241
|
+
|
|
161
242
|
cursor: pointer;
|
|
243
|
+
|
|
244
|
+
border-radius: 9999px;
|
|
245
|
+
|
|
162
246
|
fill: rgb(var(--tone-neutral-10));
|
|
247
|
+
|
|
163
248
|
font-size: 2.25rem;
|
|
249
|
+
|
|
164
250
|
line-height: 2.5rem;
|
|
251
|
+
|
|
165
252
|
opacity: 0;
|
|
166
|
-
|
|
167
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
253
|
+
|
|
168
254
|
transition-duration: 500ms;
|
|
255
|
+
|
|
169
256
|
transition-timing-function: cubic-bezier(0.77, 0, 0.175, 1);
|
|
170
257
|
|
|
258
|
+
transition-property: opacity, outline, outline-offset, transform;
|
|
171
259
|
transform: translate(0, 24px) rotate(90deg);
|
|
172
260
|
}
|
|
173
261
|
|
|
174
262
|
.window{
|
|
263
|
+
|
|
175
264
|
display: grid;
|
|
265
|
+
|
|
176
266
|
height: 100%;
|
|
267
|
+
|
|
177
268
|
gap: 0px;
|
|
178
269
|
|
|
179
270
|
background-color: var(--mds-modal-window-background);
|
|
@@ -196,22 +287,31 @@
|
|
|
196
287
|
}
|
|
197
288
|
|
|
198
289
|
:host ( .animate-bottom ){
|
|
290
|
+
|
|
199
291
|
justify-content: center;
|
|
292
|
+
|
|
200
293
|
padding: 2rem;
|
|
201
294
|
}
|
|
202
295
|
|
|
203
296
|
@media (max-width: 767px){
|
|
297
|
+
|
|
204
298
|
:host ( .animate-bottom ){
|
|
299
|
+
|
|
205
300
|
padding: 1rem;
|
|
206
301
|
}
|
|
207
302
|
}
|
|
208
303
|
|
|
209
304
|
:host ( .animate-bottom ) .window,
|
|
210
305
|
:host ( .animate-bottom ) > ::slotted ( [slot=window] ){
|
|
306
|
+
|
|
211
307
|
opacity: 0;
|
|
308
|
+
|
|
212
309
|
transition-property: background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;
|
|
310
|
+
|
|
213
311
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
312
|
+
|
|
214
313
|
transition-duration: 500ms;
|
|
314
|
+
|
|
215
315
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
216
316
|
}
|
|
217
317
|
|
|
@@ -224,6 +324,7 @@
|
|
|
224
324
|
:host ( .animate-bottom-opened.animate-bottom-outro ) > ::slotted ( [slot=window] ),
|
|
225
325
|
:host ( .animate-bottom-opened ) .window,
|
|
226
326
|
:host ( .animate-bottom-opened ) > ::slotted ( [slot=window] ){
|
|
327
|
+
|
|
227
328
|
opacity: 1;
|
|
228
329
|
|
|
229
330
|
transform: rotateX(0) scale(1) translateY(0);
|
|
@@ -235,22 +336,31 @@
|
|
|
235
336
|
}
|
|
236
337
|
|
|
237
338
|
:host ( .animate-center ){
|
|
339
|
+
|
|
238
340
|
justify-content: center;
|
|
341
|
+
|
|
239
342
|
padding: 2rem;
|
|
240
343
|
}
|
|
241
344
|
|
|
242
345
|
@media (max-width: 767px){
|
|
346
|
+
|
|
243
347
|
:host ( .animate-center ){
|
|
348
|
+
|
|
244
349
|
padding: 1rem;
|
|
245
350
|
}
|
|
246
351
|
}
|
|
247
352
|
|
|
248
353
|
:host ( .animate-center ) .window,
|
|
249
354
|
:host ( .animate-center ) > ::slotted ( [slot=window] ){
|
|
355
|
+
|
|
250
356
|
opacity: 0;
|
|
357
|
+
|
|
251
358
|
transition-property: background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;
|
|
359
|
+
|
|
252
360
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
361
|
+
|
|
253
362
|
transition-duration: 500ms;
|
|
363
|
+
|
|
254
364
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
255
365
|
}
|
|
256
366
|
|
|
@@ -263,6 +373,7 @@
|
|
|
263
373
|
:host ( .animate-center-opened.animate-center-outro ) > ::slotted ( [slot=window] ),
|
|
264
374
|
:host ( .animate-center-opened ) .window,
|
|
265
375
|
:host ( .animate-center-opened ) > ::slotted ( [slot=window] ){
|
|
376
|
+
|
|
266
377
|
opacity: 1;
|
|
267
378
|
|
|
268
379
|
transform: rotateX(0) scale(1) translateY(0);
|
|
@@ -274,15 +385,21 @@
|
|
|
274
385
|
}
|
|
275
386
|
|
|
276
387
|
:host ( .animate-left ){
|
|
388
|
+
|
|
277
389
|
justify-content: flex-start;
|
|
278
390
|
}
|
|
279
391
|
|
|
280
392
|
:host ( .animate-left ) .window,
|
|
281
393
|
:host ( .animate-left ) > ::slotted ( [slot=window] ){
|
|
394
|
+
|
|
282
395
|
opacity: 0;
|
|
396
|
+
|
|
283
397
|
transition-property: background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;
|
|
398
|
+
|
|
284
399
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
400
|
+
|
|
285
401
|
transition-duration: 500ms;
|
|
402
|
+
|
|
286
403
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
287
404
|
}
|
|
288
405
|
|
|
@@ -295,6 +412,7 @@
|
|
|
295
412
|
:host ( .animate-left-opened.animate-left-outro ) > ::slotted ( [slot=window] ),
|
|
296
413
|
:host ( .animate-left-opened ) .window,
|
|
297
414
|
:host ( .animate-left-opened ) > ::slotted ( [slot=window] ){
|
|
415
|
+
|
|
298
416
|
opacity: 1;
|
|
299
417
|
|
|
300
418
|
transform: translateX(0);
|
|
@@ -302,6 +420,7 @@
|
|
|
302
420
|
|
|
303
421
|
:host ( .animate-left-opened ) .close,
|
|
304
422
|
:host ( .animate-left-opened.animate-left-outro ) .close{
|
|
423
|
+
|
|
305
424
|
opacity: 1;
|
|
306
425
|
|
|
307
426
|
transform: translate(-24px, 24px) rotate(0);
|
|
@@ -317,21 +436,28 @@
|
|
|
317
436
|
}
|
|
318
437
|
|
|
319
438
|
:host ( .animate-left ) .close{
|
|
439
|
+
|
|
320
440
|
right: 0px;
|
|
321
441
|
|
|
322
442
|
transform: translate(36px, 24px) rotate(90deg);
|
|
323
443
|
}
|
|
324
444
|
|
|
325
445
|
:host ( .animate-right ){
|
|
446
|
+
|
|
326
447
|
justify-content: flex-end;
|
|
327
448
|
}
|
|
328
449
|
|
|
329
450
|
:host ( .animate-right ) .window,
|
|
330
451
|
:host ( .animate-right ) > ::slotted ( [slot=window] ){
|
|
452
|
+
|
|
331
453
|
opacity: 0;
|
|
454
|
+
|
|
332
455
|
transition-property: background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;
|
|
456
|
+
|
|
333
457
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
458
|
+
|
|
334
459
|
transition-duration: 500ms;
|
|
460
|
+
|
|
335
461
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
336
462
|
}
|
|
337
463
|
|
|
@@ -344,6 +470,7 @@
|
|
|
344
470
|
:host ( .animate-right-opened.animate-right-outro ) > ::slotted ( [slot=window] ),
|
|
345
471
|
:host ( .animate-right-opened ) .window,
|
|
346
472
|
:host ( .animate-right-opened ) > ::slotted ( [slot=window] ){
|
|
473
|
+
|
|
347
474
|
opacity: 1;
|
|
348
475
|
|
|
349
476
|
transform: translateX(0);
|
|
@@ -351,6 +478,7 @@
|
|
|
351
478
|
|
|
352
479
|
:host ( .animate-right-opened ) .close,
|
|
353
480
|
:host ( .animate-right-opened.animate-right-outro ) .close{
|
|
481
|
+
|
|
354
482
|
opacity: 1;
|
|
355
483
|
|
|
356
484
|
transform: translate(24px, 24px) rotate(0);
|
|
@@ -366,28 +494,38 @@
|
|
|
366
494
|
}
|
|
367
495
|
|
|
368
496
|
:host ( .animate-right ) .close{
|
|
497
|
+
|
|
369
498
|
left: 0px;
|
|
370
499
|
|
|
371
500
|
transform: translate(-36px, 24px) rotate(-90deg);
|
|
372
501
|
}
|
|
373
502
|
|
|
374
503
|
:host ( .animate-top ){
|
|
504
|
+
|
|
375
505
|
justify-content: center;
|
|
506
|
+
|
|
376
507
|
padding: 2rem;
|
|
377
508
|
}
|
|
378
509
|
|
|
379
510
|
@media (max-width: 767px){
|
|
511
|
+
|
|
380
512
|
:host ( .animate-top ){
|
|
513
|
+
|
|
381
514
|
padding: 1rem;
|
|
382
515
|
}
|
|
383
516
|
}
|
|
384
517
|
|
|
385
518
|
:host ( .animate-top ) .window,
|
|
386
519
|
:host ( .animate-top ) > ::slotted ( [slot=window] ){
|
|
520
|
+
|
|
387
521
|
opacity: 0;
|
|
522
|
+
|
|
388
523
|
transition-property: background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;
|
|
524
|
+
|
|
389
525
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
526
|
+
|
|
390
527
|
transition-duration: 500ms;
|
|
528
|
+
|
|
391
529
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
392
530
|
}
|
|
393
531
|
|
|
@@ -400,6 +538,7 @@
|
|
|
400
538
|
:host ( .animate-top-opened.animate-top-outro ) > ::slotted ( [slot=window] ),
|
|
401
539
|
:host ( .animate-top-opened ) .window,
|
|
402
540
|
:host ( .animate-top-opened ) > ::slotted ( [slot=window] ){
|
|
541
|
+
|
|
403
542
|
opacity: 1;
|
|
404
543
|
|
|
405
544
|
transform: rotateX(0) scale(1) translateY(0);
|
|
@@ -411,7 +550,9 @@
|
|
|
411
550
|
}
|
|
412
551
|
|
|
413
552
|
@media (max-width: 767px){
|
|
553
|
+
|
|
414
554
|
.mobile\:w-12{
|
|
555
|
+
|
|
415
556
|
width: 3rem;
|
|
416
557
|
}
|
|
417
558
|
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import miBaselineClose from '@icon/mi/baseline/close.svg';
|
|
4
|
+
import { KeyboardManager } from '@common/keyboard-manager';
|
|
4
5
|
export class MdsModal {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.window = null;
|
|
7
8
|
this.top = null;
|
|
8
9
|
this.bottom = null;
|
|
9
10
|
this.animationState = 'intro';
|
|
11
|
+
this.km = new KeyboardManager();
|
|
12
|
+
this.componentDidLoad = () => {
|
|
13
|
+
this.km.addElement(this.host, 'host');
|
|
14
|
+
this.km.addElement(this.host.shadowRoot.querySelector('.close'), 'close');
|
|
15
|
+
this.km.attachEscapeBehavior(() => this.close.emit());
|
|
16
|
+
this.km.attachClickBehavior('close');
|
|
17
|
+
};
|
|
10
18
|
this.animationName = (customState = null, customPosition = null) => {
|
|
11
19
|
return `animate-${customPosition !== null ? customPosition : this.position}${customState !== null ? '-' + customState : ''}`;
|
|
12
20
|
};
|
|
13
|
-
this.checkKeyboardEscape = (event) => {
|
|
14
|
-
if (event.code === 'Escape') {
|
|
15
|
-
this.close.emit();
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
21
|
this.closeModal = (e = null) => {
|
|
19
22
|
var _a;
|
|
20
23
|
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.localName) !== 'mds-modal') {
|
|
@@ -30,9 +33,9 @@ export class MdsModal {
|
|
|
30
33
|
this.position = null;
|
|
31
34
|
}
|
|
32
35
|
componentWillLoad() {
|
|
33
|
-
this.bottom = this.
|
|
34
|
-
this.top = this.
|
|
35
|
-
this.window = this.
|
|
36
|
+
this.bottom = this.host.querySelector('[slot="bottom"]') !== null;
|
|
37
|
+
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
38
|
+
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
36
39
|
this.stateOpened = this.opened;
|
|
37
40
|
if (this.window && this.position === null) {
|
|
38
41
|
this.position = 'center';
|
|
@@ -41,50 +44,35 @@ export class MdsModal {
|
|
|
41
44
|
this.position = 'right';
|
|
42
45
|
}
|
|
43
46
|
if (this.window) {
|
|
44
|
-
const modal = this.
|
|
47
|
+
const modal = this.host.querySelector('[slot="window"]');
|
|
45
48
|
modal.setAttribute('role', 'modal');
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
componentWillRender() {
|
|
49
52
|
this.animationState = this.opened ? 'intro' : 'outro';
|
|
50
|
-
this.
|
|
53
|
+
this.host.classList.add(this.animationName());
|
|
51
54
|
}
|
|
52
55
|
componentDidRender() {
|
|
53
56
|
this.animationDeelay = window.setTimeout(() => {
|
|
54
57
|
this.animationState = this.animationState === 'intro' ? 'outro' : 'intro';
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
58
|
+
this.host.classList.remove(this.animationName(this.animationState === 'intro' ? 'outro' : 'intro'));
|
|
59
|
+
this.host.classList.add(this.animationName(this.animationState));
|
|
57
60
|
window.clearTimeout(this.animationDeelay);
|
|
58
61
|
}, 500);
|
|
59
|
-
if (this.opened) {
|
|
60
|
-
this.addKeyboardEscapeListener();
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
this.removeKeyboardEscapeListener();
|
|
64
62
|
}
|
|
65
63
|
disconnectedCallback() {
|
|
66
|
-
this.
|
|
64
|
+
this.km.detachEscapeBehavior();
|
|
65
|
+
this.km.detachClickBehavior('close');
|
|
67
66
|
}
|
|
68
67
|
positionChange(_newValue, oldValue) {
|
|
69
68
|
window.clearTimeout(this.animationDeelay);
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
}
|
|
74
|
-
addKeyboardEscapeListener() {
|
|
75
|
-
window.addEventListener('keydown', this.checkKeyboardEscape.bind(this));
|
|
76
|
-
}
|
|
77
|
-
removeKeyboardEscapeListener() {
|
|
78
|
-
window.removeEventListener('keydown', this.checkKeyboardEscape.bind(this));
|
|
69
|
+
this.host.classList.remove(this.animationName(null, oldValue));
|
|
70
|
+
this.host.classList.remove(this.animationName('intro', oldValue));
|
|
71
|
+
this.host.classList.remove(this.animationName('outro', oldValue));
|
|
79
72
|
}
|
|
80
73
|
openedChange(newValue) {
|
|
81
74
|
this.stateOpened = newValue;
|
|
82
75
|
window.clearTimeout(this.animationDeelay);
|
|
83
|
-
if (newValue) {
|
|
84
|
-
this.addKeyboardEscapeListener();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
this.removeKeyboardEscapeListener();
|
|
88
76
|
}
|
|
89
77
|
onCloseListener() {
|
|
90
78
|
this.opened = false;
|
|
@@ -96,7 +84,7 @@ export class MdsModal {
|
|
|
96
84
|
:
|
|
97
85
|
h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog" }, this.top &&
|
|
98
86
|
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
99
|
-
h("slot", { name: "bottom" })), !this.window && h("i", { innerHTML: miBaselineClose, class: "svg close" })));
|
|
87
|
+
h("slot", { name: "bottom" })), !this.window && h("i", { innerHTML: miBaselineClose, tabindex: "0", onClick: (e) => { this.closeModal(e); }, class: "svg close focusable-light" })));
|
|
100
88
|
}
|
|
101
89
|
static get is() { return "mds-modal"; }
|
|
102
90
|
static get encapsulation() { return "shadow"; }
|
|
@@ -177,7 +165,7 @@ export class MdsModal {
|
|
|
177
165
|
}
|
|
178
166
|
}];
|
|
179
167
|
}
|
|
180
|
-
static get elementRef() { return "
|
|
168
|
+
static get elementRef() { return "host"; }
|
|
181
169
|
static get watchers() {
|
|
182
170
|
return [{
|
|
183
171
|
"propName": "position",
|
|
@@ -21,6 +21,10 @@ const typographyVariationsDictionary = [
|
|
|
21
21
|
'read',
|
|
22
22
|
'code',
|
|
23
23
|
];
|
|
24
|
+
const typographyReadingVariationsDictionary = [
|
|
25
|
+
'info',
|
|
26
|
+
'read',
|
|
27
|
+
];
|
|
24
28
|
const typographyMonoDictionary = [
|
|
25
29
|
'snippet',
|
|
26
30
|
'hack',
|
|
@@ -56,4 +60,4 @@ const typographyTooltipDictionary = [
|
|
|
56
60
|
'detail',
|
|
57
61
|
'tip',
|
|
58
62
|
];
|
|
59
|
-
export { typographyDictionary,
|
|
63
|
+
export { typographyDictionary, typographyInfoDictionary, typographyReadingVariationsDictionary, typographyMonoDictionary, typographyReadDictionary, typographySmallerDictionary, typographyTitleDictionary, typographyTooltipDictionary, typographyVariationsDictionary, };
|