@maggioli-design-system/mds-modal 4.7.1 → 4.7.2

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 (67) hide show
  1. package/dist/cjs/{index-1c3a970e.js → index-95c329c0.js} +29 -17
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mds-modal.cjs.entry.js +129 -129
  4. package/dist/cjs/mds-modal.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/common/aria.js +18 -18
  7. package/dist/collection/common/keyboard-manager.js +38 -38
  8. package/dist/collection/common/unit.js +7 -7
  9. package/dist/collection/components/mds-modal/mds-modal.css +8 -27
  10. package/dist/collection/components/mds-modal/mds-modal.js +188 -188
  11. package/dist/collection/components/mds-modal/meta/dictionary.js +5 -5
  12. package/dist/collection/components/mds-modal/test/mds-modal.e2e.js +34 -34
  13. package/dist/collection/components/mds-modal/test/mds-modal.stories.js +16 -16
  14. package/dist/collection/dictionary/autocomplete.js +56 -56
  15. package/dist/collection/dictionary/button.js +19 -19
  16. package/dist/collection/dictionary/color.js +14 -14
  17. package/dist/collection/dictionary/floating-ui.js +14 -14
  18. package/dist/collection/dictionary/input.js +31 -15
  19. package/dist/collection/dictionary/loading.js +2 -2
  20. package/dist/collection/dictionary/typography.js +46 -46
  21. package/dist/collection/dictionary/variant.js +54 -54
  22. package/dist/collection/fixtures/cities.js +107 -107
  23. package/dist/components/mds-modal.d.ts +2 -2
  24. package/dist/components/mds-modal.js +149 -149
  25. package/dist/documentation.json +2 -2
  26. package/dist/esm/{index-a33ffd58.js → index-2bd481c0.js} +29 -17
  27. package/dist/esm/loader.js +2 -2
  28. package/dist/esm/mds-modal.entry.js +129 -129
  29. package/dist/esm/mds-modal.js +3 -3
  30. package/dist/esm-es5/index-2bd481c0.js +1 -0
  31. package/dist/esm-es5/loader.js +1 -1
  32. package/dist/esm-es5/mds-modal.entry.js +1 -1
  33. package/dist/esm-es5/mds-modal.js +1 -1
  34. package/dist/mds-modal/mds-modal.esm.js +1 -1
  35. package/dist/mds-modal/mds-modal.js +15 -15
  36. package/{www/build/p-506f8ff7.system.js → dist/mds-modal/p-0a4de21e.system.js} +1 -1
  37. package/dist/mds-modal/{p-602c50be.js → p-2f9a631d.js} +1 -1
  38. package/dist/mds-modal/p-68c3fe7d.system.entry.js +1 -0
  39. package/dist/mds-modal/{p-7ead5b8b.system.js → p-969424eb.system.js} +1 -1
  40. package/dist/mds-modal/p-fe6df5e2.entry.js +1 -0
  41. package/dist/stats.json +30 -30
  42. package/dist/types/common/keyboard-manager.d.ts +9 -9
  43. package/dist/types/components/mds-modal/test/mds-modal.stories.d.ts +20 -20
  44. package/dist/types/dictionary/input.d.ts +2 -1
  45. package/dist/types/interface/input-value.d.ts +1 -1
  46. package/dist/types/stencil-public-runtime.d.ts +8 -0
  47. package/documentation.json +14 -4
  48. package/package.json +3 -3
  49. package/src/components/mds-modal/css/mds-modal-animate-bottom.css +2 -2
  50. package/src/components/mds-modal/css/mds-modal-animate-center.css +2 -2
  51. package/src/components/mds-modal/css/mds-modal-animate-top.css +2 -2
  52. package/src/components/mds-modal/mds-modal.css +2 -2
  53. package/src/dictionary/input.ts +18 -0
  54. package/src/fixtures/icons.json +3 -0
  55. package/src/fixtures/iconsauce.json +3 -0
  56. package/www/build/mds-modal.esm.js +1 -1
  57. package/www/build/mds-modal.js +15 -15
  58. package/{dist/mds-modal/p-506f8ff7.system.js → www/build/p-0a4de21e.system.js} +1 -1
  59. package/www/build/{p-602c50be.js → p-2f9a631d.js} +1 -1
  60. package/www/build/p-68c3fe7d.system.entry.js +1 -0
  61. package/www/build/{p-7ead5b8b.system.js → p-969424eb.system.js} +1 -1
  62. package/www/build/p-fe6df5e2.entry.js +1 -0
  63. package/dist/esm-es5/index-a33ffd58.js +0 -1
  64. package/dist/mds-modal/p-a0636f54.system.entry.js +0 -1
  65. package/dist/mds-modal/p-c5a84e4d.entry.js +0 -1
  66. package/www/build/p-a0636f54.system.entry.js +0 -1
  67. package/www/build/p-c5a84e4d.entry.js +0 -1
@@ -18,7 +18,7 @@
18
18
 
