@mgdis/mg-components 6.3.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 (231) hide show
  1. package/dist/cjs/{index-a5b2cd1b.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 +1341 -951
  9. package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
  10. package/dist/cjs/mg-alert.cjs.entry.js +15 -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.js +50 -11
  26. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  27. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
  28. package/dist/collection/components/atoms/mg-divider/mg-divider.js +9 -1
  29. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  30. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  31. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-tag/mg-tag.js +14 -4
  33. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  34. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +3 -4
  35. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  36. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +28 -6
  37. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  38. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +50 -13
  39. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
  40. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +29 -11
  41. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +106 -33
  43. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +99 -36
  45. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +130 -35
  47. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +87 -25
  49. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +86 -26
  51. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +92 -30
  53. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +108 -31
  55. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +109 -29
  57. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  58. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +67 -21
  59. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  60. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +16 -70
  61. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -1
  62. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +101 -89
  63. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  64. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +194 -157
  65. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  66. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +19 -8
  67. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  68. package/dist/collection/components/molecules/mg-alert/mg-alert.js +15 -6
  69. package/dist/collection/components/molecules/mg-alert/mg-alert.js.map +1 -1
  70. package/dist/collection/components/molecules/mg-details/mg-details.js +17 -5
  71. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  72. package/dist/collection/components/molecules/mg-form/mg-form.js +48 -16
  73. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  74. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +13 -3
  75. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  76. package/dist/collection/components/molecules/mg-loader/mg-loader.js +5 -5
  77. package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
  78. package/dist/collection/components/molecules/mg-message/mg-message.js +22 -6
  79. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  80. package/dist/collection/components/molecules/mg-modal/mg-modal.js +37 -9
  81. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  82. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +28 -9
  83. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  84. package/dist/collection/components/molecules/mg-panel/mg-panel.js +48 -13
  85. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  86. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +10 -2
  87. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  88. package/dist/collection/components/molecules/mg-popover/mg-popover.js +44 -7
  89. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  90. package/dist/collection/components/molecules/mg-progress/mg-progress.js +26 -1
  91. package/dist/collection/components/molecules/mg-progress/mg-progress.js.map +1 -1
  92. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +3 -2
  93. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  94. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +28 -8
  95. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  96. package/dist/collection/utils/behaviors.utils.js +44 -107
  97. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  98. package/dist/components/index.es.js +42 -42
  99. package/dist/components/index.es.js.map +1 -1
  100. package/dist/components/index2.js +2 -2
  101. package/dist/components/mg-action-more.js +15 -12
  102. package/dist/components/mg-action-more.js.map +1 -1
  103. package/dist/components/mg-alert.js +13 -10
  104. package/dist/components/mg-alert.js.map +1 -1
  105. package/dist/components/mg-badge2.js +13 -10
  106. package/dist/components/mg-badge2.js.map +1 -1
  107. package/dist/components/mg-button2.js +37 -16
  108. package/dist/components/mg-button2.js.map +1 -1
  109. package/dist/components/mg-card2.js +1 -1
  110. package/dist/components/mg-character-left2.js +8 -7
  111. package/dist/components/mg-character-left2.js.map +1 -1
  112. package/dist/components/mg-details.js +11 -7
  113. package/dist/components/mg-details.js.map +1 -1
  114. package/dist/components/mg-divider2.js +7 -1
  115. package/dist/components/mg-divider2.js.map +1 -1
  116. package/dist/components/mg-form.js +35 -21
  117. package/dist/components/mg-form.js.map +1 -1
  118. package/dist/components/mg-icon2.js +17 -11
  119. package/dist/components/mg-icon2.js.map +1 -1
  120. package/dist/components/mg-illustrated-message.js +10 -4
  121. package/dist/components/mg-illustrated-message.js.map +1 -1
  122. package/dist/components/mg-input-checkbox-paginated2.js +14 -10
  123. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  124. package/dist/components/mg-input-checkbox.js +73 -40
  125. package/dist/components/mg-input-checkbox.js.map +1 -1
  126. package/dist/components/mg-input-date.js +77 -46
  127. package/dist/components/mg-input-date.js.map +1 -1
  128. package/dist/components/mg-input-numeric.js +89 -44
  129. package/dist/components/mg-input-numeric.js.map +1 -1
  130. package/dist/components/mg-input-password.js +55 -27
  131. package/dist/components/mg-input-password.js.map +1 -1
  132. package/dist/components/mg-input-radio.js +59 -31
  133. package/dist/components/mg-input-radio.js.map +1 -1
  134. package/dist/components/mg-input-select2.js +59 -35
  135. package/dist/components/mg-input-select2.js.map +1 -1
  136. package/dist/components/mg-input-text2.js +69 -38
  137. package/dist/components/mg-input-text2.js.map +1 -1
  138. package/dist/components/mg-input-textarea.js +71 -35
  139. package/dist/components/mg-input-textarea.js.map +1 -1
  140. package/dist/components/mg-input-title2.js +11 -8
  141. package/dist/components/mg-input-title2.js.map +1 -1
  142. package/dist/components/mg-input-toggle.js +43 -25
  143. package/dist/components/mg-input-toggle.js.map +1 -1
  144. package/dist/components/mg-input2.js +37 -20
  145. package/dist/components/mg-input2.js.map +1 -1
  146. package/dist/components/mg-item-more2.js +146 -270
  147. package/dist/components/mg-item-more2.js.map +1 -1
  148. package/dist/components/mg-loader.js +4 -6
  149. package/dist/components/mg-loader.js.map +1 -1
  150. package/dist/components/mg-menu-item2.js +193 -149
  151. package/dist/components/mg-menu-item2.js.map +1 -1
  152. package/dist/components/mg-message2.js +21 -9
  153. package/dist/components/mg-message2.js.map +1 -1
  154. package/dist/components/mg-modal.js +33 -15
  155. package/dist/components/mg-modal.js.map +1 -1
  156. package/dist/components/mg-pagination2.js +21 -14
  157. package/dist/components/mg-pagination2.js.map +1 -1
  158. package/dist/components/mg-panel.js +37 -20
  159. package/dist/components/mg-panel.js.map +1 -1
  160. package/dist/components/mg-popover-content2.js +9 -3
  161. package/dist/components/mg-popover-content2.js.map +1 -1
  162. package/dist/components/mg-popover2.js +35 -10
  163. package/dist/components/mg-popover2.js.map +1 -1
  164. package/dist/components/mg-progress.js +26 -11
  165. package/dist/components/mg-progress.js.map +1 -1
  166. package/dist/components/mg-skip-links.js +2 -3
  167. package/dist/components/mg-skip-links.js.map +1 -1
  168. package/dist/components/mg-tabs.js +27 -17
  169. package/dist/components/mg-tabs.js.map +1 -1
  170. package/dist/components/mg-tag.js +12 -8
  171. package/dist/components/mg-tag.js.map +1 -1
  172. package/dist/components/mg-tooltip-content2.js +1 -2
  173. package/dist/components/mg-tooltip-content2.js.map +1 -1
  174. package/dist/components/mg-tooltip2.js +24 -12
  175. package/dist/components/mg-tooltip2.js.map +1 -1
  176. package/dist/esm/{index-eb0e1053.js → index-1f32332a.js} +410 -266
  177. package/dist/esm/index-1f32332a.js.map +1 -0
  178. package/dist/esm/{index-f3d3fb70.js → index-9bd10f5d.js} +3 -3
  179. package/dist/esm/{index-f3d3fb70.js.map → index-9bd10f5d.js.map} +1 -1
  180. package/dist/esm/{index.es-940821a9.js → index.es-a2587b72.js} +43 -43
  181. package/dist/esm/index.es-a2587b72.js.map +1 -0
  182. package/dist/esm/loader.js +3 -3
  183. package/dist/esm/mg-action-more_36.entry.js +1341 -951
  184. package/dist/esm/mg-action-more_36.entry.js.map +1 -1
  185. package/dist/esm/mg-alert.entry.js +15 -12
  186. package/dist/esm/mg-alert.entry.js.map +1 -1
  187. package/dist/esm/mg-components.js +4 -4
  188. package/dist/esm/mg-components.js.map +1 -1
  189. package/dist/esm/mg-loader.entry.js +6 -8
  190. package/dist/esm/mg-loader.entry.js.map +1 -1
  191. package/dist/esm/mg-progress.entry.js +27 -12
  192. package/dist/esm/mg-progress.entry.js.map +1 -1
  193. package/dist/mg-components/mg-components.esm.js +1 -1
  194. package/dist/mg-components/mg-components.esm.js.map +1 -1
  195. package/dist/mg-components/p-0ead5317.entry.js +2 -0
  196. package/dist/mg-components/{p-d0086664.entry.js.map → p-0ead5317.entry.js.map} +1 -1
  197. package/dist/mg-components/p-35898742.js +3 -0
  198. package/dist/mg-components/p-35898742.js.map +1 -0
  199. package/dist/mg-components/p-3b052ac0.entry.js +2 -0
  200. package/dist/mg-components/p-3b052ac0.entry.js.map +1 -0
  201. package/dist/mg-components/p-6810a565.entry.js +2 -0
  202. package/dist/mg-components/p-6810a565.entry.js.map +1 -0
  203. package/dist/mg-components/{p-ee51ec5e.js → p-b986c107.js} +2 -2
  204. package/dist/mg-components/p-b986c107.js.map +1 -0
  205. package/dist/mg-components/{p-a49e2b74.js → p-dc436f3c.js} +2 -2
  206. package/dist/mg-components/p-f48d964f.entry.js +2 -0
  207. package/dist/mg-components/p-f48d964f.entry.js.map +1 -0
  208. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +6 -0
  209. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.d.ts +1 -15
  210. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +14 -30
  211. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +46 -37
  212. package/dist/types/components.d.ts +0 -5
  213. package/dist/types/utils/behaviors.utils.d.ts +15 -44
  214. package/ide/intellij/web-types.json +3 -7
  215. package/ide/vscode/html-custom-data.json +2 -2
  216. package/package.json +22 -22
  217. package/dist/cjs/index-a5b2cd1b.js.map +0 -1
  218. package/dist/cjs/index.es-ac7c22e3.js.map +0 -1
  219. package/dist/esm/index-eb0e1053.js.map +0 -1
  220. package/dist/esm/index.es-940821a9.js.map +0 -1
  221. package/dist/mg-components/p-15b6849a.js +0 -3
  222. package/dist/mg-components/p-15b6849a.js.map +0 -1
  223. package/dist/mg-components/p-3aecf564.entry.js +0 -2
  224. package/dist/mg-components/p-3aecf564.entry.js.map +0 -1
  225. package/dist/mg-components/p-6f3d70b2.entry.js +0 -2
  226. package/dist/mg-components/p-6f3d70b2.entry.js.map +0 -1
  227. package/dist/mg-components/p-a17ea0af.entry.js +0 -2
  228. package/dist/mg-components/p-a17ea0af.entry.js.map +0 -1
  229. package/dist/mg-components/p-d0086664.entry.js +0 -2
  230. package/dist/mg-components/p-ee51ec5e.js.map +0 -1
  231. /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-eb0e1053.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
@@ -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) {
@@ -277,6 +283,38 @@ const MgButton = class {
277
283
  this.classDisabled = 'mg-c-button--disabled';
278
284
  this.classLoading = 'mg-c-button--loading';
279
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']);
280
318
  /**
281
319
  * Trigger actions onClick event
282
320
  * @param event - click event
@@ -325,17 +363,6 @@ const MgButton = class {
325
363
  (_b = this.element.querySelector('mg-icon')) === null || _b === void 0 ? void 0 : _b.setAttribute('size', this.size);
326
364
  }
327
365
  };
328
- this.variant = variants$3[0];
329
- this.label = undefined;
330
- this.type = undefined;
331
- this.size = sizes$2[0];
332
- this.fullWidth = false;
333
- this.form = undefined;
334
- this.disabled = undefined;
335
- this.isIcon = false;
336
- this.disableOnClick = false;
337
- this.loading = false;
338
- this.classCollection = new Xe(['mg-c-button']);
339
366
  }
340
367
  validateVariant(newValue, oldValue) {
341
368
  // validate new value
@@ -345,7 +372,7 @@ const MgButton = class {
345
372
  this.variant = variants$3[0];
346
373
  return;
347
374
  }
348
- 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)}.`);
349
376
  }
350
377
  else {
351
378
  if (oldValue !== undefined) {
@@ -357,7 +384,7 @@ const MgButton = class {
357
384
  validateSize(newValue, oldValue) {
358
385
  // validate new value
359
386
  if (!sizes$2.includes(newValue)) {
360
- throw new Error(`<mg-button> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${Ye(newValue)}.`);
387
+ throw new Error(`<mg-button> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${Je(newValue)}.`);
361
388
  }
362
389
  else {
363
390
  if (oldValue !== undefined) {
@@ -418,7 +445,7 @@ const MgButton = class {
418
445
  this.watchIsIcon();
419
446
  if (this.isIcon) {
420
447
  this.classCollection.add(`mg-c-button--icon`);
421
- if (!me(this.label)) {
448
+ if (!ye(this.label)) {
422
449
  throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
423
450
  }
424
451
  }
@@ -430,7 +457,7 @@ const MgButton = class {
430
457
  * Add listners
431
458
  */
432
459
  componentDidLoad() {
433
- tt(() => {
460
+ et(() => {
434
461
  var _a;
435
462
  const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
436
463
  // submit buttons should trigger form submition;
@@ -476,7 +503,7 @@ const MgCard = class {
476
503
  * @returns HTML Element
477
504
  */
478
505
  render() {
479
- 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' })));
480
507
  }
481
508
  };
482
509
  MgCard.style = MgCardStyle0;
@@ -487,18 +514,19 @@ const MgCharacterLeftStyle0 = mgCharacterLeftCss;
487
514
  const MgCharacterLeft = class {
488
515
  constructor(hostRef) {
489
516
  registerInstance(this, hostRef);
490
- this.identifier = undefined;
517
+ /**
518
+ * Sets the characters to count
519
+ */
491
520
  this.characters = '';
492
- this.maxlength = undefined;
493
521
  }
494
522
  watchIdentifier(newValue) {
495
- if (newValue !== undefined && !Ge(newValue)) {
496
- 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)}.`);
497
525
  }
498
526
  }
499
527
  validateMaxlength(newValue) {
500
528
  if (typeof newValue !== 'number') {
501
- 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)}.`);
502
530
  }
503
531
  }
504
532
  /*************
@@ -517,7 +545,7 @@ const MgCharacterLeft = class {
517
545
  * @returns HTML Element
518
546
  */
519
547
  render() {
520
- 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))));
521
549
  }
522
550
  get element() { return getElement(this); }
523
551
  static get watchers() { return {
@@ -534,19 +562,23 @@ const MgDetails = class {
534
562
  constructor(hostRef) {
535
563
  registerInstance(this, hostRef);
536
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;
537
573
  /**
538
574
  * Handle details toggle
539
575
  */
540
576
  this.handleToggle = () => {
541
577
  this.expanded = this.details.open;
542
578
  };
543
- this.toggleClosed = undefined;
544
- this.toggleOpened = undefined;
545
- this.hideSummary = false;
546
- this.expanded = false;
547
579
  }
548
580
  validateTitles(newValue) {
549
- if (!me(newValue)) {
581
+ if (!ye(newValue)) {
550
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}'".`);
551
583
  }
552
584
  }
@@ -568,7 +600,7 @@ const MgDetails = class {
568
600
  * @returns HTML Element
569
601
  */
570
602
  render() {
571
- 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" }))));
572
604
  }
573
605
  static get watchers() { return {
574
606
  "toggleClosed": ["validateTitles"],
@@ -584,6 +616,12 @@ const MgDividerStyle0 = mgDividerCss;
584
616
  const MgDivider = class {
585
617
  constructor(hostRef) {
586
618
  registerInstance(this, hostRef);
619
+ /**************
620
+ * Decorators *
621
+ **************/
622
+ /**
623
+ * Define component size
624
+ */
587
625
  this.fullWidth = false;
588
626
  }
589
627
  /**
@@ -591,7 +629,7 @@ const MgDivider = class {
591
629
  * @returns HTML Element
592
630
  */
593
631
  render() {
594
- return (h("div", { key: 'b7d74c11f15700cbffa553bf4d688ad291473087', class: {
632
+ return (h("div", { key: '60b987cb329c6db14c2cc4a665e7f32b2696a3ee', class: {
595
633
  'mg-c-divider': true,
596
634
  'mg-c-divider--full-width': this.fullWidth,
597
635
  } }));
@@ -619,6 +657,28 @@ const MgForm = class {
619
657
  // Classes
620
658
  this.classAllRequired = 'mg-c-form--all-required';
621
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']);
622
682
  /**
623
683
  * Define required message based on mg-inputs required elements
624
684
  */
@@ -704,31 +764,20 @@ const MgForm = class {
704
764
  }
705
765
  });
706
766
  };
707
- this.identifier = qe('mg-form');
708
- this.name = this.identifier;
709
- this.readonly = false;
710
- this.requiredMessage = undefined;
711
- this.ariaRole = undefined;
712
- this.labelOnTop = undefined;
713
- this.disabled = false;
714
- this.valid = undefined;
715
- this.invalid = undefined;
716
- this.classCollection = new Xe(['mg-c-form']);
717
- this.requiredMessageText = undefined;
718
767
  }
719
768
  watchIdentifier(newValue) {
720
- if (!Ge(newValue)) {
721
- 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)}.`);
722
771
  }
723
772
  }
724
773
  validateRequiredMessage(newValue) {
725
774
  if (newValue && !requiredMessageStatus.includes(newValue)) {
726
- 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)}.`);
727
776
  }
728
777
  }
729
778
  validateAriaRole(newValue) {
730
779
  if (newValue && !roles.includes(newValue)) {
731
- 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)}.`);
732
781
  }
733
782
  }
734
783
  handlelabelOnTop(newValue) {
@@ -804,17 +853,20 @@ const MgForm = class {
804
853
  */
805
854
  componentDidLoad() {
806
855
  // Update mgInputs when mgForm content change
807
- new MutationObserver(() => {
808
- this.setMgInputs();
809
- this.checkValidity();
810
- }).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);
811
863
  }
812
864
  /**
813
865
  * Render
814
866
  * @returns HTML Element
815
867
  */
816
868
  render() {
817
- 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" })));
818
870
  }
819
871
  get element() { return getElement(this); }
820
872
  static get watchers() { return {
@@ -849,6 +901,18 @@ const MgIconStyle0 = mgIconCss;
849
901
  const MgIcon = class {
850
902
  constructor(hostRef) {
851
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']);
852
916
  /**
853
917
  * Method to set default varianStyle props
854
918
  * needeed has stencil doesn't know that props is mutated when updated in prop watcher
@@ -869,16 +933,10 @@ const MgIcon = class {
869
933
  this.svg.setAttribute('focusable', 'false');
870
934
  this.svg.setAttribute('class', this.classCollection.join());
871
935
  };
872
- this.icon = undefined;
873
- this.size = 'medium';
874
- this.variant = undefined;
875
- this.variantStyle = undefined;
876
- this.spin = false;
877
- this.classCollection = new Xe(['mg-c-icon']);
878
936
  }
879
937
  validateIcon(newValue, oldValue) {
880
938
  if (!Object.keys(icons).includes(newValue))
881
- 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)}.`);
882
940
  else {
883
941
  if (oldValue !== undefined)
884
942
  this.classCollection.delete(`mg-c-icon--${oldValue}`);
@@ -888,7 +946,7 @@ const MgIcon = class {
888
946
  }
889
947
  validateSize(newValue, oldValue) {
890
948
  if (!sizes$1.includes(newValue))
891
- 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)}.`);
892
950
  else {
893
951
  if (oldValue !== undefined)
894
952
  this.classCollection.delete(`mg-c-icon--size-${oldValue}`);
@@ -898,7 +956,7 @@ const MgIcon = class {
898
956
  validateVariant(newValue, oldValue) {
899
957
  if (newValue !== undefined) {
900
958
  if (!variants$2.includes(newValue))
901
- 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)}.`);
902
960
  else {
903
961
  this.setDefaultVariantStyle();
904
962
  if (oldValue !== undefined)
@@ -910,7 +968,7 @@ const MgIcon = class {
910
968
  validateVariantStyle(newValue, oldValue) {
911
969
  if (newValue !== undefined) {
912
970
  if (!variantStyles$1.includes(newValue))
913
- 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)}.`);
914
972
  else {
915
973
  if (oldValue !== undefined)
916
974
  this.classCollection.delete(`mg-c-icon--variant-style-${oldValue}`);
@@ -955,13 +1013,19 @@ const MgIcon = class {
955
1013
  };
956
1014
  MgIcon.style = MgIconStyle0;
957
1015
 
958
- 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}";
959
1017
  const MgIllustratedMessageStyle0 = mgIllustratedMessageCss;
960
1018
 
961
1019
  const MgIllustratedMessage = class {
962
1020
  constructor(hostRef) {
963
1021
  registerInstance(this, hostRef);
1022
+ /**
1023
+ * Define illustration size
1024
+ */
964
1025
  this.size = 'medium';
1026
+ /**
1027
+ * Define component orientation
1028
+ */
965
1029
  this.direction = 'vertical';
966
1030
  }
967
1031
  /*************
@@ -986,13 +1050,13 @@ const MgIllustratedMessage = class {
986
1050
  * @returns HTML Element
987
1051
  */
988
1052
  render() {
989
- return (h("div", { key: '475cdb177405fc41e5dde86d9a3884de5fb88bef', class: {
1053
+ return (h("div", { key: 'ae59b32d798c888eef5f2b3464160177b7a2e9d8', class: {
990
1054
  'mg-c-illustrated-message': true,
991
1055
  'mg-c-illustrated-message--horizontal': this.direction === 'horizontal',
992
- } }, h("div", { key: '0e007f09bcdcd85d50bd16ed37f9f4d399c14e28', class: {
1056
+ } }, h("div", { key: '05d260716090d503dde8e0dddc79db0a5f553f0b', class: {
993
1057
  'mg-c-illustrated-message__illustration': true,
994
1058
  'mg-c-illustrated-message__illustration--small': this.size === 'small',
995
- } }, 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" })))));
996
1060
  }
997
1061
  get element() { return getElement(this); }
998
1062
  };
@@ -1025,31 +1089,45 @@ const MgInput = class {
1025
1089
  this.classHasError = 'mg-c-input--has-error';
1026
1090
  this.classLabelOnTop = 'mg-c-input--label-on-top';
1027
1091
  /**
1028
- * Get tooltip node
1029
- * @returns mg-tooltip
1092
+ * Define if label is visible
1030
1093
  */
1031
- this.renderTooltip = () => (h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, h("mg-icon", { icon: "info-circle" })));
1032
- this.identifier = undefined;
1033
- this.label = undefined;
1034
- this.labelOnTop = undefined;
1035
1094
  this.labelHide = false;
1036
- this.tooltip = undefined;
1095
+ /**
1096
+ * Define tooltip position
1097
+ */
1037
1098
  this.tooltipPosition = 'input';
1099
+ /**
1100
+ * Define if input is required
1101
+ */
1038
1102
  this.required = false;
1039
- this.errorMessage = undefined;
1040
- this.helpText = undefined;
1041
- this.ariaDescribedbyIDs = undefined;
1103
+ /**
1104
+ * Element is fieldset
1105
+ */
1042
1106
  this.isFieldset = false;
1107
+ /**
1108
+ * Element is readonly
1109
+ */
1043
1110
  this.isReadonly = false;
1111
+ /**
1112
+ * Element is disabled
1113
+ */
1044
1114
  this.isDisabled = false;
1115
+ /**
1116
+ * Element is disabled
1117
+ */
1045
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" })));
1046
1124
  }
1047
1125
  watchIdentifier(newValue) {
1048
- if (!me(newValue)) {
1049
- 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)}.`);
1050
1128
  }
1051
- else if (!Ge(newValue)) {
1052
- 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)}.`);
1053
1131
  }
1054
1132
  else {
1055
1133
  this.helpTextId = `${this.identifier}-help-text`;
@@ -1071,7 +1149,7 @@ const MgInput = class {
1071
1149
  }
1072
1150
  watchTooltipPosition(newValue) {
1073
1151
  if (!tooltipPositions.includes(newValue)) {
1074
- 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)}.`);
1075
1153
  }
1076
1154
  }
1077
1155
  watchErrorMessage(newValue) {
@@ -1114,7 +1192,10 @@ const MgInput = class {
1114
1192
  ariaDescribedbyIDs.add(this.helpTextErrorId);
1115
1193
  }
1116
1194
  this.element.querySelectorAll('input,select,textarea,[role="switch"]').forEach(element => {
1117
- 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');
1118
1199
  });
1119
1200
  }
1120
1201
  /**
@@ -1135,8 +1216,8 @@ const MgInput = class {
1135
1216
  */
1136
1217
  // eslint-disable-next-line @stencil-community/no-unused-watch
1137
1218
  watchLabel() {
1138
- if (!me(this.label)) {
1139
- 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)}.`);
1140
1221
  }
1141
1222
  else {
1142
1223
  this.watchAriaDescribedbyIDs();
@@ -1228,7 +1309,7 @@ const MgInput = class {
1228
1309
  */
1229
1310
  render() {
1230
1311
  const isGroup = this.isFieldset && !this.isReadonly;
1231
- 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 }))))));
1232
1313
  }
1233
1314
  get element() { return getElement(this); }
1234
1315
  static get watchers() { return {
@@ -1300,6 +1381,55 @@ const MgInputCheckbox = class {
1300
1381
  this.searchStart = 10;
1301
1382
  // popover variables
1302
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';
1303
1433
  /**
1304
1434
  * Handle input event
1305
1435
  * @param event - input event
@@ -1401,7 +1531,7 @@ const MgInputCheckbox = class {
1401
1531
  * Method to update searchResults
1402
1532
  */
1403
1533
  this.updateSearchResults = () => {
1404
- 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)));
1405
1535
  };
1406
1536
  /**
1407
1537
  * Method to validate if one of inputs value is checked id required
@@ -1433,13 +1563,13 @@ const MgInputCheckbox = class {
1433
1563
  * @returns message to display
1434
1564
  */
1435
1565
  this.getSelectValuesButtonMessage = () => {
1436
- if (this.selectValuesButtonKey === 'editButton' && me(this.editButtonMessage)) {
1566
+ if (this.selectValuesButtonKey === 'editButton' && ye(this.editButtonMessage)) {
1437
1567
  return this.editButtonMessage;
1438
1568
  }
1439
- else if (this.selectValuesButtonKey === 'showButton' && me(this.showButtonMessage)) {
1569
+ else if (this.selectValuesButtonKey === 'showButton' && ye(this.showButtonMessage)) {
1440
1570
  return this.showButtonMessage;
1441
1571
  }
1442
- else if (this.selectValuesButtonKey === 'selectButton' && me(this.selectButtonMessage)) {
1572
+ else if (this.selectValuesButtonKey === 'selectButton' && ye(this.selectButtonMessage)) {
1443
1573
  return this.selectButtonMessage;
1444
1574
  }
1445
1575
  else {
@@ -1488,33 +1618,6 @@ const MgInputCheckbox = class {
1488
1618
  * @returns The rendered MgInputCheckboxList component.
1489
1619
  */
1490
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 }));
1491
- this.value = undefined;
1492
- this.type = undefined;
1493
- this.identifier = undefined;
1494
- this.name = this.identifier;
1495
- this.label = undefined;
1496
- this.labelOnTop = undefined;
1497
- this.labelHide = false;
1498
- this.inputVerticalList = false;
1499
- this.required = false;
1500
- this.readonly = false;
1501
- this.displaySelectedValues = undefined;
1502
- this.disabled = false;
1503
- this.tooltip = undefined;
1504
- this.tooltipPosition = 'input';
1505
- this.helpText = undefined;
1506
- this.valid = undefined;
1507
- this.invalid = undefined;
1508
- this.editButtonMessage = undefined;
1509
- this.showButtonMessage = undefined;
1510
- this.selectButtonMessage = undefined;
1511
- this.classCollection = new Xe([this.baseClassName, classFieldset]);
1512
- this.errorMessage = undefined;
1513
- this.checkboxItems = [];
1514
- this.displaySearchInput = undefined;
1515
- this.searchValue = '';
1516
- this.searchResults = [];
1517
- this.selectValuesButtonKey = 'editButton';
1518
1621
  }
1519
1622
  validateValue(newValue) {
1520
1623
  if (isCheckboxItems(newValue)) {
@@ -1522,12 +1625,12 @@ const MgInputCheckbox = class {
1522
1625
  this.valueChange.emit(newValue);
1523
1626
  }
1524
1627
  else {
1525
- 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)}.`);
1526
1629
  }
