@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.
Files changed (159) hide show
  1. package/dist/cjs/{index-9e1091ab.js → index-03d2557d.js} +3 -0
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/mg-action-more_31.cjs.entry.js +444 -455
  4. package/dist/cjs/mg-components.cjs.js +2 -2
  5. package/dist/cjs/mg-item-more.cjs.entry.js +20 -29
  6. package/dist/cjs/{mg-menu.conf-1942ac70.js → mg-menu.conf-05ec32a3.js} +30 -16
  7. package/dist/collection/components/atoms/mg-badge/mg-badge.js +8 -9
  8. package/dist/collection/components/atoms/mg-button/mg-button.js +16 -20
  9. package/dist/collection/components/atoms/mg-card/mg-card.css +2 -0
  10. package/dist/collection/components/atoms/mg-card/mg-card.js +10 -12
  11. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -2
  12. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  13. package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -19
  14. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -2
  15. package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -13
  16. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +20 -25
  17. package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
  18. package/dist/collection/components/molecules/inputs/MgInput.js +26 -18
  19. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +4 -1
  20. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +18 -1
  21. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +126 -19
  22. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +1 -1
  23. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -12
  24. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -22
  26. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
  28. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +1 -1
  29. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -18
  30. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +1 -1
  31. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -32
  32. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +1 -1
  33. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +16 -31
  34. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +1 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +13 -17
  36. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -1
  37. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -23
  38. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -18
  39. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -29
  40. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -15
  41. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -3
  42. package/dist/collection/components/molecules/mg-form/mg-form.js +8 -19
  43. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -2
  44. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -7
  45. package/dist/collection/components/molecules/mg-message/mg-message.css +1 -0
  46. package/dist/collection/components/molecules/mg-message/mg-message.js +11 -14
  47. package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
  48. package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -11
  49. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -13
  50. package/dist/collection/components/molecules/mg-panel/mg-panel.css +1 -0
  51. package/dist/collection/components/molecules/mg-panel/mg-panel.js +6 -15
  52. package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
  53. package/dist/collection/components/molecules/mg-popover/mg-popover.js +16 -16
  54. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -4
  55. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -24
  56. package/dist/collection/locales/en/messages.json +7 -0
  57. package/dist/collection/locales/fr/messages.json +7 -0
  58. package/dist/collection/locales/index.js +2 -2
  59. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +1 -0
  60. package/dist/collection/utils/behaviors.utils.js +16 -22
  61. package/dist/collection/utils/components.utils.js +21 -23
  62. package/dist/collection/utils/locale.utils.js +14 -14
  63. package/dist/collection/utils/unit.test.utils.js +7 -10
  64. package/dist/components/MgInput.js +30 -18
  65. package/dist/components/components.utils.js +21 -23
  66. package/dist/components/index2.js +30 -16
  67. package/dist/components/mg-action-more.js +9 -13
  68. package/dist/components/mg-badge2.js +8 -9
  69. package/dist/components/mg-button2.js +16 -20
  70. package/dist/components/mg-card2.js +9 -11
  71. package/dist/components/mg-character-left2.js +1 -2
  72. package/dist/components/mg-details.js +1 -3
  73. package/dist/components/mg-divider.js +1 -1
  74. package/dist/components/mg-form.js +7 -15
  75. package/dist/components/mg-icon2.js +17 -19
  76. package/dist/components/mg-illustrated-message.js +1 -2
  77. package/dist/components/mg-input-checkbox.js +126 -21
  78. package/dist/components/mg-input-date.js +7 -9
  79. package/dist/components/mg-input-numeric.js +14 -19
  80. package/dist/components/mg-input-password.js +6 -7
  81. package/dist/components/mg-input-radio.js +10 -15
  82. package/dist/components/mg-input-select2.js +21 -29
  83. package/dist/components/mg-input-text2.js +15 -24
  84. package/dist/components/mg-input-textarea.js +13 -14
  85. package/dist/components/mg-input-title2.js +1 -2
  86. package/dist/components/mg-input-toggle.js +17 -20
  87. package/dist/components/mg-item-more.js +18 -27
  88. package/dist/components/mg-menu-item2.js +17 -26
  89. package/dist/components/mg-menu2.js +9 -16
  90. package/dist/components/mg-message.js +12 -15
  91. package/dist/components/mg-modal.js +8 -12
  92. package/dist/components/mg-pagination.js +11 -13
  93. package/dist/components/mg-panel.js +7 -16
  94. package/dist/components/mg-popover2.js +17 -17
  95. package/dist/components/mg-skip-links.js +2 -4
  96. package/dist/components/mg-tabs.js +20 -24
  97. package/dist/components/mg-tag.js +11 -13
  98. package/dist/components/mg-tooltip2.js +20 -25
  99. package/dist/esm/{index-3249671d.js → index-407d5211.js} +3 -0
  100. package/dist/esm/loader.js +3 -3
  101. package/dist/esm/mg-action-more_31.entry.js +444 -455
  102. package/dist/esm/mg-components.js +3 -3
  103. package/dist/esm/mg-item-more.entry.js +20 -29
  104. package/dist/esm/{mg-menu.conf-2cc1bb67.js → mg-menu.conf-c8aa56ce.js} +30 -16
  105. package/dist/mg-components/locales/en/messages.json +7 -0
  106. package/dist/mg-components/locales/fr/messages.json +7 -0
  107. package/dist/mg-components/mg-components.css +1 -1
  108. package/dist/mg-components/mg-components.esm.js +1 -1
  109. package/dist/mg-components/p-3bf533f7.js +2 -0
  110. package/dist/mg-components/p-51c2def3.entry.js +1 -0
  111. package/dist/mg-components/p-b14be68b.js +1 -0
  112. package/dist/mg-components/{p-a56a3157.entry.js → p-d3ed97d3.entry.js} +1 -1
  113. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
  114. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -3
  115. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -9
  116. package/dist/types/components/atoms/mg-card/mg-card.d.ts +2 -6
  117. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -2
  118. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
  119. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -5
  120. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -2
  121. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -5
  122. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +15 -21
  123. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
  124. package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -5
  125. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +8 -0
  126. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +40 -7
  127. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -6
  128. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -14
  129. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -4
  130. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -10
  131. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
  132. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +9 -13
  133. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -12
  134. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -5
  135. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -6
  136. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -18
  137. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -31
  138. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -10
  139. package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -3
  140. package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -11
  141. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -2
  142. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -7
  143. package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -7
  144. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -7
  145. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -9
  146. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -13
  147. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +7 -9
  148. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -4
  149. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -19
  150. package/dist/types/components.d.ts +31 -35
  151. package/dist/types/locales/index.d.ts +16 -2
  152. package/dist/types/utils/behaviors.utils.d.ts +14 -20
  153. package/dist/types/utils/components.utils.d.ts +18 -20
  154. package/dist/types/utils/locale.utils.d.ts +14 -14
  155. package/dist/types/utils/unit.test.utils.d.ts +11 -17
  156. package/package.json +4 -4
  157. package/dist/mg-components/p-73156ac9.js +0 -1
  158. package/dist/mg-components/p-8fbc0d87.js +0 -2
  159. package/dist/mg-components/p-eb32bb18.entry.js +0 -1
