@mgdis/mg-components 5.8.2 → 5.10.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/mg-action-more_31.cjs.entry.js +216 -277
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +1 -16
- package/dist/cjs/{mg-menu.conf-9afe6571.js → mg-menu.conf-1942ac70.js} +0 -5
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -3
- package/dist/collection/components/atoms/mg-button/mg-button.js +2 -7
- package/dist/collection/components/atoms/mg-card/mg-card.conf.js +8 -0
- package/dist/collection/components/atoms/mg-card/mg-card.css +54 -0
- package/dist/collection/components/atoms/mg-card/mg-card.js +113 -2
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +0 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +0 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +38 -7
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +70 -11
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +65 -24
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +0 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +12 -12
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +0 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +42 -15
- package/dist/collection/components/molecules/inputs/MgInput.js +0 -6
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +0 -6
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +0 -5
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +12 -21
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +0 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +0 -9
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +0 -13
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +1 -12
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -5
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +0 -5
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +1 -12
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +1 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -19
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +0 -8
- package/dist/collection/components/molecules/mg-details/mg-details.css +0 -3
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -4
- package/dist/collection/components/molecules/mg-form/mg-form.js +0 -8
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +0 -2
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +0 -5
- package/dist/collection/components/molecules/mg-message/mg-message.css +1 -19
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -11
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +1 -6
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +0 -6
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +5 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -8
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +0 -12
- package/dist/collection/locales/index.js +0 -1
- package/dist/collection/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/collection/utils/behaviors.utils.js +0 -10
- package/dist/collection/utils/components.utils.js +1 -10
- package/dist/collection/utils/locale.utils.js +0 -4
- package/dist/collection/utils/unit.test.utils.js +0 -5
- package/dist/collection/variables.css +7 -1
- package/dist/components/MgInput.js +0 -6
- package/dist/components/components.utils.js +1 -10
- package/dist/components/index2.js +0 -5
- package/dist/components/mg-action-more.js +1 -9
- package/dist/components/mg-badge2.js +1 -3
- package/dist/components/mg-button2.js +2 -7
- package/dist/components/mg-card2.js +67 -4
- package/dist/components/mg-character-left2.js +0 -2
- package/dist/components/mg-details.js +2 -5
- package/dist/components/mg-divider.js +0 -1
- package/dist/components/mg-form.js +0 -8
- package/dist/components/mg-icon2.js +74 -25
- package/dist/components/mg-illustrated-message.js +0 -2
- package/dist/components/mg-input-checkbox.js +0 -6
- package/dist/components/mg-input-date.js +0 -5
- package/dist/components/mg-input-numeric.js +12 -21
- package/dist/components/mg-input-password.js +0 -3
- package/dist/components/mg-input-radio.js +0 -9
- package/dist/components/mg-input-select2.js +0 -13
- package/dist/components/mg-input-text2.js +1 -12
- package/dist/components/mg-input-textarea.js +1 -5
- package/dist/components/mg-input-title2.js +0 -2
- package/dist/components/mg-input-toggle.js +0 -5
- package/dist/components/mg-item-more.js +0 -15
- package/dist/components/mg-menu-item2.js +2 -20
- package/dist/components/mg-menu2.js +0 -11
- package/dist/components/mg-message.js +4 -9
- package/dist/components/mg-modal.js +2 -7
- package/dist/components/mg-pagination.js +0 -6
- package/dist/components/mg-panel.js +6 -16
- package/dist/components/mg-popover2.js +2 -9
- package/dist/components/mg-skip-links.js +1 -4
- package/dist/components/mg-tabs.js +0 -12
- package/dist/components/mg-tag.js +1 -4
- package/dist/components/mg-tooltip2.js +42 -15
- package/dist/components/popper.js +3 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +216 -277
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +1 -16
- package/dist/esm/{mg-menu.conf-881fbd82.js → mg-menu.conf-2cc1bb67.js} +0 -5
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-67ce7cb8.entry.js → p-a56a3157.entry.js} +1 -1
- package/dist/mg-components/p-eb32bb18.entry.js +1 -0
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/mg-components/variables.css +7 -1
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +0 -2
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -5
- package/dist/types/components/atoms/mg-card/mg-card.conf.d.ts +16 -0
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +37 -1
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +0 -2
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +0 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +10 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +19 -8
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +0 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +0 -3
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +18 -9
- package/dist/types/components/molecules/inputs/MgInput.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +0 -5
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +0 -5
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +5 -17
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +0 -3
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -8
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -9
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +0 -11
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +0 -4
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +0 -5
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +0 -11
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +0 -18
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +0 -5
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +0 -3
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +0 -8
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +0 -2
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +0 -5
- package/dist/types/components/molecules/mg-message/mg-message.conf.d.ts +5 -1
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +7 -11
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +0 -5
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +0 -5
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +0 -10
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +0 -7
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +0 -3
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +0 -11
- package/dist/types/components.d.ts +35 -9
- package/dist/types/locales/index.d.ts +0 -1
- package/dist/types/utils/behaviors.utils.d.ts +0 -9
- package/dist/types/utils/components.utils.d.ts +1 -9
- package/dist/types/utils/locale.utils.d.ts +0 -4
- package/dist/types/utils/unit.test.utils.d.ts +0 -7
- package/package.json +15 -16
- package/dist/mg-components/p-0b68c4b4.entry.js +0 -1
- /package/dist/mg-components/{p-367f92d2.js → p-73156ac9.js} +0 -0
|
@@ -8,7 +8,6 @@ export class MgPanel {
|
|
|
8
8
|
************/
|
|
9
9
|
/**
|
|
10
10
|
* Toggle is editing state
|
|
11
|
-
*
|
|
12
11
|
* @returns {void}
|
|
13
12
|
*/
|
|
14
13
|
this.toggleIsEditing = () => {
|
|
@@ -19,7 +18,6 @@ export class MgPanel {
|
|
|
19
18
|
************/
|
|
20
19
|
/**
|
|
21
20
|
* Collapse button click handler
|
|
22
|
-
*
|
|
23
21
|
* @returns {void}
|
|
24
22
|
*/
|
|
25
23
|
this.handleCollapseButton = () => {
|
|
@@ -29,7 +27,6 @@ export class MgPanel {
|
|
|
29
27
|
};
|
|
30
28
|
/**
|
|
31
29
|
* Edit button click handler
|
|
32
|
-
*
|
|
33
30
|
* @returns {void}
|
|
34
31
|
*/
|
|
35
32
|
this.handleEditButton = () => {
|
|
@@ -37,7 +34,6 @@ export class MgPanel {
|
|
|
37
34
|
};
|
|
38
35
|
/**
|
|
39
36
|
* Update title handler
|
|
40
|
-
*
|
|
41
37
|
* @param {CustomEvent<string>} event input value change event
|
|
42
38
|
* @returns {void}
|
|
43
39
|
*/
|
|
@@ -46,7 +42,6 @@ export class MgPanel {
|
|
|
46
42
|
};
|
|
47
43
|
/**
|
|
48
44
|
* Cancel edition button handler
|
|
49
|
-
*
|
|
50
45
|
* @returns {void}
|
|
51
46
|
*/
|
|
52
47
|
this.handleCancelEditButton = () => {
|
|
@@ -55,7 +50,6 @@ export class MgPanel {
|
|
|
55
50
|
};
|
|
56
51
|
/**
|
|
57
52
|
* Validate edition button handler
|
|
58
|
-
*
|
|
59
53
|
* @returns {void}
|
|
60
54
|
*/
|
|
61
55
|
this.handleValidateEditButton = () => {
|
|
@@ -67,7 +61,6 @@ export class MgPanel {
|
|
|
67
61
|
};
|
|
68
62
|
/**
|
|
69
63
|
* Header left conditional render
|
|
70
|
-
*
|
|
71
64
|
* @typedef {HTMLElement} HTMLMgButtonElement
|
|
72
65
|
* @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
|
|
73
66
|
*/
|
|
@@ -105,10 +98,10 @@ export class MgPanel {
|
|
|
105
98
|
this.titleChange.emit(newValue);
|
|
106
99
|
}
|
|
107
100
|
validatetitlePattern(newValue) {
|
|
108
|
-
if (newValue && !this.titleEditable) {
|
|
101
|
+
if (newValue !== undefined && !this.titleEditable) {
|
|
109
102
|
throw new Error('<mg-panel> prop "titleEditable" must be set to `true`.');
|
|
110
103
|
}
|
|
111
|
-
if (newValue && (this.titlePatternErrorMessage === undefined || this.titlePatternErrorMessage.trim() === '')) {
|
|
104
|
+
if (newValue !== undefined && (this.titlePatternErrorMessage === undefined || this.titlePatternErrorMessage.trim() === '')) {
|
|
112
105
|
throw new Error('<mg-panel> prop "titlePattern" must be paired with the prop "titlePatternErrorMessage".');
|
|
113
106
|
}
|
|
114
107
|
}
|
|
@@ -120,7 +113,6 @@ export class MgPanel {
|
|
|
120
113
|
*************/
|
|
121
114
|
/**
|
|
122
115
|
* Check if props are well configured on init
|
|
123
|
-
*
|
|
124
116
|
* @returns {void}
|
|
125
117
|
*/
|
|
126
118
|
componentWillLoad() {
|
|
@@ -132,7 +124,6 @@ export class MgPanel {
|
|
|
132
124
|
}
|
|
133
125
|
/**
|
|
134
126
|
* Edit DOM after render
|
|
135
|
-
*
|
|
136
127
|
* @returns {void}
|
|
137
128
|
*/
|
|
138
129
|
componentDidRender() {
|
|
@@ -143,7 +134,6 @@ export class MgPanel {
|
|
|
143
134
|
}
|
|
144
135
|
/**
|
|
145
136
|
* Render component
|
|
146
|
-
*
|
|
147
137
|
* @returns {HTMLElement} html element
|
|
148
138
|
*/
|
|
149
139
|
render() {
|
|
@@ -200,7 +190,7 @@ export class MgPanel {
|
|
|
200
190
|
},
|
|
201
191
|
"titlePattern": {
|
|
202
192
|
"type": "string",
|
|
203
|
-
"mutable":
|
|
193
|
+
"mutable": false,
|
|
204
194
|
"complexType": {
|
|
205
195
|
"original": "string",
|
|
206
196
|
"resolved": "string",
|
|
@@ -217,7 +207,7 @@ export class MgPanel {
|
|
|
217
207
|
},
|
|
218
208
|
"titlePatternErrorMessage": {
|
|
219
209
|
"type": "string",
|
|
220
|
-
"mutable":
|
|
210
|
+
"mutable": false,
|
|
221
211
|
"complexType": {
|
|
222
212
|
"original": "string",
|
|
223
213
|
"resolved": "string",
|
|
@@ -252,7 +242,7 @@ export class MgPanel {
|
|
|
252
242
|
},
|
|
253
243
|
"expandToggleDisabled": {
|
|
254
244
|
"type": "boolean",
|
|
255
|
-
"mutable":
|
|
245
|
+
"mutable": false,
|
|
256
246
|
"complexType": {
|
|
257
247
|
"original": "boolean",
|
|
258
248
|
"resolved": "boolean",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
color: hsl(var(--mg-popover-font-color));
|
|
18
18
|
}
|
|
19
19
|
.mg-popover mg-card {
|
|
20
|
+
--mg-card-max-width: var(--mg-popover-max-width);
|
|
20
21
|
position: relative;
|
|
21
22
|
}
|
|
22
23
|
.mg-popover[data-show] {
|
|
@@ -115,4 +116,5 @@
|
|
|
115
116
|
--mg-card-border-radius: var(--mg-card-border-radius-default);
|
|
116
117
|
--mg-card-background: var(--mg-card-background-default);
|
|
117
118
|
--mg-card-box-shadow: var(--mg-card-box-shadow-default);
|
|
119
|
+
--mg-card-max-width: unset;
|
|
118
120
|
}
|
|
@@ -9,7 +9,6 @@ export class MgPopover {
|
|
|
9
9
|
this.classArrowHide = `mg-popover--arrow-hide`;
|
|
10
10
|
/**
|
|
11
11
|
* Check if clicked outside of component
|
|
12
|
-
*
|
|
13
12
|
* @param {MouseEvent} event mouse event
|
|
14
13
|
* @returns {void}
|
|
15
14
|
*/
|
|
@@ -23,7 +22,6 @@ export class MgPopover {
|
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
24
|
* Show popover
|
|
26
|
-
*
|
|
27
25
|
* @returns {void}
|
|
28
26
|
*/
|
|
29
27
|
this.show = () => {
|
|
@@ -43,7 +41,6 @@ export class MgPopover {
|
|
|
43
41
|
};
|
|
44
42
|
/**
|
|
45
43
|
* Hide popover
|
|
46
|
-
*
|
|
47
44
|
* @returns {void}
|
|
48
45
|
*/
|
|
49
46
|
this.hide = () => {
|
|
@@ -58,7 +55,6 @@ export class MgPopover {
|
|
|
58
55
|
};
|
|
59
56
|
/**
|
|
60
57
|
* Handle action for close button
|
|
61
|
-
*
|
|
62
58
|
* @returns {void}
|
|
63
59
|
*/
|
|
64
60
|
this.handleCloseButton = () => {
|
|
@@ -92,7 +88,6 @@ export class MgPopover {
|
|
|
92
88
|
*************/
|
|
93
89
|
/**
|
|
94
90
|
* Check if component props are well configured on init
|
|
95
|
-
*
|
|
96
91
|
* @returns {void} timeout
|
|
97
92
|
*/
|
|
98
93
|
componentWillLoad() {
|
|
@@ -104,7 +99,6 @@ export class MgPopover {
|
|
|
104
99
|
}
|
|
105
100
|
/**
|
|
106
101
|
* Check if component props are well configured on init
|
|
107
|
-
*
|
|
108
102
|
* @returns {void}
|
|
109
103
|
*/
|
|
110
104
|
componentDidLoad() {
|
|
@@ -162,7 +156,6 @@ export class MgPopover {
|
|
|
162
156
|
}
|
|
163
157
|
/**
|
|
164
158
|
* Render
|
|
165
|
-
*
|
|
166
159
|
* @returns {HTMLElement} HTML Element
|
|
167
160
|
*/
|
|
168
161
|
render() {
|
|
@@ -279,7 +272,7 @@ export class MgPopover {
|
|
|
279
272
|
},
|
|
280
273
|
"disabled": {
|
|
281
274
|
"type": "boolean",
|
|
282
|
-
"mutable":
|
|
275
|
+
"mutable": false,
|
|
283
276
|
"complexType": {
|
|
284
277
|
"original": "boolean",
|
|
285
278
|
"resolved": "boolean",
|
|
@@ -8,7 +8,6 @@ export class MgSkipLinks {
|
|
|
8
8
|
**********/
|
|
9
9
|
/**
|
|
10
10
|
* Handle link click and emit go-to-anchor event
|
|
11
|
-
*
|
|
12
11
|
* @param {MouseEvent} event mouse event
|
|
13
12
|
* @returns {void}
|
|
14
13
|
*/
|
|
@@ -30,7 +29,6 @@ export class MgSkipLinks {
|
|
|
30
29
|
*************/
|
|
31
30
|
/**
|
|
32
31
|
* Check if props are well configured on init
|
|
33
|
-
*
|
|
34
32
|
* @returns {void}
|
|
35
33
|
*/
|
|
36
34
|
componentWillLoad() {
|
|
@@ -39,7 +37,6 @@ export class MgSkipLinks {
|
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
41
39
|
* Render
|
|
42
|
-
*
|
|
43
40
|
* @returns {HTMLElement} HTML Element
|
|
44
41
|
*/
|
|
45
42
|
render() {
|
|
@@ -61,7 +58,7 @@ export class MgSkipLinks {
|
|
|
61
58
|
return {
|
|
62
59
|
"links": {
|
|
63
60
|
"type": "unknown",
|
|
64
|
-
"mutable":
|
|
61
|
+
"mutable": false,
|
|
65
62
|
"complexType": {
|
|
66
63
|
"original": "SkipLink[]",
|
|
67
64
|
"resolved": "SkipLink[]",
|
|
@@ -3,7 +3,6 @@ import { createID, ClassList, allItemsAreString } from '../../../utils/component
|
|
|
3
3
|
import { sizes, Status } from './mg-tabs.conf';
|
|
4
4
|
/**
|
|
5
5
|
* type TabItem validation function
|
|
6
|
-
*
|
|
7
6
|
* @param {TabItem} tab tab item
|
|
8
7
|
* @returns {boolean} tab item type is valid
|
|
9
8
|
*/
|
|
@@ -19,7 +18,6 @@ export class MgTabs {
|
|
|
19
18
|
this.startIndex = 1;
|
|
20
19
|
/**
|
|
21
20
|
* Method to know if given tab has the given status
|
|
22
|
-
*
|
|
23
21
|
* @param {TabItem} tab item tab key to set to ACTIVE status
|
|
24
22
|
* @param {Status} status status to valide
|
|
25
23
|
* @returns {boolean} status comparaison
|
|
@@ -27,7 +25,6 @@ export class MgTabs {
|
|
|
27
25
|
this.tabHasStatus = (tab, status) => tab.status === status;
|
|
28
26
|
/**
|
|
29
27
|
* Method to get element id from index
|
|
30
|
-
*
|
|
31
28
|
* @param {string} element to get id
|
|
32
29
|
* @param {number} index to generate id
|
|
33
30
|
* @returns {string} generated element id
|
|
@@ -35,20 +32,17 @@ export class MgTabs {
|
|
|
35
32
|
this.getElementId = (element, index) => `${element}-${this.getTabItemIndex(index)}`;
|
|
36
33
|
/**
|
|
37
34
|
* Method to get tab item index
|
|
38
|
-
*
|
|
39
35
|
* @param {number} index to get
|
|
40
36
|
* @returns {number} index
|
|
41
37
|
*/
|
|
42
38
|
this.getTabItemIndex = (index) => index + this.startIndex;
|
|
43
39
|
/**
|
|
44
40
|
* Method to get the active-tab value
|
|
45
|
-
*
|
|
46
41
|
* @returns {number} of the active-tab
|
|
47
42
|
*/
|
|
48
43
|
this.getActiveTab = () => this.activeTab || this.getTabItemIndex(this.tabs.map((tab, index) => (Object.assign(Object.assign({}, tab), { index }))).find(tab => this.tabHasStatus(tab, Status.ACTIVE)).index);
|
|
49
44
|
/**
|
|
50
45
|
* Handle click events on tabs
|
|
51
|
-
*
|
|
52
46
|
* @param {MouseEvent} event mouse event
|
|
53
47
|
*/
|
|
54
48
|
this.handleClick = (event) => {
|
|
@@ -64,14 +58,12 @@ export class MgTabs {
|
|
|
64
58
|
};
|
|
65
59
|
/**
|
|
66
60
|
* get navigation button class from given status
|
|
67
|
-
*
|
|
68
61
|
* @param {Status} status button tab status
|
|
69
62
|
* @returns {string} button class/selector variant
|
|
70
63
|
*/
|
|
71
64
|
this.getNavigationButtonClass = (status) => `${this.buttonTabBaseClass}--${status}`;
|
|
72
65
|
/**
|
|
73
66
|
* Handle keyboard event on tabs
|
|
74
|
-
*
|
|
75
67
|
* @param {MouseEvent} event mouse event
|
|
76
68
|
* @returns {void}
|
|
77
69
|
*/
|
|
@@ -111,7 +103,6 @@ export class MgTabs {
|
|
|
111
103
|
};
|
|
112
104
|
/**
|
|
113
105
|
* Method to reset focus behavior
|
|
114
|
-
*
|
|
115
106
|
* @returns {void}
|
|
116
107
|
*/
|
|
117
108
|
this.resetFocus = () => {
|
|
@@ -191,7 +182,6 @@ export class MgTabs {
|
|
|
191
182
|
*************/
|
|
192
183
|
/**
|
|
193
184
|
* Check if component props are well configured on init
|
|
194
|
-
*
|
|
195
185
|
* @returns {void}
|
|
196
186
|
*/
|
|
197
187
|
componentWillLoad() {
|
|
@@ -204,7 +194,6 @@ export class MgTabs {
|
|
|
204
194
|
}
|
|
205
195
|
/**
|
|
206
196
|
* add listners
|
|
207
|
-
*
|
|
208
197
|
* @returns {void}
|
|
209
198
|
*/
|
|
210
199
|
componentDidLoad() {
|
|
@@ -215,7 +204,6 @@ export class MgTabs {
|
|
|
215
204
|
}
|
|
216
205
|
/**
|
|
217
206
|
* Render
|
|
218
|
-
*
|
|
219
207
|
* @returns {HTMLElement} HTML Element
|
|
220
208
|
*/
|
|
221
209
|
render() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MgItemMore type guard
|
|
3
|
-
*
|
|
4
3
|
* @param {HTMLElement} element element to control type
|
|
5
4
|
* @returns {boolean} truthy if element is mg-item-more
|
|
6
5
|
*/
|
|
@@ -19,7 +18,6 @@ export class OverflowBehavior {
|
|
|
19
18
|
**********/
|
|
20
19
|
/**
|
|
21
20
|
* Disconnect ResizeObserver
|
|
22
|
-
*
|
|
23
21
|
* @returns {void}
|
|
24
22
|
*/
|
|
25
23
|
this.disconnect = () => {
|
|
@@ -30,7 +28,6 @@ export class OverflowBehavior {
|
|
|
30
28
|
************/
|
|
31
29
|
/**
|
|
32
30
|
* run overflow behavior
|
|
33
|
-
*
|
|
34
31
|
* @param {number} width width of the container. Optional.
|
|
35
32
|
* @returns {void}
|
|
36
33
|
*/
|
|
@@ -55,14 +52,12 @@ export class OverflowBehavior {
|
|
|
55
52
|
};
|
|
56
53
|
/**
|
|
57
54
|
* Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
|
|
58
|
-
*
|
|
59
55
|
* @param {Element} element element to parse
|
|
60
56
|
* @returns {Element[]} children
|
|
61
57
|
*/
|
|
62
58
|
this.getInteractiveItems = (element) => { var _a; return (((_a = element.children) === null || _a === void 0 ? void 0 : _a.length) > 0 ? Array.from(element.children) : []).filter(element => ['MG-MENU-ITEM', 'MG-BUTTON'].includes(element.nodeName)); };
|
|
63
59
|
/**
|
|
64
60
|
* Update displayed items in container from a given available space
|
|
65
|
-
*
|
|
66
61
|
* @param {number} availableWidth available width in container to display child items
|
|
67
62
|
* @returns {void}
|
|
68
63
|
*/
|
|
@@ -83,7 +78,6 @@ export class OverflowBehavior {
|
|
|
83
78
|
};
|
|
84
79
|
/**
|
|
85
80
|
* Utility method to know if item overflow partialy or totaly in the container
|
|
86
|
-
*
|
|
87
81
|
* @param {number} cumulateWidth previous sibling elements cumulate width + item width
|
|
88
82
|
* @param {HTMLElement} item item HTML element
|
|
89
83
|
* @param {number} availableWidth container available width
|
|
@@ -99,14 +93,12 @@ export class OverflowBehavior {
|
|
|
99
93
|
};
|
|
100
94
|
/**
|
|
101
95
|
* Utility method to know if a given element is the 'MORE' element
|
|
102
|
-
*
|
|
103
96
|
* @param {Element} element element to match with 'MORE' element
|
|
104
97
|
* @returns {boolean} truthy if element is the 'MORE' element
|
|
105
98
|
*/
|
|
106
99
|
this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
107
100
|
/**
|
|
108
101
|
* Toggle display item element
|
|
109
|
-
*
|
|
110
102
|
* @param {HTMLElement} item item to control
|
|
111
103
|
* @param {boolean} isHidden is item hidden
|
|
112
104
|
* @returns {void}
|
|
@@ -122,7 +114,6 @@ export class OverflowBehavior {
|
|
|
122
114
|
};
|
|
123
115
|
/**
|
|
124
116
|
* Toggle element's hidde attribute
|
|
125
|
-
*
|
|
126
117
|
* @param {Element} element element to toggle
|
|
127
118
|
* @param {boolean} isHidden element is hidden
|
|
128
119
|
* @returns {void}
|
|
@@ -135,7 +126,6 @@ export class OverflowBehavior {
|
|
|
135
126
|
};
|
|
136
127
|
/**
|
|
137
128
|
* Remove hidden attributes on all items
|
|
138
|
-
*
|
|
139
129
|
* @returns {void}
|
|
140
130
|
*/
|
|
141
131
|
this.restoreItems = () => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create random ID
|
|
3
|
-
*
|
|
4
3
|
* @param {string} prefix add prefix to created ID
|
|
5
4
|
* @param {number} length ID length
|
|
6
5
|
* @returns {string} ID
|
|
@@ -22,7 +21,6 @@ export class ClassList {
|
|
|
22
21
|
constructor(classlist = []) {
|
|
23
22
|
/**
|
|
24
23
|
* Add class
|
|
25
|
-
*
|
|
26
24
|
* @param {string} className class name to add
|
|
27
25
|
* @returns {void}
|
|
28
26
|
*/
|
|
@@ -33,7 +31,6 @@ export class ClassList {
|
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
35
33
|
* Delete class
|
|
36
|
-
*
|
|
37
34
|
* @param {string} className class name to delete
|
|
38
35
|
* @returns {void}
|
|
39
36
|
*/
|
|
@@ -45,7 +42,6 @@ export class ClassList {
|
|
|
45
42
|
};
|
|
46
43
|
/**
|
|
47
44
|
* Check if class exist in list
|
|
48
|
-
*
|
|
49
45
|
* @param {string} className class name to check
|
|
50
46
|
* @returns {boolean} class name is in the list
|
|
51
47
|
*/
|
|
@@ -54,7 +50,6 @@ export class ClassList {
|
|
|
54
50
|
};
|
|
55
51
|
/**
|
|
56
52
|
* Join classes seperated by spaces
|
|
57
|
-
*
|
|
58
53
|
* @returns {string} joined values
|
|
59
54
|
*/
|
|
60
55
|
this.join = () => {
|
|
@@ -65,14 +60,12 @@ export class ClassList {
|
|
|
65
60
|
}
|
|
66
61
|
/**
|
|
67
62
|
* Check if all items are string
|
|
68
|
-
*
|
|
69
63
|
* @param {unknown} items items to check
|
|
70
64
|
* @returns {boolean} all items are string
|
|
71
65
|
*/
|
|
72
66
|
export const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
|
|
73
67
|
/**
|
|
74
68
|
* Check if element is a heading
|
|
75
|
-
*
|
|
76
69
|
* @param {Element} element slotted element
|
|
77
70
|
* @param {string[]} tagNames allowed tag names list
|
|
78
71
|
* @returns {boolean} element is a heading
|
|
@@ -85,7 +78,7 @@ export const isTagName = (element, tagNames) => {
|
|
|
85
78
|
*/
|
|
86
79
|
export const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
|
|
87
80
|
/**
|
|
88
|
-
*
|
|
81
|
+
* Get windows
|
|
89
82
|
* @param {Window} localWindow the window we are lookink for other windows
|
|
90
83
|
* @returns {Window[]} The list of windows found
|
|
91
84
|
*/
|
|
@@ -96,7 +89,6 @@ export const getWindows = (localWindow) => {
|
|
|
96
89
|
};
|
|
97
90
|
/**
|
|
98
91
|
* Get parent windows
|
|
99
|
-
*
|
|
100
92
|
* @param {Window} localWindow the window we are lookink for parents
|
|
101
93
|
* @param {Window[]} windows The list of allready found windows
|
|
102
94
|
* @returns {Window[]} The list of windows found
|
|
@@ -119,7 +111,6 @@ export const getParentWindows = (localWindow, windows = []) => {
|
|
|
119
111
|
};
|
|
120
112
|
/**
|
|
121
113
|
* Get child windows
|
|
122
|
-
*
|
|
123
114
|
* @param {Window} localWindow the window we are lookink for children
|
|
124
115
|
* @param {Window[]} windows The list of allready found windows
|
|
125
116
|
* @returns {Window[]} The list of windows found
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Format number to the locale currency
|
|
3
|
-
*
|
|
4
3
|
* @param {number} number number to format
|
|
5
4
|
* @param {string} locale locale to apply
|
|
6
5
|
* @param {string} currency currency to apply
|
|
@@ -11,7 +10,6 @@ export const localeCurrency = (number, locale, currency) => {
|
|
|
11
10
|
};
|
|
12
11
|
/**
|
|
13
12
|
* Format number to locale
|
|
14
|
-
*
|
|
15
13
|
* @param {number} number number to format
|
|
16
14
|
* @param {string} locale locale to apply
|
|
17
15
|
* @returns {string} formatted number
|
|
@@ -25,7 +23,6 @@ export const localeNumber = (number, locale) => {
|
|
|
25
23
|
export const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
26
24
|
/**
|
|
27
25
|
* Locale date format
|
|
28
|
-
*
|
|
29
26
|
* @param {string} date date to format
|
|
30
27
|
* @param {string} locale locale to apply
|
|
31
28
|
* @returns {string} formatted date
|
|
@@ -39,7 +36,6 @@ export const localeDate = (date, locale) => {
|
|
|
39
36
|
/**
|
|
40
37
|
* Get locale and messages
|
|
41
38
|
* We load the defined locale but for now we only support the first subtag for messages
|
|
42
|
-
*
|
|
43
39
|
* @param {HTMLElement} element element we need to get the language
|
|
44
40
|
* @param {unknown} messages messages to use
|
|
45
41
|
* @param {string} defaultLocale default messages locale
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MockCustomEvent } from '@stencil/core/mock-doc';
|
|
2
2
|
/**
|
|
3
3
|
* Clone Deep function
|
|
4
|
-
*
|
|
5
4
|
* @param {unknown} obj object to clone
|
|
6
5
|
* @returns {unknown} cloned json
|
|
7
6
|
*/
|
|
@@ -43,7 +42,6 @@ export const setupResizeObserverMock = ({ disconnect, observe }) => {
|
|
|
43
42
|
};
|
|
44
43
|
/**
|
|
45
44
|
* Utility function that mocks the `SubmitEvent` API. Recommended to execute inside `beforeEach`.
|
|
46
|
-
*
|
|
47
45
|
* @returns {void}
|
|
48
46
|
* @example
|
|
49
47
|
* ```
|
|
@@ -67,7 +65,6 @@ export const setupSubmitEventMock = () => {
|
|
|
67
65
|
};
|
|
68
66
|
/**
|
|
69
67
|
* force popover id when component use randomed identifier
|
|
70
|
-
*
|
|
71
68
|
* @param {Element} component element wich include mg-popover
|
|
72
69
|
* @param {string} id new fixed id
|
|
73
70
|
* @param {string} interactiveElement element where attribute 'aria-controls' is set
|
|
@@ -86,7 +83,6 @@ export const forcePopoverId = (component, id, interactiveElement = 'button') =>
|
|
|
86
83
|
* this is due to internal function isHTMLElement(), so we can not mock it directly.
|
|
87
84
|
* this function check if test DOM element mockHTMLElement instance is 'instanceof HTMLElement'
|
|
88
85
|
* so we only override the console.error side effect for this error
|
|
89
|
-
*
|
|
90
86
|
* @returns {void}
|
|
91
87
|
*/
|
|
92
88
|
export const mockConsoleError = () => {
|
|
@@ -99,7 +95,6 @@ export const mockConsoleError = () => {
|
|
|
99
95
|
/**
|
|
100
96
|
* Add missing window.frames property to test context
|
|
101
97
|
* usefull for component with iframe listeners, ex: mg-popover
|
|
102
|
-
*
|
|
103
98
|
* @returns {void}
|
|
104
99
|
*/
|
|
105
100
|
export const mockWindowFrames = () => {
|
|
@@ -98,6 +98,9 @@
|
|
|
98
98
|
/* Shadow */
|
|
99
99
|
--box-shadow: 0 0.3rem 0.8rem 0 hsl(var(--color-dark), 0.15);
|
|
100
100
|
|
|
101
|
+
/* Soft style */
|
|
102
|
+
--mg-color-soft-l: 90%;
|
|
103
|
+
|
|
101
104
|
/*
|
|
102
105
|
Global
|
|
103
106
|
*/
|
|
@@ -109,8 +112,10 @@
|
|
|
109
112
|
*/
|
|
110
113
|
--mg-icon-small-size: 1.2rem;
|
|
111
114
|
--mg-icon-regular-size: 1.6rem;
|
|
115
|
+
--mg-icon-medium-size: 2rem;
|
|
112
116
|
--mg-icon-large-size: 2.4rem;
|
|
113
|
-
--mg-icon-extra-large-size: 3.
|
|
117
|
+
--mg-icon-extra-large-size: 3.2rem;
|
|
118
|
+
--mg-icon-border-radius: 50%;
|
|
114
119
|
|
|
115
120
|
/*
|
|
116
121
|
<mg-button>
|
|
@@ -160,6 +165,7 @@
|
|
|
160
165
|
--mg-popover-background-color: var(--color-light);
|
|
161
166
|
--mg-popover-font-color: var(--color-font-dark);
|
|
162
167
|
--mg-popover-title-font-size: 1.4rem;
|
|
168
|
+
--mg-popover-max-width: 40rem;
|
|
163
169
|
|
|
164
170
|
/*
|
|
165
171
|
<mg-message>
|
|
@@ -2,7 +2,6 @@ import { h } from '@stencil/core/internal/client';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Apply in all input child node the aria-describedby attribute
|
|
5
|
-
*
|
|
6
5
|
* @param {VNode[]} children Represent scoped elements
|
|
7
6
|
* @param {Set<string>} ariaDescribedbyIDs List of IDs
|
|
8
7
|
* @param {FunctionalUtilities} utils Stencil.js utils
|
|
@@ -19,7 +18,6 @@ const applyAriadescribedBy = (children, ariaDescribedbyIDs, utils) => utils.map(
|
|
|
19
18
|
});
|
|
20
19
|
/**
|
|
21
20
|
* Add classes based on props
|
|
22
|
-
*
|
|
23
21
|
* @param {MgInputProps} props MgInput Interface Props
|
|
24
22
|
*/
|
|
25
23
|
const manageClasses = (props) => {
|
|
@@ -33,14 +31,12 @@ const manageClasses = (props) => {
|
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
35
33
|
* Get tagname
|
|
36
|
-
*
|
|
37
34
|
* @param {boolean} isFieldset is fieldset
|
|
38
35
|
* @returns {string} tag name
|
|
39
36
|
*/
|
|
40
37
|
const getTagName = (isFieldset) => (isFieldset ? 'fieldset' : 'div');
|
|
41
38
|
/**
|
|
42
39
|
* Get input template
|
|
43
|
-
*
|
|
44
40
|
* @param {MgInputProps} props MgInput Interface Props
|
|
45
41
|
* @param {VNode[]} children Represent scoped elements
|
|
46
42
|
* @param {FunctionalUtilities} utils Stencil.js utils
|
|
@@ -100,7 +96,6 @@ const MgInput = (props, children, utils) => {
|
|
|
100
96
|
const TagName = getTagName(props.isFieldset);
|
|
101
97
|
/**
|
|
102
98
|
* Get tooltip node
|
|
103
|
-
*
|
|
104
99
|
* @returns {VNode[]} mg-tooltip
|
|
105
100
|
*/
|
|
106
101
|
const getTooltip = () => (h("mg-tooltip", { identifier: `${props.identifier}-tooltip`, message: props.tooltip },
|
|
@@ -108,7 +103,6 @@ const MgInput = (props, children, utils) => {
|
|
|
108
103
|
/**
|
|
109
104
|
* Get input title (label) node
|
|
110
105
|
* Display asterisk only if not disabled and not readonly
|
|
111
|
-
*
|
|
112
106
|
* @returns {VNode[]} mg-input-title
|
|
113
107
|
*/
|
|
114
108
|
const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
|