1527
1630
  }
1528
1631
  validateType(newValue) {
1529
1632
  if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
1530
- 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)}.`);
1531
1634
  }
1532
1635
  else if (newValue === undefined) {
1533
1636
  this.mode = 'auto';
@@ -1599,10 +1702,21 @@ const MgInputCheckbox = class {
1599
1702
  /**
1600
1703
  * Display input error if it exists.
1601
1704
  */
1602
- async displayError() {
1603
- this.checkValidity();
1604
- this.setErrorMessage();
1605
- 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
+ });
1606
1720
  }
1607
1721
  /**
1608
1722
  * Set an error and display a custom error message.
@@ -1616,7 +1730,7 @@ const MgInputCheckbox = class {
1616
1730
  if (typeof valid !== 'boolean') {
1617
1731
  throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
1618
1732
  }
1619
- else if (!me(errorMessage)) {
1733
+ else if (!ye(errorMessage)) {
1620
1734
  throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
1621
1735
  }
1622
1736
  else {
@@ -1753,7 +1867,7 @@ const MgInputCheckbox = class {
1753
1867
  else {
1754
1868
  inputContent = this.renderCheckboxMulti();
1755
1869
  }
1756
- 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));
1757
1871
  }
1758
1872
  get element() { return getElement(this); }
1759
1873
  static get watchers() { return {
@@ -1779,6 +1893,18 @@ const MgInputCheckboxPaginated = class {
1779
1893
  * Constantes *
1780
1894
  *************/
1781
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;
1782
1908
  /***********
1783
1909
  * Methods *
1784
1910
  ***********/
@@ -1814,14 +1940,6 @@ const MgInputCheckboxPaginated = class {
1814
1940
  this.handleCurrentPageChange = (event) => {
1815
1941
  this.currentPage = Number(event.detail);
1816
1942
  };
1817
- this.readonly = undefined;
1818
- this.disabled = undefined;
1819
- this.name = undefined;
1820
- this.invalid = undefined;
1821
- this.currentPage = 1;
1822
- this.checkboxes = [];
1823
- this.messages = undefined;
1824
- this.expanded = true;
1825
1943
  }
1826
1944
  watchCheckboxes(newValue, oldValue) {
1827
1945
  const pageCountNewValue = this.getPageCount(newValue);
@@ -1861,10 +1979,10 @@ const MgInputCheckboxPaginated = class {
1861
1979
  * @returns HTML Element
1862
1980
  */
1863
1981
  render() {
1864
- 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})`));
1865
1983
  const [from, to] = this.getFromToIndexes();
