@mgdis/mg-components 5.19.3 → 5.21.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 (493) hide show
  1. package/dist/cjs/{components.utils-69435877.js → components.utils-cd908d4e.js} +102 -99
  2. package/dist/cjs/components.utils-cd908d4e.js.map +1 -0
  3. package/dist/cjs/{index-60dd0c56.js → index-8532b5e9.js} +185 -87
  4. package/dist/cjs/index-8532b5e9.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/mg-action-more_34.cjs.entry.js +5140 -5107
  7. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  8. package/dist/cjs/mg-components.cjs.js +3 -3
  9. package/dist/cjs/mg-components.cjs.js.map +1 -1
  10. package/dist/cjs/mg-item-more.cjs.entry.js +237 -222
  11. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  12. package/dist/collection/assets/icons/index.js +193 -191
  13. package/dist/collection/assets/icons/index.js.map +1 -0
  14. package/dist/collection/collection-manifest.json +6 -6
  15. package/dist/collection/components/atoms/mg-badge/mg-badge.js +161 -161
  16. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  17. package/dist/collection/components/atoms/mg-button/mg-button.js +362 -362
  18. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  19. package/dist/collection/components/atoms/mg-card/mg-card.js +126 -126
  20. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  21. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +101 -101
  22. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  23. package/dist/collection/components/atoms/mg-divider/mg-divider.js +47 -47
  24. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  25. package/dist/collection/components/atoms/mg-icon/mg-icon.js +231 -231
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  27. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +132 -132
  28. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  29. package/dist/collection/components/atoms/mg-tag/mg-tag.js +158 -158
  30. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  31. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +46 -46
  32. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  33. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +3 -3
  34. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  35. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +398 -398
  36. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  37. package/dist/collection/components/molecules/inputs/MgInput.conf.js +2 -2
  38. package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +1 -1
  39. package/dist/collection/components/molecules/inputs/MgInput.js +84 -84
  40. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +8 -8
  42. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  43. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +266 -266
  44. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  45. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +4 -4
  46. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  47. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +788 -791
  48. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  49. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +4 -4
  50. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -1
  51. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +588 -578
  52. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  53. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +4 -4
  54. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
  55. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +778 -773
  56. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  57. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +536 -526
  58. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +565 -555
  60. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  61. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +700 -695
  62. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  63. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +770 -760
  64. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  65. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +705 -695
  66. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  67. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +527 -522
  68. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  69. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +2 -2
  70. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -1
  71. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +263 -263
  72. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  73. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +6 -6
  74. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -1
  75. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +423 -423
  76. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  77. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +214 -214
  78. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  79. package/dist/collection/components/molecules/mg-details/mg-details.js +155 -150
  80. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  81. package/dist/collection/components/molecules/mg-form/mg-form.conf.js +9 -0
  82. package/dist/collection/components/molecules/mg-form/mg-form.conf.js.map +1 -0
  83. package/dist/collection/components/molecules/mg-form/mg-form.js +405 -327
  84. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  85. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +85 -85
  86. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  87. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +203 -188
  88. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  89. package/dist/collection/components/molecules/mg-message/mg-message.js +325 -304
  90. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  91. package/dist/collection/components/molecules/mg-modal/mg-modal.js +317 -317
  92. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  93. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +2 -2
  94. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js.map +1 -1
  95. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +216 -216
  96. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  97. package/dist/collection/components/molecules/mg-panel/mg-panel.js +409 -399
  98. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  99. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +91 -91
  100. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  101. package/dist/collection/components/molecules/mg-popover/mg-popover.js +336 -329
  102. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  103. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +94 -94
  104. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  105. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +4 -4
  106. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js.map +1 -1
  107. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +348 -343
  108. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  109. package/dist/collection/locales/fr/messages.json +4 -4
  110. package/dist/collection/locales/index.spec.js +20 -20
  111. package/dist/collection/locales/index.spec.js.map +1 -1
  112. package/dist/collection/utils/behaviors.utils.js +127 -127
  113. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  114. package/dist/collection/utils/behaviors.utils.spec.js +46 -42
  115. package/dist/collection/utils/behaviors.utils.spec.js.map +1 -1
  116. package/dist/collection/utils/components.utils.js +77 -75
  117. package/dist/collection/utils/components.utils.js.map +1 -1
  118. package/dist/collection/utils/components.utils.spec.js +150 -140
  119. package/dist/collection/utils/components.utils.spec.js.map +1 -1
  120. package/dist/collection/utils/e2e.test.utils.js +21 -21
  121. package/dist/collection/utils/e2e.test.utils.js.map +1 -1
  122. package/dist/collection/utils/locale.utils.js +17 -17
  123. package/dist/collection/utils/locale.utils.js.map +1 -1
  124. package/dist/collection/utils/locale.utils.spec.js +45 -45
  125. package/dist/collection/utils/locale.utils.spec.js.map +1 -1
  126. package/dist/collection/utils/playwright.e2e.test.utils.js +41 -41
  127. package/dist/collection/utils/playwright.e2e.test.utils.js.map +1 -1
  128. package/dist/collection/utils/playwright.fixture.js +24 -0
  129. package/dist/collection/utils/playwright.fixture.js.map +1 -0
  130. package/dist/collection/utils/unit.test.utils.js +50 -50
  131. package/dist/collection/utils/unit.test.utils.js.map +1 -1
  132. package/dist/components/MgInput.js +98 -98
  133. package/dist/components/MgInput.js.map +1 -1
  134. package/dist/components/components.utils.js +78 -76
  135. package/dist/components/components.utils.js.map +1 -1
  136. package/dist/components/index2.js +21 -21
  137. package/dist/components/index2.js.map +1 -1
  138. package/dist/components/mg-action-more.d.ts +2 -2
  139. package/dist/components/mg-action-more.js +173 -173
  140. package/dist/components/mg-action-more.js.map +1 -1
  141. package/dist/components/mg-badge.d.ts +2 -2
  142. package/dist/components/mg-badge2.js +83 -83
  143. package/dist/components/mg-badge2.js.map +1 -1
  144. package/dist/components/mg-button.d.ts +2 -2
  145. package/dist/components/mg-button2.js +182 -182
  146. package/dist/components/mg-button2.js.map +1 -1
  147. package/dist/components/mg-card.d.ts +2 -2
  148. package/dist/components/mg-card2.js +77 -77
  149. package/dist/components/mg-card2.js.map +1 -1
  150. package/dist/components/mg-character-left.d.ts +2 -2
  151. package/dist/components/mg-character-left2.js +50 -50
  152. package/dist/components/mg-character-left2.js.map +1 -1
  153. package/dist/components/mg-details.d.ts +2 -2
  154. package/dist/components/mg-details.js +69 -69
  155. package/dist/components/mg-details.js.map +1 -1
  156. package/dist/components/mg-divider.d.ts +2 -2
  157. package/dist/components/mg-divider.js +30 -30
  158. package/dist/components/mg-divider.js.map +1 -1
  159. package/dist/components/mg-form.d.ts +2 -2
  160. package/dist/components/mg-form.js +203 -171
  161. package/dist/components/mg-form.js.map +1 -1
  162. package/dist/components/mg-icon.d.ts +2 -2
  163. package/dist/components/mg-icon2.js +319 -317
  164. package/dist/components/mg-icon2.js.map +1 -1
  165. package/dist/components/mg-illustrated-message.d.ts +2 -2
  166. package/dist/components/mg-illustrated-message.js +51 -51
  167. package/dist/components/mg-illustrated-message.js.map +1 -1
  168. package/dist/components/mg-input-checkbox-paginated.d.ts +2 -2
  169. package/dist/components/mg-input-checkbox-paginated2.js +170 -170
  170. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  171. package/dist/components/mg-input-checkbox.d.ts +2 -2
  172. package/dist/components/mg-input-checkbox.js +477 -480
  173. package/dist/components/mg-input-checkbox.js.map +1 -1
  174. package/dist/components/mg-input-date.d.ts +2 -2
  175. package/dist/components/mg-input-date.js +265 -265
  176. package/dist/components/mg-input-date.js.map +1 -1
  177. package/dist/components/mg-input-numeric.d.ts +2 -2
  178. package/dist/components/mg-input-numeric.js +353 -353
  179. package/dist/components/mg-input-numeric.js.map +1 -1
  180. package/dist/components/mg-input-password.d.ts +2 -2
  181. package/dist/components/mg-input-password.js +204 -204
  182. package/dist/components/mg-input-password.js.map +1 -1
  183. package/dist/components/mg-input-radio.d.ts +2 -2
  184. package/dist/components/mg-input-radio.js +234 -234
  185. package/dist/components/mg-input-radio.js.map +1 -1
  186. package/dist/components/mg-input-select.d.ts +2 -2
  187. package/dist/components/mg-input-select2.js +315 -315
  188. package/dist/components/mg-input-select2.js.map +1 -1
  189. package/dist/components/mg-input-text.d.ts +2 -2
  190. package/dist/components/mg-input-text2.js +305 -305
  191. package/dist/components/mg-input-text2.js.map +1 -1
  192. package/dist/components/mg-input-textarea.d.ts +2 -2
  193. package/dist/components/mg-input-textarea.js +276 -276
  194. package/dist/components/mg-input-textarea.js.map +1 -1
  195. package/dist/components/mg-input-title.d.ts +2 -2
  196. package/dist/components/mg-input-title2.js +60 -60
  197. package/dist/components/mg-input-title2.js.map +1 -1
  198. package/dist/components/mg-input-toggle.d.ts +2 -2
  199. package/dist/components/mg-input-toggle.js +251 -251
  200. package/dist/components/mg-input-toggle.js.map +1 -1
  201. package/dist/components/mg-item-more.d.ts +2 -2
  202. package/dist/components/mg-item-more.js +298 -283
  203. package/dist/components/mg-item-more.js.map +1 -1
  204. package/dist/components/mg-menu-item.d.ts +2 -2
  205. package/dist/components/mg-menu-item2.js +345 -345
  206. package/dist/components/mg-menu-item2.js.map +1 -1
  207. package/dist/components/mg-menu.conf.js +2 -2
  208. package/dist/components/mg-menu.conf.js.map +1 -1
  209. package/dist/components/mg-menu.d.ts +2 -2
  210. package/dist/components/mg-menu2.js +176 -176
  211. package/dist/components/mg-menu2.js.map +1 -1
  212. package/dist/components/mg-message.d.ts +2 -2
  213. package/dist/components/mg-message.js +197 -192
  214. package/dist/components/mg-message.js.map +1 -1
  215. package/dist/components/mg-modal.d.ts +2 -2
  216. package/dist/components/mg-modal.js +198 -198
  217. package/dist/components/mg-modal.js.map +1 -1
  218. package/dist/components/mg-pagination.d.ts +2 -2
  219. package/dist/components/mg-pagination2.js +133 -133
  220. package/dist/components/mg-pagination2.js.map +1 -1
  221. package/dist/components/mg-panel.d.ts +2 -2
  222. package/dist/components/mg-panel.js +238 -238
  223. package/dist/components/mg-panel.js.map +1 -1
  224. package/dist/components/mg-popover-content.d.ts +2 -2
  225. package/dist/components/mg-popover-content2.js +69 -69
  226. package/dist/components/mg-popover-content2.js.map +1 -1
  227. package/dist/components/mg-popover.d.ts +2 -2
  228. package/dist/components/mg-popover2.js +224 -222
  229. package/dist/components/mg-popover2.js.map +1 -1
  230. package/dist/components/mg-skip-links.d.ts +2 -2
  231. package/dist/components/mg-skip-links.js +57 -57
  232. package/dist/components/mg-skip-links.js.map +1 -1
  233. package/dist/components/mg-tabs.d.ts +2 -2
  234. package/dist/components/mg-tabs.js +243 -243
  235. package/dist/components/mg-tabs.js.map +1 -1
  236. package/dist/components/mg-tag.d.ts +2 -2
  237. package/dist/components/mg-tag.js +97 -97
  238. package/dist/components/mg-tag.js.map +1 -1
  239. package/dist/components/mg-tooltip-content.d.ts +2 -2
  240. package/dist/components/mg-tooltip-content2.js +30 -30
  241. package/dist/components/mg-tooltip-content2.js.map +1 -1
  242. package/dist/components/mg-tooltip.d.ts +2 -2
  243. package/dist/components/mg-tooltip2.js +316 -316
  244. package/dist/components/mg-tooltip2.js.map +1 -1
  245. package/dist/esm/{components.utils-6cf27db1.js → components.utils-0d67c31c.js} +102 -100
  246. package/dist/esm/components.utils-0d67c31c.js.map +1 -0
  247. package/dist/esm/{index-0f833068.js → index-f34a3a2c.js} +185 -87
  248. package/dist/esm/index-f34a3a2c.js.map +1 -0
  249. package/dist/esm/loader.js +3 -3
  250. package/dist/esm/mg-action-more_34.entry.js +5140 -5107
  251. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  252. package/dist/esm/mg-components.js +4 -4
  253. package/dist/esm/mg-components.js.map +1 -1
  254. package/dist/esm/mg-item-more.entry.js +237 -222
  255. package/dist/esm/mg-item-more.entry.js.map +1 -1
  256. package/dist/mg-components/locales/fr/messages.json +4 -4
  257. package/dist/mg-components/mg-components.esm.js +1 -1
  258. package/dist/mg-components/mg-components.esm.js.map +1 -1
  259. package/dist/mg-components/p-7444ff40.js +3 -0
  260. package/dist/mg-components/p-7444ff40.js.map +1 -0
  261. package/dist/mg-components/p-af42d17b.js +2 -0
  262. package/dist/mg-components/p-af42d17b.js.map +1 -0
  263. package/dist/mg-components/p-ce356bc0.entry.js +2 -0
  264. package/dist/mg-components/p-ce356bc0.entry.js.map +1 -0
  265. package/dist/mg-components/p-e591ba8f.entry.js +2 -0
  266. package/dist/mg-components/p-e591ba8f.entry.js.map +1 -0
  267. package/dist/types/assets/icons/index.d.ts +193 -0
  268. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +41 -41
  269. package/dist/types/components/atoms/mg-button/mg-button.d.ts +100 -100
  270. package/dist/types/components/atoms/mg-card/mg-card.d.ts +39 -39
  271. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +37 -37
  272. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +12 -12
  273. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +56 -56
  274. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +34 -34
  275. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +51 -51
  276. package/dist/types/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.d.ts +12 -12
  277. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +3 -3
  278. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +113 -113
  279. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +5 -5
  280. package/dist/types/components/molecules/inputs/MgInput.d.ts +16 -16
  281. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +100 -100
  282. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +26 -26
  283. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +262 -262
  284. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +4 -4
  285. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +150 -150
  286. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +4 -4
  287. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +223 -223
  288. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +142 -142
  289. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +3 -3
  290. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +152 -152
  291. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +6 -6
  292. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +193 -193
  293. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +195 -195
  294. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +181 -181
  295. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +2 -2
  296. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +141 -141
  297. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +2 -2
  298. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +97 -97
  299. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +6 -6
  300. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +179 -179
  301. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +12 -12
  302. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +72 -72
  303. package/dist/types/components/molecules/mg-details/mg-details.d.ts +45 -45
  304. package/dist/types/components/molecules/mg-form/mg-form.conf.d.ts +16 -0
  305. package/dist/types/components/molecules/mg-form/mg-form.d.ts +120 -103
  306. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +27 -27
  307. package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +5 -5
  308. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +67 -61
  309. package/dist/types/components/molecules/mg-message/mg-message.d.ts +100 -93
  310. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +107 -107
  311. package/dist/types/components/molecules/mg-pagination/mg-pagination.conf.d.ts +2 -2
  312. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +74 -74
  313. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +149 -149
  314. package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +43 -43
  315. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +88 -88
  316. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +2 -2
  317. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +40 -40
  318. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +10 -10
  319. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +118 -118
  320. package/dist/types/components.d.ts +312 -30
  321. package/dist/types/locales/index.d.ts +172 -172
  322. package/dist/types/stencil-public-runtime.d.ts +29 -0
  323. package/dist/types/utils/behaviors.utils.d.ts +65 -65
  324. package/dist/types/utils/components.utils.d.ts +32 -26
  325. package/dist/types/utils/locale.utils.d.ts +2 -2
  326. package/dist/types/utils/playwright.fixture.d.ts +3 -0
  327. package/dist/types/utils/unit.test.utils.d.ts +5 -5
  328. package/package.json +19 -33
  329. package/dist/cjs/components.utils-69435877.js.map +0 -1
  330. package/dist/cjs/index-60dd0c56.js.map +0 -1
  331. package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js +0 -33
  332. package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js.map +0 -1
  333. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +0 -70
  334. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +0 -1
  335. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +0 -91
  336. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +0 -1
  337. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +0 -192
  338. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +0 -1
  339. package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js +0 -36
  340. package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js.map +0 -1
  341. package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js +0 -43
  342. package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js.map +0 -1
  343. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js +0 -15
  344. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js.map +0 -1
  345. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js +0 -42
  346. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js.map +0 -1
  347. package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js +0 -11
  348. package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js.map +0 -1
  349. package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js +0 -14
  350. package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js.map +0 -1
  351. package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js +0 -55
  352. package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js.map +0 -1
  353. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +0 -84
  354. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +0 -1
  355. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js +0 -12
  356. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js.map +0 -1
  357. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js +0 -23
  358. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js.map +0 -1
  359. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +0 -23
  360. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +0 -1
  361. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +0 -71
  362. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +0 -1
  363. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +0 -138
  364. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +0 -1
  365. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +0 -272
  366. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +0 -1
  367. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +0 -237
  368. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +0 -1
  369. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +0 -634
  370. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +0 -1
  371. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js +0 -123
  372. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js.map +0 -1
  373. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +0 -383
  374. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +0 -1
  375. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js +0 -212
  376. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js.map +0 -1
  377. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +0 -460
  378. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +0 -1
  379. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js +0 -115
  380. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js.map +0 -1
  381. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +0 -293
  382. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +0 -1
  383. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +0 -154
  384. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +0 -1
  385. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +0 -359
  386. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +0 -1
  387. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js +0 -194
  388. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js.map +0 -1
  389. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +0 -403
  390. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +0 -1
  391. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +0 -147
  392. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +0 -1
  393. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +0 -355
  394. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +0 -1
  395. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js +0 -129
  396. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js.map +0 -1
  397. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +0 -320
  398. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +0 -1
  399. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js +0 -108
  400. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js.map +0 -1
  401. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +0 -247
  402. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +0 -1
  403. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js +0 -239
  404. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js.map +0 -1
  405. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js +0 -175
  406. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js.map +0 -1
  407. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js +0 -100
  408. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js.map +0 -1
  409. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js +0 -295
  410. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js.map +0 -1
  411. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js +0 -136
  412. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js.map +0 -1
  413. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js +0 -195
  414. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js.map +0 -1
  415. package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js +0 -30
  416. package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js.map +0 -1
  417. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +0 -42
  418. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +0 -1
  419. package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js +0 -169
  420. package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js.map +0 -1
  421. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +0 -292
  422. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +0 -1
  423. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js +0 -39
  424. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js.map +0 -1
  425. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js +0 -36
  426. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js.map +0 -1
  427. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js +0 -85
  428. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js.map +0 -1
  429. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js +0 -106
  430. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js.map +0 -1
  431. package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js +0 -64
  432. package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js.map +0 -1
  433. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +0 -109
  434. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +0 -1
  435. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +0 -62
  436. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +0 -1
  437. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js +0 -40
  438. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js.map +0 -1
  439. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +0 -26
  440. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +0 -1
  441. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +0 -122
  442. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +0 -1
  443. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js +0 -57
  444. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js.map +0 -1
  445. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js +0 -121
  446. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js.map +0 -1
  447. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +0 -106
  448. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +0 -1
  449. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +0 -213
  450. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +0 -1
  451. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js +0 -140
  452. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +0 -1
  453. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +0 -142
  454. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +0 -1
  455. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js +0 -55
  456. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js.map +0 -1
  457. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js +0 -55
  458. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js.map +0 -1
  459. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js +0 -76
  460. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js.map +0 -1
  461. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +0 -332
  462. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +0 -1
  463. package/dist/collection/utils/stencil.e2e.test.utils.js +0 -33
  464. package/dist/collection/utils/stencil.e2e.test.utils.js.map +0 -1
  465. package/dist/esm/components.utils-6cf27db1.js.map +0 -1
  466. package/dist/esm/index-0f833068.js.map +0 -1
  467. package/dist/mg-components/p-10ed4425.entry.js +0 -2
  468. package/dist/mg-components/p-10ed4425.entry.js.map +0 -1
  469. package/dist/mg-components/p-36a51c5e.js +0 -2
  470. package/dist/mg-components/p-36a51c5e.js.map +0 -1
  471. package/dist/mg-components/p-91feda5a.entry.js +0 -2
  472. package/dist/mg-components/p-91feda5a.entry.js.map +0 -1
  473. package/dist/mg-components/p-9b12021b.js +0 -3
  474. package/dist/mg-components/p-9b12021b.js.map +0 -1
  475. package/dist/types/components/atoms/mg-badge/test/mg-badge.e2e.playwright.d.ts +0 -1
  476. package/dist/types/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.d.ts +0 -1
  477. package/dist/types/components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts +0 -1
  478. package/dist/types/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.d.ts +0 -1
  479. package/dist/types/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.d.ts +0 -1
  480. package/dist/types/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.d.ts +0 -1
  481. package/dist/types/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.d.ts +0 -1
  482. package/dist/types/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.d.ts +0 -1
  483. package/dist/types/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.d.ts +0 -2
  484. package/dist/types/components/molecules/mg-details/test/mg-details.e2e.playwright.d.ts +0 -1
  485. package/dist/types/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.d.ts +0 -1
  486. package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.playwright.d.ts +0 -1
  487. package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.template.d.ts +0 -12
  488. package/dist/types/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.d.ts +0 -1
  489. package/dist/types/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.d.ts +0 -1
  490. package/dist/types/components/molecules/mg-panel/test/mg-panel.e2e.playwright.d.ts +0 -1
  491. package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +0 -1
  492. package/dist/types/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.d.ts +0 -1
  493. package/dist/types/utils/stencil.e2e.test.utils.d.ts +0 -14