19
19
 
20
20
  .svg svg {
21
- aspect-ratio: 1 / 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: 0px;
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,11 +76,8 @@
86
76
  .bg-transparent {
87
77
  background-color: transparent;
88
78
  }
89
- .p-4 {
90
- padding: 1rem;
91
- }
92
- .p-8 {
93
- padding: 2rem;
79
+ .text {
80
+ font-size: 1rem;
94
81
  }
95
82
  .text-tone-neutral-02 {
96
83
  --tw-text-opacity: 1;
@@ -160,7 +147,7 @@
160
147
  }
161
148
 
162
149
  .close {
163
- top: 0px;
150
+ top: 0rem;
164
151
  height: 2.25rem;
165
152
  width: 2.25rem;
166
153
  border-radius: 9999px;
@@ -180,7 +167,7 @@
180
167
 
181
168
  .window {
182
169
  height: 100%;
183
- gap: 0px;
170
+ gap: 0rem;
184
171
 
185
172
  background-color: var(--mds-modal-window-background);
186
173
  box-shadow: var(--mds-modal-window-shadow);
@@ -332,7 +319,7 @@
332
319
  }
333
320
 
334
321
  :host( .to-left ) .close {
335
- right: 0px;
322
+ right: 0rem;
336
323
 
337
324
  transform: translate(36px, 24px) rotate(90deg);
338
325
  }
@@ -381,7 +368,7 @@
381
368
  }
382
369
 
383
370
  :host( .to-right ) .close {
384
- left: 0px;
371
+ left: 0rem;
385
372
 
386
373
  transform: translate(-36px, 24px) rotate(-90deg);
387
374
  }
@@ -429,10 +416,4 @@
429
416
  transform: rotateX(-22deg) scale(0.5) translateY(-40%);
430
417
  }
431
418
 
432
- @media (max-width: 767px) {
433
- .mobile\:w-12 {
434
- width: 3rem;
435
- }
436
- }
437
-
438
419
 
@@ -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
- 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;
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
- "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": {}
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
- 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
- }
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
  }
@@ -1,8 +1,8 @@
1
1
  const modalPositionDictionary = [
2
- 'bottom',
3
- 'center',
4
- 'left',
5
- 'right',
6
- 'top',
2
+ 'bottom',
3
+ 'center',
4
+ 'left',
5
+ 'right',
6
+ 'top',
7
7
  ];
8
8
  export { modalPositionDictionary, };
@@ -1,17 +1,17 @@
1
1
  import { newE2EPage } from "@stencil/core/testing";