1866
1984
  const itemsContainerId = `items-${this.sectionKind}-container`;
1867
- 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 }))));
1868
1986
  }
1869
1987
  static get watchers() { return {
1870
1988
  "checkboxes": ["watchCheckboxes"]
@@ -1881,12 +1999,46 @@ const MgInputDate = class {
1881
1999
  this.inputValid = createEvent(this, "input-valid", 7);
1882
2000
  // hasDisplayedError (triggered by blur event)
1883
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']);
1884
2036
  /**
1885
2037
  * Method to validate date pattern string
1886
2038
  * @param value - value to test
1887
2039
  * @returns truthy when value match the pattern
1888
2040
  */
1889
- this.isValidPattern = (value) => me(value) && He.test(value);
2041
+ this.isValidPattern = (value) => ye(value) && Be.test(value);
1890
2042
  /**
1891
2043
  * Format help text to display
1892
2044
  * @param helpText - help text format
@@ -1894,10 +2046,10 @@ const MgInputDate = class {
1894
2046
  */
1895
2047
  this.formatHelpText = (helpText) => {
1896
2048
  const defaultHelpTextVariable = '{defaultHelpText}';
1897
- let text = me(helpText) ? helpText : this.messages.input.date.helpText;
2049
+ let text = ye(helpText) ? helpText : this.messages.input.date.helpText;
1898
2050
  if (text.includes(defaultHelpTextVariable))
1899
2051
  text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
1900
- 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));
1901
2053
  };
1902
2054
  /**
1903
2055
  * Handle input event
@@ -1928,7 +2080,7 @@ const MgInputDate = class {
1928
2080
  // when we reset the field we need to test a blank value.
1929
2081
  if (['Delete', 'Backspace'].includes(event.key)) {
1930
2082
  event.preventDefault();
1931
- this.value = '';
2083
+ this.value = null;
1932
2084
  this.checkValidity();
1933
2085
  if (this.hasDisplayedError) {
1934
2086
  this.setErrorMessage();
@@ -1939,7 +2091,7 @@ const MgInputDate = class {
1939
2091
  * Check if input is valid
1940
2092
  */
1941
2093
  this.checkValidity = () => {
1942
- 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))));
1943
2095
  };
1944
2096
  /**
1945
2097
  * get input error code
@@ -1948,14 +2100,14 @@ const MgInputDate = class {
1948
2100
  this.getInputError = () => {
1949
2101
  var _a;
1950
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
+ }
1951
2107
  // required
1952
- if (this.input.validity.valueMissing) {
2108
+ else if (this.input.validity.valueMissing) {
1953
2109
  inputError = 'required';
1954
2110
  }
1955
- // pattern
1956
- else if (this.value && !this.isValidPattern(this.value)) {
1957
- inputError = 'badInput';
1958
- }
1959
2111
  // min & max
1960
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') {
1961
2113
  inputError = 'minMax';
@@ -1989,8 +2141,8 @@ const MgInputDate = class {
1989
2141
  // min, max & minMax
1990
2142
  else if (['min', 'max', 'minMax'].includes(inputError)) {
1991
2143
  this.errorMessage = this.messages.errors.date[inputError]
1992
- .replace('{min}', ze(this.min, this.systemLocale))
1993
- .replace('{max}', ze(this.max, this.systemLocale));
2144
+ .replace('{min}', Pe(this.min, this.systemLocale))
2145
+ .replace('{max}', Pe(this.max, this.systemLocale));
1994
2146
  }
1995
2147
  // wrong date format
1996
2148
  // element.validity.badInput is default error message
@@ -2004,40 +2156,26 @@ const MgInputDate = class {
2004
2156
  * @returns translated html pattern
2005
2157
  */
2006
2158
  this.renderPattern = () => {
2007
- let patternLocal = ct(this.systemLocale);
2159
+ let patternLocal = at(this.systemLocale);
2008
2160
  for (const key in this.messages.input.date.pattern) {
2009
2161
  patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
2010
2162
  }
2011
2163
  return `<span aria-hidden="true">${patternLocal}</span><span class="mg-u-visually-hidden">${[...patternLocal].join(' ')}</span>`;
2012
2164
  };
2013
- this.value = undefined;
2014
- this.identifier = undefined;
2015
- this.name = this.identifier;
2016
- this.label = undefined;
2017
- this.labelOnTop = undefined;
2018
- this.labelHide = false;
2019
- this.required = false;
2020
- this.readonly = false;
2021
- this.min = undefined;
2022
- this.max = '9999-12-31';
2023
- this.disabled = false;
2024
- this.tooltip = undefined;
2025
- this.tooltipPosition = 'input';
2026
- this.helpText = undefined;
2027
- this.valid = undefined;
2028
- this.invalid = undefined;
2029
- this.classCollection = new Xe(['mg-c-input--date']);
2030
- this.errorMessage = undefined;
2031
2165
  }
2032
2166
  validateValue(newValue) {
2033
2167
  // When the input is not fully completed or has been cleared, the value becomes an empty string.
2034
- if (newValue === '')
2035
- newValue = null;
2036
- // check value validity
2037
- if (newValue && !me(newValue)) {
2038
- 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;
2039
2173
  }
2040
- 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)) {
2041
2179
  this.valueChange.emit(newValue);
2042
2180
  }
2043
2181
  else {
@@ -2052,7 +2190,7 @@ const MgInputDate = class {
2052
2190
  }
2053
2191
  validateMinMax(newValue) {
2054
2192
  if (newValue && !this.isValidPattern(newValue)) {
2055
- 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)}.`);
2056
2194
  }
2057
2195
  }
2058
2196
  handleValidityChange(newValue, _oldValue, prop) {
@@ -2074,10 +2212,21 @@ const MgInputDate = class {
2074
2212
  /**
2075
2213
  * Display input error if it exists.
2076
2214
  */
2077
- async displayError() {
2078
- this.checkValidity();
2079
- this.setErrorMessage();
2080
- 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
+ });
2081
2230
  }
2082
2231
  /**
2083
2232
  * Set an error and display a custom error message.
@@ -2091,7 +2240,7 @@ const MgInputDate = class {
2091
2240
  if (typeof valid !== 'boolean') {
2092
2241
  throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean.');
2093
2242
  }
2094
- else if (!me(errorMessage)) {
2243
+ else if (!ye(errorMessage)) {
2095
2244
  throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string.');
2096
2245
  }
2097
2246
  else {
@@ -2105,7 +2254,7 @@ const MgInputDate = class {
2105
2254
  */
2106
2255
  async reset() {
2107
2256
  if (!this.readonly) {
2108
- this.value = '';
2257
+ this.value = null;
2109
2258
  this.checkValidity();
2110
2259
  this.invalid = false;
2111
2260
  this.errorMessage = undefined;
@@ -2157,7 +2306,7 @@ const MgInputDate = class {
2157
2306
  * @returns HTML Element
2158
2307
  */
2159
2308
  render() {
2160
- 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) => {
2161
2310
  if (el !== null)
2162
2311
  this.input = el;
2163
2312
  } }))));
@@ -2190,6 +2339,62 @@ const MgInputNumeric = class {
2190
2339
  this.inputValid = createEvent(this, "input-valid", 7);
2191
2340
  // hasDisplayedError (triggered by blur event)
2192
2341
  this.hasDisplayedError = false;
2342
+ /**
2343
+ * Input name
2344
+ * If not set the value equals the identifier
2345
+ */
2346
+ this.name = this.identifier;
2347
+ /**
2348
+ * Define if label is visible
2349
+ */
2350
+ this.labelHide = false;
2351
+ /**
2352
+ * Define if input is required
2353
+ */
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']);
2193
2398
  /**
2194
2399
  * Handle input event
2195
2400
  */
@@ -2227,6 +2432,12 @@ const MgInputNumeric = class {
2227
2432
  this.checkValidity = () => {
2228
2433
  this.setValidity(this.readonly || this.disabled || this.getInputError() === null);
2229
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);
2230
2441
  /**
2231
2442
  * Set input error message
2232
2443
  * @param errorMessage - errorMessage override
@@ -2243,8 +2454,8 @@ const MgInputNumeric = class {
2243
2454
  this.errorMessage = this.messages.errors[inputError];
2244
2455
  }
2245
2456
  else {
2246
- const formattedMin = this.formatValue(this.min);
2247
- const formattedMax = this.formatValue(this.max);
2457
+ const formattedMin = this.formatErrorValue(this.min);
2458
+ const formattedMax = this.formatErrorValue(this.max);
2248
2459
  this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
2249
2460
  }
2250
2461
  }
@@ -2283,13 +2494,13 @@ const MgInputNumeric = class {
2283
2494
  this.formatValue = (value) => {
2284
2495
  switch (this.format) {
2285
2496
  case 'number':
2286
- return $t(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
2497
+ return ut(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
2287
2498
  case 'currency':
2288
- return ut(value, this.locale, this.currency);
2499
+ return ft(value, this.locale, this.currency);
2289
2500
  case 'percent':
2290
2501
  return dt(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
2291
2502
  case 'unit':
2292
- 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);
2293
2504
  case 'none':
2294
2505
  return value.toString();
2295
2506
  }
@@ -2316,34 +2527,6 @@ const MgInputNumeric = class {
2316
2527
  this.renderReadonly = () => {
2317
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));
2318
2529
  };
2319
- this.value = undefined;
2320
- this.identifier = undefined;
2321
- this.name = this.identifier;
2322
- this.label = undefined;
2323
- this.labelOnTop = undefined;
2324
- this.labelHide = false;
2325
- this.placeholder = undefined;
2326
- this.required = false;
2327
- this.readonly = false;
2328
- this.max = undefined;
2329
- this.min = undefined;
2330
- this.disabled = false;
2331
- this.mgWidth = undefined;
2332
- this.tooltip = undefined;
2333
- this.tooltipPosition = 'input';
2334
- this.helpText = undefined;
2335
- this.type = 'decimal';
2336
- this.format = 'number';
2337
- this.currency = 'EUR';
2338
- this.unit = undefined;
2339
- this.unitDisplay = 'short';
2340
- this.integerLength = 13;
2341
- this.decimalLength = 2;
2342
- this.valid = undefined;
2343
- this.invalid = undefined;
2344
- this.classCollection = new Xe(['mg-c-input--numeric']);
2345
- this.errorMessage = undefined;
2346
- this.hasFocus = undefined;
2347
2530
  }
2348
2531
  validateValue(newValue) {
2349
2532
  // has input value is always render as string we get a stringified value or a '' for nullish value, so we test string type
@@ -2396,31 +2579,42 @@ const MgInputNumeric = class {
2396
2579
  }
2397
2580
  validateType(newValue) {
2398
2581
  if (!types.includes(newValue)) {
2399
- 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)}.`);
2400
2583
  }
2401
2584
  }
2402
2585
  watchFormat(newValue) {
2403
2586
  if (!formats.includes(newValue)) {
2404
- 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)}.`);
2405
2588
  }
2406
2589
  }
2407
2590
  validateIntegerLength(newValue) {
2408
2591
  if (newValue < 1) {
2409
- 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)}.`);
2410
2593
  }
2411
2594
  }
