@mgdis/mg-components 5.10.0 → 5.10.1
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 +318 -427
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +19 -28
- package/dist/cjs/{mg-menu.conf-1942ac70.js → mg-menu.conf-196151fe.js} +16 -16
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +8 -9
- package/dist/collection/components/atoms/mg-button/mg-button.js +16 -20
- package/dist/collection/components/atoms/mg-card/mg-card.js +10 -12
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -19
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -13
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +11 -21
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +26 -18
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +10 -14
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -12
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -22
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -18
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -32
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +16 -31
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +13 -17
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -23
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -18
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -29
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -15
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -19
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -2
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -7
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -14
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -11
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -13
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +6 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -13
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -24
- package/dist/collection/locales/index.js +2 -2
- package/dist/collection/utils/behaviors.utils.js +16 -22
- package/dist/collection/utils/components.utils.js +21 -23
- package/dist/collection/utils/locale.utils.js +14 -14
- package/dist/collection/utils/unit.test.utils.js +7 -10
- package/dist/components/MgInput.js +30 -18
- package/dist/components/components.utils.js +21 -23
- package/dist/components/index2.js +16 -16
- package/dist/components/mg-action-more.js +9 -13
- package/dist/components/mg-badge2.js +8 -9
- package/dist/components/mg-button2.js +16 -20
- package/dist/components/mg-card2.js +8 -10
- package/dist/components/mg-character-left2.js +1 -2
- package/dist/components/mg-details.js +1 -3
- package/dist/components/mg-divider.js +1 -1
- package/dist/components/mg-form.js +7 -15
- package/dist/components/mg-icon2.js +17 -19
- package/dist/components/mg-illustrated-message.js +1 -2
- package/dist/components/mg-input-checkbox.js +9 -10
- package/dist/components/mg-input-date.js +6 -8
- package/dist/components/mg-input-numeric.js +13 -18
- package/dist/components/mg-input-password.js +5 -6
- package/dist/components/mg-input-radio.js +9 -14
- package/dist/components/mg-input-select2.js +20 -28
- package/dist/components/mg-input-text2.js +14 -23
- package/dist/components/mg-input-textarea.js +12 -13
- package/dist/components/mg-input-title2.js +1 -2
- package/dist/components/mg-input-toggle.js +16 -19
- package/dist/components/mg-item-more.js +18 -27
- package/dist/components/mg-menu-item2.js +17 -26
- package/dist/components/mg-menu2.js +9 -16
- package/dist/components/mg-message.js +11 -14
- package/dist/components/mg-modal.js +7 -11
- package/dist/components/mg-pagination.js +11 -13
- package/dist/components/mg-panel.js +6 -15
- package/dist/components/mg-popover2.js +7 -13
- package/dist/components/mg-skip-links.js +2 -4
- package/dist/components/mg-tabs.js +20 -24
- package/dist/components/mg-tag.js +11 -13
- package/dist/components/mg-tooltip2.js +11 -21
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +318 -427
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +19 -28
- package/dist/esm/{mg-menu.conf-2cc1bb67.js → mg-menu.conf-9ca023ee.js} +16 -16
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-a56a3157.entry.js → p-97aaca3e.entry.js} +1 -1
- package/dist/mg-components/p-d891e707.entry.js +1 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -3
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -9
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +2 -6
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -2
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -5
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -5
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -21
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -5
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -6
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -6
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -14
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -4
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -10
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +9 -13
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -12
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -5
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -6
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -18
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -31
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -10
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -3
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -11
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -2
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -7
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -7
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -7
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -9
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -13
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -9
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -4
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -19
- package/dist/types/components.d.ts +22 -34
- package/dist/types/locales/index.d.ts +2 -2
- package/dist/types/utils/behaviors.utils.d.ts +14 -20
- package/dist/types/utils/components.utils.d.ts +18 -20
- package/dist/types/utils/locale.utils.d.ts +14 -14
- package/dist/types/utils/unit.test.utils.d.ts +11 -17
- package/package.json +1 -1
- package/dist/mg-components/p-eb32bb18.entry.js +0 -1
- /package/dist/mg-components/{p-73156ac9.js → p-0d3146d9.js} +0 -0
|
@@ -27,7 +27,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
27
27
|
this.hasDisplayedError = false;
|
|
28
28
|
/**
|
|
29
29
|
* Handle input event
|
|
30
|
-
* @returns {void}
|
|
31
30
|
*/
|
|
32
31
|
this.handleInput = () => {
|
|
33
32
|
this.checkValidity();
|
|
@@ -38,26 +37,23 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
38
37
|
};
|
|
39
38
|
/**
|
|
40
39
|
* Handle focus event
|
|
41
|
-
* @returns {void}
|
|
42
40
|
*/
|
|
43
41
|
this.handleFocus = () => {
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
42
|
+
this.classCollection.add(this.classFocus);
|
|
43
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
46
44
|
};
|
|
47
45
|
/**
|
|
48
46
|
* Handle blur event
|
|
49
|
-
* @returns {void}
|
|
50
47
|
*/
|
|
51
48
|
this.handleBlur = () => {
|
|
52
49
|
// Manage focus
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
50
|
+
this.classCollection.delete(this.classFocus);
|
|
51
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
55
52
|
// Display Error
|
|
56
53
|
this.displayError();
|
|
57
54
|
};
|
|
58
55
|
/**
|
|
59
56
|
* Check if input is valid
|
|
60
|
-
* @returns {void}
|
|
61
57
|
*/
|
|
62
58
|
this.checkValidity = () => {
|
|
63
59
|
var _a;
|
|
@@ -68,7 +64,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
68
64
|
};
|
|
69
65
|
/**
|
|
70
66
|
* Set input error message
|
|
71
|
-
* @returns {void}
|
|
72
67
|
*/
|
|
73
68
|
this.setErrorMessage = () => {
|
|
74
69
|
// Set error message
|
|
@@ -84,7 +79,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
84
79
|
};
|
|
85
80
|
/**
|
|
86
81
|
* Validate pattern configuration
|
|
87
|
-
* @returns {void}
|
|
88
82
|
*/
|
|
89
83
|
this.validatePattern = () => {
|
|
90
84
|
if (this.pattern !== undefined &&
|
|
@@ -96,16 +90,15 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
96
90
|
};
|
|
97
91
|
/**
|
|
98
92
|
* Validate append slot
|
|
99
|
-
* @returns {void}
|
|
100
93
|
*/
|
|
101
94
|
this.validateAppendSlot = () => {
|
|
102
95
|
const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
|
|
103
96
|
if (slotAppendInput.length === 1) {
|
|
104
|
-
this.
|
|
97
|
+
this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-input--is-append-input-slot-content');
|
|
105
98
|
}
|
|
106
99
|
else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
100
|
+
this.classCollection.add(this.classIsInputGroupAppend);
|
|
101
|
+
this.classCollection.add('mg-input--has-buttons-group-append');
|
|
109
102
|
}
|
|
110
103
|
};
|
|
111
104
|
this.value = undefined;
|
|
@@ -129,7 +122,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
129
122
|
this.helpText = undefined;
|
|
130
123
|
this.valid = undefined;
|
|
131
124
|
this.invalid = undefined;
|
|
132
|
-
this.
|
|
125
|
+
this.classCollection = new ClassList(['mg-input--text']);
|
|
133
126
|
this.errorMessage = undefined;
|
|
134
127
|
}
|
|
135
128
|
handleValue(newValue) {
|
|
@@ -137,10 +130,10 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
137
130
|
}
|
|
138
131
|
validateIcon(newValue) {
|
|
139
132
|
if (newValue !== undefined) {
|
|
140
|
-
this.
|
|
133
|
+
this.classCollection.add(this.classHasIcon);
|
|
141
134
|
}
|
|
142
135
|
else {
|
|
143
|
-
this.
|
|
136
|
+
this.classCollection.delete(this.classHasIcon);
|
|
144
137
|
}
|
|
145
138
|
}
|
|
146
139
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -155,14 +148,12 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
155
148
|
}
|
|
156
149
|
/**
|
|
157
150
|
* Public method to play input focus
|
|
158
|
-
* @returns {Promise<void>}
|
|
159
151
|
*/
|
|
160
152
|
async setFocus() {
|
|
161
153
|
this.input.focus();
|
|
162
154
|
}
|
|
163
155
|
/**
|
|
164
156
|
* Public method to display errors
|
|
165
|
-
* @returns {Promise<void>}
|
|
166
157
|
*/
|
|
167
158
|
async displayError() {
|
|
168
159
|
this.checkValidity();
|
|
@@ -174,7 +165,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
174
165
|
*************/
|
|
175
166
|
/**
|
|
176
167
|
* Check if component props are well configured on init
|
|
177
|
-
* @returns
|
|
168
|
+
* @returns timeout
|
|
178
169
|
*/
|
|
179
170
|
componentWillLoad() {
|
|
180
171
|
// Get locales
|
|
@@ -193,10 +184,10 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
193
184
|
}
|
|
194
185
|
/**
|
|
195
186
|
* Render
|
|
196
|
-
* @returns
|
|
187
|
+
* @returns HTML Element
|
|
197
188
|
*/
|
|
198
189
|
render() {
|
|
199
|
-
return (h(MgInput, { identifier: this.identifier,
|
|
190
|
+
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left", style: {
|
|
200
191
|
'--mg-character-left-message-length': (this.displayCharacterLeft
|
|
201
192
|
? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
|
|
202
193
|
: 0).toString(),
|
|
@@ -236,7 +227,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
236
227
|
"helpText": [1, "help-text"],
|
|
237
228
|
"valid": [1028],
|
|
238
229
|
"invalid": [1028],
|
|
239
|
-
"
|
|
230
|
+
"classCollection": [32],
|
|
240
231
|
"errorMessage": [32],
|
|
241
232
|
"setFocus": [64],
|
|
242
233
|
"displayError": [64]
|
|
@@ -38,23 +38,23 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
38
38
|
* Handle focus event
|
|
39
39
|
*/
|
|
40
40
|
this.handleFocus = () => {
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
41
|
+
this.classCollection.add(this.classFocus);
|
|
42
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
45
|
* Handle blur event
|
|
46
46
|
*/
|
|
47
47
|
this.handleBlur = () => {
|
|
48
48
|
// Manage focus
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
49
|
+
this.classCollection.delete(this.classFocus);
|
|
50
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
51
51
|
// Display Error
|
|
52
52
|
this.displayError();
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
55
|
* Get pattern validity
|
|
56
56
|
* Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea
|
|
57
|
-
* @returns
|
|
57
|
+
* @returns is pattern valid
|
|
58
58
|
*/
|
|
59
59
|
this.getPatternValidity = () => this.pattern === undefined || new RegExp(`^${this.pattern}$`, 'u').test(this.value);
|
|
60
60
|
/**
|
|
@@ -114,7 +114,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
114
114
|
this.valid = undefined;
|
|
115
115
|
this.invalid = undefined;
|
|
116
116
|
this.resizable = 'none';
|
|
117
|
-
this.
|
|
117
|
+
this.classCollection = new ClassList(['mg-input--textarea']);
|
|
118
118
|
this.errorMessage = undefined;
|
|
119
119
|
}
|
|
120
120
|
handleValue(newValue) {
|
|
@@ -133,15 +133,14 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
133
133
|
}
|
|
134
134
|
validateDisplayCharacterLeft(newValue) {
|
|
135
135
|
if (newValue) {
|
|
136
|
-
this.
|
|
136
|
+
this.classCollection.add(this.classHasDisplayCharacterLeft);
|
|
137
137
|
}
|
|
138
138
|
else {
|
|
139
|
-
this.
|
|
139
|
+
this.classCollection.delete(this.classHasDisplayCharacterLeft);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
143
|
* Public method to display errors
|
|
144
|
-
* @returns {Promise<void>}
|
|
145
144
|
*/
|
|
146
145
|
async displayError() {
|
|
147
146
|
this.checkValidity();
|
|
@@ -153,7 +152,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
153
152
|
*************/
|
|
154
153
|
/**
|
|
155
154
|
* Check if component props are well configured on init
|
|
156
|
-
* @returns
|
|
155
|
+
* @returns timeout
|
|
157
156
|
*/
|
|
158
157
|
componentWillLoad() {
|
|
159
158
|
// Get locales
|
|
@@ -171,10 +170,10 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
171
170
|
}
|
|
172
171
|
/**
|
|
173
172
|
* Render
|
|
174
|
-
* @returns
|
|
173
|
+
* @returns HTML Element
|
|
175
174
|
*/
|
|
176
175
|
render() {
|
|
177
|
-
return (h(MgInput, { identifier: this.identifier,
|
|
176
|
+
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left" }, h("textarea", { class: {
|
|
178
177
|
'mg-input__box': true,
|
|
179
178
|
'mg-input__box--resizable': this.resizable === 'both',
|
|
180
179
|
'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',
|
|
@@ -215,7 +214,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
215
214
|
"valid": [1028],
|
|
216
215
|
"invalid": [1028],
|
|
217
216
|
"resizable": [1],
|
|
218
|
-
"
|
|
217
|
+
"classCollection": [32],
|
|
219
218
|
"errorMessage": [32],
|
|
220
219
|
"displayError": [64]
|
|
221
220
|
}]);
|
|
@@ -24,7 +24,6 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
24
24
|
*************/
|
|
25
25
|
/**
|
|
26
26
|
* Init tag name
|
|
27
|
-
* @returns {void}
|
|
28
27
|
*/
|
|
29
28
|
componentWillLoad() {
|
|
30
29
|
this.validateIdentifier(this.identifier);
|
|
@@ -32,7 +31,7 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
33
|
* Render
|
|
35
|
-
* @returns
|
|
34
|
+
* @returns HTML element
|
|
36
35
|
*/
|
|
37
36
|
render() {
|
|
38
37
|
const TagName = this.tagName;
|
|
@@ -9,8 +9,8 @@ const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* type Option validation function
|
|
12
|
-
* @param
|
|
13
|
-
* @returns
|
|
12
|
+
* @param option - radio option
|
|
13
|
+
* @returns toggle option type is valid
|
|
14
14
|
*/
|
|
15
15
|
const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
|
|
16
16
|
const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -31,14 +31,12 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
31
31
|
this.classIcon = 'mg-input--toggle-icon';
|
|
32
32
|
/**
|
|
33
33
|
* Change checked value
|
|
34
|
-
* @returns {void}
|
|
35
34
|
*/
|
|
36
35
|
this.toggleChecked = () => {
|
|
37
36
|
this.checked = !this.checked;
|
|
38
37
|
};
|
|
39
38
|
/**
|
|
40
39
|
* Slots validation
|
|
41
|
-
* @returns {void}
|
|
42
40
|
*/
|
|
43
41
|
this.validateSlots = () => {
|
|
44
42
|
const slots = Array.from(this.element.children);
|
|
@@ -64,7 +62,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
64
62
|
this.disabled = false;
|
|
65
63
|
this.tooltip = undefined;
|
|
66
64
|
this.helpText = undefined;
|
|
67
|
-
this.
|
|
65
|
+
this.classCollection = new ClassList(['mg-input--toggle']);
|
|
68
66
|
this.options = undefined;
|
|
69
67
|
this.checked = false;
|
|
70
68
|
}
|
|
@@ -92,40 +90,39 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
92
90
|
}
|
|
93
91
|
handleIsOnOff(newValue) {
|
|
94
92
|
if (newValue)
|
|
95
|
-
this.
|
|
93
|
+
this.classCollection.add(this.classOnOff);
|
|
96
94
|
else
|
|
97
|
-
this.
|
|
95
|
+
this.classCollection.delete(this.classOnOff);
|
|
98
96
|
}
|
|
99
97
|
handleIsIcon(newValue) {
|
|
100
98
|
if (newValue)
|
|
101
|
-
this.
|
|
99
|
+
this.classCollection.add(this.classIcon);
|
|
102
100
|
else
|
|
103
|
-
this.
|
|
101
|
+
this.classCollection.delete(this.classIcon);
|
|
104
102
|
}
|
|
105
103
|
handleReadonly(newValue) {
|
|
106
104
|
if (newValue)
|
|
107
|
-
this.
|
|
105
|
+
this.classCollection.add(this.classReadonly);
|
|
108
106
|
else
|
|
109
|
-
this.
|
|
107
|
+
this.classCollection.delete(this.classReadonly);
|
|
110
108
|
}
|
|
111
109
|
handleDisabled(newValue) {
|
|
112
110
|
if (newValue)
|
|
113
|
-
this.
|
|
111
|
+
this.classCollection.add(this.classDisabled);
|
|
114
112
|
else
|
|
115
|
-
this.
|
|
113
|
+
this.classCollection.delete(this.classDisabled);
|
|
116
114
|
}
|
|
117
115
|
handleChecked(newValue) {
|
|
118
116
|
// style
|
|
119
117
|
if (newValue)
|
|
120
|
-
this.
|
|
118
|
+
this.classCollection.add(this.classIsActive);
|
|
121
119
|
else
|
|
122
|
-
this.
|
|
120
|
+
this.classCollection.delete(this.classIsActive);
|
|
123
121
|
// update value
|
|
124
122
|
this.value = this.options[newValue ? 1 : 0].value;
|
|
125
123
|
}
|
|
126
124
|
/**
|
|
127
125
|
* set checked state
|
|
128
|
-
* @returns {void}
|
|
129
126
|
*/
|
|
130
127
|
setChecked() {
|
|
131
128
|
const optionTrueValueIndex = this.options.map(option => option.value).findIndex(value => value === true);
|
|
@@ -167,10 +164,10 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
167
164
|
}
|
|
168
165
|
/**
|
|
169
166
|
* Render
|
|
170
|
-
* @returns
|
|
167
|
+
* @returns HTML Element
|
|
171
168
|
*/
|
|
172
169
|
render() {
|
|
173
|
-
return (h(MgInput, { identifier: this.identifier,
|
|
170
|
+
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
|
|
174
171
|
}
|
|
175
172
|
get element() { return this; }
|
|
176
173
|
static get watchers() { return {
|
|
@@ -197,7 +194,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
197
194
|
"disabled": [4],
|
|
198
195
|
"tooltip": [1],
|
|
199
196
|
"helpText": [1, "help-text"],
|
|
200
|
-
"
|
|
197
|
+
"classCollection": [32],
|
|
201
198
|
"options": [32],
|
|
202
199
|
"checked": [32]
|
|
203
200
|
}]);
|
|
@@ -11,8 +11,8 @@ import { d as defineCustomElement$2 } from './mg-popover2.js';
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* MgItemMore type guard
|
|
14
|
-
* @param
|
|
15
|
-
* @returns
|
|
14
|
+
* @param element - element to control type
|
|
15
|
+
* @returns truthy if element is mg-item-more
|
|
16
16
|
*/
|
|
17
17
|
const isMgItemMore = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
18
18
|
var OverflowBehaviorElements;
|
|
@@ -29,7 +29,6 @@ class OverflowBehavior {
|
|
|
29
29
|
**********/
|
|
30
30
|
/**
|
|
31
31
|
* Disconnect ResizeObserver
|
|
32
|
-
* @returns {void}
|
|
33
32
|
*/
|
|
34
33
|
this.disconnect = () => {
|
|
35
34
|
this._resizeObserver.disconnect();
|
|
@@ -39,8 +38,7 @@ class OverflowBehavior {
|
|
|
39
38
|
************/
|
|
40
39
|
/**
|
|
41
40
|
* run overflow behavior
|
|
42
|
-
* @param
|
|
43
|
-
* @returns {void}
|
|
41
|
+
* @param width - width of the container. Optional.
|
|
44
42
|
*/
|
|
45
43
|
this.run = (width) => {
|
|
46
44
|
if (this._moreElement === undefined) {
|
|
@@ -63,14 +61,13 @@ class OverflowBehavior {
|
|
|
63
61
|
};
|
|
64
62
|
/**
|
|
65
63
|
* Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
|
|
66
|
-
* @param
|
|
67
|
-
* @returns
|
|
64
|
+
* @param element - element to parse
|
|
65
|
+
* @returns children
|
|
68
66
|
*/
|
|
69
67
|
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)); };
|
|
70
68
|
/**
|
|
71
69
|
* Update displayed items in container from a given available space
|
|
72
|
-
* @param
|
|
73
|
-
* @returns {void}
|
|
70
|
+
* @param availableWidth - available width in container to display child items
|
|
74
71
|
*/
|
|
75
72
|
this.updateDisplayedItems = (availableWidth) => {
|
|
76
73
|
this.restoreItems();
|
|
@@ -89,10 +86,10 @@ class OverflowBehavior {
|
|
|
89
86
|
};
|
|
90
87
|
/**
|
|
91
88
|
* Utility method to know if item overflow partialy or totaly in the container
|
|
92
|
-
* @param
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
95
|
-
* @returns
|
|
89
|
+
* @param cumulateWidth - previous sibling elements cumulate width + item width
|
|
90
|
+
* @param item - item HTML element
|
|
91
|
+
* @param availableWidth - container available width
|
|
92
|
+
* @returns truthy if element is overflow
|
|
96
93
|
*/
|
|
97
94
|
this.isOverflowElement = (cumulateWidth, item, availableWidth) => {
|
|
98
95
|
if (item.previousElementSibling === null || this.isMoreElement(item))
|
|
@@ -104,15 +101,14 @@ class OverflowBehavior {
|
|
|
104
101
|
};
|
|
105
102
|
/**
|
|
106
103
|
* Utility method to know if a given element is the 'MORE' element
|
|
107
|
-
* @param
|
|
108
|
-
* @returns
|
|
104
|
+
* @param element - element to match with 'MORE' element
|
|
105
|
+
* @returns truthy if element is the 'MORE' element
|
|
109
106
|
*/
|
|
110
107
|
this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
111
108
|
/**
|
|
112
109
|
* Toggle display item element
|
|
113
|
-
* @param
|
|
114
|
-
* @param
|
|
115
|
-
* @returns {void}
|
|
110
|
+
* @param item - item to control
|
|
111
|
+
* @param isHidden - is item hidden
|
|
116
112
|
*/
|
|
117
113
|
this.toggleItem = (item, isHidden) => {
|
|
118
114
|
const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
|
|
@@ -125,9 +121,8 @@ class OverflowBehavior {
|
|
|
125
121
|
};
|
|
126
122
|
/**
|
|
127
123
|
* Toggle element's hidde attribute
|
|
128
|
-
* @param
|
|
129
|
-
* @param
|
|
130
|
-
* @returns {void}
|
|
124
|
+
* @param element - element to toggle
|
|
125
|
+
* @param isHidden - element is hidden
|
|
131
126
|
*/
|
|
132
127
|
this.toggleElement = (element, isHidden) => {
|
|
133
128
|
if (isHidden)
|
|
@@ -137,7 +132,6 @@ class OverflowBehavior {
|
|
|
137
132
|
};
|
|
138
133
|
/**
|
|
139
134
|
* Remove hidden attributes on all items
|
|
140
|
-
* @returns {void}
|
|
141
135
|
*/
|
|
142
136
|
this.restoreItems = () => {
|
|
143
137
|
[...this._baseChildren, this._moreElement].forEach(item => item.removeAttribute('hidden'));
|
|
@@ -171,7 +165,7 @@ const MgItemMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
171
165
|
***********/
|
|
172
166
|
/**
|
|
173
167
|
* render mg-item-more overflow element
|
|
174
|
-
* @returns
|
|
168
|
+
* @returns mg-item-more element
|
|
175
169
|
*/
|
|
176
170
|
this.renderMgMenuItemOverflowElement = () => {
|
|
177
171
|
// create menu items proxy element from item clones
|
|
@@ -220,14 +214,12 @@ const MgItemMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
220
214
|
*************/
|
|
221
215
|
/**
|
|
222
216
|
* Disconnect overflow ResizeObserver
|
|
223
|
-
* @returns {void} run overflow resize obeserver disconnexion
|
|
224
217
|
*/
|
|
225
218
|
disconnectedCallback() {
|
|
226
219
|
this.overflowBehavior.disconnect();
|
|
227
220
|
}
|
|
228
221
|
/**
|
|
229
222
|
* Set variables and validate props
|
|
230
|
-
* @returns {void}
|
|
231
223
|
*/
|
|
232
224
|
componentWillLoad() {
|
|
233
225
|
// init variables
|
|
@@ -241,14 +233,13 @@ const MgItemMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
241
233
|
}
|
|
242
234
|
/**
|
|
243
235
|
* Add overflow behavior
|
|
244
|
-
* @returns {void}
|
|
245
236
|
*/
|
|
246
237
|
componentDidLoad() {
|
|
247
238
|
this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
|
|
248
239
|
}
|
|
249
240
|
/**
|
|
250
241
|
* Render
|
|
251
|
-
* @returns
|
|
242
|
+
* @returns HTML Element
|
|
252
243
|
*/
|
|
253
244
|
render() {
|
|
254
245
|
return (h(Host, { role: "menuitem", "aria-haspopup": "true" }, h("mg-menu-item", { "data-overflow-more": true, "data-size": this.parentMenu.size }, h("mg-icon", { icon: this.icon.icon, slot: "image" }), h("span", { class: { 'sr-only': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.moreLabel, size: this.size }))));
|
|
@@ -46,29 +46,27 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
46
46
|
**********/
|
|
47
47
|
/**
|
|
48
48
|
* Toggle expanded prop value
|
|
49
|
-
* @returns {void}
|
|
50
49
|
*/
|
|
51
50
|
this.toggleExpanded = () => {
|
|
52
51
|
this.expanded = !this.expanded;
|
|
53
52
|
};
|
|
54
53
|
/**
|
|
55
54
|
* Does an Element have given Status
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @returns
|
|
55
|
+
* @param mgMenuItemElement - to parse
|
|
56
|
+
* @param status - to check
|
|
57
|
+
* @returns true if element with status is found
|
|
59
58
|
*/
|
|
60
59
|
this.hasStatus = (mgMenuItemElement, status) => mgMenuItemElement.status === status;
|
|
61
60
|
/**
|
|
62
61
|
* Is component contextual direction match the given direction
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
65
|
-
* @returns
|
|
62
|
+
* @param direction - in parent menu
|
|
63
|
+
* @param compareWith - direction to compare with. Default: `this.direction`
|
|
64
|
+
* @returns true is direction match the direction propertie
|
|
66
65
|
*/
|
|
67
66
|
this.isDirection = (direction, compareWith = this.direction) => direction === compareWith;
|
|
68
67
|
/**
|
|
69
68
|
* Update displayNotificationBadge
|
|
70
69
|
* current component notification badge have priority over the slot badge when submenu contain badge
|
|
71
|
-
* @returns {void} update displayNotificationBadge value
|
|
72
70
|
*/
|
|
73
71
|
this.updateDisplayNotificationBadge = () => {
|
|
74
72
|
const childMenu = this.element.querySelector('mg-menu');
|
|
@@ -78,7 +76,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
78
76
|
};
|
|
79
77
|
/**
|
|
80
78
|
* Method to control if one of component children have active status
|
|
81
|
-
* @returns
|
|
79
|
+
* @returns truthy if component has active child
|
|
82
80
|
*/
|
|
83
81
|
this.hasActiveChild = () => {
|
|
84
82
|
var _a;
|
|
@@ -86,8 +84,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
86
84
|
};
|
|
87
85
|
/**
|
|
88
86
|
* Validate slots
|
|
89
|
-
* @param
|
|
90
|
-
* @returns {void}
|
|
87
|
+
* @param guard - prevent action whith guard. Default: false.
|
|
91
88
|
*/
|
|
92
89
|
this.validateSlot = (guard = false) => {
|
|
93
90
|
// slot title AND metadata validation
|
|
@@ -105,8 +102,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
105
102
|
};
|
|
106
103
|
/**
|
|
107
104
|
* Update status
|
|
108
|
-
* @param
|
|
109
|
-
* @returns {void}
|
|
105
|
+
* @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
|
|
110
106
|
*/
|
|
111
107
|
this.updateStatus = (guard = []) => {
|
|
112
108
|
if (![Status.HIDDEN, Status.DISABLED, ...guard].includes(this.status)) {
|
|
@@ -115,7 +111,6 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
115
111
|
};
|
|
116
112
|
/**
|
|
117
113
|
* Init event-listeners
|
|
118
|
-
* @returns {void}
|
|
119
114
|
*/
|
|
120
115
|
this.initListeners = () => {
|
|
121
116
|
var _a;
|
|
@@ -131,12 +126,12 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
131
126
|
};
|
|
132
127
|
/**
|
|
133
128
|
* Get mg-popover identifier
|
|
134
|
-
* @returns
|
|
129
|
+
* @returns generated mg-popover identifier
|
|
135
130
|
*/
|
|
136
131
|
this.getPopoverIdentifier = () => `${this.identifier}-popover`;
|
|
137
132
|
/**
|
|
138
133
|
* Condition to know if component should display a mg-popover
|
|
139
|
-
* @returns
|
|
134
|
+
* @returns truthy if component display popover
|
|
140
135
|
*/
|
|
141
136
|
this.displayPopover = () => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
|
|
142
137
|
/************
|
|
@@ -144,8 +139,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
144
139
|
************/
|
|
145
140
|
/**
|
|
146
141
|
* Handle interacrtive element click
|
|
147
|
-
* @param
|
|
148
|
-
* @returns {void}
|
|
142
|
+
* @param event - click on element
|
|
149
143
|
*/
|
|
150
144
|
this.handleElementCLick = (event) => {
|
|
151
145
|
if ((this.hasChildren && !this.isInMainMenu) || this.status === Status.DISABLED) {
|
|
@@ -158,15 +152,14 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
158
152
|
};
|
|
159
153
|
/**
|
|
160
154
|
* Handle popover element display-change event
|
|
161
|
-
* @param
|
|
162
|
-
* @returns {void}
|
|
155
|
+
* @param event - popover display event
|
|
163
156
|
*/
|
|
164
157
|
this.handlePopoverDisplay = (event) => {
|
|
165
158
|
this.expanded = event.detail;
|
|
166
159
|
};
|
|
167
160
|
/**
|
|
168
161
|
* Render slot
|
|
169
|
-
* @returns
|
|
162
|
+
* @returns HTML Element
|
|
170
163
|
*/
|
|
171
164
|
this.renderSlot = () => h("slot", null);
|
|
172
165
|
this.identifier = createID('mg-menu-item');
|
|
@@ -232,7 +225,6 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
232
225
|
}
|
|
233
226
|
/**
|
|
234
227
|
* Render popover clickoutside guard for content slot
|
|
235
|
-
* @returns {void}
|
|
236
228
|
*/
|
|
237
229
|
updatePopoverGuard() {
|
|
238
230
|
if (this.displayPopover())
|
|
@@ -245,7 +237,6 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
245
237
|
*************/
|
|
246
238
|
/**
|
|
247
239
|
* Validate props
|
|
248
|
-
* @returns {void}
|
|
249
240
|
*/
|
|
250
241
|
componentWillLoad() {
|
|
251
242
|
// has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
|
|
@@ -261,7 +252,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
261
252
|
}
|
|
262
253
|
/**
|
|
263
254
|
* Check if component slots configuration
|
|
264
|
-
* @returns
|
|
255
|
+
* @returns timeout
|
|
265
256
|
*/
|
|
266
257
|
componentDidLoad() {
|
|
267
258
|
// validation
|
|
@@ -300,7 +291,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
300
291
|
}
|
|
301
292
|
/**
|
|
302
293
|
* Render ineractive element
|
|
303
|
-
* @returns
|
|
294
|
+
* @returns HTML Element
|
|
304
295
|
*/
|
|
305
296
|
renderInteractiveElement() {
|
|
306
297
|
const TagName = this.href !== undefined ? 'a' : 'button';
|
|
@@ -312,7 +303,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
312
303
|
}
|
|
313
304
|
/**
|
|
314
305
|
* Render
|
|
315
|
-
* @returns
|
|
306
|
+
* @returns HTML Element
|
|
316
307
|
*/
|
|
317
308
|
render() {
|
|
318
309
|
const getContainerClasses = () => ({
|