@@ -1 +1 @@
1
- {"version":3,"file":"unit.test.utils.js","sourceRoot":"","sources":["../../src/utils/unit.test.utils.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAY,EAAW,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAuBpF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAmC,EAA2B,EAAE;EAC1I,MAAM,oBAAoB;IAKxB,YAAY,EAAE;MAJd,eAAU,GAAe,UAAU,CAAC;MACpC,YAAO,GAA2D,OAAO,CAAC;MAC1E,gBAAW,GAA2B,WAAW,CAAC;MAGhD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;GACF;EAED,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EA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AM,cAAc,GAAG,CAAC,SAAkB,EAAE,EAAU,EAAE,kBAAkB,GAAG,QAAQ,EAAQ,EAAE;EACpG,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;EACjE,IAAI,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACnE,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,YAAY,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;GAC1F;AACH,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAS,EAAE;EACzC,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC;EACpC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;EAC1C,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;IAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;MAAE,aAAa,CAAC,KAAK,CAAC,CAAC;EACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAS,EAAE;EACzC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;IACtC,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;GACrB,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\nimport { MockCustomEvent } from '@stencil/core/mock-doc';\n\n/**\n * Clone Deep function\n * @param obj - object to clone\n * @returns cloned json\n */\nexport const cloneDeep = (obj: unknown): unknown => JSON.parse(JSON.stringify(obj));\n\n/**\n * Utility function that mocks the `MutationObserver` API. Recommended to execute inside `beforeEach`.\n * @param mutationObserverMock - Parameter that is sent to the `Object.defineProperty`\n * overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only\n * mock the mutation observer, but its methods.\n * You can manually fire an intersection entry:\n * @param mutationObserverMock - configuration object\n * @returns Mocked MutationObserver\n * @example\n * ```\n * let fireMo;\n * setupMutationObserverMock({\n * observe: function () {\n * fireMo = this.cb;\n * },\n * });\n * ...\n * fireMo([{ type: 'childList', addedNodes: [AMockElemenet, AnotherMockElemenet], target: yourMockElemenet }]);;\n * ```\n */\ntype SetupMutationObserverMockParams = { disconnect: MutationObserver['disconnect']; observe: MutationObserver['observe']; takeRecords: MutationObserver['takeRecords'] };\nexport const setupMutationObserverMock = ({ disconnect, observe, takeRecords }: SetupMutationObserverMockParams): typeof MutationObserver => {\n class MockMutationObserver implements MutationObserver {\n disconnect: () => void = disconnect;\n observe: (target: Node, options?: MutationObserverInit) => void = observe;\n takeRecords: () => MutationRecord[] = takeRecords;\n cb: () => unknown;\n constructor(fn) {\n this.cb = fn;\n }\n }\n\n [window, global].forEach(element => {\n Object.defineProperty(element, 'MutationObserver', {\n writable: true,\n configurable: true,\n value: MockMutationObserver,\n });\n });\n\n return MockMutationObserver;\n};\n\ntype setupResizeObserverMockParams = { disconnect: ResizeObserver['disconnect']; observe: ResizeObserver['observe'] };\n\n/**\n * Utility function that mocks the `ResizeObserver` API. Recommended to execute inside `beforeEach`.\n * @param resizeObserverMock - Parameter that is sent to the `Object.defineProperty`\n * overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only\n * mock the resize observer, but its methods.\n * You can manually fire an intersection entry:\n * @param resizeObserverMock - configuration object\n * @returns Mocked ResizeObserver\n * @example\n * ```\n * let fireRo;\n * setupResizeObserverMock({\n * observe: function () {\n * fireRo = this.cb;\n * },\n * });\n * ...\n * fireRo([{\n * borderBoxSize: ResizeObserverSize[],\n * contentBoxSize: ResizeObserverSize[],\n * contentRect: DOMRectReadOnly,\n * devicePixelContentBoxSize: ResizeObserverSize[],\n * target: yourMockElemenet\n * }]);;\n * ```\n */\nexport const setupResizeObserverMock = ({ disconnect, observe }: setupResizeObserverMockParams): typeof ResizeObserver => {\n class MockResizeObserver implements ResizeObserver {\n disconnect: () => void = disconnect;\n observe: (target: Element, options?: ResizeObserverOptions) => void = observe;\n unobserve: () => void;\n cb: () => unknown;\n constructor(fn) {\n this.cb = fn;\n }\n }\n\n [window, global].forEach(element => {\n Object.defineProperty(element, 'ResizeObserver', {\n writable: true,\n configurable: true,\n value: MockResizeObserver,\n });\n });\n\n return MockResizeObserver;\n};\n\n/**\n * Utility function that mocks the `SubmitEvent` API. Recommended to execute inside `beforeEach`.\n * @example\n * ```\n * setupSubmitEventMock();\n * ```\n * @returns custom event mock\n */\nexport const setupSubmitEventMock = (): typeof MockCustomEvent => {\n class SubmitEvent extends MockCustomEvent {}\n\n [window, global].forEach(element => {\n Object.defineProperty(element, 'SubmitEvent', {\n writable: true,\n configurable: true,\n value: SubmitEvent,\n });\n });\n\n return SubmitEvent;\n};\n\n/**\n * force popover id when component use randomed identifier\n * @param component - element wich include mg-popover\n * @param id - new fixed id\n * @param interactiveElement - element where attribute 'aria-controls' is set\n */\nexport const forcePopoverId = (component: Element, id: string, interactiveElement = 'button'): void => {\n const popover = component.shadowRoot.querySelector('mg-popover');\n if (popover !== null) {\n popover.querySelector('mg-popover-content').setAttribute('id', id);\n component.shadowRoot.querySelector(interactiveElement).setAttribute('aria-controls', id);\n }\n};\n\n/**\n * fix popper console.error in test\n * it is generated in `@popperjs/core/dist/cjs/popper.js l.1859`\n * this is due to internal function isHTMLElement(), so we can not mock it directly.\n * this function check if test DOM element mockHTMLElement instance is 'instanceof HTMLElement'\n * so we only override the console.error side effect for this error\n */\nexport const mockConsoleError = (): void => {\n const errorFunction = console.error;\n const mock = jest.spyOn(console, 'error');\n mock.mockImplementation(error => {\n if (!error.includes('Popper')) errorFunction(error);\n });\n};\n\n/**\n * Add missing window.frames property to test context\n * usefull for component with iframe listeners, ex: mg-popover\n */\nexport const mockWindowFrames = (): void => {\n Object.defineProperty(window, 'frames', {\n value: { length: 0 },\n });\n};\n"]}
1
+ {"version":3,"file":"unit.test.utils.js","sourceRoot":"","sources":["../../src/utils/unit.test.utils.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAY,EAAW,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAuBpF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAmC,EAA2B,EAAE;IAC1I,MAAM,oBAAoB;QAKxB,YAAY,EAAE;YAJd,eAAU,GAAe,UAAU,CAAC;YACpC,YAAO,GAA2D,OAAO,CAAC;YAC1E,gBAAW,GAA2B,WAAW,CAAC;YAGhD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,CAAC;KACF;IAED,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QACjC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE;YACjD,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,oBAAoB;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAiC,EAAyB,EAAE;IACvH,MAAM,kBAAkB;QAKtB,YAAY,EAAE;YAJd,eAAU,GAAe,UAAU,CAAC;YACpC,YAAO,GAA+D,OAAO,CAAC;YAI5E,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,CAAC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G,OAAO,CAAC,KAAK,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1C,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;QAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAS,EAAE;IACzC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;QACtC,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;KACrB,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\nimport { MockCustomEvent } from '@stencil/core/mock-doc';\n\n/**\n * Clone Deep function\n * @param obj - object to clone\n * @returns cloned json\n */\nexport const cloneDeep = (obj: unknown): unknown => JSON.parse(JSON.stringify(obj));\n\n/**\n * Utility function that mocks the `MutationObserver` API. Recommended to execute inside `beforeEach`.\n * @param mutationObserverMock - Parameter that is sent to the `Object.defineProperty`\n * overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only\n * mock the mutation observer, but its methods.\n * You can manually fire an intersection entry:\n * @param mutationObserverMock - configuration object\n * @returns Mocked MutationObserver\n * @example\n * ```\n * let fireMo;\n * setupMutationObserverMock({\n * observe: function () {\n * fireMo = this.cb;\n * },\n * });\n * ...\n * fireMo([{ type: 'childList', addedNodes: [AMockElemenet, AnotherMockElemenet], target: yourMockElemenet }]);;\n * ```\n */\ntype SetupMutationObserverMockParams = { disconnect: MutationObserver['disconnect']; observe: MutationObserver['observe']; takeRecords: MutationObserver['takeRecords'] };\nexport const setupMutationObserverMock = ({ disconnect, observe, takeRecords }: SetupMutationObserverMockParams): typeof MutationObserver => {\n class MockMutationObserver implements MutationObserver {\n disconnect: () => void = disconnect;\n observe: (target: Node, options?: MutationObserverInit) => void = observe;\n takeRecords: () => MutationRecord[] = takeRecords;\n cb: () => unknown;\n constructor(fn) {\n this.cb = fn;\n }\n }\n\n [window, global].forEach(element => {\n Object.defineProperty(element, 'MutationObserver', {\n writable: true,\n configurable: true,\n value: MockMutationObserver,\n });\n });\n\n return MockMutationObserver;\n};\n\ntype setupResizeObserverMockParams = { disconnect: ResizeObserver['disconnect']; observe: ResizeObserver['observe'] };\n\n/**\n * Utility function that mocks the `ResizeObserver` API. Recommended to execute inside `beforeEach`.\n * @param resizeObserverMock - Parameter that is sent to the `Object.defineProperty`\n * overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only\n * mock the resize observer, but its methods.\n * You can manually fire an intersection entry:\n * @param resizeObserverMock - configuration object\n * @returns Mocked ResizeObserver\n * @example\n * ```\n * let fireRo;\n * setupResizeObserverMock({\n * observe: function () {\n * fireRo = this.cb;\n * },\n * });\n * ...\n * fireRo([{\n * borderBoxSize: ResizeObserverSize[],\n * contentBoxSize: ResizeObserverSize[],\n * contentRect: DOMRectReadOnly,\n * devicePixelContentBoxSize: ResizeObserverSize[],\n * target: yourMockElemenet\n * }]);;\n * ```\n */\nexport const setupResizeObserverMock = ({ disconnect, observe }: setupResizeObserverMockParams): typeof ResizeObserver => {\n class MockResizeObserver implements ResizeObserver {\n disconnect: () => void = disconnect;\n observe: (target: Element, options?: ResizeObserverOptions) => void = observe;\n unobserve: () => void;\n cb: () => unknown;\n constructor(fn) {\n this.cb = fn;\n }\n }\n\n [window, global].forEach(element => {\n Object.defineProperty(element, 'ResizeObserver', {\n writable: true,\n configurable: true,\n value: MockResizeObserver,\n });\n });\n\n return MockResizeObserver;\n};\n\n/**\n * Utility function that mocks the `SubmitEvent` API. Recommended to execute inside `beforeEach`.\n * @example\n * ```\n * setupSubmitEventMock();\n * ```\n * @returns custom event mock\n */\nexport const setupSubmitEventMock = (): typeof MockCustomEvent => {\n class SubmitEvent extends MockCustomEvent {}\n\n [window, global].forEach(element => {\n Object.defineProperty(element, 'SubmitEvent', {\n writable: true,\n configurable: true,\n value: SubmitEvent,\n });\n });\n\n return SubmitEvent;\n};\n\n/**\n * force popover id when component use randomed identifier\n * @param component - element wich include mg-popover\n * @param id - new fixed id\n * @param interactiveElement - element where attribute 'aria-controls' is set\n */\nexport const forcePopoverId = (component: Element, id: string, interactiveElement = 'button'): void => {\n const popover = component.shadowRoot.querySelector('mg-popover');\n if (popover !== null) {\n popover.querySelector('mg-popover-content').setAttribute('id', id);\n component.shadowRoot.querySelector(interactiveElement).setAttribute('aria-controls', id);\n }\n};\n\n/**\n * fix popper console.error in test\n * it is generated in `@popperjs/core/dist/cjs/popper.js l.1859`\n * this is due to internal function isHTMLElement(), so we can not mock it directly.\n * this function check if test DOM element mockHTMLElement instance is 'instanceof HTMLElement'\n * so we only override the console.error side effect for this error\n */\nexport const mockConsoleError = (): void => {\n const errorFunction = console.error;\n const mock = jest.spyOn(console, 'error');\n mock.mockImplementation(error => {\n if (!error.includes('Popper')) errorFunction(error);\n });\n};\n\n/**\n * Add missing window.frames property to test context\n * usefull for component with iframe listeners, ex: mg-popover\n */\nexport const mockWindowFrames = (): void => {\n Object.defineProperty(window, 'frames', {\n value: { length: 0 },\n });\n};\n"]}
@@ -10,8 +10,8 @@ const widths = [2, 4, 16, 'full'];
10
10
  */
