@mgdis/mg-components 6.2.0 → 6.4.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 (238) hide show
  1. package/dist/cjs/{index-52d5f3d4.js → index-911898e4.js} +410 -266
  2. package/dist/cjs/index-911898e4.js.map +1 -0
  3. package/dist/cjs/{index-cc11af95.js → index-a3269bfc.js} +3 -3
  4. package/dist/cjs/{index-cc11af95.js.map → index-a3269bfc.js.map} +1 -1
  5. package/dist/cjs/{index.es-ac7c22e3.js → index.es-325100d7.js} +47 -47
  6. package/dist/cjs/index.es-325100d7.js.map +1 -0
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/mg-action-more_36.cjs.entry.js +1414 -983
  9. package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
  10. package/dist/cjs/mg-alert.cjs.entry.js +17 -12
  11. package/dist/cjs/mg-alert.cjs.entry.js.map +1 -1
  12. package/dist/cjs/mg-components.cjs.js +3 -3
  13. package/dist/cjs/mg-components.cjs.js.map +1 -1
  14. package/dist/cjs/mg-loader.cjs.entry.js +6 -8
  15. package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
  16. package/dist/cjs/mg-progress.cjs.entry.js +27 -12
  17. package/dist/cjs/mg-progress.cjs.entry.js.map +1 -1
  18. package/dist/collection/collection-manifest.json +2 -2
  19. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +10 -3
  20. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js.map +1 -1
  21. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +15 -4
  22. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js.map +1 -1
  23. package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -4
  24. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  25. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
  26. package/dist/collection/components/atoms/mg-button/mg-button.conf.js.map +1 -1
  27. package/dist/collection/components/atoms/mg-button/mg-button.js +112 -12
  28. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  29. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
  30. package/dist/collection/components/atoms/mg-divider/mg-divider.js +9 -1
  31. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  33. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  34. package/dist/collection/components/atoms/mg-tag/mg-tag.js +14 -4
  35. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  36. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +3 -4
  37. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  38. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +28 -6
  39. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  40. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +50 -13
  41. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +29 -11
  43. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +106 -33
  45. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +99 -36
  47. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +130 -35
  49. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +87 -25
  51. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +86 -26
  53. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +92 -30
  55. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +109 -32
  57. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  58. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +109 -29
  59. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  60. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +67 -21
  61. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  62. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +16 -70
  63. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -1
  64. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +101 -89
  65. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  66. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +194 -157
  67. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  68. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +19 -8
  69. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  70. package/dist/collection/components/molecules/mg-alert/mg-alert.js +31 -6
  71. package/dist/collection/components/molecules/mg-alert/mg-alert.js.map +1 -1
  72. package/dist/collection/components/molecules/mg-details/mg-details.js +17 -5
  73. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  74. package/dist/collection/components/molecules/mg-form/mg-form.js +48 -16
  75. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  76. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +13 -3
  77. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  78. package/dist/collection/components/molecules/mg-loader/mg-loader.js +5 -5
  79. package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
  80. package/dist/collection/components/molecules/mg-message/mg-message.js +22 -6
  81. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  82. package/dist/collection/components/molecules/mg-modal/mg-modal.js +54 -11
  83. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  84. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +28 -9
  85. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  86. package/dist/collection/components/molecules/mg-panel/mg-panel.js +48 -13
  87. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  88. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +10 -2
  89. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  90. package/dist/collection/components/molecules/mg-popover/mg-popover.js +61 -7
  91. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  92. package/dist/collection/components/molecules/mg-progress/mg-progress.js +26 -1
  93. package/dist/collection/components/molecules/mg-progress/mg-progress.js.map +1 -1
  94. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +3 -2
  95. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  96. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +28 -8
  97. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  98. package/dist/collection/utils/behaviors.utils.js +44 -107
  99. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  100. package/dist/components/index.es.js +42 -42
  101. package/dist/components/index.es.js.map +1 -1
  102. package/dist/components/index2.js +2 -2
  103. package/dist/components/mg-action-more.js +15 -12
  104. package/dist/components/mg-action-more.js.map +1 -1
  105. package/dist/components/mg-alert.js +15 -10
  106. package/dist/components/mg-alert.js.map +1 -1
  107. package/dist/components/mg-badge2.js +13 -10
  108. package/dist/components/mg-badge2.js.map +1 -1
  109. package/dist/components/mg-button2.js +77 -16
  110. package/dist/components/mg-button2.js.map +1 -1
  111. package/dist/components/mg-card2.js +1 -1
  112. package/dist/components/mg-character-left2.js +8 -7
  113. package/dist/components/mg-character-left2.js.map +1 -1
  114. package/dist/components/mg-details.js +11 -7
  115. package/dist/components/mg-details.js.map +1 -1
  116. package/dist/components/mg-divider2.js +7 -1
  117. package/dist/components/mg-divider2.js.map +1 -1
  118. package/dist/components/mg-form.js +35 -21
  119. package/dist/components/mg-form.js.map +1 -1
  120. package/dist/components/mg-icon2.js +17 -11
  121. package/dist/components/mg-icon2.js.map +1 -1
  122. package/dist/components/mg-illustrated-message.js +10 -4
  123. package/dist/components/mg-illustrated-message.js.map +1 -1
  124. package/dist/components/mg-input-checkbox-paginated2.js +14 -10
  125. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  126. package/dist/components/mg-input-checkbox.js +73 -40
  127. package/dist/components/mg-input-checkbox.js.map +1 -1
  128. package/dist/components/mg-input-date.js +77 -46
  129. package/dist/components/mg-input-date.js.map +1 -1
  130. package/dist/components/mg-input-numeric.js +90 -45
  131. package/dist/components/mg-input-numeric.js.map +1 -1
  132. package/dist/components/mg-input-password.js +56 -28
  133. package/dist/components/mg-input-password.js.map +1 -1
  134. package/dist/components/mg-input-radio.js +59 -31
  135. package/dist/components/mg-input-radio.js.map +1 -1
  136. package/dist/components/mg-input-select2.js +60 -36
  137. package/dist/components/mg-input-select2.js.map +1 -1
  138. package/dist/components/mg-input-text2.js +71 -40
  139. package/dist/components/mg-input-text2.js.map +1 -1
  140. package/dist/components/mg-input-textarea.js +72 -36
  141. package/dist/components/mg-input-textarea.js.map +1 -1
  142. package/dist/components/mg-input-title2.js +11 -8
  143. package/dist/components/mg-input-title2.js.map +1 -1
  144. package/dist/components/mg-input-toggle.js +43 -25
  145. package/dist/components/mg-input-toggle.js.map +1 -1
  146. package/dist/components/mg-input2.js +37 -20
  147. package/dist/components/mg-input2.js.map +1 -1
  148. package/dist/components/mg-item-more2.js +146 -270
  149. package/dist/components/mg-item-more2.js.map +1 -1
  150. package/dist/components/mg-loader.js +4 -6
  151. package/dist/components/mg-loader.js.map +1 -1
  152. package/dist/components/mg-menu-item2.js +193 -149
  153. package/dist/components/mg-menu-item2.js.map +1 -1
  154. package/dist/components/mg-message2.js +21 -9
  155. package/dist/components/mg-message2.js.map +1 -1
  156. package/dist/components/mg-modal.js +36 -17
  157. package/dist/components/mg-modal.js.map +1 -1
  158. package/dist/components/mg-pagination2.js +21 -14
  159. package/dist/components/mg-pagination2.js.map +1 -1
  160. package/dist/components/mg-panel.js +37 -20
  161. package/dist/components/mg-panel.js.map +1 -1
  162. package/dist/components/mg-popover-content2.js +9 -3
  163. package/dist/components/mg-popover-content2.js.map +1 -1
  164. package/dist/components/mg-popover2.js +38 -10
  165. package/dist/components/mg-popover2.js.map +1 -1
  166. package/dist/components/mg-progress.js +26 -11
  167. package/dist/components/mg-progress.js.map +1 -1
  168. package/dist/components/mg-skip-links.js +2 -3
  169. package/dist/components/mg-skip-links.js.map +1 -1
  170. package/dist/components/mg-tabs.js +27 -17
  171. package/dist/components/mg-tabs.js.map +1 -1
  172. package/dist/components/mg-tag.js +12 -8
  173. package/dist/components/mg-tag.js.map +1 -1
  174. package/dist/components/mg-tooltip-content2.js +1 -2
  175. package/dist/components/mg-tooltip-content2.js.map +1 -1
  176. package/dist/components/mg-tooltip2.js +24 -12
  177. package/dist/components/mg-tooltip2.js.map +1 -1
  178. package/dist/esm/{index-81752ffe.js → index-1f32332a.js} +410 -266
  179. package/dist/esm/index-1f32332a.js.map +1 -0
  180. package/dist/esm/{index-f3d3fb70.js → index-9bd10f5d.js} +3 -3
  181. package/dist/esm/{index-f3d3fb70.js.map → index-9bd10f5d.js.map} +1 -1
  182. package/dist/esm/{index.es-940821a9.js → index.es-a2587b72.js} +43 -43
  183. package/dist/esm/index.es-a2587b72.js.map +1 -0
  184. package/dist/esm/loader.js +3 -3
  185. package/dist/esm/mg-action-more_36.entry.js +1414 -983
  186. package/dist/esm/mg-action-more_36.entry.js.map +1 -1
  187. package/dist/esm/mg-alert.entry.js +17 -12
  188. package/dist/esm/mg-alert.entry.js.map +1 -1
  189. package/dist/esm/mg-components.js +4 -4
  190. package/dist/esm/mg-components.js.map +1 -1
  191. package/dist/esm/mg-loader.entry.js +6 -8
  192. package/dist/esm/mg-loader.entry.js.map +1 -1
  193. package/dist/esm/mg-progress.entry.js +27 -12
  194. package/dist/esm/mg-progress.entry.js.map +1 -1
  195. package/dist/mg-components/mg-components.esm.js +1 -1
  196. package/dist/mg-components/mg-components.esm.js.map +1 -1
  197. package/dist/mg-components/p-0ead5317.entry.js +2 -0
  198. package/dist/mg-components/{p-31e6c1a7.entry.js.map → p-0ead5317.entry.js.map} +1 -1
  199. package/dist/mg-components/p-35898742.js +3 -0
  200. package/dist/mg-components/p-35898742.js.map +1 -0
  201. package/dist/mg-components/p-3b052ac0.entry.js +2 -0
  202. package/dist/mg-components/p-3b052ac0.entry.js.map +1 -0
  203. package/dist/mg-components/p-6810a565.entry.js +2 -0
  204. package/dist/mg-components/p-6810a565.entry.js.map +1 -0
  205. package/dist/mg-components/{p-ee51ec5e.js → p-b986c107.js} +2 -2
  206. package/dist/mg-components/p-b986c107.js.map +1 -0
  207. package/dist/mg-components/{p-a49e2b74.js → p-dc436f3c.js} +2 -2
  208. package/dist/mg-components/p-f48d964f.entry.js +2 -0
  209. package/dist/mg-components/p-f48d964f.entry.js.map +1 -0
  210. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +9 -1
  211. package/dist/types/components/atoms/mg-button/mg-button.d.ts +11 -1
  212. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +6 -0
  213. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.d.ts +1 -15
  214. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +14 -30
  215. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +46 -37
  216. package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +4 -0
  217. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +4 -0
  218. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +4 -0
  219. package/dist/types/components.d.ts +33 -15
  220. package/dist/types/utils/behaviors.utils.d.ts +15 -44
  221. package/ide/intellij/web-types.json +39 -11
  222. package/ide/vscode/html-custom-data.json +28 -6
  223. package/package.json +27 -37
  224. package/dist/cjs/index-52d5f3d4.js.map +0 -1
  225. package/dist/cjs/index.es-ac7c22e3.js.map +0 -1
  226. package/dist/esm/index-81752ffe.js.map +0 -1
  227. package/dist/esm/index.es-940821a9.js.map +0 -1
  228. package/dist/mg-components/p-2298352f.js +0 -3
  229. package/dist/mg-components/p-2298352f.js.map +0 -1
  230. package/dist/mg-components/p-31e6c1a7.entry.js +0 -2
  231. package/dist/mg-components/p-67c9be27.entry.js +0 -2
  232. package/dist/mg-components/p-67c9be27.entry.js.map +0 -1
  233. package/dist/mg-components/p-95895169.entry.js +0 -2
  234. package/dist/mg-components/p-95895169.entry.js.map +0 -1
  235. package/dist/mg-components/p-abddacc2.entry.js +0 -2
  236. package/dist/mg-components/p-abddacc2.entry.js.map +0 -1
  237. package/dist/mg-components/p-ee51ec5e.js.map +0 -1
  238. /package/dist/mg-components/{p-a49e2b74.js.map → p-dc436f3c.js.map} +0 -0
@@ -1,6 +1,6 @@
1
- import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-81752ffe.js';
2
- import { q as qe, Y as Ye, X as Xe, m as me, t as tt, G as Ge, K as Ke, e as et, H as He, z as ze, f as ft, c as ct, p as pt, d as dt, u as ut, $ as $t, J as Je, Z as Ze, Q as Qe } from './index.es-940821a9.js';
3
- import { i as initLocales } from './index-f3d3fb70.js';
1
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-1f32332a.js';
2
+ import { z as ze, J as Je, G as Ge, y as ye, e as et, I as Ie, K as Ke, V as Ve, B as Be, P as Pe, c as ct, a as at, u as ut, $ as $t, d as dt, f as ft, X as Xe, Z as Ze, Q as Qe } from './index.es-a2587b72.js';
3
+ import { i as initLocales } from './index-9bd10f5d.js';
4
4
 
5
5
  /**
6
6
  * Available menu item status values
@@ -26,7 +26,7 @@ const Direction = {
26
26
  /**
27
27
  * List of all possibles sizes
28
28
  */
29
- const sizes$2 = ['medium', 'large', 'xlarge'];
29
+ const sizes$3 = ['medium', 'large', 'xlarge'];
30
30
 
31
31
  const mgActionMoreCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host{--mg-c-popover-padding-vertical:var(--mg-b-size-8);--mg-c-popover-padding-horizontal:0;--mg-c-popover-max-width:unset}.mg-c-action-more__divider{--mg-c-divider-spacing-vertical:var(--mg-b-size-4)}.mg-c-action-more__chevron{transition:200ms}.mg-c-action-more__chevron--rotate.mg-c-action-more__chevron{transform:rotate(180deg)}";
32
32
  const MgActionMoreStyle0 = mgActionMoreCss;
@@ -73,7 +73,15 @@ const MgActionMore = class {
73
73
  ************/
74
74
  this.name = 'mg-action-more';
75
75
  this.classBase = 'mg-c-action-more';
76
- this.mgPopoverIdentifier = qe(this.name);
76
+ this.mgPopoverIdentifier = ze(this.name);
77
+ /**
78
+ * Define button properties
79
+ */
80
+ this.button = { variant: 'flat', isIcon: true };
81
+ /**
82
+ * Menu expanded state
83
+ */
84
+ this.expanded = false;
77
85
  /************
78
86
  * Methods *
79
87
  ***********/
@@ -105,23 +113,18 @@ const MgActionMore = class {
105
113
  this.expanded = false;
106
114
  customHandler(event);
107
115
  };
108
- this.items = undefined;
109
- this.icon = undefined;
110
- this.button = { variant: 'flat', isIcon: true };
111
- this.displayChevron = undefined;
112
- this.expanded = false;
113
116
  }
114
117
  validateItems(newValue) {
115
118
  if (!isMgActionMoreItems(newValue)) {
116
- throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${Ye(newValue)}.`);
119
+ throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${Je(newValue)}.`);
117
120
  }
118
121
  else if (isMgActionMoreItems(newValue) && newValue.length > 0 && (isMgActionMoreDivider(newValue[0]) || isMgActionMoreDivider(newValue[newValue.length - 1]))) {
119
- throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${Ye(newValue)}.`);
122
+ throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${Je(newValue)}.`);
120
123
  }
121
124
  }
122
125
  validateIcon(newValue) {
123
126
  if (newValue && !isMgActionMoreIcon(newValue)) {
124
- throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${Ye(newValue)}.`);
127
+ throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${Je(newValue)}.`);
125
128
  }
126
129
  else if ((newValue === null || newValue === void 0 ? void 0 : newValue.icon) === undefined && Boolean(this.button.isIcon)) {
127
130
  this.icon = { icon: 'ellipsis' };
@@ -129,7 +132,7 @@ const MgActionMore = class {
129
132
  }
130
133
  validateButton(newValue) {
131
134
  if (newValue && !isMgActionMoreButton(newValue)) {
132
- throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${Ye(newValue)}.`);
135
+ throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${Je(newValue)}.`);
133
136
  }
134
137
  }
135
138
  validateDisplayChevron(newValue) {
@@ -163,7 +166,7 @@ const MgActionMore = class {
163
166
  [`${this.classBase}__chevron--rotate`]: this.expanded === true,
164
167
  } }, h("mg-icon", { icon: "chevron-down" })));
165
168
  }