2412
2595
  validateDecimalLength(newValue) {
2413
2596
  if (newValue < 1) {
2414
- 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)}.`);
2415
2598
  }
2416
2599
  }
2417
2600
  /**
2418
2601
  * Display input error if it exists.
2419
2602
  */
2420
- async displayError() {
2421
- this.checkValidity();
2422
- this.setErrorMessage();
2423
- 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
+ });
2424
2618
  }
2425
2619
  /**
2426
2620
  * Set an error and display a custom error message.
@@ -2434,7 +2628,7 @@ const MgInputNumeric = class {
2434
2628
  if (typeof valid !== 'boolean') {
2435
2629
  throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
2436
2630
  }
2437
- else if (!me(errorMessage)) {
2631
+ else if (!ye(errorMessage)) {
2438
2632
  throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
2439
2633
  }
2440
2634
  else {
@@ -2540,7 +2734,7 @@ const MgInputNumeric = class {
2540
2734
  * @returns HTML Element
2541
2735
  */
2542
2736
  render() {
2543
- 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
2544
2738
  ? this.readonlyValue && this.renderReadonly()
2545
2739
  : [
2546
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) => {
@@ -2577,6 +2771,43 @@ const MgInputPassword = class {
2577
2771
  this.inputValid = createEvent(this, "input-valid", 7);
2578
2772
  // hasDisplayedError (triggered by blur event)
2579
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;
2580
2811
  /**
2581
2812
  * Handle input event
2582
2813
  */
@@ -2626,26 +2857,6 @@ const MgInputPassword = class {
2626
2857
  }
2627
2858
  }
2628
2859
  };
2629
- this.value = undefined;
2630
- this.identifier = undefined;
2631
- this.name = this.identifier;
2632
- this.label = undefined;
2633
- this.labelOnTop = undefined;
2634
- this.labelHide = false;
2635
- this.placeholder = undefined;
2636
- this.maxlength = undefined;
2637
- this.required = false;
2638
- this.readonly = false;
2639
- this.disabled = false;
2640
- this.mgWidth = 'full';
2641
- this.tooltip = undefined;
2642
- this.tooltipPosition = 'input';
2643
- this.helpText = undefined;
2644
- this.valid = undefined;
2645
- this.invalid = undefined;
2646
- this.classCollection = new Xe(['mg-c-input--password']);
2647
- this.errorMessage = undefined;
2648
- this.displayPassword = false;
2649
2860
  }
2650
2861
  handleValue(newValue) {
2651
2862
  this.valueChange.emit(newValue);
@@ -2684,10 +2895,21 @@ const MgInputPassword = class {
2684
2895
  /**
2685
2896
  * Display input error if it exists.
2686
2897
  */
2687
- async displayError() {
2688
- this.checkValidity();
2689
- this.setErrorMessage();
2690
- 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
+ });
2691
2913
  }
2692
2914
  /**
2693
2915
  * Set an error and display a custom error message.
@@ -2701,7 +2923,7 @@ const MgInputPassword = class {
2701
2923
  if (typeof valid !== 'boolean') {
2702
2924
  throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
2703
2925
  }
2704
- else if (!me(errorMessage)) {
2926
+ else if (!ye(errorMessage)) {
2705
2927
  throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
2706
2928
  }
2707
2929
  else {
@@ -2758,7 +2980,7 @@ const MgInputPassword = class {
2758
2980
  * @returns HTML Element
2759
2981
  */
2760
2982
  render() {
2761
- 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) => {
2762
2984
  if (el !== null)
2763
2985
  this.input = el;
2764
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' }))))));
@@ -2797,6 +3019,43 @@ const MgInputRadio = class {
2797
3019
  this.classVerticalList = 'mg-c-input--vertical-list';
2798
3020
  // hasDisplayedError (triggered by blur event)
2799
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]);
2800
3059
  /**
2801
3060
  * Handle input event
2802
3061
  * @param event - input event
@@ -2843,31 +3102,11 @@ const MgInputRadio = class {
2843
3102
  * @returns element
2844
3103
  */
2845
3104
  this.getInvalidElement = () => this.inputs.find((input) => !input.disabled && !input.readOnly && !input.checkValidity());
2846
- this.value = undefined;
2847
- this.items = undefined;
2848
- this.identifier = undefined;
2849
- this.name = this.identifier;
2850
- this.label = undefined;
2851
- this.labelOnTop = false;
2852
- this.labelHide = false;
2853
- this.inputVerticalList = false;
2854
- this.required = false;
2855
- this.readonly = false;
2856
- this.disabled = false;
2857
- this.tooltip = undefined;
2858
- this.tooltipPosition = 'input';
2859
- this.helpText = undefined;
2860
- this.valid = undefined;
2861
- this.invalid = undefined;
2862
- this.classCollection = new Xe(['mg-c-input--radio', classFieldset]);
2863
- this.errorMessage = undefined;
2864
- this.options = undefined;
2865
- this.readonlyValue = undefined;
2866
3105
  }
2867
3106
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2868
3107
  watchValue(newValue) {
2869
3108
  var _a;
2870
- if (Je(this.items) && typeof newValue === 'string') {
3109
+ if (Xe(this.items) && typeof newValue === 'string') {
2871
3110
  this.readonlyValue = newValue;
2872
3111
  }
2873
3112
  else if (Array.isArray(this.items) && this.items.every(isOption$3)) {
@@ -2881,10 +3120,10 @@ const MgInputRadio = class {
2881
3120
  validateItems(newValue) {
2882
3121
  // Validate if items have required min length
2883
3122
  if (typeof newValue === 'object' && newValue.length < 2) {
2884
- 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)}.`);
2885
3124
  }
2886
3125
  // String array
2887
- else if (Je(newValue)) {
3126
+ else if (Xe(newValue)) {
2888
3127
  this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
2889
3128
  }
2890
3129
  // Object array
@@ -2892,7 +3131,7 @@ const MgInputRadio = class {
2892
3131
  this.options = newValue;
2893
3132
  }
2894
3133
  else {
2895
- 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)}.`);
2896
3135
  }
2897
3136
  }
2898
3137
  watchInputVerticalList(newValue) {
@@ -2926,10 +3165,21 @@ const MgInputRadio = class {
2926
3165
  /**
2927
3166
  * Display input error if it exists.
2928
3167
  */
2929
- async displayError() {
2930
- this.checkValidity();
2931
- this.setErrorMessage();
2932
- 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
+ });
2933
3183
  }
2934
3184
  /**
2935
3185
  * Set an error and display a custom error message.
@@ -2943,7 +3193,7 @@ const MgInputRadio = class {
2943
3193
  if (typeof valid !== 'boolean') {
2944
3194
  throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');
2945
3195
  }
2946
- else if (!me(errorMessage)) {
3196
+ else if (!ye(errorMessage)) {
2947
3197
  throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');
2948
3198
  }
2949
3199
  else {
@@ -3003,7 +3253,7 @@ const MgInputRadio = class {
3003
3253
  * @returns HTML Element
3004
3254
  */
3005
3255
  render() {
3006
- 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) => {
3007
3257
  if (el !== null)
3008
3258
  this.inputs[index] = el;
3009
3259
  } }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
@@ -3072,6 +3322,43 @@ const MgInputSelect = class {
3072
3322
  this.inputValid = createEvent(this, "input-valid", 7);
3073
3323
  // hasDisplayedError (triggered by blur event)
3074
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']);
3075
3362
  /**
3076
3363
  * Handle input event
3077
3364
  */
@@ -3101,7 +3388,7 @@ const MgInputSelect = class {
3101
3388
  if (this.input.value === '') {
3102
3389
  this.setValue(null);
3103
3390
  }
3104
- else if (Je(this.items) && this.items.includes(this.input.value)) {
3391
+ else if (Xe(this.items) && this.items.includes(this.input.value)) {
3105
3392
  this.setValue(this.input.value);
3106
3393
  }
3107
3394
  else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
@@ -3156,34 +3443,10 @@ const MgInputSelect = class {
3156
3443
  * @returns render option
3157
3444
  */
3158
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));
3159
- this.value = undefined;
3160
- this.items = undefined;
3161
- this.identifier = undefined;
3162
- this.name = this.identifier;
3163
- this.label = undefined;
3164
- this.labelOnTop = undefined;
3165
- this.labelHide = false;
3166
- this.placeholder = undefined;
3167
- this.placeholderHide = false;
3168
- this.placeholderDisabled = false;
3169
- this.required = false;
3170
- this.readonly = false;
3171
- this.disabled = false;
3172
- this.mgWidth = undefined;
3173
- this.tooltip = undefined;
3174
- this.tooltipPosition = 'input';
3175
- this.helpText = undefined;
3176
- this.valid = undefined;
3177
- this.invalid = undefined;
3178
- this.classCollection = new Xe(['mg-c-input--select']);
3179
- this.errorMessage = undefined;
3180
- this.options = undefined;
3181
- this.valueExist = undefined;
3182
- this.readonlyValue = undefined;
3183
3446
  }
3184
3447
  validateValue(newValue) {
3185
3448
  var _a, _b;
3186
- if (Je(this.items) && typeof newValue === 'string') {
3449
+ if (Xe(this.items) && typeof newValue === 'string') {
3187
3450
  this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) !== undefined ? this.input.value : newValue;
3188
3451
  }
3189
3452
  else if (allItemsAreOptions(this.items)) {
@@ -3200,7 +3463,7 @@ const MgInputSelect = class {
3200
3463
  this.options = [];
3201
3464
  }
3202
3465
  // String array
3203
- else if (Je(newValue)) {
3466
+ else if (Xe(newValue)) {
3204
3467
  if (typeof this.value === 'string')
3205
3468
  this.valueExist = newValue.includes(this.value);
3206
3469
  this.options = newValue.map(item => ({ title: item, value: item }));
@@ -3218,7 +3481,7 @@ const MgInputSelect = class {
3218
3481
  }
3219
3482
  }
3220
3483
  else {
3221
- 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)}.`);
3222
3485
  }
3223
3486
  }
3224
3487
  watchReadonly(newValue) {
@@ -3255,10 +3518,21 @@ const MgInputSelect = class {
3255
3518
  /**
3256
3519
  * Display input error if it exists.
3257
3520
  */
3258
- async displayError() {
3259
- this.checkValidity();
3260
- this.setErrorMessage();
3261
- 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
+ });
3262
3536
  }
3263
3537
  /**
3264
3538
  * Set an error and display a custom error message.
@@ -3272,7 +3546,7 @@ const MgInputSelect = class {
3272
3546
  if (typeof valid !== 'boolean') {
3273
3547
  throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean.');
3274
3548
  }
3275
- else if (!me(errorMessage)) {
3549
+ else if (!ye(errorMessage)) {
3276
3550
  throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string.');
3277
3551
  }
3278
3552
  else {
@@ -3336,7 +3610,7 @@ const MgInputSelect = class {
3336
3610
  * @returns HTML Element
3337
3611
  */
3338
3612
  render() {
3339
- 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) => {
3340
3614
  if (el !== null)
3341
3615
  this.input = el;
3342
3616
  } }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
@@ -3368,7 +3642,7 @@ const isOption$1 = (option) => typeof option === 'object' && typeof option.title
3368
3642
  * @param options - Datalist options to check.
3369
3643
  * @returns True if datalist is well structured.
3370
3644
  */