11
11
  var Handler;
12
12
  (function (Handler) {
13
- Handler["BLUR"] = "blur";
14
- Handler["FOCUS"] = "focus";
13
+ Handler["BLUR"] = "blur";
14
+ Handler["FOCUS"] = "focus";
15
15
  })(Handler || (Handler = {}));
16
16
 
17
17
  /**
@@ -22,33 +22,33 @@ var Handler;
22
22
  * @returns Children with aria-describedby attribute
23
23
  */
24
24
  const applyAriadescribedBy = (children, ariaDescribedbyIDs, utils) => utils.map(children, child => {
25
- if (['input', 'select', 'textarea'].includes(child.vtag)) {
26
- return Object.assign(Object.assign({}, child), { vattrs: Object.assign(Object.assign({}, child.vattrs), { 'aria-describedby': [...ariaDescribedbyIDs].join(' ') }) });
27
- }
28
- // we recursively apply ariadescribedBy attributes to child input nodes if exists
29
- if (child.vchildren === null)
30
- return Object.assign({}, child);
31
- return Object.assign(Object.assign({}, child), { vchildren: applyAriadescribedBy(child.vchildren, ariaDescribedbyIDs, utils) });
25
+ if (['input', 'select', 'textarea'].includes(child.vtag)) {
26
+ return Object.assign(Object.assign({}, child), { vattrs: Object.assign(Object.assign({}, child.vattrs), { 'aria-describedby': [...ariaDescribedbyIDs].join(' ') }) });
27
+ }
28
+ // we recursively apply ariadescribedBy attributes to child input nodes if exists
29
+ if (child.vchildren === null)
30
+ return Object.assign({}, child);
31
+ return Object.assign(Object.assign({}, child), { vchildren: applyAriadescribedBy(child.vchildren, ariaDescribedbyIDs, utils) });
32
32
  });
