@mgdis/mg-components 5.10.0 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-9e1091ab.js → index-03d2557d.js} +3 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_31.cjs.entry.js +444 -455
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-item-more.cjs.entry.js +20 -29
- package/dist/cjs/{mg-menu.conf-1942ac70.js → mg-menu.conf-05ec32a3.js} +30 -16
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +8 -9
- package/dist/collection/components/atoms/mg-button/mg-button.js +16 -20
- package/dist/collection/components/atoms/mg-card/mg-card.css +2 -0
- package/dist/collection/components/atoms/mg-card/mg-card.js +10 -12
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -19
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -13
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +20 -25
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +26 -18
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +18 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +126 -19
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -12
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -22
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -18
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -32
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +16 -31
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +13 -17
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -23
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -18
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -29
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -15
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -19
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -2
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -7
- package/dist/collection/components/molecules/mg-message/mg-message.css +1 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -14
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -11
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -13
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +6 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +16 -16
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -24
- package/dist/collection/locales/en/messages.json +7 -0
- package/dist/collection/locales/fr/messages.json +7 -0
- package/dist/collection/locales/index.js +2 -2
- package/dist/collection/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/collection/utils/behaviors.utils.js +16 -22
- package/dist/collection/utils/components.utils.js +21 -23
- package/dist/collection/utils/locale.utils.js +14 -14
- package/dist/collection/utils/unit.test.utils.js +7 -10
- package/dist/components/MgInput.js +30 -18
- package/dist/components/components.utils.js +21 -23
- package/dist/components/index2.js +30 -16
- package/dist/components/mg-action-more.js +9 -13
- package/dist/components/mg-badge2.js +8 -9
- package/dist/components/mg-button2.js +16 -20
- package/dist/components/mg-card2.js +9 -11
- package/dist/components/mg-character-left2.js +1 -2
- package/dist/components/mg-details.js +1 -3
- package/dist/components/mg-divider.js +1 -1
- package/dist/components/mg-form.js +7 -15
- package/dist/components/mg-icon2.js +17 -19
- package/dist/components/mg-illustrated-message.js +1 -2
- package/dist/components/mg-input-checkbox.js +126 -21
- package/dist/components/mg-input-date.js +7 -9
- package/dist/components/mg-input-numeric.js +14 -19
- package/dist/components/mg-input-password.js +6 -7
- package/dist/components/mg-input-radio.js +10 -15
- package/dist/components/mg-input-select2.js +21 -29
- package/dist/components/mg-input-text2.js +15 -24
- package/dist/components/mg-input-textarea.js +13 -14
- package/dist/components/mg-input-title2.js +1 -2
- package/dist/components/mg-input-toggle.js +17 -20
- package/dist/components/mg-item-more.js +18 -27
- package/dist/components/mg-menu-item2.js +17 -26
- package/dist/components/mg-menu2.js +9 -16
- package/dist/components/mg-message.js +12 -15
- package/dist/components/mg-modal.js +8 -12
- package/dist/components/mg-pagination.js +11 -13
- package/dist/components/mg-panel.js +7 -16
- package/dist/components/mg-popover2.js +17 -17
- package/dist/components/mg-skip-links.js +2 -4
- package/dist/components/mg-tabs.js +20 -24
- package/dist/components/mg-tag.js +11 -13
- package/dist/components/mg-tooltip2.js +20 -25
- package/dist/esm/{index-3249671d.js → index-407d5211.js} +3 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_31.entry.js +444 -455
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-item-more.entry.js +20 -29
- package/dist/esm/{mg-menu.conf-2cc1bb67.js → mg-menu.conf-c8aa56ce.js} +30 -16
- package/dist/mg-components/locales/en/messages.json +7 -0
- package/dist/mg-components/locales/fr/messages.json +7 -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-3bf533f7.js +2 -0
- package/dist/mg-components/p-51c2def3.entry.js +1 -0
- package/dist/mg-components/p-b14be68b.js +1 -0
- package/dist/mg-components/{p-a56a3157.entry.js → p-d3ed97d3.entry.js} +1 -1
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -3
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -9
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +2 -6
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -2
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -5
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -5
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +15 -21
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -5
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +8 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +40 -7
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -6
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -14
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -4
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -10
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +9 -13
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -12
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -5
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -6
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -18
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -31
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -10
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -3
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -11
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -2
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -7
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -7
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -7
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -9
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -13
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +7 -9
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -4
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -19
- package/dist/types/components.d.ts +31 -35
- package/dist/types/locales/index.d.ts +16 -2
- package/dist/types/utils/behaviors.utils.d.ts +14 -20
- package/dist/types/utils/components.utils.d.ts +18 -20
- package/dist/types/utils/locale.utils.d.ts +14 -14
- package/dist/types/utils/unit.test.utils.d.ts +11 -17
- package/package.json +4 -4
- package/dist/mg-components/p-73156ac9.js +0 -1
- package/dist/mg-components/p-8fbc0d87.js +0 -2
- package/dist/mg-components/p-eb32bb18.entry.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create random ID
|
|
3
|
-
* @param
|
|
4
|
-
* @param
|
|
5
|
-
* @returns
|
|
3
|
+
* @param prefix - add prefix to created ID
|
|
4
|
+
* @param length - ID length
|
|
5
|
+
* @returns ID
|
|
6
6
|
*/
|
|
7
7
|
const createID = (prefix = '', length = 10) => {
|
|
8
8
|
let ID = '';
|
|
@@ -21,8 +21,7 @@ class ClassList {
|
|
|
21
21
|
constructor(classlist = []) {
|
|
22
22
|
/**
|
|
23
23
|
* Add class
|
|
24
|
-
* @param
|
|
25
|
-
* @returns {void}
|
|
24
|
+
* @param className - class name to add
|
|
26
25
|
*/
|
|
27
26
|
this.add = (className) => {
|
|
28
27
|
if (!this.has(className)) {
|
|
@@ -31,8 +30,7 @@ class ClassList {
|
|
|
31
30
|
};
|
|
32
31
|
/**
|
|
33
32
|
* Delete class
|
|
34
|
-
* @param
|
|
35
|
-
* @returns {void}
|
|
33
|
+
* @param className - class name to delete
|
|
36
34
|
*/
|
|
37
35
|
this.delete = (className) => {
|
|
38
36
|
const index = this.classes.indexOf(className);
|
|
@@ -42,15 +40,15 @@ class ClassList {
|
|
|
42
40
|
};
|
|
43
41
|
/**
|
|
44
42
|
* Check if class exist in list
|
|
45
|
-
* @param
|
|
46
|
-
* @returns
|
|
43
|
+
* @param className - class name to check
|
|
44
|
+
* @returns class name is in the list
|
|
47
45
|
*/
|
|
48
46
|
this.has = (className) => {
|
|
49
47
|
return this.classes.includes(className);
|
|
50
48
|
};
|
|
51
49
|
/**
|
|
52
50
|
* Join classes seperated by spaces
|
|
53
|
-
* @returns
|
|
51
|
+
* @returns joined values
|
|
54
52
|
*/
|
|
55
53
|
this.join = () => {
|
|
56
54
|
return this.classes.join(' ');
|
|
@@ -60,15 +58,15 @@ class ClassList {
|
|
|
60
58
|
}
|
|
61
59
|
/**
|
|
62
60
|
* Check if all items are string
|
|
63
|
-
* @param
|
|
64
|
-
* @returns
|
|
61
|
+
* @param items - items to check
|
|
62
|
+
* @returns all items are string
|
|
65
63
|
*/
|
|
66
64
|
const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
|
|
67
65
|
/**
|
|
68
66
|
* Check if element is a heading
|
|
69
|
-
* @param
|
|
70
|
-
* @param
|
|
71
|
-
* @returns
|
|
67
|
+
* @param element - slotted element
|
|
68
|
+
* @param tagNames - allowed tag names list
|
|
69
|
+
* @returns element is a heading
|
|
72
70
|
*/
|
|
73
71
|
const isTagName = (element, tagNames) => {
|
|
74
72
|
return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
|
|
@@ -79,8 +77,8 @@ const isTagName = (element, tagNames) => {
|
|
|
79
77
|
const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
|
|
80
78
|
/**
|
|
81
79
|
* Get windows
|
|
82
|
-
* @param
|
|
83
|
-
* @returns
|
|
80
|
+
* @param localWindow - the window we are lookink for other windows
|
|
81
|
+
* @returns The list of windows found
|
|
84
82
|
*/
|
|
85
83
|
const getWindows = (localWindow) => {
|
|
86
84
|
const parentWindows = getParentWindows(localWindow);
|
|
@@ -89,9 +87,9 @@ const getWindows = (localWindow) => {
|
|
|
89
87
|
};
|
|
90
88
|
/**
|
|
91
89
|
* Get parent windows
|
|
92
|
-
* @param
|
|
93
|
-
* @param
|
|
94
|
-
* @returns
|
|
90
|
+
* @param localWindow - the window we are lookink for parents
|
|
91
|
+
* @param windows - The list of allready found windows
|
|
92
|
+
* @returns The list of windows found
|
|
95
93
|
*/
|
|
96
94
|
const getParentWindows = (localWindow, windows = []) => {
|
|
97
95
|
// Check if is in iframe
|
|
@@ -111,9 +109,9 @@ const getParentWindows = (localWindow, windows = []) => {
|
|
|
111
109
|
};
|
|
112
110
|
/**
|
|
113
111
|
* Get child windows
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
116
|
-
* @returns
|
|
112
|
+
* @param localWindow - the window we are lookink for children
|
|
113
|
+
* @param windows - The list of allready found windows
|
|
114
|
+
* @returns The list of windows found
|
|
117
115
|
*/
|
|
118
116
|
const getChildWindows = (localWindow, windows = []) => {
|
|
119
117
|
if (localWindow.frames.length > 0) {
|
|
@@ -16,6 +16,13 @@ const nbCharLeft$1 = "{counter} characters left.";
|
|
|
16
16
|
const input$1 = {
|
|
17
17
|
select: {
|
|
18
18
|
placeholder: "Select a value"
|
|
19
|
+
},
|
|
20
|
+
checkbox: {
|
|
21
|
+
selectedValues: "{nb} selected values",
|
|
22
|
+
selectedValue: "{nb} selected value",
|
|
23
|
+
editButton: "Edit",
|
|
24
|
+
selectButton: "Select values",
|
|
25
|
+
showButton: "Show"
|
|
19
26
|
}
|
|
20
27
|
};
|
|
21
28
|
const form$1 = {
|
|
@@ -91,6 +98,13 @@ const nbCharLeft = "{counter} caractères disponibles.";
|
|
|
91
98
|
const input = {
|
|
92
99
|
select: {
|
|
93
100
|
placeholder: "Sélectionnez une valeur"
|
|
101
|
+
},
|
|
102
|
+
checkbox: {
|
|
103
|
+
selectedValues: "{nb} valeurs selectionnées",
|
|
104
|
+
selectedValue: "{nb} valeur selectionnée",
|
|
105
|
+
editButton: "Modifier",
|
|
106
|
+
selectButton: "Sélectionner des valeurs",
|
|
107
|
+
showButton: "Voir"
|
|
94
108
|
}
|
|
95
109
|
};
|
|
96
110
|
const form = {
|
|
@@ -150,19 +164,19 @@ const fr = {
|
|
|
150
164
|
|
|
151
165
|
/**
|
|
152
166
|
* Format number to the locale currency
|
|
153
|
-
* @param
|
|
154
|
-
* @param
|
|
155
|
-
* @param
|
|
156
|
-
* @returns
|
|
167
|
+
* @param number - number to format
|
|
168
|
+
* @param locale - locale to apply
|
|
169
|
+
* @param currency - currency to apply
|
|
170
|
+
* @returns formatted currency
|
|
157
171
|
*/
|
|
158
172
|
const localeCurrency = (number, locale, currency) => {
|
|
159
173
|
return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);
|
|
160
174
|
};
|
|
161
175
|
/**
|
|
162
176
|
* Format number to locale
|
|
163
|
-
* @param
|
|
164
|
-
* @param
|
|
165
|
-
* @returns
|
|
177
|
+
* @param number - number to format
|
|
178
|
+
* @param locale - locale to apply
|
|
179
|
+
* @returns formatted number
|
|
166
180
|
*/
|
|
167
181
|
const localeNumber = (number, locale) => {
|
|
168
182
|
return new Intl.NumberFormat(locale).format(number);
|
|
@@ -173,9 +187,9 @@ const localeNumber = (number, locale) => {
|
|
|
173
187
|
const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
174
188
|
/**
|
|
175
189
|
* Locale date format
|
|
176
|
-
* @param
|
|
177
|
-
* @param
|
|
178
|
-
* @returns
|
|
190
|
+
* @param date - date to format
|
|
191
|
+
* @param locale - locale to apply
|
|
192
|
+
* @returns formatted date
|
|
179
193
|
*/
|
|
180
194
|
const localeDate = (date, locale) => {
|
|
181
195
|
if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {
|
|
@@ -186,10 +200,10 @@ const localeDate = (date, locale) => {
|
|
|
186
200
|
/**
|
|
187
201
|
* Get locale and messages
|
|
188
202
|
* We load the defined locale but for now we only support the first subtag for messages
|
|
189
|
-
* @param
|
|
190
|
-
* @param
|
|
191
|
-
* @param
|
|
192
|
-
* @returns
|
|
203
|
+
* @param element - element we need to get the language
|
|
204
|
+
* @param messages - messages to use
|
|
205
|
+
* @param defaultLocale - default messages locale
|
|
206
|
+
* @returns messages object
|
|
193
207
|
*/
|
|
194
208
|
const getLocaleMessages = (element, messages, defaultLocale) => {
|
|
195
209
|
// Get local
|
|
@@ -209,8 +223,8 @@ const defaultLocale = 'en';
|
|
|
209
223
|
const messages = { en, fr };
|
|
210
224
|
/**
|
|
211
225
|
* Get Intl object
|
|
212
|
-
* @param
|
|
213
|
-
* @returns
|
|
226
|
+
* @param element - element we need to get the language
|
|
227
|
+
* @returns messages object
|
|
214
228
|
*/
|
|
215
229
|
const initLocales = (element) => getLocaleMessages(element, messages, defaultLocale);
|
|
216
230
|
|
|
@@ -14,8 +14,8 @@ const mgActionMoreCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* MgActionMore['items'] type guard
|
|
17
|
-
* @param
|
|
18
|
-
* @returns
|
|
17
|
+
* @param prop - commponent items prop
|
|
18
|
+
* @returns return true if type is valid
|
|
19
19
|
*/
|
|
20
20
|
const isMgActionMoreItems = (prop) => {
|
|
21
21
|
const items = prop;
|
|
@@ -23,8 +23,8 @@ const isMgActionMoreItems = (prop) => {
|
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* MgActionMore['button'] type guard
|
|
26
|
-
* @param
|
|
27
|
-
* @returns
|
|
26
|
+
* @param prop - commponent button prop
|
|
27
|
+
* @returns return true if type is valid
|
|
28
28
|
*/
|
|
29
29
|
const isMgActionMoreButton = (prop) => {
|
|
30
30
|
const button = prop;
|
|
@@ -32,8 +32,8 @@ const isMgActionMoreButton = (prop) => {
|
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
34
|
* MgActionMore['icon'] type guard
|
|
35
|
-
* @param
|
|
36
|
-
* @returns
|
|
35
|
+
* @param prop - commponent icon prop
|
|
36
|
+
* @returns return true if type is valid
|
|
37
37
|
*/
|
|
38
38
|
const isMgActionMoreIcon = (prop) => {
|
|
39
39
|
const icon = prop;
|
|
@@ -54,23 +54,20 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
54
54
|
***********/
|
|
55
55
|
/**
|
|
56
56
|
* Toogle expanded props
|
|
57
|
-
* @returns {void}
|
|
58
57
|
*/
|
|
59
58
|
this.toggleExpanded = () => {
|
|
60
59
|
this.expanded = !this.expanded;
|
|
61
60
|
};
|
|
62
61
|
/**
|
|
63
62
|
* Button click handler
|
|
64
|
-
* @returns {void}
|
|
65
63
|
*/
|
|
66
64
|
this.handleButton = () => {
|
|
67
65
|
this.toggleExpanded();
|
|
68
66
|
};
|
|
69
67
|
/**
|
|
70
68
|
* Item click handler
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @returns {void}
|
|
69
|
+
* @param event - click event
|
|
70
|
+
* @param customHandler - item['mouseEventHandler']
|
|
74
71
|
*/
|
|
75
72
|
this.handleItemClick = (event, customHandler) => {
|
|
76
73
|
this.expanded = false;
|
|
@@ -107,7 +104,6 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
107
104
|
*************/
|
|
108
105
|
/**
|
|
109
106
|
* Validate props
|
|
110
|
-
* @returns {void}
|
|
111
107
|
*/
|
|
112
108
|
componentWillLoad() {
|
|
113
109
|
this.messages = initLocales(this.element).messages.actionMore;
|
|
@@ -118,7 +114,7 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
118
114
|
}
|
|
119
115
|
/**
|
|
120
116
|
* Render
|
|
121
|
-
* @returns
|
|
117
|
+
* @returns HTML Element
|
|
122
118
|
*/
|
|
123
119
|
render() {
|
|
124
120
|
const buttonLabel = this.button.label || this.messages.label;
|
|
@@ -22,7 +22,7 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
22
22
|
this.label = undefined;
|
|
23
23
|
this.variant = variants[0];
|
|
24
24
|
this.outline = undefined;
|
|
25
|
-
this.
|
|
25
|
+
this.classCollection = new ClassList(['mg-badge']);
|
|
26
26
|
}
|
|
27
27
|
validateValue(newValue) {
|
|
28
28
|
if (`${newValue}`.match(/^(\d+\+*|[?*!a-z])$/i) === null) {
|
|
@@ -40,20 +40,19 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
42
|
if (oldValue !== undefined) {
|
|
43
|
-
this.
|
|
43
|
+
this.classCollection.delete(`mg-badge--${oldValue}`);
|
|
44
44
|
}
|
|
45
|
-
this.
|
|
45
|
+
this.classCollection.add(`mg-badge--${newValue}`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
validateOutline(newValue) {
|
|
49
49
|
if (newValue)
|
|
50
|
-
this.
|
|
50
|
+
this.classCollection.add(this.classOutline);
|
|
51
51
|
else
|
|
52
|
-
this.
|
|
52
|
+
this.classCollection.delete(this.classOutline);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Check if props are well configured on init
|
|
56
|
-
* @returns {void}
|
|
57
56
|
*/
|
|
58
57
|
componentWillLoad() {
|
|
59
58
|
this.validateValue(this.value);
|
|
@@ -63,10 +62,10 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
63
62
|
}
|
|
64
63
|
/**
|
|
65
64
|
* Render
|
|
66
|
-
* @returns
|
|
65
|
+
* @returns HTML Element
|
|
67
66
|
*/
|
|
68
67
|
render() {
|
|
69
|
-
return (h("span", { class: this.
|
|
68
|
+
return (h("span", { class: this.classCollection.join() }, h("span", { class: "mg-badge__value" }, this.value), h("span", { class: "sr-only" }, this.label)));
|
|
70
69
|
}
|
|
71
70
|
static get watchers() { return {
|
|
72
71
|
"value": ["validateValue"],
|
|
@@ -80,7 +79,7 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
80
79
|
"label": [1],
|
|
81
80
|
"variant": [1],
|
|
82
81
|
"outline": [4],
|
|
83
|
-
"
|
|
82
|
+
"classCollection": [32]
|
|
84
83
|
}]);
|
|
85
84
|
function defineCustomElement() {
|
|
86
85
|
if (typeof customElements === "undefined") {
|
|
@@ -24,8 +24,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
24
24
|
this.classFullWidth = 'mg-button--full-width';
|
|
25
25
|
/**
|
|
26
26
|
* Trigger actions onClick event
|
|
27
|
-
* @param
|
|
28
|
-
* @returns {void}
|
|
27
|
+
* @param event - click event
|
|
29
28
|
*/
|
|
30
29
|
this.handleClick = (event) => {
|
|
31
30
|
if (this.disabled)
|
|
@@ -38,8 +37,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
38
37
|
};
|
|
39
38
|
/**
|
|
40
39
|
* Handle onKeydown event
|
|
41
|
-
* @param
|
|
42
|
-
* @returns {void}
|
|
40
|
+
* @param event - keyboard event
|
|
43
41
|
*/
|
|
44
42
|
this.handleKeydown = (event) => {
|
|
45
43
|
if (!this.disabled && event.key === ' ') {
|
|
@@ -52,8 +50,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
52
50
|
};
|
|
53
51
|
/**
|
|
54
52
|
* Handle onKeyup event
|
|
55
|
-
* @param
|
|
56
|
-
* @returns {void}
|
|
53
|
+
* @param event - keyboard event
|
|
57
54
|
*/
|
|
58
55
|
this.handleKeyup = (event) => {
|
|
59
56
|
if (!this.disabled && event.key === ' ') {
|
|
@@ -71,7 +68,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
71
68
|
this.isIcon = false;
|
|
72
69
|
this.disableOnClick = false;
|
|
73
70
|
this.loading = false;
|
|
74
|
-
this.
|
|
71
|
+
this.classCollection = new ClassList(['mg-button']);
|
|
75
72
|
}
|
|
76
73
|
validateVariant(newValue, oldValue) {
|
|
77
74
|
if (!variants.includes(newValue)) {
|
|
@@ -79,9 +76,9 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
79
76
|
}
|
|
80
77
|
else {
|
|
81
78
|
if (oldValue !== undefined) {
|
|
82
|
-
this.
|
|
79
|
+
this.classCollection.delete(`mg-button--${oldValue}`);
|
|
83
80
|
}
|
|
84
|
-
this.
|
|
81
|
+
this.classCollection.add(`mg-button--${newValue}`);
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
84
|
validateFullWidth(newValue) {
|
|
@@ -89,10 +86,10 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
89
86
|
throw new Error('<mg-button> prop "fullWidth" cannot be used with prop "isIcon".');
|
|
90
87
|
}
|
|
91
88
|
else if (newValue) {
|
|
92
|
-
this.
|
|
89
|
+
this.classCollection.add(this.classFullWidth);
|
|
93
90
|
}
|
|
94
91
|
else {
|
|
95
|
-
this.
|
|
92
|
+
this.classCollection.delete(this.classFullWidth);
|
|
96
93
|
}
|
|
97
94
|
}
|
|
98
95
|
disabledHandler(isDisabled) {
|
|
@@ -105,10 +102,10 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
105
102
|
this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
|
|
106
103
|
// apply style
|
|
107
104
|
if (isDisabled) {
|
|
108
|
-
this.
|
|
105
|
+
this.classCollection.add(this.classDisabled);
|
|
109
106
|
}
|
|
110
107
|
else {
|
|
111
|
-
this.
|
|
108
|
+
this.classCollection.delete(this.classDisabled);
|
|
112
109
|
}
|
|
113
110
|
// emit value update
|
|
114
111
|
this.disabledChange.emit(isDisabled);
|
|
@@ -116,21 +113,20 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
116
113
|
loadingHandler(newValue) {
|
|
117
114
|
// we add loading style if it newvalue is true else we remove it
|
|
118
115
|
if (newValue) {
|
|
119
|
-
this.
|
|
116
|
+
this.classCollection.add(this.classLoading);
|
|
120
117
|
}
|
|
121
118
|
else {
|
|
122
|
-
this.
|
|
119
|
+
this.classCollection.delete(this.classLoading);
|
|
123
120
|
}
|
|
124
121
|
}
|
|
125
122
|
/**
|
|
126
123
|
* Check if props are well configured on init
|
|
127
|
-
* @returns {void}
|
|
128
124
|
*/
|
|
129
125
|
componentWillLoad() {
|
|
130
126
|
this.validateVariant(this.variant);
|
|
131
127
|
this.validateFullWidth(this.fullWidth);
|
|
132
128
|
if (this.isIcon) {
|
|
133
|
-
this.
|
|
129
|
+
this.classCollection.add(`mg-button--icon`);
|
|
134
130
|
if (typeof this.label !== 'string' || this.label.trim() === '') {
|
|
135
131
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
136
132
|
}
|
|
@@ -141,10 +137,10 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
141
137
|
}
|
|
142
138
|
/**
|
|
143
139
|
* Render component
|
|
144
|
-
* @returns
|
|
140
|
+
* @returns html element
|
|
145
141
|
*/
|
|
146
142
|
render() {
|
|
147
|
-
return (h(Host, { role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { class: this.
|
|
143
|
+
return (h(Host, { role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { class: this.classCollection.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
|
|
148
144
|
}
|
|
149
145
|
get element() { return this; }
|
|
150
146
|
static get watchers() { return {
|
|
@@ -165,7 +161,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
165
161
|
"isIcon": [4, "is-icon"],
|
|
166
162
|
"disableOnClick": [4, "disable-on-click"],
|
|
167
163
|
"loading": [32],
|
|
168
|
-
"
|
|
164
|
+
"classCollection": [32]
|
|
169
165
|
}]);
|
|
170
166
|
function defineCustomElement() {
|
|
171
167
|
if (typeof customElements === "undefined") {
|
|
@@ -10,7 +10,7 @@ const variants = ['info', 'warning', 'success', 'danger', 'app'];
|
|
|
10
10
|
*/
|
|
11
11
|
const variantStyles = ['bar-left', 'fill'];
|
|
12
12
|
|
|
13
|
-
const mgCardCss = ".mg-card{position:relative;width:100%;max-width:var(--mg-card-max-width);padding:var(--mg-card-padding, var(--mg-card-padding-default));overflow:var(--mg-card-overflow, var(--mg-card-overflow-default));box-sizing:border-box;z-index:inherit;background:var(--mg-card-background, var(--mg-card-background-default));border:var(--mg-card-border, var(--mg-card-border-default));border-radius:var(--mg-card-border-radius, var(--mg-card-border-radius-default));box-shadow:var(--mg-card-box-shadow, var(--mg-card-box-shadow-default))}.mg-card ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset}.mg-card.mg-card--info{overflow:hidden}.mg-card.mg-card--info.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-card.mg-card--info.mg-card--fill{background-color:hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l))}.mg-card.mg-card--warning{overflow:hidden}.mg-card.mg-card--warning.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--color-warning-l))}.mg-card.mg-card--warning.mg-card--fill{background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l))}.mg-card.mg-card--success{overflow:hidden}.mg-card.mg-card--success.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-card.mg-card--success.mg-card--fill{background-color:hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l))}.mg-card.mg-card--danger{overflow:hidden}.mg-card.mg-card--danger.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-card.mg-card--danger.mg-card--fill{background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l))}.mg-card.mg-card--app{overflow:hidden}.mg-card.mg-card--app.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-app-l))}.mg-card.mg-card--app.mg-card--fill{background-color:hsl(var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-soft-l))}.mg-card__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}";
|
|
13
|
+
const mgCardCss = ".mg-card{position:relative;width:100%;max-width:var(--mg-card-max-width);min-width:var(--mg-card-min-width);padding:var(--mg-card-padding, var(--mg-card-padding-default));overflow:var(--mg-card-overflow, var(--mg-card-overflow-default));box-sizing:border-box;z-index:inherit;background:var(--mg-card-background, var(--mg-card-background-default));border:var(--mg-card-border, var(--mg-card-border-default));border-radius:var(--mg-card-border-radius, var(--mg-card-border-radius-default));box-shadow:var(--mg-card-box-shadow, var(--mg-card-box-shadow-default))}.mg-card ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset;--mg-card-min-width:unset}.mg-card.mg-card--info{overflow:hidden}.mg-card.mg-card--info.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-card.mg-card--info.mg-card--fill{background-color:hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l))}.mg-card.mg-card--warning{overflow:hidden}.mg-card.mg-card--warning.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--color-warning-l))}.mg-card.mg-card--warning.mg-card--fill{background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l))}.mg-card.mg-card--success{overflow:hidden}.mg-card.mg-card--success.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-card.mg-card--success.mg-card--fill{background-color:hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l))}.mg-card.mg-card--danger{overflow:hidden}.mg-card.mg-card--danger.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-card.mg-card--danger.mg-card--fill{background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l))}.mg-card.mg-card--app{overflow:hidden}.mg-card.mg-card--app.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-app-l))}.mg-card.mg-card--app.mg-card--fill{background-color:hsl(var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-soft-l))}.mg-card__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}";
|
|
14
14
|
|
|
15
15
|
const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
16
16
|
constructor() {
|
|
@@ -25,7 +25,6 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
25
25
|
/**
|
|
26
26
|
* Methode to set default varianStyle props
|
|
27
27
|
* needeed has stencil doesn't know that props is mutated when updated in prop watcher
|
|
28
|
-
* @returns {void}
|
|
29
28
|
*/
|
|
30
29
|
this.setDefaultVariantStyle = () => {
|
|
31
30
|
if (this.variantStyle === undefined)
|
|
@@ -33,17 +32,17 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
33
32
|
};
|
|
34
33
|
this.variant = undefined;
|
|
35
34
|
this.variantStyle = undefined;
|
|
36
|
-
this.
|
|
35
|
+
this.classCollection = new ClassList([this.baseClass]);
|
|
37
36
|
}
|
|
38
37
|
validateVariant(newValue, oldValue) {
|
|
39
38
|
if (newValue && !variants.includes(newValue))
|
|
40
39
|
throw new Error(`<${this.name}> prop "variant" must match VariantType type.`);
|
|
41
40
|
if (Boolean(newValue)) {
|
|
42
41
|
this.setDefaultVariantStyle();
|
|
43
|
-
this.
|
|
42
|
+
this.classCollection.add(`${this.baseClass}--${newValue}`);
|
|
44
43
|
}
|
|
45
44
|
if (Boolean(oldValue))
|
|
46
|
-
this.
|
|
45
|
+
this.classCollection.delete(`${this.baseClass}--${oldValue}`);
|
|
47
46
|
}
|
|
48
47
|
validateVariantStyle(newValue, oldValue) {
|
|
49
48
|
if (newValue && !variantStyles.includes(newValue))
|
|
@@ -51,16 +50,15 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
51
50
|
else if (Boolean(newValue) && !variants.includes(this.variant))
|
|
52
51
|
throw new Error(`<${this.name}> prop "variantStyle" must be paired with ${JSON.stringify(variants)} "variant" prop.`);
|
|
53
52
|
if (Boolean(newValue))
|
|
54
|
-
this.
|
|
53
|
+
this.classCollection.add(`${this.baseClass}--${newValue}`);
|
|
55
54
|
if (Boolean(oldValue))
|
|
56
|
-
this.
|
|
55
|
+
this.classCollection.delete(`${this.baseClass}--${oldValue}`);
|
|
57
56
|
}
|
|
58
57
|
/*************
|
|
59
58
|
* Lifecycle *
|
|
60
59
|
*************/
|
|
61
60
|
/**
|
|
62
61
|
* Check if props are well configured on init
|
|
63
|
-
* @returns {void}
|
|
64
62
|
*/
|
|
65
63
|
componentWillLoad() {
|
|
66
64
|
this.validateVariant(this.variant);
|
|
@@ -68,11 +66,11 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
68
66
|
}
|
|
69
67
|
/**
|
|
70
68
|
* Render
|
|
71
|
-
* @returns
|
|
69
|
+
* @returns HTML Element
|
|
72
70
|
*/
|
|
73
71
|
render() {
|
|
74
72
|
var _a;
|
|
75
|
-
return (h("div", { class: this.
|
|
73
|
+
return (h("div", { class: this.classCollection.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && h("span", { class: "mg-card__bar" }), h("slot", null)));
|
|
76
74
|
}
|
|
77
75
|
static get watchers() { return {
|
|
78
76
|
"variant": ["validateVariant"],
|
|
@@ -82,7 +80,7 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
82
80
|
}, [1, "mg-card", {
|
|
83
81
|
"variant": [1],
|
|
84
82
|
"variantStyle": [1025, "variant-style"],
|
|
85
|
-
"
|
|
83
|
+
"classCollection": [32]
|
|
86
84
|
}]);
|
|
87
85
|
function defineCustomElement() {
|
|
88
86
|
if (typeof customElements === "undefined") {
|
|
@@ -21,7 +21,6 @@ const MgCharacterLeft = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
21
21
|
*************/
|
|
22
22
|
/**
|
|
23
23
|
* Check if props are well configured on init
|
|
24
|
-
* @returns {void}
|
|
25
24
|
*/
|
|
26
25
|
componentWillLoad() {
|
|
27
26
|
this.validateMaxlength(this.maxlength);
|
|
@@ -29,7 +28,7 @@ const MgCharacterLeft = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* Render component
|
|
32
|
-
* @returns
|
|
31
|
+
* @returns HTML Element
|
|
33
32
|
*/
|
|
34
33
|
render() {
|
|
35
34
|
return (h("span", { id: this.identifier, "aria-live": "polite" }, h("span", { "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { class: "sr-only" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
|
|
@@ -11,7 +11,6 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
11
11
|
this.expandedChange = createEvent(this, "expanded-change", 7);
|
|
12
12
|
/**
|
|
13
13
|
* Handle details toggle
|
|
14
|
-
* @returns {void}
|
|
15
14
|
*/
|
|
16
15
|
this.handleToggle = () => {
|
|
17
16
|
this.expanded = this.details.open;
|
|
@@ -34,7 +33,6 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
34
33
|
*************/
|
|
35
34
|
/**
|
|
36
35
|
* Check if component props are well configured on init
|
|
37
|
-
* @returns {void}
|
|
38
36
|
*/
|
|
39
37
|
componentWillLoad() {
|
|
40
38
|
this.validateTitles(this.toggleClosed);
|
|
@@ -42,7 +40,7 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
42
40
|
}
|
|
43
41
|
/**
|
|
44
42
|
* Render
|
|
45
|
-
* @returns
|
|
43
|
+
* @returns HTML Element
|
|
46
44
|
*/
|
|
47
45
|
render() {
|
|
48
46
|
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|