166
- return (h(Host, { key: '3653a59754e22bba9e476eeb2a92c663a048491c', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: '3115bbd0586f5a301aa17d83cf2cc5ebab7d10ec', class: this.classBase }, h("mg-popover", { key: '1ab5bdf851875423a9af68e3d26c1d545e37aa0d', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, h("mg-button", { key: 'b5e25273f75d1f45a02d3fdec9d05573edfee1ad', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && h("mg-icon", Object.assign({ key: '164320fd014593dbc7167bfc5d04136593351619' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: '2be6989ce6ba7a8a830be0cd0b8e323b9178c8f5', slot: "content" }, h("mg-menu", { key: 'aa586ac5fdacea97967d1aac3ecbf77ca9ae41de', direction: Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
169
+ return (h(Host, { key: '2255b4416986c17b4c51162e60f2d69599d730fe', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: '06e117e65bd8bbe404478c657cd96709b83e9283', class: this.classBase }, h("mg-popover", { key: '3001fb13f7d6d43c40194698c3f6b081ad7e7ab4', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, h("mg-button", { key: '7b1031a98bddbe7f1e567c42be7ce595512db2ce', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && h("mg-icon", Object.assign({ key: '756b408413f748ad8bc32e1d573ab2d7f54a9ce1' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: '623b5084381a0ff4e3b8ec06892dcb8d16cb060a', slot: "content" }, h("mg-menu", { key: '34bcf9213d4d076246270daaebbef75ec0f92b07', direction: Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
167
170
  var _a, _b;
168
171
  return isMgActionMoreDivider(item) ? (h("mg-divider", { class: "mg-c-action-more__divider", key: "divider" })) : (h("mg-menu-item", { key: item.label, status: item.status || Status$1.VISIBLE, target: item.target, href: item.href,
169
172
  // eslint-disable-next-line react/jsx-no-bind
@@ -196,25 +199,28 @@ const MgBadge = class {
196
199
  ************/
197
200
  // Classes
198
201
  this.classOutline = `mg-c-badge--outline`;
199
- this.value = undefined;
200
- this.label = undefined;
201
- this.variant = variants$4[0];
202
- this.outline = undefined;
203
- this.classCollection = new Xe(['mg-c-badge']);
202
+ /**
203
+ * Define badge variant
204
+ */
205
+ this.variant = variants$4[0]; // info
206
+ /**
207
+ * Component classes
208
+ */
209
+ this.classCollection = new Ge(['mg-c-badge']);
204
210
  }
205
211
  validateValue(newValue) {
206
212
  if (/^[^A-Z]+$/i.exec(`${newValue}`) === null) {
207
- throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${Ye(newValue)}.`);
213
+ throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${Je(newValue)}.`);
208
214
  }
209
215
  }
210
216
  validateLabel(newValue) {
211
- if (!me(newValue)) {
212
- throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${Ye(newValue)}.`);
217
+ if (!ye(newValue)) {
218
+ throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${Je(newValue)}.`);
213
219
  }
214
220
  }
215
221
  validateVariant(newValue, oldValue) {
216
222
  if (!variants$4.includes(newValue)) {
217
- throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${Ye(newValue)}.`);
223
+ throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${Je(newValue)}.`);
218
224
  }
219
225
  else {
220
226
  if (oldValue !== undefined) {
@@ -254,12 +260,16 @@ const MgBadge = class {
254
260
  };
255
261
  MgBadge.style = MgBadgeStyle0;
256
262
 
263
+ /**
264
+ * List of all possibles sizes
265
+ */
266
+ const sizes$2 = ['medium', 'large'];
257
267
  /**
258
268
  * List of all possibles variants
259
269
  */
260
270
  const variants$3 = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success', 'link'];
261
271
 
262
- const mgButtonCss = "/*!\n * @prop --mg-c-button-border-radius: Defines the border radius of the button. The default value is `--mg-b-size-radius`.\n * @prop --mg-c-button-border-top-width: Defines the top border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-right-width: Defines the right border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-bottom-width: Defines the bottom border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-left-width: Defines the left border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-radius-top-left: Defines the top left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-top-right: Defines the top right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-right: Defines the bottom right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-left: Defines the bottom left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-font-weight: Defines the font weight of the button. Unset by default, fallback on `normal`.\n * @prop --mg-c-button-icon-border-radius: Defines the border radius of the button in icon mode. The default value is `--mg-b-size-min-height`.\n */:host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:color-mix(in srgb, var(--mg-b-color-dark), transparent 90%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{/*!\n * @prop --mg-c-button-color-background-primary: Defines the background color for the primary variant button.\n * @prop --mg-c-button-color-border-primary: Defines the border color for the primary variant button.\n * @prop --mg-c-button-color-gradient-primary: Defines the gradient color for the primary variant button.\n * @prop --mg-c-button-color-text-primary: Defines the font color for the primary variant button.\n */border-color:var(--mg-c-button-color-border-primary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-primary), var(--mg-c-button-color-gradient-primary));color:var(--mg-c-button-color-text-primary)}:host(:hover) .mg-c-button.mg-c-button--primary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-primary)}.mg-c-button.mg-c-button--secondary{/*!\n * @prop --mg-c-button-color-background-secondary: Defines the background color for the secondary variant button.\n * @prop --mg-c-button-color-border-secondary: Defines the border color for the secondary variant button.\n * @prop --mg-c-button-color-gradient-secondary: Defines the gradient color for the secondary variant button.\n * @prop --mg-c-button-color-text-secondary: Defines the font color for the secondary variant button.\n */border-color:var(--mg-c-button-color-border-secondary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-secondary), var(--mg-c-button-color-gradient-secondary));color:var(--mg-c-button-color-text-secondary)}:host(:hover) .mg-c-button.mg-c-button--secondary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-secondary)}.mg-c-button.mg-c-button--danger{/*!\n * @prop --mg-c-button-color-background-danger: Defines the background color for the danger variant button.\n * @prop --mg-c-button-color-border-danger: Defines the border color for the danger variant button.\n * @prop --mg-c-button-color-gradient-danger: Defines the gradient color for the danger variant button.\n * @prop --mg-c-button-color-text-danger: Defines the font color for the danger variant button.\n */border-color:var(--mg-c-button-color-border-danger);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger), var(--mg-c-button-color-gradient-danger));color:var(--mg-c-button-color-text-danger)}:host(:hover) .mg-c-button.mg-c-button--danger:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger)}.mg-c-button.mg-c-button--info{/*!\n * @prop --mg-c-button-color-background-info: Defines the background color for the info variant button.\n * @prop --mg-c-button-color-border-info: Defines the border color for the info variant button.\n * @prop --mg-c-button-color-gradient-info: Defines the gradient color for the info variant button.\n * @prop --mg-c-button-color-text-info: Defines the font color for the info variant button.\n */border-color:var(--mg-c-button-color-border-info);background:linear-gradient(to bottom, var(--mg-c-button-color-background-info), var(--mg-c-button-color-gradient-info));color:var(--mg-c-button-color-text-info)}:host(:hover) .mg-c-button.mg-c-button--info:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-info)}.mg-c-button.mg-c-button--success{/*!\n * @prop --mg-c-button-color-background-success: Defines the background color for the success variant button.\n * @prop --mg-c-button-color-border-success: Defines the border color for the success variant button.\n * @prop --mg-c-button-color-gradient-success: Defines the gradient color for the success variant button.\n * @prop --mg-c-button-color-text-success: Defines the font color for the success variant button.\n */border-color:var(--mg-c-button-color-border-success);background:linear-gradient(to bottom, var(--mg-c-button-color-background-success), var(--mg-c-button-color-gradient-success));color:var(--mg-c-button-color-text-success)}:host(:hover) .mg-c-button.mg-c-button--success:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-success)}.mg-c-button.mg-c-button--warning{/*!\n * @prop --mg-c-button-color-background-warning: Defines the background color for the warning variant button.\n * @prop --mg-c-button-color-border-warning: Defines the border color for the warning variant button.\n * @prop --mg-c-button-color-gradient-warning: Defines the gradient color for the warning variant button.\n * @prop --mg-c-button-color-text-warning: Defines the font color for the warning variant button.\n */border-color:var(--mg-c-button-color-border-warning);background:linear-gradient(to bottom, var(--mg-c-button-color-background-warning), var(--mg-c-button-color-gradient-warning));color:var(--mg-c-button-color-text-warning)}:host(:hover) .mg-c-button.mg-c-button--warning:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-warning)}.mg-c-button.mg-c-button--danger-alt{/*!\n * @prop --mg-c-button-color-background-danger-alt: Defines the background color for the danger-alt variant button.\n * @prop --mg-c-button-color-border-danger-alt: Defines the border color for the danger-alt variant button.\n * @prop --mg-c-button-color-gradient-danger-alt: Defines the gradient color for the danger-alt variant button.\n * @prop --mg-c-button-color-text-danger-alt: Defines the font color for the danger-alt variant button.\n */border-color:var(--mg-c-button-color-border-danger-alt);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger-alt), var(--mg-c-button-color-gradient-danger-alt));color:var(--mg-c-button-color-text-danger-alt)}:host(:hover) .mg-c-button.mg-c-button--danger-alt:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger-alt)}.mg-c-button{position:relative;display:inline-flex;min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-width:var(--mg-c-button-border-top-width, var(--mg-b-size-border)) var(--mg-c-button-border-right-width, var(--mg-b-size-border)) var(--mg-c-button-border-bottom-width, var(--mg-b-size-border)) var(--mg-c-button-border-left-width, var(--mg-b-size-border));border-style:solid;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-border-radius));background-image:none;column-gap:var(--mg-b-size-8);cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button.mg-c-button--disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-button.mg-c-button--icon{width:var(--mg-b-size-min-height);height:var(--mg-b-size-min-height);justify-content:center;padding:0;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-icon-border-radius));font-size:var(--mg-b-font-size);line-height:var(--mg-b-font-size)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:var(--mg-b-size-8)}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--full-width{display:flex;justify-content:center}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}";
272
+ const mgButtonCss = "/*!\n * @prop --mg-c-button-border-radius: Defines the border radius of the button. The default value is `--mg-b-size-radius`.\n * @prop --mg-c-button-border-top-width: Defines the top border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-right-width: Defines the right border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-bottom-width: Defines the bottom border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-left-width: Defines the left border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-radius-top-left: Defines the top left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-top-right: Defines the top right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-right: Defines the bottom right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-left: Defines the bottom left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-font-weight: Defines the font weight of the button. Unset by default, fallback on `normal`.\n * @prop --mg-c-button-icon-border-radius: Defines the border radius of the button in icon mode. The default value is `--mg-b-size-min-height`.\n */:host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:color-mix(in srgb, var(--mg-b-color-dark), transparent 90%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{/*!\n * @prop --mg-c-button-color-background-primary: Defines the background color for the primary variant button.\n * @prop --mg-c-button-color-border-primary: Defines the border color for the primary variant button.\n * @prop --mg-c-button-color-gradient-primary: Defines the gradient color for the primary variant button.\n * @prop --mg-c-button-color-text-primary: Defines the font color for the primary variant button.\n */border-color:var(--mg-c-button-color-border-primary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-primary), var(--mg-c-button-color-gradient-primary));color:var(--mg-c-button-color-text-primary)}:host(:hover) .mg-c-button.mg-c-button--primary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-primary)}.mg-c-button.mg-c-button--secondary{/*!\n * @prop --mg-c-button-color-background-secondary: Defines the background color for the secondary variant button.\n * @prop --mg-c-button-color-border-secondary: Defines the border color for the secondary variant button.\n * @prop --mg-c-button-color-gradient-secondary: Defines the gradient color for the secondary variant button.\n * @prop --mg-c-button-color-text-secondary: Defines the font color for the secondary variant button.\n */border-color:var(--mg-c-button-color-border-secondary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-secondary), var(--mg-c-button-color-gradient-secondary));color:var(--mg-c-button-color-text-secondary)}:host(:hover) .mg-c-button.mg-c-button--secondary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-secondary)}.mg-c-button.mg-c-button--danger{/*!\n * @prop --mg-c-button-color-background-danger: Defines the background color for the danger variant button.\n * @prop --mg-c-button-color-border-danger: Defines the border color for the danger variant button.\n * @prop --mg-c-button-color-gradient-danger: Defines the gradient color for the danger variant button.\n * @prop --mg-c-button-color-text-danger: Defines the font color for the danger variant button.\n */border-color:var(--mg-c-button-color-border-danger);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger), var(--mg-c-button-color-gradient-danger));color:var(--mg-c-button-color-text-danger)}:host(:hover) .mg-c-button.mg-c-button--danger:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger)}.mg-c-button.mg-c-button--info{/*!\n * @prop --mg-c-button-color-background-info: Defines the background color for the info variant button.\n * @prop --mg-c-button-color-border-info: Defines the border color for the info variant button.\n * @prop --mg-c-button-color-gradient-info: Defines the gradient color for the info variant button.\n * @prop --mg-c-button-color-text-info: Defines the font color for the info variant button.\n */border-color:var(--mg-c-button-color-border-info);background:linear-gradient(to bottom, var(--mg-c-button-color-background-info), var(--mg-c-button-color-gradient-info));color:var(--mg-c-button-color-text-info)}:host(:hover) .mg-c-button.mg-c-button--info:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-info)}.mg-c-button.mg-c-button--success{/*!\n * @prop --mg-c-button-color-background-success: Defines the background color for the success variant button.\n * @prop --mg-c-button-color-border-success: Defines the border color for the success variant button.\n * @prop --mg-c-button-color-gradient-success: Defines the gradient color for the success variant button.\n * @prop --mg-c-button-color-text-success: Defines the font color for the success variant button.\n */border-color:var(--mg-c-button-color-border-success);background:linear-gradient(to bottom, var(--mg-c-button-color-background-success), var(--mg-c-button-color-gradient-success));color:var(--mg-c-button-color-text-success)}:host(:hover) .mg-c-button.mg-c-button--success:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-success)}.mg-c-button.mg-c-button--warning{/*!\n * @prop --mg-c-button-color-background-warning: Defines the background color for the warning variant button.\n * @prop --mg-c-button-color-border-warning: Defines the border color for the warning variant button.\n * @prop --mg-c-button-color-gradient-warning: Defines the gradient color for the warning variant button.\n * @prop --mg-c-button-color-text-warning: Defines the font color for the warning variant button.\n */border-color:var(--mg-c-button-color-border-warning);background:linear-gradient(to bottom, var(--mg-c-button-color-background-warning), var(--mg-c-button-color-gradient-warning));color:var(--mg-c-button-color-text-warning)}:host(:hover) .mg-c-button.mg-c-button--warning:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-warning)}.mg-c-button.mg-c-button--danger-alt{/*!\n * @prop --mg-c-button-color-background-danger-alt: Defines the background color for the danger-alt variant button.\n * @prop --mg-c-button-color-border-danger-alt: Defines the border color for the danger-alt variant button.\n * @prop --mg-c-button-color-gradient-danger-alt: Defines the gradient color for the danger-alt variant button.\n * @prop --mg-c-button-color-text-danger-alt: Defines the font color for the danger-alt variant button.\n */border-color:var(--mg-c-button-color-border-danger-alt);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger-alt), var(--mg-c-button-color-gradient-danger-alt));color:var(--mg-c-button-color-text-danger-alt)}:host(:hover) .mg-c-button.mg-c-button--danger-alt:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger-alt)}.mg-c-button{position:relative;display:inline-flex;min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-width:var(--mg-c-button-border-top-width, var(--mg-b-size-border)) var(--mg-c-button-border-right-width, var(--mg-b-size-border)) var(--mg-c-button-border-bottom-width, var(--mg-b-size-border)) var(--mg-c-button-border-left-width, var(--mg-b-size-border));border-style:solid;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-border-radius));background-image:none;column-gap:var(--mg-b-size-8);cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:var(--mg-b-size-8)}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--large{padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border)) calc(var(--mg-b-size-24) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon){line-height:var(--mg-b-size-24)}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) slot,.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) ::slotted(*){font-size:var(--mg-b-size-16)}.mg-c-button.mg-c-button--icon{width:var(--mg-b-size-min-height);height:var(--mg-b-size-min-height);justify-content:center;padding:0;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-icon-border-radius));font-size:var(--mg-b-font-size);line-height:var(--mg-b-font-size)}.mg-c-button.mg-c-button--icon.mg-c-button--large{width:unset;height:unset;padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--icon.mg-c-button--large ::slotted(*){min-width:var(--mg-b-size-24);min-height:var(--mg-b-size-24);align-items:center;justify-content:center}.mg-c-button.mg-c-button--full-width{display:flex;justify-content:center}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}";
263
273
  const MgButtonStyle0 = mgButtonCss;
264
274
 
265
275
  const MgButton = class {
@@ -273,6 +283,38 @@ const MgButton = class {
273
283
  this.classDisabled = 'mg-c-button--disabled';
274
284
  this.classLoading = 'mg-c-button--loading';
275
285
  this.classFullWidth = 'mg-c-button--full-width';
286
+ /**
287
+ * Define button variant
288
+ */
289
+ this.variant = variants$3[0]; // Primary
290
+ /**
291
+ * Define button size
292
+ */
293
+ this.size = sizes$2[0]; // medium
294
+ /**
295
+ * Set button to full-width
296
+ */
297
+ this.fullWidth = false;
298
+ /**
299
+ * Define if button is round.
300
+ * Used for icon button.
301
+ */
302
+ this.isIcon = false;
303
+ /**
304
+ * Option to set input disable on click, in order to prevent multi-click.
305
+ * Parent component have to remove the attribute 'disabled' when the process ends.
306
+ */
307
+ this.disableOnClick = false;
308
+ /**
309
+ * Define if button is loading, default to false.
310
+ * Trigger when button is clicked or key-up ['enter', 'space], then value change to true.
311
+ * It's required to reset to false when action/promise in parent is done to stop the loading state
312
+ */
313
+ this.loading = false;
314
+ /**
315
+ * Component classes
316
+ */
317
+ this.classCollection = new Ge(['mg-c-button']);
276
318
  /**
277
319
  * Trigger actions onClick event
278
320
  * @param event - click event
@@ -309,16 +351,18 @@ const MgButton = class {
309
351
  this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
310
352
  }
311
353
  };
312
- this.variant = variants$3[0];
313
- this.label = undefined;
314
- this.type = undefined;
315
- this.fullWidth = false;
316
- this.form = undefined;
317
- this.disabled = undefined;
318
- this.isIcon = false;
319
- this.disableOnClick = false;
320
- this.loading = false;
321
- this.classCollection = new Xe(['mg-c-button']);
354
+ /**
355
+ * Set child `<mg-icon>` element `size` prop to follow the current `size` prop
356
+ */
357
+ this.setIconSize = () => {
358
+ var _a, _b;
359
+ if (this.size === 'medium') {
360
+ (_a = this.element.querySelector('mg-icon')) === null || _a === void 0 ? void 0 : _a.removeAttribute('size');
361
+ }
362
+ else if (this.isIcon) {
363
+ (_b = this.element.querySelector('mg-icon')) === null || _b === void 0 ? void 0 : _b.setAttribute('size', this.size);
364
+ }
365
+ };
322
366
  }
323
367
  validateVariant(newValue, oldValue) {
324
368
  // validate new value
@@ -328,13 +372,26 @@ const MgButton = class {
328
372
  this.variant = variants$3[0];
329
373
  return;
330
374
  }
331
- throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${Ye(newValue)}.`);
375
+ throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${Je(newValue)}.`);
376
+ }
377
+ else {
378
+ if (oldValue !== undefined) {
379
+ this.classCollection.delete(`mg-c-button--${oldValue}`);
380
+ }
381
+ this.classCollection.add(`mg-c-button--${newValue}`);
382
+ }
383
+ }
384
+ validateSize(newValue, oldValue) {
385
+ // validate new value
386
+ if (!sizes$2.includes(newValue)) {
387
+ throw new Error(`<mg-button> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${Je(newValue)}.`);
332
388
  }
333
389
  else {
334
390
  if (oldValue !== undefined) {
335
391
  this.classCollection.delete(`mg-c-button--${oldValue}`);
336
392
  }
337
393
  this.classCollection.add(`mg-c-button--${newValue}`);
394
+ this.setIconSize();
338
395
  }
339
396
  }
340
397
  validateFullWidth(newValue) {
@@ -366,6 +423,9 @@ const MgButton = class {
366
423
  // emit value update
367
424
  this.disabledChange.emit(isDisabled);
368
425
  }
426
+ watchIsIcon() {
427
+ this.setIconSize();
428
+ }
369
429
  loadingHandler(newValue) {
370
430
  // we add loading style if it newvalue is true else we remove it
371
431
  if (newValue) {
@@ -381,9 +441,11 @@ const MgButton = class {
381
441
  componentWillLoad() {
382
442
  this.validateVariant(this.variant);
383
443
  this.validateFullWidth(this.fullWidth);
444
+ this.validateSize(this.size);
445
+ this.watchIsIcon();
384
446
  if (this.isIcon) {
385
447
  this.classCollection.add(`mg-c-button--icon`);
386
- if (!me(this.label)) {
448
+ if (!ye(this.label)) {
387
449
  throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
388
450
  }
389
451
  }
@@ -395,7 +457,7 @@ const MgButton = class {
395
457
  * Add listners
396
458
  */
397
459
  componentDidLoad() {
398
- tt(() => {
460
+ et(() => {
399
461
  var _a;
400
462
  const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
401
463
  // submit buttons should trigger form submition;
@@ -412,13 +474,15 @@ const MgButton = class {
412
474
  */
413
475
  render() {
414
476
  var _a;
415
- return (h(Host, { key: '0e3996123ef570a493d645b7a24d4271f13ae7c4', role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { key: 'bef43bda72867ea981814bdeda110d2dec4306f9', class: this.classCollection.join() }, this.loading && h("mg-icon", { key: 'e5754f3ca96f24da369e0961ced9f119b22b8878', icon: "loader", spin: true }), h("div", { key: '20afb713a15e3a003dc4fd0a5470aa764246858e', class: "mg-c-button__content" }, h("slot", { key: 'd0468692516ebc044a14dedbba96d74791552bd1' })))));
477
+ return (h(Host, { key: 'a56efb7c3e49a4aadf6751b10bacb39f20c260df', role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { key: '2d47d068d188161b603b26117256d0e828393348', class: this.classCollection.join() }, this.loading && h("mg-icon", { key: 'ba84820c70834f1e345af506265222340659f8ec', icon: "loader", spin: true }), h("div", { key: 'db6c3437d5de7f828cca7df9d83670de9d3a8ed6', class: "mg-c-button__content" }, h("slot", { key: 'b00f76d92e1e2f9e4dd834bf41419c68c2635d1a' })))));
416
478
  }
417
479
  get element() { return getElement(this); }
418
480
  static get watchers() { return {
419
481
  "variant": ["validateVariant"],
482
+ "size": ["validateSize"],
420
483
  "fullWidth": ["validateFullWidth"],
421
484
  "disabled": ["disabledHandler"],
485
+ "isIcon": ["watchIsIcon"],
422
486
  "loading": ["loadingHandler"]
423
487
  }; }
424
488
  };
@@ -439,7 +503,7 @@ const MgCard = class {
439
503
  * @returns HTML Element
440
504
  */
441
505
  render() {
442
- return (h("div", { key: 'b8de627bd3018342b2e33f62e1779de8c53fa61e', class: "mg-c-card" }, h("slot", { key: '210e9b12485a345ab50d4ddb85d091cde58551a8' })));
506
+ return (h("div", { key: 'e59cabb09dbc28c148770b57de98f130c4479b75', class: "mg-c-card" }, h("slot", { key: 'b6e679317bddd23e73443c601992b7b344d6dc72' })));
443
507
  }
444
508
  };
445
509
  MgCard.style = MgCardStyle0;
@@ -450,18 +514,19 @@ const MgCharacterLeftStyle0 = mgCharacterLeftCss;
450
514
  const MgCharacterLeft = class {
451
515
  constructor(hostRef) {
452
516
  registerInstance(this, hostRef);
453
- this.identifier = undefined;
517
+ /**
518
+ * Sets the characters to count
519
+ */
454
520
  this.characters = '';
455
- this.maxlength = undefined;
456
521
  }
457
522
  watchIdentifier(newValue) {
458
- if (newValue !== undefined && !Ge(newValue)) {
459
- console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
523
+ if (newValue !== undefined && !Ie(newValue)) {
524
+ console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
460
525
  }
461
526
  }
462
527
  validateMaxlength(newValue) {
463
528
  if (typeof newValue !== 'number') {
464
- throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${Ye(newValue)}.`);
529
+ throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${Je(newValue)}.`);
465
530
  }
466
531
  }
467
532
  /*************
@@ -480,7 +545,7 @@ const MgCharacterLeft = class {
480
545
  * @returns HTML Element
481
546
  */
482
547
  render() {
483
- return (h("span", { key: '2b0d8d920df6ec866670736d3ab0c686668befd8', id: this.identifier, "aria-live": "polite" }, h("span", { key: 'd620461fe31ae8845a497b0601be71b3347613db', "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { key: '20b5e5624aaec2cb6b5cb73bc111dff351666521', class: "mg-u-visually-hidden" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
548
+ return (h("span", { key: '38d0a5617735f7f451d8f07f7e4840ccc2539d6b', id: this.identifier, "aria-live": "polite" }, h("span", { key: '382dc20170c5285afdc0c73a76f5797703ffdf9a', "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { key: '8f57b75c08c3da4353f194dc174dff4a3f7e06e4', class: "mg-u-visually-hidden" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
484
549
  }
485
550
  get element() { return getElement(this); }
486
551
  static get watchers() { return {
@@ -497,19 +562,23 @@ const MgDetails = class {
497
562
  constructor(hostRef) {
498
563
  registerInstance(this, hostRef);
499
564
  this.expandedChange = createEvent(this, "expanded-change", 7);
565
+ /**
566
+ * Hide summary element
567
+ */
568
+ this.hideSummary = false;
569
+ /**
570
+ * Define if details are diplayed
571
+ */
572
+ this.expanded = false;
500
573
  /**
501
574
  * Handle details toggle
502
575
  */
503
576
  this.handleToggle = () => {
504
577
  this.expanded = this.details.open;
505
578
  };
506
- this.toggleClosed = undefined;
507
- this.toggleOpened = undefined;
508
- this.hideSummary = false;
509
- this.expanded = false;
510
579
  }
511
580
  validateTitles(newValue) {
512
- if (!me(newValue)) {
581
+ if (!ye(newValue)) {
513
582
  throw new Error(`<mg-details> prop "toggleClosed" and "toggleOpened" is required and must be a valid string. Passed value: "toggleClosed='${this.toggleClosed}'" and "toggleOpened='${this.toggleOpened}'".`);
514
583
  }
515
584
  }
@@ -531,7 +600,7 @@ const MgDetails = class {
531
600
  * @returns HTML Element
532
601
  */
533
602
  render() {
534
- return (h("details", { key: 'd9bd05ca12f405dd25dda244ec0260691d340223', class: "mg-c-details", onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: '2b7893cc0c54d94981d6500776eb22723e1fb5f2' }, h("slot", { key: '714054624ffc1b6b7261edd166bfd16a256e06ce', name: "summary" }), h("span", { key: 'a257d98ed1e8243eae76d259b09bf7fabbfa66e0', class: "mg-c-details__toggle" }, h("mg-icon", { key: '7afafc9c038cbb0d3b984564973776313b9c65c4', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: 'adaaa789315e3c70073087cce6e7ff2136786a38', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: '466d0637025066728de423fc8cc3fa6e49dca70b', class: "mg-c-details__details" }, h("slot", { key: '2f4747fd80523a949f9bc55dab3ebbb5756aad24', name: "details" }))));
603
+ return (h("details", { key: '88fc8b0e86b70ba906ee85b41c2fcc3cb628a9e3', class: "mg-c-details", onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: '54b17765416f8f48df9dbdf845fd17b4512a6f8f' }, h("slot", { key: 'c6a873a83bb7a83ee056cb0d65d92f41241c4776', name: "summary" }), h("span", { key: '9cd5700ebfdd142c3b23ef603a2ee857c9361259', class: "mg-c-details__toggle" }, h("mg-icon", { key: '1d24c1a83a002f2a9cb8d61324ab7f46a189190f', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: 'ee3ac65c4dcf801183b786a739f99c00e90192e7', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: '8c30ce444d7c83d022ac29ef5a2fcccfd9f534ea', class: "mg-c-details__details" }, h("slot", { key: 'cfefe3169934e4fd5e3c539e8f0482ad6a4e082b', name: "details" }))));
535
604
  }
536
605
  static get watchers() { return {
537
606
  "toggleClosed": ["validateTitles"],
@@ -547,6 +616,12 @@ const MgDividerStyle0 = mgDividerCss;
547
616
  const MgDivider = class {
548
617
  constructor(hostRef) {
549
618
  registerInstance(this, hostRef);
619
+ /**************
620
+ * Decorators *
621
+ **************/
622
+ /**
623
+ * Define component size
624
+ */
550
625
  this.fullWidth = false;
551
626
  }
552
627
  /**
@@ -554,7 +629,7 @@ const MgDivider = class {
554
629
  * @returns HTML Element
555
630
  */
556
631
  render() {
557
- return (h("div", { key: 'b7d74c11f15700cbffa553bf4d688ad291473087', class: {
632
+ return (h("div", { key: '60b987cb329c6db14c2cc4a665e7f32b2696a3ee', class: {
558
633
  'mg-c-divider': true,
559
634
  'mg-c-divider--full-width': this.fullWidth,
560
635
  } }));
@@ -582,6 +657,28 @@ const MgForm = class {
582
657
  // Classes
583
658
  this.classAllRequired = 'mg-c-form--all-required';
584
659
  this.classLabelOnTop = 'mg-c-form--label-on-top';
660
+ /**
661
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
662
+ * If not set, it will be created.
663
+ */
664
+ this.identifier = ze('mg-form');
665
+ /**
666
+ * Input name
667
+ * If not set the value equals the identifier
668
+ */
669
+ this.name = this.identifier;
670
+ /**
671
+ * Define if form is readonly
672
+ */
673
+ this.readonly = false;
674
+ /**
675
+ * Define if form is disabled
676
+ */
677
+ this.disabled = false;
678
+ /**
679
+ * Component classes
680
+ */
681
+ this.classCollection = new Ge(['mg-c-form']);
585
682
  /**
586
683
  * Define required message based on mg-inputs required elements
587
684
  */
@@ -667,31 +764,20 @@ const MgForm = class {
667
764
  }
668
765
  });
669
766
  };
670
- this.identifier = qe('mg-form');
671
- this.name = this.identifier;
672
- this.readonly = false;
673
- this.requiredMessage = undefined;
674
- this.ariaRole = undefined;
675
- this.labelOnTop = undefined;
676
- this.disabled = false;
677
- this.valid = undefined;
678
- this.invalid = undefined;
679
- this.classCollection = new Xe(['mg-c-form']);
680
- this.requiredMessageText = undefined;
681
767
  }
682
768
  watchIdentifier(newValue) {
683
- if (!Ge(newValue)) {
684
- console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
769
+ if (!Ie(newValue)) {
770
+ console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
685
771
  }
686
772
  }
687
773
  validateRequiredMessage(newValue) {
688
774
  if (newValue && !requiredMessageStatus.includes(newValue)) {
689
- throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${Ye(newValue)}.`);
775
+ throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${Je(newValue)}.`);
690
776
  }
691
777
  }
692
778
  validateAriaRole(newValue) {
693
779
  if (newValue && !roles.includes(newValue)) {
694
- throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${Ye(newValue)}.`);
780
+ throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${Je(newValue)}.`);
695
781
  }
696
782
  }
697
783
  handlelabelOnTop(newValue) {
@@ -767,17 +853,20 @@ const MgForm = class {
767
853
  */
768
854
  componentDidLoad() {
769
855
  // Update mgInputs when mgForm content change
770
- new MutationObserver(() => {
771
- this.setMgInputs();
772
- this.checkValidity();
773
- }).observe(this.element, { childList: true });
856
+ const observerOptions = { childList: true, subtree: true };
857
+ new MutationObserver((mutations) => {
858
+ if (mutations.some(mutation => Object.keys(observerOptions).includes(mutation.type))) {
859
+ this.setMgInputs();
860
+ this.checkValidity();
861
+ }
862
+ }).observe(this.element, observerOptions);
774
863
  }
775
864
  /**
776
865
  * Render
777
866
  * @returns HTML Element
778
867
  */
779
868
  render() {
780
- return (h("form", { key: 'ecfaff2bb897ce2c48ed352167bb418703a56c98', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: '4d4fa2ff3cf4f25ebe0b009ae1995734bfcafd3b', innerHTML: this.requiredMessageText }), h("slot", { key: 'dc0c7acadf6b744335852f847a8336b018e28cb5' }), !this.readonly && !this.disabled && h("slot", { key: 'ede3ace32f6a88067845013fa65e5414cae5fcea', name: "actions" })));
869
+ return (h("form", { key: 'e61304b43787fba050014fd223f82e36aa76a133', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: '4ff8cc35336c0943584b717c6c5717fb517b4301', innerHTML: this.requiredMessageText }), h("slot", { key: '214cbf3473b2bb00534b315e4faae164e07a14a4' }), !this.readonly && !this.disabled && h("slot", { key: 'db314dd5d606da7dc5fce4c8663f4064586b34be', name: "actions" })));
781
870
  }
782
871
  get element() { return getElement(this); }
783
872
  static get watchers() { return {
@@ -812,6 +901,18 @@ const MgIconStyle0 = mgIconCss;
812
901
  const MgIcon = class {
813
902
  constructor(hostRef) {
814
903
  registerInstance(this, hostRef);
904
+ /**
905
+ * Define icon size
906
+ */
907
+ this.size = 'medium';
908
+ /**
909
+ * Make the icon spin
910
+ */
911
+ this.spin = false;
912
+ /**
913
+ * Component classes
914
+ */
915
+ this.classCollection = new Ge(['mg-c-icon']);
815
916
  /**
816
917
  * Method to set default varianStyle props
817
918
  * needeed has stencil doesn't know that props is mutated when updated in prop watcher
@@ -832,16 +933,10 @@ const MgIcon = class {
832
933
  this.svg.setAttribute('focusable', 'false');
833
934
  this.svg.setAttribute('class', this.classCollection.join());
834
935
  };
835
- this.icon = undefined;
836
- this.size = 'medium';
837
- this.variant = undefined;
838
- this.variantStyle = undefined;
839
- this.spin = false;
840
- this.classCollection = new Xe(['mg-c-icon']);
841
936
  }
842
937
  validateIcon(newValue, oldValue) {
843
938
  if (!Object.keys(icons).includes(newValue))
844
- throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${Ye(newValue)}.`);
939
+ throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${Je(newValue)}.`);
845
940
  else {
846
941
  if (oldValue !== undefined)
847
942
  this.classCollection.delete(`mg-c-icon--${oldValue}`);
@@ -851,7 +946,7 @@ const MgIcon = class {
851
946
  }
852
947
  validateSize(newValue, oldValue) {
853
948
  if (!sizes$1.includes(newValue))
854
- throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${Ye(newValue)}.`);
949
+ throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${Je(newValue)}.`);
855
950
  else {
856
951
  if (oldValue !== undefined)
857
952
  this.classCollection.delete(`mg-c-icon--size-${oldValue}`);
@@ -861,7 +956,7 @@ const MgIcon = class {
861
956
  validateVariant(newValue, oldValue) {
862
957
  if (newValue !== undefined) {
863
958
  if (!variants$2.includes(newValue))
864
- throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${Ye(newValue)}.`);
959
+ throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${Je(newValue)}.`);
865
960
  else {
866
961
  this.setDefaultVariantStyle();
867
962
  if (oldValue !== undefined)
@@ -873,7 +968,7 @@ const MgIcon = class {
873
968
  validateVariantStyle(newValue, oldValue) {
874
969
  if (newValue !== undefined) {
875
970
  if (!variantStyles$1.includes(newValue))
876
- throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${Ye(newValue)}.`);
971
+ throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${Je(newValue)}.`);
877
972
  else {
878
973
  if (oldValue !== undefined)
879
974
  this.classCollection.delete(`mg-c-icon--variant-style-${oldValue}`);
@@ -918,13 +1013,19 @@ const MgIcon = class {
918
1013
  };
919
1014
  MgIcon.style = MgIconStyle0;
920
1015
 
921
- const mgIllustratedMessageCss = "/*!\n * @prop --mg-c-illustrated-message-spacing-vertical: Defines the vertical padding of the illustrated message. Default value: `--mg-b-size-40`.\n */.mg-c-illustrated-message{display:flex;max-width:calc(60*var(--mg-b-size-8));box-sizing:border-box;flex-direction:column;justify-content:center;padding:var(--mg-c-illustrated-message-spacing-vertical) var(--mg-b-size-16);margin:auto;gap:var(--mg-b-size-32) var(--mg-b-size-64);text-align:center}.mg-c-illustrated-message__illustration{max-height:calc(23*var(--mg-b-size-8))}.mg-c-illustrated-message__illustration ::slotted([slot=illustration]){width:auto;max-width:100%;height:auto;max-height:calc(23*var(--mg-b-size-8))}.mg-c-illustrated-message__illustration.mg-c-illustrated-message__illustration--small{max-height:var(--mg-b-size-64)}.mg-c-illustrated-message__illustration.mg-c-illustrated-message__illustration--small ::slotted([slot=illustration]){max-height:var(--mg-b-size-64)}.mg-c-illustrated-message.mg-c-illustrated-message--horizontal{max-width:unset;flex-flow:row wrap;align-items:center}.mg-c-illustrated-message.mg-c-illustrated-message--horizontal .mg-c-illustrated-message__slots,.mg-c-illustrated-message.mg-c-illustrated-message--horizontal .mg-c-illustrated-message__illustration{max-width:calc(60*var(--mg-b-size-8))}.mg-c-illustrated-message__title ::slotted([slot=title]){margin:0;font-family:var(--mg-b-font-family) !important;font-size:var(--mg-b-font-size-h2) !important;font-weight:400 !important}.mg-c-illustrated-message__details ::slotted([slot=details]){margin:var(--mg-b-size-16) 0 0}";
1016
+ const mgIllustratedMessageCss = "/*!\n * @prop --mg-c-illustrated-message-spacing-vertical: Defines the vertical padding of the illustrated message. Default value: `--mg-b-size-40`.\n */.mg-c-illustrated-message{display:flex;max-width:calc(60*var(--mg-b-size-8));box-sizing:border-box;flex-direction:column;justify-content:center;padding:var(--mg-c-illustrated-message-spacing-vertical) var(--mg-b-size-16);margin:auto;gap:var(--mg-b-size-32) var(--mg-b-size-64);text-align:center}.mg-c-illustrated-message__illustration{max-height:calc(23*var(--mg-b-size-8))}.mg-c-illustrated-message__illustration ::slotted([slot=illustration]){width:100%;max-width:100%;height:auto;max-height:calc(23*var(--mg-b-size-8))}.mg-c-illustrated-message__illustration.mg-c-illustrated-message__illustration--small{max-height:var(--mg-b-size-64)}.mg-c-illustrated-message__illustration.mg-c-illustrated-message__illustration--small ::slotted([slot=illustration]){max-height:var(--mg-b-size-64)}.mg-c-illustrated-message.mg-c-illustrated-message--horizontal{max-width:unset;flex-flow:row wrap;align-items:center}.mg-c-illustrated-message.mg-c-illustrated-message--horizontal .mg-c-illustrated-message__slots,.mg-c-illustrated-message.mg-c-illustrated-message--horizontal .mg-c-illustrated-message__illustration{max-width:calc(60*var(--mg-b-size-8))}.mg-c-illustrated-message__title ::slotted([slot=title]){margin:0;font-family:var(--mg-b-font-family) !important;font-size:var(--mg-b-font-size-h2) !important;font-weight:400 !important}.mg-c-illustrated-message__details ::slotted([slot=details]){margin:var(--mg-b-size-16) 0 0}";
922
1017
  const MgIllustratedMessageStyle0 = mgIllustratedMessageCss;
923
1018
 
924
1019
  const MgIllustratedMessage = class {
925
1020
  constructor(hostRef) {
926
1021
  registerInstance(this, hostRef);
1022
+ /**
1023
+ * Define illustration size
1024
+ */
927
1025
  this.size = 'medium';
1026
+ /**
1027
+ * Define component orientation
1028
+ */
928
1029
  this.direction = 'vertical';
929
1030
  }
930
1031
  /*************
@@ -949,13 +1050,13 @@ const MgIllustratedMessage = class {
949
1050
  * @returns HTML Element
950
1051
  */
951
1052
  render() {
952
- return (h("div", { key: '475cdb177405fc41e5dde86d9a3884de5fb88bef', class: {
1053
+ return (h("div", { key: 'ae59b32d798c888eef5f2b3464160177b7a2e9d8', class: {
953
1054
  'mg-c-illustrated-message': true,
954
1055
  'mg-c-illustrated-message--horizontal': this.direction === 'horizontal',
955
- } }, h("div", { key: '0e007f09bcdcd85d50bd16ed37f9f4d399c14e28', class: {
1056
+ } }, h("div", { key: '05d260716090d503dde8e0dddc79db0a5f553f0b', class: {
956
1057
  'mg-c-illustrated-message__illustration': true,
957
1058
  'mg-c-illustrated-message__illustration--small': this.size === 'small',
958
- } }, h("slot", { key: '41190bb4bc5d13cecbf7b847c58af7975ffc0255', name: "illustration" })), h("div", { key: 'c338cba5ecac003b1642800441139e497f3c3769', class: "mg-c-illustrated-message__slots" }, h("div", { key: '804f5fc5a96d87d4e533d64eb80d275377dec0cf', class: "mg-c-illustrated-message__title" }, h("slot", { key: 'c5db8d1c61b0b85bc94905dc4b4bfe3ce44d48d1', name: "title" })), h("div", { key: 'e5be01c4e24a60a039a072946d12275bf46b681d', class: "mg-c-illustrated-message__details" }, h("slot", { key: '76eaf55622ed37c42f40ec832ec48ca6ab66e42c', name: "details" })))));
1059
+ } }, h("slot", { key: '119f517d66d9d4fe1bbc84341fccab9db1070c06', name: "illustration" })), h("div", { key: 'cc00f05411b3d8103e566d01d48a6ab66438027c', class: "mg-c-illustrated-message__slots" }, h("div", { key: '1832b69ce391c8c018bfc3acad75ded56dc0d484', class: "mg-c-illustrated-message__title" }, h("slot", { key: 'd0dfb8c433246571c140797f99f434cb64c67e7e', name: "title" })), h("div", { key: '75b18511e74d1d4d049e698c3fb43ad4f00450c3', class: "mg-c-illustrated-message__details" }, h("slot", { key: '78e11fa31da149666973e03fe707e302d60f8989', name: "details" })))));
959
1060
  }
960
1061
  get element() { return getElement(this); }
961
1062
  };
@@ -988,31 +1089,45 @@ const MgInput = class {
988
1089
  this.classHasError = 'mg-c-input--has-error';
989
1090
  this.classLabelOnTop = 'mg-c-input--label-on-top';
990
1091
  /**
991
- * Get tooltip node
992
- * @returns mg-tooltip
1092
+ * Define if label is visible
993
1093
  */
994
- this.renderTooltip = () => (h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, h("mg-icon", { icon: "info-circle" })));
995
- this.identifier = undefined;
996
- this.label = undefined;
997
- this.labelOnTop = undefined;
998
1094
  this.labelHide = false;
999
- this.tooltip = undefined;
1095
+ /**
1096
+ * Define tooltip position
1097
+ */
1000
1098
  this.tooltipPosition = 'input';
1099
+ /**
1100
+ * Define if input is required
1101
+ */
1001
1102
  this.required = false;
1002
- this.errorMessage = undefined;
1003
- this.helpText = undefined;
1004
- this.ariaDescribedbyIDs = undefined;
1103
+ /**
1104
+ * Element is fieldset
1105
+ */
1005
1106
  this.isFieldset = false;
1107
+ /**
1108
+ * Element is readonly
1109
+ */
1006
1110
  this.isReadonly = false;
1111
+ /**
1112
+ * Element is disabled
1113
+ */
1007
1114
  this.isDisabled = false;
1115
+ /**
1116
+ * Element is disabled
1117
+ */
1008
1118
  this.isVerticalList = false;
1119
+ /**
1120
+ * Get tooltip node
1121
+ * @returns mg-tooltip
1122
+ */
1123
+ this.renderTooltip = () => (h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, h("mg-icon", { icon: "info-circle" })));
1009
1124
  }
1010
1125
  watchIdentifier(newValue) {
1011
- if (!me(newValue)) {
1012
- throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${Ye(newValue)}.`);
1126
+ if (!ye(newValue)) {
1127
+ throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${Je(newValue)}.`);
1013
1128
  }
1014
- else if (!Ge(newValue)) {
1015
- console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
1129
+ else if (!Ie(newValue)) {
1130
+ console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
1016
1131
  }
1017
1132
  else {
1018
1133
  this.helpTextId = `${this.identifier}-help-text`;
@@ -1034,7 +1149,7 @@ const MgInput = class {
1034
1149
  }
1035
1150
  watchTooltipPosition(newValue) {
1036
1151
  if (!tooltipPositions.includes(newValue)) {
1037
- throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${Ye(newValue)}.`);
1152
+ throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${Je(newValue)}.`);
1038
1153
  }
1039
1154
  }
1040
1155
  watchErrorMessage(newValue) {
@@ -1077,7 +1192,10 @@ const MgInput = class {
1077
1192
  ariaDescribedbyIDs.add(this.helpTextErrorId);
1078
1193
  }
1079
1194
  this.element.querySelectorAll('input,select,textarea,[role="switch"]').forEach(element => {
1080
- element.setAttribute('aria-describedby', Array.from(ariaDescribedbyIDs).join(' '));
1195
+ if (ariaDescribedbyIDs.size)
1196
+ element.setAttribute('aria-describedby', Array.from(ariaDescribedbyIDs).join(' '));
1197
+ else
1198
+ element.removeAttribute('aria-describedby');
1081
1199
  });
1082
1200
  }
1083
1201
  /**
@@ -1098,8 +1216,8 @@ const MgInput = class {
1098
1216
  */
1099
1217
  // eslint-disable-next-line @stencil-community/no-unused-watch
1100
1218
  watchLabel() {
1101
- if (!me(this.label)) {
1102
- throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${Ye(this.label)}.`);
1219
+ if (!ye(this.label)) {
1220
+ throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${Je(this.label)}.`);
1103
1221
  }
1104
1222
  else {
1105
1223
  this.watchAriaDescribedbyIDs();
@@ -1191,7 +1309,7 @@ const MgInput = class {
1191
1309
  */
1192
1310
  render() {
1193
1311
  const isGroup = this.isFieldset && !this.isReadonly;
1194
- return (h(Host, { key: '628e189d5e91c6146c2e8ab5b9374b5cc4132786', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, h("div", { key: '9471070c3810c71fe5335f31012fa9294dbcadde', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, h("slot", { key: 'd653ebdb538ba4325b76d92725a8192245b022ab', name: this.slotLabel }), this.tooltip && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), h("div", { key: '6c9d40fc0ae6b51581659470c14678474885bc0c', class: "mg-c-input__input-container" }, h("div", { key: '5f80ebc33f11151607322133f995374056321453', class: "mg-c-input__input" }, h("slot", { key: 'da67674bb91c4957c850cd50b0196f4aeaa8f4d0' }), this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()), this.helptextMessageSlotElement && (h("div", { key: '25be9fc701e42a4b2eb0ecc01d22ca0be271c1d9', class: "mg-c-input__help-text" }, h("slot", { key: 'fc6b29fdc35e52d90646cbf1d9f2f3e631371dc7', name: this.slotHelpText }))), !this.isDisabled && this.errorMessage && (h("div", { key: '3ad2878abfa52fb5129cf773e907f75fac9a0985', class: "mg-c-input__error", "aria-live": "assertive" }, h("slot", { key: '1c72d4ab723c8c7805a1dcc8c6554ac24739f080', name: this.slotError }))))));
1312
+ return (h(Host, { key: '2b69235bf675e431e61261d1a4465e216675bbb2', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, h("div", { key: '7cbe4343e2d6ebbad943b4562c69b8e2f583fe23', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, h("slot", { key: 'af2c9482dd4a66c62047edc8fecef17efeeb6537', name: this.slotLabel }), this.tooltip && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), h("div", { key: 'b48eaa21ea25c08b3a04c1f0d22c9c59bd535e26', class: "mg-c-input__input-container" }, h("div", { key: '3f61784438dd63b5ccf7fd8cbb50b51ae3ac982e', class: "mg-c-input__input" }, h("slot", { key: '05bed4a07201b7fe65c82886ebf8ac63b004be4e' }), this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()), this.helptextMessageSlotElement && (h("div", { key: 'b27e2ae017422b7408780521a1d38f9b094c341c', class: "mg-c-input__help-text" }, h("slot", { key: '3798d38bcbdabfeec3b0e9f97c2074734ffd7149', name: this.slotHelpText }))), !this.isDisabled && this.errorMessage && (h("div", { key: '70f4ea8fda4fb884934e3d3c9d34c67eb6db9ab9', class: "mg-c-input__error", "aria-live": "assertive" }, h("slot", { key: '90c13c82e7b7a9c820bcab5cdad7f09ce95b8512', name: this.slotError }))))));
1195
1313
  }
1196
1314
  get element() { return getElement(this); }
1197
1315
  static get watchers() { return {
@@ -1263,6 +1381,55 @@ const MgInputCheckbox = class {
1263
1381
  this.searchStart = 10;
1264
1382
  // popover variables
1265
1383
  this.hasOpenedPopover = false;
1384
+ /**
1385
+ * Define input name
1386
+ * If not set the value equals the identifier
1387
+ */
1388
+ this.name = this.identifier;
1389
+ /**
1390
+ * Define if label is visible
1391
+ */
1392
+ this.labelHide = false;
1393
+ /**
1394
+ * Define if inputs are display verticaly
1395
+ */
1396
+ this.inputVerticalList = false;
1397
+ /**
1398
+ * Define if mg-input-checkbox is required
1399
+ */
1400
+ this.required = false;
1401
+ /**
1402
+ * Define if mg-input-checkbox is readonly
1403
+ */
1404
+ this.readonly = false;
1405
+ /**
1406
+ * Define if input is disabled
1407
+ */
1408
+ this.disabled = false;
1409
+ /**
1410
+ * Define tooltip position
1411
+ */
1412
+ this.tooltipPosition = 'input';
1413
+ /**
1414
+ * Component classes
1415
+ */
1416
+ this.classCollection = new Ge([this.baseClassName, classFieldset]);
1417
+ /**
1418
+ * Formated value to display in list
1419
+ */
1420
+ this.checkboxItems = [];
1421
+ /**
1422
+ * Search value query
1423
+ */
1424
+ this.searchValue = '';
1425
+ /**
1426
+ * Search current page
1427
+ */
1428
+ this.searchResults = [];
1429
+ /**
1430
+ * Select values button text local key
1431
+ */
1432
+ this.selectValuesButtonKey = 'editButton';
1266
1433
  /**
1267
1434
  * Handle input event
1268
1435
  * @param event - input event
@@ -1364,7 +1531,7 @@ const MgInputCheckbox = class {
1364
1531
  * Method to update searchResults
1365
1532
  */
1366
1533
  this.updateSearchResults = () => {
1367
- this.searchResults = this.checkboxItems.filter(item => et(item.title).includes(et(this.searchValue)));
1534
+ this.searchResults = this.checkboxItems.filter(item => Ve(item.title).includes(Ve(this.searchValue)));
1368
1535
  };
1369
1536
  /**
1370
1537
  * Method to validate if one of inputs value is checked id required
@@ -1396,13 +1563,13 @@ const MgInputCheckbox = class {
1396
1563
  * @returns message to display
1397
1564
  */
1398
1565
  this.getSelectValuesButtonMessage = () => {
1399
- if (this.selectValuesButtonKey === 'editButton' && me(this.editButtonMessage)) {
1566
+ if (this.selectValuesButtonKey === 'editButton' && ye(this.editButtonMessage)) {
1400
1567
  return this.editButtonMessage;
1401
1568
  }
1402
- else if (this.selectValuesButtonKey === 'showButton' && me(this.showButtonMessage)) {
1569
+ else if (this.selectValuesButtonKey === 'showButton' && ye(this.showButtonMessage)) {
1403
1570
  return this.showButtonMessage;
1404
1571
  }
1405
- else if (this.selectValuesButtonKey === 'selectButton' && me(this.selectButtonMessage)) {
1572
+ else if (this.selectValuesButtonKey === 'selectButton' && ye(this.selectButtonMessage)) {
1406
1573
  return this.selectButtonMessage;
1407
1574
  }
1408
1575
  else {
@@ -1451,33 +1618,6 @@ const MgInputCheckbox = class {
1451
1618
  * @returns The rendered MgInputCheckboxList component.
1452
1619
  */
1453
1620
  this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name, invalid: this.invalid }));
1454
- this.value = undefined;
1455
- this.type = undefined;
1456
- this.identifier = undefined;
1457
- this.name = this.identifier;
1458
- this.label = undefined;
1459
- this.labelOnTop = undefined;
1460
- this.labelHide = false;
1461
- this.inputVerticalList = false;
1462
- this.required = false;
1463
- this.readonly = false;
1464
- this.displaySelectedValues = undefined;
1465
- this.disabled = false;
1466
- this.tooltip = undefined;
1467
- this.tooltipPosition = 'input';
1468
- this.helpText = undefined;
1469
- this.valid = undefined;
1470
- this.invalid = undefined;
1471
- this.editButtonMessage = undefined;
1472
- this.showButtonMessage = undefined;
1473
- this.selectButtonMessage = undefined;
1474
- this.classCollection = new Xe([this.baseClassName, classFieldset]);
1475
- this.errorMessage = undefined;
1476
- this.checkboxItems = [];
1477
- this.displaySearchInput = undefined;
1478
- this.searchValue = '';
1479
- this.searchResults = [];
1480
- this.selectValuesButtonKey = 'editButton';
1481
1621
  }
1482
1622
  validateValue(newValue) {
1483
1623
  if (isCheckboxItems(newValue)) {
@@ -1485,12 +1625,12 @@ const MgInputCheckbox = class {
1485
1625
  this.valueChange.emit(newValue);
1486
1626
  }
1487
1627
  else {
1488
- throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${Ye(newValue)}.`);
1628
+ throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${Je(newValue)}.`);
1489
1629
  }
1490
1630
  }
1491
1631
  validateType(newValue) {
1492
1632
  if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
1493
- throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${Ye(newValue)}.`);
1633
+ throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${Je(newValue)}.`);
1494
1634
  }
1495
1635
  else if (newValue === undefined) {
1496
1636
  this.mode = 'auto';
@@ -1562,10 +1702,21 @@ const MgInputCheckbox = class {
1562
1702
  /**
1563
1703
  * Display input error if it exists.
1564
1704
  */
1565
- async displayError() {
1566
- this.checkValidity();
1567
- this.setErrorMessage();
1568
- this.hasDisplayedError = this.invalid;
1705
+ displayError() {
1706
+ // Use `Promise` as requested for stencil method
1707
+ // Use `requestAnimationFrame` to ensure:
1708
+ // - DOM is fully updated before validation
1709
+ // - Async operations are completed
1710
+ // - No timing issues with Stencil's render cycle
1711
+ // - Keep everything in sync both inside and outside the component
1712
+ return new Promise(resolve => {
1713
+ requestAnimationFrame(() => {
1714
+ this.checkValidity();
1715
+ this.setErrorMessage();
1716
+ this.hasDisplayedError = this.invalid;
1717
+ resolve();
1718
+ });
1719
+ });
1569
1720
  }
1570
1721
  /**
1571
1722
  * Set an error and display a custom error message.
@@ -1579,7 +1730,7 @@ const MgInputCheckbox = class {
1579
1730
  if (typeof valid !== 'boolean') {
1580
1731
  throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
1581
1732
  }
1582
- else if (!me(errorMessage)) {
1733
+ else if (!ye(errorMessage)) {
1583
1734
  throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
1584
1735
  }
1585
1736
  else {
@@ -1716,7 +1867,7 @@ const MgInputCheckbox = class {
1716
1867
  else {
1717
1868
  inputContent = this.renderCheckboxMulti();
1718
1869
  }
1719
- return (h("mg-input", { key: '5a6c84d1f533159645c5aec09bb6e82a7cd30cc7', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
1870
+ return (h("mg-input", { key: '08c3ca7708ff929696a83a8d7c4fe627e7651963', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
1720
1871
  }
1721
1872
  get element() { return getElement(this); }
1722
1873
  static get watchers() { return {
@@ -1742,6 +1893,18 @@ const MgInputCheckboxPaginated = class {
1742
1893
  * Constantes *
1743
1894
  *************/
1744
1895
  this.offset = 10;
1896
+ /**
1897
+ * Current page
1898
+ */
1899
+ this.currentPage = 1;
1900
+ /**
1901
+ * Define checkboxes to paginate
1902
+ */
1903
+ this.checkboxes = [];
1904
+ /**
1905
+ * Is checked items values expanded
1906
+ */
1907
+ this.expanded = true;
1745
1908
  /***********
1746
1909
  * Methods *
1747
1910
  ***********/
@@ -1777,14 +1940,6 @@ const MgInputCheckboxPaginated = class {
1777
1940
  this.handleCurrentPageChange = (event) => {
1778
1941
  this.currentPage = Number(event.detail);
1779
1942
  };
1780
- this.readonly = undefined;
1781
- this.disabled = undefined;
1782
- this.name = undefined;
1783
- this.invalid = undefined;
1784
- this.currentPage = 1;
1785
- this.checkboxes = [];
1786
- this.messages = undefined;
1787
- this.expanded = true;
1788
1943
  }
1789
1944
  watchCheckboxes(newValue, oldValue) {
1790
1945
  const pageCountNewValue = this.getPageCount(newValue);
@@ -1824,10 +1979,10 @@ const MgInputCheckboxPaginated = class {
1824
1979
  * @returns HTML Element
1825
1980
  */
1826
1981
  render() {
1827
- const getText = (checkboxes) => (h("em", { key: '05d577bded8e2602d1dedf9a36f695904d491242', class: "mg-c-input__section-header-title-label" }, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`));
1982
+ const getText = (checkboxes) => (h("em", { key: '8f20e5be81047106e04cd101385b9c6555c0c38d', class: "mg-c-input__section-header-title-label" }, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`));
1828
1983
  const [from, to] = this.getFromToIndexes();
1829
1984
  const itemsContainerId = `items-${this.sectionKind}-container`;
1830
- return (h(Host, { key: '49b95a0882cc475aab4a810ccd8f292d83b59a9a', hidden: this.checkboxes.length < 1 }, h("div", { key: '2db5103f9784add1effb7a5dcafa8f8196601d14', class: "mg-c-input__section-header" }, this.sectionKind === SectionKind.SELECTED ? (h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), h("span", { class: "mg-c-input__section-header-title" }, getText(this.checkboxes)))) : (h("p", { class: "mg-c-input__section-header-title mg-c-input__section-header-title--static" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (h("mg-tooltip", { key: '946506778c280928acd6e3e7256c828b7a7598b5', class: "mg-c-input__section-header-tootlip", message: this.messages.tooltip }, h("mg-button", { key: 'b71a4e10a764bfaf438430dd44b6f82785d0f5d4', variant: "link", onClick: this.massActionHandler }, this.messages.action))), this.expanded && this.getPageCount(this.checkboxes) > 1 && (h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { key: '06af47b1e9f0a6d0a11741dae03f75ce71e32666', hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__section-content" }, h(MgInputCheckboxList, { key: 'aba29baa719288ad0b172326c669d146c803a4e4', checkboxes: this.getArrayRange(this.checkboxes, from, to), displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, disabled: this.disabled, name: this.name, invalid: this.invalid }))));
1985
+ return (h(Host, { key: '39d0fc41abe4b537b240bdc14e80fc42cb41033d', hidden: this.checkboxes.length < 1 }, h("div", { key: 'fec430cfffc005a217694f9a4ba68412a6a08c7b', class: "mg-c-input__section-header" }, this.sectionKind === SectionKind.SELECTED ? (h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), h("span", { class: "mg-c-input__section-header-title" }, getText(this.checkboxes)))) : (h("p", { class: "mg-c-input__section-header-title mg-c-input__section-header-title--static" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (h("mg-tooltip", { key: 'e1b38d93875962af3024ac27e1892c040dbf9bdb', class: "mg-c-input__section-header-tootlip", message: this.messages.tooltip }, h("mg-button", { key: 'f593b3d5ca5bd8b3080253842a5c513709f16e3a', variant: "link", onClick: this.massActionHandler }, this.messages.action))), this.expanded && this.getPageCount(this.checkboxes) > 1 && (h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { key: '74c18984938188e2861cd79b56d919a94f32064f', hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__section-content" }, h(MgInputCheckboxList, { key: '15c2f6fe98d772ce5b0a0d4ec448986e91592107', checkboxes: this.getArrayRange(this.checkboxes, from, to), displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, disabled: this.disabled, name: this.name, invalid: this.invalid }))));
1831
1986
  }
1832
1987
  static get watchers() { return {
1833
1988
  "checkboxes": ["watchCheckboxes"]
@@ -1844,12 +1999,46 @@ const MgInputDate = class {
1844
1999
  this.inputValid = createEvent(this, "input-valid", 7);
1845
2000
  // hasDisplayedError (triggered by blur event)
1846
2001
  this.hasDisplayedError = false;
2002
+ /**
2003
+ * Input name
2004
+ * If not set the value equals the identifier
2005
+ */
2006
+ this.name = this.identifier;
2007
+ /**
2008
+ * Define if label is visible
2009
+ */
2010
+ this.labelHide = false;
2011
+ /**
2012
+ * Define if input is required
2013
+ */
2014
+ this.required = false;
2015
+ /**
2016
+ * Define if input is readonly
2017
+ */
2018
+ this.readonly = false;
2019
+ /**
2020
+ * Define input maximum date
2021
+ * format: yyyy-mm-dd
2022
+ */
2023
+ this.max = '9999-12-31';
2024
+ /**
2025
+ * Define if input is disabled
2026
+ */
2027
+ this.disabled = false;
2028
+ /**
2029
+ * Define tooltip position
2030
+ */
2031
+ this.tooltipPosition = 'input';
2032
+ /**
2033
+ * Component classes
2034
+ */
2035
+ this.classCollection = new Ge(['mg-c-input--date']);
1847
2036
  /**
1848
2037
  * Method to validate date pattern string
1849
2038
  * @param value - value to test
1850
2039
  * @returns truthy when value match the pattern
1851
2040
  */
1852
- this.isValidPattern = (value) => me(value) && He.test(value);
2041
+ this.isValidPattern = (value) => ye(value) && Be.test(value);
1853
2042
  /**
1854
2043
  * Format help text to display
1855
2044
  * @param helpText - help text format
@@ -1857,10 +2046,10 @@ const MgInputDate = class {
1857
2046
  */
1858
2047
  this.formatHelpText = (helpText) => {
1859
2048
  const defaultHelpTextVariable = '{defaultHelpText}';
1860
- let text = me(helpText) ? helpText : this.messages.input.date.helpText;
2049
+ let text = ye(helpText) ? helpText : this.messages.input.date.helpText;
1861
2050
  if (text.includes(defaultHelpTextVariable))
1862
2051
  text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
1863
- return text.replace('{pattern}', this.renderPattern()).replace('{date}', ze(ft(new Date('2023-12-24')), this.systemLocale));
2052
+ return text.replace('{pattern}', this.renderPattern()).replace('{date}', Pe(ct(new Date('2023-12-24')), this.systemLocale));
1864
2053
  };
1865
2054
  /**
1866
2055
  * Handle input event
@@ -1891,7 +2080,7 @@ const MgInputDate = class {
1891
2080
  // when we reset the field we need to test a blank value.
1892
2081
  if (['Delete', 'Backspace'].includes(event.key)) {
1893
2082
  event.preventDefault();
1894
- this.value = '';
2083
+ this.value = null;
1895
2084
  this.checkValidity();
1896
2085
  if (this.hasDisplayedError) {
1897
2086
  this.setErrorMessage();
@@ -1902,7 +2091,7 @@ const MgInputDate = class {
1902
2091
  * Check if input is valid
1903
2092
  */
1904
2093
  this.checkValidity = () => {
1905
- this.setValidity(this.readonly || this.disabled || (this.input.checkValidity() && (['', undefined].includes(this.value) || this.isValidPattern(this.value))));
2094
+ this.setValidity(this.readonly || this.disabled || (this.input.checkValidity() && (this.value === null || this.isValidPattern(this.value))));
1906
2095
  };
1907
2096
  /**
1908
2097
  * get input error code
@@ -1911,14 +2100,14 @@ const MgInputDate = class {
1911
2100
  this.getInputError = () => {
1912
2101
  var _a;
1913
2102
  let inputError = null;
2103
+ // bad input or pattern
2104
+ if (this.input.validity.badInput || (this.value && !this.isValidPattern(this.value))) {
2105
+ inputError = 'badInput';
2106
+ }
1914
2107
  // required
1915
- if (this.input.validity.valueMissing) {
2108
+ else if (this.input.validity.valueMissing) {
1916
2109
  inputError = 'required';
1917
2110
  }
1918
- // pattern
1919
- else if (this.value && !this.isValidPattern(this.value)) {
1920
- inputError = 'badInput';
1921
- }
1922
2111
  // min & max
1923
2112
  else if ((this.input.validity.rangeUnderflow || this.input.validity.rangeOverflow) && ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.max !== '9999-12-31') {
1924
2113
  inputError = 'minMax';
@@ -1952,8 +2141,8 @@ const MgInputDate = class {
1952
2141
  // min, max & minMax
1953
2142
  else if (['min', 'max', 'minMax'].includes(inputError)) {
1954
2143
  this.errorMessage = this.messages.errors.date[inputError]
1955
- .replace('{min}', ze(this.min, this.systemLocale))
1956
- .replace('{max}', ze(this.max, this.systemLocale));
2144
+ .replace('{min}', Pe(this.min, this.systemLocale))
2145
+ .replace('{max}', Pe(this.max, this.systemLocale));
1957
2146
  }
1958
2147
  // wrong date format
1959
2148
  // element.validity.badInput is default error message
@@ -1967,40 +2156,26 @@ const MgInputDate = class {
1967
2156
  * @returns translated html pattern
1968
2157
  */
1969
2158
  this.renderPattern = () => {
1970
- let patternLocal = ct(this.systemLocale);
2159
+ let patternLocal = at(this.systemLocale);
1971
2160
  for (const key in this.messages.input.date.pattern) {
1972
2161
  patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
1973
2162
  }
1974
2163
  return `<span aria-hidden="true">${patternLocal}</span><span class="mg-u-visually-hidden">${[...patternLocal].join(' ')}</span>`;
1975
2164
  };
1976
- this.value = undefined;
1977
- this.identifier = undefined;
1978
- this.name = this.identifier;
1979
- this.label = undefined;
1980
- this.labelOnTop = undefined;
1981
- this.labelHide = false;
1982
- this.required = false;
1983
- this.readonly = false;
1984
- this.min = undefined;
1985
- this.max = '9999-12-31';
1986
- this.disabled = false;
1987
- this.tooltip = undefined;
1988
- this.tooltipPosition = 'input';
1989
- this.helpText = undefined;
1990
- this.valid = undefined;
1991
- this.invalid = undefined;
1992
- this.classCollection = new Xe(['mg-c-input--date']);
1993
- this.errorMessage = undefined;
1994
2165
  }
1995
2166
  validateValue(newValue) {
1996
2167
  // When the input is not fully completed or has been cleared, the value becomes an empty string.
1997
- if (newValue === '')
1998
- newValue = null;
1999
- // check value validity
2000
- if (newValue && !me(newValue)) {
2001
- throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${Ye(newValue)}.`);
2168
+ if (['', undefined].includes(newValue)) {
2169
+ // need to force value update to `null` to prevent extra render
2170
+ // - `''` is not a valide value
2171
+ // - `undefined` is not allowed in CustomEvent['detail']
2172
+ this.value = null;
2002
2173
  }
2003
- else if ([null, undefined].includes(newValue) || this.isValidPattern(newValue)) {
2174
+ else if (newValue && !ye(newValue)) {
2175
+ // check value validity
2176
+ throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${Je(newValue)}.`);
2177
+ }
2178
+ else if (newValue === null || this.isValidPattern(newValue)) {
2004
2179
  this.valueChange.emit(newValue);
2005
2180
  }
2006
2181
  else {
@@ -2015,7 +2190,7 @@ const MgInputDate = class {
2015
2190
  }
2016
2191
  validateMinMax(newValue) {
2017
2192
  if (newValue && !this.isValidPattern(newValue)) {
2018
- throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${Ye(newValue)}.`);
2193
+ throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${Je(newValue)}.`);
2019
2194
  }
2020
2195
  }
2021
2196
  handleValidityChange(newValue, _oldValue, prop) {
@@ -2037,10 +2212,21 @@ const MgInputDate = class {
2037
2212
  /**
2038
2213
  * Display input error if it exists.
2039
2214
  */
2040
- async displayError() {
2041
- this.checkValidity();
2042
- this.setErrorMessage();
2043
- this.hasDisplayedError = this.invalid;
2215
+ displayError() {
2216
+ // Use `Promise` as requested for stencil method
2217
+ // Use `requestAnimationFrame` to ensure:
2218
+ // - DOM is fully updated before validation
2219
+ // - Async operations are completed
2220
+ // - No timing issues with Stencil's render cycle
2221
+ // - Keep everything in sync both inside and outside the component
2222
+ return new Promise(resolve => {
2223
+ requestAnimationFrame(() => {
2224
+ this.checkValidity();
2225
+ this.setErrorMessage();
2226
+ this.hasDisplayedError = this.invalid;
2227
+ resolve();
2228
+ });
2229
+ });
2044
2230
  }
2045
2231
  /**
2046
2232
  * Set an error and display a custom error message.
@@ -2054,7 +2240,7 @@ const MgInputDate = class {
2054
2240
  if (typeof valid !== 'boolean') {
2055
2241
  throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean.');
2056
2242
  }
2057
- else if (!me(errorMessage)) {
2243
+ else if (!ye(errorMessage)) {
2058
2244
  throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string.');
2059
2245
  }
2060
2246
  else {
@@ -2068,7 +2254,7 @@ const MgInputDate = class {
2068
2254
  */
2069
2255
  async reset() {
2070
2256
  if (!this.readonly) {
2071
- this.value = '';
2257
+ this.value = null;
2072
2258
  this.checkValidity();
2073
2259
  this.invalid = false;
2074
2260
  this.errorMessage = undefined;
@@ -2120,7 +2306,7 @@ const MgInputDate = class {
2120
2306
  * @returns HTML Element
2121
2307
  */
2122
2308
  render() {
2123
- return (h("mg-input", { key: '33ffeaf0b7b07cc65081891709a73a44c9454092', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && ['', undefined].includes(this.value) ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, ze(this.value, this.locale))) : (h("input", { type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
2309
+ return (h("mg-input", { key: '09d07883b178cd1196c2be110c8fcfdde8fef01d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === null ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, Pe(this.value, this.locale))) : (h("input", { type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
2124
2310
  if (el !== null)
2125
2311
  this.input = el;
2126
2312
  } }))));
@@ -2143,7 +2329,7 @@ MgInputDate.style = MgInputDateStyle0;
2143
2329
  const types = ['decimal', 'integer'];
2144
2330
  const formats = ['none', 'number', 'currency', 'percent', 'unit'];
2145
2331
 
2146
- const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
2332
+ const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
2147
2333
  const MgInputNumericStyle0 = mgInputNumericCss;
2148
2334
 
2149
2335
  const MgInputNumeric = class {
@@ -2154,32 +2340,88 @@ const MgInputNumeric = class {
2154
2340
  // hasDisplayedError (triggered by blur event)
2155
2341
  this.hasDisplayedError = false;
2156
2342
  /**
2157
- * Handle input event
2343
+ * Input name
2344
+ * If not set the value equals the identifier
2158
2345
  */
2159
- this.handleInput = () => {
2160
- // Check validity
2161
- this.checkValidity();
2162
- if (this.hasDisplayedError) {
2163
- this.setErrorMessage();
2164
- }
2165
- this.value = this.input.value;
2166
- };
2346
+ this.name = this.identifier;
2167
2347
  /**
2168
- * Handle focus event
2348
+ * Define if label is visible
2169
2349
  */
2170
- this.handleFocus = () => {
2171
- this.hasFocus = true;
2172
- };
2350
+ this.labelHide = false;
2173
2351
  /**
2174
- * Handle blur event
2352
+ * Define if input is required
2175
2353
  */
2176
- this.handleBlur = () => {
2177
- if (this.value === '-')
2178
- this.value = '';
2179
- // Display Error
2180
- this.handlerInProgress = 'blur';
2181
- this.displayError().finally(() => {
2182
- // reset guard
2354
+ this.required = false;
2355
+ /**
2356
+ * Define if input is readonly
2357
+ */
2358
+ this.readonly = false;
2359
+ /**
2360
+ * Define if input is disabled
2361
+ */
2362
+ this.disabled = false;
2363
+ /**
2364
+ * Define tooltip position
2365
+ */
2366
+ this.tooltipPosition = 'input';
2367
+ /**
2368
+ * Define numeric type
2369
+ */
2370
+ this.type = 'decimal';
2371
+ /**
2372
+ * Set local formatting.
2373
+ * Numbers are formatted based on the locale.
2374
+ */
2375
+ this.format = 'number';
2376
+ /**
2377
+ * Define currency
2378
+ */
2379
+ this.currency = 'EUR';
2380
+ /**
2381
+ * Define unit display format ('short', 'long', 'narrow')
2382
+ */
2383
+ this.unitDisplay = 'short';
2384
+ /**
2385
+ * Override integer length
2386
+ * integer is the number before the decimal point
2387
+ */
2388
+ this.integerLength = 13;
2389
+ /**
2390
+ * Override decimal length
2391
+ * decimal is the number after the decimal point
2392
+ */
2393
+ this.decimalLength = 2;
2394
+ /**
2395
+ * Component classes
2396
+ */
2397
+ this.classCollection = new Ge(['mg-c-input--numeric']);
2398
+ /**
2399
+ * Handle input event
2400
+ */
2401
+ this.handleInput = () => {
2402
+ // Check validity
2403
+ this.checkValidity();
2404
+ if (this.hasDisplayedError) {
2405
+ this.setErrorMessage();
2406
+ }
2407
+ this.value = this.input.value;
2408
+ };
2409
+ /**
2410
+ * Handle focus event
2411
+ */
2412
+ this.handleFocus = () => {
2413
+ this.hasFocus = true;
2414
+ };
2415
+ /**
2416
+ * Handle blur event
2417
+ */
2418
+ this.handleBlur = () => {
2419
+ if (this.value === '-')
2420
+ this.value = '';
2421
+ // Display Error
2422
+ this.handlerInProgress = 'blur';
2423
+ this.displayError().finally(() => {
2424
+ // reset guard
2183
2425
  this.handlerInProgress = undefined;
2184
2426
  this.hasFocus = false;
2185
2427
  });
@@ -2190,6 +2432,12 @@ const MgInputNumeric = class {
2190
2432
  this.checkValidity = () => {
2191
2433
  this.setValidity(this.readonly || this.disabled || this.getInputError() === null);
2192
2434
  };
2435
+ /**
2436
+ * Format min/max value for error message
2437
+ * @param value - value to format
2438
+ * @returns formatted value according to locale
2439
+ */
2440
+ this.formatErrorValue = (value) => ut(value, this.locale, !Number.isInteger(value) && this.type === 'decimal' ? this.decimalLength : 0);
2193
2441
  /**
2194
2442
  * Set input error message
2195
2443
  * @param errorMessage - errorMessage override
@@ -2206,8 +2454,8 @@ const MgInputNumeric = class {
2206
2454
  this.errorMessage = this.messages.errors[inputError];
2207
2455
  }
2208
2456
  else {
2209
- const formattedMin = this.formatValue(this.min);
2210
- const formattedMax = this.formatValue(this.max);
2457
+ const formattedMin = this.formatErrorValue(this.min);
2458
+ const formattedMax = this.formatErrorValue(this.max);
2211
2459
  this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
2212
2460
  }
2213
2461
  }
@@ -2246,13 +2494,13 @@ const MgInputNumeric = class {
2246
2494
  this.formatValue = (value) => {
2247
2495
  switch (this.format) {
2248
2496
  case 'number':
2249
- return $t(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
2497
+ return ut(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
2250
2498
  case 'currency':
2251
- return ut(value, this.locale, this.currency);
2499
+ return ft(value, this.locale, this.currency);
2252
2500
  case 'percent':
2253
2501
  return dt(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
2254
2502
  case 'unit':
2255
- return pt(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
2503
+ return $t(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
2256
2504
  case 'none':
2257
2505
  return value.toString();
2258
2506
  }
@@ -2279,34 +2527,6 @@ const MgInputNumeric = class {
2279
2527
  this.renderReadonly = () => {
2280
2528
  return this.slotContent !== undefined ? (h("span", { class: "mg-c-input__readonly-value" }, h("b", null, this.readonlyValue), this.slotContent)) : (h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue));
2281
2529
  };
2282
- this.value = undefined;
2283
- this.identifier = undefined;
2284
- this.name = this.identifier;
2285
- this.label = undefined;
2286
- this.labelOnTop = undefined;
2287
- this.labelHide = false;
2288
- this.placeholder = undefined;
2289
- this.required = false;
2290
- this.readonly = false;
2291
- this.max = undefined;
2292
- this.min = undefined;
2293
- this.disabled = false;
2294
- this.mgWidth = undefined;
2295
- this.tooltip = undefined;
2296
- this.tooltipPosition = 'input';
2297
- this.helpText = undefined;
2298
- this.type = 'decimal';
2299
- this.format = 'number';
2300
- this.currency = 'EUR';
2301
- this.unit = undefined;
2302
- this.unitDisplay = 'short';
2303
- this.integerLength = 13;
2304
- this.decimalLength = 2;
2305
- this.valid = undefined;
2306
- this.invalid = undefined;
2307
- this.classCollection = new Xe(['mg-c-input--numeric']);
2308
- this.errorMessage = undefined;
2309
- this.hasFocus = undefined;
2310
2530
  }
2311
2531
  validateValue(newValue) {
2312
2532
  // has input value is always render as string we get a stringified value or a '' for nullish value, so we test string type
@@ -2359,31 +2579,42 @@ const MgInputNumeric = class {
2359
2579
  }
2360
2580
  validateType(newValue) {
2361
2581
  if (!types.includes(newValue)) {
2362
- throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${Ye(newValue)}.`);
2582
+ throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${Je(newValue)}.`);
2363
2583
  }
2364
2584
  }
2365
2585
  watchFormat(newValue) {
2366
2586
  if (!formats.includes(newValue)) {
2367
- throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${Ye(newValue)}.`);
2587
+ throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${Je(newValue)}.`);
2368
2588
  }
2369
2589
  }
2370
2590
  validateIntegerLength(newValue) {
2371
2591
  if (newValue < 1) {
2372
- throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${Ye(newValue)}.`);
2592
+ throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${Je(newValue)}.`);
2373
2593
  }
2374
2594
  }
2375
2595
  validateDecimalLength(newValue) {
2376
2596
  if (newValue < 1) {
2377
- throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${Ye(newValue)}.`);
2597
+ throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${Je(newValue)}.`);
2378
2598
  }
2379
2599
  }
2380
2600
  /**
2381
2601
  * Display input error if it exists.
2382
2602
  */
2383
- async displayError() {
2384
- this.checkValidity();
2385
- this.setErrorMessage();
2386
- this.hasDisplayedError = this.invalid;
2603
+ displayError() {
2604
+ // Use `Promise` as requested for stencil method
2605
+ // Use `requestAnimationFrame` to ensure:
2606
+ // - DOM is fully updated before validation
2607
+ // - Async operations are completed
2608
+ // - No timing issues with Stencil's render cycle
2609
+ // - Keep everything in sync both inside and outside the component
2610
+ return new Promise(resolve => {
2611
+ requestAnimationFrame(() => {
2612
+ this.checkValidity();
2613
+ this.setErrorMessage();
2614
+ this.hasDisplayedError = this.invalid;
2615
+ resolve();
2616
+ });
2617
+ });
2387
2618
  }
2388
2619
  /**
2389
2620
  * Set an error and display a custom error message.
@@ -2397,7 +2628,7 @@ const MgInputNumeric = class {
2397
2628
  if (typeof valid !== 'boolean') {
2398
2629
  throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
2399
2630
  }
2400
- else if (!me(errorMessage)) {
2631
+ else if (!ye(errorMessage)) {
2401
2632
  throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
2402
2633
  }
2403
2634
  else {
@@ -2503,7 +2734,7 @@ const MgInputNumeric = class {
2503
2734
  * @returns HTML Element
2504
2735
  */
2505
2736
  render() {
2506
- return (h("mg-input", { key: '6d34c2b7e9762cdefc5de3814ff4afd95fa4a6a6', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
2737
+ return (h("mg-input", { key: 'b3f1b0e8a78d2f61146f052db1636d98e89271d1', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
2507
2738
  ? this.readonlyValue && this.renderReadonly()
2508
2739
  : [
2509
2740
  h("input", { key: "input", type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
@@ -2530,7 +2761,7 @@ const MgInputNumeric = class {
2530
2761
  };
2531
2762
  MgInputNumeric.style = MgInputNumericStyle0;
2532
2763
 
2533
- const mgInputPasswordCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--password .mg-c-input__input-icon{color:var(--mg-b-color-dark)}.mg-c-input.mg-c-input--password .mg-c-input__input-group{position:relative;flex-grow:1}.mg-c-input.mg-c-input--password .mg-c-input__append-button{position:absolute;right:0}.mg-c-input.mg-c-input--password .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-8))}.mg-c-input.mg-c-input--password .mg-c-input__box::-ms-reveal{display:none}";
2764
+ const mgInputPasswordCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--password .mg-c-input__input-icon{color:var(--mg-b-color-dark)}.mg-c-input.mg-c-input--password .mg-c-input__input-group{position:relative;flex-grow:1}.mg-c-input.mg-c-input--password .mg-c-input__append-button{position:absolute;right:0}.mg-c-input.mg-c-input--password .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-8))}.mg-c-input.mg-c-input--password .mg-c-input__box::-ms-reveal{display:none}";
2534
2765
  const MgInputPasswordStyle0 = mgInputPasswordCss;
2535
2766
 
2536
2767
  const MgInputPassword = class {
@@ -2540,6 +2771,43 @@ const MgInputPassword = class {
2540
2771
  this.inputValid = createEvent(this, "input-valid", 7);
2541
2772
  // hasDisplayedError (triggered by blur event)
2542
2773
  this.hasDisplayedError = false;
2774
+ /**
2775
+ * Input name
2776
+ * If not set the value equals the identifier
2777
+ */
2778
+ this.name = this.identifier;
2779
+ /**
2780
+ * Define if label is visible
2781
+ */
2782
+ this.labelHide = false;
2783
+ /**
2784
+ * Define if input is required
2785
+ */
2786
+ this.required = false;
2787
+ /**
2788
+ * Define if input is readonly
2789
+ */
2790
+ this.readonly = false;
2791
+ /**
2792
+ * Define if input is disabled
2793
+ */
2794
+ this.disabled = false;
2795
+ /**
2796
+ * Define input width
2797
+ */
2798
+ this.mgWidth = 'full';
2799
+ /**
2800
+ * Define tooltip position
2801
+ */
2802
+ this.tooltipPosition = 'input';
2803
+ /**
2804
+ * Component classes
2805
+ */
2806
+ this.classCollection = new Ge(['mg-c-input--password']);
2807
+ /**
2808
+ * Indicates if password is displayed or not
2809
+ */
2810
+ this.displayPassword = false;
2543
2811
  /**
2544
2812
  * Handle input event
2545
2813
  */
@@ -2589,26 +2857,6 @@ const MgInputPassword = class {
2589
2857
  }
2590
2858
  }
2591
2859
  };
2592
- this.value = undefined;
2593
- this.identifier = undefined;
2594
- this.name = this.identifier;
2595
- this.label = undefined;
2596
- this.labelOnTop = undefined;
2597
- this.labelHide = false;
2598
- this.placeholder = undefined;
2599
- this.maxlength = undefined;
2600
- this.required = false;
2601
- this.readonly = false;
2602
- this.disabled = false;
2603
- this.mgWidth = 'full';
2604
- this.tooltip = undefined;
2605
- this.tooltipPosition = 'input';
2606
- this.helpText = undefined;
2607
- this.valid = undefined;
2608
- this.invalid = undefined;
2609
- this.classCollection = new Xe(['mg-c-input--password']);
2610
- this.errorMessage = undefined;
2611
- this.displayPassword = false;
2612
2860
  }
2613
2861
  handleValue(newValue) {
2614
2862
  this.valueChange.emit(newValue);
@@ -2647,10 +2895,21 @@ const MgInputPassword = class {
2647
2895
  /**
2648
2896
  * Display input error if it exists.
2649
2897
  */
2650
- async displayError() {
2651
- this.checkValidity();
2652
- this.setErrorMessage();
2653
- this.hasDisplayedError = this.invalid;
2898
+ displayError() {
2899
+ // Use `Promise` as requested for stencil method
2900
+ // Use `requestAnimationFrame` to ensure:
2901
+ // - DOM is fully updated before validation
2902
+ // - Async operations are completed
2903
+ // - No timing issues with Stencil's render cycle
2904
+ // - Keep everything in sync both inside and outside the component
2905
+ return new Promise(resolve => {
2906
+ requestAnimationFrame(() => {
2907
+ this.checkValidity();
2908
+ this.setErrorMessage();
2909
+ this.hasDisplayedError = this.invalid;
2910
+ resolve();
2911
+ });
2912
+ });
2654
2913
  }
2655
2914
  /**
2656
2915
  * Set an error and display a custom error message.
@@ -2664,7 +2923,7 @@ const MgInputPassword = class {
2664
2923
  if (typeof valid !== 'boolean') {
2665
2924
  throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
2666
2925
  }
2667
- else if (!me(errorMessage)) {
2926
+ else if (!ye(errorMessage)) {
2668
2927
  throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
2669
2928
  }
2670
2929
  else {
@@ -2721,7 +2980,7 @@ const MgInputPassword = class {
2721
2980
  * @returns HTML Element
2722
2981
  */
2723
2982
  render() {
2724
- return (h("mg-input", { key: 'af313cb20a94a9c8dcf2b944c31b7ea36b2d3feb', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
2983
+ return (h("mg-input", { key: '3c494aa50f437d261e7d006f395c5b7c3cbead5d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
2725
2984
  if (el !== null)
2726
2985
  this.input = el;
2727
2986
  } }), h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
@@ -2760,6 +3019,43 @@ const MgInputRadio = class {
2760
3019
  this.classVerticalList = 'mg-c-input--vertical-list';
2761
3020
  // hasDisplayedError (triggered by blur event)
2762
3021
  this.hasDisplayedError = false;
3022
+ /**
3023
+ * Input name
3024
+ * If not set the value equals the identifier
3025
+ */
3026
+ this.name = this.identifier;
3027
+ /**
3028
+ * Define if label is displayed on top
3029
+ */
3030
+ this.labelOnTop = false;
3031
+ /**
3032
+ * Define if label is visible
3033
+ */
3034
+ this.labelHide = false;
3035
+ /**
3036
+ * Define if inputs are display verticaly
3037
+ */
3038
+ this.inputVerticalList = false;
3039
+ /**
3040
+ * Define if input is required
3041
+ */
3042
+ this.required = false;
3043
+ /**
3044
+ * Define if input is readonly
3045
+ */
3046
+ this.readonly = false;
3047
+ /**
3048
+ * Define if input is disabled
3049
+ */
3050
+ this.disabled = false;
3051
+ /**
3052
+ * Define tooltip position
3053
+ */
3054
+ this.tooltipPosition = 'input';
3055
+ /**
3056
+ * Component classes
3057
+ */
3058
+ this.classCollection = new Ge(['mg-c-input--radio', classFieldset]);
2763
3059
  /**
2764
3060
  * Handle input event
2765
3061
  * @param event - input event
@@ -2806,31 +3102,11 @@ const MgInputRadio = class {
2806
3102
  * @returns element
2807
3103
  */
2808
3104
  this.getInvalidElement = () => this.inputs.find((input) => !input.disabled && !input.readOnly && !input.checkValidity());
2809
- this.value = undefined;
2810
- this.items = undefined;
2811
- this.identifier = undefined;
2812
- this.name = this.identifier;
2813
- this.label = undefined;
2814
- this.labelOnTop = false;
2815
- this.labelHide = false;
2816
- this.inputVerticalList = false;
2817
- this.required = false;
2818
- this.readonly = false;
2819
- this.disabled = false;
2820
- this.tooltip = undefined;
2821
- this.tooltipPosition = 'input';
2822
- this.helpText = undefined;
2823
- this.valid = undefined;
2824
- this.invalid = undefined;
2825
- this.classCollection = new Xe(['mg-c-input--radio', classFieldset]);
2826
- this.errorMessage = undefined;
2827
- this.options = undefined;
2828
- this.readonlyValue = undefined;
2829
3105
  }
2830
3106
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2831
3107
  watchValue(newValue) {
2832
3108
  var _a;
2833
- if (Je(this.items) && typeof newValue === 'string') {
3109
+ if (Xe(this.items) && typeof newValue === 'string') {
2834
3110
  this.readonlyValue = newValue;
2835
3111
  }
2836
3112
  else if (Array.isArray(this.items) && this.items.every(isOption$3)) {
@@ -2844,10 +3120,10 @@ const MgInputRadio = class {
2844
3120
  validateItems(newValue) {
2845
3121
  // Validate if items have required min length
2846
3122
  if (typeof newValue === 'object' && newValue.length < 2) {
2847
- throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${Ye(newValue)}.`);
3123
+ throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${Je(newValue)}.`);
2848
3124
  }
2849
3125
  // String array
2850
- else if (Je(newValue)) {
3126
+ else if (Xe(newValue)) {
2851
3127
  this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
2852
3128
  }
2853
3129
  // Object array
@@ -2855,7 +3131,7 @@ const MgInputRadio = class {
2855
3131
  this.options = newValue;
2856
3132
  }
2857
3133
  else {
2858
- throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${Ye(newValue)}.`);
3134
+ throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${Je(newValue)}.`);
2859
3135
  }
2860
3136
  }
2861
3137
  watchInputVerticalList(newValue) {
@@ -2889,10 +3165,21 @@ const MgInputRadio = class {
2889
3165
  /**
2890
3166
  * Display input error if it exists.
2891
3167
  */
2892
- async displayError() {
2893
- this.checkValidity();
2894
- this.setErrorMessage();
2895
- this.hasDisplayedError = this.invalid;
3168
+ displayError() {
3169
+ // Use `Promise` as requested for stencil method
3170
+ // Use `requestAnimationFrame` to ensure:
3171
+ // - DOM is fully updated before validation
3172
+ // - Async operations are completed
3173
+ // - No timing issues with Stencil's render cycle
3174
+ // - Keep everything in sync both inside and outside the component
3175
+ return new Promise(resolve => {
3176
+ requestAnimationFrame(() => {
3177
+ this.checkValidity();
3178
+ this.setErrorMessage();
3179
+ this.hasDisplayedError = this.invalid;
3180
+ resolve();
3181
+ });
3182
+ });
2896
3183
  }
2897
3184
  /**
2898
3185
  * Set an error and display a custom error message.
@@ -2906,7 +3193,7 @@ const MgInputRadio = class {
2906
3193
  if (typeof valid !== 'boolean') {
2907
3194
  throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');
2908
3195
  }
2909
- else if (!me(errorMessage)) {
3196
+ else if (!ye(errorMessage)) {
2910
3197
  throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');
2911
3198
  }
2912
3199
  else {
@@ -2966,7 +3253,7 @@ const MgInputRadio = class {
2966
3253
  * @returns HTML Element
2967
3254
  */
2968
3255
  render() {
2969
- return (h("mg-input", { key: '1f27ea2672375c28b2b7afca66ebd09f8dfc2354', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
3256
+ return (h("mg-input", { key: 'df8daa3c340c0410d092029685e195256a523b31', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
2970
3257
  if (el !== null)
2971
3258
  this.inputs[index] = el;
2972
3259
  } }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
@@ -2983,7 +3270,7 @@ const MgInputRadio = class {
2983
3270
  };
2984
3271
  MgInputRadio.style = MgInputRadioStyle0;
2985
3272
 
2986
- const mgInputSelectCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
3273
+ const mgInputSelectCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
2987
3274
  const MgInputSelectStyle0 = mgInputSelectCss;
2988
3275
 
2989
3276
  /**
@@ -3035,6 +3322,43 @@ const MgInputSelect = class {
3035
3322
  this.inputValid = createEvent(this, "input-valid", 7);
3036
3323
  // hasDisplayedError (triggered by blur event)
3037
3324
  this.hasDisplayedError = false;
3325
+ /**
3326
+ * Input name
3327
+ * If not set the value equals the identifier
3328
+ */
3329
+ this.name = this.identifier;
3330
+ /**
3331
+ * Define if label is visible
3332
+ */
3333
+ this.labelHide = false;
3334
+ /**
3335
+ * Option to remove placeholder
3336
+ */
3337
+ this.placeholderHide = false;
3338
+ /**
3339
+ * Option to disable placeholder
3340
+ */
3341
+ this.placeholderDisabled = false;
3342
+ /**
3343
+ * Define if input is required
3344
+ */
3345
+ this.required = false;
3346
+ /**
3347
+ * Define if input is readonly
3348
+ */
3349
+ this.readonly = false;
3350
+ /**
3351
+ * Define if input is disabled
3352
+ */
3353
+ this.disabled = false;
3354
+ /**
3355
+ * Define tooltip position
3356
+ */
3357
+ this.tooltipPosition = 'input';
3358
+ /**
3359
+ * Component classes
3360
+ */
3361
+ this.classCollection = new Ge(['mg-c-input--select']);
3038
3362
  /**
3039
3363
  * Handle input event
3040
3364
  */
@@ -3064,7 +3388,7 @@ const MgInputSelect = class {
3064
3388
  if (this.input.value === '') {
3065
3389
  this.setValue(null);
3066
3390
  }
3067
- else if (Je(this.items) && this.items.includes(this.input.value)) {
3391
+ else if (Xe(this.items) && this.items.includes(this.input.value)) {
3068
3392
  this.setValue(this.input.value);
3069
3393
  }
3070
3394
  else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
@@ -3119,34 +3443,10 @@ const MgInputSelect = class {
3119
3443
  * @returns render option
3120
3444
  */
3121
3445
  this.renderOption = (option) => (h("option", { key: option.title, value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title));
3122
- this.value = undefined;
3123
- this.items = undefined;
3124
- this.identifier = undefined;
3125
- this.name = this.identifier;
3126
- this.label = undefined;
3127
- this.labelOnTop = undefined;
3128
- this.labelHide = false;
3129
- this.placeholder = undefined;
3130
- this.placeholderHide = false;
3131
- this.placeholderDisabled = false;
3132
- this.required = false;
3133
- this.readonly = false;
3134
- this.disabled = false;
3135
- this.mgWidth = undefined;
3136
- this.tooltip = undefined;
3137
- this.tooltipPosition = 'input';
3138
- this.helpText = undefined;
3139
- this.valid = undefined;
3140
- this.invalid = undefined;
3141
- this.classCollection = new Xe(['mg-c-input--select']);
3142
- this.errorMessage = undefined;
3143
- this.options = undefined;
3144
- this.valueExist = undefined;
3145
- this.readonlyValue = undefined;
3146
3446
  }
3147
3447
  validateValue(newValue) {
3148
3448
  var _a, _b;
3149
- if (Je(this.items) && typeof newValue === 'string') {
3449
+ if (Xe(this.items) && typeof newValue === 'string') {
3150
3450
  this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) !== undefined ? this.input.value : newValue;
3151
3451
  }
3152
3452
  else if (allItemsAreOptions(this.items)) {
@@ -3163,7 +3463,7 @@ const MgInputSelect = class {
3163
3463
  this.options = [];
3164
3464
  }
3165
3465
  // String array
3166
- else if (Je(newValue)) {
3466
+ else if (Xe(newValue)) {
3167
3467
  if (typeof this.value === 'string')
3168
3468
  this.valueExist = newValue.includes(this.value);
3169
3469
  this.options = newValue.map(item => ({ title: item, value: item }));
@@ -3181,7 +3481,7 @@ const MgInputSelect = class {
3181
3481
  }
3182
3482
  }
3183
3483
  else {
3184
- throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${Ye(newValue)}.`);
3484
+ throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${Je(newValue)}.`);
3185
3485
  }
3186
3486
  }
3187
3487
  watchReadonly(newValue) {
@@ -3218,10 +3518,21 @@ const MgInputSelect = class {
3218
3518
  /**
3219
3519
  * Display input error if it exists.
3220
3520
  */
3221
- async displayError() {
3222
- this.checkValidity();
3223
- this.setErrorMessage();
3224
- this.hasDisplayedError = this.invalid;
3521
+ displayError() {
3522
+ // Use `Promise` as requested for stencil method
3523
+ // Use `requestAnimationFrame` to ensure:
3524
+ // - DOM is fully updated before validation
3525
+ // - Async operations are completed
3526
+ // - No timing issues with Stencil's render cycle
3527
+ // - Keep everything in sync both inside and outside the component
3528
+ return new Promise(resolve => {
3529
+ requestAnimationFrame(() => {
3530
+ this.checkValidity();
3531
+ this.setErrorMessage();
3532
+ this.hasDisplayedError = this.invalid;
3533
+ resolve();
3534
+ });
3535
+ });
3225
3536
  }
3226
3537
  /**
3227
3538
  * Set an error and display a custom error message.
@@ -3235,7 +3546,7 @@ const MgInputSelect = class {
3235
3546
  if (typeof valid !== 'boolean') {
3236
3547
  throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean.');
3237
3548
  }
3238
- else if (!me(errorMessage)) {
3549
+ else if (!ye(errorMessage)) {
3239
3550
  throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string.');
3240
3551
  }
3241
3552
  else {
@@ -3299,7 +3610,7 @@ const MgInputSelect = class {
3299
3610
  * @returns HTML Element
3300
3611
  */
3301
3612
  render() {
3302
- return (h("mg-input", { key: '23ce3f91b4a5abdbd9b9731a895ca38d37b8c0a5', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
3613
+ return (h("mg-input", { key: '11584b2acab392278a9c26cb9ba49ae1e638a877', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
3303
3614
  if (el !== null)
3304
3615
  this.input = el;
3305
3616
  } }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
@@ -3317,7 +3628,7 @@ const MgInputSelect = class {
3317
3628
  };
3318
3629
  MgInputSelect.style = MgInputSelectStyle0;
3319
3630
 
3320
- const mgInputTextCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__error ::slotted(*){margin-top:0}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__with-character-left{position:relative;width:100%}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left .mg-c-input__box{padding-right:max(var(--mg-c-character-left-message-length)*.6ch + var(--mg-b-size-16)*clamp(0,var(--mg-c-character-left-message-length),1),var(--mg-b-size-8))}.mg-c-input__with-character-left mg-character-left{position:absolute;top:50%;right:var(--mg-b-size-8);display:none;font-size:var(--mg-b-font-size-small);opacity:.6;transform:translateY(-50%)}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{display:block}.mg-c-input.mg-c-input--readonly b{min-height:var(--mg-b-font-size);margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}";
3631
+ const mgInputTextCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__error ::slotted(*){margin-top:0}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__with-character-left{position:relative;width:100%}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left .mg-c-input__box{padding-right:max(var(--mg-c-character-left-message-length)*(.35ch + .3rem) + var(--mg-b-size-16)*clamp(0,var(--mg-c-character-left-message-length),1),var(--mg-b-size-8))}.mg-c-input__with-character-left mg-character-left{position:absolute;top:50%;right:var(--mg-b-size-8);display:none;font-size:var(--mg-b-font-size-small);opacity:.6;transform:translateY(-50%)}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{display:block}.mg-c-input.mg-c-input--readonly b{min-height:var(--mg-b-font-size);margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}";
3321
3632
  const MgInputTextStyle0 = mgInputTextCss;
3322
3633
 
3323
3634
  /**
@@ -3331,7 +3642,7 @@ const isOption$1 = (option) => typeof option === 'object' && typeof option.title
3331
3642
  * @param options - Datalist options to check.
3332
3643
  * @returns True if datalist is well structured.
3333
3644
  */
3334
- const isDatalistOptions = (options) => Je(options) || (Array.isArray(options) && options.every(isOption$1));
3645
+ const isDatalistOptions = (options) => Xe(options) || (Array.isArray(options) && options.every(isOption$1));
3335
3646
  const MgInputText = class {
3336
3647
  constructor(hostRef) {
3337
3648
  registerInstance(this, hostRef);
@@ -3348,6 +3659,51 @@ const MgInputText = class {
3348
3659
  this.classIsAppendInputSlotContent = 'mg-c-input--is-append-input-slot-content';
3349
3660
  // hasDisplayedError (triggered by blur event)
3350
3661
  this.hasDisplayedError = false;
3662
+ /**
3663
+ * Input name
3664
+ * If not set the value equals the identifier
3665
+ */
3666
+ this.name = this.identifier;
3667
+ /**
3668
+ * Input type
3669
+ */
3670
+ this.type = 'text';
3671
+ /**
3672
+ * Define if label is visible
3673
+ */
3674
+ this.labelHide = false;
3675
+ /**
3676
+ * Input max length
3677
+ */
3678
+ this.maxlength = 400;
3679
+ /**
3680
+ * Define if input is required
3681
+ */
3682
+ this.required = false;
3683
+ /**
3684
+ * Define if input is readonly
3685
+ */
3686
+ this.readonly = false;
3687
+ /**
3688
+ * Define if input is disabled
3689
+ */
3690
+ this.disabled = false;
3691
+ /**
3692
+ * Define input width
3693
+ */
3694
+ this.mgWidth = 'full';
3695
+ /**
3696
+ * Define tooltip position
3697
+ */
3698
+ this.tooltipPosition = 'input';
3699
+ /**
3700
+ * Define if component should display character left
3701
+ */
3702
+ this.characterLeftHide = false;
3703
+ /**
3704
+ * Component classes
3705
+ */
3706
+ this.classCollection = new Ge(['mg-c-input--text']);
3351
3707
  /**
3352
3708
  * Handle input event
3353
3709
  */
@@ -3363,7 +3719,7 @@ const MgInputText = class {
3363
3719
  */
3364
3720
  this.handleFocus = () => {
3365
3721
  this.classCollection.add(this.classFocus);
3366
- this.classCollection = new Xe(this.classCollection.classes);
3722
+ this.classCollection = new Ge(this.classCollection.classes);
3367
3723
  };
3368
3724
  /**
3369
3725
  * Handle blur event
@@ -3371,7 +3727,7 @@ const MgInputText = class {
3371
3727
  this.handleBlur = () => {
3372
3728
  // Manage focus
3373
3729
  this.classCollection.delete(this.classFocus);
3374
- this.classCollection = new Xe(this.classCollection.classes);
3730
+ this.classCollection = new Ge(this.classCollection.classes);
3375
3731
  // Display Error
3376
3732
  this.handlerInProgress = 'blur';
3377
3733
  this.displayError().finally(() => {
@@ -3436,31 +3792,6 @@ const MgInputText = class {
3436
3792
  this.renderReadonly = () => {
3437
3793
  return this.slotContent !== undefined ? (h("span", { class: "mg-c-input__readonly-value" }, h("b", null, this.value), this.slotContent)) : (h("b", { class: "mg-c-input__readonly-value" }, this.value));
3438
3794
  };
3439
- this.value = undefined;
3440
- this.identifier = undefined;
3441
- this.name = this.identifier;
3442
- this.label = undefined;
3443
- this.type = 'text';
3444
- this.icon = undefined;
3445
- this.labelOnTop = undefined;
3446
- this.labelHide = false;
3447
- this.placeholder = undefined;
3448
- this.datalistoptions = undefined;
3449
- this.maxlength = 400;
3450
- this.required = false;
3451
- this.readonly = false;
3452
- this.disabled = false;
3453
- this.mgWidth = 'full';
3454
- this.pattern = undefined;
3455
- this.patternErrorMessage = undefined;
3456
- this.tooltip = undefined;
3457
- this.tooltipPosition = 'input';
3458
- this.characterLeftHide = false;
3459
- this.helpText = undefined;
3460
- this.valid = undefined;
3461
- this.invalid = undefined;
3462
- this.classCollection = new Xe(['mg-c-input--text']);
3463
- this.errorMessage = undefined;
3464
3795
  }
3465
3796
  handleValue(newValue) {
3466
3797
  var _a, _b;
@@ -3481,7 +3812,7 @@ const MgInputText = class {
3481
3812
  }
3482
3813
  validateDatalistoptions(newValue) {
3483
3814
  if (Boolean(newValue) && !isDatalistOptions(newValue)) {
3484
- throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${Ye(newValue)}.`);
3815
+ throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${Je(newValue)}.`);
3485
3816
  }
3486
3817
  }
3487
3818
  watchReadonly(newValue) {
@@ -3516,8 +3847,8 @@ const MgInputText = class {
3516
3847
  this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
3517
3848
  }
3518
3849
  validatePattern(newValue) {
3519
- if (newValue !== undefined && !(me(this.pattern) && me(this.patternErrorMessage))) {
3520
- throw new Error(`<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${Ye(this.pattern)}'" and "patternErrorMessage='${Ye(this.patternErrorMessage)}'".`);
3850
+ if (newValue !== undefined && !(ye(this.pattern) && ye(this.patternErrorMessage))) {
3851
+ throw new Error(`<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${Je(this.pattern)}'" and "patternErrorMessage='${Je(this.patternErrorMessage)}'".`);
3521
3852
  }
3522
3853
  }
3523
3854
  /**
@@ -3529,10 +3860,21 @@ const MgInputText = class {
3529
3860
  /**
3530
3861
  * Display input error if it exists.
3531
3862
  */
3532
- async displayError() {
3533
- this.checkValidity();
3534
- this.setErrorMessage();
3535
- this.hasDisplayedError = this.invalid;
3863
+ displayError() {
3864
+ // Use `Promise` as requested for stencil method
3865
+ // Use `requestAnimationFrame` to ensure:
3866
+ // - DOM is fully updated before validation
3867
+ // - Async operations are completed
3868
+ // - No timing issues with Stencil's render cycle
3869
+ // - Keep everything in sync both inside and outside the component
3870
+ return new Promise(resolve => {
3871
+ requestAnimationFrame(() => {
3872
+ this.checkValidity();
3873
+ this.setErrorMessage();
3874
+ this.hasDisplayedError = this.invalid;
3875
+ resolve();
3876
+ });
3877
+ });
3536
3878
  }
3537
3879
  /**
3538
3880
  * Set an error and display a custom error message.
@@ -3546,7 +3888,7 @@ const MgInputText = class {
3546
3888
  if (typeof valid !== 'boolean') {
3547
3889
  throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean.');
3548
3890
  }
3549
- else if (!me(errorMessage)) {
3891
+ else if (!ye(errorMessage)) {
3550
3892
  throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string.');
3551
3893
  }
3552
3894
  else {
@@ -3611,12 +3953,12 @@ const MgInputText = class {
3611
3953
  * @returns HTML Element
3612
3954
  */
3613
3955
  render() {
3614
- return (h("mg-input", { key: '6ed4f9339354571851d415755b989824f623d62d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
3956
+ return (h("mg-input", { key: '11cdf9ff3675c7e130a46bce025b7c8b5f4e0d02', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
3615
3957
  ? this.value && this.renderReadonly()
3616
3958
  : [
3617
3959
  h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
3618
3960
  '--mg-c-character-left-message-length': (!this.characterLeftHide
3619
- ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
3961
+ ? (this.maxlength.toString().length * 2 + 1)
3620
3962
  : 0).toString(),
3621
3963
  } }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { type: this.type, class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, list: this.hasDatalist() ? this.datalistId : undefined, autocomplete: this.hasDatalist() ? 'off' : undefined, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
3622
3964
  if (el !== null)
@@ -3640,7 +3982,7 @@ const MgInputText = class {
3640
3982
  };
3641
3983
  MgInputText.style = MgInputTextStyle0;
3642
3984
 
3643
- const mgInputTextareaCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__error ::slotted(*){margin-top:0}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__input{align-items:start}.mg-c-input__box{display:block;height:auto;resize:none}.mg-c-input__box.mg-c-input__box--resizable{resize:both}.mg-c-input__box.mg-c-input__box--resizable-horizontal{resize:horizontal}.mg-c-input__box.mg-c-input__box--resizable-vertical{resize:vertical}.mg-c-input__readonly-value{white-space:pre-line}.mg-c-input__with-character-left{flex-grow:1}.mg-c-input__with-character-left mg-character-left{display:block;text-align:end;visibility:hidden}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-c-input__box{overflow-x:hidden}}";
3985
+ const mgInputTextareaCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__error ::slotted(*){margin-top:0}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__input{align-items:start}.mg-c-input__box{display:block;height:auto;resize:none}.mg-c-input__box.mg-c-input__box--resizable{resize:both}.mg-c-input__box.mg-c-input__box--resizable-horizontal{resize:horizontal}.mg-c-input__box.mg-c-input__box--resizable-vertical{resize:vertical}.mg-c-input__readonly-value{white-space:pre-line}.mg-c-input__with-character-left{flex-grow:1}.mg-c-input__with-character-left mg-character-left{display:block;text-align:end;visibility:hidden}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-c-input__box{overflow-x:hidden}}";
3644
3986
  const MgInputTextareaStyle0 = mgInputTextareaCss;
3645
3987
 
3646
3988
  const MgInputTextarea = class {
@@ -3656,6 +3998,55 @@ const MgInputTextarea = class {
3656
3998
  this.classDisplayCharacterLeft = 'mg-c-input--display-character-left';
3657
3999
  // hasDisplayedError (triggered by blur event)
3658
4000
  this.hasDisplayedError = false;
4001
+ /**
4002
+ * Input name
4003
+ * If not set the value equals the identifier
4004
+ */
4005
+ this.name = this.identifier;
4006
+ /**
4007
+ * Define if label is visible
4008
+ */
4009
+ this.labelHide = false;
4010
+ /**
4011
+ * Input max length
4012
+ */
4013
+ this.maxlength = 4000;
4014
+ /**
4015
+ * Define if input is required
4016
+ */
4017
+ this.required = false;
4018
+ /**
4019
+ * Define if input is readonly
4020
+ */
4021
+ this.readonly = false;
4022
+ /**
4023
+ * Define if input is disabled
4024
+ */
4025
+ this.disabled = false;
4026
+ /**
4027
+ * Define input width
4028
+ */
4029
+ this.mgWidth = 'full';
4030
+ /**
4031
+ * Define the number of visible text lines for the control
4032
+ */
4033
+ this.rows = 3;
4034
+ /**
4035
+ * Define tooltip position
4036
+ */
4037
+ this.tooltipPosition = 'input';
4038
+ /**
4039
+ * Define if component should display character left
4040
+ */
4041
+ this.characterLeftHide = false;
4042
+ /**
4043
+ * Define if input is resizable
4044
+ */
4045
+ this.resizable = 'none';
4046
+ /**
4047
+ * Component classes
4048
+ */
4049
+ this.classCollection = new Ge(['mg-c-input--textarea']);
3659
4050
  /**
3660
4051
  * Handle input event
3661
4052
  */
@@ -3671,7 +4062,7 @@ const MgInputTextarea = class {
3671
4062
  */
3672
4063
  this.handleFocus = () => {
3673
4064
  this.classCollection.add(this.classFocus);
3674
- this.classCollection = new Xe(this.classCollection.classes);
4065
+ this.classCollection = new Ge(this.classCollection.classes);
3675
4066
  };
3676
4067
  /**
3677
4068
  * Handle blur event
@@ -3679,7 +4070,7 @@ const MgInputTextarea = class {
3679
4070
  this.handleBlur = () => {
3680
4071
  // Manage focus
3681
4072
  this.classCollection.delete(this.classFocus);
3682
- this.classCollection = new Xe(this.classCollection.classes);
4073
+ this.classCollection = new Ge(this.classCollection.classes);
3683
4074
  // Display Error
3684
4075
  this.handlerInProgress = 'blur';
3685
4076
  this.displayError().finally(() => {
@@ -3720,30 +4111,6 @@ const MgInputTextarea = class {
3720
4111
  }
3721
4112
  }
3722
4113
  };
3723
- this.value = undefined;
3724
- this.identifier = undefined;
3725
- this.name = this.identifier;
3726
- this.label = undefined;
3727
- this.labelOnTop = undefined;
3728
- this.labelHide = false;
3729
- this.placeholder = undefined;
3730
- this.maxlength = 4000;
3731
- this.required = false;
3732
- this.readonly = false;
3733
- this.disabled = false;
3734
- this.mgWidth = 'full';
3735
- this.pattern = undefined;
3736
- this.patternErrorMessage = undefined;
3737
- this.rows = 3;
3738
- this.tooltip = undefined;
3739
- this.tooltipPosition = 'input';
3740
- this.characterLeftHide = false;
3741
- this.helpText = undefined;
3742
- this.valid = undefined;
3743
- this.invalid = undefined;
3744
- this.resizable = 'none';
3745
- this.classCollection = new Xe(['mg-c-input--textarea']);
3746
- this.errorMessage = undefined;
3747
4114
  }
3748
4115
  handleValue(newValue) {
3749
4116
  this.checkValidity();
@@ -3781,8 +4148,8 @@ const MgInputTextarea = class {
3781
4148
  this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
3782
4149
  }
3783
4150
  validatePattern(newValue) {
3784
- if (newValue !== undefined && !(me(this.pattern) && me(this.patternErrorMessage))) {
3785
- throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${Ye(this.pattern)}'" and "patternErrorMessage='${Ye(this.patternErrorMessage)}'".`);
4151
+ if (newValue !== undefined && !(ye(this.pattern) && ye(this.patternErrorMessage))) {
4152
+ throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${Je(this.pattern)}'" and "patternErrorMessage='${Je(this.patternErrorMessage)}'".`);
3786
4153
  }
3787
4154
  }
3788
4155
  validatecharacterLeftHide(newValue) {
@@ -3796,10 +4163,21 @@ const MgInputTextarea = class {
3796
4163
  /**
3797
4164
  * Display input error if it exists.
3798
4165
  */
3799
- async displayError() {
3800
- this.checkValidity();
3801
- this.setErrorMessage();
3802
- this.hasDisplayedError = this.invalid;
4166
+ displayError() {
4167
+ // Use `Promise` as requested for stencil method
4168
+ // Use `requestAnimationFrame` to ensure:
4169
+ // - DOM is fully updated before validation
4170
+ // - Async operations are completed
4171
+ // - No timing issues with Stencil's render cycle
4172
+ // - Keep everything in sync both inside and outside the component
4173
+ return new Promise(resolve => {
4174
+ requestAnimationFrame(() => {
4175
+ this.checkValidity();
4176
+ this.setErrorMessage();
4177
+ this.hasDisplayedError = this.invalid;
4178
+ resolve();
4179
+ });
4180
+ });
3803
4181
  }
3804
4182
  /**
3805
4183
  * Set an error and display a custom error message.
@@ -3813,7 +4191,7 @@ const MgInputTextarea = class {
3813
4191
  if (typeof valid !== 'boolean') {
3814
4192
  throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean.');
3815
4193
  }
3816
- else if (!me(errorMessage)) {
4194
+ else if (!ye(errorMessage)) {
3817
4195
  throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string.');
3818
4196
  }
3819
4197
  else {
@@ -3875,7 +4253,7 @@ const MgInputTextarea = class {
3875
4253
  * @returns HTML Element
3876
4254
  */
3877
4255
  render() {
3878
- return (h("mg-input", { key: '311c9e0b36a6373aff8e3ca666dd4af93c2c1137', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
4256
+ return (h("mg-input", { key: 'a7c6657511d21d8df9e11f7fb1bf3d2d42a01fa0', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
3879
4257
  'mg-c-input__box': true,
3880
4258
  'mg-c-input__box--width': true,
3881
4259
  'mg-c-input__box--resizable': this.resizable === 'both',
@@ -3906,18 +4284,21 @@ const MgInputTitleStyle0 = mgInputTitleCss;
3906
4284
  const MgInputTitle = class {
3907
4285
  constructor(hostRef) {
3908
4286
  registerInstance(this, hostRef);
3909
- this.identifier = undefined;
3910
- this.required = undefined;
3911
- this.readonly = undefined;
4287
+ /**
4288
+ * Switch from label to fieldset sementic
4289
+ */
3912
4290
  this.isLegend = false;
4291
+ /**
4292
+ * Component parent tagname
4293
+ */
3913
4294
  this.tagName = 'label';
3914
4295
  }
3915
4296
  validateIdentifier(newValue) {
3916
- if (!me(newValue)) {
4297
+ if (!ye(newValue)) {
3917
4298
  throw new Error('<mg-input-title> prop "identifier" is required.');
3918
4299
  }
3919
- else if (!Ge(newValue)) {
3920
- console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
4300
+ else if (!Ie(newValue)) {
4301
+ console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
3921
4302
  }
3922
4303
  }
3923
4304
  validateIsLegend(newValue) {
@@ -3940,7 +4321,7 @@ const MgInputTitle = class {
3940
4321
  render() {
3941
4322
  const TagName = this.readonly ? 'span' : this.tagName;
3942
4323
  // \u00A0 represent a &nbsp;
3943
- return (h(TagName, { key: '2185a08a69a1b749c7e36d430b83079cbce131de', class: "mg-c-input-title", htmlFor: !this.isLegend && this.identifier, id: this.isLegend ? `${this.identifier}-title` : undefined }, h("slot", { key: 'eb7409f94e137a2dacd83fa7df27c6b2635bf660' }), this.required && !this.readonly && (h("span", { key: '6910dd3c0d87ea94ab3c07371e5ee55b212d9342', class: "mg-c-input-title__required" }, "\u00A0", h("span", { key: '45e9d38af05410888be0fc36e04d4641a41f367b', class: "mg-u-is-asterisk" }, "*")))));
4324
+ return (h(TagName, { key: 'f8f8baaeb87e7c2cc77e71781f4d33ea5a63f760', class: "mg-c-input-title", htmlFor: !this.isLegend && this.identifier, id: this.isLegend ? `${this.identifier}-title` : undefined }, h("slot", { key: '7f6c0f451dfe789d924e9f608813e03bc72ad88a' }), this.required && !this.readonly && (h("span", { key: 'a78c5191995399e3e2ad346fec8546277581ca9d', class: "mg-c-input-title__required" }, "\u00A0", h("span", { key: 'ae8df5f13d54a1b8419d0d01048ff91dda601ab6', class: "mg-u-is-asterisk" }, "*")))));
3944
4325
  }
3945
4326
  static get watchers() { return {
3946
4327
  "identifier": ["validateIdentifier"],
@@ -3970,6 +4351,43 @@ const MgInputToggle = class {
3970
4351
  this.classIsActive = 'mg-c-input--toggle-is-active';
3971
4352
  this.classOnOff = 'mg-c-input--toggle-on-off';
3972
4353
  this.classIcon = 'mg-c-input--toggle-icon';
4354
+ /**
4355
+ * Input name
4356
+ * If not set the value equals the identifier
4357
+ */
4358
+ this.name = this.identifier;
4359
+ /**
4360
+ * Define if label is visible
4361
+ */
4362
+ this.labelHide = false;
4363
+ /**
4364
+ * Define if toggle have on/off style
4365
+ */
4366
+ this.isOnOff = false;
4367
+ /**
4368
+ * Define if toggle display icon
4369
+ */
4370
+ this.isIcon = false;
4371
+ /**
4372
+ * Define if input is readonly
4373
+ */
4374
+ this.readonly = false;
4375
+ /**
4376
+ * Define if input is disabled
4377
+ */
4378
+ this.disabled = false;
4379
+ /**
4380
+ * Define tooltip position
4381
+ */
4382
+ this.tooltipPosition = 'input';
4383
+ /**
4384
+ * Component classes
4385
+ */
4386
+ this.classCollection = new Ge(['mg-c-input--toggle']);
4387
+ /**
4388
+ * Checked internal value
4389
+ */
4390
+ this.checked = false;
3973
4391
  /**
3974
4392
  * Set input error message
3975
4393
  * @param errorMessage - errorMessage override
@@ -4016,25 +4434,6 @@ const MgInputToggle = class {
4016
4434
  return null;
4017
4435
  }
4018
4436
  };
4019
- this.value = undefined;
4020
- this.items = undefined;
4021
- this.identifier = undefined;
4022
- this.name = this.identifier;
4023
- this.label = undefined;
4024
- this.labelOnTop = undefined;
4025
- this.labelHide = false;
4026
- this.isOnOff = false;
4027
- this.isIcon = false;
4028
- this.readonly = false;
4029
- this.disabled = false;
4030
- this.tooltip = undefined;
4031
- this.tooltipPosition = 'input';
4032
- this.helpText = undefined;
4033
- this.classCollection = new Xe(['mg-c-input--toggle']);
4034
- this.options = undefined;
4035
- this.errorMessage = undefined;
4036
- this.valid = undefined;
4037
- this.checked = false;
4038
4437
  }
4039
4438
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4040
4439
  handleValue(newValue) {
@@ -4045,10 +4444,10 @@ const MgInputToggle = class {
4045
4444
  }
4046
4445
  validateItems(newValue) {
4047
4446
  if (typeof newValue === 'object' && this.items.length !== 2) {
4048
- throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${Ye(newValue)}.`);
4447
+ throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${Je(newValue)}.`);
4049
4448
  }
4050
4449
  // String array
4051
- else if (Je(newValue)) {
4450
+ else if (Xe(newValue)) {
4052
4451
  this.options = newValue.map(item => ({ title: item, value: item }));
4053
4452
  }
4054
4453
  // Object array
@@ -4056,7 +4455,7 @@ const MgInputToggle = class {
4056
4455
  this.options = newValue;
4057
4456
  }
4058
4457
  else {
4059
- throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${Ye(newValue)}.`);
4458
+ throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${Je(newValue)}.`);
4060
4459
  }
4061
4460
  }
4062
4461
  watchIsOnOff(newValue) {
@@ -4104,7 +4503,7 @@ const MgInputToggle = class {
4104
4503
  if (typeof valid !== 'boolean') {
4105
4504
  throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
4106
4505
  }
4107
- else if (!me(errorMessage)) {
4506
+ else if (!ye(errorMessage)) {
4108
4507
  throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
4109
4508
  }
4110
4509
  else {
@@ -4171,7 +4570,7 @@ const MgInputToggle = class {
4171
4570
  */
4172
4571
  render() {
4173
4572
  const checkedItem = this.getCheckedItem(this.checked);
4174
- return (h("mg-input", { key: 'b47ba6e093e47f8405e12744576f2098943e5fbe', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
4573
+ return (h("mg-input", { key: '769507fe4a474312d399cc356682221b5d8f3267', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
4175
4574
  }
4176
4575
  get element() { return getElement(this); }
4177
4576
  static get watchers() { return {
@@ -4187,19 +4586,13 @@ const MgInputToggle = class {
4187
4586
  MgInputToggle.style = MgInputToggleStyle0;
4188
4587
 
4189
4588
  /**
4190
- * MgItemMore type guard
4191
- * @param element - element to control type
4192
- * @returns truthy if element is mg-item-more
4589
+ *
4193
4590
  */
4194
- const isMgItemMore = (element) => element.nodeName === 'MG-ITEM-MORE';
4195
- const OverflowBehaviorElements = {
4196
- BASE_INDEX: 'data-overflow-base-index',
4197
- PROXY_INDEX: 'data-overflow-proxy-index',
4198
- };
4199
4591
  class OverflowBehavior {
4200
- constructor(element, render) {
4201
- this.element = element;
4202
- this.render = render;
4592
+ constructor(parentElement, itemMoreElement, itemMoreContainerElement) {
4593
+ this.parentElement = parentElement;
4594
+ this.itemMoreElement = itemMoreElement;
4595
+ this.itemMoreContainerElement = itemMoreContainerElement;
4203
4596
  /**********
4204
4597
  * Public *
4205
4598
  **********/
@@ -4213,116 +4606,59 @@ class OverflowBehavior {
4213
4606
  * Internal *
4214
4607
  ************/
4215
4608
  /**
4216
- * run overflow behavior
4217
- * @param width - width of the container. Optional.
4218
- */
4219
- this.run = (width) => {
4220
- if (this._moreElement === undefined) {
4221
- // set moreElement
4222
- this._moreElement = this.render();
4223
- // set children
4224
- this._baseChildren = this.getInteractiveItems(this.element);
4225
- if (isMgItemMore(this._moreElement)) {
4226
- this._proxyChildren = this.getInteractiveItems(this._moreElement.shadowRoot.querySelector('mg-menu'));
4227
- }
4228
- // update children
4229
- this._baseChildren.forEach((child, index) => {
4230
- child.setAttribute(OverflowBehaviorElements.BASE_INDEX, `${index}`);
4231
- // set moreElement children
4232
- this._proxyChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
4233
- });
4234
- }
4235
- if (width !== undefined)
4236
- this.updateDisplayedItems(width);
4237
- };
4238
- /**
4239
- * Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
4240
- * @param element - element to parse
4241
- * @returns children
4242
- */
4243
- this.getInteractiveItems = (element) => { var _a; return (((_a = element.children) === null || _a === void 0 ? void 0 : _a.length) > 0 ? Array.from(element.children) : []).filter(element => ['MG-MENU-ITEM', 'MG-BUTTON'].includes(element.nodeName)); };
4244
- /**
4245
- * Update displayed items in container from a given available space
4246
- * @param availableWidth - available width in container to display child items
4247
- */
4248
- this.updateDisplayedItems = (availableWidth) => {
4249
- this.restoreItems();
4250
- const acc = { accWidth: 0, previousItem: null };
4251
- [...this._baseChildren, this._moreElement].forEach((child) => {
4252
- acc.accWidth += child.offsetWidth;
4253
- const hasPreviuosItem = acc.previousItem !== null;
4254
- const isPreviousItemHidden = hasPreviuosItem && acc.previousItem.hasAttribute('hidden');
4255
- // if previous item is hidden AND is NOT more element we hide current
4256
- // OR if item has an overflow we hide current
4257
- // OR if current item is more element AND have NOT previous hidden items, current more element item is an hidden item
4258
- // ELSE current is a display item
4259
- this.toggleItem(child, (isPreviousItemHidden && !this.isMoreElement(child)) || this.isOverflowElement(acc.accWidth, child, availableWidth) || (this.isMoreElement(child) && !isPreviousItemHidden));
4260
- // update previous item with current item
4261
- acc.previousItem = child;
4262
- });
4263
- };
4609
+ * Utility method to know if element is HTMLMgItemMoreElement
4610
+ * @param element - element to match with 'MORE' element
4611
+ * @returns truthy if element is the 'MORE' element
4612
+ */
4613
+ this.isMoreElement = (element) => element === this.itemMoreElement;
4264
4614
  /**
4265
4615
  * Utility method to know if item overflow partialy or totaly in the container
4266
4616
  * @param cumulateWidth - previous sibling elements cumulate width + item width
4267
4617
  * @param item - item HTML element
4268
- * @param availableWidth - container available width
4269
4618
  * @returns truthy if element is overflow
4270
4619
  */
4271
- this.isOverflowElement = (cumulateWidth, item, availableWidth) => {
4272
- if (item.previousElementSibling === null || this.isMoreElement(item))
4273
- return false;
4274
- else if (!this.isMoreElement(item.nextElementSibling))
4275
- return cumulateWidth + this._moreElement.offsetWidth > availableWidth;
4276
- else
4277
- return cumulateWidth > availableWidth;
4278
- };
4279
- /**
4280
- * Utility method to know if a given element is the 'MORE' element
4281
- * @param element - element to match with 'MORE' element
4282
- * @returns truthy if element is the 'MORE' element
4283
- */
4284
- this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
4285
- /**
4286
- * Toggle display item element
4287
- * @param item - item to control
4288
- * @param isHidden - is item hidden
4289
- */
4290
- this.toggleItem = (item, isHidden) => {
4291
- const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
4292
- if (this.isMoreElement(item))
4293
- this.toggleElement(this._moreElement, isHidden);
4294
- else if (mgActionMenuindex >= 0) {
4295
- this.toggleElement(item, isHidden);
4296
- this.toggleElement(this._proxyChildren[mgActionMenuindex], !isHidden);
4620
+ this.isOverflowElement = (cumulateWidth, item) => {
4621
+ const displayMgItemMore = this.itemMoreContainerElement.children.length > 0;
4622
+ if (!this.isMoreElement(item)) {
4623
+ if (item.nextElementSibling.nodeName !== 'MG-ITEM-MORE' && !displayMgItemMore)
4624
+ return cumulateWidth + this.itemMoreElement.offsetWidth > this._availableWidth;
4625
+ else
4626
+ return cumulateWidth > this._availableWidth;
4297
4627
  }
4298
- };
4299
- /**
4300
- * Toggle element's hide attribute
4301
- * @param element - element to toggle
4302
- * @param isHidden - element is hidden
4303
- */
4304
- this.toggleElement = (element, isHidden) => {
4305
- if (isHidden)
4306
- element.setAttribute('hidden', '');
4307
4628
  else
4308
- element.removeAttribute('hidden');
4629
+ return !displayMgItemMore;
4309
4630
  };
4310
4631
  /**
4311
- * Remove hidden attributes on all items
4632
+ * Toogle item from isHidden condition
4633
+ * @param item - item to update
4634
+ * @param isHidden - item is hidden
4312
4635
  */
4313
- this.restoreItems = () => {
4314
- [...this._baseChildren, this._moreElement].forEach(item => item.removeAttribute('hidden'));
4315
- };
4316
- if (this._resizeObserver === undefined) {
4317
- // add resize observer
4318
- this._resizeObserver = new ResizeObserver(entries => {
4319
- entries.forEach(entry => {
4320
- this.run(entry.contentRect.width);
4321
- });
4636
+ this.toggleItem = (item, isHidden) => {
4637
+ if (this.isMoreElement(item) && isHidden)
4638
+ item.setAttribute('hidden', '');
4639
+ else if (this.isMoreElement(item) && !isHidden)
4640
+ item.removeAttribute('hidden');
4641
+ else if (!this.isMoreElement(item) && isHidden)
4642
+ this.itemMoreContainerElement.appendChild(item);
4643
+ else if (!this.isMoreElement(item) && item.parentElement !== this.parentElement)
4644
+ this.parentElement.insertBefore(item, this.itemMoreElement);
4645
+ };
4646
+ if (!this.parentElement || !this.itemMoreElement || !this.itemMoreContainerElement) {
4647
+ throw new Error('OverflowBehavior - all construtor params are required');
4648
+ }
4649
+ const items = Array.from(this.parentElement.children);
4650
+ this._resizeObserver = new ResizeObserver(entries => {
4651
+ this._availableWidth = entries.map(entry => entry.contentRect.width).sort((a, b) => a - b).shift();
4652
+ // reset items
4653
+ items.forEach(item => this.toggleItem(item, false));
4654
+ let accWidth = 0;
4655
+ items.forEach((item, index) => {
4656
+ accWidth += item.offsetWidth;
4657
+ if (index)
4658
+ this.toggleItem(item, this.isOverflowElement(accWidth, item));
4322
4659
  });
4323
- this._resizeObserver.observe(this.element);
4324
- }
4325
- this.run();
4660
+ });
4661
+ this._resizeObserver.observe(this.parentElement);
4326
4662
  }
4327
4663
  }
4328
4664
 
@@ -4337,86 +4673,27 @@ const MgItemMore = class {
4337
4673
  ************/
4338
4674
  this.name = 'mg-item-more';
4339
4675
  /**
4340
- * Set proxy element properties and listeners
4341
- * @param proxified - element to proxify from
4676
+ * Define icon
4342
4677
  */
4343
- this.setProxyElement = (proxified) => {
4344
- const proxy = this.moreElementMenuItem.querySelector(`[identifier="${proxified.identifier}"]`);
4345
- if (proxy === null) {
4346
- return;
4347
- }
4348
- // remove proxy id to prevent duplicate key. default html id is: '';
4349
- if (me(proxy.id))
4350
- proxy.id = '';
4351
- const proxyClickHandler = () => {
4352
- this.parentMenu
4353
- .querySelector(`[identifier="${proxy.identifier}"]`)
4354
- .shadowRoot.querySelector('a, button')
4355
- .dispatchEvent(new MouseEvent('click', { bubbles: true }));
4356
- };
4357
- // Watch the `item-updated` event to keep element needeed properties and innerHTML in sync between the proxified and the proxy elements
4358
- const updateProxy = (element) => {
4359
- for (const key in element) {
4360
- if (['identifier', 'href', 'targer', 'status', 'expanded'].includes(key))
4361
- element[key] ? proxy.setAttribute(key, element[key]) : proxy.removeAttribute(key);
4362
- }
4363
- proxy.innerHTML = element.innerHTML;
4364
- // When `href` is updated we need to wait the full component re-render before update its handler
4365
- setTimeout(() => {
4366
- const interactiveElement = proxy.shadowRoot.querySelector('a, button');
4367
- interactiveElement === null || interactiveElement === void 0 ? void 0 : interactiveElement.removeEventListener('click', proxyClickHandler);
4368
- interactiveElement === null || interactiveElement === void 0 ? void 0 : interactiveElement.addEventListener('click', proxyClickHandler);
4369
- });
4370
- };
4371
- updateProxy(proxified);
4372
- proxified.addEventListener('item-updated', event => {
4373
- updateProxy(event.target);
4374
- });
4375
- // update click event listener on proxy item and mirror the event on the main menu element
4376
- // we need to wait mg-menu-item to be loaded to ensure the shadowroot is rendered
4377
- proxy.addEventListener('item-loaded', () => {
4378
- updateProxy(proxified);
4379
- });
4380
- };
4381
- /***********
4382
- * Methods *
4383
- ***********/
4384
- /**
4385
- * render mg-item-more overflow element
4386
- * @returns mg-item-more element
4387
- */
4388
- this.renderMgMenuItemOverflowElement = () => {
4389
- this.parentMenuItems.forEach((child) => {
4390
- // create item-more menu items element from main menu-items clones
4391
- this.moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
4392
- // we need to get all `mg-menu-item` linked to the cloned one to set mirror process
4393
- tt(() => {
4394
- this.setProxyElement(child);
4395
- if (child.querySelector('mg-menu') !== null) {
4396
- child.querySelectorAll('mg-menu-item').forEach(this.setProxyElement);
4397
- }
4398
- });
4399
- });
4400
- return this.element;
4401
- };
4402
4678
  this.icon = { icon: 'ellipsis-vertical' };
4679
+ /**
4680
+ * Define slot label element
4681
+ */
4403
4682
  this.slotlabel = { display: false };
4404
- this.size = undefined;
4405
- this.parentMenu = undefined;
4406
4683
  }
4407
4684
  validateIcon(newValue) {
4408
4685
  if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
4409
- throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${Ye(newValue)}.`);
4686
+ throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${Je(newValue)}.`);
4410
4687
  }
4411
4688
  validateSlotLabel(newValue) {
4412
4689
  if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
4413
- throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${Ye(newValue)}.`);
4690
+ throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${Je(newValue)}.`);
4414
4691
  else if (typeof newValue.label !== 'string')
4415
4692
  this.slotlabel.label = this.messages.menuLabel;
4416
4693
  }
4417
4694
  validateSize(newValue) {
4418
- if (newValue && !sizes$2.includes(newValue))
4419
- throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${Ye(newValue)}.`);
4695
+ if (newValue && !sizes$3.includes(newValue))
4696
+ throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${Je(newValue)}.`);
4420
4697
  }
4421
4698
  /*************
4422
4699
  * Lifecycle *
@@ -4447,8 +4724,7 @@ const MgItemMore = class {
4447
4724
  */
4448
4725
  componentDidUpdate() {
4449
4726
  if (this.parentMenu && this.overflowBehavior === undefined) {
4450
- this.parentMenuItems = Array.from(this.parentMenu.children).filter(item => item.nodeName === 'MG-MENU-ITEM');
4451
- this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
4727
+ this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.element, this.itemMoreContainer);
4452
4728
  }
4453
4729
  }
4454
4730
  /**
@@ -4463,11 +4739,11 @@ const MgItemMore = class {
4463
4739
  * @returns HTML Element
4464
4740
  */
4465
4741
  render() {
4466
- return (h(Host, { key: '11c43154129c5756e80db0af3434c88cab2191f3', role: "listitem" }, this.parentMenu && (h("mg-menu-item", { key: '38fc92410328c317fb046f4e1ec4f94175d484fb', "data-overflow-more": true, "data-size": this.parentMenu.size, identifier: "mg-item-more", ref: el => {
4467
- if (el !== null) {
4468
- this.moreElementMenuItem = el;
4469
- }
4470
- } }, h("mg-icon", { key: '90e21f30004e38a1a0938359276dccd7458e5e86', icon: this.icon.icon, size: this.size, slot: "image" }), h("span", { key: '20f846c5718a19d39ad94abf59bab54658e1ff9c', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { key: 'b52f97129e736be9164ae18b717057d1bfc0cd0a', direction: Direction.VERTICAL, label: this.messages.menuLabel, size: this.size })))));
4742
+ const menuItemIdentifier = "mg-item-more";
4743
+ return (h(Host, { key: '522fc142a992fa450b2d102e2c053fcd25704dcc', role: "listitem", "data-mg-popover-guard": `${menuItemIdentifier}-popover` }, this.parentMenu && (h("mg-menu-item", { key: 'c05fb5c0379656b9634beca745b3b74d36c8e46c', "data-overflow-more": true, "data-size": this.parentMenu.size, "data-style-direction": Direction.HORIZONTAL, identifier: menuItemIdentifier }, h("mg-icon", { key: 'e40f07ce8c55c30ef79a42ddb973d884ab289427', icon: this.icon.icon, size: this.size, slot: "image" }), h("span", { key: '3b38b9362a023df9e53733bf810c4f37a0016a93', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { key: '4f20389326507261356d897dd25e676ac37ca5bb', direction: Direction.VERTICAL, label: this.messages.menuLabel, size: this.size, ref: (ref) => {
4744
+ if (ref !== null)
4745
+ this.itemMoreContainer = ref;
4746
+ } })))));
4471
4747
  }
4472
4748
  get element() { return getElement(this); }
4473
4749
  static get watchers() { return {
@@ -4478,7 +4754,7 @@ const MgItemMore = class {
4478
4754
  };
4479
4755
  MgItemMore.style = MgItemMoreStyle0;
4480
4756
 
4481
- const mgMenuCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:flex;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){height:100%;flex-direction:column;overflow-y:auto}";
4757
+ const mgMenuCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:inline-flex;width:100%;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}";
4482
4758
  const MgMenuStyle0 = mgMenuCss;
4483
4759
 
4484
4760
  const MgMenu = class {
@@ -4488,100 +4764,78 @@ const MgMenu = class {
4488
4764
  * Internal *
4489
4765
  ************/
4490
4766
  this.name = 'mg-menu';
4491
- this.menuItems = [];
4492
- this.focusedMenuItem = 0;
4493
- /*************
4494
- * Methods *
4495
- *************/
4496
4767
  /**
4497
- * Close matching menu-item
4498
- * @param item - menu-item to close
4499
- * @param condition - addionnal condition
4768
+ * Component display direction.
4500
4769
  */
4501
- this.closeMenuItem = (item, condition) => {
4502
- if (!this.isChildMenu && condition) {
4503
- item.expanded = false;
4504
- }
4505
- };
4770
+ this.direction = Direction.HORIZONTAL;
4506
4771
  /**
4507
- * get mg-item-more child mg-menu-item element
4508
- * @returns mg-menu-item element
4772
+ * Define mg-menu size
4509
4773
  */
4510
- this.getItemMoreMenuItem = () => { var _a, _b; return (_b = (_a = this.itemMoreElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item'); };
4774
+ this.size = 'medium';
4775
+ /*************
4776
+ * Methods *
4777
+ *************/
4511
4778
  /**
4512
- * Set item listend
4513
- * @param item - mg-menu-item element
4514
- * @param index - number
4779
+ * Test if menu is a child menu
4780
+ * @returns truthy if menu is a child menu
4515
4781
  */
4516
- this.setItemListener = (item, index) => {
4517
- ['click', 'focus'].forEach(trigger => {
4518
- item.shadowRoot.querySelector('button,a').addEventListener(trigger, () => {
4519
- this.focusedMenuItem = index;
4520
- // reset expanded on previous active menu item
4521
- const itemMoreMenuItem = this.getItemMoreMenuItem();
4522
- (![null, undefined].includes(itemMoreMenuItem) ? [...this.menuItems, itemMoreMenuItem] : this.menuItems).forEach((item, index) => {
4523
- this.closeMenuItem(item, index !== this.focusedMenuItem);
4524
- });
4525
- });
4526
- });
4527
- };
4782
+ this.isChildMenu = () => this.element.closest('mg-menu-item') !== null;
4528
4783
  /**
4529
- * Store menu-items on component init and add listeners
4784
+ * Get menu children items
4785
+ * @returns menu children mg-menu-item
4530
4786
  */
4531
- this.initMenuItemsListeners = () => {
4532
- // add listeners on menu item and edit index
4533
- this.menuItems.forEach((item, index) => {
4534
- this.setItemListener(item, index);
4535
- });
4787
+ this.getMenuItems = (menu = this.element) => {
4788
+ var _a, _b;
4789
+ const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
4790
+ const itemMoreMenuItem = (_b = (_a = menu.querySelector('mg-item-more')) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item');
4791
+ if (itemMoreMenuItem) {
4792
+ menuItems.push(itemMoreMenuItem);
4793
+ }
4794
+ return menuItems;
4536
4795
  };
4537
4796
  /**
4538
- * Handle item-loaded event on mg-item-more element
4797
+ * Update menu items
4539
4798
  */
4540
- this.handleItemLoaded = () => {
4541
- this.setItemListener(this.getItemMoreMenuItem(), this.menuItems.length);
4799
+ this.updateMenuItems = () => {
4800
+ this.getMenuItems().forEach((item) => {
4801
+ item.dataset.styleDirection = this.direction;
4802
+ });
4803
+ // render mg-item-more to manage OverflowBehavior
4804
+ this.renderMgItemMore();
4542
4805
  };
4543
4806
  /**
4544
4807
  * render mg-item-more
4545
4808
  */
4546
4809
  this.renderMgItemMore = () => {
4547
4810
  var _a;
4548
- if (this.direction !== Direction.HORIZONTAL || this.isChildMenu || this.element.children.length <= 1) {
4811
+ if (this.direction === Direction.VERTICAL || this.direction === Direction.HORIZONTAL && this.isChildMenu() || this.element.children.length <= 1) {
4549
4812
  return;
4550
4813
  }
4551
4814
  // Insert mg-item-more outside the mg-menu shadowdom
4552
- if (this.itemMoreElement === undefined) {
4553
- this.itemMoreElement = document.createElement('mg-item-more');
4554
- this.itemMoreElement.addEventListener('item-loaded', this.handleItemLoaded);
4555
- this.element.appendChild(this.itemMoreElement);
4815
+ let itemMoreElement = this.element.querySelector('mg-item-more');
4816
+ if (itemMoreElement === null) {
4817
+ itemMoreElement = document.createElement('mg-item-more');
4818
+ this.element.appendChild(itemMoreElement);
4556
4819
  }
4557
4820
  // update mg-item-more props
4558
- for (const attribute in this.itemmore) {
4559
- const newValue = this.itemmore[attribute];
4560
- // to improve rendering we use HTML attributes as much as possible
4561
- if (['string', 'number'].includes(typeof newValue)) {
4562
- this.itemMoreElement.setAttribute(attribute, newValue);
4563
- }
4564
- else {
4565
- this.itemMoreElement[attribute] = newValue;
4566
- }
4821
+ for (const propertie in this.itemmore) {
4822
+ itemMoreElement[propertie] = this.itemmore[propertie];
4567
4823
  }
4568
4824
  if (((_a = this.itemmore) === null || _a === void 0 ? void 0 : _a.size) === undefined)
4569
- this.itemMoreElement.size = this.size;
4825
+ itemMoreElement.size = this.size;
4570
4826
  };
4571
- this.label = undefined;
4572
- this.direction = Direction.HORIZONTAL;
4573
- this.itemmore = undefined;
4574
- this.size = 'medium';
4575
- this.isChildMenu = undefined;
4576
4827
  }
4577
4828
  validateLabel(newValue) {
4578
4829
  if (newValue === undefined && !this.element.hasAttribute('aria-label')) {
4579
- throw new Error(`<${this.name}> prop "label" is required. Passed value: ${Ye(newValue)}.`);
4830
+ throw new Error(`<${this.name}> prop "label" is required. Passed value: ${Je(newValue)}.`);
4580
4831
  }
4581
4832
  }
4582
4833
  validateDirection(newValue) {
4583
4834
  if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
4584
- throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${Ye(newValue)}.`);
4835
+ throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${Je(newValue)}.`);
4836
+ }
4837
+ else {
4838
+ this.updateMenuItems();
4585
4839
  }
4586
4840
  }
4587
4841
  validateItemMore(newValue) {
@@ -4593,10 +4847,31 @@ const MgMenu = class {
4593
4847
  }
4594
4848
  }
4595
4849
  validateSize(newValue) {
4596
- if (!sizes$2.includes(newValue)) {
4597
- throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${Ye(newValue)}.`);
4850
+ if (!sizes$3.includes(newValue)) {
4851
+ throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$3.join(', ')}. Passed value: ${Je(newValue)}.`);
4598
4852
  }
4599
4853
  }
4854
+ /**
4855
+ * Define mg-menu-item listener when they are loaded
4856
+ * @param event - mg-item-loaded "item-loaded" custom event
4857
+ */
4858
+ updateItemListener(event) {
4859
+ const itemToWatch = event.target.nodeName === 'MG-ITEM-MORE' ? event.target.shadowRoot.querySelector('mg-menu-item') : event.target;
4860
+ ['click', 'focus'].forEach(trigger => {
4861
+ itemToWatch.addEventListener(trigger, () => {
4862
+ const focusedItem = event.target.closest('mg-menu').querySelector('[data-has-focus]');
4863
+ // exit process if new focused item in the current menu children
4864
+ if (focusedItem === itemToWatch)
4865
+ return;
4866
+ // reset expanded on previous active menu item
4867
+ if (focusedItem)
4868
+ focusedItem.removeAttribute("data-has-focus");
4869
+ // update focusedMenuItem with new value
4870
+ itemToWatch.setAttribute('data-has-focus', 'true');
4871
+ });
4872
+ });
4873
+ }
4874
+ ;
4600
4875
  /*************
4601
4876
  * Lifecycle *
4602
4877
  *************/
@@ -4611,37 +4886,38 @@ const MgMenu = class {
4611
4886
  }
4612
4887
  /**
4613
4888
  * Check if component slots configuration
4614
- * @returns timeout
4615
4889
  */
4616
4890
  componentDidLoad() {
4617
- // update props and states after componentDidLoad hook
4618
- // return a promise to process action only in the FIRST render().
4619
- // https://stenciljs.com/docs/component-lifecycle#componentwillload
4620
- return setTimeout(() => {
4621
- // store all menu-items
4622
- this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
4623
- this.isChildMenu = this.element.closest('mg-menu-item') !== null;
4624
- // add mg-item-more to manage OverflowBehavior
4625
- // when all props, states and DOM are already rendered we can render the mg-item-more
4626
- this.renderMgItemMore();
4627
- // then use mutation observer on children to improve reactivity
4628
- new MutationObserver(() => {
4629
- this.renderMgItemMore();
4630
- }).observe(this.element, { childList: true });
4631
- });
4632
- }
4633
- /**
4634
- * Add listeners to items
4635
- */
4636
- componentDidRender() {
4637
- this.initMenuItemsListeners();
4891
+ // set menu-items
4892
+ this.updateMenuItems();
4893
+ // add listener to close main menu when focus leave it
4894
+ if (!this.isChildMenu() && this.direction === Direction.HORIZONTAL) {
4895
+ document.addEventListener('focusin', (event) => {
4896
+ const isElementChild = (element) => {
4897
+ if (element === this.element)
4898
+ return true;
4899
+ else if (!element.parentElement)
4900
+ return false;
4901
+ else
4902
+ return isElementChild(element.parentElement);
4903
+ };
4904
+ if (!event.target.closest('mg-menu') || !isElementChild(event.target)) {
4905
+ const focusedItem = this.element.querySelector('[data-has-focus]');
4906
+ // reset expanded on previous active menu item
4907
+ if (focusedItem)
4908
+ focusedItem.removeAttribute('data-has-focus');
4909
+ }
4910
+ });
4911
+ }
4912
+ // add mutation observer to improve global reactivity
4913
+ new MutationObserver(this.updateMenuItems).observe(this.element, { childList: true });
4638
4914
  }
4639
4915
  /**
4640
4916
  * Render
4641
4917
  * @returns HTML Element
4642
4918
  */
4643
4919
  render() {
4644
- return (h(Host, { key: '550624e40ec66eeb90f8bc4ac1590adcbaa20dfd', role: "list", "aria-label": this.label }, h("slot", { key: 'bf6f5ac748fd45e250c02d93cc7cf72e4580de3b' })));
4920
+ return (h(Host, { key: 'eb78530a80f841391df90167523b6d446cd5405e', role: "list", "aria-label": this.label }, h("slot", { key: '1a8839c831a81915de8a5b03ebe1481a32762217' })));
4645
4921
  }
4646
4922
  get element() { return getElement(this); }
4647
4923
  static get watchers() { return {
@@ -4659,7 +4935,6 @@ const MgMenuItemStyle0 = mgMenuItemCss;
4659
4935
  const MgMenuItem = class {
4660
4936
  constructor(hostRef) {
4661
4937
  registerInstance(this, hostRef);
4662
- this.statusChange = createEvent(this, "status-change", 7);
4663
4938
  this.itemLoaded = createEvent(this, "item-loaded", 7);
4664
4939
  this.itemUpdated = createEvent(this, "item-updated", 7);
4665
4940
  /************
@@ -4667,15 +4942,39 @@ const MgMenuItem = class {
4667
4942
  ************/
4668
4943
  this.name = 'mg-menu-item';
4669
4944
  this.navigationButton = 'mg-c-menu-item__navigation-button';
4945
+ /************
4946
+ * Props *
4947
+ ************/
4948
+ /**
4949
+ * Identifier is used to control mg-popover
4950
+ */
4951
+ this.identifier = ze('mg-menu-item');
4952
+ /**
4953
+ * Define menu-item status.
4954
+ */
4955
+ this.status = Status$1.VISIBLE;
4956
+ /**
4957
+ * Define menu-item content expanded.
4958
+ */
4959
+ this.expanded = false;
4960
+ /**********
4961
+ * States *
4962
+ *********/
4963
+ /**
4964
+ * Define menu-item size.
4965
+ */
4966
+ this.size = 'medium';
4967
+ /**
4968
+ * Component button classes
4969
+ */
4970
+ this.navigationButtonClassList = new Ge([this.navigationButton]);
4971
+ /**
4972
+ * Does component have children.
4973
+ */
4974
+ this.hasChildren = false;
4670
4975
  /***********
4671
4976
  * Methods *
4672
4977
  **********/
4673
- /**
4674
- * Toggle expanded prop value
4675
- */
4676
- this.toggleExpanded = () => {
4677
- this.expanded = !this.expanded;
4678
- };
4679
4978
  /**
4680
4979
  * Does an Element have given Status
4681
4980
  * @param mgMenuItemElement - to parse
@@ -4683,6 +4982,24 @@ const MgMenuItem = class {
4683
4982
  * @returns true if element with status is found
4684
4983
  */
4685
4984
  this.hasStatus = (mgMenuItemElement, status) => mgMenuItemElement.status === status;
4985
+ /**
4986
+ * Condition to know if component should display a mg-popover
4987
+ * @returns truthy if component display popover
4988
+ */
4989
+ this.hasPopover = () => this.isDirection(Direction.HORIZONTAL) && (this.isInMainMenu && Array.from(this.element.children).some(element => !element.querySelector('[slot]')) || this.isItemMore) && this.href === undefined;
4990
+ /**
4991
+ * Method to control if one of component children have active status
4992
+ * @returns truthy if component has active child
4993
+ */
4994
+ this.hasActiveChild = () => {
4995
+ var _a;
4996
+ return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).some((element) => element.nodeName === 'MG-MENU-ITEM' && this.hasStatus(element, Status$1.ACTIVE) && !element.hasAttribute('hidden'));
4997
+ };
4998
+ /**
4999
+ * Is component an interactive item
5000
+ * @returns truthy if element is clickable
5001
+ */
5002
+ this.isInteractiveItem = () => this.hasChildren || !ye(this.href);
4686
5003
  /**
4687
5004
  * Is component contextual direction match the given direction
4688
5005
  * @param direction - in parent menu
@@ -4700,25 +5017,37 @@ const MgMenuItem = class {
4700
5017
  childMenu !== null && Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && !subItem.hasAttribute('hidden'));
4701
5018
  };
4702
5019
  /**
4703
- * Method to control if one of component children have active status
4704
- * @returns truthy if component has active child
5020
+ * Update expanded prop
5021
+ * @param newValue - expanded new value
4705
5022
  */
4706
- this.hasActiveChild = () => {
4707
- var _a;
4708
- return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).some((element) => element.nodeName === 'MG-MENU-ITEM' && this.hasStatus(element, Status$1.ACTIVE) && !element.hasAttribute('hidden'));
5023
+ this.updateExpanded = (newValue) => {
5024
+ if (this.isInteractiveItem()) {
5025
+ // item is always expanded in vertical menu when has active child
5026
+ this.expanded = this.isDirection(Direction.VERTICAL) && this.hasActiveChild() || newValue;
5027
+ }
5028
+ };
5029
+ /**
5030
+ * Update status
5031
+ * @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
5032
+ */
5033
+ this.updateStatus = (guard = []) => {
5034
+ if (![Status$1.HIDDEN, Status$1.DISABLED, ...guard].includes(this.status)) {
5035
+ this.status = this.hasActiveChild() ? Status$1.ACTIVE : Status$1.VISIBLE;
5036
+ }
4709
5037
  };
4710
5038
  /**
4711
- * Validate slots
5039
+ * Update slots
4712
5040
  * @param guard - prevent action with guard. Default: false.
4713
5041
  */
4714
- this.validateSlot = (guard = false) => {
5042
+ this.updateSlot = (guard = false) => {
4715
5043
  // slot title AND metadata validation
4716
5044
  // add title on label AND metada slots due to text-overflow on these element
4717
- if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined)
5045
+ if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined) {
4718
5046
  throw new Error(`<${this.name}> slot "label" is required.`);
5047
+ }
4719
5048
  ['label', 'metadata'].forEach(slot => {
4720
5049
  Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
4721
- if (!me(element.textContent))
5050
+ if (!ye(element.textContent))
4722
5051
  throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
4723
5052
  if ((guard && !element.hasAttribute('title')) || !guard)
4724
5053
  element.setAttribute('title', element.textContent);
@@ -4726,39 +5055,23 @@ const MgMenuItem = class {
4726
5055
  });
4727
5056
  };
4728
5057
  /**
4729
- * Update status
4730
- * @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
4731
- */
4732
- this.updateStatus = (guard = []) => {
4733
- if (![Status$1.HIDDEN, Status$1.DISABLED, ...guard].includes(this.status)) {
4734
- this.status = this.hasActiveChild() ? Status$1.ACTIVE : Status$1.VISIBLE;
4735
- }
4736
- };
4737
- /**
4738
- * Init event-listeners
5058
+ * Update menu item
5059
+ * @param guard - prevent action with guard
4739
5060
  */
4740
- this.initListeners = () => {
4741
- var _a;
4742
- // manage first sub-level menu-items
4743
- Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).forEach(item => {
4744
- if (item.nodeName === 'MG-MENU-ITEM') {
4745
- // manage child menu listener
4746
- item.addEventListener('status-change', () => {
4747
- this.updateStatus();
4748
- });
4749
- }
4750
- });
5061
+ this.updateItem = (guard) => {
5062
+ const menu = this.element.closest('mg-menu');
5063
+ this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;
5064
+ // define element size
5065
+ if ((menu === null || menu === void 0 ? void 0 : menu.size) !== undefined && !this.isItemMore)
5066
+ this.size = menu.size;
5067
+ else if (this.isItemMore)
5068
+ this.size = this.element.dataset.size;
5069
+ // when vertical main menu item contain an active item we force expanded
5070
+ this.updateExpanded(this.expanded);
5071
+ this.updateStatus(guard);
5072
+ this.updatePopoverGuard();
5073
+ this.updateDisplayNotificationBadge();
4751
5074
  };
4752
- /**
4753
- * Get mg-popover identifier
4754
- * @returns generated mg-popover identifier
4755
- */
4756
- this.getPopoverIdentifier = () => `${this.identifier}-popover`;
4757
- /**
4758
- * Condition to know if component should display a mg-popover
4759
- * @returns truthy if component display popover
4760
- */
4761
- this.displayPopover = () => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
4762
5075
  /************
4763
5076
  * Handlers *
4764
5077
  ************/
@@ -4767,106 +5080,123 @@ const MgMenuItem = class {
4767
5080
  * @param event - click on element
4768
5081
  */
4769
5082
  this.handleElementCLick = (event) => {
4770
- if ((this.hasChildren && !this.isInMainMenu) || this.status === Status$1.DISABLED) {
5083
+ if (this.status === Status$1.DISABLED) {
4771
5084
  event.preventDefault();
4772
5085
  event.stopPropagation();
4773
5086
  }
4774
- // toggle expanded when mg-menu-item has child items
4775
- if (this.hasChildren)
4776
- this.toggleExpanded();
5087
+ // for non "poperized" menu-item we toggle expanded manualy
5088
+ this.updateExpanded(!this.expanded);
5089
+ // when item is the last clickable item we close the parent popover
5090
+ if (!this.isInteractiveItem()) {
5091
+ const closePopover = (element) => {
5092
+ if (!element)
5093
+ return;
5094
+ else if (element !== this.element && element.expanded && element.shadowRoot.querySelector('mg-popover') !== null) {
5095
+ element.expanded = false;
5096
+ }
5097
+ else {
5098
+ closePopover(element.parentElement.closest('mg-menu-item'));
5099
+ }
5100
+ };
5101
+ closePopover(this.element);
5102
+ }
4777
5103
  };
4778
5104
  /**
4779
5105
  * Handle popover element display-change event
4780
5106
  * @param event - popover display event
4781
5107
  */
4782
5108
  this.handlePopoverDisplay = (event) => {
4783
- this.expanded = event.detail;
5109
+ this.updateExpanded(event.detail);
4784
5110
  };
4785
5111
  /**
4786
5112
  * Render slot
4787
5113
  * @returns HTML Element
4788
5114
  */
4789
5115
  this.renderSlot = () => h("slot", null);
4790
- this.identifier = qe('mg-menu-item');
4791
- this.href = undefined;
4792
- this.target = undefined;
4793
- this.status = Status$1.VISIBLE;
4794
- this.expanded = false;
4795
- this.size = 'medium';
4796
- this.navigationButtonClassList = new Xe([this.navigationButton]);
4797
- this.direction = undefined;
4798
- this.isInMainMenu = undefined;
4799
- this.isItemMore = undefined;
4800
- this.hasChildren = false;
4801
- this.displayNotificationBadge = undefined;
4802
5116
  }
4803
5117
  watchIdentifier(newValue) {
4804
- if (!Ge(newValue)) {
4805
- console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
5118
+ if (!Ie(newValue)) {
5119
+ console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
5120
+ }
5121
+ else {
5122
+ this.popoverIdentifier = `${this.identifier}-popover`;
4806
5123
  }
4807
5124
  }
4808
5125
  watchTarget(newValue) {
4809
5126
  if (newValue && !targets.includes(newValue)) {
4810
- throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${Ye(newValue)}.`);
5127
+ throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${Je(newValue)}.`);
4811
5128
  }
4812
5129
  }
4813
- validateStatus(newValue, oldValue) {
4814
- if (oldValue !== undefined) {
5130
+ watchStatus(newValue, oldValue) {
5131
+ if (oldValue !== undefined)
4815
5132
  this.navigationButtonClassList.delete(`${this.navigationButton}--${oldValue}`);
4816
- }
4817
5133
  this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
4818
- this.statusChange.emit(newValue);
4819
- }
4820
- validateExpanded(newValue) {
4821
- if (typeof newValue !== 'boolean')
4822
- throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${Ye(newValue)}.`);
4823
- // if menu-item has sub-menu we have to apply some updates:
4824
- if (this.hasChildren) {
4825
- const subItems = Array.from(this.element.querySelectorAll(this.name));
4826
- if (!newValue) {
4827
- // - when main menu item is NOT expanded we need NOT expanded sub-items and NOT expanded sub-content
4828
- subItems.forEach(item => {
4829
- item.expanded = false;
4830
- });
4831
- }
4832
- else if (this.element.querySelector(`${this.name}[status="${Status$1.ACTIVE}"]`) !== null) {
4833
- // - when expanded and contain an active item parents are expended too
4834
- subItems.forEach(item => {
4835
- if (this.hasStatus(item, Status$1.ACTIVE)) {
4836
- item.expanded = true;
4837
- }
4838
- });
4839
- }
5134
+ }
5135
+ watchExpanded(newValue) {
5136
+ if (typeof newValue !== 'boolean') {
5137
+ throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${Je(newValue)}.`);
5138
+ }
5139
+ else {
5140
+ this.updateExpanded(newValue);
5141
+ // when expanded all actives sub-items need to be expanded and non active closed
5142
+ Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
5143
+ if (item !== this.element)
5144
+ item.expanded = newValue ? this.hasStatus(item, Status$1.ACTIVE) : false;
5145
+ });
4840
5146
  }
4841
5147
  }
4842
- validateSize(newValue, oldValue) {
4843
- this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);
5148
+ watchSize(newValue, oldValue) {
5149
+ if (oldValue !== undefined)
5150
+ this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);
4844
5151
  this.navigationButtonClassList.add(`${this.navigationButton}--size-${newValue}`);
4845
5152
  }
4846
- validateDirection(newValue) {
4847
- // manage menu items style depending to parent menu horientation
4848
- this.element.setAttribute('data-style-direction', newValue);
5153
+ validateDirection(newValue, oldValue) {
5154
+ if (oldValue !== undefined)
5155
+ this.navigationButtonClassList.delete(`${this.navigationButton}--${oldValue}`);
4849
5156
  this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
4850
5157
  // manage all sub levels child menu-items level with data-level attribut
4851
- if (this.isDirection(Direction.VERTICAL, newValue)) {
4852
- Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
5158
+ Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
5159
+ if (this.isDirection(Direction.VERTICAL, newValue)) {
4853
5160
  item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
4854
- });
4855
- }
5161
+ }
5162
+ else {
5163
+ delete item.dataset.level;
5164
+ }
5165
+ });
4856
5166
  }
4857
5167
  validateHasChildren(newValue) {
4858
5168
  if (newValue && this.element.href !== undefined) {
4859
5169
  throw new Error(`<${this.name}> prop "href" is unauthorizied when element is a parent.`);
4860
5170
  }
4861
5171
  }
5172
+ /**
5173
+ * direction value in dataset
5174
+ * @param newValue - new direction value
5175
+ */
5176
+ // eslint-disable-next-line @stencil-community/no-unused-watch
5177
+ watchDataStyleDirection(newValue) {
5178
+ this.direction = newValue;
5179
+ }
5180
+ /**
5181
+ * has focus value in dataset
5182
+ * @param newValue - new direction value
5183
+ */
5184
+ // eslint-disable-next-line @stencil-community/no-unused-watch
5185
+ watchDataHasFocus(newValue) {
5186
+ if (!newValue)
5187
+ this.updateExpanded(Boolean(newValue));
5188
+ }
4862
5189
  /**
4863
5190
  * Render popover clickoutside guard for content slot
4864
5191
  */
4865
5192
  updatePopoverGuard() {
4866
- if (this.displayPopover())
4867
- Array.from(this.element.children)
4868
- .filter((child) => !child.hasAttribute('slot') && child.nodeName !== 'MG-MENU' && Boolean(child.dataset))
4869
- .forEach((slot) => (slot.dataset.mgPopoverGuard = this.getPopoverIdentifier()));
5193
+ const subItem = this.element.querySelector('*:not([slot])');
5194
+ if (!subItem)
5195
+ return;
5196
+ if (this.hasPopover())
5197
+ subItem.dataset.mgPopoverGuard = this.popoverIdentifier;
5198
+ else
5199
+ delete subItem.dataset.mgPopoverGuard;
4870
5200
  }
4871
5201
  /*************
4872
5202
  * Lifecycle *
@@ -4880,13 +5210,12 @@ const MgMenuItem = class {
4880
5210
  this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));
4881
5211
  this.messages = initLocales(this.element).messages.menuItem;
4882
5212
  this.isItemMore = this.element.dataset.overflowMore !== undefined;
4883
- // Validate props
4884
- this.validateStatus(this.status);
4885
- this.validateExpanded(this.expanded);
5213
+ // watchers
5214
+ this.watchStatus(this.status);
5215
+ this.watchExpanded(this.expanded);
4886
5216
  this.watchTarget(this.target);
4887
5217
  this.watchIdentifier(this.identifier);
4888
- // Validate states
4889
- this.validateSize(this.size);
5218
+ this.watchSize(this.size);
4890
5219
  }
4891
5220
  /**
4892
5221
  * Check if component slots configuration
@@ -4894,40 +5223,36 @@ const MgMenuItem = class {
4894
5223
  */
4895
5224
  componentDidLoad() {
4896
5225
  // validation
4897
- this.validateSlot(true);
5226
+ this.updateSlot(true);
4898
5227
  // update props and states after componentDidLoad hook
4899
5228
  // return a promise to process action only in the FIRST render().
4900
5229
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
4901
5230
  return setTimeout(() => {
4902
- // define menu-item context states
4903
- const menu = this.element.closest('mg-menu');
4904
- this.direction = this.isItemMore || menu === null ? Direction.HORIZONTAL : menu.direction;
4905
- this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;
4906
- if ((menu === null || menu === void 0 ? void 0 : menu.size) !== undefined)
4907
- this.size = menu.size;
4908
- if (this.isItemMore)
4909
- this.size = this.element.dataset.size;
4910
- // when main menu item contain an active item it will get the active style
4911
- // AND if item is in vertical menu it will be expanded
4912
- if (this.hasActiveChild() && this.isInMainMenu)
4913
- this.expanded = this.isDirection(Direction.VERTICAL);
4914
- this.updateStatus([Status$1.ACTIVE]);
4915
- this.updateDisplayNotificationBadge();
4916
- this.updatePopoverGuard();
4917
- // manage child dom changes with mutationObserver and listners
4918
- this.initListeners();
5231
+ this.watchDataStyleDirection(this.element.dataset.styleDirection);
5232
+ this.watchDataHasFocus(this.element.dataset.hasFocus);
5233
+ this.updateItem([Status$1.ACTIVE]);
4919
5234
  // emit loaded event when component is fully loaded
4920
5235
  this.itemLoaded.emit();
4921
5236
  new MutationObserver(mutationsList => {
4922
- if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
5237
+ if (mutationsList.some(mutation => ['hidden', 'status'].includes(mutation.attributeName)))
4923
5238
  this.updateStatus(this.hasChildren ? undefined : [Status$1.ACTIVE]);
4924
5239
  if (mutationsList.some(mutation => mutation.type === 'characterData'))
4925
- this.validateSlot();
4926
- this.updateDisplayNotificationBadge();
5240
+ this.updateSlot();
5241
+ if (mutationsList.some(mutation => mutation.type === 'childList'))
5242
+ this.updateItem();
4927
5243
  this.itemUpdated.emit();
4928
5244
  }).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });
4929
5245
  }, 0);
4930
5246
  }
5247
+ /**
5248
+ * Emit event when component is updated
5249
+ * @returns promise process wich emit the 'item-updated' event
5250
+ */
5251
+ componentShouldUpdate() {
5252
+ return et(() => {
5253
+ this.itemUpdated.emit();
5254
+ });
5255
+ }
4931
5256
  /**
4932
5257
  * Render ineractive element
4933
5258
  * @returns HTML Element
@@ -4942,15 +5267,6 @@ const MgMenuItem = class {
4942
5267
  [`${this.navigationButton}-chevron--rotate`]: this.expanded === true,
4943
5268
  } }, h("mg-icon", { icon: "chevron-down" })))));
4944
5269
  }
4945
- /**
4946
- * Emit event when component is updated
4947
- * @returns promise process wich emit the 'item-updated' event
4948
- */
4949
- componentShouldUpdate() {
4950
- return tt(() => {
4951
- this.itemUpdated.emit();
4952
- });
4953
- }
4954
5270
  /**
4955
5271
  * Render
4956
5272
  * @returns HTML Element
@@ -4960,7 +5276,7 @@ const MgMenuItem = class {
4960
5276
  ['mg-c-menu-item__collapse-container']: true,
4961
5277
  ['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
4962
5278
  });
4963
- return (h(Host, { key: '0705617f39133b4da491c150f4984cc57cafe085', role: this.isItemMore ? 'presentation' : 'listitem' }, this.displayPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier(), "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
5279
+ return (h(Host, { key: '1bfbcc26638508e5fff8d0a9b0bd1956e06cb9ae', role: this.isItemMore ? 'presentation' : 'listitem' }, this.hasPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.popoverIdentifier, "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
4964
5280
  }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
4965
5281
  this.renderInteractiveElement(),
4966
5282
  h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
@@ -4970,11 +5286,13 @@ const MgMenuItem = class {
4970
5286
  static get watchers() { return {
4971
5287
  "identifier": ["watchIdentifier"],
4972
5288
  "target": ["watchTarget"],
4973
- "status": ["validateStatus"],
4974
- "expanded": ["validateExpanded"],
4975
- "size": ["validateSize"],
5289
+ "status": ["watchStatus"],
5290
+ "expanded": ["watchExpanded"],
5291
+ "size": ["watchSize"],
4976
5292
  "direction": ["validateDirection"],
4977
- "hasChildren": ["validateHasChildren"]
5293
+ "hasChildren": ["validateHasChildren"],
5294
+ "data-style-direction": ["watchDataStyleDirection"],
5295
+ "data-has-focus": ["watchDataHasFocus"]
4978
5296
  }; }
4979
5297
  };
4980
5298
  MgMenuItem.style = MgMenuItemStyle0;
@@ -4998,6 +5316,22 @@ const MgMessage = class {
4998
5316
  * Internal *
4999
5317
  ************/
5000
5318
  this.classBase = 'mg-c-message';
5319
+ /**
5320
+ * Define variant
5321
+ */
5322
+ this.variant = 'info';
5323
+ /**
5324
+ * Define variant style
5325
+ */
5326
+ this.variantStyle = 'bar-left';
5327
+ /**
5328
+ * Component classes
5329
+ */
5330
+ this.classCollection = new Ge(['mg-c-message']);
5331
+ /**
5332
+ * Define if component is using actions slot
5333
+ */
5334
+ this.hasActions = false;
5001
5335
  /**
5002
5336
  * Get icon corresponding to variant
5003
5337
  * @returns icon
@@ -5014,14 +5348,10 @@ const MgMessage = class {
5014
5348
  return 'exclamation-circle';
5015
5349
  }
5016
5350
  };
5017
- this.variant = 'info';
5018
- this.variantStyle = 'bar-left';
5019
- this.classCollection = new Xe(['mg-c-message']);
5020
- this.hasActions = false;
5021
5351
  }
5022
5352
  watchVariant(newValue, oldValue) {
5023
5353
  if (!variants$1.includes(newValue)) {
5024
- throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${Ye(newValue)}.`);
5354
+ throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${Je(newValue)}.`);
5025
5355
  }
5026
5356
  else {
5027
5357
  if (newValue !== undefined)
@@ -5032,7 +5362,7 @@ const MgMessage = class {
5032
5362
  }
5033
5363
  watchVariantStyle(newValue, oldValue) {
5034
5364
  if (!variantStyles.includes(newValue)) {
5035
- throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${Ye(newValue)}.`);
5365
+ throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${Je(newValue)}.`);
5036
5366
  }
5037
5367
  else {
5038
5368
  if (newValue !== undefined)
@@ -5059,9 +5389,9 @@ const MgMessage = class {
5059
5389
  * @returns HTML Element
5060
5390
  */
5061
5391
  render() {
5062
- return (h("div", { key: '9ce1d7b25bf12d974a7b0b296d9d71b9b2c984e1', class: this.classCollection.join() }, h("mg-card", { key: '7c7c1d5891d988adc7c5090b02d809aab32565f8' }, this.variantStyle === 'bar-left' && h("span", { key: 'd6c291fcf93ab6e84ba0288a1a0c4ec405b57e78', class: "mg-c-message__bar" }), h("span", { key: 'afc3dcf95dbf4ee96ca1041c54c0d4c37d435601', class: "mg-c-message__icon" }, h("mg-icon", { key: 'd9b79cb3be22fedee6a04cf43c72641202cc80f7', icon: this.getIcon() })), h("div", { key: 'f70d488459d28a464a3714b122b7a708c3562741', class: "mg-c-message__content" }, h("span", { key: 'd24b0ed1c326cb04bc7944f0c4f1fe19efa3fc9c', class: "mg-c-message__content-slot" }, h("slot", { key: 'bb491533bc09600c04699d561c7af608ee1567e5' })), this.hasActions && [
5392
+ return (h("div", { key: '851d97fde6f05799e1420f8825fcff986d9af1d6', class: this.classCollection.join() }, h("mg-card", { key: '40f85f1fb3240ab709b1ab46286e9a953f2d5dc8' }, this.variantStyle === 'bar-left' && h("span", { key: '50b078ec379c7774d2f409c64b56108041bf3053', class: "mg-c-message__bar" }), h("span", { key: 'bc6b1019e1103fc8cd5e4e92f95b62374207be2b', class: "mg-c-message__icon" }, h("mg-icon", { key: 'e461ddc1eb1ddcb7ecc673f59dc59f400efbe916', icon: this.getIcon() })), h("div", { key: 'edf836b375d7f1fd413b53711b99acbe2bef3e92', class: "mg-c-message__content" }, h("span", { key: 'c6ce4628e450b7e89ef3715126b3a2dee081224e', class: "mg-c-message__content-slot" }, h("slot", { key: '36ecf7417e61ab84695078e2fd4ebe829bd769a7' })), this.hasActions && [
5063
5393
  h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
5064
- h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '43547919e1ec8b34f23ea1ad5e75d5b0da23c831', name: "actions" })),
5394
+ h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '43be5769165cac1ab702b2ba80fb885c2ec1834f', name: "actions" })),
5065
5395
  ]))));
5066
5396
  }
5067
5397
  get element() { return getElement(this); }
@@ -5085,8 +5415,34 @@ const MgModal = class {
5085
5415
  registerInstance(this, hostRef);
5086
5416
  this.componentShow = createEvent(this, "component-show", 7);
5087
5417
  this.componentHide = createEvent(this, "component-hide", 7);
5418
+ this.componentClose = createEvent(this, "component-close", 7);
5088
5419
  // IDs
5089
5420
  this.titleId = '';
5421
+ /**
5422
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
5423
+ * If not set, it will be created.
5424
+ */
5425
+ this.identifier = ze('mg-modal');
5426
+ /**
5427
+ * Modal dialog role.
5428
+ */
5429
+ this.dialogRole = dialogRoles[0];
5430
+ /**
5431
+ * Define if modal has a cross button
5432
+ */
5433
+ this.closeButton = false;
5434
+ /**
5435
+ * Define if modal is open
5436
+ */
5437
+ this.open = false;
5438
+ /**
5439
+ * Define if component is using actions slot
5440
+ */
5441
+ this.hasActions = false;
5442
+ /**
5443
+ * Component classes
5444
+ */
5445
+ this.classCollection = new Ge(['mg-c-modal']);
5090
5446
  /***********
5091
5447
  * Handles *
5092
5448
  ***********/
@@ -5095,27 +5451,21 @@ const MgModal = class {
5095
5451
  */
5096
5452
  this.handleClose = () => {
5097
5453
  this.open = false;
5454
+ this.componentClose.emit();
5098
5455
  };
5099
- this.identifier = qe('mg-modal');
5100
- this.dialogRole = dialogRoles[0];
5101
- this.modalTitle = undefined;
5102
- this.closeButton = false;
5103
- this.open = false;
5104
- this.hasActions = false;
5105
- this.classCollection = new Xe(['mg-c-modal']);
5106
5456
  }
5107
5457
  watchIdentifier(newValue) {
5108
- if (!Ge(newValue)) {
5109
- throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
5458
+ if (!Ie(newValue)) {
5459
+ throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
5110
5460
  }
5111
5461
  }
5112
5462
  validateDialogRole(newValue) {
5113
5463
  if (!dialogRoles.includes(newValue))
5114
- throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${Ye(newValue)}.`);
5464
+ throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${Je(newValue)}.`);
5115
5465
  }
5116
5466
  validateModalTitle(newValue) {
5117
- if (!me(newValue)) {
5118
- throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${Ye(newValue)}.`);
5467
+ if (!ye(newValue)) {
5468
+ throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${Je(newValue)}.`);
5119
5469
  }
5120
5470
  }
5121
5471
  watchOpen(newValue) {
@@ -5156,6 +5506,7 @@ const MgModal = class {
5156
5506
  // update open prop when use escape key
5157
5507
  this.dialog.addEventListener('close', () => {
5158
5508
  this.open = false;
5509
+ this.componentClose.emit();
5159
5510
  });
5160
5511
  }
5161
5512
  /**
@@ -5163,13 +5514,11 @@ const MgModal = class {
5163
5514
  * @returns HTML Element
5164
5515
  */
5165
5516
  render() {
5166
- return (h("dialog", { key: '00881e2aa895d9b4bc48f721460a0f65f3ba1042', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
5517
+ return (h("dialog", { key: 'f927a4473e69d4034433e170b6279e027fc9c9d3', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
5167
5518
  if (el !== null) {
5168
5519
  this.dialog = el;
5169
5520
  }
5170
- } }, h("mg-card", { key: '3fdda688cfa51f9f96403cd918d7469a1be5f640' }, h("div", { key: 'f7f7dd207d50ed6a50cb13043acd6b1662197b8f', class: "mg-c-modal__dialog" }, h("header", { key: '9b6f2fbc0aba552d4f921df08f5e0301fcb996d1', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: 'cbe67968704c82cdcf640b829daf4367e31afc87', class: "mg-c-modal__close-button" }, h("mg-button", { key: '050ce6bdd52df7363f37a7e785e7de82e5f28fc8', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton,
5171
- // eslint-disable-next-line react/jsx-no-bind
5172
- onClick: this.handleClose }, h("mg-icon", { key: '256f467d254ba056505d8b0fdffbbef0bc426b37', icon: "cross" })))), h("h1", { key: '9812cb37e4cc713309191d53a83526b1970389c1', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: 'a83b1be738c8556d60e1c0c74c7adb24c751bdf9', class: "mg-c-modal__content" }, h("slot", { key: '3431c31ac066e43748063cc28daa785ae39f7b25' })), this.hasActions && (h("footer", { key: '0080243246ca901e0566fd947e74737c12fc2426', class: "mg-c-modal__footer" }, h("slot", { key: '044104989259ebd5a3ca8b84a24b7b1e844b7d7e', name: "actions" })))))));
5521
+ } }, h("mg-card", { key: '36e09b525447abd8b810c8d4b770597e354fc3c3' }, h("div", { key: '4e8188bd2f7c4db85b902b58079ea45a863929eb', class: "mg-c-modal__dialog" }, h("header", { key: 'bd0512246a56379a63d7be10fd9e7999d26b578a', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: 'f115aca533d59950c9b340f1e71d58cfe631b63d', class: "mg-c-modal__close-button" }, h("mg-button", { key: '691ed3f1b20978e302ebd7a793adeac23ccd87f4', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: 'aa1bc4cc8906234144fa2944ff5d2b7eab2df11e', icon: "cross" })))), h("h1", { key: 'cfab5ec91d14b904e68f4e8dfe973067f0e2af4e', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: 'c829f024a77f9c49d84cf7a05a34561b94fc6e47', class: "mg-c-modal__content" }, h("slot", { key: '4c2cf29eac6523b23e0d144fded17c38afab4a0a' })), this.hasActions && (h("footer", { key: 'e414e21afe1a4a3de720876b71d56efd267bd964', class: "mg-c-modal__footer" }, h("slot", { key: 'e71d2578822f3fbaf990fbb3e2878ab850bf4141', name: "actions" })))))));
5173
5522
  }
5174
5523
  get element() { return getElement(this); }
5175
5524
  static get watchers() { return {
@@ -5215,6 +5564,19 @@ const MgPagination = class {
5215
5564
  constructor(hostRef) {
5216
5565
  registerInstance(this, hostRef);
5217
5566
  this.currentPageChange = createEvent(this, "current-page-change", 7);
5567
+ /**
5568
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
5569
+ * If not set, it will be created.
5570
+ */
5571
+ this.identifier = ze('mg-pagination');
5572
+ /**
5573
+ * Component total pages
5574
+ */
5575
+ this.totalPages = 1;
5576
+ /**
5577
+ * Component current page
5578
+ */
5579
+ this.currentPage = 1;
5218
5580
  /**
5219
5581
  * Change current page from target
5220
5582
  * @param target - target page
@@ -5241,26 +5603,20 @@ const MgPagination = class {
5241
5603
  this.handleGoToPage = (action, disabled) => {
5242
5604
  !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
5243
5605
  };
5244
- this.identifier = qe('mg-pagination');
5245
- this.label = undefined;
5246
- this.hideNavigationLabels = undefined;
5247
- this.hidePageCount = undefined;
5248
- this.totalPages = 1;
5249
- this.currentPage = 1;
5250
5606
  }
5251
5607
  watchIdentifier(newValue) {
5252
- if (!Ge(newValue)) {
5253
- console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
5608
+ if (!Ie(newValue)) {
5609
+ console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
5254
5610
  }
5255
5611
  }
5256
5612
  validateTotalPages(newValue) {
5257
5613
  if (newValue < 1) {
5258
- throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${Ye(newValue)}.`);
5614
+ throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${Je(newValue)}.`);
5259
5615
  }
5260
5616
  }
5261
5617
  validateCurrentPage(newValue) {
5262
5618
  if (newValue < 1) {
5263
- throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${Ye(newValue)}.`);
5619
+ throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${Je(newValue)}.`);
5264
5620
  }
5265
5621
  else if (newValue > this.totalPages) {
5266
5622
  throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page.');
@@ -5290,10 +5646,10 @@ const MgPagination = class {
5290
5646
  * @returns HTML Element
5291
5647
  */
5292
5648
  render() {
5293
- const navigationActionButton = (disabled, action) => (h("mg-button", { key: '271af13e1b68e4fd00f46e99466d3fb7656b7892', label: this.messages.pagination[`${action}Page`],
5649
+ const navigationActionButton = (disabled, action) => (h("mg-button", { key: '223001cd79932ca02a46d6cc8be58346bd535f98', label: this.messages.pagination[`${action}Page`],
5294
5650
  // eslint-disable-next-line react/jsx-no-bind
5295
- onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { key: 'fea9b12c882c49824eef9216dc1e934f5dc8ddab', icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { key: 'c91f74667fbd297b1884b5406f3fe14604e943ce', icon: "chevron-right" })));
5296
- return (h(Host, { key: 'd3c8eb93a223c62239ea6e93f9848da697c93171', hidden: this.totalPages < 2 }, h("nav", { key: '91607b9155cd2194583b7548ae058cafbc495339', role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("div", { key: '2065b5f99eddc5e44e13dc1f03913003dcca44da', class: "mg-c-pagination__page-count" }, h("mg-input-select", { key: '405ff290c7ce715bdbc657e1a83aef1444e64cbe', identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { key: '6daf535469f5672858d7ae63991ee4cb1f03e04a', class: "mg-u-visually-hidden" }, this.messages.pagination.page, " ", this.currentPage), "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page)), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
5651
+ onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { key: '6dd38be4df1a9c540c1e04567f6a6ff858805014', icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { key: '226f0fcd8ce73dbcae38300bc9e559968c6413d7', icon: "chevron-right" })));
5652
+ return (h(Host, { key: '871b799015c76975770cc775c0a7c0a58551b491', hidden: this.totalPages < 2 }, h("nav", { key: 'faff3bc618af20b0273fe0272c3437198df0dc53', role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("div", { key: 'c4dabd89aa82b89436fdc3405090a635e51384aa', class: "mg-c-pagination__page-count" }, h("mg-input-select", { key: '6a3796ec81c0b862837750c6ecd71986fb77a9c1', identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { key: '5e6555ab6fb9da09ebf4687c652177c5040c4f0d', class: "mg-u-visually-hidden" }, this.messages.pagination.page, " ", this.currentPage), "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page)), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
5297
5653
  }
5298
5654
  get element() { return getElement(this); }
5299
5655
  static get watchers() { return {
@@ -5321,6 +5677,35 @@ const MgPanel = class {
5321
5677
  registerInstance(this, hostRef);
5322
5678
  this.titleChange = createEvent(this, "title-change", 7);
5323
5679
  this.expandedChange = createEvent(this, "expanded-change", 7);
5680
+ /**
5681
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
5682
+ * If not set, it will be created.
5683
+ */
5684
+ this.identifier = ze('mg-panel');
5685
+ /**
5686
+ * Define if panel title is editable
5687
+ */
5688
+ this.titleEditable = false;
5689
+ /**
5690
+ * Define title position
5691
+ */
5692
+ this.titlePosition = titlePositions[0];
5693
+ /**
5694
+ * Panel is opened
5695
+ */
5696
+ this.expanded = false;
5697
+ /**
5698
+ * Define expand toggle button display
5699
+ */
5700
+ this.expandToggleDisplay = expandToggleDisplays[0];
5701
+ /**
5702
+ * Component classes
5703
+ */
5704
+ this.classCollection = new Ge(['mg-c-panel']);
5705
+ /**
5706
+ * Title is in edition mode
5707
+ */
5708
+ this.isEditing = false;
5324
5709
  /************
5325
5710
  * Methods *
5326
5711
  ************/
@@ -5413,27 +5798,15 @@ const MgPanel = class {
5413
5798
  ];
5414
5799
  return this.titlePosition === 'right' ? children.reverse() : children;
5415
5800
  };
5416
- this.identifier = qe('mg-panel');
5417
- this.panelTitle = undefined;
5418
- this.titlePattern = undefined;
5419
- this.titlePatternErrorMessage = undefined;
5420
- this.titleEditable = false;
5421
- this.titlePosition = titlePositions[0];
5422
- this.expanded = false;
5423
- this.expandToggleDisplay = expandToggleDisplays[0];
5424
- this.expandToggleDisabled = undefined;
5425
- this.classCollection = new Xe(['mg-c-panel']);
5426
- this.isEditing = false;
5427
- this.updatedPanelTitle = undefined;
5428
5801
  }
5429
5802
  watchIdentifier(newValue) {
5430
- if (!Ge(newValue)) {
5431
- console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
5803
+ if (!Ie(newValue)) {
5804
+ console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
5432
5805
  }
5433
5806
  }
5434
5807
  validatePanelTitle(newValue) {
5435
- if (!me(newValue))
5436
- throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${Ye(newValue)}.`);
5808
+ if (!ye(newValue))
5809
+ throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${Je(newValue)}.`);
5437
5810
  this.titleChange.emit(newValue);
5438
5811
  }
5439
5812
  validateTitlePattern(newValue) {
@@ -5442,14 +5815,14 @@ const MgPanel = class {
5442
5815
  }
5443
5816
  validateTitlePosition(newValue) {
5444
5817
  if (!titlePositions.includes(newValue))
5445
- throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${Ye(newValue)}.`);
5818
+ throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${Je(newValue)}.`);
5446
5819
  }
5447
5820
  handleExpanded(newValue) {
5448
5821
  this.expandedChange.emit(newValue);
5449
5822
  }
5450
5823
  validateExpandToggleDisplay(newValue) {
5451
5824
  if (!expandToggleDisplays.includes(newValue))
5452
- throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${Ye(newValue)}.`);
5825
+ throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${Je(newValue)}.`);
5453
5826
  if (newValue === 'icon' && this.titleEditable)
5454
5827
  this.titleEditable = false;
5455
5828
  }
@@ -5484,7 +5857,7 @@ const MgPanel = class {
5484
5857
  */
5485
5858
  render() {
5486
5859
  const headerId = `${this.identifier}-header`;
5487
- return (h("section", { key: '22da4ba224a53f828c659fe8cddf23b911051ca3', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '1180c7e9e7d4e4601205abfa30a592bf93e88cf1' }, h("header", { key: 'db9489a40dceebfd7fed16be67faabf0dfee67bc', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: 'f25761138798e3965e9310da0e0cc90b1ac0cfe5', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '0c0aa51490734813a5a04e5aec40149c87766e5a' })))));
5860
+ return (h("section", { key: 'b4471d72f38c4e6f5b21aef7cc08696f745fd6b7', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: 'f51e3e4c51d56b9019ed4a3bc91fbb4b9ffcb543' }, h("header", { key: '9cfcb8fb0e01b570cddee46b2ef9737440c7e192', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: 'b5f8c6cb02f97f24b45b567ca25c00cf6930ca2f', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '5efc9246ad9d6c457abc9a80705df00a5d9e1cb1' })))));
5488
5861
  }
5489
5862
  get element() { return getElement(this); }
5490
5863
  static get watchers() { return {
@@ -7297,6 +7670,32 @@ const MgPopover = class {
7297
7670
  constructor(hostRef) {
7298
7671
  registerInstance(this, hostRef);
7299
7672
  this.displayChange = createEvent(this, "display-change", 7);
7673
+ this.componentClose = createEvent(this, "component-close", 7);
7674
+ /**
7675
+ * Sets an `id` attribute.
7676
+ * Needed by the input for accessibility `aria-decribedby`.
7677
+ */
7678
+ this.identifier = ze('mg-popover');
7679
+ /**
7680
+ * Popover placement
7681
+ */
7682
+ this.placement = 'bottom';
7683
+ /**
7684
+ * Hide popover arrow
7685
+ */
7686
+ this.arrowHide = false;
7687
+ /**
7688
+ * Define if popover has a cross button
7689
+ */
7690
+ this.closeButton = false;
7691
+ /**
7692
+ * Display popover
7693
+ */
7694
+ this.display = false;
7695
+ /**
7696
+ * Disable popover
7697
+ */
7698
+ this.disabled = false;
7300
7699
  /**
7301
7700
  * Check if clicked outside of component
7302
7701
  * @param event - mouse event
@@ -7361,6 +7760,7 @@ const MgPopover = class {
7361
7760
  */
7362
7761
  this.handleHideContent = () => {
7363
7762
  this.display = false;
7763
+ this.componentClose.emit();
7364
7764
  };
7365
7765
  /**
7366
7766
  * Render popover content element
@@ -7388,16 +7788,10 @@ const MgPopover = class {
7388
7788
  mgPopoverContent.setAttribute('id', this.identifier);
7389
7789
  }
7390
7790
  };
7391
- this.identifier = qe('mg-popover');
7392
- this.placement = 'bottom';
7393
- this.arrowHide = false;
7394
- this.closeButton = false;
7395
- this.display = false;
7396
- this.disabled = false;
7397
7791
  }
7398
7792
  validateIdentifier(newValue) {
7399
- if (!Ge(newValue)) {
7400
- throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
7793
+ if (!Ie(newValue)) {
7794
+ throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
7401
7795
  }
7402
7796
  // use renderPopoverContent to update popover-content id
7403
7797
  this.renderPopoverContent();
@@ -7486,10 +7880,17 @@ const MgPopover = class {
7486
7880
  if (!this.disabled)
7487
7881
  this.display = !this.display;
7488
7882
  });
7883
+ this.element.addEventListener('click', (event) => {
7884
+ const target = event.target.closest('[popovertargetaction]');
7885
+ if (this.display === true && target !== null && target.getAttribute('popovertargetaction') === 'hide') {
7886
+ this.display = false;
7887
+ }
7888
+ });
7489
7889
  // Add events to hide popover
7490
7890
  this.element.addEventListener('keydown', e => {
7491
7891
  if (!this.disabled && e.code === 'Escape') {
7492
7892
  this.display = false;
7893
+ this.componentClose.emit();
7493
7894
  interactiveElement.focus();
7494
7895
  }
7495
7896
  });
@@ -7500,7 +7901,7 @@ const MgPopover = class {
7500
7901
  * @returns HTML Element
7501
7902
  */
7502
7903
  render() {
7503
- return (h(Host, { key: 'a57ac343aacb59b7f3c86d0a41309a1aecef2a18' }, h("slot", { key: '086f8ce4cf204e465e7e0fd200bc3f4bddd2d45d' }), h("slot", { key: 'd9fb5a62f694b01605ce0008195445f89c1e70e8', name: "content" })));
7904
+ return (h(Host, { key: '29e8b74394c1a3f620b4119912d5038feb87b873' }, h("slot", { key: '8a3fc0141c2b48db2bf5bd526c1ce289797aaede' }), h("slot", { key: '32ef24ddf19e932ae40f1263da121244c969ce0c', name: "content" })));
7504
7905
  }
7505
7906
  get element() { return getElement(this); }
7506
7907
  static get watchers() { return {
@@ -7519,14 +7920,20 @@ const MgPopoverContent = class {
7519
7920
  constructor(hostRef) {
7520
7921
  registerInstance(this, hostRef);
7521
7922
  this.hideContent = createEvent(this, "hide-content", 7);
7923
+ /**
7924
+ * Define if popover has a cross button
7925
+ */
7926
+ this.closeButton = false;
7927
+ /**
7928
+ * Component classes
7929
+ */
7930
+ this.classCollection = new Ge(['mg-c-popover-content']);
7522
7931
  /**
7523
7932
  * Handle action for close button
7524
7933
  */
7525
7934
  this.handleCloseButton = () => {
7526
7935
  this.hideContent.emit();
7527
7936
  };
7528
- this.closeButton = false;
7529
- this.classCollection = new Xe(['mg-c-popover-content']);
7530
7937
  }
7531
7938
  /*************
7532
7939
  * Lifecycle *
@@ -7577,10 +7984,9 @@ const MgSkipLinks = class {
7577
7984
  event.currentTarget.blur();
7578
7985
  this.goToAnchor.emit(event.currentTarget.getAttribute('href'));
7579
7986
  };
7580
- this.links = undefined;
7581
7987
  }
7582
7988
  validateLinks(links) {
7583
- if (links === undefined || links.length === 0 || links.some(link => !me(link.href) || !link.href.startsWith('#') || !me(link.label))) {
7989
+ if (links === undefined || links.length === 0 || links.some(link => !ye(link.href) || !link.href.startsWith('#') || !ye(link.label))) {
7584
7990
  throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
7585
7991
  }
7586
7992
  }
@@ -7642,6 +8048,23 @@ const MgTabs = class {
7642
8048
  this.tabPanel = 'panel';
7643
8049
  this.buttonTabBaseClass = 'mg-c-tabs__navigation-button';
7644
8050
  this.startIndex = 1;
8051
+ /**
8052
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
8053
+ * If not set, it will be created.
8054
+ */
8055
+ this.identifier = ze('mg-tabs');
8056
+ /**
8057
+ * Define tabs size
8058
+ */
8059
+ this.size = 'medium';
8060
+ /**
8061
+ * Component tabs
8062
+ */
8063
+ this.tabs = [];
8064
+ /**
8065
+ * Component classes
8066
+ */
8067
+ this.classCollection = new Ge(['mg-c-tabs']);
7645
8068
  /**
7646
8069
  * Validate that new tab status can be `Status.ACTIVE`
7647
8070
  * @param tab - tab item
@@ -7739,7 +8162,7 @@ const MgTabs = class {
7739
8162
  */
7740
8163
  this.resetFocus = () => {
7741
8164
  // update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
7742
- tt(() => {
8165
+ et(() => {
7743
8166
  this.tabFocus = undefined;
7744
8167
  Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
7745
8168
  tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
@@ -7754,39 +8177,32 @@ const MgTabs = class {
7754
8177
  if (slots.length !== this.tabs.length)
7755
8178
  throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
7756
8179
  };
7757
- this.identifier = qe('mg-tabs');
7758
- this.label = undefined;
7759
- this.size = 'medium';
7760
- this.items = undefined;
7761
- this.activeTab = undefined;
7762
- this.tabs = [];
7763
- this.classCollection = new Xe(['mg-c-tabs']);
7764
8180
  }
7765
8181
  watchIdentifier(newValue) {
7766
- if (!Ge(newValue)) {
7767
- console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
8182
+ if (!Ie(newValue)) {
8183
+ console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
7768
8184
  }
7769
8185
  }
7770
8186
  validateLabel(newValue) {
7771
- if (!me(newValue)) {
7772
- throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${Ye(newValue)}.`);
8187
+ if (!ye(newValue)) {
8188
+ throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${Je(newValue)}.`);
7773
8189
  }
7774
8190
  }
7775
8191
  validateSize(newValue) {
7776
8192
  if (!sizes.includes(newValue)) {
7777
- throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Ye(newValue)}.`);
8193
+ throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Je(newValue)}.`);
7778
8194
  }
7779
8195
  this.classCollection.add(`mg-c-tabs--size-${this.size}`);
7780
8196
  }
7781
8197
  validateItems(newValue) {
7782
8198
  // String array
7783
- if (Je(newValue))
8199
+ if (Xe(newValue))
7784
8200
  this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
7785
8201
  // Object array
7786
8202
  else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
7787
8203
  this.tabs = newValue;
7788
8204
  else
7789
- throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${Ye(newValue)}.`);
8205
+ throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${Je(newValue)}.`);
7790
8206
  }
7791
8207
  validateActiveTab(newValue) {
7792
8208
  // when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
@@ -7811,7 +8227,7 @@ const MgTabs = class {
7811
8227
  this.activeTabChange.emit(newValue);
7812
8228
  }
7813
8229
  else {
7814
- throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${Ye(newValue)}.`);
8230
+ throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${Je(newValue)}.`);
7815
8231
  }
7816
8232
  }
7817
8233
  /*************
@@ -7882,14 +8298,18 @@ const MgTag = class {
7882
8298
  // Classes
7883
8299
  this.classOutline = 'mg-c-tag--outline';
7884
8300
  this.classSoft = 'mg-c-tag--soft';
7885
- this.variant = variants[0];
7886
- this.outline = undefined;
7887
- this.soft = undefined;
7888
- this.classCollection = new Xe(['mg-c-tag']);
8301
+ /**
8302
+ * Define tag variant
8303
+ */
8304
+ this.variant = variants[0]; // primary
8305
+ /**
8306
+ * Component classes
8307
+ */
8308
+ this.classCollection = new Ge(['mg-c-tag']);
7889
8309
  }
7890
8310
  validateVariant(newValue, oldValue) {
7891
8311
  if (!variants.includes(newValue)) {
7892
- throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${Ye(newValue)}.`);
8312
+ throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${Je(newValue)}.`);
7893
8313
  }
7894
8314
  else {
7895
8315
  if (oldValue !== undefined) {
@@ -7922,7 +8342,7 @@ const MgTag = class {
7922
8342
  * @param textContent - html element textContent property
7923
8343
  */
7924
8344
  validateTextContent(textContent) {
7925
- if (!me(textContent))
8345
+ if (!ye(textContent))
7926
8346
  throw new Error('<mg-tag> slot must contain a text content.');
7927
8347
  }
7928
8348
  /*************
@@ -7942,7 +8362,7 @@ const MgTag = class {
7942
8362
  * @returns HTML Element
7943
8363
  */
7944
8364
  render() {
7945
- return (h("span", { key: 'bb99306c07ea9ef4ee193a6e52c2c211378d34df', class: this.classCollection.join() }, h("slot", { key: '0e427b1189217e5d863daf9ed15d35de4832d8dd' })));
8365
+ return (h("span", { key: 'b3269e3baec3a281bdbe65f8b62636b7ea2fa84c', class: this.classCollection.join() }, h("slot", { key: 'bcca2d8653dbcd6a96d322055a4e2773d85ca87d' })));
7946
8366
  }
7947
8367
  get element() { return getElement(this); }
7948
8368
  static get watchers() { return {
@@ -7972,6 +8392,23 @@ const isButton = (element) => typeof element === 'object' && ['MG-BUTTON', 'BUTT
7972
8392
  const MgTooltip = class {
7973
8393
  constructor(hostRef) {
7974
8394
  registerInstance(this, hostRef);
8395
+ /**
8396
+ * Sets an `id` attribute.
8397
+ * Needed by the input for accessibility `aria-decribedby`.
8398
+ */
8399
+ this.identifier = ze('mg-tooltip');
8400
+ /**
8401
+ * Tooltip placement
8402
+ */
8403
+ this.placement = 'bottom';
8404
+ /**
8405
+ * Display tooltip
8406
+ */
8407
+ this.display = false;
8408
+ /**
8409
+ * Disable tooltip
8410
+ */
8411
+ this.disabled = false;
7975
8412
  /**
7976
8413
  * Show tooltip
7977
8414
  */
@@ -7981,7 +8418,7 @@ const MgTooltip = class {
7981
8418
  // Enable the event listeners
7982
8419
  this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
7983
8420
  // hide when click outside on nextTick to prevent event to trigger after creation
7984
- tt(() => {
8421
+ et(() => {
7985
8422
  this.windows.forEach((localWindow) => {
7986
8423
  localWindow.addEventListener('click', this.handleClickOutside, false);
7987
8424
  localWindow.addEventListener('keydown', this.handlePressEscape, false);
@@ -8177,22 +8614,17 @@ const MgTooltip = class {
8177
8614
  element.setAttribute('aria-describedby', `${[...new Set([...element.getAttribute('aria-describedby').split(' '), this.identifier])].join(' ')}`);
8178
8615
  }
8179
8616
  };
8180
- this.identifier = qe('mg-tooltip');
8181
- this.message = undefined;
8182
- this.placement = 'bottom';
8183
- this.display = false;
8184
- this.disabled = false;
8185
8617
  }
8186
8618
  watchIdentifier(newValue) {
8187
- if (!Ge(newValue)) {
8188
- throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${Ye(newValue)}.`);
8619
+ if (!Ie(newValue)) {
8620
+ throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
8189
8621
  }
8190
8622
  // use renderTooltipContent to update tooltip-content id
8191
8623
  this.renderTooltipContent();
8192
8624
  }
8193
8625
  watchMessage(newValue) {
8194
- if (!me(newValue)) {
8195
- throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${Ye(newValue)}.`);
8626
+ if (!ye(newValue)) {
8627
+ throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${Je(newValue)}.`);
8196
8628
  }
8197
8629
  if (this.mgTooltipContent !== undefined)
8198
8630
  this.mgTooltipContent.message = newValue;
@@ -8311,7 +8743,7 @@ const MgTooltip = class {
8311
8743
  * @returns HTML Element
8312
8744
  */
8313
8745
  render() {
8314
- return (h(Host, { key: '76fa15330f130c087376fd76188806dbd972fca9' }, h("slot", { key: '3ae6087202535e2855cda3b25bd8be886eb37d21' }), h("slot", { key: 'b2502789d5270a19b585c4e44b5d7e9f7fffc196', name: "content" })));
8746
+ return (h(Host, { key: '7868f7704c0f1ccd9d0d67d45eac6aa8901f4d5d' }, h("slot", { key: '4f865f9e153c5d01259ca83b81772dce302f5c05' }), h("slot", { key: '2032e81f60a7b7818a7220f0b00cec81ca0a84ed', name: "content" })));
8315
8747
  }
8316
8748
  get element() { return getElement(this); }
8317
8749
  static get watchers() { return {
@@ -8329,7 +8761,6 @@ const MgTooltipContentStyle0 = mgTooltipContentCss;
8329
8761
  const MgTooltipContent = class {
8330
8762
  constructor(hostRef) {
8331
8763
  registerInstance(this, hostRef);
8332
- this.message = undefined;
8333
8764
  }
8334
8765
  /*************
8335
8766
  * Lifecycle *
@@ -8339,7 +8770,7 @@ const MgTooltipContent = class {
8339
8770
  * @returns HTML Element
8340
8771
  */
8341
8772
  render() {
8342
- return (h(Host, { key: '2f94fdb8d48e172cc1d1f069ce12d1508e5e7896', role: "tooltip" }, h("span", { key: 'f075e8392eba2cd1256df7e89b7f20c832dc02e8', innerHTML: this.message, class: "mg-tooltip-content__message" }), h("slot", { key: '5f840ac9a4c9c422dc6e012dd8fbb0637232bd5f', name: "arrow" })));
8773
+ return (h(Host, { key: '2221de3ca0ef7c9d6e46e24b19c69007fababf81', role: "tooltip" }, h("span", { key: '9e14f7f5b3f5e5060ed9f42e8d7259b17575168e', innerHTML: this.message, class: "mg-tooltip-content__message" }), h("slot", { key: 'bc083567d77e8f4ffccee98b96036ba8ac494fb6', name: "arrow" })));
8343
8774
  }
8344
8775
  };
8345
8776
  MgTooltipContent.style = MgTooltipContentStyle0;