33
33
  /**
34
34
  * Add classes based on props
35
35
  * @param props - MgInput Interface Props
36
36
  */
37
37
  const manageClasses = (props) => {
38
- props.classCollection.add('mg-c-input');
39
- if (props.labelOnTop)
40
- props.classCollection.add('mg-c-input--label-on-top');
41
- else
42
- props.classCollection.delete('mg-c-input--label-on-top');
43
- if (props.readonly)
44
- props.classCollection.add('mg-c-input--readonly');
45
- else
46
- props.classCollection.delete('mg-c-input--readonly');
47
- widths.forEach(width => {
48
- props.classCollection.delete(`mg-c-input--width-${width}`);
49
- });
50
- if (props.mgWidth !== undefined)
51
- props.classCollection.add(`mg-c-input--width-${props.mgWidth}`);
38
+ props.classCollection.add('mg-c-input');
39
+ if (props.labelOnTop)
40
+ props.classCollection.add('mg-c-input--label-on-top');
41
+ else
42
+ props.classCollection.delete('mg-c-input--label-on-top');
43
+ if (props.readonly)
44
+ props.classCollection.add('mg-c-input--readonly');
45
+ else
46
+ props.classCollection.delete('mg-c-input--readonly');
47
+ widths.forEach(width => {
48
+ props.classCollection.delete(`mg-c-input--width-${width}`);
49
+ });
50
+ if (props.mgWidth !== undefined)
51
+ props.classCollection.add(`mg-c-input--width-${props.mgWidth}`);
52
52
  };
53
53
  /**
54
54
  * Get tagname
@@ -64,81 +64,81 @@ const getTagName = (isFieldset, readOnly) => (!isFieldset || readOnly ? 'div' :
64
64
  * @returns input template
65
65
  */