2
2
  describe('mds-modal', () => {
3
- it('renders', async () => {
4
- const page = await newE2EPage();
5
- await page.setContent('<mds-modal></mds-modal>');
6
- const element = await page.find('mds-modal');
7
- // La riga seguente non è valida perché `animate-right-intro` viene impostato in `componentDidRender`
8
- // e quindi appena instanziato non è presente come classe
9
- expect(element).toHaveClass('to-right');
10
- expect(element).toHaveAttribute('hydrated');
11
- expect(element).toHaveAttribute('position');
12
- expect(element.getAttribute('position')).toBe('right');
13
- expect(element).not.toHaveAttribute('opened');
14
- expect(element.shadowRoot).toEqualHtml(`
3
+ it('renders', async () => {
4
+ const page = await newE2EPage();
5
+ await page.setContent('<mds-modal></mds-modal>');
6
+ const element = await page.find('mds-modal');
7
+ // La riga seguente non è valida perché `animate-right-intro` viene impostato in `componentDidRender`
8
+ // e quindi appena instanziato non è presente come classe
9
+ expect(element).toHaveClass('to-right');
10
+ expect(element).toHaveAttribute('hydrated');
11
+ expect(element).toHaveAttribute('position');
12
+ expect(element.getAttribute('position')).toBe('right');
13
+ expect(element).not.toHaveAttribute('opened');
14
+ expect(element.shadowRoot).toEqualHtml(`
15
15
  <div class="window" part="window" role="dialog">
16
16
  <slot></slot>
17
17
  </div>
@@ -21,13 +21,13 @@ describe('mds-modal', () => {
21
21
  </svg>
22
22
  </i>
23
23
  `);
24
- });
25
- it('renders opened', async () => {
26
- const page = await newE2EPage();
27
- await page.setContent('<mds-modal opened="true"></mds-modal>');
28
- const element = await page.find('mds-modal');
29
- expect(element.getAttribute('opened')).not.toBe('false');
30
- expect(element.shadowRoot).toEqualHtml(`
24
+ });
25
+ it('renders opened', async () => {
26
+ const page = await newE2EPage();
27
+ await page.setContent('<mds-modal opened="true"></mds-modal>');
28
+ const element = await page.find('mds-modal');
29
+ expect(element.getAttribute('opened')).not.toBe('false');
30
+ expect(element.shadowRoot).toEqualHtml(`
31
31
  <div class="window" part="window" role="dialog">
32
32
  <slot></slot>
33
33
  </div>
@@ -37,19 +37,19 @@ describe('mds-modal', () => {
37
37
  </svg>
38
38
  </i>
39
39
  `);
40
- });
41
- it('can be closed', async () => {
42
- const page = await newE2EPage();
43
- await page.setContent('<mds-modal opened="true"></mds-modal>');
44
- const element = await page.find('mds-modal');
45
- expect(element.getAttribute('opened')).not.toBe('false');
46
- await page.mouse.click(window.innerWidth / 2, window.innerHeight / 2);
47
- // const mdsIcon = element.shadowRoot.querySelector('mds-icon') as HTMLElement
48
- // console.info('mdsIcon', mdsIcon)
49
- // const closeButton = mdsIcon.shadowRoot.querySelector('i') as HTMLElement
50
- // console.info('closeButton', closeButton)
51
- // closeButton.click()
52
- await page.waitForChanges();
53
- expect(element).not.toHaveClass('opened');
54
- });
40
+ });
41
+ it('can be closed', async () => {
42
+ const page = await newE2EPage();
43
+ await page.setContent('<mds-modal opened="true"></mds-modal>');
44
+ const element = await page.find('mds-modal');
45
+ expect(element.getAttribute('opened')).not.toBe('false');
46
+ await page.mouse.click(window.innerWidth / 2, window.innerHeight / 2);
47
+ // const mdsIcon = element.shadowRoot.querySelector('mds-icon') as HTMLElement
48
+ // console.info('mdsIcon', mdsIcon)
49
+ // const closeButton = mdsIcon.shadowRoot.querySelector('i') as HTMLElement
50
+ // console.info('closeButton', closeButton)
51
+ // closeButton.click()
52
+ await page.waitForChanges();
53
+ expect(element).not.toHaveClass('opened');
54
+ });
55
55
  });
@@ -2,19 +2,19 @@ import { h } from "@stencil/core";
2
2
  import { useState } from "react";
3
3
  import { modalPositionDictionary } from "../meta/dictionary";
4
4
  export default {
5
- title: 'UI / Modal',
6
- argTypes: {
7
- opened: {
8
- description: 'Specifies if the modal is opened or not',
9
- type: { name: 'boolean', required: false },
5
+ title: 'UI / Modal',
6
+ argTypes: {
7
+ opened: {
8
+ description: 'Specifies if the modal is opened or not',
9
+ type: { name: 'boolean', required: false },
10
+ },
11
+ position: {
12
+ control: { type: 'select' },
13
+ description: 'Specifies the animation position of the modal window',
14
+ options: modalPositionDictionary,
15
+ type: { name: 'string', required: false },
16
+ },
10
17
  },
11
- position: {
12
- control: { type: 'select' },
13
- description: 'Specifies the animation position of the modal window',
14
- options: modalPositionDictionary,
15
- type: { name: 'string', required: false },
16
- },
17
- },
18
18
  };
19
19
  const firstName = 'Mario';
20
20
  const lastName = 'Rossi';
@@ -23,10 +23,10 @@ const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}@nintendo.com
23
23
  const Template = args => h("mds-modal", Object.assign({}, args), h("header", { slot: "top", class: "p-8 max-w-lg flex gap-4 items-center border-b border-tone-neutral-09" }, h("mds-img", { class: "w-16", src: "/logo-gruppo-maggioli-512w.webp" }), h("div", { class: "text-tone-neutral-02" }, h("mds-text", { typography: "h5", class: "truncate min-w-0" }, "Maggioli Editore"), h("mds-text", { typography: "detail", class: "truncate min-w-0" }, "Menu di servizio"))), h("div", { class: "p-8 max-w-lg" }, h("mds-text", null, "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("footer", { slot: "bottom", class: "p-8 max-w-lg flex gap-4 text-tone-neutral-02 border-t border-tone-neutral-09" }, h("mds-author", null, h("mds-avatar", { slot: "avatar", class: "w-16 mobile:w-12", src: "/avatar-01-200x200.jpeg" }), h("mds-text", { typography: "h6", class: "truncate min-w-0" }, fullName), h("mds-text", { typography: "caption", class: "text-tone-neutral-04 truncate min-w-0" }, email)), h("mds-button", { icon: "mdi/dots-vertical", class: "ml-auto bg-transparent text-tone-neutral-02 p-4 border border-tone-neutral-09 rounded-full" })));
24
24
  const CustomTemplate = args => h("mds-modal", Object.assign({}, args), 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: "primary", tone: "quiet" }, "Cancel"), h("mds-button", { slot: "actions", variant: "primary" }, "Confirm")));
25
25
  const AriaTemplate = () => {
26
- // Click not working with reader
27
- const [opened, setOpened] = useState(false);
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"))));
26
+ // Click not working with reader
27
+ const [opened, setOpened] = useState(false);
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({});