@@ -15,13 +15,11 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
15
  this.classAllRequired = 'mg-form--all-required';
16
16
  /**
17
17
  * Define required message based on mg-inputs required elements
18
- * Also
19
- * @returns {void}
20
18
  */
21
19
  this.setRequiredMessage = () => {
22
20
  // init required message
23
21
  this.requiredMessage = null;
24
- this.classList.delete(this.classAllRequired);
22
+ this.classCollection.delete(this.classAllRequired);
25
23
  // If the form is disabled or readonly none of them are required
26
24
  // Check if all fields are not editable (readonly or disabled)
27
25
  if (!this.disabled && !this.readonly && !this.mgInputs.every(input => input.disabled || input.readonly)) {
@@ -31,7 +29,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
31
29
  // mg-input-toggle can not be required
32
30
  if (requiredInputs.length > 0 && requiredInputs.length === this.mgInputs.filter(input => input.nodeName !== 'MG-INPUT-TOGGLE').length) {
33
31
  this.requiredMessage = requiredInputs.length === 1 ? this.messages.form.allRequiredSingle : this.messages.form.allRequired;
34
- this.classList.add(this.classAllRequired);
32
+ this.classCollection.add(this.classAllRequired);
35
33
  }
36
34
  // Some fields are required
37
35
  else if (requiredInputs.length > 0) {
@@ -41,7 +39,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
41
39
  };
42
40
  /**
43
41
  * Check if form is valid
44
- * @returns {void}
45
42
  */
46
43
  this.checkValidity = () => {
47
44
  // Update required on input event
@@ -53,8 +50,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
53
50
  };
54
51
  /**
55
52
  * Handle Form Submit
56
- * @param {SubmitEvent} event submit event
57
- * @returns {void}
53
+ * @param event - submit event
58
54
  */
59
55
  this.handleFormSubmit = (event) => {
60
56
  event.preventDefault();
@@ -62,7 +58,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
62
58
  };
63
59
  /**
64
60
  * Set mgInputs
65
- * @returns {void}
66
61
  */
67
62
  this.setMgInputs = () => {
68
63
  // Get slotted mgInputs
@@ -84,7 +79,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
84
79
  this.disabled = false;
85
80
  this.valid = undefined;
86
81
  this.invalid = undefined;
87
- this.classList = new ClassList(['mg-form']);
82
+ this.classCollection = new ClassList(['mg-form']);
88
83
  this.requiredMessage = undefined;
89
84
  }
90
85
  handleAttributeChange() {
@@ -93,7 +88,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
93
88
  }
94
89
  /**
95
90
  * Public method to display errors
96
- * @returns {Promise<void>}
97
91
  */
98
92
  async displayError() {
99
93
  if (!this.readonly) {
@@ -108,7 +102,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
108
102
  *************/
109
103
  /**
110
104
  * Check if component props are well configured on init
111
- * @returns {void}
112
105
  */
113
106
  componentWillLoad() {
114
107
  // Get locales
@@ -135,7 +128,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
135
128
  }
136
129
  /**
137
130
  * Add slot listeners
138
- * @returns {void}
139
131
  */
140
132
  componentDidLoad() {
141
133
  this.mgButtons.forEach(mgButton => {
@@ -153,10 +145,10 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
153
145
  }
154
146
  /**
155
147
  * Render
156
- * @returns {HTMLElement} HTML Element
148
+ * @returns HTML Element
157
149
  */
158
150
  render() {
159
- return (h("form", { class: this.classList.join(), id: this.identifier, name: this.name, ref: el => (this.form = el), onSubmit: this.handleFormSubmit }, this.requiredMessage && h("p", { innerHTML: this.requiredMessage }), h("slot", null), !this.readonly && !this.disabled && h("slot", { name: "actions" })));
151
+ return (h("form", { class: this.classCollection.join(), id: this.identifier, name: this.name, ref: el => (this.form = el), onSubmit: this.handleFormSubmit }, this.requiredMessage && h("p", { innerHTML: this.requiredMessage }), h("slot", null), !this.readonly && !this.disabled && h("slot", { name: "actions" })));
160
152
  }
161
153
  get element() { return this; }
162
154
  static get watchers() { return {
@@ -171,7 +163,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
171
163
  "disabled": [4],
172
164
  "valid": [1028],
173
165
  "invalid": [1028],
174
- "classList": [32],
166
+ "classCollection": [32],
175
167
  "requiredMessage": [32],
176
168
  "displayError": [64]
177
169
  }]);
@@ -240,13 +240,12 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
240
240
  this.__attachShadow();
241
241
  /**
242
242
  * getIcon
243
- * @returns {HTMLElement} icon html
243
+ * @returns icon html
244
244
  */
245
245
  this.getIcon = () => icons[this.icon]();
246
246
  /**
247
247
  * Method to set default varianStyle props
248
248
  * needeed has stencil doesn't know that props is mutated when updated in prop watcher
249
- * @returns {void}
250
249
  */
251
250
  this.setDefaultVariantStyle = () => {
252
251
  if (this.variantStyle === undefined)
@@ -257,15 +256,15 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
257
256
  this.variant = undefined;
258
257
  this.variantStyle = undefined;
259
258
  this.spin = false;
260
- this.classList = new ClassList(['mg-icon']);
259
+ this.classCollection = new ClassList(['mg-icon']);
261
260
  }
262
261
  validateIcon(newValue, oldValue) {
263
262
  if (!Object.keys(icons).includes(newValue))
264
263
  throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}`);
265
264
  else {
266
265
  if (oldValue !== undefined)
267
- this.classList.delete(`mg-icon--${oldValue}`);
268
- this.classList.add(`mg-icon--${newValue}`);
266
+ this.classCollection.delete(`mg-icon--${oldValue}`);
267
+ this.classCollection.add(`mg-icon--${newValue}`);
269
268
  }
270
269
  }
271
270
  validateSize(newValue, oldValue) {
@@ -273,8 +272,8 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
273
272
  throw new Error(`<mg-icon> prop "size" must be one of: ${sizes.join(', ')}`);
274
273
  else {
275
274
  if (oldValue !== undefined)
276
- this.classList.delete(`mg-icon--size-${oldValue}`);
277
- this.classList.add(`mg-icon--size-${newValue}`);
275
+ this.classCollection.delete(`mg-icon--size-${oldValue}`);
276
+ this.classCollection.add(`mg-icon--size-${newValue}`);
278
277
  }
279
278
  }
280
279
  validateVariant(newValue, oldValue) {
@@ -284,8 +283,8 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
284
283
  else {
285
284
  this.setDefaultVariantStyle();
286
285
  if (oldValue !== undefined)
287
- this.classList.delete(`mg-icon--variant-${oldValue}`);
288
- this.classList.add(`mg-icon--variant-${newValue}`);
286
+ this.classCollection.delete(`mg-icon--variant-${oldValue}`);
287
+ this.classCollection.add(`mg-icon--variant-${newValue}`);
289
288
  }
290
289
  }
291
290
  }
@@ -295,24 +294,23 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
295
294
  throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles.join(', ')}`);
296
295
  else {
297
296
  if (oldValue !== undefined)
298
- this.classList.delete(`mg-icon--variant-style-${oldValue}`);
299
- this.classList.add(`mg-icon--variant-style-${newValue}`);
297
+ this.classCollection.delete(`mg-icon--variant-style-${oldValue}`);
298
+ this.classCollection.add(`mg-icon--variant-style-${newValue}`);
300
299
  }
301
300
  }
302
301
  }
303
302
  handleSpin(newValue) {
304
303
  if (newValue) {
305
- this.classList.add('mg-icon--spin');
306
- this.classList.add('mg-a11y-animation');
304
+ this.classCollection.add('mg-icon--spin');
305
+ this.classCollection.add('mg-a11y-animation');
307
306
  }
308
307
  else {
309
- this.classList.delete('mg-icon--spin');
310
- this.classList.delete('mg-a11y-animation');
308
+ this.classCollection.delete('mg-icon--spin');
309
+ this.classCollection.delete('mg-a11y-animation');
311
310
  }
312
311
  }
313
312
  /**
314
313
  * Check if props are well configured on init
315
- * @returns {void}
316
314
  */
317
315
  componentWillLoad() {
318
316
  this.validateIcon(this.icon);
@@ -323,10 +321,10 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
323
321
  }
324
322
  /**
325
323
  * Render component
326
- * @returns {HTMLElement} HTML Element
324
+ * @returns HTML Element
327
325
  */
328
326
  render() {
329
- return (h("svg", { class: this.classList.join(), "aria-hidden": "true", focusable: "false", viewBox: "0 0 16 16" }, this.getIcon()));
327
+ return (h("svg", { class: this.classCollection.join(), "aria-hidden": "true", focusable: "false", viewBox: "0 0 16 16" }, this.getIcon()));
330
328
  }
331
329
  static get watchers() { return {
332
330
  "icon": ["validateIcon"],
@@ -342,7 +340,7 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
342
340
  "variant": [1],
343
341
  "variantStyle": [1025, "variant-style"],
344
342
  "spin": [4],
345
- "classList": [32]
343
+ "classCollection": [32]
346
344
  }]);
347
345
  function defineCustomElement() {
348
346
  if (typeof customElements === "undefined") {
@@ -16,7 +16,6 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
16
16
  *************/
17
17
  /**
18
18
  * Check if component props are well configured on init
19
- * @returns {void}
20
19
  */
21
20
  componentDidLoad() {
22
21
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
@@ -31,7 +30,7 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
31
30
  }
32
31
  /**
33
32
  * Render
34
- * @returns {HTMLElement} HTML Element
33
+ * @returns HTML Element
35
34
  */
36
35
  render() {
37
36
  return (h("div", { class: {
@@ -2,16 +2,24 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
2
2
  import { M as MgInput } from './MgInput.js';
3
3
  import { C as ClassList } from './components.utils.js';
4
4
  import { i as initLocales } from './index2.js';
5
- import { d as defineCustomElement$4 } from './mg-icon2.js';
6
- import { d as defineCustomElement$3 } from './mg-input-title2.js';
5
+ import { d as defineCustomElement$7 } from './mg-button2.js';
6
+ import { d as defineCustomElement$6 } from './mg-card2.js';
7
+ import { d as defineCustomElement$5 } from './mg-icon2.js';
8
+ import { d as defineCustomElement$4 } from './mg-input-title2.js';
9
+ import { d as defineCustomElement$3 } from './mg-popover2.js';
7
10
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
8
11
 
9
- const mgInputCheckboxCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}fieldset.mg-input{border:0;margin-left:0;margin-right:0;padding:0}fieldset.mg-input input[type=radio],fieldset.mg-input input[type=checkbox]{flex-shrink:0;width:var(--mg-input-check-size);height:var(--mg-input-check-size);margin-top:calc((var(--font-size) * var(--line-height) - var(--mg-input-check-size)) / 2);margin-right:0.6rem;margin-bottom:0;margin-left:0}fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container{margin-top:0.7rem}.mg-input__input-container mg-tooltip{margin-left:3rem}.mg-input__input-group-container{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;column-gap:2.3rem;row-gap:1rem;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2)}.mg-input__input-group-container--vertical{flex-direction:column}.mg-input__input-group{display:flex;align-items:top}.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}}";
12
+ /**
13
+ * List of all availables checkbox type
14
+ */
15
+ const checkboxTypes = ['checkbox', 'multi'];
16
+
17
+ const mgInputCheckboxCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle,.mg-input.mg-input--checkbox-multi-disabled .mg-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}fieldset.mg-input{border:0;margin-left:0;margin-right:0;padding:0}fieldset.mg-input input[type=radio],fieldset.mg-input input[type=checkbox]{flex-shrink:0;width:var(--mg-input-check-size);height:var(--mg-input-check-size);margin-top:calc((var(--font-size) * var(--line-height) - var(--mg-input-check-size)) / 2);margin-right:0.6rem;margin-bottom:0;margin-left:0}fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container{margin-top:0.7rem}.mg-input__input-container mg-tooltip{margin-left:3rem}.mg-input__input-group-container{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;column-gap:2.3rem;row-gap:1rem;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2)}.mg-input__input-group-container--vertical{flex-direction:column}.mg-input__input-group{display:flex;align-items:top}.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-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi{display:flex;flex-wrap:wrap;gap:calc(var(--mg-inputs-spacer) * 1.2)}.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-inputs{margin:0}.mg-input.mg-input--checkbox-multi:not(.mg-input--label-on-top) mg-tooltip{margin-left:var(--mg-inputs-spacer)}.mg-input.mg-input--checkbox-multi mg-popover{--mg-popover-min-width:7rem}";
10
18
 
11
19
  /**
12
20
  * type CheckboxItem validation function
13
- * @param {unknown} items Checkbox item
14
- * @returns {boolean} match item type
21
+ * @param items - Checkbox item
22
+ * @returns match item type
15
23
  */
16
24
  const isCheckboxItems = (items) => Array.isArray(items) &&
17
25
  items.every(item => typeof item === 'object' && typeof item.title === 'string' && (item.value === null || typeof item.value === 'boolean') && item.value !== undefined);
@@ -29,9 +37,11 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
29
37
  this.inputs = [];
30
38
  // hasDisplayedError (triggered by blur event)
31
39
  this.hasDisplayedError = false;
40
+ // style
41
+ this.baseClassName = 'mg-input--checkbox';
32
42
  /**
33
43
  * Handle input event
34
- * @param {InputEvent} event input event
44
+ * @param event - input event
35
45
  */
36
46
  this.handleInput = (event) => {
37
47
  this.checkboxItems = this.checkboxItems.map(item => {
@@ -43,6 +53,21 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
43
53
  this.value = this.checkboxItems.map(o => ({ value: o.value, title: o.title, disabled: o.disabled }));
44
54
  this.checkValidity();
45
55
  };
56
+ /**
57
+ * Keyboard handler
58
+ * @param event - to trak "tab" key
59
+ */
60
+ this.handleKeydown = (event) => {
61
+ var _a;
62
+ // track "Tab" key event when popover display (is "multi" type selected)
63
+ if (event.key === 'Tab' && ((_a = this.popover) === null || _a === void 0 ? void 0 : _a.display)) {
64
+ const enableInputs = this.checkboxItems.filter(input => !input.disabled).map(({ id }) => id);
65
+ const originInputIndex = enableInputs.findIndex(id => id === event.target.id);
66
+ // close popover when tab trigger focus outside its DOM
67
+ if ((originInputIndex + 1 >= enableInputs.length && !event.shiftKey) || (originInputIndex === 0 && event.shiftKey))
68
+ this.popover.display = false;
69
+ }
70
+ };
46
71
  /**
47
72
  * Handle blur event
48
73
  */
@@ -53,7 +78,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
53
78
  };
54
79
  /**
55
80
  * get invalid element
56
- * @returns {HTMLInputElement} element
81
+ * @returns element
57
82
  */
58
83
  this.getInvalidElement = () => this.inputs.find((input) => input !== null && !input.disabled && !input.checkValidity());
59
84
  /**
@@ -65,6 +90,19 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
65
90
  // We need to send valid event even if it is the same value
66
91
  this.inputValid.emit(this.valid);
67
92
  };
93
+ /**
94
+ * Render button text
95
+ * @param selectedValuesNb - nb of selected values
96
+ * @returns translated message
97
+ */
98
+ this.renderButtonText = (selectedValuesNb) => {
99
+ let messageKey = 'editButton';
100
+ if (this.disabled)
101
+ messageKey = 'showButton';
102
+ else if (selectedValuesNb < 1)
103
+ messageKey = 'selectButton';
104
+ return this.messages.input.checkbox[messageKey];
105
+ };
68
106
  /**
69
107
  * Set input error message
70
108
  */
@@ -76,7 +114,13 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
76
114
  this.errorMessage = this.messages.errors.required;
77
115
  }
78
116
  };
117
+ /**
118
+ * Method to get mg-popover identifier
119
+ * @returns MgPopover identifier
120
+ */
121
+ this.getMgPopoverIdentifier = () => `${this.identifier}-input-mg-popover`;
79
122
  this.value = undefined;
123
+ this.type = checkboxTypes[0];
80
124
  this.identifier = undefined;
81
125
  this.name = this.identifier;
82
126
  this.label = undefined;
@@ -90,14 +134,14 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
90
134
  this.helpText = undefined;
91
135
  this.valid = undefined;
92
136
  this.invalid = undefined;
93
- this.classList = new ClassList(['mg-input--checkbox']);
137
+ this.classCollection = new ClassList([this.baseClassName]);
94
138
  this.errorMessage = undefined;
95
139
  this.checkboxItems = [];
96
140
  }