3371
- 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));
3372
3646
  const MgInputText = class {
3373
3647
  constructor(hostRef) {
3374
3648
  registerInstance(this, hostRef);
@@ -3385,6 +3659,51 @@ const MgInputText = class {
3385
3659
  this.classIsAppendInputSlotContent = 'mg-c-input--is-append-input-slot-content';
3386
3660
  // hasDisplayedError (triggered by blur event)
3387
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']);
3388
3707
  /**
3389
3708
  * Handle input event
3390
3709
  */
@@ -3400,7 +3719,7 @@ const MgInputText = class {
3400
3719
  */
3401
3720
  this.handleFocus = () => {
3402
3721
  this.classCollection.add(this.classFocus);
3403
- this.classCollection = new Xe(this.classCollection.classes);
3722
+ this.classCollection = new Ge(this.classCollection.classes);
3404
3723
  };
3405
3724
  /**
3406
3725
  * Handle blur event
@@ -3408,7 +3727,7 @@ const MgInputText = class {
3408
3727
  this.handleBlur = () => {
3409
3728
  // Manage focus
3410
3729
  this.classCollection.delete(this.classFocus);
3411
- this.classCollection = new Xe(this.classCollection.classes);
3730
+ this.classCollection = new Ge(this.classCollection.classes);
3412
3731
  // Display Error
3413
3732
  this.handlerInProgress = 'blur';
3414
3733
  this.displayError().finally(() => {
@@ -3473,31 +3792,6 @@ const MgInputText = class {
3473
3792
  this.renderReadonly = () => {
3474
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));
3475
3794
  };
3476
- this.value = undefined;
3477
- this.identifier = undefined;
3478
- this.name = this.identifier;
3479
- this.label = undefined;
3480
- this.type = 'text';
3481
- this.icon = undefined;
3482
- this.labelOnTop = undefined;
3483
- this.labelHide = false;
3484
- this.placeholder = undefined;
3485
- this.datalistoptions = undefined;
3486
- this.maxlength = 400;
3487
- this.required = false;
3488
- this.readonly = false;
3489
- this.disabled = false;
3490
- this.mgWidth = 'full';
3491
- this.pattern = undefined;
3492
- this.patternErrorMessage = undefined;
3493
- this.tooltip = undefined;
3494
- this.tooltipPosition = 'input';
3495
- this.characterLeftHide = false;
3496
- this.helpText = undefined;
3497
- this.valid = undefined;
3498
- this.invalid = undefined;
3499
- this.classCollection = new Xe(['mg-c-input--text']);
3500
- this.errorMessage = undefined;
3501
3795
  }
3502
3796
  handleValue(newValue) {
3503
3797
  var _a, _b;
@@ -3518,7 +3812,7 @@ const MgInputText = class {
3518
3812
  }
3519
3813
  validateDatalistoptions(newValue) {
3520
3814
  if (Boolean(newValue) && !isDatalistOptions(newValue)) {
3521
- 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)}.`);
3522
3816
  }
3523
3817
  }
3524
3818
  watchReadonly(newValue) {
@@ -3553,8 +3847,8 @@ const MgInputText = class {
3553
3847
  this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
3554
3848
  }
3555
3849
  validatePattern(newValue) {
3556
- if (newValue !== undefined && !(me(this.pattern) && me(this.patternErrorMessage))) {
3557
- 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)}'".`);
3558
3852
  }
3559
3853
  }
3560
3854
  /**
@@ -3566,10 +3860,21 @@ const MgInputText = class {
3566
3860
  /**
3567
3861
  * Display input error if it exists.
3568
3862
  */
3569
- async displayError() {
3570
- this.checkValidity();
3571
- this.setErrorMessage();
3572
- 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
+ });
3573
3878
  }
3574
3879
  /**
3575
3880
  * Set an error and display a custom error message.
@@ -3583,7 +3888,7 @@ const MgInputText = class {
3583
3888
  if (typeof valid !== 'boolean') {
3584
3889
  throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean.');
3585
3890
  }
3586
- else if (!me(errorMessage)) {
3891
+ else if (!ye(errorMessage)) {
3587
3892
  throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string.');
3588
3893
  }
3589
3894
  else {
@@ -3648,7 +3953,7 @@ const MgInputText = class {
3648
3953
  * @returns HTML Element
3649
3954
  */
3650
3955
  render() {
3651
- 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
3652
3957
  ? this.value && this.renderReadonly()
3653
3958
  : [
3654
3959
  h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
@@ -3693,6 +3998,55 @@ const MgInputTextarea = class {
3693
3998
  this.classDisplayCharacterLeft = 'mg-c-input--display-character-left';
3694
3999
  // hasDisplayedError (triggered by blur event)
3695
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']);
3696
4050
  /**
3697
4051
  * Handle input event
3698
4052
  */
@@ -3708,7 +4062,7 @@ const MgInputTextarea = class {
3708
4062
  */
3709
4063
  this.handleFocus = () => {
3710
4064
  this.classCollection.add(this.classFocus);
3711
- this.classCollection = new Xe(this.classCollection.classes);
4065
+ this.classCollection = new Ge(this.classCollection.classes);
3712
4066
  };
3713
4067
  /**
3714
4068
  * Handle blur event
@@ -3716,7 +4070,7 @@ const MgInputTextarea = class {
3716
4070
  this.handleBlur = () => {
3717
4071
  // Manage focus
3718
4072
  this.classCollection.delete(this.classFocus);
3719
- this.classCollection = new Xe(this.classCollection.classes);
4073
+ this.classCollection = new Ge(this.classCollection.classes);
3720
4074
  // Display Error
3721
4075
  this.handlerInProgress = 'blur';
3722
4076
  this.displayError().finally(() => {
@@ -3757,30 +4111,6 @@ const MgInputTextarea = class {
3757
4111
  }
3758
4112
  }
3759
4113
  };
3760
- this.value = undefined;
3761
- this.identifier = undefined;
3762
- this.name = this.identifier;
3763
- this.label = undefined;
3764
- this.labelOnTop = undefined;
3765
- this.labelHide = false;
3766
- this.placeholder = undefined;
3767
- this.maxlength = 4000;
3768
- this.required = false;
3769
- this.readonly = false;
3770
- this.disabled = false;
3771
- this.mgWidth = 'full';
3772
- this.pattern = undefined;
3773
- this.patternErrorMessage = undefined;
3774
- this.rows = 3;
3775
- this.tooltip = undefined;
3776
- this.tooltipPosition = 'input';
3777
- this.characterLeftHide = false;
3778
- this.helpText = undefined;
3779
- this.valid = undefined;
3780
- this.invalid = undefined;
3781
- this.resizable = 'none';
3782
- this.classCollection = new Xe(['mg-c-input--textarea']);
3783
- this.errorMessage = undefined;
3784
4114
  }
3785
4115
  handleValue(newValue) {
3786
4116
  this.checkValidity();
@@ -3818,8 +4148,8 @@ const MgInputTextarea = class {
3818
4148
  this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
3819
4149
  }
3820
4150
  validatePattern(newValue) {
3821
- if (newValue !== undefined && !(me(this.pattern) && me(this.patternErrorMessage))) {
3822
- 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)}'".`);
3823
4153
  }
3824
4154
  }
3825
4155
  validatecharacterLeftHide(newValue) {
@@ -3833,10 +4163,21 @@ const MgInputTextarea = class {
3833
4163
  /**
3834
4164
  * Display input error if it exists.
3835
4165
  */
3836
- async displayError() {
3837
- this.checkValidity();
3838
- this.setErrorMessage();
3839
- 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
+ });
3840
4181
  }
3841
4182
  /**
3842
4183
  * Set an error and display a custom error message.
@@ -3850,7 +4191,7 @@ const MgInputTextarea = class {
3850
4191
  if (typeof valid !== 'boolean') {
3851
4192
  throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean.');
3852
4193
  }
3853
- else if (!me(errorMessage)) {
4194
+ else if (!ye(errorMessage)) {
3854
4195
  throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string.');
3855
4196
  }
3856
4197
  else {
@@ -3912,7 +4253,7 @@ const MgInputTextarea = class {
3912
4253
  * @returns HTML Element
3913
4254
  */
3914
4255
  render() {
3915
- 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: {
3916
4257
  'mg-c-input__box': true,
3917
4258
  'mg-c-input__box--width': true,
3918
4259
  'mg-c-input__box--resizable': this.resizable === 'both',
@@ -3943,18 +4284,21 @@ const MgInputTitleStyle0 = mgInputTitleCss;
3943
4284
  const MgInputTitle = class {
3944
4285
  constructor(hostRef) {
3945
4286
  registerInstance(this, hostRef);
3946
- this.identifier = undefined;
3947
- this.required = undefined;
3948
- this.readonly = undefined;
4287
+ /**
4288
+ * Switch from label to fieldset sementic
4289
+ */
3949
4290
  this.isLegend = false;
4291
+ /**
4292
+ * Component parent tagname
4293
+ */
3950
4294
  this.tagName = 'label';
3951
4295
  }
3952
4296
  validateIdentifier(newValue) {
3953
- if (!me(newValue)) {
4297
+ if (!ye(newValue)) {
3954
4298
  throw new Error('<mg-input-title> prop "identifier" is required.');
3955
4299
  }
3956
- else if (!Ge(newValue)) {
3957
- 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)}.`);
3958
4302
  }
3959
4303
  }
3960
4304
  validateIsLegend(newValue) {
@@ -3977,7 +4321,7 @@ const MgInputTitle = class {
3977
4321
  render() {
3978
4322
  const TagName = this.readonly ? 'span' : this.tagName;
3979
4323
  // \u00A0 represent a &nbsp;
3980
- 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" }, "*")))));
3981
4325
  }
3982
4326
  static get watchers() { return {
3983
4327
  "identifier": ["validateIdentifier"],
@@ -4007,6 +4351,43 @@ const MgInputToggle = class {
4007
4351
  this.classIsActive = 'mg-c-input--toggle-is-active';
4008
4352
  this.classOnOff = 'mg-c-input--toggle-on-off';
4009
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;
4010
4391
  /**
4011
4392
  * Set input error message
4012
4393
  * @param errorMessage - errorMessage override
@@ -4053,25 +4434,6 @@ const MgInputToggle = class {
4053
4434
  return null;
4054
4435
  }
4055
4436
  };
4056
- this.value = undefined;
4057
- this.items = undefined;
4058
- this.identifier = undefined;
4059
- this.name = this.identifier;
4060
- this.label = undefined;
4061
- this.labelOnTop = undefined;
4062
- this.labelHide = false;
4063
- this.isOnOff = false;
4064
- this.isIcon = false;
4065
- this.readonly = false;
4066
- this.disabled = false;
4067
- this.tooltip = undefined;
4068
- this.tooltipPosition = 'input';
4069
- this.helpText = undefined;
4070
- this.classCollection = new Xe(['mg-c-input--toggle']);
4071
- this.options = undefined;
4072
- this.errorMessage = undefined;
4073
- this.valid = undefined;
4074
- this.checked = false;
4075
4437
  }
4076
4438
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4077
4439
  handleValue(newValue) {
@@ -4082,10 +4444,10 @@ const MgInputToggle = class {
4082
4444
  }
4083
4445
  validateItems(newValue) {
4084
4446
  if (typeof newValue === 'object' && this.items.length !== 2) {
4085
- 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)}.`);
4086
4448
  }
4087
4449
  // String array
4088
- else if (Je(newValue)) {
4450
+ else if (Xe(newValue)) {
4089
4451
  this.options = newValue.map(item => ({ title: item, value: item }));
4090
4452
  }
4091
4453
  // Object array
@@ -4093,7 +4455,7 @@ const MgInputToggle = class {
4093
4455
  this.options = newValue;
4094
4456
  }
4095
4457
  else {
4096
- 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)}.`);
4097
4459
  }
4098
4460
  }
4099
4461
  watchIsOnOff(newValue) {
@@ -4141,7 +4503,7 @@ const MgInputToggle = class {
4141
4503
  if (typeof valid !== 'boolean') {
4142
4504
  throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
4143
4505
  }
4144
- else if (!me(errorMessage)) {
4506
+ else if (!ye(errorMessage)) {
4145
4507
  throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
4146
4508
  }
4147
4509
  else {
@@ -4208,7 +4570,7 @@ const MgInputToggle = class {
4208
4570
  */
4209
4571
  render() {
4210
4572
  const checkedItem = this.getCheckedItem(this.checked);
4211
- 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" }))))));
4212
4574
  }
4213
4575
  get element() { return getElement(this); }
4214
4576
  static get watchers() { return {
@@ -4224,19 +4586,13 @@ const MgInputToggle = class {
4224
4586
  MgInputToggle.style = MgInputToggleStyle0;
4225
4587
 
4226
4588
  /**
4227
- * MgItemMore type guard
4228
- * @param element - element to control type
4229
- * @returns truthy if element is mg-item-more
4589
+ *
4230
4590
  */
4231
- const isMgItemMore = (element) => element.nodeName === 'MG-ITEM-MORE';
4232
- const OverflowBehaviorElements = {
4233
- BASE_INDEX: 'data-overflow-base-index',
4234
- PROXY_INDEX: 'data-overflow-proxy-index',
4235
- };
4236
4591
  class OverflowBehavior {
4237
- constructor(element, render) {
4238
- this.element = element;
4239
- this.render = render;
4592
+ constructor(parentElement, itemMoreElement, itemMoreContainerElement) {
4593
+ this.parentElement = parentElement;
4594
+ this.itemMoreElement = itemMoreElement;
4595
+ this.itemMoreContainerElement = itemMoreContainerElement;
4240
4596
  /**********
4241
4597
  * Public *
4242
4598
  **********/
@@ -4250,116 +4606,59 @@ class OverflowBehavior {
4250
4606
  * Internal *
4251
4607
  ************/
4252
4608
  /**
4253
- * run overflow behavior
4254
- * @param width - width of the container. Optional.
4255
- */
4256
- this.run = (width) => {
4257
- if (this._moreElement === undefined) {
4258
- // set moreElement
4259
- this._moreElement = this.render();
4260
- // set children
4261
- this._baseChildren = this.getInteractiveItems(this.element);
4262
- if (isMgItemMore(this._moreElement)) {
4263
- this._proxyChildren = this.getInteractiveItems(this._moreElement.shadowRoot.querySelector('mg-menu'));
4264
- }
4265
- // update children
4266
- this._baseChildren.forEach((child, index) => {
4267
- child.setAttribute(OverflowBehaviorElements.BASE_INDEX, `${index}`);
4268
- // set moreElement children
4269
- this._proxyChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
4270
- });
4271
- }
4272
- if (width !== undefined)
4273
- this.updateDisplayedItems(width);
4274
- };
4275
- /**
4276
- * Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
4277
- * @param element - element to parse
4278
- * @returns children
4279
- */
4280
- 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)); };
4281
- /**
4282
- * Update displayed items in container from a given available space
4283
- * @param availableWidth - available width in container to display child items
4284
- */
4285
- this.updateDisplayedItems = (availableWidth) => {
4286
- this.restoreItems();
4287
- const acc = { accWidth: 0, previousItem: null };
4288
- [...this._baseChildren, this._moreElement].forEach((child) => {
4289
- acc.accWidth += child.offsetWidth;
4290
- const hasPreviuosItem = acc.previousItem !== null;
4291
- const isPreviousItemHidden = hasPreviuosItem && acc.previousItem.hasAttribute('hidden');
4292
- // if previous item is hidden AND is NOT more element we hide current
4293
- // OR if item has an overflow we hide current
4294
- // OR if current item is more element AND have NOT previous hidden items, current more element item is an hidden item
4295
- // ELSE current is a display item
4296
- this.toggleItem(child, (isPreviousItemHidden && !this.isMoreElement(child)) || this.isOverflowElement(acc.accWidth, child, availableWidth) || (this.isMoreElement(child) && !isPreviousItemHidden));
4297
- // update previous item with current item
4298
- acc.previousItem = child;
4299
- });
4300
- };
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;
4301
4614
  /**
4302
4615
  * Utility method to know if item overflow partialy or totaly in the container
4303
4616
  * @param cumulateWidth - previous sibling elements cumulate width + item width
4304
4617
  * @param item - item HTML element
4305
- * @param availableWidth - container available width
4306
4618
  * @returns truthy if element is overflow
4307
4619
  */
4308
- this.isOverflowElement = (cumulateWidth, item, availableWidth) => {
4309
- if (item.previousElementSibling === null || this.isMoreElement(item))
4310
- return false;
4311
- else if (!this.isMoreElement(item.nextElementSibling))
4312
- return cumulateWidth + this._moreElement.offsetWidth > availableWidth;
4313
- else
4314
- return cumulateWidth > availableWidth;
4315
- };
4316
- /**
4317
- * Utility method to know if a given element is the 'MORE' element
4318
- * @param element - element to match with 'MORE' element
4319
- * @returns truthy if element is the 'MORE' element
4320
- */
4321
- this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
4322
- /**
4323
- * Toggle display item element
4324
- * @param item - item to control
4325
- * @param isHidden - is item hidden
4326
- */
4327
- this.toggleItem = (item, isHidden) => {
4328
- const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
4329
- if (this.isMoreElement(item))
4330
- this.toggleElement(this._moreElement, isHidden);
4331
- else if (mgActionMenuindex >= 0) {
4332
- this.toggleElement(item, isHidden);
4333
- 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;
4334
4627
  }
4335
- };
4336
- /**
4337
- * Toggle element's hide attribute
4338
- * @param element - element to toggle
4339
- * @param isHidden - element is hidden
4340
- */
4341
- this.toggleElement = (element, isHidden) => {
4342
- if (isHidden)
4343
- element.setAttribute('hidden', '');
4344
4628
  else
4345
- element.removeAttribute('hidden');
4629
+ return !displayMgItemMore;
4346
4630
  };
4347
4631
  /**
4348
- * Remove hidden attributes on all items
4632
+ * Toogle item from isHidden condition
4633
+ * @param item - item to update
4634
+ * @param isHidden - item is hidden
4349
4635
  */
4350
- this.restoreItems = () => {
4351
- [...this._baseChildren, this._moreElement].forEach(item => item.removeAttribute('hidden'));
4352
- };
4353
- if (this._resizeObserver === undefined) {
4354
- // add resize observer
4355
- this._resizeObserver = new ResizeObserver(entries => {
4356
- entries.forEach(entry => {
4357
- this.run(entry.contentRect.width);
4358
- });
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));
4359
4659
  });
4360
- this._resizeObserver.observe(this.element);
4361
- }
4362
- this.run();
4660
+ });
4661
+ this._resizeObserver.observe(this.parentElement);
4363
4662
  }
4364
4663
  }
4365
4664
 
@@ -4374,86 +4673,27 @@ const MgItemMore = class {
4374
4673
  ************/
4375
4674
  this.name = 'mg-item-more';
4376
4675
  /**
4377
- * Set proxy element properties and listeners
4378
- * @param proxified - element to proxify from
4676
+ * Define icon
4379
4677
  */
4380
- this.setProxyElement = (proxified) => {
4381
- const proxy = this.moreElementMenuItem.querySelector(`[identifier="${proxified.identifier}"]`);
4382
- if (proxy === null) {
4383
- return;
4384
- }
4385
- // remove proxy id to prevent duplicate key. default html id is: '';
4386
- if (me(proxy.id))
4387
- proxy.id = '';
4388
- const proxyClickHandler = () => {
4389
- this.parentMenu
4390
- .querySelector(`[identifier="${proxy.identifier}"]`)
4391
- .shadowRoot.querySelector('a, button')
4392
- .dispatchEvent(new MouseEvent('click', { bubbles: true }));
4393
- };
4394
- // Watch the `item-updated` event to keep element needeed properties and innerHTML in sync between the proxified and the proxy elements
4395
- const updateProxy = (element) => {
4396
- for (const key in element) {
4397
- if (['identifier', 'href', 'targer', 'status', 'expanded'].includes(key))
4398
- element[key] ? proxy.setAttribute(key, element[key]) : proxy.removeAttribute(key);
4399
- }
4400
- proxy.innerHTML = element.innerHTML;
4401
- // When `href` is updated we need to wait the full component re-render before update its handler
4402
- setTimeout(() => {
4403
- const interactiveElement = proxy.shadowRoot.querySelector('a, button');
4404
- interactiveElement === null || interactiveElement === void 0 ? void 0 : interactiveElement.removeEventListener('click', proxyClickHandler);
4405
- interactiveElement === null || interactiveElement === void 0 ? void 0 : interactiveElement.addEventListener('click', proxyClickHandler);
4406
- });
4407
- };
4408
- updateProxy(proxified);
4409
- proxified.addEventListener('item-updated', event => {
4410
- updateProxy(event.target);
4411
- });
4412
- // update click event listener on proxy item and mirror the event on the main menu element
4413
- // we need to wait mg-menu-item to be loaded to ensure the shadowroot is rendered
4414
- proxy.addEventListener('item-loaded', () => {
4415
- updateProxy(proxified);
4416
- });
4417
- };
4418
- /***********
4419
- * Methods *
4420
- ***********/
4421
- /**
4422
- * render mg-item-more overflow element
4423
- * @returns mg-item-more element
4424
- */
4425
- this.renderMgMenuItemOverflowElement = () => {
4426
- this.parentMenuItems.forEach((child) => {
4427
- // create item-more menu items element from main menu-items clones
4428
- this.moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
4429
- // we need to get all `mg-menu-item` linked to the cloned one to set mirror process
4430
- tt(() => {
4431
- this.setProxyElement(child);
4432
- if (child.querySelector('mg-menu') !== null) {
4433
- child.querySelectorAll('mg-menu-item').forEach(this.setProxyElement);
4434
- }
4435
- });
4436
- });
4437
- return this.element;
4438
- };
4439
4678
  this.icon = { icon: 'ellipsis-vertical' };
4679
+ /**
4680
+ * Define slot label element
4681
+ */
4440
4682
  this.slotlabel = { display: false };
4441
- this.size = undefined;
4442
- this.parentMenu = undefined;
4443
4683
  }
4444
4684
  validateIcon(newValue) {
4445
4685
  if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
4446
- 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)}.`);
4447
4687
  }
4448
4688
  validateSlotLabel(newValue) {
4449
4689
  if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
4450
- 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)}.`);
4451
4691
  else if (typeof newValue.label !== 'string')
4452
4692
  this.slotlabel.label = this.messages.menuLabel;
4453
4693
  }
4454
4694
  validateSize(newValue) {
4455
4695
  if (newValue && !sizes$3.includes(newValue))
4456
- throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${Ye(newValue)}.`);
4696
+ throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${Je(newValue)}.`);
4457
4697
  }
4458
4698
  /*************
4459
4699
  * Lifecycle *
@@ -4484,8 +4724,7 @@ const MgItemMore = class {
4484
4724
  */
4485
4725
  componentDidUpdate() {
4486
4726
  if (this.parentMenu && this.overflowBehavior === undefined) {
4487
- this.parentMenuItems = Array.from(this.parentMenu.children).filter(item => item.nodeName === 'MG-MENU-ITEM');
4488
- this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
4727
+ this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.element, this.itemMoreContainer);
4489
4728
  }
4490
4729
  }
4491
4730
  /**
@@ -4500,11 +4739,11 @@ const MgItemMore = class {
4500
4739
  * @returns HTML Element
4501
4740
  */
4502
4741
  render() {
4503
- 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 => {
4504
- if (el !== null) {
4505
- this.moreElementMenuItem = el;
4506
- }
4507
- } }, 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
+ } })))));
4508
4747
  }
4509
4748
  get element() { return getElement(this); }
4510
4749
  static get watchers() { return {
@@ -4515,7 +4754,7 @@ const MgItemMore = class {
4515
4754
  };
4516
4755
  MgItemMore.style = MgItemMoreStyle0;
4517
4756
 
4518
- 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}";
4519
4758
  const MgMenuStyle0 = mgMenuCss;
4520
4759
 
4521
4760
  const MgMenu = class {
@@ -4525,100 +4764,78 @@ const MgMenu = class {
4525
4764
  * Internal *
4526
4765
  ************/
4527
4766
  this.name = 'mg-menu';
4528
- this.menuItems = [];
4529
- this.focusedMenuItem = 0;
4530
- /*************
4531
- * Methods *
4532
- *************/
4533
4767
  /**
4534
- * Close matching menu-item
4535
- * @param item - menu-item to close
4536
- * @param condition - addionnal condition
4768
+ * Component display direction.
4537
4769
  */
4538
- this.closeMenuItem = (item, condition) => {
4539
- if (!this.isChildMenu && condition) {
4540
- item.expanded = false;
4541
- }
4542
- };
4770
+ this.direction = Direction.HORIZONTAL;
4543
4771
  /**
4544
- * get mg-item-more child mg-menu-item element
4545
- * @returns mg-menu-item element
4772
+ * Define mg-menu size
4546
4773
  */
4547
- 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
+ *************/
4548
4778
  /**
4549
- * Set item listend
4550
- * @param item - mg-menu-item element
4551
- * @param index - number
4779
+ * Test if menu is a child menu
4780
+ * @returns truthy if menu is a child menu
4552
4781
  */
4553
- this.setItemListener = (item, index) => {
4554
- ['click', 'focus'].forEach(trigger => {
4555
- item.shadowRoot.querySelector('button,a').addEventListener(trigger, () => {
4556
- this.focusedMenuItem = index;
4557
- // reset expanded on previous active menu item
4558
- const itemMoreMenuItem = this.getItemMoreMenuItem();
4559
- (![null, undefined].includes(itemMoreMenuItem) ? [...this.menuItems, itemMoreMenuItem] : this.menuItems).forEach((item, index) => {
4560
- this.closeMenuItem(item, index !== this.focusedMenuItem);
4561
- });
4562
- });
4563
- });
4564
- };
4782
+ this.isChildMenu = () => this.element.closest('mg-menu-item') !== null;
4565
4783
  /**
4566
- * Store menu-items on component init and add listeners
4784
+ * Get menu children items
4785
+ * @returns menu children mg-menu-item
4567
4786
  */
4568
- this.initMenuItemsListeners = () => {
4569
- // add listeners on menu item and edit index
4570
- this.menuItems.forEach((item, index) => {
4571
- this.setItemListener(item, index);
4572
- });
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;
4573
4795
  };
4574
4796
  /**
4575
- * Handle item-loaded event on mg-item-more element
4797
+ * Update menu items
4576
4798
  */
4577
- this.handleItemLoaded = () => {
4578
- 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();
4579
4805
  };
4580
4806
  /**
4581
4807
  * render mg-item-more
4582
4808
  */
4583
4809
  this.renderMgItemMore = () => {
4584
4810
  var _a;
4585
- 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) {
4586
4812
  return;
4587
4813
  }
4588
4814
  // Insert mg-item-more outside the mg-menu shadowdom
4589
- if (this.itemMoreElement === undefined) {
4590
- this.itemMoreElement = document.createElement('mg-item-more');
4591
- this.itemMoreElement.addEventListener('item-loaded', this.handleItemLoaded);
4592
- 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);
4593
4819
  }
4594
4820
  // update mg-item-more props
4595
- for (const attribute in this.itemmore) {
4596
- const newValue = this.itemmore[attribute];
4597
- // to improve rendering we use HTML attributes as much as possible
4598
- if (['string', 'number'].includes(typeof newValue)) {
4599
- this.itemMoreElement.setAttribute(attribute, newValue);
4600
- }
4601
- else {
4602
- this.itemMoreElement[attribute] = newValue;
4603
- }
4821
+ for (const propertie in this.itemmore) {
4822
+ itemMoreElement[propertie] = this.itemmore[propertie];
4604
4823
  }
4605
4824
  if (((_a = this.itemmore) === null || _a === void 0 ? void 0 : _a.size) === undefined)
4606
- this.itemMoreElement.size = this.size;
4825
+ itemMoreElement.size = this.size;
4607
4826
  };
4608
- this.label = undefined;
4609
- this.direction = Direction.HORIZONTAL;
4610
- this.itemmore = undefined;
4611
- this.size = 'medium';
4612
- this.isChildMenu = undefined;
4613
4827
  }
4614
4828
  validateLabel(newValue) {
4615
4829
  if (newValue === undefined && !this.element.hasAttribute('aria-label')) {
4616
- 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)}.`);
4617
4831
  }
