@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.
Files changed (53) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mds-modal.cjs.entry.js +22 -24
  3. package/dist/cjs/mds-modal.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +1 -1
  5. package/dist/collection/common/aria.js +4 -2
  6. package/dist/collection/common/keyboard-manager.js +1 -1
  7. package/dist/collection/components/mds-modal/mds-modal.css +93 -96
  8. package/dist/collection/components/mds-modal/mds-modal.js +25 -26
  9. package/dist/collection/components/mds-modal/test/mds-modal.stories.js +2 -2
  10. package/dist/components/mds-modal.js +22 -24
  11. package/dist/documentation.d.ts +148 -0
  12. package/dist/documentation.json +137 -0
  13. package/dist/esm/loader.js +1 -1
  14. package/dist/esm/mds-modal.entry.js +22 -24
  15. package/dist/esm/mds-modal.js +1 -1
  16. package/dist/esm-es5/mds-modal.entry.js +1 -1
  17. package/dist/mds-modal/mds-modal.esm.js +1 -1
  18. package/dist/mds-modal/mds-modal.js +1 -1
  19. package/dist/mds-modal/p-8363eae7.system.entry.js +1 -0
  20. package/dist/mds-modal/p-a7878434.entry.js +1 -0
  21. package/{www/build/p-f856db3e.system.js → dist/mds-modal/p-e2fdb863.system.js} +1 -1
  22. package/dist/stats.json +24 -22
  23. package/dist/types/components.d.ts +1 -1
  24. package/dist/types/interface/input-value.d.ts +1 -1
  25. package/documentation.json +144 -0
  26. package/package.json +10 -4
  27. package/readme.md +4 -4
  28. package/src/common/aria.ts +2 -2
  29. package/src/common/keyboard-manager.ts +1 -1
  30. package/src/components/mds-modal/css/components.css +49 -0
  31. package/src/components/mds-modal/css/mds-modal-animate-bottom.css +12 -12
  32. package/src/components/mds-modal/css/mds-modal-animate-center.css +12 -12
  33. package/src/components/mds-modal/css/mds-modal-animate-left.css +16 -16
  34. package/src/components/mds-modal/css/mds-modal-animate-right.css +16 -16
  35. package/src/components/mds-modal/css/mds-modal-animate-top.css +12 -12
  36. package/src/components/mds-modal/mds-modal.css +14 -67
  37. package/src/components/mds-modal/mds-modal.tsx +15 -21
  38. package/src/components/mds-modal/readme.md +4 -4
  39. package/src/components/mds-modal/test/mds-modal.e2e.ts +1 -1
  40. package/src/components/mds-modal/test/mds-modal.stories.mdx +2 -3
  41. package/src/components/mds-modal/test/mds-modal.stories.tsx +2 -2
  42. package/src/components.d.ts +1 -1
  43. package/src/fixtures/icons.json +1 -0
  44. package/src/interface/input-value.ts +1 -1
  45. package/www/build/mds-modal.esm.js +1 -1
  46. package/www/build/mds-modal.js +1 -1
  47. package/www/build/p-8363eae7.system.entry.js +1 -0
  48. package/www/build/p-a7878434.entry.js +1 -0
  49. package/{dist/mds-modal/p-f856db3e.system.js → www/build/p-e2fdb863.system.js} +1 -1
  50. package/dist/mds-modal/p-225eed54.entry.js +0 -1
  51. package/dist/mds-modal/p-568fbb8b.system.entry.js +0 -1
  52. package/www/build/p-225eed54.entry.js +0 -1
  53. package/www/build/p-568fbb8b.system.entry.js +0 -1