97
141
  validateValue(newValue) {
98
142
  if (isCheckboxItems(newValue)) {
99
143
  this.checkboxItems = newValue.map((item, index) => ({
100
- id: `${this.identifier}_${index.toString()}`,
144
+ id: `${this.identifier}_${index}`,
101
145
  title: item.title,
102
146
  value: item.value,
103
147
  disabled: item.disabled,
@@ -108,6 +152,18 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
108
152
  throw new Error('<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem.');
109
153
  }
110
154
  }
155
+ validateType(newValue) {
156
+ if (!checkboxTypes.includes(newValue)) {
157
+ throw new Error('<mg-input-checkbox> prop "type" must be a CheckboxType.');
158
+ }
159
+ else {
160
+ const className = `${this.baseClassName}-multi`;
161
+ if (newValue === 'multi')
162
+ this.classCollection.add(className);
163
+ else
164
+ this.classCollection.delete(className);
165
+ }
166
+ }
111
167
  handleValidityChange(newValue, _oldValue, prop) {
112
168
  this.inputs.forEach(input => {
113
169
  input[prop] = newValue;
@@ -118,9 +174,15 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
118
174
  this.hasDisplayedError = false;
119
175
  }
120
176
  }
177
+ validateDisabled(newValue) {
178
+ const className = `${this.baseClassName}-multi-disabled`;
179
+ if (newValue && this.type === 'multi')
180
+ this.classCollection.add(className);
181
+ else
182
+ this.classCollection.delete(className);
183
+ }
121
184
  /**
122
185
  * Public method to display errors
123
- * @returns {Promise<void>}
124
186
  */
125
187
  async displayError() {
126
188
  this.checkValidity();
@@ -132,13 +194,17 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
132
194
  *************/
133
195
  /**
134
196
  * Check if component props are well configured on init
135
- * @returns {ReturnType<typeof setTimeout>} timeout
197
+ * @returns timeout
136
198
  */
137
199
  componentWillLoad() {
138
200
  // Get locales
139
201
  this.messages = initLocales(this.element).messages;
202
+ if (this.type === 'multi')
203
+ this.element.dataset.mgPopoverGuard = this.getMgPopoverIdentifier();
140
204
  // Validate
141
205
  this.validateValue(this.value);
206
+ this.validateDisabled(this.disabled);
207
+ this.validateType(this.type);
142
208
  // Check validity when component is ready
143
209
  // return a promise to process action only in the FIRST render().
144
210
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
@@ -147,29 +213,53 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
147
213
  }, 0);
148
214
  }
149
215
  /**
150
- * Render
151
- * @returns {HTMLElement} HTML Element
216
+ * render checkbox multi element
217
+ * @returns html element
152
218
  */
153
- render() {
154
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.checkboxItems
219
+ renderCheckboxMulti() {
220
+ const selectedValuesNb = this.checkboxItems.filter(({ value }) => value).length;
221
+ return (h("div", { class: "mg-input__input-container mg-input__input-checkbox-multi" }, h("strong", null, this.messages.input.checkbox[selectedValuesNb > 1 ? 'selectedValues' : 'selectedValue'].replace('{nb}', selectedValuesNb)), h("mg-popover", { arrowHide: true, identifier: this.getMgPopoverIdentifier(), ref: el => {
222
+ if (Boolean(el))
223
+ this.popover = el;
224
+ } }, h("mg-button", { variant: "secondary" }, h("mg-icon", { icon: "list" }), this.renderButtonText(selectedValuesNb)), h("div", { slot: "content" }, this.renderCheckboxes()))));
225
+ }
226
+ /**
227
+ * Render checkbox element
228
+ * @returns HTML Element
229
+ */
230
+ renderCheckboxes() {
231
+ return (h("ul", { class: {
232
+ 'mg-input__input-group-container': true,
233
+ 'mg-input__input-group-container--vertical': this.inputVerticalList || (this.type === 'multi' && !this.readonly),
234
+ 'mg-input__input-checkbox-multi-inputs': this.type === 'multi' && !this.readonly,
235
+ }, role: "list" }, this.checkboxItems
155
236
  .filter(item => {
156
237
  return !this.readonly || item.value;
157
238
  })
158
- .map((input, index) => (h("li", { key: input.id, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
239
+ .map((input, index) => (h("li", { key: input.id, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeydown, ref: el => {
159
240
  if (el !== null)
160
241
  this.inputs[index] = el;
161
- } }), h("label", { htmlFor: input.id }, input.title)))))));
242
+ } }), h("label", { htmlFor: input.id }, input.title))))));
243
+ }
244
+ /**
245
+ * Render
246
+ * @returns HTML Element
247
+ */
248
+ render() {
249
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, this.type === 'checkbox' || this.readonly ? this.renderCheckboxes() : this.renderCheckboxMulti()));
162
250
  }