4618
4832
  }
4619
4833
  validateDirection(newValue) {
4620
4834
  if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
4621
- 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();
4622
4839
  }
4623
4840
  }
4624
4841
  validateItemMore(newValue) {
@@ -4631,9 +4848,30 @@ const MgMenu = class {
4631
4848
  }
4632
4849
  validateSize(newValue) {
4633
4850
  if (!sizes$3.includes(newValue)) {
4634
- throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$3.join(', ')}. Passed value: ${Ye(newValue)}.`);
4851
+ throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$3.join(', ')}. Passed value: ${Je(newValue)}.`);
4635
4852
  }
4636
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
+ ;
4637
4875
  /*************
4638
4876
  * Lifecycle *
4639
4877
  *************/
@@ -4648,37 +4886,38 @@ const MgMenu = class {
4648
4886
  }
4649
4887
  /**
4650
4888
  * Check if component slots configuration
4651
- * @returns timeout
4652
4889
  */
4653
4890
  componentDidLoad() {
4654
- // update props and states after componentDidLoad hook
4655
- // return a promise to process action only in the FIRST render().
4656
- // https://stenciljs.com/docs/component-lifecycle#componentwillload
4657
- return setTimeout(() => {
4658
- // store all menu-items
4659
- this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
4660
- this.isChildMenu = this.element.closest('mg-menu-item') !== null;
4661
- // add mg-item-more to manage OverflowBehavior
4662
- // when all props, states and DOM are already rendered we can render the mg-item-more
4663
- this.renderMgItemMore();
4664
- // then use mutation observer on children to improve reactivity
4665
- new MutationObserver(() => {
4666
- this.renderMgItemMore();
4667
- }).observe(this.element, { childList: true });
4668
- });
4669
- }
4670
- /**
4671
- * Add listeners to items
4672
- */
4673
- componentDidRender() {
4674
- 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 });
4675
4914
  }
4676
4915
  /**
4677
4916
  * Render
4678
4917
  * @returns HTML Element
4679
4918
  */
4680
4919
  render() {
4681
- 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' })));
4682
4921
  }
4683
4922
  get element() { return getElement(this); }
