@maggioli-design-system/mds-modal 4.0.0 → 4.2.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/loader.cjs.js +1 -1
- package/dist/cjs/mds-modal.cjs.entry.js +22 -24
- package/dist/cjs/mds-modal.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/common/aria.js +4 -2
- package/dist/collection/common/keyboard-manager.js +1 -1
- package/dist/collection/components/mds-modal/mds-modal.css +93 -96
- package/dist/collection/components/mds-modal/mds-modal.js +25 -26
- package/dist/collection/components/mds-modal/test/mds-modal.stories.js +2 -2
- package/dist/components/mds-modal.js +22 -24
- package/dist/documentation.d.ts +148 -0
- package/dist/documentation.json +137 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mds-modal.entry.js +22 -24
- package/dist/esm/mds-modal.js +1 -1
- package/dist/esm-es5/mds-modal.entry.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-8363eae7.system.entry.js +1 -0
- package/dist/mds-modal/p-a7878434.entry.js +1 -0
- package/{www/build/p-f856db3e.system.js → dist/mds-modal/p-e2fdb863.system.js} +1 -1
- package/dist/stats.json +24 -22
- package/dist/types/components.d.ts +1 -1
- package/dist/types/interface/input-value.d.ts +1 -1
- package/documentation.json +144 -0
- package/package.json +10 -4
- package/readme.md +4 -4
- package/src/common/aria.ts +2 -2
- package/src/common/keyboard-manager.ts +1 -1
- package/src/components/mds-modal/css/components.css +49 -0
- package/src/components/mds-modal/css/mds-modal-animate-bottom.css +12 -12
- package/src/components/mds-modal/css/mds-modal-animate-center.css +12 -12
- package/src/components/mds-modal/css/mds-modal-animate-left.css +16 -16
- package/src/components/mds-modal/css/mds-modal-animate-right.css +16 -16
- package/src/components/mds-modal/css/mds-modal-animate-top.css +12 -12
- package/src/components/mds-modal/mds-modal.css +14 -67
- package/src/components/mds-modal/mds-modal.tsx +15 -21
- package/src/components/mds-modal/readme.md +4 -4
- package/src/components/mds-modal/test/mds-modal.e2e.ts +1 -1
- package/src/components/mds-modal/test/mds-modal.stories.mdx +2 -3
- package/src/components/mds-modal/test/mds-modal.stories.tsx +2 -2
- package/src/components.d.ts +1 -1
- package/src/fixtures/icons.json +1 -0
- package/src/interface/input-value.ts +1 -1
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/mds-modal.js +1 -1
- package/www/build/p-8363eae7.system.entry.js +1 -0
- package/www/build/p-a7878434.entry.js +1 -0
- package/{dist/mds-modal/p-f856db3e.system.js → www/build/p-e2fdb863.system.js} +1 -1
- package/dist/mds-modal/p-225eed54.entry.js +0 -1
- package/dist/mds-modal/p-568fbb8b.system.entry.js +0 -1
- package/www/build/p-225eed54.entry.js +0 -1
- package/www/build/p-568fbb8b.system.entry.js +0 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/* stylelint-disable */
|
|
1
2
|
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
2
5
|
|
|
3
6
|
.focus-off,
|
|
4
7
|
.focusable,
|
|
@@ -14,6 +17,7 @@
|
|
|
14
17
|
transition-property: background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform;
|
|
15
18
|
}
|
|
16
19
|
|
|
20
|
+
|
|
17
21
|
.focus-on,
|
|
18
22
|
.focusable-light:focus-visible,
|
|
19
23
|
.focusable:focus-visible {
|
|
@@ -21,16 +25,19 @@
|
|
|
21
25
|
--magma-outline-blur: var(--magma-outline-focus);
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
|
|
24
29
|
.focus-light-on,
|
|
25
30
|
.focusable-light:focus-visible {
|
|
26
31
|
--magma-outline-blur: 2px solid rgb(var(--tone-neutral));
|
|
27
32
|
}
|
|
28
33
|
|
|
34
|
+
|
|
29
35
|
.svg{
|
|
30
36
|
|
|
31
37
|
display: flex;
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
|
|
34
41
|
.svg svg{
|
|
35
42
|
|
|
36
43
|
aspect-ratio: 1 / 1;
|
|
@@ -40,19 +47,6 @@
|
|
|
40
47
|
width: 100%;
|
|
41
48
|
}
|
|
42
49
|
|
|
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
50
|
|
|
57
51
|
.animate-right-intro,
|
|
58
52
|
.animate-right-outro {
|
|
@@ -138,14 +132,14 @@
|
|
|
138
132
|
|
|
139
133
|
background-color: transparent;
|
|
140
134
|
}
|
|
141
|
-
.p-8{
|
|
142
|
-
|
|
143
|
-
padding: 2rem;
|
|
144
|
-
}
|
|
145
135
|
.p-4{
|
|
146
136
|
|
|
147
137
|
padding: 1rem;
|
|
148
138
|
}
|
|
139
|
+
.p-8{
|
|
140
|
+
|
|
141
|
+
padding: 2rem;
|
|
142
|
+
}
|
|
149
143
|
.text-tone-neutral-02{
|
|
150
144
|
|
|
151
145
|
--tw-text-opacity: 1;
|
|
@@ -177,6 +171,7 @@
|
|
|
177
171
|
*/
|
|
178
172
|
|
|
179
173
|
:host {
|
|
174
|
+
|
|
180
175
|
--mds-modal-overlay-color: var(--magma-overlay-color, 0 0 0);
|
|
181
176
|
--mds-modal-overlay-opacity: var(--magma-overlay-opacity, 0.5);
|
|
182
177
|
--mds-modal-window-background: rgb(var(--tone-neutral));
|
|
@@ -185,10 +180,7 @@
|
|
|
185
180
|
--mds-modal-z-index: var(--magma-modal-z-index);
|
|
186
181
|
pointer-events: none;
|
|
187
182
|
position: fixed;
|
|
188
|
-
|
|
189
|
-
right: 0px;
|
|
190
|
-
bottom: 0px;
|
|
191
|
-
left: 0px;
|
|
183
|
+
inset: 0px;
|
|
192
184
|
display: flex;
|
|
193
185
|
align-items: center;
|
|
194
186
|
justify-content: center;
|
|
@@ -197,28 +189,28 @@
|
|
|
197
189
|
|
|
198
190
|
background-color: rgba(var(--mds-modal-overlay-color) / 0);
|
|
199
191
|
perspective: 600px;
|
|
200
|
-
z-index: var(--z-index, 1000);
|
|
192
|
+
z-index: var(--mds-modal-z-index, 1000);
|
|
201
193
|
}
|
|
202
194
|
|
|
203
|
-
:host
|
|
195
|
+
:host( [position=top] ){
|
|
204
196
|
|
|
205
197
|
align-items: flex-start;
|
|
206
198
|
|
|
207
199
|
justify-content: center;
|
|
208
200
|
}
|
|
209
201
|
|
|
210
|
-
:host
|
|
202
|
+
:host( [position=bottom] ){
|
|
211
203
|
|
|
212
204
|
align-items: flex-end;
|
|
213
205
|
|
|
214
206
|
justify-content: center;
|
|
215
207
|
}
|
|
216
208
|
|
|
217
|
-
:host
|
|
218
|
-
:host
|
|
219
|
-
:host
|
|
220
|
-
:host
|
|
221
|
-
:host
|
|
209
|
+
:host( .to-bottom-opened ),
|
|
210
|
+
:host( .to-center-opened ),
|
|
211
|
+
:host( .to-left-opened ),
|
|
212
|
+
:host( .to-right-opened ),
|
|
213
|
+
:host( .to-top-opened ){
|
|
222
214
|
|
|
223
215
|
pointer-events: auto;
|
|
224
216
|
|
|
@@ -255,8 +247,8 @@
|
|
|
255
247
|
|
|
256
248
|
transition-timing-function: cubic-bezier(0.77, 0, 0.175, 1);
|
|
257
249
|
|
|
258
|
-
transition-property: opacity, outline, outline-offset, transform;
|
|
259
250
|
transform: translate(0, 24px) rotate(90deg);
|
|
251
|
+
transition-property: opacity, outline, outline-offset, transform;
|
|
260
252
|
}
|
|
261
253
|
|
|
262
254
|
.window{
|
|
@@ -286,7 +278,7 @@
|
|
|
286
278
|
grid-template-rows: auto 1fr auto;
|
|
287
279
|
}
|
|
288
280
|
|
|
289
|
-
:host
|
|
281
|
+
:host( .to-bottom ){
|
|
290
282
|
|
|
291
283
|
justify-content: center;
|
|
292
284
|
|
|
@@ -295,14 +287,15 @@
|
|
|
295
287
|
|
|
296
288
|
@media (max-width: 767px){
|
|
297
289
|
|
|
298
|
-
|
|
290
|
+
|
|
291
|
+
:host( .to-bottom ){
|
|
299
292
|
|
|
300
293
|
padding: 1rem;
|
|
301
294
|
}
|
|
302
295
|
}
|
|
303
296
|
|
|
304
|
-
:host
|
|
305
|
-
:host
|
|
297
|
+
:host( .to-bottom ) .window,
|
|
298
|
+
:host( .to-bottom ) > ::slotted( [slot="window"] ){
|
|
306
299
|
|
|
307
300
|
opacity: 0;
|
|
308
301
|
|
|
@@ -315,27 +308,27 @@
|
|
|
315
308
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
316
309
|
}
|
|
317
310
|
|
|
318
|
-
:host
|
|
319
|
-
:host
|
|
311
|
+
:host( .to-bottom-intro ) .window,
|
|
312
|
+
:host( .to-bottom-intro ) > ::slotted( [slot="window"] ) {
|
|
320
313
|
transform: rotateX(-22deg) scale(0.5) translateY(40%);
|
|
321
314
|
}
|
|
322
315
|
|
|
323
|
-
:host
|
|
324
|
-
:host
|
|
325
|
-
:host
|
|
326
|
-
:host
|
|
316
|
+
:host( .to-bottom-opened.to-bottom-outro ) .window,
|
|
317
|
+
:host( .to-bottom-opened.to-bottom-outro ) > ::slotted( [slot="window"] ),
|
|
318
|
+
:host( .to-bottom-opened ) .window,
|
|
319
|
+
:host( .to-bottom-opened ) > ::slotted( [slot="window"] ){
|
|
327
320
|
|
|
328
321
|
opacity: 1;
|
|
329
322
|
|
|
330
323
|
transform: rotateX(0) scale(1) translateY(0);
|
|
331
324
|
}
|
|
332
325
|
|
|
333
|
-
:host
|
|
334
|
-
:host
|
|
326
|
+
:host( .to-bottom-outro ) .window,
|
|
327
|
+
:host( .to-bottom-outro ) > ::slotted( [slot="window"] ) {
|
|
335
328
|
transform: rotateX(-22deg) scale(0.5) translateY(-40%);
|
|
336
329
|
}
|
|
337
330
|
|
|
338
|
-
:host
|
|
331
|
+
:host( .to-center ){
|
|
339
332
|
|
|
340
333
|
justify-content: center;
|
|
341
334
|
|
|
@@ -344,14 +337,15 @@
|
|
|
344
337
|
|
|
345
338
|
@media (max-width: 767px){
|
|
346
339
|
|
|
347
|
-
|
|
340
|
+
|
|
341
|
+
:host( .to-center ){
|
|
348
342
|
|
|
349
343
|
padding: 1rem;
|
|
350
344
|
}
|
|
351
345
|
}
|
|
352
346
|
|
|
353
|
-
:host
|
|
354
|
-
:host
|
|
347
|
+
:host( .to-center ) .window,
|
|
348
|
+
:host( .to-center ) > ::slotted( [slot="window"] ){
|
|
355
349
|
|
|
356
350
|
opacity: 0;
|
|
357
351
|
|
|
@@ -364,33 +358,33 @@
|
|
|
364
358
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
365
359
|
}
|
|
366
360
|
|
|
367
|
-
:host
|
|
368
|
-
:host
|
|
361
|
+
:host( .to-center-intro ) .window,
|
|
362
|
+
:host( .to-center-intro ) > ::slotted( [slot="window"] ) {
|
|
369
363
|
transform: rotateX(-22deg) scale(0.5) translateY(40%);
|
|
370
364
|
}
|
|
371
365
|
|
|
372
|
-
:host
|
|
373
|
-
:host
|
|
374
|
-
:host
|
|
375
|
-
:host
|
|
366
|
+
:host( .to-center-opened.to-center-outro ) .window,
|
|
367
|
+
:host( .to-center-opened.to-center-outro ) > ::slotted( [slot="window"] ),
|
|
368
|
+
:host( .to-center-opened ) .window,
|
|
369
|
+
:host( .to-center-opened ) > ::slotted( [slot="window"] ){
|
|
376
370
|
|
|
377
371
|
opacity: 1;
|
|
378
372
|
|
|
379
373
|
transform: rotateX(0) scale(1) translateY(0);
|
|
380
374
|
}
|
|
381
375
|
|
|
382
|
-
:host
|
|
383
|
-
:host
|
|
376
|
+
:host( .to-center-outro ) .window,
|
|
377
|
+
:host( .to-center-outro ) > ::slotted( [slot="window"] ) {
|
|
384
378
|
transform: rotateX(-22deg) scale(0.5) translateY(-40%);
|
|
385
379
|
}
|
|
386
380
|
|
|
387
|
-
:host
|
|
381
|
+
:host( .to-left ){
|
|
388
382
|
|
|
389
383
|
justify-content: flex-start;
|
|
390
384
|
}
|
|
391
385
|
|
|
392
|
-
:host
|
|
393
|
-
:host
|
|
386
|
+
:host( .to-left ) .window,
|
|
387
|
+
:host( .to-left ) > ::slotted( [slot="window"] ){
|
|
394
388
|
|
|
395
389
|
opacity: 0;
|
|
396
390
|
|
|
@@ -403,52 +397,52 @@
|
|
|
403
397
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
404
398
|
}
|
|
405
399
|
|
|
406
|
-
:host
|
|
407
|
-
:host
|
|
400
|
+
:host( .to-left-intro ) .window,
|
|
401
|
+
:host( .to-left-intro ) > ::slotted( [slot="window"] ) {
|
|
408
402
|
transform: translateX(calc(-100% - 50px));
|
|
409
403
|
}
|
|
410
404
|
|
|
411
|
-
:host
|
|
412
|
-
:host
|
|
413
|
-
:host
|
|
414
|
-
:host
|
|
405
|
+
:host( .to-left-opened.to-left-outro ) .window,
|
|
406
|
+
:host( .to-left-opened.to-left-outro ) > ::slotted( [slot="window"] ),
|
|
407
|
+
:host( .to-left-opened ) .window,
|
|
408
|
+
:host( .to-left-opened ) > ::slotted( [slot="window"] ){
|
|
415
409
|
|
|
416
410
|
opacity: 1;
|
|
417
411
|
|
|
418
412
|
transform: translateX(0);
|
|
419
413
|
}
|
|
420
414
|
|
|
421
|
-
:host
|
|
422
|
-
:host
|
|
415
|
+
:host( .to-left-opened ) .close,
|
|
416
|
+
:host( .to-left-opened.to-left-outro ) .close{
|
|
423
417
|
|
|
424
418
|
opacity: 1;
|
|
425
419
|
|
|
426
420
|
transform: translate(-24px, 24px) rotate(0);
|
|
427
421
|
}
|
|
428
422
|
|
|
429
|
-
:host
|
|
430
|
-
:host
|
|
423
|
+
:host( .to-left-outro ) .window,
|
|
424
|
+
:host( .to-left-outro ) > ::slotted( [slot="window"] ) {
|
|
431
425
|
transform: translateX(calc(-100% - 50px));
|
|
432
426
|
}
|
|
433
427
|
|
|
434
|
-
:host
|
|
428
|
+
:host( .to-left-outro ) .close {
|
|
435
429
|
transform: translate(24px, 24px) rotate(-90deg);
|
|
436
430
|
}
|
|
437
431
|
|
|
438
|
-
:host
|
|
432
|
+
:host( .to-left ) .close{
|
|
439
433
|
|
|
440
434
|
right: 0px;
|
|
441
435
|
|
|
442
436
|
transform: translate(36px, 24px) rotate(90deg);
|
|
443
437
|
}
|
|
444
438
|
|
|
445
|
-
:host
|
|
439
|
+
:host( .to-right ){
|
|
446
440
|
|
|
447
441
|
justify-content: flex-end;
|
|
448
442
|
}
|
|
449
443
|
|
|
450
|
-
:host
|
|
451
|
-
:host
|
|
444
|
+
:host( .to-right ) .window,
|
|
445
|
+
:host( .to-right ) > ::slotted([slot="window"]){
|
|
452
446
|
|
|
453
447
|
opacity: 0;
|
|
454
448
|
|
|
@@ -461,46 +455,46 @@
|
|
|
461
455
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
462
456
|
}
|
|
463
457
|
|
|
464
|
-
:host
|
|
465
|
-
:host
|
|
458
|
+
:host( .to-right-intro ) .window,
|
|
459
|
+
:host( .to-right-intro ) > ::slotted( [slot="window"] ) {
|
|
466
460
|
transform: translateX(calc(100% + 50px));
|
|
467
461
|
}
|
|
468
462
|
|
|
469
|
-
:host
|
|
470
|
-
:host
|
|
471
|
-
:host
|
|
472
|
-
:host
|
|
463
|
+
:host( .to-right-opened.to-right-outro ) .window,
|
|
464
|
+
:host( .to-right-opened.to-right-outro ) > ::slotted( [slot="window"] ),
|
|
465
|
+
:host( .to-right-opened ) .window,
|
|
466
|
+
:host( .to-right-opened ) > ::slotted( [slot="window"] ){
|
|
473
467
|
|
|
474
468
|
opacity: 1;
|
|
475
469
|
|
|
476
470
|
transform: translateX(0);
|
|
477
471
|
}
|
|
478
472
|
|
|
479
|
-
:host
|
|
480
|
-
:host
|
|
473
|
+
:host( .to-right-opened ) .close,
|
|
474
|
+
:host( .to-right-opened.to-right-outro ) .close{
|
|
481
475
|
|
|
482
476
|
opacity: 1;
|
|
483
477
|
|
|
484
478
|
transform: translate(24px, 24px) rotate(0);
|
|
485
479
|
}
|
|
486
480
|
|
|
487
|
-
:host
|
|
488
|
-
:host
|
|
481
|
+
:host( .to-right-outro ) .window,
|
|
482
|
+
:host( .to-right-outro ) > ::slotted( [slot="window"] ) {
|
|
489
483
|
transform: translateX(calc(100% + 50px));
|
|
490
484
|
}
|
|
491
485
|
|
|
492
|
-
:host
|
|
486
|
+
:host( .to-right-outro ) .close {
|
|
493
487
|
transform: translate(-24px, 24px) rotate(90deg);
|
|
494
488
|
}
|
|
495
489
|
|
|
496
|
-
:host
|
|
490
|
+
:host( .to-right ) .close{
|
|
497
491
|
|
|
498
492
|
left: 0px;
|
|
499
493
|
|
|
500
494
|
transform: translate(-36px, 24px) rotate(-90deg);
|
|
501
495
|
}
|
|
502
496
|
|
|
503
|
-
:host
|
|
497
|
+
:host( .to-top ){
|
|
504
498
|
|
|
505
499
|
justify-content: center;
|
|
506
500
|
|
|
@@ -509,14 +503,15 @@
|
|
|
509
503
|
|
|
510
504
|
@media (max-width: 767px){
|
|
511
505
|
|
|
512
|
-
|
|
506
|
+
|
|
507
|
+
:host( .to-top ){
|
|
513
508
|
|
|
514
509
|
padding: 1rem;
|
|
515
510
|
}
|
|
516
511
|
}
|
|
517
512
|
|
|
518
|
-
:host
|
|
519
|
-
:host
|
|
513
|
+
:host( .to-top ) .window,
|
|
514
|
+
:host( .to-top ) > ::slotted( [slot="window"] ){
|
|
520
515
|
|
|
521
516
|
opacity: 0;
|
|
522
517
|
|
|
@@ -529,31 +524,33 @@
|
|
|
529
524
|
transition-timing-function: cubic-bezier(1, 0, 0, 1);
|
|
530
525
|
}
|
|
531
526
|
|
|
532
|
-
:host
|
|
533
|
-
:host
|
|
527
|
+
:host( .to-top-intro ) .window,
|
|
528
|
+
:host( .to-top-intro ) > ::slotted( [slot="window"] ) {
|
|
534
529
|
transform: rotateX(-22deg) scale(0.5) translateY(40%);
|
|
535
530
|
}
|
|
536
531
|
|
|
537
|
-
:host
|
|
538
|
-
:host
|
|
539
|
-
:host
|
|
540
|
-
:host
|
|
532
|
+
:host( .to-top-opened.to-top-outro ) .window,
|
|
533
|
+
:host( .to-top-opened.to-top-outro ) > ::slotted( [slot="window"] ),
|
|
534
|
+
:host( .to-top-opened ) .window,
|
|
535
|
+
:host( .to-top-opened ) > ::slotted( [slot="window"] ){
|
|
541
536
|
|
|
542
537
|
opacity: 1;
|
|
543
538
|
|
|
544
539
|
transform: rotateX(0) scale(1) translateY(0);
|
|
545
540
|
}
|
|
546
541
|
|
|
547
|
-
:host
|
|
548
|
-
:host
|
|
542
|
+
:host( .to-top-outro ) .window,
|
|
543
|
+
:host( .to-top-outro ) > ::slotted( [slot="window"] ) {
|
|
549
544
|
transform: rotateX(-22deg) scale(0.5) translateY(-40%);
|
|
550
545
|
}
|
|
551
546
|
|
|
552
547
|
@media (max-width: 767px){
|
|
553
548
|
|
|
549
|
+
|
|
554
550
|
.mobile\:w-12{
|
|
555
551
|
|
|
556
552
|
width: 3rem;
|
|
557
553
|
}
|
|
558
554
|
}
|
|
559
555
|
|
|
556
|
+
|
|
@@ -4,21 +4,24 @@ import { Host, h } from '@stencil/core';
|
|
|
4
4
|
import { KeyboardManager } from '@common/keyboard-manager';
|
|
5
5
|
export class MdsModal {
|
|
6
6
|
constructor() {
|
|
7
|
-
this.window =
|
|
8
|
-
this.top =
|
|
9
|
-
this.bottom =
|
|
7
|
+
this.window = false;
|
|
8
|
+
this.top = false;
|
|
9
|
+
this.bottom = false;
|
|
10
10
|
this.animationState = 'intro';
|
|
11
11
|
this.km = new KeyboardManager();
|
|
12
12
|
this.componentDidLoad = () => {
|
|
13
|
+
var _a;
|
|
13
14
|
this.km.addElement(this.host, 'host');
|
|
14
|
-
|
|
15
|
+
const close = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.close');
|
|
16
|
+
if (close)
|
|
17
|
+
this.km.addElement(close, 'close');
|
|
15
18
|
this.km.attachEscapeBehavior(() => this.closeEvent.emit());
|
|
16
19
|
this.km.attachClickBehavior('close');
|
|
17
20
|
};
|
|
18
|
-
this.animationName = (customState =
|
|
19
|
-
return `
|
|
21
|
+
this.animationName = (customState = '', customPosition = '') => {
|
|
22
|
+
return `to-${customPosition !== '' ? customPosition : this.position}${customState !== '' ? '-' + customState : ''}`;
|
|
20
23
|
};
|
|
21
|
-
this.closeModal = (e
|
|
24
|
+
this.closeModal = (e) => {
|
|
22
25
|
var _a;
|
|
23
26
|
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.localName) !== 'mds-modal') {
|
|
24
27
|
return;
|
|
@@ -29,23 +32,20 @@ export class MdsModal {
|
|
|
29
32
|
}
|
|
30
33
|
};
|
|
31
34
|
this.stateOpened = undefined;
|
|
32
|
-
this.opened =
|
|
33
|
-
this.position =
|
|
35
|
+
this.opened = false;
|
|
36
|
+
this.position = 'center';
|
|
34
37
|
}
|
|
35
38
|
componentWillLoad() {
|
|
39
|
+
var _a;
|
|
36
40
|
this.bottom = this.host.querySelector('[slot="bottom"]') !== null;
|
|
37
41
|
this.top = this.host.querySelector('[slot="top"]') !== null;
|
|
38
42
|
this.window = this.host.querySelector('[slot="window"]') !== null;
|
|
39
43
|
this.stateOpened = this.opened;
|
|
40
|
-
if (this.window
|
|
41
|
-
this.position = 'center';
|
|
42
|
-
}
|
|
43
|
-
if (this.position === null) {
|
|
44
|
+
if (!this.window) {
|
|
44
45
|
this.position = 'right';
|
|
45
46
|
}
|
|
46
47
|
if (this.window) {
|
|
47
|
-
|
|
48
|
-
modal.setAttribute('role', 'modal');
|
|
48
|
+
(_a = this.host.querySelector('[slot="window"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('role', 'modal');
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
componentWillRender() {
|
|
@@ -66,7 +66,7 @@ export class MdsModal {
|
|
|
66
66
|
}
|
|
67
67
|
positionChange(_newValue, oldValue) {
|
|
68
68
|
window.clearTimeout(this.animationDeelay);
|
|
69
|
-
this.host.classList.remove(this.animationName(
|
|
69
|
+
this.host.classList.remove(this.animationName('', oldValue));
|
|
70
70
|
this.host.classList.remove(this.animationName('intro', oldValue));
|
|
71
71
|
this.host.classList.remove(this.animationName('outro', oldValue));
|
|
72
72
|
}
|
|
@@ -82,12 +82,10 @@ export class MdsModal {
|
|
|
82
82
|
}
|
|
83
83
|
render() {
|
|
84
84
|
return (h(Host, { "aria-modal": clsx(this.opened ? 'true' : 'false'), class: clsx(this.stateOpened && this.animationName('opened')), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
85
|
-
?
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
h("
|
|
89
|
-
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
90
|
-
h("slot", { name: "bottom" })), !this.window && h("i", { innerHTML: miBaselineClose, tabindex: "0", onClick: (e) => { this.closeModal(e); }, class: "svg close focusable-light" })));
|
|
85
|
+
? h("slot", { name: "window" })
|
|
86
|
+
: h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog" }, this.top &&
|
|
87
|
+
h("slot", { name: "top" }), h("slot", null), this.bottom &&
|
|
88
|
+
h("slot", { name: "bottom" })), !this.window && h("i", { innerHTML: miBaselineClose, tabindex: "0", onClick: (e) => { this.closeModal(e); }, class: "svg close focusable-light" })));
|
|
91
89
|
}
|
|
92
90
|
static get is() { return "mds-modal"; }
|
|
93
91
|
static get encapsulation() { return "shadow"; }
|
|
@@ -112,20 +110,21 @@ export class MdsModal {
|
|
|
112
110
|
"references": {}
|
|
113
111
|
},
|
|
114
112
|
"required": false,
|
|
115
|
-
"optional":
|
|
113
|
+
"optional": false,
|
|
116
114
|
"docs": {
|
|
117
115
|
"tags": [],
|
|
118
116
|
"text": "Specifies if the modal is opened or not"
|
|
119
117
|
},
|
|
120
118
|
"attribute": "opened",
|
|
121
|
-
"reflect": true
|
|
119
|
+
"reflect": true,
|
|
120
|
+
"defaultValue": "false"
|
|
122
121
|
},
|
|
123
122
|
"position": {
|
|
124
123
|
"type": "string",
|
|
125
124
|
"mutable": true,
|
|
126
125
|
"complexType": {
|
|
127
126
|
"original": "ModalPositionType",
|
|
128
|
-
"resolved": "\"bottom\" | \"center\" | \"left\" | \"right\" | \"top\"",
|
|
127
|
+
"resolved": "\"bottom\" | \"center\" | \"left\" | \"right\" | \"top\" | undefined",
|
|
129
128
|
"references": {
|
|
130
129
|
"ModalPositionType": {
|
|
131
130
|
"location": "import",
|
|
@@ -141,7 +140,7 @@ export class MdsModal {
|
|
|
141
140
|
},
|
|
142
141
|
"attribute": "position",
|
|
143
142
|
"reflect": true,
|
|
144
|
-
"defaultValue": "
|
|
143
|
+
"defaultValue": "'center'"
|
|
145
144
|
}
|
|
146
145
|
};
|
|
147
146
|
}
|
|
@@ -25,8 +25,8 @@ const CustomTemplate = args => h("mds-modal", Object.assign({}, args), h("mds-ba
|
|
|
25
25
|
const AriaTemplate = () => {
|
|
26
26
|
// Click not working with reader
|
|
27
27
|
const [opened, setOpened] = useState(false);
|
|
28
|
-
window.addEventListener('
|
|
29
|
-
return h("div", null, h("mds-button", { onClick: () => setOpened(true) }, "Apri modale"), h("mds-modal", { opened: opened,
|
|
28
|
+
window.addEventListener('mdsModalClose', () => { setOpened(false); });
|
|
29
|
+
return h("div", null, h("mds-button", { onClick: () => setOpened(true) }, "Apri modale"), h("mds-modal", { opened: opened, onMdsModalClose: () => setOpened(false) }, h("mds-banner", { slot: "window", class: "max-w-xl mx-6", deletable: true, headline: "Action required" }, h("mds-text", { typography: "detail" }, "As a multi-brand design system, our components need to be flexible enough for any one of our brands to use them for multiple use cases. To achieve this, we ensure that all of the brands are involved in the specification stage, giving us more confidence that we\u2019re future-proofing our components as more brands adopt NewsKit."), h("mds-button", { slot: "actions", variant: "dark", tone: "quiet", onClick: () => setOpened(false) }, "Cancel"), h("mds-button", { slot: "actions", variant: "primary" }, "Confirm"))));
|
|
30
30
|
};
|
|
31
31
|
export const Default = Template.bind({});
|
|
32
32
|
export const CustomWindow = CustomTemplate.bind({});
|