163
251
  get element() { return this; }
164
252
  static get watchers() { return {
165
253
  "value": ["validateValue"],
254
+ "type": ["validateType"],
166
255
  "required": ["handleValidityChange"],
167
256
  "readonly": ["handleValidityChange"],
168
- "disabled": ["handleValidityChange"]
257
+ "disabled": ["handleValidityChange", "validateDisabled"]
169
258
  }; }
170
259
  static get style() { return mgInputCheckboxCss; }
171
260
  }, [1, "mg-input-checkbox", {
172
261
  "value": [1040],
262
+ "type": [1],
173
263
  "identifier": [1],
174
264
  "name": [1],
175
265
  "label": [1],
@@ -183,7 +273,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
183
273
  "helpText": [1, "help-text"],
184
274
  "valid": [1028],
185
275
  "invalid": [1028],
186
- "classList": [32],
276
+ "classCollection": [32],
187
277
  "errorMessage": [32],
188
278
  "checkboxItems": [32],
189
279
  "displayError": [64]
@@ -192,19 +282,34 @@ function defineCustomElement$1() {
192
282
  if (typeof customElements === "undefined") {
193
283
  return;
194
284
  }
195
- const components = ["mg-input-checkbox", "mg-icon", "mg-input-title", "mg-tooltip"];
285
+ const components = ["mg-input-checkbox", "mg-button", "mg-card", "mg-icon", "mg-input-title", "mg-popover", "mg-tooltip"];
196
286
  components.forEach(tagName => { switch (tagName) {
197
287
  case "mg-input-checkbox":
198
288
  if (!customElements.get(tagName)) {
199
289
  customElements.define(tagName, MgInputCheckbox$1);
200
290
  }
201
291
  break;
292
+ case "mg-button":
293
+ if (!customElements.get(tagName)) {
294
+ defineCustomElement$7();
295
+ }
296
+ break;
297
+ case "mg-card":
298
+ if (!customElements.get(tagName)) {
299
+ defineCustomElement$6();
300
+ }
301
+ break;
202
302
  case "mg-icon":
203
303
  if (!customElements.get(tagName)) {
204
- defineCustomElement$4();
304
+ defineCustomElement$5();
205
305
  }
206
306
  break;
207
307
  case "mg-input-title":
308
+ if (!customElements.get(tagName)) {
309
+ defineCustomElement$4();
310
+ }
311
+ break;
312
+ case "mg-popover":
208
313
  if (!customElements.get(tagName)) {
209
314
  defineCustomElement$3();
210
315
  }
@@ -14,7 +14,7 @@ var InputError;
14
14
  InputError["REQUIRED"] = "required";
15
15
  })(InputError || (InputError = {}));
16
16
 
17
- const mgInputDateCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0;border-bottom-right-radius:0}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.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}}";
17
+ const mgInputDateCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle,.mg-input.mg-input--checkbox-multi-disabled .mg-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0;border-bottom-right-radius:0}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.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}}";
18
18
 