66
66
  const MgInput = (props, children, utils) => {
67
- /**
68
- * Check required properties
69
- */
70
- if (!isValidString(props.identifier)) {
71
- throw new Error('<mg-input> prop "identifier" is required.');
72
- }
73
- if (!isValidString(props.label)) {
74
- throw new Error('<mg-input> prop "label" is required.');
75
- }
76
- if (props.labelOnTop && props.labelHide) {
77
- throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
78
- }
79
- /**
80
- * Set readonly value
81
- */
82
- if (props.readonlyValue === undefined)
83
- props.readonlyValue = props.value;
84
- /**
85
- * Component classes
86
- */
87
- manageClasses(props);
88
- /**
89
- * a11y IDs
90
- */
91
- const ariaDescribedbyIDs = new Set(props.ariaDescribedbyIDs);
92
- // Help text
93
- const helpTextId = `${props.identifier}-help-text`;
94
- if (typeof props.helpText === 'string' && props.helpText !== '') {
95
- ariaDescribedbyIDs.add(helpTextId);
96
- }
97
- // Error Message
98
- const helpTextErrorId = `${props.identifier}-error`;
99
- if (typeof props.errorMessage === 'string' && props.errorMessage !== '') {
100
- ariaDescribedbyIDs.add(helpTextErrorId);
101
- }
102
- /**
103
- * Return template
104
- *
105
- * +--------+--------------+---------+
106
- * | label | input | tooltip |
107
- * | +--------------+---------+
108
- * | | nb Char Left |
109
- * | +------------------------+
110
- * | | Help Text |
111
- * | +------------------------+
112
- * | | Error |
113
- * +--------+------------------------+
114
- *
115
- * Error message is based on this aria method: https://www.w3.org/WAI/tutorials/forms/notifications/#on-focus-change
116
- */
117
- const TagName = getTagName(props.isFieldset, props.readonly);
118
- /**
119
- * Get tooltip node
120
- * @returns mg-tooltip
121
- */
122
- const getTooltip = () => (h("mg-tooltip", { identifier: `${props.identifier}-tooltip`, message: props.tooltip },
123
- h("mg-icon", { icon: "info-circle" })));
124
- /**
125
- * Get input title (label) node
126
- * Display asterisk only if not disabled and not readonly
127
- * @returns mg-input-title
128
- */
129
- const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, readonly: props.readonly, class: props.labelHide ? 'mg-u-visually-hidden' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
130
- return (h(TagName, { class: props.classCollection.join() },
131
- props.labelOnTop ? (h("div", { class: "mg-c-input__title" },
132
- getInputTitle(),
133
- !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()),
134
- props.readonly ? (h("div", { class: "mg-c-input__input-container" },
135
- h("strong", null, props.readonlyValue),
136
- children.filter(child => Object.values(child).includes('append-input')))) : (h("div", { class: "mg-c-input__input-container" },
137
- h("div", { class: { 'mg-c-input__input': true, 'mg-c-input__input--has-error': props.errorMessage !== undefined } },
138
- applyAriadescribedBy(children, ariaDescribedbyIDs, utils),
139
- !props.labelOnTop && props.tooltip && getTooltip()),
140
- props.helpText && h("div", { id: helpTextId, class: "mg-c-input__help-text", innerHTML: props.helpText }),
141
- props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-c-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
67
+ /**
68
+ * Check required properties
69
+ */
70
+ if (!isValidString(props.identifier)) {
71
+ throw new Error('<mg-input> prop "identifier" is required.');
72
+ }
73
+ if (!isValidString(props.label)) {
74
+ throw new Error('<mg-input> prop "label" is required.');
75
+ }
76
+ if (props.labelOnTop && props.labelHide) {
77
+ throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
78
+ }
79
+ /**
80
+ * Set readonly value
81
+ */
82
+ if (props.readonlyValue === undefined)
83
+ props.readonlyValue = props.value;
84
+ /**
85
+ * Component classes
86
+ */
87
+ manageClasses(props);
88
+ /**
89
+ * a11y IDs
90
+ */
91
+ const ariaDescribedbyIDs = new Set(props.ariaDescribedbyIDs);
92
+ // Help text
93
+ const helpTextId = `${props.identifier}-help-text`;
94
+ if (typeof props.helpText === 'string' && props.helpText !== '') {
95
+ ariaDescribedbyIDs.add(helpTextId);
96
+ }
97
+ // Error Message
98
+ const helpTextErrorId = `${props.identifier}-error`;
99
+ if (typeof props.errorMessage === 'string' && props.errorMessage !== '') {
100
+ ariaDescribedbyIDs.add(helpTextErrorId);
101
+ }
102
+ /**
103
+ * Return template
104
+ *
105
+ * +--------+--------------+---------+
106
+ * | label | input | tooltip |
107
+ * | +--------------+---------+
108
+ * | | nb Char Left |
109
+ * | +------------------------+
110
+ * | | Help Text |
111
+ * | +------------------------+
112
+ * | | Error |
113
+ * +--------+------------------------+
114
+ *
115
+ * Error message is based on this aria method: https://www.w3.org/WAI/tutorials/forms/notifications/#on-focus-change
116
+ */
117
+ const TagName = getTagName(props.isFieldset, props.readonly);
118
+ /**
119
+ * Get tooltip node
120
+ * @returns mg-tooltip
121
+ */
122
+ const getTooltip = () => (h("mg-tooltip", { identifier: `${props.identifier}-tooltip`, message: props.tooltip },
123
+ h("mg-icon", { icon: "info-circle" })));
124
+ /**
125
+ * Get input title (label) node
126
+ * Display asterisk only if not disabled and not readonly
127
+ * @returns mg-input-title
128
+ */
129
+ const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, readonly: props.readonly, class: props.labelHide ? 'mg-u-visually-hidden' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
130
+ return (h(TagName, { class: props.classCollection.join() },
131
+ props.labelOnTop ? (h("div", { class: "mg-c-input__title" },
132
+ getInputTitle(),
133
+ !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()),
134
+ props.readonly ? (h("div", { class: "mg-c-input__input-container" },
135
+ h("strong", null, props.readonlyValue),
136
+ children.filter(child => Object.values(child).includes('append-input')))) : (h("div", { class: "mg-c-input__input-container" },
137
+ h("div", { class: { 'mg-c-input__input': true, 'mg-c-input__input--has-error': props.errorMessage !== undefined } },
138
+ applyAriadescribedBy(children, ariaDescribedbyIDs, utils),
139
+ !props.labelOnTop && props.tooltip && getTooltip()),
140
+ props.helpText && h("div", { id: helpTextId, class: "mg-c-input__help-text", innerHTML: props.helpText }),
141
+ props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-c-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
142
142
  };
143
143
 
144
144
  export { Handler as H, MgInput as M };
@@ -1 +1 @@
1
- {"file":"MgInput.js","mappings":";;;AAAA;;;AAGO,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,CAAU,CAAC;AAmBlD;;;IAGY;AAAZ,WAAY,OAAO;EACjB,wBAAa,CAAA;EACb,0BAAe,CAAA;AACjB,CAAC,EAHW,OAAO,KAAP,OAAO;;ACpBnB;;;;;;;AAOA,MAAM,oBAAoB,GAAG,CAAC,QAAiB,EAAE,kBAA+B,EAAE,KAA0B,KAC1G,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK;EACvB,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAc,CAAC,EAAE;IAClE,uCACK,KAAK,KACR,MAAM,kCACD,KAAK,CAAC,MAAM,KACf,kBAAkB,EAAE,CAAC,GAAG,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAEvD;GACH;;EAGD,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI;IAAE,yBAAY,KAAK,EAAG;EAClD,uCACK,KAAK,KACR,SAAS,EAAE,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,kBAAkB,EAAE,KAAK,CAAC,IAC3E;AACJ,CAAC,CAAC,CAAC;AAEL;;;;AAIA,MAAM,aAAa,GAAG,CAAC,KAAmB;EACxC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;EAExC,IAAI,KAAK,CAAC,UAAU;IAAE,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;;IACvE,KAAK,CAAC,eAAe,CAAC,MAAM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KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,IAAI,UAAU,EAAE,CAC7C,KAEN,aAAa,EAAE,CAChB;IACA,KAAK,CAAC,QAAQ,IACb,WAAK,KAAK,EAAC,6BAA6B;MACtC,kBAAS,KAAK,CAAC,aAAa,CAAU;MACrC,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CACpE,KAEN,WAAK,KAAK,EAAC,6BAA6B;MACtC,WAAK,KAAK,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE;QACxG,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,CAAC;QACzD,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,OAAO,IAAI,UAAU,EAAE,CAC/C;MACL,KAAK,CAAC,QAAQ,IAAI,WAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAC,uBAAuB,EAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,GAAQ;MACtG,KAAK,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,KACvD,WAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAC,mBAAmB,EAAC,SAAS,EAAE,KAAK,CAAC,YAAY,eAAY,WAAW,GAAO,CAChH,CACG,CACP,CACO,EACV;AACJ;;;;","names":[],"sources":["src/components/molecules/inputs/MgInput.conf.ts","src/components/molecules/inputs/MgInput.tsx"],"sourcesContent":["/**\n * Possible input width\n */\nexport const widths = [2, 4, 16, 'full'] as const;\n\nexport type Width = (typeof widths)[number];\n\n/**\n * Possible Input types\n */\n\nexport type HTMLMgInputsElement =\n | HTMLMgInputCheckboxElement\n | HTMLMgInputDateElement\n | HTMLMgInputNumericElement\n | HTMLMgInputPasswordElement\n | HTMLMgInputRadioElement\n | HTMLMgInputSelectElement\n | HTMLMgInputTextElement\n | HTMLMgInputTextareaElement\n | (HTMLMgInputToggleElement & { required: true; invalid: false; displayError: () => void });\n\n/**\n * Available handlers\n */\nexport enum Handler {\n BLUR = 'blur',\n FOCUS = 'focus',\n}\n","import { FunctionalComponent, h, VNode, FunctionalUtilities } from '@stencil/core';\nimport { widths, Width } from './MgInput.conf';\nimport { ClassList, isValidString } from '../../../utils/components.utils';\nimport { MgInputTitle } from '../../atoms/mg-input-title/mg-input-title';\n\n/**\n * Apply in all input child node the aria-describedby attribute\n * @param children - Represent scoped elements\n * @param ariaDescribedbyIDs - List of IDs\n * @param utils - Stencil.js utils\n * @returns Children with aria-describedby attribute\n */\nconst applyAriadescribedBy = (children: VNode[], ariaDescribedbyIDs: Set<string>, utils: FunctionalUtilities): VNode[] =>\n utils.map(children, child => {\n if (['input', 'select', 'textarea'].includes(child.vtag as string)) {\n return {\n ...child,\n vattrs: {\n ...child.vattrs,\n 'aria-describedby': [...ariaDescribedbyIDs].join(' '),\n },\n };\n }\n\n // we recursively apply ariadescribedBy attributes to child input nodes if exists\n if (child.vchildren === null) return { ...child };\n return {\n ...child,\n vchildren: applyAriadescribedBy(child.vchildren, ariaDescribedbyIDs, utils),\n };\n });\n\n/**\n * Add classes based on props\n * @param props - MgInput Interface Props\n */\nconst manageClasses = (props: MgInputProps): void => {\n props.classCollection.add('mg-c-input');\n\n if (props.labelOnTop) props.classCollection.add('mg-c-input--label-on-top');\n else props.classCollection.delete('mg-c-input--label-on-top');\n\n if (props.readonly) props.classCollection.add('mg-c-input--readonly');\n else props.classCollection.delete('mg-c-input--readonly');\n\n widths.forEach(width => {\n props.classCollection.delete(`mg-c-input--width-${width}`);\n });\n if (props.mgWidth !== undefined) props.classCollection.add(`mg-c-input--width-${props.mgWidth}`);\n};\n\n/**\n * Get tagname\n * @param isFieldset - is fieldset\n * @returns tag name\n */\nconst getTagName = (isFieldset: MgInputProps['isFieldset'], readOnly: MgInputProps['readonly']): string => (!isFieldset || readOnly ? 'div' : 'fieldset');\n\n/**\n * MgInput Interface\n */\ninterface MgInputProps {\n // Global\n identifier: string;\n classCollection: ClassList;\n // Label\n label: string;\n labelOnTop: boolean;\n labelHide: boolean;\n isFieldset: MgInputTitle['isLegend'];\n // Input\n value: string;\n readonlyValue: string;\n required: boolean;\n readonly: boolean;\n mgWidth: Width;\n disabled: boolean;\n // Tooltip\n tooltip: string;\n // Help Text\n helpText: string;\n // Error Message\n errorMessage: string;\n // ariaDescribedbyIDs\n ariaDescribedbyIDs: string[];\n}\n\n/**\n * Get input template\n * @param props - MgInput Interface Props\n * @param children - Represent scoped elements\n * @param utils - Stencil.js utils\n * @returns input template\n */\nexport const MgInput: FunctionalComponent<MgInputProps> = (props: MgInputProps, children: VNode[], utils: FunctionalUtilities): VNode[] => {\n /**\n * Check required properties\n */\n if (!isValidString(props.identifier)) {\n throw new Error('<mg-input> prop \"identifier\" is required.');\n }\n if (!isValidString(props.label)) {\n throw new Error('<mg-input> prop \"label\" is required.');\n }\n if (props.labelOnTop && props.labelHide) {\n throw new Error('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\".');\n }\n\n /**\n * Set readonly value\n */\n if (props.readonlyValue === undefined) props.readonlyValue = props.value;\n\n /**\n * Component classes\n */\n manageClasses(props);\n\n /**\n * a11y IDs\n */\n const ariaDescribedbyIDs: Set<string> = new Set(props.ariaDescribedbyIDs);\n\n // Help text\n const helpTextId = `${props.identifier}-help-text`;\n if (typeof props.helpText === 'string' && props.helpText !== '') {\n ariaDescribedbyIDs.add(helpTextId);\n }\n\n // Error Message\n const helpTextErrorId = `${props.identifier}-error`;\n if (typeof props.errorMessage === 'string' && props.errorMessage !== '') {\n ariaDescribedbyIDs.add(helpTextErrorId);\n }\n\n /**\n * Return template\n *\n * +--------+--------------+---------+\n * | label | input | tooltip |\n * | +--------------+---------+\n * | | nb Char Left |\n * | +------------------------+\n * | | Help Text |\n * | +------------------------+\n * | | Error |\n * +--------+------------------------+\n *\n * Error message is based on this aria method: https://www.w3.org/WAI/tutorials/forms/notifications/#on-focus-change\n */\n\n const TagName = getTagName(props.isFieldset, props.readonly);\n\n /**\n * Get tooltip node\n * @returns mg-tooltip\n */\n const getTooltip = (): VNode[] => (\n <mg-tooltip identifier={`${props.identifier}-tooltip`} message={props.tooltip}>\n <mg-icon icon=\"info-circle\"></mg-icon>\n </mg-tooltip>\n );\n\n /**\n * Get input title (label) node\n * Display asterisk only if not disabled and not readonly\n * @returns mg-input-title\n */\n const getInputTitle = (): VNode[] => (\n <mg-input-title\n identifier={props.identifier}\n readonly={props.readonly}\n class={props.labelHide ? 'mg-u-visually-hidden' : undefined}\n required={props.required && !props.disabled && !props.readonly}\n is-legend={props.isFieldset}\n >\n {props.label}\n </mg-input-title>\n );\n\n return (\n <TagName class={props.classCollection.join()}>\n {props.labelOnTop ? (\n <div class=\"mg-c-input__title\">\n {getInputTitle()}\n {!props.readonly && props.tooltip && getTooltip()}\n </div>\n ) : (\n getInputTitle()\n )}\n {props.readonly ? (\n <div class=\"mg-c-input__input-container\">\n <strong>{props.readonlyValue}</strong>\n {children.filter(child => Object.values(child).includes('append-input'))}\n </div>\n ) : (\n <div class=\"mg-c-input__input-container\">\n <div class={{ 'mg-c-input__input': true, 'mg-c-input__input--has-error': props.errorMessage !== undefined }}>\n {applyAriadescribedBy(children, ariaDescribedbyIDs, utils)}\n {!props.labelOnTop && props.tooltip && getTooltip()}\n </div>\n {props.helpText && <div id={helpTextId} class=\"mg-c-input__help-text\" innerHTML={props.helpText}></div>}\n {props.errorMessage && !props.readonly && !props.disabled && (\n <div id={helpTextErrorId} class=\"mg-c-input__error\" innerHTML={props.errorMessage} aria-live=\"assertive\"></div>\n )}\n </div>\n )}\n </TagName>\n );\n};\n"],"version":3}
1
+ {"file":"MgInput.js","mappings":";;;AAAA;;;AAGO,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,CAAU,CAAC;AAmBlD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WAAK,KAAK,EAAC,6BAA6B;YACtC,WAAK,KAAK,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE;gBACxG,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,CAAC;gBACzD,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,OAAO,IAAI,UAAU,EAAE,CAC/C;YACL,KAAK,CAAC,QAAQ,IAAI,WAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAC,uBAAuB,EAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,GAAQ;YACtG,KAAK,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,KACvD,WAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAC,mBAAmB,EAAC,SAAS,EAAE,KAAK,CAAC,YAAY,eAAY,WAAW,GAAO,CAChH,CACG,CACP,CACO,EACV;AACJ;;;;","names":[],"sources":["src/components/molecules/inputs/MgInput.conf.ts","src/components/molecules/inputs/MgInput.tsx"],"sourcesContent":["/**\n * Possible input width\n */\nexport const widths = [2, 4, 16, 'full'] as const;\n\nexport type Width = (typeof widths)[number];\n\n/**\n * Possible Input types\n */\n\nexport type HTMLMgInputsElement =\n | HTMLMgInputCheckboxElement\n | HTMLMgInputDateElement\n | HTMLMgInputNumericElement\n | HTMLMgInputPasswordElement\n | HTMLMgInputRadioElement\n | HTMLMgInputSelectElement\n | HTMLMgInputTextElement\n | HTMLMgInputTextareaElement\n | (HTMLMgInputToggleElement & { required: true; invalid: false; displayError: () => void });\n\n/**\n * Available handlers\n */\nexport enum Handler {\n BLUR = 'blur',\n FOCUS = 'focus',\n}\n","import { FunctionalComponent, h, VNode, FunctionalUtilities } from '@stencil/core';\nimport { widths, Width } from './MgInput.conf';\nimport { ClassList, isValidString } from '../../../utils/components.utils';\nimport { MgInputTitle } from '../../atoms/mg-input-title/mg-input-title';\n\n/**\n * Apply in all input child node the aria-describedby attribute\n * @param children - Represent scoped elements\n * @param ariaDescribedbyIDs - List of IDs\n * @param utils - Stencil.js utils\n * @returns Children with aria-describedby attribute\n */\nconst applyAriadescribedBy = (children: VNode[], ariaDescribedbyIDs: Set<string>, utils: FunctionalUtilities): VNode[] =>\n utils.map(children, child => {\n if (['input', 'select', 'textarea'].includes(child.vtag as string)) {\n return {\n ...child,\n vattrs: {\n ...child.vattrs,\n 'aria-describedby': [...ariaDescribedbyIDs].join(' '),\n },\n };\n }\n\n // we recursively apply ariadescribedBy attributes to child input nodes if exists\n if (child.vchildren === null) return { ...child };\n return {\n ...child,\n vchildren: applyAriadescribedBy(child.vchildren, ariaDescribedbyIDs, utils),\n };\n });\n\n/**\n * Add classes based on props\n * @param props - MgInput Interface Props\n */\nconst manageClasses = (props: MgInputProps): void => {\n props.classCollection.add('mg-c-input');\n\n if (props.labelOnTop) props.classCollection.add('mg-c-input--label-on-top');\n else props.classCollection.delete('mg-c-input--label-on-top');\n\n if (props.readonly) props.classCollection.add('mg-c-input--readonly');\n else props.classCollection.delete('mg-c-input--readonly');\n\n widths.forEach(width => {\n props.classCollection.delete(`mg-c-input--width-${width}`);\n });\n if (props.mgWidth !== undefined) props.classCollection.add(`mg-c-input--width-${props.mgWidth}`);\n};\n\n/**\n * Get tagname\n * @param isFieldset - is fieldset\n * @returns tag name\n */\nconst getTagName = (isFieldset: MgInputProps['isFieldset'], readOnly: MgInputProps['readonly']): string => (!isFieldset || readOnly ? 'div' : 'fieldset');\n\n/**\n * MgInput Interface\n */\ninterface MgInputProps {\n // Global\n identifier: string;\n classCollection: ClassList;\n // Label\n label: string;\n labelOnTop: boolean;\n labelHide: boolean;\n isFieldset: MgInputTitle['isLegend'];\n // Input\n value: string;\n readonlyValue: string;\n required: boolean;\n readonly: boolean;\n mgWidth: Width;\n disabled: boolean;\n // Tooltip\n tooltip: string;\n // Help Text\n helpText: string;\n // Error Message\n errorMessage: string;\n // ariaDescribedbyIDs\n ariaDescribedbyIDs: string[];\n}\n\n/**\n * Get input template\n * @param props - MgInput Interface Props\n * @param children - Represent scoped elements\n * @param utils - Stencil.js utils\n * @returns input template\n */\nexport const MgInput: FunctionalComponent<MgInputProps> = (props: MgInputProps, children: VNode[], utils: FunctionalUtilities): VNode[] => {\n /**\n * Check required properties\n */\n if (!isValidString(props.identifier)) {\n throw new Error('<mg-input> prop \"identifier\" is required.');\n }\n if (!isValidString(props.label)) {\n throw new Error('<mg-input> prop \"label\" is required.');\n }\n if (props.labelOnTop && props.labelHide) {\n throw new Error('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\".');\n }\n\n /**\n * Set readonly value\n */\n if (props.readonlyValue === undefined) props.readonlyValue = props.value;\n\n /**\n * Component classes\n */\n manageClasses(props);\n\n /**\n * a11y IDs\n */\n const ariaDescribedbyIDs: Set<string> = new Set(props.ariaDescribedbyIDs);\n\n // Help text\n const helpTextId = `${props.identifier}-help-text`;\n if (typeof props.helpText === 'string' && props.helpText !== '') {\n ariaDescribedbyIDs.add(helpTextId);\n }\n\n // Error Message\n const helpTextErrorId = `${props.identifier}-error`;\n if (typeof props.errorMessage === 'string' && props.errorMessage !== '') {\n ariaDescribedbyIDs.add(helpTextErrorId);\n }\n\n /**\n * Return template\n *\n * +--------+--------------+---------+\n * | label | input | tooltip |\n * | +--------------+---------+\n * | | nb Char Left |\n * | +------------------------+\n * | | Help Text |\n * | +------------------------+\n * | | Error |\n * +--------+------------------------+\n *\n * Error message is based on this aria method: https://www.w3.org/WAI/tutorials/forms/notifications/#on-focus-change\n */\n\n const TagName = getTagName(props.isFieldset, props.readonly);\n\n /**\n * Get tooltip node\n * @returns mg-tooltip\n */\n const getTooltip = (): VNode[] => (\n <mg-tooltip identifier={`${props.identifier}-tooltip`} message={props.tooltip}>\n <mg-icon icon=\"info-circle\"></mg-icon>\n </mg-tooltip>\n );\n\n /**\n * Get input title (label) node\n * Display asterisk only if not disabled and not readonly\n * @returns mg-input-title\n */\n const getInputTitle = (): VNode[] => (\n <mg-input-title\n identifier={props.identifier}\n readonly={props.readonly}\n class={props.labelHide ? 'mg-u-visually-hidden' : undefined}\n required={props.required && !props.disabled && !props.readonly}\n is-legend={props.isFieldset}\n >\n {props.label}\n </mg-input-title>\n );\n\n return (\n <TagName class={props.classCollection.join()}>\n {props.labelOnTop ? (\n <div class=\"mg-c-input__title\">\n {getInputTitle()}\n {!props.readonly && props.tooltip && getTooltip()}\n </div>\n ) : (\n getInputTitle()\n )}\n {props.readonly ? (\n <div class=\"mg-c-input__input-container\">\n <strong>{props.readonlyValue}</strong>\n {children.filter(child => Object.values(child).includes('append-input'))}\n </div>\n ) : (\n <div class=\"mg-c-input__input-container\">\n <div class={{ 'mg-c-input__input': true, 'mg-c-input__input--has-error': props.errorMessage !== undefined }}>\n {applyAriadescribedBy(children, ariaDescribedbyIDs, utils)}\n {!props.labelOnTop && props.tooltip && getTooltip()}\n </div>\n {props.helpText && <div id={helpTextId} class=\"mg-c-input__help-text\" innerHTML={props.helpText}></div>}\n {props.errorMessage && !props.readonly && !props.disabled && (\n <div id={helpTextErrorId} class=\"mg-c-input__error\" innerHTML={props.errorMessage} aria-live=\"assertive\"></div>\n )}\n </div>\n )}\n </TagName>\n );\n};\n"],"version":3}
@@ -5,60 +5,56 @@
5
5
  * @returns ID
6
6
  */
7
7
  const createID = (prefix = '', length = 10) => {
8
- const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
9
- const charsLength = chars.length;
10
- let ID = '';
11
- let now = Math.floor(globalThis.crypto.getRandomValues(new Uint32Array(1))[0] * Date.now());
12
- while (length > 0) {
13
- now += Math.pow(10, 6); // Add 1 millisecond to the timestamp
14
- const index = now % charsLength;
15
- ID += chars.charAt(index);
16
- length--;
17
- }
18
- return (prefix !== '' ? `${prefix}-` : '') + ID;
8
+ const randomBytes = new Uint8Array(length);
9
+ crypto.getRandomValues(randomBytes);
10
+ const hexString = Array.from(randomBytes)
11
+ .map(byte => byte.toString(16).padStart(2, '0'))
12
+ .join('')
13
+ .slice(0, length);
14
+ return prefix !== '' ? `${prefix}-${hexString}` : hexString;
19
15
  };
20
16
  /**
21
17
  * Class to manage component classlist
22
18
  * Set() are not working when imported in project
23
19
  */
24
20
  class ClassList {
25
- constructor(classlist = []) {
26
- /**
27
- * Add class
28
- * @param className - class name to add
29
- */
30
- this.add = (className) => {
31
- if (!this.has(className)) {
32
- this.classes.push(className);
33
- }
34
- };
35
- /**
36
- * Delete class
37
- * @param className - class name to delete
38
- */
39
- this.delete = (className) => {
40
- const index = this.classes.indexOf(className);
41
- if (index > -1) {
42
- this.classes.splice(index, 1);
43
- }
44
- };
45
- /**
46
- * Check if class exist in list
47
- * @param className - class name to check
48
- * @returns class name is in the list
49
- */
50
- this.has = (className) => {
51
- return this.classes.includes(className);
52
- };
53
- /**
54
- * Join classes seperated by spaces
55
- * @returns joined values
56
- */
57
- this.join = () => {
58
- return this.classes.join(' ');
59
- };
60
- this.classes = classlist;
61
- }
21
+ constructor(classlist = []) {
22
+ /**
23
+ * Add class
24
+ * @param className - class name to add
25
+ */
26
+ this.add = (className) => {
27
+ if (!this.has(className)) {
28
+ this.classes.push(className);
29
+ }
30
+ };
31
+ /**
32
+ * Delete class
33
+ * @param className - class name to delete
34
+ */
35
+ this.delete = (className) => {
36
+ const index = this.classes.indexOf(className);
37
+ if (index > -1) {
38
+ this.classes.splice(index, 1);
39
+ }
40
+ };
41
+ /**
42
+ * Check if class exist in list
43
+ * @param className - class name to check
44
+ * @returns class name is in the list
45
+ */
46
+ this.has = (className) => {
47
+ return this.classes.includes(className);
48
+ };
49
+ /**
50
+ * Join classes seperated by spaces
51
+ * @returns joined values
52
+ */
53
+ this.join = () => {
54
+ return this.classes.join(' ');
55
+ };
56
+ this.classes = classlist;
57
+ }
62
58
  }
63
59
  /**
64
60
  * Check if all items are string
@@ -73,7 +69,7 @@ const allItemsAreString = (items) => Array.isArray(items) && items.every(item =>
73
69
  * @returns element is a heading
74
70
  */
75
71
  const isTagName = (element, tagNames) => {
76
- return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
72
+ return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
77
73
  };
78
74
  /**
79
75
  * Focusable elements query selector
@@ -85,9 +81,9 @@ const focusableElements = 'a[href], button, input, textarea, select, details, [t
85
81
  * @returns The list of windows found
86
82
  */
87
83
  const getWindows = (localWindow) => {
88
- const parentWindows = getParentWindows(localWindow);
89
- const childWindows = getChildWindows(localWindow);
90
- return [localWindow, ...parentWindows, ...childWindows];
84
+ const parentWindows = getParentWindows(localWindow);
85
+ const childWindows = getChildWindows(localWindow);
86
+ return [localWindow, ...parentWindows, ...childWindows];
91
87
  };
92
88
  /**
93
89
  * Get parent windows
@@ -96,20 +92,20 @@ const getWindows = (localWindow) => {
96
92
  * @returns The list of windows found
97
93
  */
98
94
  const getParentWindows = (localWindow, windows = []) => {
99
- // Check if is in iframe
100
- if (localWindow.self !== localWindow.top) {
101
- // Check if we have permission to access parent
102
- try {
103
- const parentWindow = localWindow.parent;
104
- windows.push(parentWindow);
105
- return getParentWindows(parentWindow, windows);
106
- }
107
- catch (err) {
108
- console.error('Different hosts between iframes:', err);
109
- return windows;
95
+ // Check if is in iframe
96
+ if (localWindow.self !== localWindow.top) {
97
+ // Check if we have permission to access parent
98
+ try {
99
+ const parentWindow = localWindow.parent;
100
+ windows.push(parentWindow);
101
+ return getParentWindows(parentWindow, windows);
102
+ }
103
+ catch (err) {
104
+ console.error('Different hosts between iframes:', err);
105
+ return windows;
106
+ }
110
107
  }
111
- }
112
- return windows;
108
+ return windows;
113
109
  };
114
110
  /**
115
111
  * Get child windows
@@ -118,13 +114,13 @@ const getParentWindows = (localWindow, windows = []) => {
118
114
  * @returns The list of windows found
119
115
  */
120
116
  const getChildWindows = (localWindow, windows = []) => {
121
- if (localWindow.frames.length > 0) {
122
- for (const childWindow of Array.from(localWindow.frames)) {
123
- windows.push(childWindow);
124
- getChildWindows(childWindow, windows);
117
+ if (localWindow.frames.length > 0) {
118
+ for (const childWindow of Array.from(localWindow.frames)) {
119
+ windows.push(childWindow);
120
+ getChildWindows(childWindow, windows);
121
+ }
125
122
  }
126
- }
127
- return windows;
123
+ return windows;
128
124
  };
129
125
  /**
130
126
  * Validate string
@@ -138,11 +134,17 @@ const isValidString = (value) => typeof value === 'string' && value.trim() !== '
138
134
  * @returns cleanded string
139
135
  */
140
136
  const cleanString = (text) => typeof text === 'string' &&
141
- text
142
- .toLocaleLowerCase()
143
- .normalize('NFD')
144
- .replaceAll(/[\u0300-\u036f]/g, '');
137
+ text
138
+ .toLocaleLowerCase()
139
+ .normalize('NFD')
140
+ .replaceAll(/[\u0300-\u036f]/g, '');
141
+ /**
142
+ * Use to process code next tick in the event loop
143
+ * @param callback - code to excute on next tick
144
+ * @returns differed code excution
145
+ */
146
+ const nextTick = async (callback) => callback();
145
147
 
146
- export { ClassList as C, isTagName as a, cleanString as b, createID as c, allItemsAreString as d, focusableElements as f, getWindows as g, isValidString as i };
148
+ export { ClassList as C, isTagName as a, cleanString as b, createID as c, allItemsAreString as d, focusableElements as f, getWindows as g, isValidString as i, nextTick as n };
147
149
 
148
150
  //# sourceMappingURL=components.utils.js.map
@@ -1 +1 @@
1
- {"file":"components.utils.js","mappings":"AAAA;;;;;;MAMa,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE;EAC/C,MAAM,KAAK,GAAG,sCAAsC,CAAC;EACrD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;EAEjC,IAAI,EAAE,GAAG,EAAE,CAAC;EACZ,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;EAC5F,OAAO,MAAM,GAAG,CAAC,EAAE;IACjB,GAAG,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O,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;MAKa,aAAa,GAAG,CAAC,KAAc,KAAc,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG;AAE3G;;;;;MAKa,WAAW,GAAG,CAAC,IAAY,KACtC,OAAO,IAAI,KAAK,QAAQ;EACxB,IAAI;KACD,iBAAiB,EAAE;KACnB,SAAS,CAAC,KAAK,CAAC;KAChB,UAAU,CAAC,kBAAkB,EAAE,EAAE;;;;","names":[],"sources":["src/utils/components.utils.ts"],"sourcesContent":["/**\n * Create random ID\n * @param prefix - add prefix to created ID\n * @param length - ID length\n * @returns ID\n */\nexport const createID = (prefix = '', length = 10): string => {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';\n const charsLength = chars.length;\n\n let ID = '';\n let now = Math.floor(globalThis.crypto.getRandomValues(new Uint32Array(1))[0] * Date.now());\n while (length > 0) {\n now += Math.pow(10, 6); // Add 1 millisecond to the timestamp\n const index = now % charsLength;\n ID += chars.charAt(index);\n length--;\n }\n return (prefix !== '' ? `${prefix}-` : '') + ID;\n};\n\n/**\n * Class to manage component classlist\n * Set() are not working when imported in project\n */\nexport class ClassList {\n /**\n * Available classes\n */\n classes: string[];\n\n constructor(classlist: string[] = []) {\n this.classes = classlist;\n }\n\n /**\n * Add class\n * @param className - class name to add\n */\n add = (className: string): void => {\n if (!this.has(className)) {\n this.classes.push(className);\n }\n };\n\n /**\n * Delete class\n * @param className - class name to delete\n */\n delete = (className: string): void => {\n const index = this.classes.indexOf(className);\n if (index > -1) {\n this.classes.splice(index, 1);\n }\n };\n\n /**\n * Check if class exist in list\n * @param className - class name to check\n * @returns class name is in the list\n */\n has = (className: string): boolean => {\n return this.classes.includes(className);\n };\n\n /**\n * Join classes seperated by spaces\n * @returns joined values\n */\n join = (): string => {\n return this.classes.join(' ');\n };\n}\n\n/**\n * Check if all items are string\n * @param items - items to check\n * @returns all items are string\n */\nexport const allItemsAreString = (items: unknown): items is string[] => Array.isArray(items) && items.every(item => typeof item === 'string');\n\n/**\n * Check if element is a heading\n * @param element - slotted element\n * @param tagNames - allowed tag names list\n * @returns element is a heading\n */\nexport const isTagName = (element: Element, tagNames: string[]): boolean => {\n return tagNames.includes(element?.tagName.toLowerCase());\n};\n\n/**\n * Focusable elements query selector\n */\nexport const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier]';\n\n/**\n * Get windows\n * @param localWindow - the window we are lookink for other windows\n * @returns The list of windows found\n */\nexport const getWindows = (localWindow: Window): Window[] => {\n const parentWindows = getParentWindows(localWindow);\n const childWindows = getChildWindows(localWindow);\n return [localWindow, ...parentWindows, ...childWindows];\n};\n\n/**\n * Get parent windows\n * @param localWindow - the window we are lookink for parents\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nexport const getParentWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n // Check if is in iframe\n if (localWindow.self !== localWindow.top) {\n // Check if we have permission to access parent\n try {\n const parentWindow: Window = localWindow.parent;\n windows.push(parentWindow);\n return getParentWindows(parentWindow, windows);\n } catch (err) {\n console.error('Different hosts between iframes:', err);\n return windows;\n }\n }\n return windows;\n};\n\n/**\n * Get child windows\n * @param localWindow - the window we are lookink for children\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getChildWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n if (localWindow.frames.length > 0) {\n for (const childWindow of Array.from(localWindow.frames)) {\n windows.push(childWindow);\n getChildWindows(childWindow, windows);\n }\n }\n return windows;\n};\n\n/**\n * Validate string\n * @param value - value to check\n * @returns if string is valid\n */\nexport const isValidString = (value: unknown): boolean => typeof value === 'string' && value.trim() !== '';\n\n/**\n * Clean string caraters\n * @param text - text to cliean\n * @returns cleanded string\n */\nexport const cleanString = (text: string): string =>\n typeof text === 'string' &&\n text\n .toLocaleLowerCase()\n .normalize('NFD')\n .replaceAll(/[\\u0300-\\u036f]/g, '');\n"],"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AAE,UAAoB,EAAE;IAClE,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,KAAK,MAAM,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;YACxD,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC1B,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;SACvC;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;MAKa,aAAa,GAAG,CAAC,KAAc,KAAc,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG;AAE3G;;;;;MAKa,WAAW,GAAG,CAAC,IAAY,KACtC,OAAO,IAAI,KAAK,QAAQ;IACxB,IAAI;SACD,iBAAiB,EAAE;SACnB,SAAS,CAAC,KAAK,CAAC;SAChB,UAAU,CAAC,kBAAkB,EAAE,EAAE,EAAE;AAExC;;;;;MAKa,QAAQ,GAAG,OAAO,QAAoB,KAAoB,QAAQ;;;;","names":[],"sources":["src/utils/components.utils.ts"],"sourcesContent":["/**\n * Create random ID\n * @param prefix - add prefix to created ID\n * @param length - ID length\n * @returns ID\n */\nexport const createID = (prefix = '', length = 10): string => {\n const randomBytes = new Uint8Array(length);\n\n crypto.getRandomValues(randomBytes);\n\n const hexString = Array.from(randomBytes)\n .map(byte => byte.toString(16).padStart(2, '0'))\n .join('')\n .slice(0, length);\n\n return prefix !== '' ? `${prefix}-${hexString}` : hexString;\n};\n\n/**\n * Class to manage component classlist\n * Set() are not working when imported in project\n */\nexport class ClassList {\n /**\n * Available classes\n */\n classes: string[];\n\n constructor(classlist: string[] = []) {\n this.classes = classlist;\n }\n\n /**\n * Add class\n * @param className - class name to add\n */\n add = (className: string): void => {\n if (!this.has(className)) {\n this.classes.push(className);\n }\n };\n\n /**\n * Delete class\n * @param className - class name to delete\n */\n delete = (className: string): void => {\n const index = this.classes.indexOf(className);\n if (index > -1) {\n this.classes.splice(index, 1);\n }\n };\n\n /**\n * Check if class exist in list\n * @param className - class name to check\n * @returns class name is in the list\n */\n has = (className: string): boolean => {\n return this.classes.includes(className);\n };\n\n /**\n * Join classes seperated by spaces\n * @returns joined values\n */\n join = (): string => {\n return this.classes.join(' ');\n };\n}\n\n/**\n * Check if all items are string\n * @param items - items to check\n * @returns all items are string\n */\nexport const allItemsAreString = (items: unknown): items is string[] => Array.isArray(items) && items.every(item => typeof item === 'string');\n\n/**\n * Check if element is a heading\n * @param element - slotted element\n * @param tagNames - allowed tag names list\n * @returns element is a heading\n */\nexport const isTagName = (element: Element, tagNames: string[]): boolean => {\n return tagNames.includes(element?.tagName.toLowerCase());\n};\n\n/**\n * Focusable elements query selector\n */\nexport const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier]';\n\n/**\n * Get windows\n * @param localWindow - the window we are lookink for other windows\n * @returns The list of windows found\n */\nexport const getWindows = (localWindow: Window): Window[] => {\n const parentWindows = getParentWindows(localWindow);\n const childWindows = getChildWindows(localWindow);\n return [localWindow, ...parentWindows, ...childWindows];\n};\n\n/**\n * Get parent windows\n * @param localWindow - the window we are lookink for parents\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nexport const getParentWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n // Check if is in iframe\n if (localWindow.self !== localWindow.top) {\n // Check if we have permission to access parent\n try {\n const parentWindow: Window = localWindow.parent;\n windows.push(parentWindow);\n return getParentWindows(parentWindow, windows);\n } catch (err) {\n console.error('Different hosts between iframes:', err);\n return windows;\n }\n }\n return windows;\n};\n\n/**\n * Get child windows\n * @param localWindow - the window we are lookink for children\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getChildWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n if (localWindow.frames.length > 0) {\n for (const childWindow of Array.from(localWindow.frames)) {\n windows.push(childWindow);\n getChildWindows(childWindow, windows);\n }\n }\n return windows;\n};\n\n/**\n * Validate string\n * @param value - value to check\n * @returns if string is valid\n */\nexport const isValidString = (value: unknown): boolean => typeof value === 'string' && value.trim() !== '';\n\n/**\n * Clean string caraters\n * @param text - text to cliean\n * @returns cleanded string\n */\nexport const cleanString = (text: string): string =>\n typeof text === 'string' &&\n text\n .toLocaleLowerCase()\n .normalize('NFD')\n .replaceAll(/[\\u0300-\\u036f]/g, '');\n\n/**\n * Use to process code next tick in the event loop\n * @param callback - code to excute on next tick\n * @returns differed code excution\n */\nexport const nextTick = async (callback: () => void): Promise<void> => callback();\n"],"version":3}