4684
4923
  static get watchers() { return {
@@ -4696,7 +4935,6 @@ const MgMenuItemStyle0 = mgMenuItemCss;
4696
4935
  const MgMenuItem = class {
4697
4936
  constructor(hostRef) {
4698
4937
  registerInstance(this, hostRef);
4699
- this.statusChange = createEvent(this, "status-change", 7);
4700
4938
  this.itemLoaded = createEvent(this, "item-loaded", 7);
4701
4939
  this.itemUpdated = createEvent(this, "item-updated", 7);
4702
4940
  /************
@@ -4704,15 +4942,39 @@ const MgMenuItem = class {
4704
4942
  ************/
4705
4943
  this.name = 'mg-menu-item';
4706
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;
4707
4975
  /***********
4708
4976
  * Methods *
4709
4977
  **********/
4710
- /**
4711
- * Toggle expanded prop value
4712
- */
4713
- this.toggleExpanded = () => {
4714
- this.expanded = !this.expanded;
4715
- };
4716
4978
  /**
4717
4979
  * Does an Element have given Status
4718
4980
  * @param mgMenuItemElement - to parse
@@ -4720,6 +4982,24 @@ const MgMenuItem = class {
4720
4982
  * @returns true if element with status is found
4721
4983
  */
4722
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);
4723
5003
  /**
4724
5004
  * Is component contextual direction match the given direction
4725
5005
  * @param direction - in parent menu
@@ -4737,25 +5017,37 @@ const MgMenuItem = class {
4737
5017
  childMenu !== null && Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && !subItem.hasAttribute('hidden'));
4738
5018
  };
4739
5019
  /**
4740
- * Method to control if one of component children have active status
4741
- * @returns truthy if component has active child
5020
+ * Update expanded prop
5021
+ * @param newValue - expanded new value
4742
5022
  */
4743
- this.hasActiveChild = () => {
4744
- var _a;
4745
- 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
+ }
4746
5037
  };
4747
5038
  /**
4748
- * Validate slots
5039
+ * Update slots
4749
5040
  * @param guard - prevent action with guard. Default: false.
4750
5041
  */
4751
- this.validateSlot = (guard = false) => {
5042
+ this.updateSlot = (guard = false) => {
4752
5043
  // slot title AND metadata validation
4753
5044
  // add title on label AND metada slots due to text-overflow on these element
4754
- 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) {
4755
5046
  throw new Error(`<${this.name}> slot "label" is required.`);
5047
+ }
4756
5048
  ['label', 'metadata'].forEach(slot => {
4757
5049
  Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
4758
- if (!me(element.textContent))
5050
+ if (!ye(element.textContent))
4759
5051
  throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
4760
5052
  if ((guard && !element.hasAttribute('title')) || !guard)
4761
5053
  element.setAttribute('title', element.textContent);
@@ -4763,39 +5055,23 @@ const MgMenuItem = class {
4763
5055
  });
4764
5056
  };
4765
5057
  /**
4766
- * Update status
4767
- * @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
4768
- */
4769
- this.updateStatus = (guard = []) => {
4770
- if (![Status$1.HIDDEN, Status$1.DISABLED, ...guard].includes(this.status)) {
4771
- this.status = this.hasActiveChild() ? Status$1.ACTIVE : Status$1.VISIBLE;
4772
- }
4773
- };
4774
- /**
4775
- * Init event-listeners
5058
+ * Update menu item
5059
+ * @param guard - prevent action with guard
4776
5060
  */
4777
- this.initListeners = () => {
4778
- var _a;
4779
- // manage first sub-level menu-items
4780
- Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).forEach(item => {
4781
- if (item.nodeName === 'MG-MENU-ITEM') {
4782
- // manage child menu listener
4783
- item.addEventListener('status-change', () => {
4784
- this.updateStatus();
4785
- });
4786
- }
4787
- });
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();
4788
5074
  };
4789
- /**
4790
- * Get mg-popover identifier
4791
- * @returns generated mg-popover identifier
4792
- */
4793
- this.getPopoverIdentifier = () => `${this.identifier}-popover`;
4794
- /**
4795
- * Condition to know if component should display a mg-popover
4796
- * @returns truthy if component display popover
4797
- */
4798
- this.displayPopover = () => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
4799
5075
  /************
4800
5076
  * Handlers *
4801
5077
  ************/
@@ -4804,106 +5080,123 @@ const MgMenuItem = class {
4804
5080
  * @param event - click on element
4805
5081
  */
4806
5082
  this.handleElementCLick = (event) => {
4807
- if ((this.hasChildren && !this.isInMainMenu) || this.status === Status$1.DISABLED) {
5083
+ if (this.status === Status$1.DISABLED) {
4808
5084
  event.preventDefault();
4809
5085
  event.stopPropagation();
4810
5086
  }
4811
- // toggle expanded when mg-menu-item has child items
4812
- if (this.hasChildren)
4813
- 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
+ }
4814
5103
  };
4815
5104
  /**
4816
5105
  * Handle popover element display-change event
4817
5106
  * @param event - popover display event
4818
5107
  */
4819
5108
  this.handlePopoverDisplay = (event) => {
4820
- this.expanded = event.detail;
5109
+ this.updateExpanded(event.detail);
4821
5110
  };
4822
5111
  /**
4823
5112
  * Render slot
4824
5113
  * @returns HTML Element
4825
5114
  */
4826
5115
  this.renderSlot = () => h("slot", null);
4827
- this.identifier = qe('mg-menu-item');
4828
- this.href = undefined;
4829
- this.target = undefined;
4830
- this.status = Status$1.VISIBLE;
4831
- this.expanded = false;
4832
- this.size = 'medium';
4833
- this.navigationButtonClassList = new Xe([this.navigationButton]);
4834
- this.direction = undefined;
4835
- this.isInMainMenu = undefined;
4836
- this.isItemMore = undefined;
4837
- this.hasChildren = false;
4838
- this.displayNotificationBadge = undefined;
4839
5116
  }
4840
5117
  watchIdentifier(newValue) {
4841
- if (!Ge(newValue)) {
4842
- 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`;
4843
5123
  }
4844
5124
  }
4845
5125
  watchTarget(newValue) {
4846
5126
  if (newValue && !targets.includes(newValue)) {
4847
- 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)}.`);
4848
5128
  }
4849
5129
  }
4850
- validateStatus(newValue, oldValue) {
4851
- if (oldValue !== undefined) {
5130
+ watchStatus(newValue, oldValue) {
5131
+ if (oldValue !== undefined)
4852
5132
  this.navigationButtonClassList.delete(`${this.navigationButton}--${oldValue}`);
4853
- }
4854
5133
  this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
4855
- this.statusChange.emit(newValue);
4856
- }
4857
- validateExpanded(newValue) {
4858
- if (typeof newValue !== 'boolean')
4859
- throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${Ye(newValue)}.`);
4860
- // if menu-item has sub-menu we have to apply some updates:
4861
- if (this.hasChildren) {
4862
- const subItems = Array.from(this.element.querySelectorAll(this.name));
4863
- if (!newValue) {
4864
- // - when main menu item is NOT expanded we need NOT expanded sub-items and NOT expanded sub-content
4865
- subItems.forEach(item => {
4866
- item.expanded = false;
4867
- });
4868
- }
4869
- else if (this.element.querySelector(`${this.name}[status="${Status$1.ACTIVE}"]`) !== null) {
4870
- // - when expanded and contain an active item parents are expended too
4871
- subItems.forEach(item => {
4872
- if (this.hasStatus(item, Status$1.ACTIVE)) {
4873
- item.expanded = true;
4874
- }
4875
- });
4876
- }
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
+ });
4877
5146
  }
4878
5147
  }
4879
- validateSize(newValue, oldValue) {
4880
- this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);
5148
+ watchSize(newValue, oldValue) {
5149
+ if (oldValue !== undefined)
5150
+ this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);
4881
5151
  this.navigationButtonClassList.add(`${this.navigationButton}--size-${newValue}`);
4882
5152
  }
4883
- validateDirection(newValue) {
4884
- // manage menu items style depending to parent menu horientation
4885
- this.element.setAttribute('data-style-direction', newValue);
5153
+ validateDirection(newValue, oldValue) {
5154
+ if (oldValue !== undefined)
5155
+ this.navigationButtonClassList.delete(`${this.navigationButton}--${oldValue}`);
4886
5156
  this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
4887
5157
  // manage all sub levels child menu-items level with data-level attribut
4888
- if (this.isDirection(Direction.VERTICAL, newValue)) {
4889
- 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)) {
4890
5160
  item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
4891
- });
4892
- }
5161
+ }
5162
+ else {
5163
+ delete item.dataset.level;
5164
+ }
5165
+ });
4893
5166
  }
4894
5167
  validateHasChildren(newValue) {
4895
5168
  if (newValue && this.element.href !== undefined) {
4896
5169
  throw new Error(`<${this.name}> prop "href" is unauthorizied when element is a parent.`);
4897
5170
  }
4898
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
+ }
4899
5189
  /**
4900
5190
  * Render popover clickoutside guard for content slot
4901
5191
  */
4902
5192
  updatePopoverGuard() {
4903
- if (this.displayPopover())
4904
- Array.from(this.element.children)
4905
- .filter((child) => !child.hasAttribute('slot') && child.nodeName !== 'MG-MENU' && Boolean(child.dataset))
4906
- .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;
4907
5200
  }
4908
5201
  /*************
4909
5202
  * Lifecycle *
@@ -4917,13 +5210,12 @@ const MgMenuItem = class {
4917
5210
  this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));
4918
5211
  this.messages = initLocales(this.element).messages.menuItem;
4919
5212
  this.isItemMore = this.element.dataset.overflowMore !== undefined;
4920
- // Validate props
4921
- this.validateStatus(this.status);
4922
- this.validateExpanded(this.expanded);
5213
+ // watchers
5214
+ this.watchStatus(this.status);
5215
+ this.watchExpanded(this.expanded);
4923
5216
  this.watchTarget(this.target);
4924
5217
  this.watchIdentifier(this.identifier);
4925
- // Validate states
4926
- this.validateSize(this.size);
5218
+ this.watchSize(this.size);
4927
5219
  }
4928
5220
  /**
4929
5221
  * Check if component slots configuration
@@ -4931,40 +5223,36 @@ const MgMenuItem = class {
4931
5223
  */
4932
5224
  componentDidLoad() {
4933
5225
  // validation
4934
- this.validateSlot(true);
5226
+ this.updateSlot(true);
4935
5227
  // update props and states after componentDidLoad hook
4936
5228
  // return a promise to process action only in the FIRST render().
4937
5229
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
4938
5230
  return setTimeout(() => {
4939
- // define menu-item context states
4940
- const menu = this.element.closest('mg-menu');
4941
- this.direction = this.isItemMore || menu === null ? Direction.HORIZONTAL : menu.direction;
4942
- this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;
4943
- if ((menu === null || menu === void 0 ? void 0 : menu.size) !== undefined)
4944
- this.size = menu.size;
4945
- if (this.isItemMore)
4946
- this.size = this.element.dataset.size;
4947
- // when main menu item contain an active item it will get the active style
4948
- // AND if item is in vertical menu it will be expanded
4949
- if (this.hasActiveChild() && this.isInMainMenu)
4950
- this.expanded = this.isDirection(Direction.VERTICAL);
4951
- this.updateStatus([Status$1.ACTIVE]);
4952
- this.updateDisplayNotificationBadge();
4953
- this.updatePopoverGuard();
4954
- // manage child dom changes with mutationObserver and listners
4955
- this.initListeners();
5231
+ this.watchDataStyleDirection(this.element.dataset.styleDirection);
5232
+ this.watchDataHasFocus(this.element.dataset.hasFocus);
5233
+ this.updateItem([Status$1.ACTIVE]);
4956
5234
  // emit loaded event when component is fully loaded
4957
5235
  this.itemLoaded.emit();
4958
5236
  new MutationObserver(mutationsList => {
4959
- if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
5237
+ if (mutationsList.some(mutation => ['hidden', 'status'].includes(mutation.attributeName)))
4960
5238
  this.updateStatus(this.hasChildren ? undefined : [Status$1.ACTIVE]);
4961
5239
  if (mutationsList.some(mutation => mutation.type === 'characterData'))
4962
- this.validateSlot();
4963
- this.updateDisplayNotificationBadge();
5240
+ this.updateSlot();
5241
+ if (mutationsList.some(mutation => mutation.type === 'childList'))
5242
+ this.updateItem();
4964
5243
  this.itemUpdated.emit();
4965
5244
  }).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });
4966
5245
  }, 0);
4967
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
+ }
4968
5256
  /**
4969
5257
  * Render ineractive element
4970
5258
  * @returns HTML Element
@@ -4979,15 +5267,6 @@ const MgMenuItem = class {
4979
5267
  [`${this.navigationButton}-chevron--rotate`]: this.expanded === true,
4980
5268
  } }, h("mg-icon", { icon: "chevron-down" })))));
4981
5269
  }
4982
- /**
4983
- * Emit event when component is updated
4984
- * @returns promise process wich emit the 'item-updated' event
4985
- */
4986
- componentShouldUpdate() {
4987
- return tt(() => {
4988
- this.itemUpdated.emit();
4989
- });
4990
- }
4991
5270
  /**
4992
5271
  * Render
4993
5272
  * @returns HTML Element
@@ -4997,7 +5276,7 @@ const MgMenuItem = class {
4997
5276
  ['mg-c-menu-item__collapse-container']: true,
4998
5277
  ['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
4999
5278
  });
5000
- 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
5001
5280
  }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
5002
5281
  this.renderInteractiveElement(),
5003
5282
  h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
@@ -5007,11 +5286,13 @@ const MgMenuItem = class {
5007
5286
  static get watchers() { return {
5008
5287
  "identifier": ["watchIdentifier"],
5009
5288
  "target": ["watchTarget"],
5010
- "status": ["validateStatus"],
5011
- "expanded": ["validateExpanded"],
5012
- "size": ["validateSize"],
5289
+ "status": ["watchStatus"],
5290
+ "expanded": ["watchExpanded"],
5291
+ "size": ["watchSize"],
5013
5292
  "direction": ["validateDirection"],
5014
- "hasChildren": ["validateHasChildren"]
5293
+ "hasChildren": ["validateHasChildren"],
5294
+ "data-style-direction": ["watchDataStyleDirection"],
5295
+ "data-has-focus": ["watchDataHasFocus"]
5015
5296
  }; }
5016
5297
  };
5017
5298
  MgMenuItem.style = MgMenuItemStyle0;
@@ -5035,6 +5316,22 @@ const MgMessage = class {
5035
5316
  * Internal *
5036
5317
  ************/
5037
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;
5038
5335
  /**
5039
5336
  * Get icon corresponding to variant
5040
5337
  * @returns icon
@@ -5051,14 +5348,10 @@ const MgMessage = class {
5051
5348
  return 'exclamation-circle';
5052
5349
  }
5053
5350
  };
5054
- this.variant = 'info';
5055
- this.variantStyle = 'bar-left';
5056
- this.classCollection = new Xe(['mg-c-message']);
5057
- this.hasActions = false;
5058
5351
  }
5059
5352
  watchVariant(newValue, oldValue) {
5060
5353
  if (!variants$1.includes(newValue)) {
5061
- 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)}.`);
5062
5355
  }
5063
5356
  else {
5064
5357
  if (newValue !== undefined)
@@ -5069,7 +5362,7 @@ const MgMessage = class {
5069
5362
  }
5070
5363
  watchVariantStyle(newValue, oldValue) {
5071
5364
  if (!variantStyles.includes(newValue)) {
5072
- 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)}.`);
5073
5366
  }
5074
5367
  else {
5075
5368
  if (newValue !== undefined)
@@ -5096,9 +5389,9 @@ const MgMessage = class {
5096
5389
  * @returns HTML Element
5097
5390
  */
5098
5391
  render() {
5099
- 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 && [
5100
5393
  h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
5101
- 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" })),
5102
5395
  ]))));
5103
5396
  }
5104
5397
  get element() { return getElement(this); }
@@ -5125,6 +5418,31 @@ const MgModal = class {
5125
5418
  this.componentClose = createEvent(this, "component-close", 7);
5126
5419
  // IDs
5127
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']);
5128
5446
  /***********
5129
5447
  * Handles *
5130
5448
  ***********/
@@ -5135,26 +5453,19 @@ const MgModal = class {
5135
5453
  this.open = false;
5136
5454
  this.componentClose.emit();
5137
5455
  };
5138
- this.identifier = qe('mg-modal');
5139
- this.dialogRole = dialogRoles[0];
5140
- this.modalTitle = undefined;
5141
- this.closeButton = false;
5142
- this.open = false;
5143
- this.hasActions = false;
5144
- this.classCollection = new Xe(['mg-c-modal']);
5145
5456
  }
5146
5457
  watchIdentifier(newValue) {
5147
- if (!Ge(newValue)) {
5148
- 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)}.`);
5149
5460
  }
5150
5461
  }
5151
5462
  validateDialogRole(newValue) {
5152
5463
  if (!dialogRoles.includes(newValue))
5153
- 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)}.`);
5154
5465
  }
5155
5466
  validateModalTitle(newValue) {
5156
- if (!me(newValue)) {
5157
- 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)}.`);
5158
5469
  }
5159
5470
  }