19
19
  const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
20
20
  constructor() {
@@ -53,7 +53,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
53
53
  };
54
54
  /**
55
55
  * get input error code
56
- * @returns {null | InputError} error code
56
+ * @returns error code
57
57
  */
58
58
  this.getInputError = () => {
59
59
  var _a, _b;
@@ -78,7 +78,6 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
78
78
  };
79
79
  /**
80
80
  * Check input errors
81
- * @returns {void}
82
81
  */
83
82
  this.setErrorMessage = () => {
84
83
  var _a;
@@ -116,7 +115,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
116
115
  this.invalid = undefined;
117
116
  this.min = undefined;
118
117
  this.max = undefined;
119
- this.classList = new ClassList(['mg-input--date']);
118
+ this.classCollection = new ClassList(['mg-input--date']);
120
119
  this.errorMessage = undefined;
121
120
  }
122
121
  validateValue(newValue) {
@@ -147,7 +146,6 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
147
146
  }
148
147
  /**
149
148
  * Public method to display errors
150
- * @returns {Promise<void>}
151
149
  */
152
150
  async displayError() {
153
151
  this.checkValidity();
@@ -159,7 +157,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
159
157
  *************/
160
158
  /**
161
159
  * Check if component props are well configured on init
162
- * @returns {ReturnType<typeof setTimeout>} timeout
160
+ * @returns timeout
163
161
  */
164
162
  componentWillLoad() {
165
163
  // Get locales
@@ -179,10 +177,10 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
179
177
  }
180
178
  /**
181
179
  * Render
182
- * @returns {HTMLElement} HTML Element
180
+ * @returns HTML Element
183
181
  */
184
182
  render() {
185
- return (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 }, 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 => {
183
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, 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 }, 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 => {
186
184
  if (el !== null)
187
185
  this.input = el;
188
186
  } })));
@@ -213,7 +211,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
213
211
  "invalid": [1028],
214
212
  "min": [1],
215
213
  "max": [1],
216
- "classList": [32],
214
+ "classCollection": [32],
217
215
  "errorMessage": [32],
218
216
  "displayError": [64]
219
217
  }]);