@@ -0,0 +1,49 @@
1
+ @tailwind components;
2
+ @tailwind utilities;
3
+
4
+ @layer components {
5
+ .animate {
6
+ @apply
7
+ duration-500
8
+ ease-in-out-expo
9
+ opacity-0
10
+ transition-cosmetic;
11
+ }
12
+
13
+ .animate-bottom-intro,
14
+ .animate-center-intro,
15
+ .animate-top-intro {
16
+ transform: rotateX(-22deg) scale(0.5) translateY(40%);
17
+ }
18
+
19
+ .animate-bottom-opened,
20
+ .animate-center-opened,
21
+ .animate-top-opened {
22
+ @apply opacity-100;
23
+
24
+ transform: rotateX(0) scale(1) translateY(0);
25
+ }
26
+
27
+ .animate-bottom-outro,
28
+ .animate-center-outro,
29
+ .animate-top-outro {
30
+ transform: rotateX(-22deg) scale(0.5) translateY(-40%);
31
+ }
32
+
33
+ .animate-right-intro,
34
+ .animate-right-outro {
35
+ transform: translateX(calc(100% + 50px));
36
+ }
37
+
38
+ .animate-right-opened,
39
+ .animate-left-opened {
40
+ @apply opacity-100;
41
+
42
+ transform: translateX(0);
43
+ }
44
+
45
+ .animate-left-intro,
46
+ .animate-left-outro {
47
+ transform: translateX(calc(-100% - 50px));
48
+ }
49
+ }
@@ -1,28 +1,28 @@
1
- :host ( .animate-bottom ) {
1
+ :host( .to-bottom ) {
2
2
  @apply
3
3
  justify-center
4
4
  mobile:p-4
5
5
  p-8;
6
6
  }
7
7
 
8
- :host ( .animate-bottom ) .window,
9
- :host ( .animate-bottom ) > ::slotted ( [slot=window] ) {
10
- @apply animate-bottom;
8
+ :host( .to-bottom ) .window,
9
+ :host( .to-bottom ) > ::slotted( [slot="window"] ) {
10
+ @apply animate;
11
11
  }
12
12
 
13
- :host ( .animate-bottom-intro ) .window,
14
- :host ( .animate-bottom-intro ) > ::slotted ( [slot=window] ) {
13
+ :host( .to-bottom-intro ) .window,
14
+ :host( .to-bottom-intro ) > ::slotted( [slot="window"] ) {
15
15
  @apply animate-bottom-intro;
16
16
  }
17
17
 
18
- :host ( .animate-bottom-opened.animate-bottom-outro ) .window,
19
- :host ( .animate-bottom-opened.animate-bottom-outro ) > ::slotted ( [slot=window] ),
20
- :host ( .animate-bottom-opened ) .window,
21
- :host ( .animate-bottom-opened ) > ::slotted ( [slot=window] ) {
18
+ :host( .to-bottom-opened.to-bottom-outro ) .window,
19
+ :host( .to-bottom-opened.to-bottom-outro ) > ::slotted( [slot="window"] ),
20
+ :host( .to-bottom-opened ) .window,
21
+ :host( .to-bottom-opened ) > ::slotted( [slot="window"] ) {
22
22
  @apply animate-bottom-opened;
23
23
  }
24
24
 
25
- :host ( .animate-bottom-outro ) .window,
26
- :host ( .animate-bottom-outro ) > ::slotted ( [slot=window] ) {
25
+ :host( .to-bottom-outro ) .window,
26
+ :host( .to-bottom-outro ) > ::slotted( [slot="window"] ) {
27
27
  @apply animate-bottom-outro;
28
28
  }
@@ -1,28 +1,28 @@
1
- :host ( .animate-center ) {
1
+ :host( .to-center ) {
2
2
  @apply
3
3
  justify-center
4
4
  mobile:p-4
5
5
  p-8;
6
6
  }
7
7
 
8
- :host ( .animate-center ) .window,
9
- :host ( .animate-center ) > ::slotted ( [slot=window] ) {
10
- @apply animate-center;
8
+ :host( .to-center ) .window,
9
+ :host( .to-center ) > ::slotted( [slot="window"] ) {
10
+ @apply animate;
11
11
  }
12
12
 
13
- :host ( .animate-center-intro ) .window,
14
- :host ( .animate-center-intro ) > ::slotted ( [slot=window] ) {
13
+ :host( .to-center-intro ) .window,
14
+ :host( .to-center-intro ) > ::slotted( [slot="window"] ) {
15
15
  @apply animate-center-intro;
16
16
  }
17
17
 
18
- :host ( .animate-center-opened.animate-center-outro ) .window,
19
- :host ( .animate-center-opened.animate-center-outro ) > ::slotted ( [slot=window] ),
20
- :host ( .animate-center-opened ) .window,
21
- :host ( .animate-center-opened ) > ::slotted ( [slot=window] ) {
18
+ :host( .to-center-opened.to-center-outro ) .window,
19
+ :host( .to-center-opened.to-center-outro ) > ::slotted( [slot="window"] ),
20
+ :host( .to-center-opened ) .window,
21
+ :host( .to-center-opened ) > ::slotted( [slot="window"] ) {
22
22
  @apply animate-center-opened;
23
23
  }
24
24
 
25
- :host ( .animate-center-outro ) .window,
26
- :host ( .animate-center-outro ) > ::slotted ( [slot=window] ) {
25
+ :host( .to-center-outro ) .window,
26
+ :host( .to-center-outro ) > ::slotted( [slot="window"] ) {
27
27
  @apply animate-center-outro;
28
28
  }
@@ -1,41 +1,41 @@
1
- :host ( .animate-left ) {
1
+ :host( .to-left ) {
2
2
  @apply justify-start;
3
3
  }
4
4
 
5
- :host ( .animate-left ) .window,
6
- :host ( .animate-left ) > ::slotted ( [slot=window] ) {
7
- @apply animate-left;
5
+ :host( .to-left ) .window,
6
+ :host( .to-left ) > ::slotted( [slot="window"] ) {
7
+ @apply animate;
8
8
  }
9
9
 
10
- :host ( .animate-left-intro ) .window,
11
- :host ( .animate-left-intro ) > ::slotted ( [slot=window] ) {
10
+ :host( .to-left-intro ) .window,
11
+ :host( .to-left-intro ) > ::slotted( [slot="window"] ) {
12
12
  @apply animate-left-intro;
13
13
  }
14
14
 
15
- :host ( .animate-left-opened.animate-left-outro ) .window,
16
- :host ( .animate-left-opened.animate-left-outro ) > ::slotted ( [slot=window] ),
17
- :host ( .animate-left-opened ) .window,
18
- :host ( .animate-left-opened ) > ::slotted ( [slot=window] ) {
15
+ :host( .to-left-opened.to-left-outro ) .window,
16
+ :host( .to-left-opened.to-left-outro ) > ::slotted( [slot="window"] ),
17
+ :host( .to-left-opened ) .window,
18
+ :host( .to-left-opened ) > ::slotted( [slot="window"] ) {
19
19
  @apply animate-left-opened;
20
20
  }
21
21
 
22
- :host ( .animate-left-opened ) .close,
23
- :host ( .animate-left-opened.animate-left-outro ) .close {
22
+ :host( .to-left-opened ) .close,
23
+ :host( .to-left-opened.to-left-outro ) .close {
24
24
  @apply opacity-100;
25
25
 
26
26
  transform: translate(-24px, 24px) rotate(0);
27
27
  }
28
28
 
29
- :host ( .animate-left-outro ) .window,
30
- :host ( .animate-left-outro ) > ::slotted ( [slot=window] ) {
29
+ :host( .to-left-outro ) .window,
30
+ :host( .to-left-outro ) > ::slotted( [slot="window"] ) {
31
31
  @apply animate-left-outro;
32
32
  }
33
33
 
34
- :host ( .animate-left-outro ) .close {
34
+ :host( .to-left-outro ) .close {
35
35
  transform: translate(24px, 24px) rotate(-90deg);
36
36
  }
37
37
 
38
- :host ( .animate-left ) .close {
38
+ :host( .to-left ) .close {
39
39
  @apply right-0;
40
40
 
41
41
  transform: translate(36px, 24px) rotate(90deg);
@@ -1,41 +1,41 @@
1
- :host ( .animate-right ) {
1
+ :host( .to-right ) {
2
2
  @apply justify-end;
3
3
  }
4
4
 
5
- :host ( .animate-right ) .window,
6
- :host ( .animate-right ) > ::slotted ( [slot=window] ) {
7
- @apply animate-right;
5
+ :host( .to-right ) .window,
6
+ :host( .to-right ) > ::slotted([slot="window"]) {
7
+ @apply animate;
8
8
  }
9
9
 
10
- :host ( .animate-right-intro ) .window,
11
- :host ( .animate-right-intro ) > ::slotted ( [slot=window] ) {
10
+ :host( .to-right-intro ) .window,
11
+ :host( .to-right-intro ) > ::slotted( [slot="window"] ) {
12
12
  @apply animate-right-intro;
13
13
  }
14
14
 
15
- :host ( .animate-right-opened.animate-right-outro ) .window,
16
- :host ( .animate-right-opened.animate-right-outro ) > ::slotted ( [slot=window] ),
17
- :host ( .animate-right-opened ) .window,
18
- :host ( .animate-right-opened ) > ::slotted ( [slot=window] ) {
15
+ :host( .to-right-opened.to-right-outro ) .window,
16
+ :host( .to-right-opened.to-right-outro ) > ::slotted( [slot="window"] ),
17
+ :host( .to-right-opened ) .window,
18
+ :host( .to-right-opened ) > ::slotted( [slot="window"] ) {
19
19
  @apply animate-right-opened;
20
20
  }
21
21
 
22
- :host ( .animate-right-opened ) .close,
23
- :host ( .animate-right-opened.animate-right-outro ) .close {
22
+ :host( .to-right-opened ) .close,
23
+ :host( .to-right-opened.to-right-outro ) .close {
24
24
  @apply opacity-100;
25
25
 
26
26
  transform: translate(24px, 24px) rotate(0);
27
27
  }
28
28
 
29
- :host ( .animate-right-outro ) .window,
30
- :host ( .animate-right-outro ) > ::slotted ( [slot=window] ) {
29
+ :host( .to-right-outro ) .window,
30
+ :host( .to-right-outro ) > ::slotted( [slot="window"] ) {
31
31
  @apply animate-right-outro;
32
32
  }
33
33
 
34
- :host ( .animate-right-outro ) .close {
34
+ :host( .to-right-outro ) .close {
35
35
  transform: translate(-24px, 24px) rotate(90deg);
36
36
  }
37
37
 
38
- :host ( .animate-right ) .close {
38
+ :host( .to-right ) .close {
39
39
  @apply left-0;
40
40
 
41
41
  transform: translate(-36px, 24px) rotate(-90deg);
@@ -1,28 +1,28 @@
1
- :host ( .animate-top ) {
1
+ :host( .to-top ) {
2
2
  @apply
3
3
  justify-center
4
4
  mobile:p-4
5
5
  p-8;
6
6
  }
7
7
 
8
- :host ( .animate-top ) .window,
9
- :host ( .animate-top ) > ::slotted ( [slot=window] ) {
10
- @apply animate-top;
8
+ :host( .to-top ) .window,
9
+ :host( .to-top ) > ::slotted( [slot="window"] ) {
10
+ @apply animate;
11
11
  }
12
12
 
13
- :host ( .animate-top-intro ) .window,
14
- :host ( .animate-top-intro ) > ::slotted ( [slot=window] ) {
13
+ :host( .to-top-intro ) .window,
14
+ :host( .to-top-intro ) > ::slotted( [slot="window"] ) {
15
15
  @apply animate-top-intro;
16
16
  }
17
17
 
18
- :host ( .animate-top-opened.animate-top-outro ) .window,
19
- :host ( .animate-top-opened.animate-top-outro ) > ::slotted ( [slot=window] ),
20
- :host ( .animate-top-opened ) .window,
21
- :host ( .animate-top-opened ) > ::slotted ( [slot=window] ) {
18
+ :host( .to-top-opened.to-top-outro ) .window,
19
+ :host( .to-top-opened.to-top-outro ) > ::slotted( [slot="window"] ),
20
+ :host( .to-top-opened ) .window,
21
+ :host( .to-top-opened ) > ::slotted( [slot="window"] ) {
22
22
  @apply animate-top-opened;
23
23
  }
24
24
 
25
- :host ( .animate-top-outro ) .window,
26
- :host ( .animate-top-outro ) > ::slotted ( [slot=window] ) {
25
+ :host( .to-top-outro ) .window,
26
+ :host( .to-top-outro ) > ::slotted( [slot="window"] ) {
27
27
  @apply animate-top-outro;
28
28
  }
@@ -1,4 +1,7 @@
1
+ /* stylelint-disable */
1
2
  @import '../../tailwind/components.css';
3
+ @import './css/components.css';
4
+
2
5
  @tailwind components;
3
6
  @tailwind utilities;
4
7
 
@@ -11,65 +14,8 @@
11
14
  * @prop --mds-modal-z-index: Set the z-index of the window when the component is opened
12
15
  */
13
16
 
14
- @layer components {
15
- .animate-bottom,
16
- .animate-center,
17
- .animate-top {
18
- @apply
19
- duration-500
20
- ease-in-out-expo
21
- opacity-0
22
- transition-cosmetic;
23
- }
24
-
25
- .animate-bottom-intro,
26
- .animate-center-intro,
27
- .animate-top-intro {
28
- transform: rotateX(-22deg) scale(0.5) translateY(40%);
29
- }
30
-
31
- .animate-bottom-opened,
32
- .animate-center-opened,
33
- .animate-top-opened {
34
- @apply opacity-100;
35
-
36
- transform: rotateX(0) scale(1) translateY(0);
37
- }
38
-
39
- .animate-bottom-outro,
40
- .animate-center-outro,
41
- .animate-top-outro {
42
- transform: rotateX(-22deg) scale(0.5) translateY(-40%);
43
- }
44
-
45
- .animate-left,
46
- .animate-right {
47
- @apply
48
- duration-500
49
- opacity-0
50
- ease-in-out-expo
51
- transition-cosmetic;
52
- }
53
-
54
- .animate-right-intro,
55
- .animate-right-outro {
56
- transform: translateX(calc(100% + 50px));
57
- }
58
-
59
- .animate-right-opened,
60
- .animate-left-opened {
61
- @apply opacity-100;
62
-
63
- transform: translateX(0);
64
- }
65
-
66
- .animate-left-intro,
67
- .animate-left-outro {
68
- transform: translateX(calc(-100% - 50px));
69
- }
70
- }
71
-
72
17
  :host {
18
+
73
19
  --mds-modal-overlay-color: var(--magma-overlay-color, 0 0 0);
74
20
  --mds-modal-overlay-opacity: var(--magma-overlay-opacity, 0.5);
75
21
  --mds-modal-window-background: theme('colors.tone-neutral');
@@ -89,26 +35,26 @@
89
35
 
90
36
  background-color: rgba(var(--mds-modal-overlay-color) / 0);
91
37
  perspective: 600px;
92
- z-index: var(--z-index, 1000);
38
+ z-index: var(--mds-modal-z-index, 1000);
93
39
  }
94
40
 
95
- :host ( [position=top] ) {
41
+ :host( [position=top] ) {
96
42
  @apply
97
43
  items-start
98
44
  justify-center;
99
45
  }
100
46
 
101
- :host ( [position=bottom] ) {
47
+ :host( [position=bottom] ) {
102
48
  @apply
103
49
  items-end
104
50
  justify-center;
105
51
  }
106
52
 
107
- :host ( .animate-bottom-opened ),
108
- :host ( .animate-center-opened ),
109
- :host ( .animate-left-opened ),
110
- :host ( .animate-right-opened ),
111
- :host ( .animate-top-opened ) {
53
+ :host( .to-bottom-opened ),
54
+ :host( .to-center-opened ),
55
+ :host( .to-left-opened ),
56
+ :host( .to-right-opened ),
57
+ :host( .to-top-opened ) {
112
58
  @apply
113
59
  duration-500
114
60
  pointer-events-auto;
@@ -131,8 +77,8 @@
131
77
  top-0
132
78
  w-9;
133
79
 
134
- transition-property: opacity, outline, outline-offset, transform;
135
80
  transform: translate(0, 24px) rotate(90deg);
81
+ transition-property: opacity, outline, outline-offset, transform;
136
82
  }
137
83
 
138
84
  .window {
@@ -165,3 +111,4 @@
165
111
  @import './css/mds-modal-animate-left.css';
166
112
  @import './css/mds-modal-animate-right.css';
167
113
  @import './css/mds-modal-animate-top.css';
114
+
@@ -12,9 +12,9 @@ import { ModalPositionType, ModalAnimationStateType } from './meta/types'
12
12
  export class MdsModal {
13
13
 
14
14
  private animationDeelay
15
- private window: boolean = null
16
- private top: boolean = null
17
- private bottom: boolean = null
15
+ private window = false
16
+ private top = false
17
+ private bottom = false
18
18
  private animationState: ModalAnimationStateType = 'intro'
19
19
  private km = new KeyboardManager()
20
20
  @State() stateOpened: boolean
@@ -23,12 +23,12 @@ export class MdsModal {
23
23
  /**
24
24
  * Specifies if the modal is opened or not
25
25
  */
26
- @Prop({ reflect: true, mutable: true }) opened?: boolean
26
+ @Prop({ reflect: true, mutable: true }) opened = false
27
27
 
28
28
  /**
29
29
  * Specifies the animation position of the modal window
30
30
  */
31
- @Prop({ reflect: true, mutable: true }) position?: ModalPositionType = null
31
+ @Prop({ reflect: true, mutable: true }) position?: ModalPositionType = 'center'
32
32
 
33
33
  componentWillLoad (): void {
34
34
  this.bottom = this.host.querySelector('[slot="bottom"]') !== null
@@ -36,17 +36,12 @@ export class MdsModal {
36
36
  this.window = this.host.querySelector('[slot="window"]') !== null
37
37
  this.stateOpened = this.opened
38
38
 
39
- if (this.window && this.position === null) {
40
- this.position = 'center'
41
- }
42
-
43
- if (this.position === null) {
39
+ if (!this.window) {
44
40
  this.position = 'right'
45
41
  }
46
42
 
47
43
  if (this.window) {
48
- const modal = this.host.querySelector('[slot="window"]')
49
- modal.setAttribute('role', 'modal')
44
+ this.host.querySelector('[slot="window"]')?.setAttribute('role', 'modal')
50
45
  }
51
46
  }
52
47
 
@@ -66,7 +61,8 @@ export class MdsModal {
66
61
 
67
62
  componentDidLoad = (): void => {
68
63
  this.km.addElement(this.host, 'host')
69
- this.km.addElement(this.host.shadowRoot.querySelector('.close'), 'close')
64
+ const close = this.host.shadowRoot?.querySelector('.close')
65
+ if (close) this.km.addElement(close as HTMLElement, 'close')
70
66
  this.km.attachEscapeBehavior(() => this.closeEvent.emit())
71
67
  this.km.attachClickBehavior('close')
72
68
  }
@@ -76,14 +72,14 @@ export class MdsModal {
76
72
  this.km.detachClickBehavior('close')
77
73
  }
78
74
 
79
- private animationName = (customState: string = null, customPosition: string = null): string => {
80
- return `animate-${customPosition !== null ? customPosition : this.position}${customState !== null ? '-' + customState : ''}`
75
+ private animationName = (customState = '', customPosition = ''): string => {
76
+ return `to-${customPosition !== '' ? customPosition : this.position}${customState !== '' ? '-' + customState : ''}`
81
77
  }
82
78
 
83
79
  @Watch('position')
84
80
  positionChange (_newValue: string, oldValue: string): void {
85
81
  window.clearTimeout(this.animationDeelay)
86
- this.host.classList.remove(this.animationName(null, oldValue))
82
+ this.host.classList.remove(this.animationName('', oldValue))
87
83
  this.host.classList.remove(this.animationName('intro', oldValue))
88
84
  this.host.classList.remove(this.animationName('outro', oldValue))
89
85
  }
@@ -99,7 +95,7 @@ export class MdsModal {
99
95
  */
100
96
  @Event({ bubbles: true, composed: true, eventName: 'mdsModalClose' }) closeEvent: EventEmitter<void>
101
97
 
102
- private closeModal = (e:Event = null): void => {
98
+ private closeModal = (e:Event): void => {
103
99
  if ((e.target as HTMLElement)?.localName !== 'mds-modal') {
104
100
  return
105
101
  }
@@ -123,10 +119,8 @@ export class MdsModal {
123
119
  return (
124
120
  <Host aria-modal={clsx(this.opened ? 'true' : 'false' )} class={clsx(this.stateOpened && this.animationName('opened'))} onClick={(e: Event) => { this.closeModal(e) }}>
125
121
  { this.window
126
- ?
127
- <slot name="window"/>
128
- :
129
- <div class={clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`)} role="dialog">
122
+ ? <slot name="window"/>
123
+ : <div class={clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`)} role="dialog">
130
124
  { this.top &&
131
125
  <slot name="top"/>
132
126
  }
@@ -7,10 +7,10 @@
7
7
 
8
8
  ## Properties
9
9
 
10
- | Property | Attribute | Description | Type | Default |
11
- | ---------- | ---------- | ---------------------------------------------------- | ---------------------------------------------------- | ----------- |
12
- | `opened` | `opened` | Specifies if the modal is opened or not | `boolean` | `undefined` |
13
- | `position` | `position` | Specifies the animation position of the modal window | `"bottom" \| "center" \| "left" \| "right" \| "top"` | `null` |
10
+ | Property | Attribute | Description | Type | Default |
11
+ | ---------- | ---------- | ---------------------------------------------------- | ----------------------------------------------------------------- | ---------- |
12
+ | `opened` | `opened` | Specifies if the modal is opened or not | `boolean` | `false` |
13
+ | `position` | `position` | Specifies the animation position of the modal window | `"bottom" \| "center" \| "left" \| "right" \| "top" \| undefined` | `'center'` |
14
14
 
15
15
 
16
16
  ## Events
@@ -9,7 +9,7 @@ describe('mds-modal', () => {
9
9
 
10
10
  // La riga seguente non è valida perché `animate-right-intro` viene impostato in `componentDidRender`
11
11
  // e quindi appena instanziato non è presente come classe
12
- expect(element).toHaveClass('animate-right')
12
+ expect(element).toHaveClass('to-right')
13
13
  expect(element).toHaveAttribute('hydrated')
14
14
  expect(element).toHaveAttribute('position')
15
15
 
@@ -1,6 +1,6 @@
1
- import { Canvas, Meta, Story } from '@storybook/addon-docs';
1
+ import { Canvas, Meta, Story } from "@storybook/addon-docs";
2
2
 
3
- import MdsModal from '@component/mds-modal/mds-modal'
3
+ import MdsModal from "@component-dist/mds-modal/mds-modal";
4
4
 
5
5
  <Meta title="UI/Modal/Known issues" component={MdsModal} />
6
6
 
@@ -11,4 +11,3 @@ import MdsModal from '@component/mds-modal/mds-modal'
11
11
  ### Close event triggered in wrong moments
12
12
 
13
13
  If you trigger the event `onMouseDown` on the slot `top`, then you trigger `onMouseUp` slot `bottom`, the window closes insted of remaining opened.
14
-
@@ -62,10 +62,10 @@ const CustomTemplate = args =>
62
62
  const AriaTemplate = () => {
63
63
  // Click not working with reader
64
64
  const [opened, setOpened] = useState(false)
65
- window.addEventListener('close', () => { setOpened(false) })
65
+ window.addEventListener('mdsModalClose', () => { setOpened(false) })
66
66
  return <div>
67
67
  <mds-button onClick={() => setOpened(true) }>Apri modale</mds-button>
68
- <mds-modal opened={opened} onClose={() => setOpened(false)}>
68
+ <mds-modal opened={opened} onMdsModalClose={() => setOpened(false)}>
69
69
  <mds-banner slot="window" class="max-w-xl mx-6" deletable headline="Action required">
70
70
  <mds-text typography="detail">
71
71
  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.
@@ -11,7 +11,7 @@ export namespace Components {
11
11
  /**
12
12
  * Specifies if the modal is opened or not
13
13
  */
14
- "opened"?: boolean;
14
+ "opened": boolean;
15
15
  /**
16
16
  * Specifies the animation position of the modal window
17
17
  */
@@ -221,6 +221,7 @@
221
221
  "mi/baseline/navigate-next",
222
222
  "mi/baseline/panorama",
223
223
  "mi/baseline/person",
224
+ "mi/baseline/pets",
224
225
  "mi/baseline/radio-button-checked",
225
226
  "mi/baseline/radio-button-unchecked",
226
227
  "mi/baseline/route",
@@ -1,4 +1,4 @@
1
- import { InputValueType } from '../types/input-value-type'
1
+ import { InputValueType } from '@type/input-value-type'
2
2
 
3
3
  export interface InputValue {
4
4
  value: InputValueType
@@ -1 +1 @@
1
- import{p as e,b as o}from"./p-4fdbb5fc.js";export{s as setNonce}from"./p-4fdbb5fc.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-225eed54",[[1,"mds-modal",{opened:[1540],position:[1537],stateOpened:[32]},[[4,"mdsModalClose","onModalCloseListener"],[4,"mdsBannerClose","onBannerCloseListener"]]]]]],e)));
1
+ import{p as e,b as o}from"./p-4fdbb5fc.js";export{s as setNonce}from"./p-4fdbb5fc.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-a7878434",[[1,"mds-modal",{opened:[1540],position:[1537],stateOpened:[32]},[[4,"mdsModalClose","onModalCloseListener"],[4,"mdsBannerClose","onBannerCloseListener"]]]]]],e)));
@@ -115,7 +115,7 @@ DOMTokenList
115
115
  var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : '';
116
116
  var start = function() {
117
117
  // if src is not present then origin is "null", and new URL() throws TypeError: Failed to construct 'URL': Invalid base URL
118
- var url = new URL('./p-f856db3e.system.js', new URL(resourcesUrl, window.location.origin !== 'null' ? window.location.origin : undefined));
118
+ var url = new URL('./p-e2fdb863.system.js', new URL(resourcesUrl, window.location.origin !== 'null' ? window.location.origin : undefined));
119
119
  System.import(url.href);
120
120
  };
121
121