5160
5471
  watchOpen(newValue) {
@@ -5203,11 +5514,11 @@ const MgModal = class {
5203
5514
  * @returns HTML Element
5204
5515
  */
5205
5516
  render() {
5206
- return (h("dialog", { key: 'e4091c6fa70e4b7bccd24db2212e0d2b94ae3099', 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) => {
5207
5518
  if (el !== null) {
5208
5519
  this.dialog = el;
5209
5520
  }
5210
- } }, h("mg-card", { key: 'd674065eb361fbae99545e79840ee13779dff236' }, h("div", { key: 'f3c7464c97710c9b58db1e4ad5b3c80c43de5493', class: "mg-c-modal__dialog" }, h("header", { key: 'b6f714cdaf553e26ab1a8212608a50949cfc0395', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: '95310b0c375e412da21487ae68cb3437afdf7537', class: "mg-c-modal__close-button" }, h("mg-button", { key: '29303f06b8db367aaa372196996b2ab074d799f2', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: '153eb9f3039422b5e9c554a7878ebc9678b2a997', icon: "cross" })))), h("h1", { key: 'fae980d224a9947ac11ae6d7ddddcc7591ba695f', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: 'e5efb0df7f7726f454d7f4347c8f5cee7bac1f00', class: "mg-c-modal__content" }, h("slot", { key: '38eeb27cf83588402e6ebc0d674e3967c45576ea' })), this.hasActions && (h("footer", { key: 'c50c3bde92a3e6fae3a047ad7803a8f80f277eeb', class: "mg-c-modal__footer" }, h("slot", { key: '777984d09b3df311a2f6e30dda664dfe0771bfd4', 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" })))))));
5211
5522
  }
5212
5523
  get element() { return getElement(this); }
5213
5524
  static get watchers() { return {
@@ -5253,6 +5564,19 @@ const MgPagination = class {
5253
5564
  constructor(hostRef) {
5254
5565
  registerInstance(this, hostRef);
5255
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;
5256
5580
  /**
5257
5581
  * Change current page from target
5258
5582
  * @param target - target page
@@ -5279,26 +5603,20 @@ const MgPagination = class {
5279
5603
  this.handleGoToPage = (action, disabled) => {
5280
5604
  !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
5281
5605
  };
5282
- this.identifier = qe('mg-pagination');
5283
- this.label = undefined;
5284
- this.hideNavigationLabels = undefined;
5285
- this.hidePageCount = undefined;
5286
- this.totalPages = 1;
5287
- this.currentPage = 1;
5288
5606
  }
5289
5607
  watchIdentifier(newValue) {
5290
- if (!Ge(newValue)) {
5291
- 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)}.`);
5292
5610
  }
5293
5611
  }
5294
5612
  validateTotalPages(newValue) {
5295
5613
  if (newValue < 1) {
5296
- 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)}.`);
5297
5615
  }
5298
5616
  }
5299
5617
  validateCurrentPage(newValue) {
5300
5618
  if (newValue < 1) {
5301
- 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)}.`);
5302
5620
  }
5303
5621
  else if (newValue > this.totalPages) {
5304
5622
  throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page.');
@@ -5328,10 +5646,10 @@ const MgPagination = class {
5328
5646
  * @returns HTML Element
5329
5647
  */
5330
5648
  render() {
5331
- 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`],
5332
5650
  // eslint-disable-next-line react/jsx-no-bind
5333
- 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" })));
5334
- 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))));
5335
5653
  }
5336
5654
  get element() { return getElement(this); }
5337
5655
  static get watchers() { return {
@@ -5359,6 +5677,35 @@ const MgPanel = class {
5359
5677
  registerInstance(this, hostRef);
5360
5678
  this.titleChange = createEvent(this, "title-change", 7);
5361
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;
5362
5709
  /************
5363
5710
  * Methods *
5364
5711
  ************/
@@ -5451,27 +5798,15 @@ const MgPanel = class {
5451
5798
  ];
5452
5799
  return this.titlePosition === 'right' ? children.reverse() : children;
5453
5800
  };
5454
- this.identifier = qe('mg-panel');
5455
- this.panelTitle = undefined;
5456
- this.titlePattern = undefined;
5457
- this.titlePatternErrorMessage = undefined;
5458
- this.titleEditable = false;
5459
- this.titlePosition = titlePositions[0];
5460
- this.expanded = false;
5461
- this.expandToggleDisplay = expandToggleDisplays[0];
5462
- this.expandToggleDisabled = undefined;
5463
- this.classCollection = new Xe(['mg-c-panel']);
5464
- this.isEditing = false;
5465
- this.updatedPanelTitle = undefined;
5466
5801
  }
5467
5802
  watchIdentifier(newValue) {
5468
- if (!Ge(newValue)) {
5469
- 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)}.`);
5470
5805
  }
5471
5806
  }
5472
5807
  validatePanelTitle(newValue) {
5473
- if (!me(newValue))
5474
- 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)}.`);
5475
5810
  this.titleChange.emit(newValue);
5476
5811
  }
5477
5812
  validateTitlePattern(newValue) {
@@ -5480,14 +5815,14 @@ const MgPanel = class {
5480
5815
  }
5481
5816
  validateTitlePosition(newValue) {
5482
5817
  if (!titlePositions.includes(newValue))
5483
- 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)}.`);
5484
5819
  }
5485
5820
  handleExpanded(newValue) {
5486
5821
  this.expandedChange.emit(newValue);
5487
5822
  }
5488
5823
  validateExpandToggleDisplay(newValue) {
5489
5824
  if (!expandToggleDisplays.includes(newValue))
5490
- 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)}.`);
5491
5826
  if (newValue === 'icon' && this.titleEditable)
5492
5827
  this.titleEditable = false;
5493
5828
  }
@@ -5522,7 +5857,7 @@ const MgPanel = class {
5522
5857
  */
5523
5858
  render() {
5524
5859
  const headerId = `${this.identifier}-header`;
5525
- 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' })))));
5526
5861
  }
5527
5862
  get element() { return getElement(this); }
5528
5863
  static get watchers() { return {
@@ -7336,6 +7671,31 @@ const MgPopover = class {
7336
7671
  registerInstance(this, hostRef);
7337
7672
  this.displayChange = createEvent(this, "display-change", 7);
7338
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;
7339
7699
  /**
7340
7700
  * Check if clicked outside of component
7341
7701
  * @param event - mouse event
@@ -7428,16 +7788,10 @@ const MgPopover = class {
7428
7788
  mgPopoverContent.setAttribute('id', this.identifier);
7429
7789
  }
7430
7790
  };
7431
- this.identifier = qe('mg-popover');
7432
- this.placement = 'bottom';
7433
- this.arrowHide = false;
7434
- this.closeButton = false;
7435
- this.display = false;
7436
- this.disabled = false;
7437
7791
  }
7438
7792
  validateIdentifier(newValue) {
7439
- if (!Ge(newValue)) {
7440
- 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)}.`);
7441
7795
  }
7442
7796
  // use renderPopoverContent to update popover-content id
7443
7797
  this.renderPopoverContent();
@@ -7526,6 +7880,12 @@ const MgPopover = class {
7526
7880
  if (!this.disabled)
7527
7881
  this.display = !this.display;
7528
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
+ });
7529
7889
  // Add events to hide popover
7530
7890
  this.element.addEventListener('keydown', e => {
7531
7891
  if (!this.disabled && e.code === 'Escape') {
@@ -7541,7 +7901,7 @@ const MgPopover = class {
7541
7901
  * @returns HTML Element
7542
7902
  */
7543
7903
  render() {
7544
- return (h(Host, { key: '659148b3948900bbfe18d0d6898ad0c3a77ccd4d' }, h("slot", { key: 'd1fe9c5465fafd8e6a5c42476b2b6096f91ef3ee' }), h("slot", { key: 'ac905b983bd5bf55ceea4d7fb0a6de31875cd0ba', name: "content" })));
7904
+ return (h(Host, { key: '29e8b74394c1a3f620b4119912d5038feb87b873' }, h("slot", { key: '8a3fc0141c2b48db2bf5bd526c1ce289797aaede' }), h("slot", { key: '32ef24ddf19e932ae40f1263da121244c969ce0c', name: "content" })));
7545
7905
  }
7546
7906
  get element() { return getElement(this); }
7547
7907
  static get watchers() { return {
@@ -7560,14 +7920,20 @@ const MgPopoverContent = class {
7560
7920
  constructor(hostRef) {
7561
7921
  registerInstance(this, hostRef);
7562
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']);
7563
7931
  /**
7564
7932
  * Handle action for close button
7565
7933
  */
7566
7934
  this.handleCloseButton = () => {
7567
7935
  this.hideContent.emit();
7568
7936
  };
7569
- this.closeButton = false;
7570
- this.classCollection = new Xe(['mg-c-popover-content']);
7571
7937
  }
7572
7938
  /*************
7573
7939
  * Lifecycle *
@@ -7618,10 +7984,9 @@ const MgSkipLinks = class {
7618
7984
  event.currentTarget.blur();
7619
7985
  this.goToAnchor.emit(event.currentTarget.getAttribute('href'));
7620
7986
  };
7621
- this.links = undefined;
7622
7987
  }
7623
7988
  validateLinks(links) {
7624
- 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))) {
7625
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.`);
7626
7991
  }
7627
7992
  }
@@ -7683,6 +8048,23 @@ const MgTabs = class {
7683
8048
  this.tabPanel = 'panel';
7684
8049
  this.buttonTabBaseClass = 'mg-c-tabs__navigation-button';
7685
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']);
7686
8068
  /**
7687
8069
  * Validate that new tab status can be `Status.ACTIVE`
7688
8070
  * @param tab - tab item
@@ -7780,7 +8162,7 @@ const MgTabs = class {
7780
8162
  */
7781
8163
  this.resetFocus = () => {
7782
8164
  // update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
7783
- tt(() => {
8165
+ et(() => {
7784
8166
  this.tabFocus = undefined;
7785
8167
  Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
7786
8168
  tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
@@ -7795,39 +8177,32 @@ const MgTabs = class {
7795
8177
  if (slots.length !== this.tabs.length)
7796
8178
  throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
7797
8179
  };
7798
- this.identifier = qe('mg-tabs');
7799
- this.label = undefined;
7800
- this.size = 'medium';
7801
- this.items = undefined;
7802
- this.activeTab = undefined;
7803
- this.tabs = [];
7804
- this.classCollection = new Xe(['mg-c-tabs']);
7805
8180
  }
7806
8181
  watchIdentifier(newValue) {
7807
- if (!Ge(newValue)) {
7808
- 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)}.`);
7809
8184
  }
7810
8185
  }
7811
8186
  validateLabel(newValue) {
7812
- if (!me(newValue)) {
7813
- 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)}.`);
7814
8189
  }
7815
8190
  }
7816
8191
  validateSize(newValue) {
7817
8192
  if (!sizes.includes(newValue)) {
7818
- 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)}.`);
7819
8194
  }
7820
8195
  this.classCollection.add(`mg-c-tabs--size-${this.size}`);
7821
8196
  }
7822
8197
  validateItems(newValue) {
7823
8198
  // String array
7824
- if (Je(newValue))
8199
+ if (Xe(newValue))
7825
8200
  this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
7826
8201
  // Object array
7827
8202
  else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
7828
8203
  this.tabs = newValue;
7829
8204
  else
7830
- 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)}.`);
7831
8206
  }
7832
8207
  validateActiveTab(newValue) {
7833
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
@@ -7852,7 +8227,7 @@ const MgTabs = class {
7852
8227
  this.activeTabChange.emit(newValue);
7853
8228
  }
7854
8229
  else {
7855
- 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)}.`);
7856
8231
  }
7857
8232
  }
7858
8233
  /*************
@@ -7923,14 +8298,18 @@ const MgTag = class {
7923
8298
  // Classes
7924
8299
  this.classOutline = 'mg-c-tag--outline';
7925
8300
  this.classSoft = 'mg-c-tag--soft';
7926
- this.variant = variants[0];
7927
- this.outline = undefined;
7928
- this.soft = undefined;
7929
- 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']);
7930
8309
  }
7931
8310
  validateVariant(newValue, oldValue) {
7932
8311
  if (!variants.includes(newValue)) {
7933
- 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)}.`);
7934
8313
  }
7935
8314
  else {
7936
8315
  if (oldValue !== undefined) {
@@ -7963,7 +8342,7 @@ const MgTag = class {
7963
8342
  * @param textContent - html element textContent property
7964
8343
  */
7965
8344
  validateTextContent(textContent) {
7966
- if (!me(textContent))
8345
+ if (!ye(textContent))
7967
8346
  throw new Error('<mg-tag> slot must contain a text content.');
7968
8347
  }
7969
8348
  /*************
@@ -7983,7 +8362,7 @@ const MgTag = class {
7983
8362
  * @returns HTML Element
7984
8363
  */
7985
8364
  render() {
7986
- 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' })));
7987
8366
  }
7988
8367
  get element() { return getElement(this); }
7989
8368
  static get watchers() { return {
@@ -8013,6 +8392,23 @@ const isButton = (element) => typeof element === 'object' && ['MG-BUTTON', 'BUTT
8013
8392
  const MgTooltip = class {
8014
8393
  constructor(hostRef) {
8015
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;
8016
8412
  /**
8017
8413
  * Show tooltip
8018
8414
  */
@@ -8022,7 +8418,7 @@ const MgTooltip = class {
8022
8418
  // Enable the event listeners
8023
8419
  this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
8024
8420
  // hide when click outside on nextTick to prevent event to trigger after creation
8025
- tt(() => {
8421
+ et(() => {
8026
8422
  this.windows.forEach((localWindow) => {
8027
8423
  localWindow.addEventListener('click', this.handleClickOutside, false);
8028
8424
  localWindow.addEventListener('keydown', this.handlePressEscape, false);
@@ -8218,22 +8614,17 @@ const MgTooltip = class {
8218
8614
  element.setAttribute('aria-describedby', `${[...new Set([...element.getAttribute('aria-describedby').split(' '), this.identifier])].join(' ')}`);
8219
8615
  }
8220
8616
  };
8221
- this.identifier = qe('mg-tooltip');
8222
- this.message = undefined;
8223
- this.placement = 'bottom';
8224
- this.display = false;
8225
- this.disabled = false;
8226
8617
  }
8227
8618
  watchIdentifier(newValue) {
8228
- if (!Ge(newValue)) {
8229
- 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)}.`);
8230
8621
  }
8231
8622
  // use renderTooltipContent to update tooltip-content id
8232
8623
  this.renderTooltipContent();
8233
8624
  }
8234
8625
  watchMessage(newValue) {
8235
- if (!me(newValue)) {
8236
- 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)}.`);
8237
8628
  }
8238
8629
  if (this.mgTooltipContent !== undefined)
8239
8630
  this.mgTooltipContent.message = newValue;
@@ -8352,7 +8743,7 @@ const MgTooltip = class {
8352
8743
  * @returns HTML Element
8353
8744
  */
8354
8745
  render() {
8355
- 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" })));
8356
8747
  }
8357
8748
  get element() { return getElement(this); }
8358
8749
  static get watchers() { return {
@@ -8370,7 +8761,6 @@ const MgTooltipContentStyle0 = mgTooltipContentCss;
8370
8761
  const MgTooltipContent = class {
8371
8762
  constructor(hostRef) {
8372
8763
  registerInstance(this, hostRef);
8373
- this.message = undefined;
8374
8764
  }
8375
8765
  /*************
8376
8766
  * Lifecycle *
@@ -8380,7 +8770,7 @@ const MgTooltipContent = class {
8380
8770
  * @returns HTML Element
8381
8771
  */
8382
8772
  render() {
8383
- 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" })));
8384
8774
  }
8385
8775
  };
8386
8776
  MgTooltipContent.style = MgTooltipContentStyle0;