@mgdis/mg-components 5.7.0 → 5.8.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 +351 -600
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +273 -0
- package/dist/cjs/mg-menu.conf-9afe6571.js +242 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +24 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +8 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +14 -10
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +91 -21
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +0 -13
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +80 -76
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +7 -5
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +174 -78
- package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js +1 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +30 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +200 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -2
- package/dist/collection/styles/navigation-button.scss +1 -1
- package/dist/collection/utils/behaviors.utils.js +33 -29
- package/dist/collection/utils/components.utils.js +2 -4
- package/dist/collection/utils/unit.test.utils.js +25 -0
- package/dist/components/components.utils.js +2 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/mg-action-more.js +2 -1
- package/dist/components/mg-button2.js +4 -1
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-icon2.js +8 -0
- package/dist/components/mg-input-checkbox.js +5 -4
- package/dist/components/mg-input-select2.js +83 -17
- package/dist/components/mg-item-more.d.ts +11 -0
- package/dist/components/mg-item-more.js +336 -0
- package/dist/components/mg-menu-item2.js +138 -251
- package/dist/components/mg-menu.conf.js +14 -0
- package/dist/components/mg-menu2.js +76 -111
- package/dist/components/mg-tabs.js +1 -1
- package/dist/components/mg-tooltip2.js +6 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +321 -570
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +269 -0
- package/dist/esm/mg-menu.conf-881fbd82.js +235 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-1221773c.entry.js +1 -0
- package/dist/mg-components/p-30bc87db.entry.js +1 -0
- package/dist/mg-components/p-367f92d2.js +1 -0
- package/dist/mg-components/styles/navigation-button.scss +1 -1
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +3 -3
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +39 -4
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +3 -27
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +38 -30
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +69 -16
- package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +26 -0
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +74 -0
- package/dist/types/components.d.ts +75 -17
- package/dist/types/utils/behaviors.utils.d.ts +12 -5
- package/dist/types/utils/components.utils.d.ts +2 -2
- package/dist/types/utils/unit.test.utils.d.ts +11 -0
- package/package.json +1 -1
- package/dist/mg-components/p-4cfd5423.entry.js +0 -1
|
@@ -3,227 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-5e7ede97.js');
|
|
6
|
-
|
|
7
|
-
const errors$1 = {
|
|
8
|
-
required: "This field is required.",
|
|
9
|
-
date: {
|
|
10
|
-
badInput: "The date format must be <span aria-hidden=\"true\">mm/dd/yyyy</span><span class=\"sr-only\">m m / d d / y y y y</span> and the date must be greater than {min}",
|
|
11
|
-
min: "The date cannot be earlier than {min}",
|
|
12
|
-
max: "The date cannot be later than {max}",
|
|
13
|
-
minMax: "The date must be between {min} and {max}"
|
|
14
|
-
},
|
|
15
|
-
numeric: {
|
|
16
|
-
min: "The value cannot be less than {min}",
|
|
17
|
-
max: "The value cannot be greater than {max}",
|
|
18
|
-
minMax: "The value must be between {min} et {max}"
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const nbCharLeft$1 = "{counter} characters left.";
|
|
22
|
-
const input$1 = {
|
|
23
|
-
select: {
|
|
24
|
-
placeholder: "Select a value"
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const form$1 = {
|
|
28
|
-
required: "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
|
|
29
|
-
requiredSingle: "Field with a <strong class=\"is-asterisk\">*</strong> is required",
|
|
30
|
-
allRequired: "All fields are required",
|
|
31
|
-
allRequiredSingle: "The field is required"
|
|
32
|
-
};
|
|
33
|
-
const message$1 = {
|
|
34
|
-
closeButton: "Close message"
|
|
35
|
-
};
|
|
36
|
-
const modal$1 = {
|
|
37
|
-
closeButton: "Close modal"
|
|
38
|
-
};
|
|
39
|
-
const pagination$1 = {
|
|
40
|
-
label: "Pagination",
|
|
41
|
-
page: "page",
|
|
42
|
-
pages: "pages",
|
|
43
|
-
nextPage: "Next page",
|
|
44
|
-
previousPage: "Previous page",
|
|
45
|
-
selectPage: "Select the page to display."
|
|
46
|
-
};
|
|
47
|
-
const panel$1 = {
|
|
48
|
-
editLabel: "Edit section title."
|
|
49
|
-
};
|
|
50
|
-
const skipLinks$1 = {
|
|
51
|
-
navLabel: "Quick access"
|
|
52
|
-
};
|
|
53
|
-
const general$1 = {
|
|
54
|
-
confirm: "Confirm",
|
|
55
|
-
cancel: "Cancel",
|
|
56
|
-
close: "Close",
|
|
57
|
-
next: "next",
|
|
58
|
-
previous: "previous"
|
|
59
|
-
};
|
|
60
|
-
const plusMenu$1 = {
|
|
61
|
-
moreLabel: "Additional menu",
|
|
62
|
-
badgeLabel: "Include notification(s)"
|
|
63
|
-
};
|
|
64
|
-
const actionMore$1 = {
|
|
65
|
-
label: "Actions"
|
|
66
|
-
};
|
|
67
|
-
const en = {
|
|
68
|
-
errors: errors$1,
|
|
69
|
-
nbCharLeft: nbCharLeft$1,
|
|
70
|
-
input: input$1,
|
|
71
|
-
form: form$1,
|
|
72
|
-
message: message$1,
|
|
73
|
-
modal: modal$1,
|
|
74
|
-
pagination: pagination$1,
|
|
75
|
-
panel: panel$1,
|
|
76
|
-
skipLinks: skipLinks$1,
|
|
77
|
-
general: general$1,
|
|
78
|
-
plusMenu: plusMenu$1,
|
|
79
|
-
actionMore: actionMore$1
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const errors = {
|
|
83
|
-
required: "Ce champ est obligatoire.",
|
|
84
|
-
date: {
|
|
85
|
-
badInput: "Le format de la date doit être du type <span aria-hidden=\"true\">jj/mm/aaaa</span><span class=\"sr-only\">j j / m m / a a a a</span> et la date supérieure au {min}",
|
|
86
|
-
min: "La date ne peut pas être antérieure au {min}",
|
|
87
|
-
max: "La date ne peut pas être postérieure au {max}",
|
|
88
|
-
minMax: "La date doit être comprise entre le {min} et le {max}"
|
|
89
|
-
},
|
|
90
|
-
numeric: {
|
|
91
|
-
min: "La valeur ne peut pas être inférieure à {min}",
|
|
92
|
-
max: "La valeur ne peut pas être supérieure à {max}",
|
|
93
|
-
minMax: "La valeur doit être comprise entre {min} et {max}"
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const nbCharLeft = "{counter} caractères disponibles.";
|
|
97
|
-
const input = {
|
|
98
|
-
select: {
|
|
99
|
-
placeholder: "Sélectionnez une valeur"
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const form = {
|
|
103
|
-
required: "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
|
|
104
|
-
requiredSingle: "Le champ marqué d'un <strong class=\"is-asterisk\">*</strong> est obligatoire",
|
|
105
|
-
allRequired: "Tous les champs sont obligatoires",
|
|
106
|
-
allRequiredSingle: "Le champ est obligatoire"
|
|
107
|
-
};
|
|
108
|
-
const message = {
|
|
109
|
-
closeButton: "Fermer le message"
|
|
110
|
-
};
|
|
111
|
-
const modal = {
|
|
112
|
-
closeButton: "Fermer la modale"
|
|
113
|
-
};
|
|
114
|
-
const pagination = {
|
|
115
|
-
label: "Pagination",
|
|
116
|
-
page: "page",
|
|
117
|
-
pages: "pages",
|
|
118
|
-
nextPage: "Page suivante",
|
|
119
|
-
previousPage: "Page précédente",
|
|
120
|
-
selectPage: "Sélectionner la page à afficher."
|
|
121
|
-
};
|
|
122
|
-
const panel = {
|
|
123
|
-
editLabel: "Modifier le titre de la section."
|
|
124
|
-
};
|
|
125
|
-
const skipLinks = {
|
|
126
|
-
navLabel: "Accès rapide"
|
|
127
|
-
};
|
|
128
|
-
const general = {
|
|
129
|
-
confirm: "Valider",
|
|
130
|
-
cancel: "Annuler",
|
|
131
|
-
close: "Fermer",
|
|
132
|
-
next: "suivant",
|
|
133
|
-
previous: "précédent"
|
|
134
|
-
};
|
|
135
|
-
const plusMenu = {
|
|
136
|
-
moreLabel: "Menu complémentaire",
|
|
137
|
-
badgeLabel: "Notification(s) incluse(s)"
|
|
138
|
-
};
|
|
139
|
-
const actionMore = {
|
|
140
|
-
label: "Actions"
|
|
141
|
-
};
|
|
142
|
-
const fr = {
|
|
143
|
-
errors: errors,
|
|
144
|
-
nbCharLeft: nbCharLeft,
|
|
145
|
-
input: input,
|
|
146
|
-
form: form,
|
|
147
|
-
message: message,
|
|
148
|
-
modal: modal,
|
|
149
|
-
pagination: pagination,
|
|
150
|
-
panel: panel,
|
|
151
|
-
skipLinks: skipLinks,
|
|
152
|
-
general: general,
|
|
153
|
-
plusMenu: plusMenu,
|
|
154
|
-
actionMore: actionMore
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Format number to the locale currency
|
|
159
|
-
*
|
|
160
|
-
* @param {number} number number to format
|
|
161
|
-
* @param {string} locale locale to apply
|
|
162
|
-
* @param {string} currency currency to apply
|
|
163
|
-
* @returns {string} formatted currency
|
|
164
|
-
*/
|
|
165
|
-
const localeCurrency = (number, locale, currency) => {
|
|
166
|
-
return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Format number to locale
|
|
170
|
-
*
|
|
171
|
-
* @param {number} number number to format
|
|
172
|
-
* @param {string} locale locale to apply
|
|
173
|
-
* @returns {string} formatted number
|
|
174
|
-
*/
|
|
175
|
-
const localeNumber = (number, locale) => {
|
|
176
|
-
return new Intl.NumberFormat(locale).format(number);
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Date RegExp
|
|
180
|
-
*/
|
|
181
|
-
const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
182
|
-
/**
|
|
183
|
-
* Locale date format
|
|
184
|
-
*
|
|
185
|
-
* @param {string} date date to format
|
|
186
|
-
* @param {string} locale locale to apply
|
|
187
|
-
* @returns {string} formatted date
|
|
188
|
-
*/
|
|
189
|
-
const localeDate = (date, locale) => {
|
|
190
|
-
if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {
|
|
191
|
-
return '';
|
|
192
|
-
}
|
|
193
|
-
return new Intl.DateTimeFormat(locale).format(new Date(date));
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* Get locale and messages
|
|
197
|
-
* We load the defined locale but for now we only support the first subtag for messages
|
|
198
|
-
*
|
|
199
|
-
* @param {HTMLElement} element element we need to get the language
|
|
200
|
-
* @param {unknown} messages messages to use
|
|
201
|
-
* @param {string} defaultLocale default messages locale
|
|
202
|
-
* @returns {{ locale: string; messages: Record<string, unknown> }} messages object
|
|
203
|
-
*/
|
|
204
|
-
const getLocaleMessages = (element, messages, defaultLocale) => {
|
|
205
|
-
// Get local
|
|
206
|
-
const closestLangAttribute = element.closest('[lang]');
|
|
207
|
-
const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute === null || closestLangAttribute === void 0 ? void 0 : closestLangAttribute.lang);
|
|
208
|
-
const locale = closestLang.length > 0 ? closestLang[0] : navigator.language || defaultLocale;
|
|
209
|
-
// Only keep first subtag
|
|
210
|
-
const localeSubtag = locale.split('-').shift();
|
|
211
|
-
// Return
|
|
212
|
-
return {
|
|
213
|
-
locale,
|
|
214
|
-
messages: messages[localeSubtag] || messages[defaultLocale],
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const defaultLocale = 'en';
|
|
219
|
-
const messages = { en, fr };
|
|
220
|
-
/**
|
|
221
|
-
* Get Intl object
|
|
222
|
-
*
|
|
223
|
-
* @param {HTMLElement} element element we need to get the language
|
|
224
|
-
* @returns {{ locale: string; messages: Record<string, unknown> }} messages object
|
|
225
|
-
*/
|
|
226
|
-
const initLocales = (element) => getLocaleMessages(element, messages, defaultLocale);
|
|
6
|
+
const mgMenu_conf = require('./mg-menu.conf-9afe6571.js');
|
|
227
7
|
|
|
228
8
|
/**
|
|
229
9
|
* Available menu-item positions
|
|
@@ -244,32 +24,6 @@ var Status$1;
|
|
|
244
24
|
Status["ACTIVE"] = "active";
|
|
245
25
|
})(Status$1 || (Status$1 = {}));
|
|
246
26
|
|
|
247
|
-
/**
|
|
248
|
-
* Menu direction type
|
|
249
|
-
*/
|
|
250
|
-
var Direction;
|
|
251
|
-
(function (Direction) {
|
|
252
|
-
Direction["VERTICAL"] = "vertical";
|
|
253
|
-
Direction["HORIZONTAL"] = "horizontal";
|
|
254
|
-
})(Direction || (Direction = {}));
|
|
255
|
-
/**
|
|
256
|
-
* More item type guard
|
|
257
|
-
*
|
|
258
|
-
* @param {unknown} element element to control
|
|
259
|
-
* @returns {boolean} truthy if element is more-item
|
|
260
|
-
*/
|
|
261
|
-
const isMoreItem = (element) => {
|
|
262
|
-
var _a, _b, _c;
|
|
263
|
-
const item = element;
|
|
264
|
-
return (item === undefined ||
|
|
265
|
-
(typeof item === 'object' &&
|
|
266
|
-
(typeof item.size === 'string' || typeof ((_a = item.mgIcon) === null || _a === void 0 ? void 0 : _a.icon) === 'string' || typeof ((_b = item.slotLabel) === null || _b === void 0 ? void 0 : _b.label) === 'string' || typeof ((_c = item.slotLabel) === null || _c === void 0 ? void 0 : _c.display) === 'boolean')));
|
|
267
|
-
};
|
|
268
|
-
/**
|
|
269
|
-
* List of all possibles sizes
|
|
270
|
-
*/
|
|
271
|
-
const sizes$2 = ['regular', 'medium', 'large'];
|
|
272
|
-
|
|
273
27
|
/**
|
|
274
28
|
* Create random ID
|
|
275
29
|
*
|
|
@@ -338,12 +92,10 @@ class ClassList {
|
|
|
338
92
|
/**
|
|
339
93
|
* Check if all items are string
|
|
340
94
|
*
|
|
341
|
-
* @param {
|
|
95
|
+
* @param {unknown} items items to check
|
|
342
96
|
* @returns {boolean} all items are string
|
|
343
97
|
*/
|
|
344
|
-
const allItemsAreString = (items) =>
|
|
345
|
-
return items && items.every(item => typeof item === 'string');
|
|
346
|
-
};
|
|
98
|
+
const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
|
|
347
99
|
/**
|
|
348
100
|
* Check if element is a heading
|
|
349
101
|
*
|
|
@@ -516,7 +268,7 @@ const MgActionMore = class {
|
|
|
516
268
|
* @returns {void}
|
|
517
269
|
*/
|
|
518
270
|
componentWillLoad() {
|
|
519
|
-
this.messages = initLocales(this.element).messages.actionMore;
|
|
271
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages.actionMore;
|
|
520
272
|
this.validateItems(this.items);
|
|
521
273
|
this.validateButton(this.button);
|
|
522
274
|
this.validateIcon(this.icon);
|
|
@@ -537,7 +289,7 @@ const MgActionMore = class {
|
|
|
537
289
|
'mg-a11y-animation': true,
|
|
538
290
|
} }, index.h("mg-icon", { icon: "chevron-down", size: "small" })));
|
|
539
291
|
}
|
|
540
|
-
return (index.h(index.Host, { "data-mg-popover-guard": this.mgPopoverIdentifier }, index.h("span", { class: "mg-action-more" }, index.h("mg-popover", { identifier: this.mgPopoverIdentifier, display: this.expanded }, index.h("mg-button", { variant: this.button.variant, isIcon: this.button.isIcon, type: "button", label: buttonLabel, onClick: this.handleButton }, index.h("mg-icon", Object.assign({}, this.icon)), !this.button.isIcon && buttonContent), index.h("div", { slot: "content" }, index.h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
|
|
292
|
+
return (index.h(index.Host, { "data-mg-popover-guard": this.mgPopoverIdentifier }, index.h("span", { class: "mg-action-more" }, index.h("mg-popover", { identifier: this.mgPopoverIdentifier, display: this.expanded }, index.h("mg-button", { variant: this.button.variant, isIcon: this.button.isIcon, type: "button", label: buttonLabel, onClick: this.handleButton }, index.h("mg-icon", Object.assign({}, this.icon)), !this.button.isIcon && buttonContent), index.h("div", { slot: "content" }, index.h("mg-menu", { direction: mgMenu_conf.Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
|
|
541
293
|
var _a;
|
|
542
294
|
return (
|
|
543
295
|
// eslint-disable-next-line react/jsx-no-bind
|
|
@@ -640,6 +392,7 @@ const mgButtonCss = ":host{display:inline-block;vertical-align:middle;max-width:
|
|
|
640
392
|
const MgButton = class {
|
|
641
393
|
constructor(hostRef) {
|
|
642
394
|
index.registerInstance(this, hostRef);
|
|
395
|
+
this.disabledChange = index.createEvent(this, "disabled-change", 7);
|
|
643
396
|
/************
|
|
644
397
|
* Internal *
|
|
645
398
|
************/
|
|
@@ -738,6 +491,8 @@ const MgButton = class {
|
|
|
738
491
|
else {
|
|
739
492
|
this.classList.delete(this.classDisabled);
|
|
740
493
|
}
|
|
494
|
+
// emit value update
|
|
495
|
+
this.disabledChange.emit(isDisabled);
|
|
741
496
|
}
|
|
742
497
|
loadingHandler(newValue) {
|
|
743
498
|
// we add loading style if it newvalue is true else we remove it
|
|
@@ -828,7 +583,7 @@ const MgCharacterLeft = class {
|
|
|
828
583
|
*/
|
|
829
584
|
componentWillLoad() {
|
|
830
585
|
this.validateMaxlength(this.maxlength);
|
|
831
|
-
this.messages = initLocales(this.element).messages;
|
|
586
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
832
587
|
}
|
|
833
588
|
/**
|
|
834
589
|
* Render component
|
|
@@ -1035,7 +790,7 @@ const MgForm = class {
|
|
|
1035
790
|
*/
|
|
1036
791
|
componentWillLoad() {
|
|
1037
792
|
// Get locales
|
|
1038
|
-
this.messages = initLocales(this.element).messages;
|
|
793
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
1039
794
|
// Get slotted mgButtons
|
|
1040
795
|
this.mgButtons = Array.from(this.element.querySelectorAll('mg-button'));
|
|
1041
796
|
// Set button form identifier
|
|
@@ -1066,7 +821,7 @@ const MgForm = class {
|
|
|
1066
821
|
// submit buttons should trigger form submition;
|
|
1067
822
|
if (['submit', null].includes(mgButton.getAttribute('type'))) {
|
|
1068
823
|
mgButton.addEventListener('click', () => {
|
|
1069
|
-
this.form.dispatchEvent(new
|
|
824
|
+
this.form.dispatchEvent(new SubmitEvent('submit', { bubbles: true }));
|
|
1070
825
|
});
|
|
1071
826
|
}
|
|
1072
827
|
});
|
|
@@ -1123,6 +878,7 @@ const icons = {
|
|
|
1123
878
|
'bell': () => (index.h("path", { fill: "currentColor", d: "M8 15.33a1.7 1.7 0 0 0 1.52-1.83h-3A1.7 1.7 0 0 0 8 15.33ZM13.13 11c-.46-.59-1.32-1.48-1.32-4.42a4.4 4.4 0 0 0-3.05-4.4v-.6A.85.85 0 0 0 8 .67a.85.85 0 0 0-.76.91v.6a4.4 4.4 0 0 0-3 4.44c0 2.94-.86 3.83-1.32 4.42a1 1 0 0 0-.2.63.85.85 0 0 0 .76.91h9.14a.85.85 0 0 0 .76-.91 1.05 1.05 0 0 0-.25-.67Z" })),
|
|
1124
879
|
'briefcase': () => (index.h("path", { fill: "currentColor", d: "M14 4.5h-3v-1c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H2c-.55 0-1 .45-1 1v7c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-7c0-.55-.45-1-1-1Zm-8-1h4v1H6v-1Z" })),
|
|
1125
880
|
'briefcase-outline': () => (index.h("path", { fill: "currentColor", d: "M14 4.5h-3v-1c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H2c-.55 0-1 .45-1 1v7c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-7c0-.55-.45-1-1-1Zm-8-1h4v1H6v-1Zm8 9H2v-7h12v7Z" })),
|
|
881
|
+
'building-outline': () => (index.h("path", { fill: "currentColor", d: "M4 2h8v12H9v-1a1 1 0 1 0-2 0v1H4V2Zm4 13h4a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h4ZM7 4H5v2h2V4Zm2 0h2v2H9V4Zm2 4H9v2h2V8ZM5 8h2v2H5V8Z" })),
|
|
1126
882
|
'calculator': () => (index.h("path", { fill: "currentColor", d: "M12.83.67H3.17a.5.5 0 0 0-.5.5v13.66a.5.5 0 0 0 .5.5h9.66a.5.5 0 0 0 .5-.5V1.17a.5.5 0 0 0-.5-.5ZM5.58 13.39a.29.29 0 0 1-.28.3H4.1a.29.29 0 0 1-.3-.28v-1.2a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm0-3.28a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V8.93a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm3.29 3.28a.29.29 0 0 1-.3.3H7.38a.29.29 0 0 1-.3-.3v-1.18a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm0-3.28a.32.32 0 0 1-.3.3H7.38a.32.32 0 0 1-.3-.3V8.93a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm3.33 3.28a.29.29 0 0 1-.28.3h-1.25a.29.29 0 0 1-.3-.28V8.93a.29.29 0 0 1 .28-.3h1.25a.29.29 0 0 1 .3.28v4.48Zm0-7.15a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V2.61a.29.29 0 0 1 .28-.3h7.82a.29.29 0 0 1 .3.28v3.65Z" })),
|
|
1127
883
|
'calendar': () => (index.h("path", { fill: "currentColor", d: "M14 3.5c0-.55-.45-1-1-1h-1v-1h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v.98s0 .02.02.02H2v9c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-9h-.02s.02 0 .02-.02V3.5Zm-11 10v-8h10v8H3Z" })),
|
|
1128
884
|
'calendar-outline': () => (index.h("path", { fill: "currentColor", d: "M13 2.5h-1v-1h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-10c0-.55-.45-1-1-1Zm-10 11v-8h10v8H3Zm0-9v-1h10v1H3Z" })),
|
|
@@ -1238,6 +994,7 @@ const icons = {
|
|
|
1238
994
|
'pen': () => (index.h("path", { fill: "currentColor", d: "M1.67,11.69v2.64h2.64l7.78-7.78-2.64-2.64L1.67,11.69ZM14.13,4.51c.27-.28,.27-.72,0-1h0l-1.65-1.64c-.28-.27-.72-.27-1,0h0l-1.28,1.29,2.64,2.64,1.29-1.29Z" })),
|
|
1239
995
|
'pen-circle': () => (index.h("path", { fill: "currentColor", d: "M8 .44C3.82.44.44 3.82.44 8S3.83 15.56 8 15.56s7.56-3.39 7.56-7.56C15.56 3.82 12.18.44 8 .44M5.47 12.19H3.62v-1.85l5.46-5.45 1.85 1.86-5.45 5.45Zm6.88-6.89-.9.9-1.86-1.85.9-.9c.19-.19.51-.19.7 0l1.16 1.15c.19.19.19.51 0 .7" })),
|
|
1240
996
|
'pen-fancy': () => (index.h("path", { fill: "currentColor", d: "M3.63,8.65c-.24,.07-.43,.26-.5,.5l-1.46,4.37,.11,.12,2.3-2.3c0-.06,0-.13,0-.19,0-.44,.35-.8,.79-.81,.44,0,.8,.35,.81,.79,0,.44-.35,.8-.79,.81,0,0-.01,0-.02,0h-.19l-2.3,2.3,.12,.11,4.37-1.46c.24-.07,.43-.26,.5-.5l.82-2.08-2.49-2.48-2.07,.82ZM10.8,2.35L6.27,7.28l2.42,2.42,4.94-4.52c2.1-1.86-.99-4.92-2.83-2.83Z" })),
|
|
997
|
+
'pen-fancy-files-outline': () => (index.h("path", { fill: "currentColor", d: "M12 2H6v10h6V8.946l.023-.058.085-.078.892-.813V12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v.112a2.298 2.298 0 0 0-.974.66L12 2.8V2Zm1 4.643-1 .913-.566.515-1.528-1.524L12 4.275l.767-.832c.075-.085.153-.156.233-.215 1.167-.857 2.796.9 1.555 1.997L13 6.643ZM4 3H3v11.5a.5.5 0 0 0 .5.5H11v-1H4V3Zm4.238 4.41a.466.466 0 0 0-.316.315L7 10.477l.07.076 1.452-1.449v-.12a.51.51 0 0 1 .5-.51.51.51 0 0 1 .511.498.51.51 0 0 1-.499.51h-.133L7.45 10.931l.075.069 2.76-.92a.466.466 0 0 0 .317-.314l.518-1.31-1.573-1.562-1.308.516Z" })),
|
|
1241
998
|
'pen-fancy-outline': () => (index.h("path", { fill: "currentColor", d: "M12.24 1.67c-.49 0-1 .21-1.44.7L6.27 7.3l2.42 2.42 4.94-4.52c1.6-1.42.19-3.53-1.39-3.53ZM8.72 8.34 7.66 7.28l3.9-4.24c.22-.24.44-.36.69-.36.41 0 .87.34 1.03.78.14.37.04.7-.32 1.02L8.73 8.36ZM5.7 7.86l-2.08.82c-.24.08-.42.26-.5.5l-1.46 4.37.12.12.56.56.12.12 4.37-1.46c.24-.08.42-.26.5-.5l.81-2.08L5.7 7.87Zm-2.57 4.46L4 9.72c.03-.08.09-.15.17-.18l1.29-.51 1.52 1.52-.5 1.29c-.03.08-.1.15-.19.18l-2.6.87.95-.95c.06.02.12.04.19.04.44 0 .79-.35.79-.79s-.35-.79-.79-.79-.79.35-.79.79c0 .07.02.13.04.19l-.95.95Z" })),
|
|
1242
999
|
'phone': () => (index.h("path", { fill: "currentColor", d: "M13.97 10.62 11.2 9.43a.6.6 0 0 0-.69.17l-1.23 1.5A9.137 9.137 0 0 1 4.9 6.72l1.5-1.23c.21-.17.28-.45.17-.69L5.38 2.03a.589.589 0 0 0-.68-.34l-2.57.59a.59.59 0 0 0-.46.58c0 6.34 5.14 11.48 11.48 11.48.28 0 .52-.19.58-.46l.59-2.57a.595.595 0 0 0-.35-.68Z" })),
|
|
1243
1000
|
'picture': () => (index.h("path", { fill: "currentColor", d: "M14.33 12.93V3.07a1.4 1.4 0 0 0-1.4-1.4H3.07a1.4 1.4 0 0 0-1.4 1.4v9.86a1.4 1.4 0 0 0 1.4 1.4h9.86a1.4 1.4 0 0 0 1.4-1.4ZM5.54 9.06l1.76 2.11L9.76 8l3.17 4.22H3.07Z" })),
|
|
@@ -1256,6 +1013,8 @@ const icons = {
|
|
|
1256
1013
|
index.h("path", { key: "tags-2", fill: "currentColor", d: "M15 7.37 10.15 3a1.12 1.12 0 0 0-.77-.29H8.26l4.5 4.09a1.76 1.76 0 0 1 0 2.65L8.77 13a1.17 1.17 0 0 0 1.55 0L15 8.79a.94.94 0 0 0 0-1.42Z" }),
|
|
1257
1014
|
],
|
|
1258
1015
|
'thumb-up': () => (index.h("path", { fill: "currentColor", d: "M2.11 14.36h1a.45.45 0 0 0 .45-.44V7.17a.45.45 0 0 0-.45-.44h-1a.44.44 0 0 0-.44.44v6.75a.44.44 0 0 0 .44.44Zm12.22-7a1.27 1.27 0 0 0-1.27-1.27H9.71l.61-2.91v-.2a1.07 1.07 0 0 0-.28-.68l-.68-.66-4.17 4.19a1.26 1.26 0 0 0-.37.9v6.36a1.27 1.27 0 0 0 1.27 1.27h5.06a1.24 1.24 0 0 0 1.17-.77l1.92-4.49a1.22 1.22 0 0 0 .09-.46V7.42Z" })),
|
|
1016
|
+
'thumbtack': () => (index.h("path", { fill: "currentColor", d: "M8.91 2 7.71 5.594 2.364 7.09 5.274 10l-.707.706-1.687 1.687-.264.264-.09.09-.209.498L2 14l.755-.317.498-.21.09-.089.264-.264 1.687-1.687.706-.706 2.91 2.908 1.496-5.347L14 7.09 8.91 2Z" })),
|
|
1017
|
+
'thumbtack-outline': () => (index.h("path", { fill: "currentColor", "fill-rule": "evenodd", d: "m5.273 10-2.91 2.91L2 14l1.09-.364L6 10.727l2.91 2.91 1.496-5.348L14 7.09 8.91 2 7.71 5.594 2.364 7.09 5.273 10Zm3.241-3.563-4.18 1.17 4.059 4.059 1.17-4.18 2.533-.845-2.737-2.737-.845 2.533Z" })),
|
|
1259
1018
|
'trash': () => [
|
|
1260
1019
|
index.h("path", { key: "trash-1", fill: "currentColor", d: "M3.27 14.17c0 .66.54 1.19 1.2 1.2h7l-.05-.02h.08c.64-.02 1.14-.56 1.12-1.2V4.32H3.27v9.85Zm5.97-7.12c0-.33.27-.6.6-.6s.6.27.6.6v5.3c0 .33-.27.6-.6.6s-.6-.27-.6-.6v-5.3Zm-3.5 0c0-.33.27-.59.6-.6.32.02.58.28.6.6v5.3c-.02.32-.28.58-.6.6a.645.645 0 0 1-.6-.6v-5.3Zm7.28-5.39h-2.6V.95a.28.28 0 0 0-.28-.28H5.87a.28.28 0 0 0-.28.28v.72H2.91a.28.28 0 0 0-.28.28V3.1c0 .15.12.28.28.28h10.11c.15 0 .28-.12.28-.28V1.94a.28.28 0 0 0-.28-.28Z" }),
|
|
1261
1020
|
index.h("path", { key: "trash-2", fill: "currentColor", d: "M13,2h-2.9L9.9,1.6 C9.8,1.4,9.6,1.2,9.4,1.2H6.6c-0.2,0-0.4,0.1-0.5,0.3L5.8,2H2.9C2.7,2,2.5,2.2,2.5,2.4c0,0,0,0,0,0v0.8c0,0.2,0.2,0.4,0.4,0.4H13 c0.2,0,0.4-0.2,0.4-0.4V2.4C13.4,2.2,13.2,2,13,2z" }),
|
|
@@ -1266,6 +1025,10 @@ const icons = {
|
|
|
1266
1025
|
'upload': () => (index.h("path", { fill: "currentColor", d: "M9.58 10.74V6.59a.31.31 0 0 1 .31-.3H12a.3.3 0 0 0 .21-.52l-4-4a.29.29 0 0 0-.42 0l-4 4a.3.3 0 0 0 .21.52h2.11a.31.31 0 0 1 .31.3v4.15a.3.3 0 0 0 .3.3h2.56a.3.3 0 0 0 .3-.3ZM14.33 14v-1a.29.29 0 0 0-.29-.3H2a.29.29 0 0 0-.29.3v1a.29.29 0 0 0 .29.29h12a.29.29 0 0 0 .33-.29Z" })),
|
|
1267
1026
|
'user': () => (index.h("path", { fill: "currentColor", d: "M8 8.79a3.56 3.56 0 1 0-3.56-3.56A3.56 3.56 0 0 0 8 8.79Zm3.17.79H9.8a4.27 4.27 0 0 1-3.6 0H4.83a3.16 3.16 0 0 0-3.16 3.17v.4a1.18 1.18 0 0 0 1.18 1.18h10.3a1.18 1.18 0 0 0 1.18-1.18v-.4a3.16 3.16 0 0 0-3.16-3.17Z" })),
|
|
1268
1027
|
'user-circle': () => (index.h("path", { fill: "currentColor", d: "M8 .62C3.95.61.66 3.9.65 7.95c0 4.05 3.28 7.34 7.33 7.35 4.04 0 7.33-3.26 7.35-7.3.02-4.05-3.25-7.36-7.3-7.38H8Zm0 .75c3.64 0 6.59 2.96 6.58 6.6V8c0 1.35-.41 2.66-1.19 3.76a2.713 2.713 0 0 0-2.66-2.37H9.54c-.98.46-2.1.46-3.08 0H5.28c-1.36 0-2.5 1.02-2.67 2.37A6.483 6.483 0 0 1 1.42 8a6.59 6.59 0 0 1 6.55-6.63H8ZM5 5.63c0-1.68 1.37-3.05 3.05-3.05 1.68 0 3.05 1.37 3.05 3.05 0 1.68-1.37 3.05-3.05 3.05H8c-1.66-.03-3-1.39-3-3.05Z" })),
|
|
1028
|
+
'user-pen-fancy-outline': () => [
|
|
1029
|
+
index.h("path", { fill: "currentColor", d: "M7.5 7a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5Zm0-4C6.67 3 6 3.67 6 4.5S6.67 6 7.5 6 9 5.33 9 4.5 8.33 3 7.5 3ZM11.12 11.46l-.22.54-.3.77s-.04.09-.06.13c-.03.04-.06.07-.1.1-.05.04-.1.07-.16.08L7.52 14l-.07-.07 1.45-1.45h.13c.15 0 .27-.06.36-.16a.56.56 0 0 0 .1-.15c.01-.02.02-.04.03-.07v-.02s.01-.05.01-.08v-.03c0-.28-.23-.5-.51-.5-.28.01-.5.24-.5.51v.14l-.76.75-.14.13-.55.55-.07-.07.16-.48.1-.29.24-.71.42-1.27c.05-.16.17-.28.32-.32l1.31-.52 1.57 1.57ZM14.56 8.22l-2.05 1.87-.7.64-.06.05-.32.29-1.52-1.52.28-.31.06-.06.64-.7 1.88-2.04c1.16-1.31 3.11.61 1.79 1.78Z" }),
|
|
1030
|
+
index.h("path", { fill: "currentColor", d: "M9 8H6c-2.21 0-4 1.79-4 4 0 .55.45 1 1 1h3.11l.33-1H3c0-1.66 1.34-3 3-3h3.05l.12-.13.71-.77C9.6 8.03 9.3 8 9 8Z" }),
|
|
1031
|
+
],
|
|
1269
1032
|
'user-group': () => (index.h("path", { fill: "currentColor", d: "M13.15 4.12c-.81-.01-1.47.65-1.48 1.46 0 .82.65 1.47 1.46 1.48s1.47-.65 1.48-1.46-.65-1.47-1.46-1.48Zm-10.04.01a1.47 1.47 0 0 0-1.58 1.59c.06.71.62 1.28 1.34 1.34.81.07 1.52-.53 1.59-1.34.06-.81-.54-1.52-1.35-1.59Zm7.36.39c-.22-.84-.87-1.51-1.71-1.75-1.36-.41-2.8.36-3.22 1.72-.18.61-.13 1.27.14 1.85.41.9 1.33 1.48 2.32 1.45 1.41.01 2.56-1.14 2.57-2.55 0-.24-.03-.49-.1-.72Zm-.71 4h-.19c-.99.49-2.14.49-3.13 0h-.19c-1.46 0-2.64 1.18-2.64 2.64v2.69c1.23.93 2.74 1.47 4.39 1.47s3.17-.55 4.4-1.48v-2.68c0-1.46-1.18-2.64-2.64-2.64Zm5.52.25a7.282 7.282 0 0 1-1.65 3.91c-.08.1-.16.19-.25.28-.08.09-.17.18-.25.27v-.55h.03v-.72s.01-.07 0-.1v-.66c.01-1.25-.66-2.4-1.76-3 .27-.26.63-.41 1-.41h1.51c.63.01 1.17.41 1.37.98ZM2.86 11.16v1.52h.01v.55l-.28-.31c-.08-.08-.15-.16-.22-.24A7.238 7.238 0 0 1 .74 8.86c.16-.62.72-1.07 1.4-1.07h1.47c.37-.01.73.12 1.01.37-1.1.6-1.77 1.75-1.76 3Z" })),
|
|
1270
1033
|
'user-plus': () => (index.h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
|
|
1271
1034
|
'user-question-outline': () => (index.h("path", { fill: "currentColor", d: "M5.23 11.14c.86-.66 1.01-1.9.35-2.75s-1.9-1.01-2.75-.35a1.96 1.96 0 0 0 0 3.1c-.72.42-1.16 1.2-1.16 2.03v.8c0 .2.17.37.37.37h3.98c.2 0 .37-.17.37-.37v-.8c0-.83-.44-1.61-1.16-2.03ZM2.81 9.59c0-.67.55-1.22 1.22-1.22s1.22.55 1.22 1.22-.55 1.22-1.22 1.22-1.22-.55-1.22-1.22Zm2.83 4H2.41v-.42c0-.89.72-1.62 1.62-1.62s1.62.72 1.62 1.62v.42h-.01Zm7.13-11.93H8c-.86 0-1.56.7-1.56 1.56v7.16c0 .21.17.37.37.37.08 0 .16-.03.22-.07l1.49-1.12h4.25c.86 0 1.56-.7 1.56-1.56V3.22c0-.86-.7-1.56-1.56-1.56Zm.82 6.33c0 .45-.37.82-.82.82H8.4a.41.41 0 0 0-.22.07l-1 .75V3.22c0-.45.37-.82.82-.82h4.77c.45 0 .82.37.82.82v4.77Zm-2.8-.42c0 .23-.18.41-.41.41s-.41-.18-.41-.41.18-.41.41-.41c.23 0 .41.18.41.41Zm-.41-4.34c-.83 0-1.5.67-1.5 1.5 0 .23.18.41.41.41s.41-.18.41-.41c0-.38.31-.68.69-.68.38 0 .68.31.68.69 0 .38-.31.68-.68.68-.23 0-.41.18-.41.41v.44c0 .23.18.41.41.41s.41-.18.41-.41v-.09c.8-.23 1.26-1.06 1.04-1.85-.18-.65-.77-1.09-1.44-1.09Z" })),
|
|
@@ -1546,10 +1309,11 @@ const mgInputCheckboxCss = ":host{display:block}.mg-input{display:flex;align-ite
|
|
|
1546
1309
|
/**
|
|
1547
1310
|
* type CheckboxItem validation function
|
|
1548
1311
|
*
|
|
1549
|
-
* @param {
|
|
1550
|
-
* @returns {boolean} match item
|
|
1312
|
+
* @param {unknown} items Checkbox item
|
|
1313
|
+
* @returns {boolean} match item type
|
|
1551
1314
|
*/
|
|
1552
|
-
const
|
|
1315
|
+
const isCheckboxItems = (items) => Array.isArray(items) &&
|
|
1316
|
+
items.every(item => typeof item === 'object' && typeof item.title === 'string' && (item.value === null || typeof item.value === 'boolean') && item.value !== undefined);
|
|
1553
1317
|
const MgInputCheckbox = class {
|
|
1554
1318
|
constructor(hostRef) {
|
|
1555
1319
|
index.registerInstance(this, hostRef);
|
|
@@ -1630,7 +1394,7 @@ const MgInputCheckbox = class {
|
|
|
1630
1394
|
this.checkboxItems = [];
|
|
1631
1395
|
}
|
|
1632
1396
|
validateValue(newValue) {
|
|
1633
|
-
if (newValue
|
|
1397
|
+
if (isCheckboxItems(newValue)) {
|
|
1634
1398
|
this.checkboxItems = newValue.map((item, index) => ({
|
|
1635
1399
|
id: `${this.identifier}_${index.toString()}`,
|
|
1636
1400
|
title: item.title,
|
|
@@ -1673,7 +1437,7 @@ const MgInputCheckbox = class {
|
|
|
1673
1437
|
*/
|
|
1674
1438
|
componentWillLoad() {
|
|
1675
1439
|
// Get locales
|
|
1676
|
-
this.messages = initLocales(this.element).messages;
|
|
1440
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
1677
1441
|
// Validate
|
|
1678
1442
|
this.validateValue(this.value);
|
|
1679
1443
|
// Check validity when component is ready
|
|
@@ -1794,12 +1558,12 @@ const MgInputDate = class {
|
|
|
1794
1558
|
}
|
|
1795
1559
|
// min, max & minMax
|
|
1796
1560
|
else if ([InputError$1.MIN, InputError$1.MAX, InputError$1.MINMAX].includes(inputError)) {
|
|
1797
|
-
this.errorMessage = this.messages.errors.date[inputError].replace('{min}', localeDate(this.min, this.locale)).replace('{max}', localeDate(this.max, this.locale));
|
|
1561
|
+
this.errorMessage = this.messages.errors.date[inputError].replace('{min}', mgMenu_conf.localeDate(this.min, this.locale)).replace('{max}', mgMenu_conf.localeDate(this.max, this.locale));
|
|
1798
1562
|
}
|
|
1799
1563
|
// wrong date format
|
|
1800
1564
|
// element.validity.badInput is default error message
|
|
1801
1565
|
else {
|
|
1802
|
-
this.errorMessage = this.messages.errors.date.badInput.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? localeDate(this.min, this.locale) : localeDate('1900-01-01', this.locale));
|
|
1566
|
+
this.errorMessage = this.messages.errors.date.badInput.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? mgMenu_conf.localeDate(this.min, this.locale) : mgMenu_conf.localeDate('1900-01-01', this.locale));
|
|
1803
1567
|
}
|
|
1804
1568
|
}
|
|
1805
1569
|
};
|
|
@@ -1825,7 +1589,7 @@ const MgInputDate = class {
|
|
|
1825
1589
|
// When the input is not fully completed or has been cleared, the value becomes an empty string.
|
|
1826
1590
|
if (newValue === '')
|
|
1827
1591
|
newValue = null;
|
|
1828
|
-
if (newValue !== undefined && newValue !== null && (typeof newValue !== 'string' || !dateRegExp.test(newValue))) {
|
|
1592
|
+
if (newValue !== undefined && newValue !== null && (typeof newValue !== 'string' || !mgMenu_conf.dateRegExp.test(newValue))) {
|
|
1829
1593
|
throw new Error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
1830
1594
|
}
|
|
1831
1595
|
else {
|
|
@@ -1843,7 +1607,7 @@ const MgInputDate = class {
|
|
|
1843
1607
|
}
|
|
1844
1608
|
}
|
|
1845
1609
|
validateMinMax(newValue) {
|
|
1846
|
-
if ((newValue === null || newValue === void 0 ? void 0 : newValue.length) === 0 || ((newValue === null || newValue === void 0 ? void 0 : newValue.length) > 0 && !(typeof newValue === 'string' && dateRegExp.test(newValue)))) {
|
|
1610
|
+
if ((newValue === null || newValue === void 0 ? void 0 : newValue.length) === 0 || ((newValue === null || newValue === void 0 ? void 0 : newValue.length) > 0 && !(typeof newValue === 'string' && mgMenu_conf.dateRegExp.test(newValue)))) {
|
|
1847
1611
|
throw new Error("<mg-input-date> props 'min/max' doesn't match pattern: yyyy-mm-dd");
|
|
1848
1612
|
}
|
|
1849
1613
|
}
|
|
@@ -1867,7 +1631,7 @@ const MgInputDate = class {
|
|
|
1867
1631
|
*/
|
|
1868
1632
|
componentWillLoad() {
|
|
1869
1633
|
// Get locales
|
|
1870
|
-
const locales = initLocales(this.element);
|
|
1634
|
+
const locales = mgMenu_conf.initLocales(this.element);
|
|
1871
1635
|
this.locale = locales.locale;
|
|
1872
1636
|
this.messages = locales.messages;
|
|
1873
1637
|
// Validate
|
|
@@ -1887,7 +1651,7 @@ const MgInputDate = class {
|
|
|
1887
1651
|
* @returns {HTMLElement} HTML Element
|
|
1888
1652
|
*/
|
|
1889
1653
|
render() {
|
|
1890
|
-
return (index.h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
1654
|
+
return (index.h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: mgMenu_conf.localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
1891
1655
|
if (el !== null)
|
|
1892
1656
|
this.input = el;
|
|
1893
1657
|
} })));
|
|
@@ -2019,7 +1783,7 @@ const MgInputNumeric = class {
|
|
|
2019
1783
|
* @param {number} value value to format
|
|
2020
1784
|
* @returns {string} formated local value
|
|
2021
1785
|
*/
|
|
2022
|
-
this.formatValue = (value) => (this.type === 'currency' ? localeCurrency(value, this.locale, this.currency) : localeNumber(value, this.locale));
|
|
1786
|
+
this.formatValue = (value) => (this.type === 'currency' ? mgMenu_conf.localeCurrency(value, this.locale, this.currency) : mgMenu_conf.localeNumber(value, this.locale));
|
|
2023
1787
|
/**
|
|
2024
1788
|
* Validate append slot
|
|
2025
1789
|
*
|
|
@@ -2137,7 +1901,7 @@ const MgInputNumeric = class {
|
|
|
2137
1901
|
*/
|
|
2138
1902
|
componentWillLoad() {
|
|
2139
1903
|
// Get locales
|
|
2140
|
-
const locales = initLocales(this.element);
|
|
1904
|
+
const locales = mgMenu_conf.initLocales(this.element);
|
|
2141
1905
|
this.locale = locales.locale;
|
|
2142
1906
|
this.messages = locales.messages;
|
|
2143
1907
|
// Validate
|
|
@@ -2274,7 +2038,7 @@ const MgInputPassword = class {
|
|
|
2274
2038
|
*/
|
|
2275
2039
|
componentWillLoad() {
|
|
2276
2040
|
// Get locales
|
|
2277
|
-
this.messages = initLocales(this.element).messages;
|
|
2041
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
2278
2042
|
// Check validity when component is ready
|
|
2279
2043
|
// return a promise to process action only in the FIRST render().
|
|
2280
2044
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
@@ -2442,7 +2206,7 @@ const MgInputRadio = class {
|
|
|
2442
2206
|
*/
|
|
2443
2207
|
componentWillLoad() {
|
|
2444
2208
|
// Get locales
|
|
2445
|
-
this.messages = initLocales(this.element).messages;
|
|
2209
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
2446
2210
|
// Validate
|
|
2447
2211
|
this.validateItems(this.items);
|
|
2448
2212
|
// Check validity when component is ready
|
|
@@ -2479,10 +2243,24 @@ const mgInputSelectCss = ":host{display:block}.mg-input{display:flex;align-items
|
|
|
2479
2243
|
/**
|
|
2480
2244
|
* Check if item is a well configured option
|
|
2481
2245
|
*
|
|
2482
|
-
* @param {
|
|
2246
|
+
* @param {unknown} option select option
|
|
2483
2247
|
* @returns {boolean} select option type is valid
|
|
2484
2248
|
*/
|
|
2485
2249
|
const isOption$1 = (option) => typeof option === 'object' && typeof option.title === 'string';
|
|
2250
|
+
/**
|
|
2251
|
+
* Check if items[] is SelectOption
|
|
2252
|
+
*
|
|
2253
|
+
* @param {unknown[]} items select option
|
|
2254
|
+
* @returns {boolean} select option array type is valid
|
|
2255
|
+
*/
|
|
2256
|
+
const allItemsAreOptions = (items) => Array.isArray(items) && items.every(item => isOption$1(item));
|
|
2257
|
+
/**
|
|
2258
|
+
* Check if item is a well configured optgroup
|
|
2259
|
+
*
|
|
2260
|
+
* @param {unknown} optgroup select option
|
|
2261
|
+
* @returns {boolean} select optgroup type is valid
|
|
2262
|
+
*/
|
|
2263
|
+
const isOptGroup = (optgroup) => typeof optgroup === 'object' && typeof optgroup.group === 'string' && allItemsAreOptions(optgroup.options);
|
|
2486
2264
|
/**
|
|
2487
2265
|
* Group options
|
|
2488
2266
|
*
|
|
@@ -2521,17 +2299,50 @@ const MgInputSelect = class {
|
|
|
2521
2299
|
this.hasDisplayedError = false;
|
|
2522
2300
|
/**
|
|
2523
2301
|
* Handle input event
|
|
2302
|
+
*
|
|
2303
|
+
* @returns {void}
|
|
2524
2304
|
*/
|
|
2525
2305
|
this.handleInput = () => {
|
|
2526
|
-
this.
|
|
2527
|
-
if (this.hasDisplayedError)
|
|
2306
|
+
this.updateValue();
|
|
2307
|
+
if (this.hasDisplayedError)
|
|
2528
2308
|
this.setErrorMessage();
|
|
2309
|
+
};
|
|
2310
|
+
/**
|
|
2311
|
+
* Method to compare item.title with input.value
|
|
2312
|
+
*
|
|
2313
|
+
* @param {SelectOption} item item to compare with
|
|
2314
|
+
* @returns {boolean} truthy if input.value is an item
|
|
2315
|
+
*/
|
|
2316
|
+
this.isInputValue = (item) => { var _a; return item.title === ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value); };
|
|
2317
|
+
/**
|
|
2318
|
+
* value props setter
|
|
2319
|
+
*
|
|
2320
|
+
* @param {MgInputSelect['value']} newValue value to update with
|
|
2321
|
+
* @returns {void}
|
|
2322
|
+
*/
|
|
2323
|
+
this.setValue = (newValue) => {
|
|
2324
|
+
this.checkValidity();
|
|
2325
|
+
this.value = newValue;
|
|
2326
|
+
};
|
|
2327
|
+
/**
|
|
2328
|
+
* Update value from input.value
|
|
2329
|
+
*
|
|
2330
|
+
* @returns {void}
|
|
2331
|
+
*/
|
|
2332
|
+
this.updateValue = () => {
|
|
2333
|
+
if (this.input.value === '') {
|
|
2334
|
+
this.setValue(null);
|
|
2335
|
+
}
|
|
2336
|
+
else if (allItemsAreString(this.items) && this.items.includes(this.input.value)) {
|
|
2337
|
+
this.setValue(this.input.value);
|
|
2529
2338
|
}
|
|
2530
|
-
if (this.input.value
|
|
2531
|
-
this.
|
|
2339
|
+
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
2340
|
+
this.setValue(this.items.find(this.isInputValue).value);
|
|
2532
2341
|
}
|
|
2533
2342
|
else {
|
|
2534
|
-
|
|
2343
|
+
// before set newValue with push to options[] the unknown input.value with a disable satus
|
|
2344
|
+
this.options.push({ title: this.input.value, value: this.input.value, disabled: true });
|
|
2345
|
+
this.setValue(this.input.value);
|
|
2535
2346
|
}
|
|
2536
2347
|
};
|
|
2537
2348
|
/**
|
|
@@ -2540,12 +2351,18 @@ const MgInputSelect = class {
|
|
|
2540
2351
|
this.handleBlur = () => {
|
|
2541
2352
|
this.displayError();
|
|
2542
2353
|
};
|
|
2354
|
+
/**
|
|
2355
|
+
* Input value is disabled
|
|
2356
|
+
*
|
|
2357
|
+
* @returns {boolean} truthy if input value is disabled
|
|
2358
|
+
*/
|
|
2359
|
+
this.isDisabledValue = () => { var _a; return allItemsAreOptions(this.options) && ((_a = this.options.find(this.isInputValue)) === null || _a === void 0 ? void 0 : _a.disabled) === true; };
|
|
2543
2360
|
/**
|
|
2544
2361
|
* Check if input is valid
|
|
2545
2362
|
*/
|
|
2546
2363
|
this.checkValidity = () => {
|
|
2547
2364
|
var _a;
|
|
2548
|
-
this.valid = this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined ? this.input.checkValidity() : true);
|
|
2365
|
+
this.valid = !this.isDisabledValue() && (this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined ? this.input.checkValidity() : true));
|
|
2549
2366
|
this.invalid = !this.valid;
|
|
2550
2367
|
// We need to send valid event even if it is the same value
|
|
2551
2368
|
this.inputValid.emit(this.valid);
|
|
@@ -2560,6 +2377,13 @@ const MgInputSelect = class {
|
|
|
2560
2377
|
this.errorMessage = this.messages.errors.required;
|
|
2561
2378
|
}
|
|
2562
2379
|
};
|
|
2380
|
+
/**
|
|
2381
|
+
* Render option
|
|
2382
|
+
*
|
|
2383
|
+
* @param {SelectOption} option to render
|
|
2384
|
+
* @returns {HTMLElement} render option
|
|
2385
|
+
*/
|
|
2386
|
+
this.renderOption = (option) => (index.h("option", { key: option.title, value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title));
|
|
2563
2387
|
this.value = undefined;
|
|
2564
2388
|
this.items = undefined;
|
|
2565
2389
|
this.identifier = undefined;
|
|
@@ -2584,9 +2408,13 @@ const MgInputSelect = class {
|
|
|
2584
2408
|
this.valueExist = undefined;
|
|
2585
2409
|
this.readonlyValue = undefined;
|
|
2586
2410
|
}
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2411
|
+
validateValue(newValue) {
|
|
2412
|
+
var _a, _b;
|
|
2413
|
+
if (allItemsAreString(this.items) && typeof newValue === 'string') {
|
|
2414
|
+
this.readonlyValue = Boolean((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.input.value : newValue;
|
|
2415
|
+
}
|
|
2416
|
+
else if (allItemsAreOptions(this.items)) {
|
|
2417
|
+
this.readonlyValue = (_b = this.items.find(item => item.value === newValue)) === null || _b === void 0 ? void 0 : _b.title;
|
|
2590
2418
|
}
|
|
2591
2419
|
else {
|
|
2592
2420
|
this.readonlyValue = null;
|
|
@@ -2600,14 +2428,15 @@ const MgInputSelect = class {
|
|
|
2600
2428
|
}
|
|
2601
2429
|
// String array
|
|
2602
2430
|
else if (allItemsAreString(newValue)) {
|
|
2603
|
-
|
|
2604
|
-
|
|
2431
|
+
if (typeof this.value === 'string')
|
|
2432
|
+
this.valueExist = newValue.includes(this.value);
|
|
2433
|
+
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
2605
2434
|
}
|
|
2606
2435
|
// Object array
|
|
2607
|
-
else if (newValue
|
|
2436
|
+
else if (allItemsAreOptions(newValue)) {
|
|
2608
2437
|
this.valueExist = newValue.map(item => item.value).includes(this.value);
|
|
2609
2438
|
// Grouped object options
|
|
2610
|
-
if (newValue.some(item => item.group
|
|
2439
|
+
if (newValue.some(item => Boolean(item.group))) {
|
|
2611
2440
|
this.options = newValue.reduce(groupOptions, []);
|
|
2612
2441
|
}
|
|
2613
2442
|
// Standart object options
|
|
@@ -2649,9 +2478,10 @@ const MgInputSelect = class {
|
|
|
2649
2478
|
*/
|
|
2650
2479
|
componentWillLoad() {
|
|
2651
2480
|
// Get locales
|
|
2652
|
-
this.messages = initLocales(this.element).messages;
|
|
2481
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
2653
2482
|
// Validate
|
|
2654
2483
|
this.validateItems(this.items);
|
|
2484
|
+
this.validateValue(this.value);
|
|
2655
2485
|
// Set default placeholder
|
|
2656
2486
|
if (this.placeholder === undefined || this.placeholder === '') {
|
|
2657
2487
|
this.placeholder = this.messages.input.select.placeholder;
|
|
@@ -2669,15 +2499,15 @@ const MgInputSelect = class {
|
|
|
2669
2499
|
* @returns {HTMLElement} HTML Element
|
|
2670
2500
|
*/
|
|
2671
2501
|
render() {
|
|
2672
|
-
return (index.h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value:
|
|
2502
|
+
return (index.h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: undefined, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("select", { class: "mg-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
2673
2503
|
if (el !== null)
|
|
2674
2504
|
this.input = el;
|
|
2675
2505
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
2676
|
-
index.h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option
|
|
2506
|
+
index.h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => isOptGroup(option) ? index.h("optgroup", { label: option.group }, option.options.map(this.renderOption)) : isOption$1(option) && this.renderOption(option)))));
|
|
2677
2507
|
}
|
|
2678
2508
|
get element() { return index.getElement(this); }
|
|
2679
2509
|
static get watchers() { return {
|
|
2680
|
-
"value": ["
|
|
2510
|
+
"value": ["validateValue"],
|
|
2681
2511
|
"items": ["validateItems"],
|
|
2682
2512
|
"required": ["handleValidityChange"],
|
|
2683
2513
|
"readonly": ["handleValidityChange"],
|
|
@@ -2865,7 +2695,7 @@ const MgInputText = class {
|
|
|
2865
2695
|
*/
|
|
2866
2696
|
componentWillLoad() {
|
|
2867
2697
|
// Get locales
|
|
2868
|
-
this.messages = initLocales(this.element).messages;
|
|
2698
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
2869
2699
|
this.characterLeftId = `${this.identifier}-character-left`;
|
|
2870
2700
|
// Validate
|
|
2871
2701
|
this.validateIcon(this.icon);
|
|
@@ -3055,7 +2885,7 @@ const MgInputTextarea = class {
|
|
|
3055
2885
|
*/
|
|
3056
2886
|
componentWillLoad() {
|
|
3057
2887
|
// Get locales
|
|
3058
|
-
this.messages = initLocales(this.element).messages;
|
|
2888
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
3059
2889
|
this.characterLeftId = `${this.identifier}-character-left`;
|
|
3060
2890
|
// Validate
|
|
3061
2891
|
this.validateDisplayCharacterLeft(this.displayCharacterLeft);
|
|
@@ -3323,158 +3153,6 @@ const MgInputToggle = class {
|
|
|
3323
3153
|
};
|
|
3324
3154
|
MgInputToggle.style = mgInputToggleCss;
|
|
3325
3155
|
|
|
3326
|
-
/**
|
|
3327
|
-
* MgMenuItem type guard
|
|
3328
|
-
*
|
|
3329
|
-
* @param {HTMLElement} element element to control type
|
|
3330
|
-
* @returns {boolean} truthy if element is mg-menu-item
|
|
3331
|
-
*/
|
|
3332
|
-
const isMgMenuItem = (element) => element.nodeName === 'MG-MENU-ITEM';
|
|
3333
|
-
var OverflowBehaviorElements;
|
|
3334
|
-
(function (OverflowBehaviorElements) {
|
|
3335
|
-
OverflowBehaviorElements["MORE"] = "data-overflow-more";
|
|
3336
|
-
OverflowBehaviorElements["BASE_INDEX"] = "data-overflow-base-index";
|
|
3337
|
-
OverflowBehaviorElements["PROXY_INDEX"] = "data-overflow-proxy-index";
|
|
3338
|
-
})(OverflowBehaviorElements || (OverflowBehaviorElements = {}));
|
|
3339
|
-
class OverflowBehavior {
|
|
3340
|
-
constructor(element, render) {
|
|
3341
|
-
this.element = element;
|
|
3342
|
-
this.render = render;
|
|
3343
|
-
/**********
|
|
3344
|
-
* Public *
|
|
3345
|
-
**********/
|
|
3346
|
-
/**
|
|
3347
|
-
* Disconnect ResizeObserver
|
|
3348
|
-
*
|
|
3349
|
-
* @returns {void}
|
|
3350
|
-
*/
|
|
3351
|
-
this.disconnect = () => {
|
|
3352
|
-
this.resizeObserver.disconnect();
|
|
3353
|
-
};
|
|
3354
|
-
/************
|
|
3355
|
-
* Internal *
|
|
3356
|
-
************/
|
|
3357
|
-
/**
|
|
3358
|
-
* run overflow behavior
|
|
3359
|
-
*
|
|
3360
|
-
* @param {number} width width of the container
|
|
3361
|
-
* @returns {void}
|
|
3362
|
-
*/
|
|
3363
|
-
this.run = (width) => {
|
|
3364
|
-
if (this.moreElement === undefined) {
|
|
3365
|
-
// set moreElement
|
|
3366
|
-
this.moreElement = this.render();
|
|
3367
|
-
this.moreElement.setAttribute(OverflowBehaviorElements.MORE, '');
|
|
3368
|
-
// set children
|
|
3369
|
-
this.children = Array.from(this.element.children);
|
|
3370
|
-
let moreElementChildren;
|
|
3371
|
-
const allowedElements = ['MG-MENU-ITEM', 'MG-BUTTON'];
|
|
3372
|
-
if (isMgMenuItem(this.moreElement)) {
|
|
3373
|
-
moreElementChildren = Array.from(this.moreElement.querySelector('mg-menu').children).filter(element => allowedElements.includes(element.nodeName));
|
|
3374
|
-
}
|
|
3375
|
-
this.children.forEach((child, index) => {
|
|
3376
|
-
child.setAttribute(OverflowBehaviorElements.BASE_INDEX, `${index}`);
|
|
3377
|
-
if (child.getAttribute(OverflowBehaviorElements.MORE) === null) {
|
|
3378
|
-
// set moreElement children
|
|
3379
|
-
moreElementChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
|
|
3380
|
-
}
|
|
3381
|
-
});
|
|
3382
|
-
}
|
|
3383
|
-
this.updateDisplayedItems(width);
|
|
3384
|
-
};
|
|
3385
|
-
/**
|
|
3386
|
-
* Update displayed items in container from a given available space
|
|
3387
|
-
*
|
|
3388
|
-
* @param {number} availableWidth available width in container to display child items
|
|
3389
|
-
* @returns {void}
|
|
3390
|
-
*/
|
|
3391
|
-
this.updateDisplayedItems = (availableWidth) => {
|
|
3392
|
-
this.restoreItems();
|
|
3393
|
-
const acc = { accWidth: 0, previousItem: null };
|
|
3394
|
-
this.children.forEach((child) => {
|
|
3395
|
-
acc.accWidth += child.offsetWidth;
|
|
3396
|
-
const isPreviousItemHidden = acc.previousItem !== null && acc.previousItem.getAttribute('hidden') !== null;
|
|
3397
|
-
// if previous item is hidden AND is NOT more element we hidde current
|
|
3398
|
-
// OR if item has an overflow we hidde current
|
|
3399
|
-
// OR if current item is more element AND have NOT previous hidden items, current more element item is an hidden item
|
|
3400
|
-
// ELSE current is a display item
|
|
3401
|
-
this.toggleItem(child, (isPreviousItemHidden && !this.isMoreElement(child)) || this.isOverflowElement(acc.accWidth, child, availableWidth) || (this.isMoreElement(child) && !isPreviousItemHidden));
|
|
3402
|
-
// update previous item with current item
|
|
3403
|
-
acc.previousItem = child;
|
|
3404
|
-
});
|
|
3405
|
-
};
|
|
3406
|
-
/**
|
|
3407
|
-
* Utility method to know if item overflow partialy or totaly in the container
|
|
3408
|
-
*
|
|
3409
|
-
* @param {number} cumulateWidth previous sibling elements cumulate width + item width
|
|
3410
|
-
* @param {HTMLElement} item item HTML element
|
|
3411
|
-
* @param {number} availableWidth container available width
|
|
3412
|
-
* @returns {boolean} truthy if element is overflow
|
|
3413
|
-
*/
|
|
3414
|
-
this.isOverflowElement = (cumulateWidth, item, availableWidth) => {
|
|
3415
|
-
if (item.previousElementSibling === null || this.isMoreElement(item))
|
|
3416
|
-
return false;
|
|
3417
|
-
else if (!this.isMoreElement(item.nextElementSibling))
|
|
3418
|
-
return cumulateWidth + this.moreElement.offsetWidth > availableWidth;
|
|
3419
|
-
else
|
|
3420
|
-
return cumulateWidth > availableWidth;
|
|
3421
|
-
};
|
|
3422
|
-
/**
|
|
3423
|
-
* Utility method to know if a given element is the 'MORE' element
|
|
3424
|
-
*
|
|
3425
|
-
* @param {Element} element element to match with 'MORE' element
|
|
3426
|
-
* @returns {boolean} truthy if element is the 'MORE' element
|
|
3427
|
-
*/
|
|
3428
|
-
this.isMoreElement = (element) => element.getAttribute(OverflowBehaviorElements.MORE) !== null;
|
|
3429
|
-
/**
|
|
3430
|
-
* Toggle display item element
|
|
3431
|
-
*
|
|
3432
|
-
* @param {HTMLElement} item item to control
|
|
3433
|
-
* @param {boolean} isHidden is item hidden
|
|
3434
|
-
* @returns {void}
|
|
3435
|
-
*/
|
|
3436
|
-
this.toggleItem = (item, isHidden) => {
|
|
3437
|
-
const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
|
|
3438
|
-
if (this.isMoreElement(item))
|
|
3439
|
-
this.toggleElement(this.moreElement, isHidden);
|
|
3440
|
-
else if (mgActionMenuindex >= 0) {
|
|
3441
|
-
this.toggleElement(item, isHidden);
|
|
3442
|
-
this.toggleElement(this.moreElement.querySelector(`[${OverflowBehaviorElements.PROXY_INDEX}="${mgActionMenuindex}"]`), !isHidden);
|
|
3443
|
-
}
|
|
3444
|
-
};
|
|
3445
|
-
/**
|
|
3446
|
-
* Toggle element's hidde attribute
|
|
3447
|
-
*
|
|
3448
|
-
* @param {Element} element element to toggle
|
|
3449
|
-
* @param {boolean} isHidden element is hidden
|
|
3450
|
-
* @returns {void}
|
|
3451
|
-
*/
|
|
3452
|
-
this.toggleElement = (element, isHidden) => {
|
|
3453
|
-
if (isHidden)
|
|
3454
|
-
element.setAttribute('hidden', '');
|
|
3455
|
-
else
|
|
3456
|
-
element.removeAttribute('hidden');
|
|
3457
|
-
};
|
|
3458
|
-
/**
|
|
3459
|
-
* Remove hidden attributes on all items
|
|
3460
|
-
*
|
|
3461
|
-
* @returns {void}
|
|
3462
|
-
*/
|
|
3463
|
-
this.restoreItems = () => {
|
|
3464
|
-
this.children.forEach(item => item.removeAttribute('hidden'));
|
|
3465
|
-
};
|
|
3466
|
-
if (this.resizeObserver === undefined) {
|
|
3467
|
-
// add resize observer
|
|
3468
|
-
this.resizeObserver = new ResizeObserver(entries => {
|
|
3469
|
-
entries.forEach(entry => {
|
|
3470
|
-
this.run(entry.contentRect.width);
|
|
3471
|
-
});
|
|
3472
|
-
});
|
|
3473
|
-
this.resizeObserver.observe(this.element);
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
|
-
}
|
|
3477
|
-
|
|
3478
3156
|
const mgMenuCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{display:flex;background-color:hsl(var(--mg-menu-background-color-hsl, var(--color-light)))}:host([direction=vertical]){flex-direction:column;height:100%;overflow-y:auto}";
|
|
3479
3157
|
|
|
3480
3158
|
const MgMenu = class {
|
|
@@ -3486,6 +3164,9 @@ const MgMenu = class {
|
|
|
3486
3164
|
this.name = 'mg-menu';
|
|
3487
3165
|
this.menuItems = [];
|
|
3488
3166
|
this.focusedMenuItem = 0;
|
|
3167
|
+
/*************
|
|
3168
|
+
* Methods *
|
|
3169
|
+
*************/
|
|
3489
3170
|
/**
|
|
3490
3171
|
* Close matching menu-item
|
|
3491
3172
|
*
|
|
@@ -3498,68 +3179,74 @@ const MgMenu = class {
|
|
|
3498
3179
|
item.expanded = false;
|
|
3499
3180
|
}
|
|
3500
3181
|
};
|
|
3501
|
-
/*************
|
|
3502
|
-
* Methods *
|
|
3503
|
-
*************/
|
|
3504
3182
|
/**
|
|
3505
|
-
*
|
|
3183
|
+
* get mg-item-more element
|
|
3184
|
+
*
|
|
3185
|
+
* @returns {HTMLMgItemMoreElement} mg-item-more element
|
|
3186
|
+
*/
|
|
3187
|
+
this.getItemMore = () => this.element.querySelector('mg-item-more');
|
|
3188
|
+
/**
|
|
3189
|
+
* get mg-item-more >>> mg-menu-item element
|
|
3190
|
+
*
|
|
3191
|
+
* @returns {HTMLMgMenuItemElement} mg-item-more >>> mg-menu-item element
|
|
3192
|
+
*/
|
|
3193
|
+
this.getItemMoreMenuItem = () => { var _a, _b; return (_b = (_a = this.getItemMore()) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item'); };
|
|
3194
|
+
/**
|
|
3195
|
+
* Set item listend
|
|
3506
3196
|
*
|
|
3197
|
+
* @param {HTMLMgMenuItemElement} item mg-menu-item element
|
|
3198
|
+
* @param {MgMenu['focusedMenuItem']} index number
|
|
3507
3199
|
* @returns {void}
|
|
3508
3200
|
*/
|
|
3509
|
-
this.
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
this.menuItems.forEach((item, index) => {
|
|
3517
|
-
this.closeMenuItem(item, index !== this.focusedMenuItem);
|
|
3518
|
-
});
|
|
3201
|
+
this.setItemListener = (item, index) => {
|
|
3202
|
+
['click', 'focus'].forEach(trigger => {
|
|
3203
|
+
(item.shadowRoot.querySelector('button') || item.shadowRoot.querySelector('a')).addEventListener(trigger, () => {
|
|
3204
|
+
this.focusedMenuItem = index;
|
|
3205
|
+
// reset expanded on previous active menu item
|
|
3206
|
+
(Boolean(this.getItemMoreMenuItem()) ? [...this.menuItems, this.getItemMoreMenuItem()] : this.menuItems).forEach((item, index) => {
|
|
3207
|
+
this.closeMenuItem(item, index !== this.focusedMenuItem);
|
|
3519
3208
|
});
|
|
3520
3209
|
});
|
|
3521
3210
|
});
|
|
3522
3211
|
};
|
|
3523
3212
|
/**
|
|
3524
|
-
*
|
|
3213
|
+
* Store menu-items on component init and add listeners
|
|
3525
3214
|
*
|
|
3526
|
-
* @returns {
|
|
3215
|
+
* @returns {void}
|
|
3527
3216
|
*/
|
|
3528
|
-
this.
|
|
3529
|
-
|
|
3530
|
-
this.menuItems.forEach((
|
|
3531
|
-
|
|
3532
|
-
moreElement.querySelector('mg-menu').appendChild(proxy);
|
|
3533
|
-
});
|
|
3534
|
-
const allMenuItem = Array.from(this.element.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
|
|
3535
|
-
Array.from(moreElement.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
|
|
3536
|
-
// manage click on proxy to mirror it on initial element
|
|
3537
|
-
proxy.addEventListener('click', () => {
|
|
3538
|
-
(allMenuItem[index].shadowRoot.querySelector('a') || allMenuItem[index].shadowRoot.querySelector('button')).dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
3539
|
-
});
|
|
3540
|
-
// manage status change miror in proxy
|
|
3541
|
-
allMenuItem[index].addEventListener('status-change', (event) => {
|
|
3542
|
-
proxy.setAttribute('status', event.detail);
|
|
3543
|
-
});
|
|
3217
|
+
this.initMenuItemsListeners = () => {
|
|
3218
|
+
// add listeners on menu item and edit index
|
|
3219
|
+
this.menuItems.forEach((item, index) => {
|
|
3220
|
+
this.setItemListener(item, index);
|
|
3544
3221
|
});
|
|
3545
|
-
this.element.appendChild(moreElement);
|
|
3546
|
-
return this.element.querySelector(`[${OverflowBehaviorElements.MORE}]`);
|
|
3547
3222
|
};
|
|
3548
3223
|
/**
|
|
3549
|
-
*
|
|
3224
|
+
* Handle item-loaded event on mg-item-more element
|
|
3550
3225
|
*
|
|
3551
|
-
* @returns {
|
|
3226
|
+
* @returns {void}
|
|
3552
3227
|
*/
|
|
3553
|
-
this.
|
|
3554
|
-
|
|
3555
|
-
|
|
3228
|
+
this.handleItemLoaded = () => {
|
|
3229
|
+
this.setItemListener(this.getItemMoreMenuItem(), this.menuItems.length);
|
|
3230
|
+
};
|
|
3231
|
+
/**
|
|
3232
|
+
* render mg-item-more
|
|
3233
|
+
*
|
|
3234
|
+
* @returns {void}
|
|
3235
|
+
*/
|
|
3236
|
+
this.renderMgItemMore = () => {
|
|
3237
|
+
// /!\ externalise item tag name to get a string type and bypass type checking when value is used in next createElement
|
|
3238
|
+
// by doing this we prevent stencil to generate a circular dependencies graph at build time with mg-item-more component.
|
|
3239
|
+
const item = 'mg-item-more';
|
|
3240
|
+
const mgItemMore = document.createElement(item);
|
|
3241
|
+
Object.assign(mgItemMore, this.itemmore);
|
|
3242
|
+
mgItemMore.addEventListener('item-loaded', this.handleItemLoaded);
|
|
3243
|
+
this.element.appendChild(mgItemMore);
|
|
3556
3244
|
};
|
|
3557
3245
|
this.label = undefined;
|
|
3558
|
-
this.direction = Direction.HORIZONTAL;
|
|
3559
|
-
this.
|
|
3246
|
+
this.direction = mgMenu_conf.Direction.HORIZONTAL;
|
|
3247
|
+
this.itemmore = undefined;
|
|
3560
3248
|
this.size = 'regular';
|
|
3561
3249
|
this.isChildMenu = undefined;
|
|
3562
|
-
this.hasOverflow = false;
|
|
3563
3250
|
}
|
|
3564
3251
|
validateLabel(newValue) {
|
|
3565
3252
|
if (newValue === undefined) {
|
|
@@ -3567,21 +3254,18 @@ const MgMenu = class {
|
|
|
3567
3254
|
}
|
|
3568
3255
|
}
|
|
3569
3256
|
validateDirection(newValue) {
|
|
3570
|
-
if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
|
|
3571
|
-
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);
|
|
3257
|
+
if (![mgMenu_conf.Direction.VERTICAL, mgMenu_conf.Direction.HORIZONTAL].includes(newValue)) {
|
|
3258
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${mgMenu_conf.Direction.HORIZONTAL}, ${mgMenu_conf.Direction.VERTICAL}.`);
|
|
3572
3259
|
}
|
|
3573
3260
|
}
|
|
3574
|
-
|
|
3575
|
-
if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {
|
|
3576
|
-
throw new Error(`<${this.name}> prop "
|
|
3577
|
-
}
|
|
3578
|
-
else if (newValue !== undefined && !isMoreItem(newValue)) {
|
|
3579
|
-
throw new Error(`<${this.name}> prop "moreitem" must match MoreItemType.`);
|
|
3261
|
+
validateItemMore(newValue) {
|
|
3262
|
+
if (newValue !== undefined && this.direction !== mgMenu_conf.Direction.HORIZONTAL) {
|
|
3263
|
+
throw new Error(`<${this.name}> prop "itemmore" must be paired with direction ${mgMenu_conf.Direction.HORIZONTAL}.`);
|
|
3580
3264
|
}
|
|
3581
3265
|
}
|
|
3582
3266
|
validateSize(newValue) {
|
|
3583
|
-
if (!sizes
|
|
3584
|
-
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes
|
|
3267
|
+
if (!mgMenu_conf.sizes.includes(newValue)) {
|
|
3268
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${mgMenu_conf.sizes.join(', ')}.`);
|
|
3585
3269
|
}
|
|
3586
3270
|
}
|
|
3587
3271
|
/*************
|
|
@@ -3593,11 +3277,9 @@ const MgMenu = class {
|
|
|
3593
3277
|
* @returns {void}
|
|
3594
3278
|
*/
|
|
3595
3279
|
componentWillLoad() {
|
|
3596
|
-
this.messages = initLocales(this.element).messages.plusMenu;
|
|
3597
|
-
// validation
|
|
3598
3280
|
this.validateDirection(this.direction);
|
|
3599
3281
|
this.validateLabel(this.label);
|
|
3600
|
-
this.
|
|
3282
|
+
this.validateItemMore(this.itemmore);
|
|
3601
3283
|
this.validateSize(this.size);
|
|
3602
3284
|
}
|
|
3603
3285
|
/**
|
|
@@ -3613,53 +3295,57 @@ const MgMenu = class {
|
|
|
3613
3295
|
// store all menu-items
|
|
3614
3296
|
this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
3615
3297
|
this.isChildMenu = this.element.closest('mg-menu-item') !== null;
|
|
3616
|
-
|
|
3617
|
-
if (this.
|
|
3618
|
-
this.
|
|
3298
|
+
// add mg-item-more to manage OverflowBehavior
|
|
3299
|
+
if (this.direction === mgMenu_conf.Direction.HORIZONTAL && !this.isChildMenu)
|
|
3300
|
+
this.renderMgItemMore();
|
|
3301
|
+
// use mutation observer to improve reactivity
|
|
3302
|
+
new MutationObserver(entries => {
|
|
3303
|
+
const mgItemMore = this.getItemMore();
|
|
3304
|
+
// prevent infinit loop by exclude mg-item-more deletion entry
|
|
3305
|
+
if (entries.some(entry => entry.type === 'childList' && Array.from(entry.removedNodes).some(node => node.nodeName === 'MG-ITEM-MORE')))
|
|
3306
|
+
return;
|
|
3307
|
+
else if (mgItemMore !== null) {
|
|
3308
|
+
// render a new mg-item-more
|
|
3309
|
+
mgItemMore.remove();
|
|
3310
|
+
mgItemMore.removeEventListener('item-loaded', this.handleItemLoaded);
|
|
3311
|
+
this.renderMgItemMore();
|
|
3312
|
+
}
|
|
3313
|
+
}).observe(this.element, { childList: true, characterData: true, subtree: true });
|
|
3619
3314
|
}, 0);
|
|
3620
3315
|
}
|
|
3621
3316
|
/**
|
|
3622
|
-
*
|
|
3317
|
+
* Add listeners to items
|
|
3623
3318
|
*
|
|
3624
3319
|
* @returns {void}
|
|
3625
3320
|
*/
|
|
3626
3321
|
componentDidRender() {
|
|
3627
|
-
// add menu items listeners
|
|
3628
3322
|
this.initMenuItemsListeners();
|
|
3629
3323
|
}
|
|
3630
|
-
/**
|
|
3631
|
-
* Disconnect overflow ResizeObserver
|
|
3632
|
-
*
|
|
3633
|
-
* @returns {void} run overflow resize obeserver disconnexion
|
|
3634
|
-
*/
|
|
3635
|
-
disconnectedCallback() {
|
|
3636
|
-
if (this.hasOverflow)
|
|
3637
|
-
this.overflowBehavior.disconnect();
|
|
3638
|
-
}
|
|
3639
3324
|
/**
|
|
3640
3325
|
* Render
|
|
3641
3326
|
*
|
|
3642
3327
|
* @returns {HTMLElement} HTML Element
|
|
3643
3328
|
*/
|
|
3644
3329
|
render() {
|
|
3645
|
-
return (index.h(index.Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, index.h("slot", null)
|
|
3330
|
+
return (index.h(index.Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, index.h("slot", null)));
|
|
3646
3331
|
}
|
|
3647
3332
|
get element() { return index.getElement(this); }
|
|
3648
3333
|
static get watchers() { return {
|
|
3649
3334
|
"label": ["validateLabel"],
|
|
3650
3335
|
"direction": ["validateDirection"],
|
|
3651
|
-
"
|
|
3336
|
+
"itemmore": ["validateItemMore"],
|
|
3652
3337
|
"size": ["validateSize"]
|
|
3653
3338
|
}; }
|
|
3654
3339
|
};
|
|
3655
3340
|
MgMenu.style = mgMenuCss;
|
|
3656
3341
|
|
|
3657
|
-
const mgMenuItemCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding:1rem 2rem;height:calc(3.8rem)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular ::slotted([slot=metadata]){font-size:var(--font-size)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular.mg-menu-item__navigation-button--vertical{padding-left:calc(2rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding:1rem 3rem;height:calc(5.1rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium ::slotted([slot=metadata]){font-size:calc(var(--font-size) + 0.2rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium.mg-menu-item__navigation-button--vertical{padding-left:calc(3rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding:1rem 4rem;height:calc(7.1rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large ::slotted([slot=metadata]){font-size:calc(var(--font-size) + 0.2rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large.mg-menu-item__navigation-button--vertical{padding-left:calc(4rem - 0.3rem)}.mg-menu-item__navigation-button{display:flex;align-items:center;column-gap:var(--mg-menu-item-navigation-button-column-gap, 1rem);background-color:unset;border:none;font-family:var(--font-family);font-weight:400;color:hsl(var(--mg-menu-item-color-hsl, var(--color-dark)));line-height:var(--line-height);text-decoration:none;white-space:nowrap;box-sizing:border-box;cursor:pointer}.mg-menu-item__navigation-button:disabled,.mg-menu-item__navigation-button--disabled{cursor:default;opacity:var(--mg-disabled-opacity)}.mg-menu-item__navigation-button:focus-visible{z-index:10}.mg-menu-item__navigation-button:hover:not(.mg-menu-item__navigation-button--disabled),.mg-menu-item__navigation-button:focus-visible:not(.mg-menu-item__navigation-button--disabled){background-color:hsl(var(--mg-menu-item-focused-background-color-hsl), 0.1)}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active{color:hsl(var(--mg-menu-item-color-active-hsl));font-weight:600}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active.mg-menu-item__navigation-button--horizontal{border-bottom-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active.mg-menu-item__navigation-button--vertical{border-left-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--hidden{display:none}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal{border-bottom:0.3rem solid transparent}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical{border-left:0.3rem solid transparent}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(1 * 2rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(2 * 2rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(3 * 2rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(4 * 2rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(5 * 2rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(6 * 2rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(1 * 3rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(2 * 3rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(3 * 3rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(4 * 3rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(5 * 3rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(6 * 3rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(1 * 4rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(2 * 4rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(3 * 4rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(4 * 4rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(5 * 4rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(6 * 4rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host{position:relative;display:flex;--mg-popover-padding-vertical:0;--mg-popover-padding-horizontal:0}:host([data-style-direction-vertical]){flex-direction:column}:host([data-style-direction-vertical]) .mg-menu-item__navigation-button{width:100%}:host([data-style-direction-vertical]) .mg-menu-item__collapse-container{left:unset;top:unset;position:unset;width:unset}:host([data-style-direction-vertical]) .mg-menu-item-chevron{margin-left:auto}:host([data-style-direction-horizontal]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level{background-color:hsl(var(--color-light))}:host([data-style-direction-horizontal]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level ::slotted(mg-menu){padding:1rem 0}:host([data-overflow-more]){--mg-menu-item-navigation-button-column-gap:0}:host([data-overflow-more]) .mg-menu-item__navigation-button-chevron{display:none}:host([data-overflow-more]) .mg-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:0}:host([data-overflow-more]) ::slotted(mg-menu){--mg-menu-item-navigation-button-column-gap:1rem}.mg-menu-item{max-width:var(--mg-menu-item-navigation-button-max-width)}.mg-menu-item__collapse-container{width:max-content;z-index:10}.mg-menu-item__navigation-button-center{min-width:0}.mg-menu-item__navigation-button-text-content{width:100%;display:flex;align-items:center}.mg-menu-item__navigation-button-text-content-notification,.mg-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:1rem;font-size:var(--font-size)}.mg-menu-item__navigation-button-chevron{margin-left:auto;transition:200ms}.mg-menu-item__navigation-button-chevron--rotate.mg-menu-item__navigation-button-chevron{transform:rotate(180deg)}::slotted([slot=label]),::slotted([slot=metadata]){display:block;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}::slotted(*){display:flex;flex-direction:column}:host([status=disabled]){pointer-events:none}:host([hidden]){display:none}";
|
|
3342
|
+
const mgMenuItemCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding:1rem 2rem;height:3.8rem}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular ::slotted([slot=metadata]){font-size:var(--font-size)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular.mg-menu-item__navigation-button--vertical{padding-left:calc(2rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding:1rem 3rem;height:5.1rem}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium ::slotted([slot=metadata]){font-size:calc(var(--font-size) + 0.2rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium.mg-menu-item__navigation-button--vertical{padding-left:calc(3rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding:1rem 4rem;height:7.1rem}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large ::slotted([slot=metadata]){font-size:calc(var(--font-size) + 0.2rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large.mg-menu-item__navigation-button--vertical{padding-left:calc(4rem - 0.3rem)}.mg-menu-item__navigation-button{display:flex;align-items:center;column-gap:var(--mg-menu-item-navigation-button-column-gap, 1rem);background-color:unset;border:none;font-family:var(--font-family);font-weight:400;color:hsl(var(--mg-menu-item-color-hsl, var(--color-dark)));line-height:var(--line-height);text-decoration:none;white-space:nowrap;box-sizing:border-box;cursor:pointer}.mg-menu-item__navigation-button:disabled,.mg-menu-item__navigation-button--disabled{cursor:default;opacity:var(--mg-disabled-opacity)}.mg-menu-item__navigation-button:focus-visible{z-index:10}.mg-menu-item__navigation-button:hover:not(.mg-menu-item__navigation-button--disabled),.mg-menu-item__navigation-button:focus-visible:not(.mg-menu-item__navigation-button--disabled){background-color:hsl(var(--mg-menu-item-focused-background-color-hsl), 0.1)}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active{color:hsl(var(--mg-menu-item-color-active-hsl));font-weight:600}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active.mg-menu-item__navigation-button--horizontal{border-bottom-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active.mg-menu-item__navigation-button--vertical{border-left-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--hidden{display:none}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal{border-bottom:0.3rem solid transparent}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical{border-left:0.3rem solid transparent}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(1 * 2rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(2 * 2rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(3 * 2rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(4 * 2rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(5 * 2rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(6 * 2rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(1 * 3rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(2 * 3rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(3 * 3rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(4 * 3rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(5 * 3rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(6 * 3rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(1 * 4rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(2 * 4rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(3 * 4rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(4 * 4rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(5 * 4rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(6 * 4rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host{position:relative;display:flex;--mg-popover-padding-vertical:0;--mg-popover-padding-horizontal:0}:host([data-style-direction-vertical]){flex-direction:column}:host([data-style-direction-vertical]) .mg-menu-item__navigation-button{width:100%}:host([data-style-direction-vertical]) .mg-menu-item__collapse-container{left:unset;top:unset;position:unset;width:unset}:host([data-style-direction-vertical]) .mg-menu-item-chevron{margin-left:auto}:host([data-style-direction-horizontal]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level,:host([data-overflow-more]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level{background-color:hsl(var(--color-light))}:host([data-style-direction-horizontal]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level ::slotted(mg-menu),:host([data-overflow-more]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level ::slotted(mg-menu){padding:1rem 0}:host([data-overflow-more]){--mg-menu-item-navigation-button-column-gap:0}:host([data-overflow-more]) .mg-menu-item__navigation-button-chevron{display:none}:host([data-overflow-more]) .mg-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:0}:host([data-overflow-more]) ::slotted(mg-menu){--mg-menu-item-navigation-button-column-gap:1rem}.mg-menu-item{max-width:var(--mg-menu-item-navigation-button-max-width)}.mg-menu-item__collapse-container{width:max-content;z-index:10}.mg-menu-item__navigation-button-center{min-width:0}.mg-menu-item__navigation-button-text-content{width:100%;display:flex;align-items:center}.mg-menu-item__navigation-button-text-content-notification,.mg-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:1rem;font-size:var(--font-size)}.mg-menu-item__navigation-button-chevron{margin-left:auto;transition:200ms}.mg-menu-item__navigation-button-chevron--rotate.mg-menu-item__navigation-button-chevron{transform:rotate(180deg)}::slotted([slot=label]),::slotted([slot=metadata]){display:block;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}::slotted(*){display:flex;flex-direction:column}:host([status=disabled]){pointer-events:none}:host([hidden]){display:none}";
|
|
3658
3343
|
|
|
3659
3344
|
const MgMenuItem = class {
|
|
3660
3345
|
constructor(hostRef) {
|
|
3661
3346
|
index.registerInstance(this, hostRef);
|
|
3662
3347
|
this.statusChange = index.createEvent(this, "status-change", 7);
|
|
3348
|
+
this.itemLoaded = index.createEvent(this, "item-loaded", 7);
|
|
3663
3349
|
/************
|
|
3664
3350
|
* Internal *
|
|
3665
3351
|
************/
|
|
@@ -3688,9 +3374,91 @@ const MgMenuItem = class {
|
|
|
3688
3374
|
* Is component contextual direction match the given direction
|
|
3689
3375
|
*
|
|
3690
3376
|
* @param {MgMenuItem['direction']} direction in parent menu
|
|
3377
|
+
* @param {MgMenuItem['direction']} compareWith direction to compare with. Default: `this.direction`
|
|
3691
3378
|
* @returns {boolean} true is direction match the direction propertie
|
|
3692
3379
|
*/
|
|
3693
|
-
this.isDirection = (direction
|
|
3380
|
+
this.isDirection = (direction, compareWith = this.direction) => direction === compareWith;
|
|
3381
|
+
/**
|
|
3382
|
+
* Update displayNotificationBadge
|
|
3383
|
+
* current component notification badge have priority over the slot badge when submenu contain badge
|
|
3384
|
+
*
|
|
3385
|
+
* @returns {void} update displayNotificationBadge value
|
|
3386
|
+
*/
|
|
3387
|
+
this.updateDisplayNotificationBadge = () => {
|
|
3388
|
+
const childMenu = this.element.querySelector('mg-menu');
|
|
3389
|
+
this.displayNotificationBadge =
|
|
3390
|
+
childMenu !== null &&
|
|
3391
|
+
Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && subItem.getAttribute('hidden') === null);
|
|
3392
|
+
};
|
|
3393
|
+
/**
|
|
3394
|
+
* Method to control if one of component children have active status
|
|
3395
|
+
*
|
|
3396
|
+
* @returns {boolean} truthy if component has active child
|
|
3397
|
+
*/
|
|
3398
|
+
this.hasActiveChild = () => {
|
|
3399
|
+
var _a;
|
|
3400
|
+
return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).some((element) => element.nodeName === 'MG-MENU-ITEM' && this.hasStatus(element, Status$1.ACTIVE) && element.getAttribute('hidden') === null);
|
|
3401
|
+
};
|
|
3402
|
+
/**
|
|
3403
|
+
* Validate slots
|
|
3404
|
+
*
|
|
3405
|
+
* @param {boolean} guard prevent action whith guard. Default: false.
|
|
3406
|
+
* @returns {void}
|
|
3407
|
+
*/
|
|
3408
|
+
this.validateSlot = (guard = false) => {
|
|
3409
|
+
// slot title AND metadata validation
|
|
3410
|
+
// add title on label AND metada slots due to text-overflow on these element
|
|
3411
|
+
if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined)
|
|
3412
|
+
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
3413
|
+
['label', 'metadata'].forEach(slot => {
|
|
3414
|
+
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
3415
|
+
if (element.textContent.trim().length < 1)
|
|
3416
|
+
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
3417
|
+
if ((guard && element.getAttribute('title') === null) || !guard)
|
|
3418
|
+
element.setAttribute('title', element.textContent);
|
|
3419
|
+
});
|
|
3420
|
+
});
|
|
3421
|
+
};
|
|
3422
|
+
/**
|
|
3423
|
+
* Update status
|
|
3424
|
+
*
|
|
3425
|
+
* @param {Status[]} guard status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
|
|
3426
|
+
* @returns {void}
|
|
3427
|
+
*/
|
|
3428
|
+
this.updateStatus = (guard = []) => {
|
|
3429
|
+
if (![Status$1.HIDDEN, Status$1.DISABLED, ...guard].includes(this.status)) {
|
|
3430
|
+
this.status = this.hasActiveChild() ? Status$1.ACTIVE : Status$1.VISIBLE;
|
|
3431
|
+
}
|
|
3432
|
+
};
|
|
3433
|
+
/**
|
|
3434
|
+
* Init event-listeners
|
|
3435
|
+
*
|
|
3436
|
+
* @returns {void}
|
|
3437
|
+
*/
|
|
3438
|
+
this.initListeners = () => {
|
|
3439
|
+
var _a;
|
|
3440
|
+
// manage first sub-level menu-items
|
|
3441
|
+
Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).forEach(item => {
|
|
3442
|
+
if (item.nodeName === 'MG-MENU-ITEM') {
|
|
3443
|
+
// manage child menu listener
|
|
3444
|
+
item.addEventListener('status-change', () => {
|
|
3445
|
+
this.updateStatus();
|
|
3446
|
+
});
|
|
3447
|
+
}
|
|
3448
|
+
});
|
|
3449
|
+
};
|
|
3450
|
+
/**
|
|
3451
|
+
* Get mg-popover identifier
|
|
3452
|
+
*
|
|
3453
|
+
* @returns {MgPopover['identifier']} generated mg-popover identifier
|
|
3454
|
+
*/
|
|
3455
|
+
this.getPopoverIdentifier = () => `${this.identifier}-popover`;
|
|
3456
|
+
/**
|
|
3457
|
+
* Condition to know if component should display a mg-popover
|
|
3458
|
+
*
|
|
3459
|
+
* @returns {boolean} truthy if component display popover
|
|
3460
|
+
*/
|
|
3461
|
+
this.displayPopover = () => this.isDirection(mgMenu_conf.Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
|
|
3694
3462
|
/************
|
|
3695
3463
|
* Handlers *
|
|
3696
3464
|
************/
|
|
@@ -3718,35 +3486,13 @@ const MgMenuItem = class {
|
|
|
3718
3486
|
this.handlePopoverDisplay = (event) => {
|
|
3719
3487
|
this.expanded = event.detail;
|
|
3720
3488
|
};
|
|
3721
|
-
/**
|
|
3722
|
-
* Update displayNotificationBadge
|
|
3723
|
-
* current component notification badge have priority over the slot badge when submenu contain badge
|
|
3724
|
-
*
|
|
3725
|
-
* @returns {void} update displayNotificationBadge value
|
|
3726
|
-
*/
|
|
3727
|
-
this.updateDisplayNotificationBadge = () => {
|
|
3728
|
-
const childMenu = this.element.querySelector('mg-menu');
|
|
3729
|
-
this.displayNotificationBadge =
|
|
3730
|
-
childMenu !== null &&
|
|
3731
|
-
Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && subItem.getAttribute('hidden') === null);
|
|
3732
|
-
};
|
|
3733
|
-
/**
|
|
3734
|
-
* Method to control if one of component children have active status
|
|
3735
|
-
*
|
|
3736
|
-
* @returns {boolean} truthy if component has active child
|
|
3737
|
-
*/
|
|
3738
|
-
this.hasActiveChild = () => {
|
|
3739
|
-
var _a;
|
|
3740
|
-
return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || [])
|
|
3741
|
-
.filter(element => element.nodeName === 'MG-MENU-ITEM')
|
|
3742
|
-
.some((element) => this.hasStatus(element, Status$1.ACTIVE) && element.getAttribute('hidden') === null);
|
|
3743
|
-
};
|
|
3744
3489
|
/**
|
|
3745
3490
|
* Render slot
|
|
3746
3491
|
*
|
|
3747
3492
|
* @returns {HTMLElement} HTML Element
|
|
3748
3493
|
*/
|
|
3749
3494
|
this.renderSlot = () => index.h("slot", null);
|
|
3495
|
+
this.identifier = createID('mg-menu-item');
|
|
3750
3496
|
this.href = undefined;
|
|
3751
3497
|
this.status = Status$1.VISIBLE;
|
|
3752
3498
|
this.expanded = false;
|
|
@@ -3754,6 +3500,7 @@ const MgMenuItem = class {
|
|
|
3754
3500
|
this.navigationButtonClassList = new ClassList([this.navigationButton]);
|
|
3755
3501
|
this.direction = undefined;
|
|
3756
3502
|
this.isInMainMenu = undefined;
|
|
3503
|
+
this.isItemMore = undefined;
|
|
3757
3504
|
this.hasChildren = false;
|
|
3758
3505
|
this.displayNotificationBadge = undefined;
|
|
3759
3506
|
}
|
|
@@ -3790,11 +3537,33 @@ const MgMenuItem = class {
|
|
|
3790
3537
|
this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);
|
|
3791
3538
|
this.navigationButtonClassList.add(`${this.navigationButton}--size-${newValue}`);
|
|
3792
3539
|
}
|
|
3540
|
+
validateDirection(newValue) {
|
|
3541
|
+
// manage menu items style depending to parent menu horientation
|
|
3542
|
+
this.element.setAttribute(`data-style-direction-${newValue}`, '');
|
|
3543
|
+
this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
|
|
3544
|
+
// manage all sub levels child menu-items level with data-level attribut
|
|
3545
|
+
if (this.isDirection(mgMenu_conf.Direction.VERTICAL, newValue)) {
|
|
3546
|
+
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
|
|
3547
|
+
item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3793
3551
|
validateHasChildren(newValue) {
|
|
3794
3552
|
if (newValue && this.element.href !== undefined) {
|
|
3795
3553
|
throw new Error(`<${this.name}> prop "href" is unauthorizied when element is a parent.`);
|
|
3796
3554
|
}
|
|
3797
3555
|
}
|
|
3556
|
+
/**
|
|
3557
|
+
* Render popover clickoutside guard for content slot
|
|
3558
|
+
*
|
|
3559
|
+
* @returns {void}
|
|
3560
|
+
*/
|
|
3561
|
+
updatePopoverGuard() {
|
|
3562
|
+
if (this.displayPopover())
|
|
3563
|
+
Array.from(this.element.children)
|
|
3564
|
+
.filter((child) => child.getAttribute('slot') === null && child.nodeName !== 'MG-MENU' && Boolean(child.dataset))
|
|
3565
|
+
.forEach((slot) => (slot.dataset.mgPopoverGuard = this.getPopoverIdentifier()));
|
|
3566
|
+
}
|
|
3798
3567
|
/*************
|
|
3799
3568
|
* Lifecycle *
|
|
3800
3569
|
*************/
|
|
@@ -3807,11 +3576,13 @@ const MgMenuItem = class {
|
|
|
3807
3576
|
// has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
|
|
3808
3577
|
// we store only matching elements
|
|
3809
3578
|
this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));
|
|
3579
|
+
this.badgeLabel = mgMenu_conf.initLocales(this.element).messages.plusMenu.badgeLabel;
|
|
3580
|
+
this.isItemMore = this.element.dataset.overflowMore !== undefined;
|
|
3810
3581
|
// Validate props
|
|
3811
|
-
this.validateSize(this.size);
|
|
3812
3582
|
this.validateStatus(this.status);
|
|
3813
3583
|
this.validateExpanded(this.expanded);
|
|
3814
|
-
|
|
3584
|
+
// Validate states
|
|
3585
|
+
this.validateSize(this.size);
|
|
3815
3586
|
}
|
|
3816
3587
|
/**
|
|
3817
3588
|
* Check if component slots configuration
|
|
@@ -3819,63 +3590,38 @@ const MgMenuItem = class {
|
|
|
3819
3590
|
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
3820
3591
|
*/
|
|
3821
3592
|
componentDidLoad() {
|
|
3822
|
-
//
|
|
3823
|
-
|
|
3824
|
-
if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined)
|
|
3825
|
-
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
3826
|
-
['label', 'metadata'].forEach(slot => {
|
|
3827
|
-
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
3828
|
-
if (element.textContent.trim().length < 1)
|
|
3829
|
-
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
3830
|
-
if (element.getAttribute('title') === null)
|
|
3831
|
-
element.setAttribute('title', element.textContent);
|
|
3832
|
-
});
|
|
3833
|
-
});
|
|
3593
|
+
// validation
|
|
3594
|
+
this.validateSlot(true);
|
|
3834
3595
|
// update props and states after componentDidLoad hook
|
|
3835
3596
|
// return a promise to process action only in the FIRST render().
|
|
3836
3597
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
3837
3598
|
return setTimeout(() => {
|
|
3838
|
-
var _a;
|
|
3839
3599
|
// define menu-item context states
|
|
3840
3600
|
const menu = this.element.closest('mg-menu');
|
|
3841
|
-
this.direction = this.
|
|
3842
|
-
this.
|
|
3843
|
-
|
|
3601
|
+
this.direction = this.isItemMore || menu === null ? mgMenu_conf.Direction.HORIZONTAL : menu.direction;
|
|
3602
|
+
this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;
|
|
3603
|
+
if ((menu === null || menu === void 0 ? void 0 : menu.size) !== undefined)
|
|
3604
|
+
this.size = menu.size;
|
|
3605
|
+
if (this.isItemMore)
|
|
3606
|
+
this.size = this.element.dataset.size;
|
|
3844
3607
|
// when main menu item contain an active item it will get the active style
|
|
3845
3608
|
// AND if item is in vertical menu it will be expanded
|
|
3846
|
-
if (this.hasActiveChild())
|
|
3847
|
-
this.
|
|
3848
|
-
|
|
3849
|
-
this.expanded = this.isDirection(Direction.VERTICAL);
|
|
3850
|
-
}
|
|
3851
|
-
// manage menu items style depending to parent menu horientation
|
|
3852
|
-
this.element.setAttribute(`data-style-direction-${this.direction}`, '');
|
|
3853
|
-
this.navigationButtonClassList.add(`${this.navigationButton}--${this.direction}`);
|
|
3609
|
+
if (this.hasActiveChild() && this.isInMainMenu)
|
|
3610
|
+
this.expanded = this.isDirection(mgMenu_conf.Direction.VERTICAL);
|
|
3611
|
+
this.updateStatus([Status$1.ACTIVE]);
|
|
3854
3612
|
this.updateDisplayNotificationBadge();
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
}
|
|
3868
|
-
};
|
|
3869
|
-
// manage child menu listener
|
|
3870
|
-
item.addEventListener('status-change', () => {
|
|
3871
|
-
updateStatus();
|
|
3872
|
-
});
|
|
3873
|
-
new MutationObserver(mutationsList => {
|
|
3874
|
-
if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
|
|
3875
|
-
updateStatus();
|
|
3876
|
-
this.updateDisplayNotificationBadge();
|
|
3877
|
-
}).observe(item, { attributes: true });
|
|
3878
|
-
});
|
|
3613
|
+
this.updatePopoverGuard();
|
|
3614
|
+
// manage child dom changes with mutationObserver and listzners
|
|
3615
|
+
this.initListeners();
|
|
3616
|
+
// emit loaded event when component is fully loaded
|
|
3617
|
+
this.itemLoaded.emit();
|
|
3618
|
+
new MutationObserver(mutationsList => {
|
|
3619
|
+
if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
|
|
3620
|
+
this.updateStatus();
|
|
3621
|
+
if (mutationsList.some(mutation => mutation.type === 'characterData'))
|
|
3622
|
+
this.validateSlot();
|
|
3623
|
+
this.updateDisplayNotificationBadge();
|
|
3624
|
+
}).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });
|
|
3879
3625
|
}, 0);
|
|
3880
3626
|
}
|
|
3881
3627
|
/**
|
|
@@ -3899,9 +3645,9 @@ const MgMenuItem = class {
|
|
|
3899
3645
|
render() {
|
|
3900
3646
|
const getContainerClasses = () => ({
|
|
3901
3647
|
[`${this.name}__collapse-container`]: true,
|
|
3902
|
-
[`${this.name}__collapse-container--first-level`]: this.isInMainMenu && this.isDirection(Direction.HORIZONTAL),
|
|
3648
|
+
[`${this.name}__collapse-container--first-level`]: (this.isInMainMenu || this.isItemMore) && this.isDirection(mgMenu_conf.Direction.HORIZONTAL),
|
|
3903
3649
|
});
|
|
3904
|
-
return (index.h(index.Host, { role:
|
|
3650
|
+
return (index.h(index.Host, { role: !this.isItemMore && 'menuitem', "aria-haspopup": !this.isItemMore && this.hasChildren.toString() }, this.displayPopover() ? (index.h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier() }, this.renderInteractiveElement(), index.h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
3905
3651
|
this.renderInteractiveElement(),
|
|
3906
3652
|
index.h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
3907
3653
|
])));
|
|
@@ -3911,6 +3657,7 @@ const MgMenuItem = class {
|
|
|
3911
3657
|
"status": ["validateStatus"],
|
|
3912
3658
|
"expanded": ["validateExpanded"],
|
|
3913
3659
|
"size": ["validateSize"],
|
|
3660
|
+
"direction": ["validateDirection"],
|
|
3914
3661
|
"hasChildren": ["validateHasChildren"]
|
|
3915
3662
|
}; }
|
|
3916
3663
|
};
|
|
@@ -4061,7 +3808,7 @@ const MgMessage = class {
|
|
|
4061
3808
|
*/
|
|
4062
3809
|
componentWillLoad() {
|
|
4063
3810
|
// Get locales
|
|
4064
|
-
this.messages = initLocales(this.element).messages;
|
|
3811
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
4065
3812
|
// Validate
|
|
4066
3813
|
this.validateVariant(this.variant);
|
|
4067
3814
|
// Check if close button is an can be activated
|
|
@@ -4195,7 +3942,7 @@ const MgModal = class {
|
|
|
4195
3942
|
// Store body overflow
|
|
4196
3943
|
this.bodyOverflow = document.body.style.overflow;
|
|
4197
3944
|
// Get locales
|
|
4198
|
-
this.messages = initLocales(this.element).messages;
|
|
3945
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
4199
3946
|
// Validate
|
|
4200
3947
|
this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
|
|
4201
3948
|
this.hasContent = this.element.querySelector('[slot="content"]') !== null;
|
|
@@ -4333,7 +4080,7 @@ const MgPagination = class {
|
|
|
4333
4080
|
*/
|
|
4334
4081
|
componentWillLoad() {
|
|
4335
4082
|
// Get locales
|
|
4336
|
-
this.messages = initLocales(this.element).messages;
|
|
4083
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
4337
4084
|
// Validate
|
|
4338
4085
|
this.validateTotalPages(this.totalPages);
|
|
4339
4086
|
this.validateCurrentPage(this.currentPage);
|
|
@@ -4490,7 +4237,7 @@ const MgPanel = class {
|
|
|
4490
4237
|
*/
|
|
4491
4238
|
componentWillLoad() {
|
|
4492
4239
|
// Get locales
|
|
4493
|
-
this.messages = initLocales(this.element).messages;
|
|
4240
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
4494
4241
|
// Validate
|
|
4495
4242
|
this.validatetitlePattern(this.titlePattern);
|
|
4496
4243
|
this.validatePanelTitle(this.panelTitle);
|
|
@@ -6422,7 +6169,7 @@ const MgPopover = class {
|
|
|
6422
6169
|
// Get windows to attach events
|
|
6423
6170
|
this.windows = getWindows(window);
|
|
6424
6171
|
// Get locales
|
|
6425
|
-
this.messages = initLocales(this.element).messages;
|
|
6172
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
6426
6173
|
this.validateArrowHide(this.arrowHide);
|
|
6427
6174
|
}
|
|
6428
6175
|
/**
|
|
@@ -6537,7 +6284,7 @@ const MgSkipLinks = class {
|
|
|
6537
6284
|
*/
|
|
6538
6285
|
componentWillLoad() {
|
|
6539
6286
|
this.validateLinks(this.links);
|
|
6540
|
-
this.messages = initLocales(this.element).messages;
|
|
6287
|
+
this.messages = mgMenu_conf.initLocales(this.element).messages;
|
|
6541
6288
|
}
|
|
6542
6289
|
/**
|
|
6543
6290
|
* Render
|
|
@@ -6569,7 +6316,7 @@ var Status;
|
|
|
6569
6316
|
*/
|
|
6570
6317
|
const sizes = ['regular', 'large'];
|
|
6571
6318
|
|
|
6572
|
-
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular{padding:1rem 2rem
|
|
6319
|
+
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular{padding:1rem 2rem}.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button ::slotted([slot=label]),.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button ::slotted([slot=metadata]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular ::slotted([slot=label]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular ::slotted([slot=metadata]){font-size:var(--font-size)}.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button.mg-tabs__navigation-button--horizontal,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular.mg-tabs__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button.mg-tabs__navigation-button--vertical,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular.mg-tabs__navigation-button--vertical{padding-left:calc(2rem - 0.3rem)}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large{padding:1.5rem 3rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button,.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button ::slotted([slot=label]),.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button ::slotted([slot=metadata]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large ::slotted([slot=label]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large ::slotted([slot=metadata]){font-size:calc(var(--font-size) + 0.2rem)}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button.mg-tabs__navigation-button--horizontal,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large.mg-tabs__navigation-button--horizontal{padding-bottom:calc(1.5rem - 0.3rem)}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button.mg-tabs__navigation-button--vertical,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large.mg-tabs__navigation-button--vertical{padding-left:calc(3rem - 0.3rem)}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:var(--mg-tabs-navigation-button-column-gap, 1rem);background-color:unset;border:none;font-family:var(--font-family);font-weight:400;color:hsl(var(--mg-tabs-color-hsl, var(--color-dark)));line-height:var(--line-height);text-decoration:none;white-space:nowrap;box-sizing:border-box;cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:var(--mg-disabled-opacity)}.mg-tabs__navigation-button:focus-visible{z-index:10}.mg-tabs__navigation-button:hover:not(.mg-tabs__navigation-button--disabled),.mg-tabs__navigation-button:focus-visible:not(.mg-tabs__navigation-button--disabled){background-color:hsl(var(--mg-tabs-focused-background-color-hsl), 0.1)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--mg-tabs-color-active-hsl));font-weight:600}.mg-tabs__navigation-button.mg-tabs__navigation-button--active.mg-tabs__navigation-button--horizontal{border-bottom-color:hsl(var(--mg-tabs-border-color-active-hsl))}.mg-tabs__navigation-button.mg-tabs__navigation-button--active.mg-tabs__navigation-button--vertical{border-left-color:hsl(var(--mg-tabs-border-color-active-hsl))}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__navigation-button.mg-tabs__navigation-button--horizontal{border-bottom:0.3rem solid transparent}.mg-tabs__navigation-button.mg-tabs__navigation-button--vertical{border-left:0.3rem solid transparent}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__content-container:focus-visible{outline:none}.mg-tabs__navigation-button-text{flex:0 0 content}";
|
|
6573
6320
|
|
|
6574
6321
|
/**
|
|
6575
6322
|
* type TabItem validation function
|
|
@@ -7066,6 +6813,7 @@ const MgTooltip = class {
|
|
|
7066
6813
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
7067
6814
|
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
7068
6815
|
}
|
|
6816
|
+
this.popper.update();
|
|
7069
6817
|
}
|
|
7070
6818
|
handleDisplay(newValue) {
|
|
7071
6819
|
if (newValue) {
|
|
@@ -7097,10 +6845,13 @@ const MgTooltip = class {
|
|
|
7097
6845
|
this.tooltipedElement = interactiveElement || slotElement;
|
|
7098
6846
|
// Check if slotted element is a disabled mg-button
|
|
7099
6847
|
// In this case we wrap the mg-button into a div to enable the tooltip
|
|
7100
|
-
if (
|
|
6848
|
+
if (['MG-BUTTON', 'BUTTON'].includes(slotElement.tagName)) {
|
|
7101
6849
|
new MutationObserver(mutationList => {
|
|
7102
|
-
if (mutationList.some(mutation =>
|
|
6850
|
+
if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) {
|
|
7103
6851
|
this.setMgButtonWrapper(slotElement);
|
|
6852
|
+
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
6853
|
+
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
6854
|
+
this.resetGuard();
|
|
7104
6855
|
this.initTooltip(slotElement, interactiveElement);
|
|
7105
6856
|
}
|
|
7106
6857
|
}).observe(slotElement, { attributes: true });
|