@mgdis/mg-components 5.9.1 → 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 +345 -648
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +19 -43
- package/dist/cjs/{mg-menu.conf-9afe6571.js → mg-menu.conf-196151fe.js} +16 -21
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -12
- package/dist/collection/components/atoms/mg-button/mg-button.js +18 -27
- package/dist/collection/components/atoms/mg-card/mg-card.js +22 -15
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -4
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +26 -23
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -4
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -16
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +12 -34
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +26 -24
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +10 -20
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -17
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -34
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -13
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -27
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -45
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +17 -43
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +14 -22
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -28
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -29
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -47
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -23
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -27
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -4
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -12
- package/dist/collection/components/molecules/mg-message/mg-message.js +12 -20
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -17
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -19
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -30
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +8 -21
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +3 -8
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -36
- package/dist/collection/locales/index.js +2 -3
- package/dist/collection/utils/behaviors.utils.js +16 -32
- package/dist/collection/utils/components.utils.js +22 -33
- package/dist/collection/utils/locale.utils.js +14 -18
- package/dist/collection/utils/unit.test.utils.js +7 -15
- package/dist/components/MgInput.js +30 -24
- package/dist/components/components.utils.js +22 -33
- package/dist/components/index2.js +16 -21
- package/dist/components/mg-action-more.js +9 -21
- package/dist/components/mg-badge2.js +9 -12
- package/dist/components/mg-button2.js +18 -27
- package/dist/components/mg-card2.js +20 -13
- package/dist/components/mg-character-left2.js +1 -4
- package/dist/components/mg-details.js +1 -6
- package/dist/components/mg-divider.js +1 -2
- package/dist/components/mg-form.js +7 -23
- package/dist/components/mg-icon2.js +26 -23
- package/dist/components/mg-illustrated-message.js +1 -4
- package/dist/components/mg-input-checkbox.js +9 -16
- package/dist/components/mg-input-date.js +6 -13
- package/dist/components/mg-input-numeric.js +13 -30
- package/dist/components/mg-input-password.js +5 -9
- package/dist/components/mg-input-radio.js +9 -23
- package/dist/components/mg-input-select2.js +20 -41
- package/dist/components/mg-input-text2.js +15 -35
- package/dist/components/mg-input-textarea.js +13 -18
- package/dist/components/mg-input-title2.js +1 -4
- package/dist/components/mg-input-toggle.js +16 -24
- package/dist/components/mg-item-more.js +18 -42
- package/dist/components/mg-menu-item2.js +17 -44
- package/dist/components/mg-menu2.js +9 -27
- package/dist/components/mg-message.js +12 -20
- package/dist/components/mg-modal.js +8 -17
- package/dist/components/mg-pagination.js +11 -19
- package/dist/components/mg-panel.js +11 -30
- package/dist/components/mg-popover2.js +8 -21
- package/dist/components/mg-skip-links.js +3 -8
- package/dist/components/mg-tabs.js +20 -36
- package/dist/components/mg-tag.js +11 -16
- package/dist/components/mg-tooltip2.js +12 -34
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +345 -648
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +19 -43
- package/dist/esm/{mg-menu.conf-881fbd82.js → mg-menu.conf-9ca023ee.js} +16 -21
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-67ce7cb8.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 -5
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -14
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +11 -8
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -4
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +8 -7
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -4
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -8
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -33
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -6
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -11
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -11
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -26
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -7
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -18
- 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 -22
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -23
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -9
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -11
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -29
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -49
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -15
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -6
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -19
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -4
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -12
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -12
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -12
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -14
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -23
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -16
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -7
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -30
- package/dist/types/components.d.ts +22 -34
- package/dist/types/locales/index.d.ts +2 -3
- package/dist/types/utils/behaviors.utils.d.ts +14 -29
- package/dist/types/utils/components.utils.d.ts +19 -29
- package/dist/types/utils/locale.utils.d.ts +14 -18
- package/dist/types/utils/unit.test.utils.d.ts +11 -24
- package/package.json +11 -12
- package/dist/mg-components/p-9a93b7af.entry.js +0 -1
- /package/dist/mg-components/{p-367f92d2.js → p-0d3146d9.js} +0 -0
|
@@ -27,8 +27,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
27
27
|
this.hasDisplayedError = false;
|
|
28
28
|
/**
|
|
29
29
|
* Handle input event
|
|
30
|
-
*
|
|
31
|
-
* @returns {void}
|
|
32
30
|
*/
|
|
33
31
|
this.handleInput = () => {
|
|
34
32
|
this.checkValidity();
|
|
@@ -39,29 +37,23 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
39
37
|
};
|
|
40
38
|
/**
|
|
41
39
|
* Handle focus event
|
|
42
|
-
*
|
|
43
|
-
* @returns {void}
|
|
44
40
|
*/
|
|
45
41
|
this.handleFocus = () => {
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
42
|
+
this.classCollection.add(this.classFocus);
|
|
43
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
48
44
|
};
|
|
49
45
|
/**
|
|
50
46
|
* Handle blur event
|
|
51
|
-
*
|
|
52
|
-
* @returns {void}
|
|
53
47
|
*/
|
|
54
48
|
this.handleBlur = () => {
|
|
55
49
|
// Manage focus
|
|
56
|
-
this.
|
|
57
|
-
this.
|
|
50
|
+
this.classCollection.delete(this.classFocus);
|
|
51
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
58
52
|
// Display Error
|
|
59
53
|
this.displayError();
|
|
60
54
|
};
|
|
61
55
|
/**
|
|
62
56
|
* Check if input is valid
|
|
63
|
-
*
|
|
64
|
-
* @returns {void}
|
|
65
57
|
*/
|
|
66
58
|
this.checkValidity = () => {
|
|
67
59
|
var _a;
|
|
@@ -72,8 +64,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
72
64
|
};
|
|
73
65
|
/**
|
|
74
66
|
* Set input error message
|
|
75
|
-
*
|
|
76
|
-
* @returns {void}
|
|
77
67
|
*/
|
|
78
68
|
this.setErrorMessage = () => {
|
|
79
69
|
// Set error message
|
|
@@ -89,11 +79,9 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
89
79
|
};
|
|
90
80
|
/**
|
|
91
81
|
* Validate pattern configuration
|
|
92
|
-
*
|
|
93
|
-
* @returns {void}
|
|
94
82
|
*/
|
|
95
83
|
this.validatePattern = () => {
|
|
96
|
-
if (this.pattern &&
|
|
84
|
+
if (this.pattern !== undefined &&
|
|
97
85
|
typeof this.pattern === 'string' &&
|
|
98
86
|
this.pattern !== '' &&
|
|
99
87
|
(this.patternErrorMessage === undefined || typeof this.patternErrorMessage !== 'string' || this.patternErrorMessage === '')) {
|
|
@@ -102,17 +90,15 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
102
90
|
};
|
|
103
91
|
/**
|
|
104
92
|
* Validate append slot
|
|
105
|
-
*
|
|
106
|
-
* @returns {void}
|
|
107
93
|
*/
|
|
108
94
|
this.validateAppendSlot = () => {
|
|
109
95
|
const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
|
|
110
96
|
if (slotAppendInput.length === 1) {
|
|
111
|
-
this.
|
|
97
|
+
this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-input--is-append-input-slot-content');
|
|
112
98
|
}
|
|
113
99
|
else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
|
|
114
|
-
this.
|
|
115
|
-
this.
|
|
100
|
+
this.classCollection.add(this.classIsInputGroupAppend);
|
|
101
|
+
this.classCollection.add('mg-input--has-buttons-group-append');
|
|
116
102
|
}
|
|
117
103
|
};
|
|
118
104
|
this.value = undefined;
|
|
@@ -136,7 +122,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
136
122
|
this.helpText = undefined;
|
|
137
123
|
this.valid = undefined;
|
|
138
124
|
this.invalid = undefined;
|
|
139
|
-
this.
|
|
125
|
+
this.classCollection = new ClassList(['mg-input--text']);
|
|
140
126
|
this.errorMessage = undefined;
|
|
141
127
|
}
|
|
142
128
|
handleValue(newValue) {
|
|
@@ -144,10 +130,10 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
144
130
|
}
|
|
145
131
|
validateIcon(newValue) {
|
|
146
132
|
if (newValue !== undefined) {
|
|
147
|
-
this.
|
|
133
|
+
this.classCollection.add(this.classHasIcon);
|
|
148
134
|
}
|
|
149
135
|
else {
|
|
150
|
-
this.
|
|
136
|
+
this.classCollection.delete(this.classHasIcon);
|
|
151
137
|
}
|
|
152
138
|
}
|
|
153
139
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -162,16 +148,12 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
162
148
|
}
|
|
163
149
|
/**
|
|
164
150
|
* Public method to play input focus
|
|
165
|
-
*
|
|
166
|
-
* @returns {Promise<void>}
|
|
167
151
|
*/
|
|
168
152
|
async setFocus() {
|
|
169
153
|
this.input.focus();
|
|
170
154
|
}
|
|
171
155
|
/**
|
|
172
156
|
* Public method to display errors
|
|
173
|
-
*
|
|
174
|
-
* @returns {Promise<void>}
|
|
175
157
|
*/
|
|
176
158
|
async displayError() {
|
|
177
159
|
this.checkValidity();
|
|
@@ -183,8 +165,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
183
165
|
*************/
|
|
184
166
|
/**
|
|
185
167
|
* Check if component props are well configured on init
|
|
186
|
-
*
|
|
187
|
-
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
168
|
+
* @returns timeout
|
|
188
169
|
*/
|
|
189
170
|
componentWillLoad() {
|
|
190
171
|
// Get locales
|
|
@@ -203,11 +184,10 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
203
184
|
}
|
|
204
185
|
/**
|
|
205
186
|
* Render
|
|
206
|
-
*
|
|
207
|
-
* @returns {HTMLElement} HTML Element
|
|
187
|
+
* @returns HTML Element
|
|
208
188
|
*/
|
|
209
189
|
render() {
|
|
210
|
-
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: {
|
|
211
191
|
'--mg-character-left-message-length': (this.displayCharacterLeft
|
|
212
192
|
? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
|
|
213
193
|
: 0).toString(),
|
|
@@ -247,7 +227,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
247
227
|
"helpText": [1, "help-text"],
|
|
248
228
|
"valid": [1028],
|
|
249
229
|
"invalid": [1028],
|
|
250
|
-
"
|
|
230
|
+
"classCollection": [32],
|
|
251
231
|
"errorMessage": [32],
|
|
252
232
|
"setFocus": [64],
|
|
253
233
|
"displayError": [64]
|
|
@@ -38,24 +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
|
-
*
|
|
58
|
-
* @returns {boolean} is pattern valid
|
|
57
|
+
* @returns is pattern valid
|
|
59
58
|
*/
|
|
60
59
|
this.getPatternValidity = () => this.pattern === undefined || new RegExp(`^${this.pattern}$`, 'u').test(this.value);
|
|
61
60
|
/**
|
|
@@ -87,7 +86,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
87
86
|
* Validate pattern configuration
|
|
88
87
|
*/
|
|
89
88
|
this.validatePattern = () => {
|
|
90
|
-
if (this.pattern &&
|
|
89
|
+
if (this.pattern !== undefined &&
|
|
91
90
|
typeof this.pattern === 'string' &&
|
|
92
91
|
this.pattern !== '' &&
|
|
93
92
|
(this.patternErrorMessage === undefined || typeof this.patternErrorMessage !== 'string' || this.patternErrorMessage === '')) {
|
|
@@ -115,7 +114,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
115
114
|
this.valid = undefined;
|
|
116
115
|
this.invalid = undefined;
|
|
117
116
|
this.resizable = 'none';
|
|
118
|
-
this.
|
|
117
|
+
this.classCollection = new ClassList(['mg-input--textarea']);
|
|
119
118
|
this.errorMessage = undefined;
|
|
120
119
|
}
|
|
121
120
|
handleValue(newValue) {
|
|
@@ -134,16 +133,14 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
134
133
|
}
|
|
135
134
|
validateDisplayCharacterLeft(newValue) {
|
|
136
135
|
if (newValue) {
|
|
137
|
-
this.
|
|
136
|
+
this.classCollection.add(this.classHasDisplayCharacterLeft);
|
|
138
137
|
}
|
|
139
138
|
else {
|
|
140
|
-
this.
|
|
139
|
+
this.classCollection.delete(this.classHasDisplayCharacterLeft);
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
142
|
/**
|
|
144
143
|
* Public method to display errors
|
|
145
|
-
*
|
|
146
|
-
* @returns {Promise<void>}
|
|
147
144
|
*/
|
|
148
145
|
async displayError() {
|
|
149
146
|
this.checkValidity();
|
|
@@ -155,8 +152,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
155
152
|
*************/
|
|
156
153
|
/**
|
|
157
154
|
* Check if component props are well configured on init
|
|
158
|
-
*
|
|
159
|
-
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
155
|
+
* @returns timeout
|
|
160
156
|
*/
|
|
161
157
|
componentWillLoad() {
|
|
162
158
|
// Get locales
|
|
@@ -174,11 +170,10 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
174
170
|
}
|
|
175
171
|
/**
|
|
176
172
|
* Render
|
|
177
|
-
*
|
|
178
|
-
* @returns {HTMLElement} HTML Element
|
|
173
|
+
* @returns HTML Element
|
|
179
174
|
*/
|
|
180
175
|
render() {
|
|
181
|
-
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: {
|
|
182
177
|
'mg-input__box': true,
|
|
183
178
|
'mg-input__box--resizable': this.resizable === 'both',
|
|
184
179
|
'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',
|
|
@@ -219,7 +214,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
219
214
|
"valid": [1028],
|
|
220
215
|
"invalid": [1028],
|
|
221
216
|
"resizable": [1],
|
|
222
|
-
"
|
|
217
|
+
"classCollection": [32],
|
|
223
218
|
"errorMessage": [32],
|
|
224
219
|
"displayError": [64]
|
|
225
220
|
}]);
|
|
@@ -24,8 +24,6 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
24
24
|
*************/
|
|
25
25
|
/**
|
|
26
26
|
* Init tag name
|
|
27
|
-
*
|
|
28
|
-
* @returns {void}
|
|
29
27
|
*/
|
|
30
28
|
componentWillLoad() {
|
|
31
29
|
this.validateIdentifier(this.identifier);
|
|
@@ -33,8 +31,7 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
33
|
* Render
|
|
36
|
-
*
|
|
37
|
-
* @returns {HTMLElement} HTML Element
|
|
34
|
+
* @returns HTML element
|
|
38
35
|
*/
|
|
39
36
|
render() {
|
|
40
37
|
const TagName = this.tagName;
|
|
@@ -9,9 +9,8 @@ const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* type Option validation function
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
14
|
-
* @returns {boolean} toggle option type is valid
|
|
12
|
+
* @param option - radio option
|
|
13
|
+
* @returns toggle option type is valid
|
|
15
14
|
*/
|
|
16
15
|
const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
|
|
17
16
|
const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -32,16 +31,12 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
32
31
|
this.classIcon = 'mg-input--toggle-icon';
|
|
33
32
|
/**
|
|
34
33
|
* Change checked value
|
|
35
|
-
*
|
|
36
|
-
* @returns {void}
|
|
37
34
|
*/
|
|
38
35
|
this.toggleChecked = () => {
|
|
39
36
|
this.checked = !this.checked;
|
|
40
37
|
};
|
|
41
38
|
/**
|
|
42
39
|
* Slots validation
|
|
43
|
-
*
|
|
44
|
-
* @returns {void}
|
|
45
40
|
*/
|
|
46
41
|
this.validateSlots = () => {
|
|
47
42
|
const slots = Array.from(this.element.children);
|
|
@@ -67,7 +62,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
67
62
|
this.disabled = false;
|
|
68
63
|
this.tooltip = undefined;
|
|
69
64
|
this.helpText = undefined;
|
|
70
|
-
this.
|
|
65
|
+
this.classCollection = new ClassList(['mg-input--toggle']);
|
|
71
66
|
this.options = undefined;
|
|
72
67
|
this.checked = false;
|
|
73
68
|
}
|
|
@@ -95,41 +90,39 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
95
90
|
}
|
|
96
91
|
handleIsOnOff(newValue) {
|
|
97
92
|
if (newValue)
|
|
98
|
-
this.
|
|
93
|
+
this.classCollection.add(this.classOnOff);
|
|
99
94
|
else
|
|
100
|
-
this.
|
|
95
|
+
this.classCollection.delete(this.classOnOff);
|
|
101
96
|
}
|
|
102
97
|
handleIsIcon(newValue) {
|
|
103
98
|
if (newValue)
|
|
104
|
-
this.
|
|
99
|
+
this.classCollection.add(this.classIcon);
|
|
105
100
|
else
|
|
106
|
-
this.
|
|
101
|
+
this.classCollection.delete(this.classIcon);
|
|
107
102
|
}
|
|
108
103
|
handleReadonly(newValue) {
|
|
109
104
|
if (newValue)
|
|
110
|
-
this.
|
|
105
|
+
this.classCollection.add(this.classReadonly);
|
|
111
106
|
else
|
|
112
|
-
this.
|
|
107
|
+
this.classCollection.delete(this.classReadonly);
|
|
113
108
|
}
|
|
114
109
|
handleDisabled(newValue) {
|
|
115
110
|
if (newValue)
|
|
116
|
-
this.
|
|
111
|
+
this.classCollection.add(this.classDisabled);
|
|
117
112
|
else
|
|
118
|
-
this.
|
|
113
|
+
this.classCollection.delete(this.classDisabled);
|
|
119
114
|
}
|
|
120
115
|
handleChecked(newValue) {
|
|
121
116
|
// style
|
|
122
117
|
if (newValue)
|
|
123
|
-
this.
|
|
118
|
+
this.classCollection.add(this.classIsActive);
|
|
124
119
|
else
|
|
125
|
-
this.
|
|
120
|
+
this.classCollection.delete(this.classIsActive);
|
|
126
121
|
// update value
|
|
127
122
|
this.value = this.options[newValue ? 1 : 0].value;
|
|
128
123
|
}
|
|
129
124
|
/**
|
|
130
125
|
* set checked state
|
|
131
|
-
*
|
|
132
|
-
* @returns {void}
|
|
133
126
|
*/
|
|
134
127
|
setChecked() {
|
|
135
128
|
const optionTrueValueIndex = this.options.map(option => option.value).findIndex(value => value === true);
|
|
@@ -171,11 +164,10 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
171
164
|
}
|
|
172
165
|
/**
|
|
173
166
|
* Render
|
|
174
|
-
*
|
|
175
|
-
* @returns {HTMLElement} HTML Element
|
|
167
|
+
* @returns HTML Element
|
|
176
168
|
*/
|
|
177
169
|
render() {
|
|
178
|
-
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" })))));
|
|
179
171
|
}
|
|
180
172
|
get element() { return this; }
|
|
181
173
|
static get watchers() { return {
|
|
@@ -202,7 +194,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
202
194
|
"disabled": [4],
|
|
203
195
|
"tooltip": [1],
|
|
204
196
|
"helpText": [1, "help-text"],
|
|
205
|
-
"
|
|
197
|
+
"classCollection": [32],
|
|
206
198
|
"options": [32],
|
|
207
199
|
"checked": [32]
|
|
208
200
|
}]);
|
|
@@ -11,9 +11,8 @@ import { d as defineCustomElement$2 } from './mg-popover2.js';
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* MgItemMore type guard
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
16
|
-
* @returns {boolean} truthy if element is mg-item-more
|
|
14
|
+
* @param element - element to control type
|
|
15
|
+
* @returns truthy if element is mg-item-more
|
|
17
16
|
*/
|
|
18
17
|
const isMgItemMore = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
19
18
|
var OverflowBehaviorElements;
|
|
@@ -30,8 +29,6 @@ class OverflowBehavior {
|
|
|
30
29
|
**********/
|
|
31
30
|
/**
|
|
32
31
|
* Disconnect ResizeObserver
|
|
33
|
-
*
|
|
34
|
-
* @returns {void}
|
|
35
32
|
*/
|
|
36
33
|
this.disconnect = () => {
|
|
37
34
|
this._resizeObserver.disconnect();
|
|
@@ -41,9 +38,7 @@ class OverflowBehavior {
|
|
|
41
38
|
************/
|
|
42
39
|
/**
|
|
43
40
|
* run overflow behavior
|
|
44
|
-
*
|
|
45
|
-
* @param {number} width width of the container. Optional.
|
|
46
|
-
* @returns {void}
|
|
41
|
+
* @param width - width of the container. Optional.
|
|
47
42
|
*/
|
|
48
43
|
this.run = (width) => {
|
|
49
44
|
if (this._moreElement === undefined) {
|
|
@@ -66,16 +61,13 @@ class OverflowBehavior {
|
|
|
66
61
|
};
|
|
67
62
|
/**
|
|
68
63
|
* Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
71
|
-
* @returns {Element[]} children
|
|
64
|
+
* @param element - element to parse
|
|
65
|
+
* @returns children
|
|
72
66
|
*/
|
|
73
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)); };
|
|
74
68
|
/**
|
|
75
69
|
* Update displayed items in container from a given available space
|
|
76
|
-
*
|
|
77
|
-
* @param {number} availableWidth available width in container to display child items
|
|
78
|
-
* @returns {void}
|
|
70
|
+
* @param availableWidth - available width in container to display child items
|
|
79
71
|
*/
|
|
80
72
|
this.updateDisplayedItems = (availableWidth) => {
|
|
81
73
|
this.restoreItems();
|
|
@@ -94,11 +86,10 @@ class OverflowBehavior {
|
|
|
94
86
|
};
|
|
95
87
|
/**
|
|
96
88
|
* Utility method to know if item overflow partialy or totaly in the container
|
|
97
|
-
*
|
|
98
|
-
* @param
|
|
99
|
-
* @param
|
|
100
|
-
* @
|
|
101
|
-
* @returns {boolean} truthy if element is overflow
|
|
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
|
|
102
93
|
*/
|
|
103
94
|
this.isOverflowElement = (cumulateWidth, item, availableWidth) => {
|
|
104
95
|
if (item.previousElementSibling === null || this.isMoreElement(item))
|
|
@@ -110,17 +101,14 @@ class OverflowBehavior {
|
|
|
110
101
|
};
|
|
111
102
|
/**
|
|
112
103
|
* Utility method to know if a given element is the 'MORE' element
|
|
113
|
-
*
|
|
114
|
-
* @
|
|
115
|
-
* @returns {boolean} truthy if element is the 'MORE' element
|
|
104
|
+
* @param element - element to match with 'MORE' element
|
|
105
|
+
* @returns truthy if element is the 'MORE' element
|
|
116
106
|
*/
|
|
117
107
|
this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
118
108
|
/**
|
|
119
109
|
* Toggle display item element
|
|
120
|
-
*
|
|
121
|
-
* @param
|
|
122
|
-
* @param {boolean} isHidden is item hidden
|
|
123
|
-
* @returns {void}
|
|
110
|
+
* @param item - item to control
|
|
111
|
+
* @param isHidden - is item hidden
|
|
124
112
|
*/
|
|
125
113
|
this.toggleItem = (item, isHidden) => {
|
|
126
114
|
const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
|
|
@@ -133,10 +121,8 @@ class OverflowBehavior {
|
|
|
133
121
|
};
|
|
134
122
|
/**
|
|
135
123
|
* Toggle element's hidde attribute
|
|
136
|
-
*
|
|
137
|
-
* @param
|
|
138
|
-
* @param {boolean} isHidden element is hidden
|
|
139
|
-
* @returns {void}
|
|
124
|
+
* @param element - element to toggle
|
|
125
|
+
* @param isHidden - element is hidden
|
|
140
126
|
*/
|
|
141
127
|
this.toggleElement = (element, isHidden) => {
|
|
142
128
|
if (isHidden)
|
|
@@ -146,8 +132,6 @@ class OverflowBehavior {
|
|
|
146
132
|
};
|
|
147
133
|
/**
|
|
148
134
|
* Remove hidden attributes on all items
|
|
149
|
-
*
|
|
150
|
-
* @returns {void}
|
|
151
135
|
*/
|
|
152
136
|
this.restoreItems = () => {
|
|
153
137
|
[...this._baseChildren, this._moreElement].forEach(item => item.removeAttribute('hidden'));
|
|
@@ -181,8 +165,7 @@ const MgItemMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
181
165
|
***********/
|
|
182
166
|
/**
|
|
183
167
|
* render mg-item-more overflow element
|
|
184
|
-
*
|
|
185
|
-
* @returns {HTMLMgItemMoreElement} mg-item-more element
|
|
168
|
+
* @returns mg-item-more element
|
|
186
169
|
*/
|
|
187
170
|
this.renderMgMenuItemOverflowElement = () => {
|
|
188
171
|
// create menu items proxy element from item clones
|
|
@@ -231,16 +214,12 @@ const MgItemMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
231
214
|
*************/
|
|
232
215
|
/**
|
|
233
216
|
* Disconnect overflow ResizeObserver
|
|
234
|
-
*
|
|
235
|
-
* @returns {void} run overflow resize obeserver disconnexion
|
|
236
217
|
*/
|
|
237
218
|
disconnectedCallback() {
|
|
238
219
|
this.overflowBehavior.disconnect();
|
|
239
220
|
}
|
|
240
221
|
/**
|
|
241
222
|
* Set variables and validate props
|
|
242
|
-
*
|
|
243
|
-
* @returns {void}
|
|
244
223
|
*/
|
|
245
224
|
componentWillLoad() {
|
|
246
225
|
// init variables
|
|
@@ -254,16 +233,13 @@ const MgItemMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
254
233
|
}
|
|
255
234
|
/**
|
|
256
235
|
* Add overflow behavior
|
|
257
|
-
*
|
|
258
|
-
* @returns {void}
|
|
259
236
|
*/
|
|
260
237
|
componentDidLoad() {
|
|
261
238
|
this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
|
|
262
239
|
}
|
|
263
240
|
/**
|
|
264
241
|
* Render
|
|
265
|
-
*
|
|
266
|
-
* @returns {HTMLElement} HTML Element
|
|
242
|
+
* @returns HTML Element
|
|
267
243
|
*/
|
|
268
244
|
render() {
|
|
269
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 }))));
|