@mgdis/mg-components 5.18.0 → 5.19.1

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 (358) hide show
  1. package/dist/cjs/{mg-menu.conf-43aacf30.js → components.utils-dc9c8a53.js} +160 -7
  2. package/dist/cjs/components.utils-dc9c8a53.js.map +1 -0
  3. package/dist/cjs/index-c042e24b.js +18 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/mg-action-more_34.cjs.entry.js +381 -465
  6. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  7. package/dist/cjs/mg-components.cjs.js +1 -1
  8. package/dist/cjs/mg-item-more.cjs.entry.js +7 -6
  9. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.js +10 -10
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  12. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +5 -5
  13. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +1 -1
  14. package/dist/collection/components/atoms/mg-button/mg-button.js +13 -12
  15. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  16. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +4 -4
  17. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -1
  18. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +3 -3
  19. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -1
  20. package/dist/collection/components/atoms/mg-card/mg-card.js +13 -13
  21. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  22. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +3 -3
  23. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  24. package/dist/collection/components/atoms/mg-divider/mg-divider.js +4 -4
  25. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.js +15 -17
  27. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  28. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +4 -4
  29. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +1 -1
  30. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +24 -5
  31. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js +12 -0
  33. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js.map +1 -0
  34. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js +1 -5
  35. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js.map +1 -1
  36. package/dist/collection/components/atoms/mg-tag/mg-tag.js +9 -9
  37. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  38. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +23 -0
  39. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +1 -0
  40. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +5 -5
  41. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +1 -1
  42. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
  43. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  44. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -7
  45. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  46. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +1 -1
  47. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -1
  48. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +1 -1
  49. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/MgInput.js +14 -13
  51. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +7 -4
  53. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +20 -2
  55. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  57. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +25 -27
  58. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +21 -27
  60. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +1 -1
  61. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +9 -7
  62. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
  63. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +6 -6
  64. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  65. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +11 -10
  66. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  67. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -6
  68. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  69. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +6 -6
  70. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  71. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +1 -1
  72. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +1 -1
  73. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +8 -8
  74. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  75. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +6 -0
  76. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -0
  77. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +52 -14
  78. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  79. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +147 -0
  80. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +1 -0
  81. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +12 -2
  82. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
  83. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +12 -12
  84. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  85. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +2 -2
  86. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
  87. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +86 -10
  88. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  89. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js +108 -0
  90. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js.map +1 -0
  91. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +46 -2
  92. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -1
  93. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +3 -3
  94. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  95. package/dist/collection/components/molecules/menu/mg-menu/test/{mg-menu.e2e.js → mg-menu.e2e.playwright.js} +67 -96
  96. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js.map +1 -0
  97. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +8 -9
  98. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  99. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js +100 -0
  100. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js.map +1 -0
  101. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  102. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +7 -7
  103. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  104. package/dist/collection/components/molecules/mg-details/mg-details.js +5 -4
  105. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  106. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +1 -1
  107. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +1 -1
  108. package/dist/collection/components/molecules/mg-form/mg-form.js +6 -5
  109. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  110. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +4 -4
  111. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -1
  112. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +7 -7
  113. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  114. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +5 -4
  115. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  116. package/dist/collection/components/molecules/mg-message/mg-message.js +8 -8
  117. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  118. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +11 -11
  119. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +1 -1
  120. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
  121. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  122. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +7 -7
  123. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -1
  124. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +3 -3
  125. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +1 -1
  126. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +1 -1
  127. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +1 -1
  128. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +3 -3
  129. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  130. package/dist/collection/components/molecules/mg-panel/mg-panel.js +9 -9
  131. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  132. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +2 -2
  133. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
  134. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +8 -8
  135. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -1
  136. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -4
  137. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  138. package/dist/collection/components/molecules/mg-popover/mg-popover.js +2 -2
  139. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  140. package/dist/collection/components/molecules/mg-popover/test/{mg-popover.e2e.js → mg-popover.e2e.playwright.js} +46 -65
  141. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +1 -0
  142. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -6
  143. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  144. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +34 -34
  145. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  146. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +13 -13
  147. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +1 -1
  148. package/dist/collection/locales/en/messages.json +3 -3
  149. package/dist/collection/locales/fr/messages.json +3 -3
  150. package/dist/collection/utils/behaviors.utils.js +2 -1
  151. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  152. package/dist/collection/utils/components.utils.js +10 -0
  153. package/dist/collection/utils/components.utils.js.map +1 -1
  154. package/dist/collection/utils/components.utils.spec.js +14 -1
  155. package/dist/collection/utils/components.utils.spec.js.map +1 -1
  156. package/dist/collection/utils/playwright.e2e.test.utils.js +3 -3
  157. package/dist/collection/utils/playwright.e2e.test.utils.js.map +1 -1
  158. package/dist/collection/utils/unit.test.utils.js +0 -3
  159. package/dist/collection/utils/unit.test.utils.js.map +1 -1
  160. package/dist/collection/variables.css +1 -275
  161. package/dist/components/MgInput.js +19 -18
  162. package/dist/components/MgInput.js.map +1 -1
  163. package/dist/components/components.utils.js +11 -1
  164. package/dist/components/components.utils.js.map +1 -1
  165. package/dist/components/index2.js +6 -6
  166. package/dist/components/mg-action-more.js +6 -6
  167. package/dist/components/mg-action-more.js.map +1 -1
  168. package/dist/components/mg-badge2.js +9 -9
  169. package/dist/components/mg-badge2.js.map +1 -1
  170. package/dist/components/mg-button2.js +12 -11
  171. package/dist/components/mg-button2.js.map +1 -1
  172. package/dist/components/mg-card2.js +12 -12
  173. package/dist/components/mg-card2.js.map +1 -1
  174. package/dist/components/mg-character-left2.js +1 -1
  175. package/dist/components/mg-character-left2.js.map +1 -1
  176. package/dist/components/mg-details.js +4 -3
  177. package/dist/components/mg-details.js.map +1 -1
  178. package/dist/components/mg-divider.js +3 -3
  179. package/dist/components/mg-divider.js.map +1 -1
  180. package/dist/components/mg-form.js +5 -4
  181. package/dist/components/mg-form.js.map +1 -1
  182. package/dist/components/mg-icon2.js +14 -16
  183. package/dist/components/mg-icon2.js.map +1 -1
  184. package/dist/components/mg-illustrated-message.js +7 -7
  185. package/dist/components/mg-illustrated-message.js.map +1 -1
  186. package/dist/components/mg-input-checkbox-paginated2.js +13 -8
  187. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  188. package/dist/components/mg-input-checkbox.js +24 -26
  189. package/dist/components/mg-input-checkbox.js.map +1 -1
  190. package/dist/components/mg-input-date.js +5 -5
  191. package/dist/components/mg-input-date.js.map +1 -1
  192. package/dist/components/mg-input-numeric.js +10 -9
  193. package/dist/components/mg-input-numeric.js.map +1 -1
  194. package/dist/components/mg-input-password.js +5 -5
  195. package/dist/components/mg-input-password.js.map +1 -1
  196. package/dist/components/mg-input-radio.js +5 -5
  197. package/dist/components/mg-input-radio.js.map +1 -1
  198. package/dist/components/mg-input-select2.js +7 -7
  199. package/dist/components/mg-input-select2.js.map +1 -1
  200. package/dist/components/mg-input-text2.js +29 -12
  201. package/dist/components/mg-input-text2.js.map +1 -1
  202. package/dist/components/mg-input-textarea.js +12 -12
  203. package/dist/components/mg-input-textarea.js.map +1 -1
  204. package/dist/components/mg-input-title2.js +7 -4
  205. package/dist/components/mg-input-title2.js.map +1 -1
  206. package/dist/components/mg-input-toggle.js +48 -10
  207. package/dist/components/mg-input-toggle.js.map +1 -1
  208. package/dist/components/mg-item-more.js +6 -4
  209. package/dist/components/mg-item-more.js.map +1 -1
  210. package/dist/components/mg-menu-item2.js +7 -8
  211. package/dist/components/mg-menu-item2.js.map +1 -1
  212. package/dist/components/mg-menu2.js +2 -2
  213. package/dist/components/mg-menu2.js.map +1 -1
  214. package/dist/components/mg-message.js +7 -7
  215. package/dist/components/mg-message.js.map +1 -1
  216. package/dist/components/mg-modal.js +7 -7
  217. package/dist/components/mg-modal.js.map +1 -1
  218. package/dist/components/mg-pagination2.js +2 -2
  219. package/dist/components/mg-pagination2.js.map +1 -1
  220. package/dist/components/mg-panel.js +8 -8
  221. package/dist/components/mg-panel.js.map +1 -1
  222. package/dist/components/mg-popover-content2.js +4 -4
  223. package/dist/components/mg-popover-content2.js.map +1 -1
  224. package/dist/components/mg-popover2.js.map +1 -1
  225. package/dist/components/mg-skip-links.js +4 -5
  226. package/dist/components/mg-skip-links.js.map +1 -1
  227. package/dist/components/mg-tabs.js +33 -33
  228. package/dist/components/mg-tabs.js.map +1 -1
  229. package/dist/components/mg-tag.js +8 -8
  230. package/dist/components/mg-tag.js.map +1 -1
  231. package/dist/components/mg-tooltip-content2.js +1 -1
  232. package/dist/components/mg-tooltip-content2.js.map +1 -1
  233. package/dist/components/mg-tooltip2.js +5 -5
  234. package/dist/components/mg-tooltip2.js.map +1 -1
  235. package/dist/esm/{mg-menu.conf-012fc9b4.js → components.utils-0f76010d.js} +153 -8
  236. package/dist/esm/components.utils-0f76010d.js.map +1 -0
  237. package/dist/esm/index-ce01e63b.js +18 -1
  238. package/dist/esm/loader.js +1 -1
  239. package/dist/esm/mg-action-more_34.entry.js +315 -399
  240. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  241. package/dist/esm/mg-components.js +1 -1
  242. package/dist/esm/mg-item-more.entry.js +6 -5
  243. package/dist/esm/mg-item-more.entry.js.map +1 -1
  244. package/dist/mg-components/locales/en/messages.json +3 -3
  245. package/dist/mg-components/locales/fr/messages.json +3 -3
  246. package/dist/mg-components/mg-components.css +1 -1
  247. package/dist/mg-components/mg-components.esm.js +1 -1
  248. package/dist/mg-components/mg-components.esm.js.map +1 -1
  249. package/dist/mg-components/p-01ebc95a.entry.js +2 -0
  250. package/dist/mg-components/p-01ebc95a.entry.js.map +1 -0
  251. package/dist/mg-components/p-71a5a848.entry.js +2 -0
  252. package/dist/mg-components/p-71a5a848.entry.js.map +1 -0
  253. package/dist/mg-components/p-c9e2c669.js +2 -0
  254. package/dist/mg-components/p-c9e2c669.js.map +1 -0
  255. package/dist/mg-components/variables.css +1 -275
  256. package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
  257. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +5 -1
  258. package/dist/types/components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts +1 -0
  259. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -2
  260. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +5 -1
  261. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +5 -8
  262. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +2 -2
  263. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +9 -0
  264. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +13 -1
  265. package/dist/types/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.d.ts +1 -0
  266. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +22 -0
  267. package/dist/types/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.d.ts +1 -0
  268. package/dist/types/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.d.ts +1 -0
  269. package/dist/types/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.d.ts +1 -0
  270. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +1 -3
  271. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -1
  272. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +2 -2
  273. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
  274. package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +1 -0
  275. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +6 -5
  276. package/dist/types/components.d.ts +34 -2
  277. package/dist/types/utils/components.utils.d.ts +6 -0
  278. package/package.json +21 -22
  279. package/readme.md +0 -31
  280. package/dist/cjs/mg-menu.conf-43aacf30.js.map +0 -1
  281. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -116
  282. package/dist/collection/components/atoms/mg-button/mg-button.css +0 -182
  283. package/dist/collection/components/atoms/mg-card/mg-card.css +0 -75
  284. package/dist/collection/components/atoms/mg-character-left/mg-character-left.css +0 -3
  285. package/dist/collection/components/atoms/mg-divider/mg-divider.css +0 -9
  286. package/dist/collection/components/atoms/mg-icon/mg-icon.css +0 -138
  287. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +0 -12
  288. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js +0 -18
  289. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js.map +0 -1
  290. package/dist/collection/components/atoms/mg-tag/mg-tag.css +0 -131
  291. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js +0 -37
  292. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js.map +0 -1
  293. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.css +0 -43
  294. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +0 -3
  295. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +0 -268
  296. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +0 -211
  297. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +0 -257
  298. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +0 -254
  299. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +0 -179
  300. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +0 -264
  301. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +0 -304
  302. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js +0 -171
  303. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js.map +0 -1
  304. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +0 -303
  305. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +0 -233
  306. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js +0 -125
  307. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js.map +0 -1
  308. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +0 -37
  309. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.js.map +0 -1
  310. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +0 -377
  311. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js +0 -119
  312. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js.map +0 -1
  313. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +0 -39
  314. package/dist/collection/components/molecules/mg-details/mg-details.css +0 -64
  315. package/dist/collection/components/molecules/mg-form/mg-form.css +0 -19
  316. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +0 -45
  317. package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +0 -30
  318. package/dist/collection/components/molecules/mg-message/mg-message.css +0 -82
  319. package/dist/collection/components/molecules/mg-modal/mg-modal.css +0 -67
  320. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +0 -47
  321. package/dist/collection/components/molecules/mg-panel/mg-panel.css +0 -64
  322. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.css +0 -135
  323. package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -11
  324. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +0 -1
  325. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +0 -28
  326. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -99
  327. package/dist/collection/styles/a11y.scss +0 -36
  328. package/dist/collection/styles/fonts.scss +0 -21
  329. package/dist/collection/styles/form.scss +0 -3
  330. package/dist/collection/styles/global.scss +0 -80
  331. package/dist/collection/styles/layout.scss +0 -29
  332. package/dist/collection/styles/main.scss +0 -23
  333. package/dist/collection/styles/mg-icon-animation.scss +0 -6
  334. package/dist/collection/styles/navigation-button.scss +0 -77
  335. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +0 -11
  336. package/dist/collection/styles/typography.scss +0 -82
  337. package/dist/collection/styles/utilities.scss +0 -21
  338. package/dist/collection/test/typography.e2e.playwright.js +0 -12
  339. package/dist/collection/test/typography.e2e.playwright.js.map +0 -1
  340. package/dist/esm/mg-menu.conf-012fc9b4.js.map +0 -1
  341. package/dist/mg-components/p-1d7d6fa0.js +0 -2
  342. package/dist/mg-components/p-1d7d6fa0.js.map +0 -1
  343. package/dist/mg-components/p-9257e8f1.entry.js +0 -2
  344. package/dist/mg-components/p-9257e8f1.entry.js.map +0 -1
  345. package/dist/mg-components/p-ff3ca349.entry.js +0 -2
  346. package/dist/mg-components/p-ff3ca349.entry.js.map +0 -1
  347. package/dist/mg-components/styles/a11y.scss +0 -36
  348. package/dist/mg-components/styles/fonts.scss +0 -21
  349. package/dist/mg-components/styles/form.scss +0 -3
  350. package/dist/mg-components/styles/global.scss +0 -80
  351. package/dist/mg-components/styles/layout.scss +0 -29
  352. package/dist/mg-components/styles/main.scss +0 -23
  353. package/dist/mg-components/styles/mg-icon-animation.scss +0 -6
  354. package/dist/mg-components/styles/navigation-button.scss +0 -77
  355. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +0 -11
  356. package/dist/mg-components/styles/typography.scss +0 -82
  357. package/dist/mg-components/styles/utilities.scss +0 -21
  358. /package/dist/types/{test/typography.e2e.playwright.d.ts → components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"components.utils.spec.js","sourceRoot":"","sources":["../../src/utils/components.utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,gBAAgB,EAAE,CAAC;AAEnB,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;EAChC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,+CAA+C,EAAE,MAAM,CAAC,EAAE;MAC1F,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;MAC5B,IAAI,MAAM,GAAG,gBAAgB,CAAC;MAC9B,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,EAAE;QACzC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,gBAAgB,CAAC,CAAC;OACjD;MACD,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;MACtC,MAAM,eAAe,GAAG,IAAI,SAAS,EAAE,CAAC;MACxC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;MAC5C,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;MAC3B,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CA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I,KAAK,CAAC,KAAK,CAAC,CAAC;MACzB,CAAC,CAAC,CAAC;MACH,MAAM,WAAW,GAAW,MAAM,CAAC;MACnC,MAAM,OAAO,GAAa,UAAU,CAAC,WAAW,CAAC,CAAC;MAClD,MAAM,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;MAChC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;MACxC,MAAM,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;MACtC,MAAM,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;MACzC,MAAM,CAAC,eAAe,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,0CAA0C,EAAE,KAAK,CAAC,EAAE;MACnG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,sCAAsC,EAAE,KAAK,CAAC,EAAE;MAC/E,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { createID, ClassList, allItemsAreString, isTagName, getWindows, isValidString } from './components.utils';\nimport { mockConsoleError } from './unit.test.utils';\n\nmockConsoleError();\n\ndescribe('components.utils', () => {\n describe('createID', () => {\n test.each([undefined, '', 'blu'])('Should generate a prefixed ID if defined : %s', prefix => {\n const id = createID(prefix);\n let regexp = /^[a-z0-9]{10}$/;\n if (prefix !== undefined && prefix !== '') {\n regexp = new RegExp(`^${prefix}-[a-z0-9]{10}$`);\n }\n expect(id).toMatch(regexp);\n });\n });\n\n describe('ClassList', () => {\n test('Should add classes to list', () => {\n const classCollection = new ClassList();\n expect(classCollection.classes).toEqual([]);\n classCollection.add('blu');\n expect(classCollection.classes).toEqual(['blu']);\n classCollection.add('bli');\n expect(classCollection.classes).toEqual(['blu', 'bli']);\n // Should not add classes if already in list\n classCollection.add('blu');\n expect(classCollection.classes).toEqual(['blu', 'bli']);\n });\n\n test('Should delete classes from list', () => {\n const classCollection = new ClassList(['blu', 'bli']);\n classCollection.delete('blu');\n expect(classCollection.classes).toEqual(['bli']);\n // List doesn't change if class name doesn't existe in list\n classCollection.delete('bla');\n expect(classCollection.classes).toEqual(['bli']);\n });\n\n test('Should check if class already in list', () => {\n const classCollection = new ClassList(['blu']);\n expect(classCollection.has('blu')).toEqual(true);\n expect(classCollection.has('bli')).toEqual(false);\n });\n\n test('Should return seperated space classes list', () => {\n const classCollection = new ClassList(['blu', 'bli']);\n expect(classCollection.join()).toEqual('blu bli');\n });\n });\n\n describe('allItemsAreString', () => {\n test.each([\n { items: ['blu', 'bli', 'blo', 'bla'], expected: true },\n { items: ['blu', 'bli', 'blo', { value: 'bla' }], expected: false },\n ])('Should test if all otems are string: %s', ({ items, expected }) => {\n expect(allItemsAreString(items as string[])).toEqual(expected);\n });\n });\n\n describe('isTagName', () => {\n test.each([\n { querySelector: 'h1', expected: true },\n { querySelector: 'span', expected: false },\n { querySelector: 'blu', expected: false },\n ])('Should test if all otems are string: %s', ({ querySelector, expected }) => {\n const div = document.createElement('div');\n div.innerHTML = '<h1></h1><span></span>';\n const elm = div.querySelector(querySelector);\n expect(isTagName(elm as HTMLElement, ['h1'])).toEqual(expected);\n });\n });\n\n describe('getWindows', () => {\n const mockWindowFramesLength = jest.fn();\n const mockWindowIndexZero = jest.fn();\n Object.defineProperty(window, 'frames', {\n value: {\n get length() {\n return mockWindowFramesLength();\n },\n get 0() {\n return mockWindowIndexZero();\n },\n },\n });\n\n afterEach(() => {\n jest.clearAllMocks();\n });\n\n test('Should return the window in an array', () => {\n mockWindowFramesLength.mockReturnValue(0);\n const localWindow: Window = window;\n const windows: Window[] = getWindows(localWindow);\n expect(windows).toHaveLength(1);\n expect(windows[0]).toEqual(localWindow);\n });\n\n test('Should return the window with a parent', () => {\n mockWindowFramesLength.mockReturnValue(0);\n const spyWindowSelf = jest.spyOn(window, 'self', 'get').mockImplementationOnce(jest.fn());\n const spyWindowParent = jest.spyOn(window, 'parent', 'get').mockImplementationOnce(() => window);\n\n const windows = getWindows(window);\n expect(windows).toHaveLength(2);\n expect(spyWindowSelf).toBeCalledTimes(2);\n expect(spyWindowParent).toBeCalledTimes(1);\n });\n\n test('Should return the window with a child', () => {\n mockWindowFramesLength.mockReturnValueOnce(1).mockReturnValueOnce(1).mockReturnValue(0);\n mockWindowIndexZero.mockReturnValueOnce(window);\n const windows = getWindows(window);\n expect(windows).toHaveLength(2);\n });\n\n test('Should throw an error when cannot access top parent window', () => {\n mockWindowFramesLength.mockReturnValue(0);\n const spyConsole = jest.spyOn(console, 'error');\n const spyWindowSelf = jest.spyOn(window, 'self', 'get').mockImplementationOnce(jest.fn());\n const spyWindowParent = jest.spyOn(window, 'parent', 'get').mockImplementationOnce(() => {\n throw new Error('non');\n });\n const localWindow: Window = window;\n const windows: Window[] = getWindows(localWindow);\n expect(windows).toHaveLength(1);\n expect(windows[0]).toEqual(localWindow);\n expect(spyConsole).toBeCalledTimes(1);\n expect(spyWindowSelf).toBeCalledTimes(1);\n expect(spyWindowParent).toBeCalledTimes(1);\n });\n });\n\n describe('isValidString', () => {\n test.each(['', ' ', null, undefined, 1, {}, []])('Should return \"false\" for invalid values', value => {\n expect(isValidString(value)).toEqual(false);\n });\n\n test.each(['batman', 'batman '])('Should return \"true\" for valid value', value => {\n expect(isValidString(value)).toEqual(true);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"components.utils.spec.js","sourceRoot":"","sources":["../../src/utils/components.utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC/H,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,gBAAgB,EAAE,CAAC;AAEnB,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;EAChC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,+CAA+C,EAAE,MAAM,CAAC,EAAE;MAC1F,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;MAC5B,IAAI,MAAM,GAAG,gBAAgB,CAAC;MAC9B,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,EAAE;QACzC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,gBAAgB,CAAC,CAAC;OACjD;MACD,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;MACtC,MAAM,eAAe,GAAG,IAAI,SAAS,EAAE,CAAC;MACxC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;MAC5C,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;MAC3B,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,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,EAAE,QAAQ,EAAE;MACxC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;MACxC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;MACxC,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE;MAC5C,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;MAC1C,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;MAC1C,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE;KAC/C,CAAC,CAAC,+BAA+B,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE;MAC3D,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { createID, ClassList, allItemsAreString, isTagName, getWindows, isValidString, cleanString } from './components.utils';\nimport { mockConsoleError } from './unit.test.utils';\n\nmockConsoleError();\n\ndescribe('components.utils', () => {\n describe('createID', () => {\n test.each([undefined, '', 'blu'])('Should generate a prefixed ID if defined : %s', prefix => {\n const id = createID(prefix);\n let regexp = /^[a-z0-9]{10}$/;\n if (prefix !== undefined && prefix !== '') {\n regexp = new RegExp(`^${prefix}-[a-z0-9]{10}$`);\n }\n expect(id).toMatch(regexp);\n });\n });\n\n describe('ClassList', () => {\n test('Should add classes to list', () => {\n const classCollection = new ClassList();\n expect(classCollection.classes).toEqual([]);\n classCollection.add('blu');\n expect(classCollection.classes).toEqual(['blu']);\n classCollection.add('bli');\n expect(classCollection.classes).toEqual(['blu', 'bli']);\n // Should not add classes if already in list\n classCollection.add('blu');\n expect(classCollection.classes).toEqual(['blu', 'bli']);\n });\n\n test('Should delete classes from list', () => {\n const classCollection = new ClassList(['blu', 'bli']);\n classCollection.delete('blu');\n expect(classCollection.classes).toEqual(['bli']);\n // List doesn't change if class name doesn't existe in list\n classCollection.delete('bla');\n expect(classCollection.classes).toEqual(['bli']);\n });\n\n test('Should check if class already in list', () => {\n const classCollection = new ClassList(['blu']);\n expect(classCollection.has('blu')).toEqual(true);\n expect(classCollection.has('bli')).toEqual(false);\n });\n\n test('Should return seperated space classes list', () => {\n const classCollection = new ClassList(['blu', 'bli']);\n expect(classCollection.join()).toEqual('blu bli');\n });\n });\n\n describe('allItemsAreString', () => {\n test.each([\n { items: ['blu', 'bli', 'blo', 'bla'], expected: true },\n { items: ['blu', 'bli', 'blo', { value: 'bla' }], expected: false },\n ])('Should test if all otems are string: %s', ({ items, expected }) => {\n expect(allItemsAreString(items as string[])).toEqual(expected);\n });\n });\n\n describe('isTagName', () => {\n test.each([\n { querySelector: 'h1', expected: true },\n { querySelector: 'span', expected: false },\n { querySelector: 'blu', expected: false },\n ])('Should test if all otems are string: %s', ({ querySelector, expected }) => {\n const div = document.createElement('div');\n div.innerHTML = '<h1></h1><span></span>';\n const elm = div.querySelector(querySelector);\n expect(isTagName(elm as HTMLElement, ['h1'])).toEqual(expected);\n });\n });\n\n describe('getWindows', () => {\n const mockWindowFramesLength = jest.fn();\n const mockWindowIndexZero = jest.fn();\n Object.defineProperty(window, 'frames', {\n value: {\n get length() {\n return mockWindowFramesLength();\n },\n get 0() {\n return mockWindowIndexZero();\n },\n },\n });\n\n afterEach(() => {\n jest.clearAllMocks();\n });\n\n test('Should return the window in an array', () => {\n mockWindowFramesLength.mockReturnValue(0);\n const localWindow: Window = window;\n const windows: Window[] = getWindows(localWindow);\n expect(windows).toHaveLength(1);\n expect(windows[0]).toEqual(localWindow);\n });\n\n test('Should return the window with a parent', () => {\n mockWindowFramesLength.mockReturnValue(0);\n const spyWindowSelf = jest.spyOn(window, 'self', 'get').mockImplementationOnce(jest.fn());\n const spyWindowParent = jest.spyOn(window, 'parent', 'get').mockImplementationOnce(() => window);\n\n const windows = getWindows(window);\n expect(windows).toHaveLength(2);\n expect(spyWindowSelf).toBeCalledTimes(2);\n expect(spyWindowParent).toBeCalledTimes(1);\n });\n\n test('Should return the window with a child', () => {\n mockWindowFramesLength.mockReturnValueOnce(1).mockReturnValueOnce(1).mockReturnValue(0);\n mockWindowIndexZero.mockReturnValueOnce(window);\n const windows = getWindows(window);\n expect(windows).toHaveLength(2);\n });\n\n test('Should throw an error when cannot access top parent window', () => {\n mockWindowFramesLength.mockReturnValue(0);\n const spyConsole = jest.spyOn(console, 'error');\n const spyWindowSelf = jest.spyOn(window, 'self', 'get').mockImplementationOnce(jest.fn());\n const spyWindowParent = jest.spyOn(window, 'parent', 'get').mockImplementationOnce(() => {\n throw new Error('non');\n });\n const localWindow: Window = window;\n const windows: Window[] = getWindows(localWindow);\n expect(windows).toHaveLength(1);\n expect(windows[0]).toEqual(localWindow);\n expect(spyConsole).toBeCalledTimes(1);\n expect(spyWindowSelf).toBeCalledTimes(1);\n expect(spyWindowParent).toBeCalledTimes(1);\n });\n });\n\n describe('isValidString', () => {\n test.each(['', ' ', null, undefined, 1, {}, []])('Should return \"false\" for invalid values', value => {\n expect(isValidString(value)).toEqual(false);\n });\n\n test.each(['batman', 'batman '])('Should return \"true\" for valid value', value => {\n expect(isValidString(value)).toEqual(true);\n });\n });\n\n describe('cleanString', () => {\n test.each([\n { string: 'batman', expected: 'batman' },\n { string: 'BATMAN', expected: 'batman' },\n { string: 'Batman', expected: 'batman' },\n { string: ' batman ', expected: ' batman ' },\n { string: ' batman', expected: ' batman' },\n { string: 'batman ', expected: 'batman ' },\n { string: 'âäàçéèêñù', expected: 'aaaceeenu' },\n ])('Should format string properly', ({ string, expected }) => {\n expect(cleanString(string)).toEqual(expected);\n });\n });\n});\n"]}
@@ -17,13 +17,13 @@ export const setPageContent = async (page, html, viewportSize) => {
17
17
  await page.addStyleTag({ content: css });
18
18
  // JS
19
19
  await page.addScriptTag({ url: 'http://localhost:3333/build/mg-components.esm.js', type: 'module' });
20
+ // Set page size before style setting to prevent "resize" event to be triggered
21
+ if (viewportSize !== undefined)
22
+ await page.setViewportSize(viewportSize);
20
23
  // Set page content
21
24
  // Added the `e2e-screenshot` class to be able to do the screenshot on this specific one with
22
25
  // `await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();`
23
26
  await page.setContent(`<style>${css} .e2e-screenshot { display: inline-block; }</style><span class="e2e-screenshot">${html}</span>`);
24
- // Set page size
25
- if (viewportSize !== undefined)
26
- await page.setViewportSize(viewportSize);
27
27
  // Make sure everything is loaded
28
28
  await page.waitForLoadState('networkidle');
29
29
  await page.waitForSelector('html.hydrated');
@@ -1 +1 @@
1
- {"version":3,"file":"playwright.e2e.test.utils.js","sourceRoot":"","sources":["../../src/utils/playwright.e2e.test.utils.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAA2B,IAAI,IAAI,cAAc,EAAE,MAAM,IAAI,gBAAgB,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC7I,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,IAAU,EAAE,IAAY,EAAE,YAA2B,EAAiB,EAAE;EAC3G,+CAA+C;EAC/C,gDAAgD;EAChD,oFAAoF;EAEpF,MAAM;EACN,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,mCAAmC,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;EACvG,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;EAEzC,KAAK;EACL,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,kDAAkD,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAA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B,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;EACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;EAC9C,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;EACxB,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC,EAAE,MAAM,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { type Page, ViewportSize, test as playwrightTest, expect as playwrightExpect, devices as playwrightDevices } from '@playwright/test';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\n\n/**\n * Add mg-components to browser page\n *\n * @param page - browser page\n * @param html - html to load in page\n */\nexport const setPageContent = async (page: Page, html: string, viewportSize?: ViewportSize): Promise<void> => {\n // We need to add mg-components to the e2e page\n // Those solutions wasn't working to add the CSS\n // await page.addStyleTag({ url: 'http://localhost:3333/build/mg-components.css' });\n\n // CSS\n const css = await readFile(join(__dirname, '../../www/build/mg-components.css'), { encoding: 'utf8' });\n await page.addStyleTag({ content: css });\n\n // JS\n await page.addScriptTag({ url: 'http://localhost:3333/build/mg-components.esm.js', type: 'module' });\n\n // Set page content\n // Added the `e2e-screenshot` class to be able to do the screenshot on this specific one with\n // `await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();`\n await page.setContent(`<style>${css} .e2e-screenshot { display: inline-block; }</style><span class=\"e2e-screenshot\">${html}</span>`);\n\n // Set page size\n if (viewportSize !== undefined) await page.setViewportSize(viewportSize);\n\n // Make sure everything is loaded\n await page.waitForLoadState('networkidle');\n await page.waitForSelector('html.hydrated');\n};\n\n/**\n * playwright 'expect' function definition\n */\nexport const expect = playwrightExpect;\n\n/**\n * playwright 'describe' function definition\n */\nexport const describe = playwrightTest.describe;\n\n/**\n * playwright 'test' function definition\n */\nexport const test = playwrightTest;\n\n/**\n * playwright 'devices' definition\n */\nexport const devices = playwrightDevices;\n\n/**\n * Value to get in string\n * @param value - valut to stringify\n * @returns stringified value\n */\nconst valueToString = (value: unknown): string => (typeof value === 'object' ? JSON.stringify(value) : `${value}`);\n\n/**\n * Declare page type\n */\nexport type PageType = Page;\n\n/**\n * repeat test over array\n * @param array - array of test\n * @param option - test runner option\n * @returns describe iteration\n */\nexport const describeEach = (array: unknown[] | any, option?: 'skip' | 'only') => (title: string, cb: (param: unknown) => void) => {\n array.forEach(value => {\n const displayTitle = title.replace('%s', valueToString(value));\n const fn = () => cb(value);\n if (Boolean(option)) describe[option](displayTitle, fn);\n else describe(displayTitle, fn);\n });\n};\n\n/**\n * repeat test over array\n * @param array - array of test\n * @param option - test runner option\n * @returns test iteration\n */\nexport const testEach = (array: unknown[] | any, option?: 'skip' | 'only') => (title: string, cb: (page: PageType, param: unknown) => Promise<void>) => {\n array.forEach(value => {\n const displayTitle = title.replace('%s', valueToString(value));\n const fn = async ({ page }) => cb(page, value);\n if (Boolean(option)) test[option](displayTitle, fn);\n else test(displayTitle, fn);\n });\n};\n\n/**\n * Update .e2e-screenshot style for screenshot needs\n * @param page - playwright Page\n * @param params - css properties to apply\n * @returns class style definition\n */\nexport const updateScreenshotClass = async (page: Page, params: unknown): Promise<void> =>\n page.evaluate(params => {\n const css = `.e2e-screenshot { ${Object.keys(params)\n .map(key => `${key}: ${typeof params[key] === 'string' ? params[key] : ''}`)\n .join(';')} }`;\n const body = document.getElementsByTagName('body')[0];\n const style = document.createElement('style');\n body.appendChild(style);\n style.appendChild(document.createTextNode(css));\n }, params);\n"]}
1
+ {"version":3,"file":"playwright.e2e.test.utils.js","sourceRoot":"","sources":["../../src/utils/playwright.e2e.test.utils.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAA2B,IAAI,IAAI,cAAc,EAAE,MAAM,IAAI,gBAAgB,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC7I,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACv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CAAC,CAAC;EAC9B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EAAE,IAAU,EAAE,MAAe,EAAiB,EAAE,CACxF,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;EACrB,MAAM,GAAG,GAAG,qBAAqB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;KACjD,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,KAAK,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;KAC3E,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;EACjB,MAAM,IAAI,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;EACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;EAC9C,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;EACxB,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC,EAAE,MAAM,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { type Page, ViewportSize, test as playwrightTest, expect as playwrightExpect, devices as playwrightDevices } from '@playwright/test';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\n\n/**\n * Add mg-components to browser page\n *\n * @param page - browser page\n * @param html - html to load in page\n */\nexport const setPageContent = async (page: Page, html: string, viewportSize?: ViewportSize): Promise<void> => {\n // We need to add mg-components to the e2e page\n // Those solutions wasn't working to add the CSS\n // await page.addStyleTag({ url: 'http://localhost:3333/build/mg-components.css' });\n\n // CSS\n const css = await readFile(join(__dirname, '../../www/build/mg-components.css'), { encoding: 'utf8' });\n await page.addStyleTag({ content: css });\n\n // JS\n await page.addScriptTag({ url: 'http://localhost:3333/build/mg-components.esm.js', type: 'module' });\n\n // Set page size before style setting to prevent \"resize\" event to be triggered\n if (viewportSize !== undefined) await page.setViewportSize(viewportSize);\n\n // Set page content\n // Added the `e2e-screenshot` class to be able to do the screenshot on this specific one with\n // `await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();`\n await page.setContent(`<style>${css} .e2e-screenshot { display: inline-block; }</style><span class=\"e2e-screenshot\">${html}</span>`);\n\n // Make sure everything is loaded\n await page.waitForLoadState('networkidle');\n await page.waitForSelector('html.hydrated');\n};\n\n/**\n * playwright 'expect' function definition\n */\nexport const expect = playwrightExpect;\n\n/**\n * playwright 'describe' function definition\n */\nexport const describe = playwrightTest.describe;\n\n/**\n * playwright 'test' function definition\n */\nexport const test = playwrightTest;\n\n/**\n * playwright 'devices' definition\n */\nexport const devices = playwrightDevices;\n\n/**\n * Value to get in string\n * @param value - valut to stringify\n * @returns stringified value\n */\nconst valueToString = (value: unknown): string => (typeof value === 'object' ? JSON.stringify(value) : `${value}`);\n\n/**\n * Declare page type\n */\nexport type PageType = Page;\n\n/**\n * repeat test over array\n * @param array - array of test\n * @param option - test runner option\n * @returns describe iteration\n */\nexport const describeEach = (array: unknown[] | any, option?: 'skip' | 'only') => (title: string, cb: (param: unknown) => void) => {\n array.forEach(value => {\n const displayTitle = title.replace('%s', valueToString(value));\n const fn = () => cb(value);\n if (Boolean(option)) describe[option](displayTitle, fn);\n else describe(displayTitle, fn);\n });\n};\n\n/**\n * repeat test over array\n * @param array - array of test\n * @param option - test runner option\n * @returns test iteration\n */\nexport const testEach = (array: unknown[] | any, option?: 'skip' | 'only') => (title: string, cb: (page: PageType, param: unknown) => Promise<void>) => {\n array.forEach(value => {\n const displayTitle = title.replace('%s', valueToString(value));\n const fn = async ({ page }) => cb(page, value);\n if (Boolean(option)) test[option](displayTitle, fn);\n else test(displayTitle, fn);\n });\n};\n\n/**\n * Update .e2e-screenshot style for screenshot needs\n * @param page - playwright Page\n * @param params - css properties to apply\n * @returns class style definition\n */\nexport const updateScreenshotClass = async (page: Page, params: unknown): Promise<void> =>\n page.evaluate(params => {\n const css = `.e2e-screenshot { ${Object.keys(params)\n .map(key => `${key}: ${typeof params[key] === 'string' ? params[key] : ''}`)\n .join(';')} }`;\n const body = document.getElementsByTagName('body')[0];\n const style = document.createElement('style');\n body.appendChild(style);\n style.appendChild(document.createTextNode(css));\n }, params);\n"]}
@@ -77,9 +77,6 @@ export const setupResizeObserverMock = ({ disconnect, observe }) => {
77
77
  */
78
78
  export const setupSubmitEventMock = () => {
79
79
  class SubmitEvent extends MockCustomEvent {
80
- constructor(type, eventInitDict) {
81
- super(type, eventInitDict);
82
- }
83
80
  }
84
81
  [window, global].forEach(element => {
85
82
  Object.defineProperty(element, 'SubmitEvent', {
@@ -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,EAAE;IACjC,MAAM,CAAC,cAAc,CAAC,OAAO,EA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AAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,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 constructor(type: string, eventInitDict?: SubmitEventInit) {\n super(type, eventInitDict);\n }\n }\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;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,EAAE;IACjC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE;MACjD,QAAQ,EAAE,IAAI;MACd,YAAY,EAAE,IAAI;MAClB,KAAK,EAAE,oBAAoB;KAC5B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAE,UAAU,EAAE,OAAO,EAAiC,EAAyB,EAAE;EACvH,MAAM,kBAAkB;IAKtB,YAAY,EAAE;MAJd,eAAU,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,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,275 +1 @@
1
- :root {
2
- /*
3
- Fonts
4
- */
5
-
6
- --font-size: 1.3rem;
7
- --line-height: 1.4;
8
-
9
- /* Open Sans is used for the body (mostly all texts) */
10
- --font-family: 'Open Sans', sans-serif;
11
-
12
- /* Headings (h1 to h6) font can be customized */
13
- --font-family-heading: var(--font-family);
14
-
15
- /* Font colors */
16
- --color-font-light: var(--color-light);
17
- --color-font-dark: var(--color-dark);
18
- /*
19
- Colors
20
- https://jira.mgdis.fr/browse/PDA9-690
21
- */
22
-
23
- /* App */
24
- /* default color-info */
25
- --mg-color-app-h: var(--color-info-h);
26
- --mg-color-app-s: var(--color-info-s);
27
- --mg-color-app-l: var(--color-info-l);
28
- --mg-color-app-hsl: var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-app-l);
29
-
30
- /* Neutral */
31
- /* #fefefe; */
32
- /* rgb(254, 254, 254); */
33
- --color-neutral-h: 0;
34
- --color-neutral-s: 0%;
35
- --color-neutral-l: 99.6%;
36
- --color-neutral: var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l);
37
-
38
- /* Warning */
39
- /* #ffc33e */
40
- /* rgb(255, 195, 62); */
41
- --color-warning-h: 41;
42
- --color-warning-s: 100%;
43
- --color-warning-l: 62.2%;
44
- --color-warning: var(--color-warning-h), var(--color-warning-s), var(--color-warning-l);
45
-
46
- /* Success */
47
- /* #32d59c */
48
- /* rgb(50, 213, 156); */
49
- --color-success-h: 159;
50
- --color-success-s: 66%;
51
- --color-success-l: 51.6%;
52
- --color-success: var(--color-success-h), var(--color-success-s), var(--color-success-l);
53
-
54
- /* Info */
55
- /* #005e9c; */
56
- /* rgb(0, 94, 156); */
57
- --color-info-h: 204;
58
- --color-info-s: 100%;
59
- --color-info-l: 30.6%;
60
- --color-info: var(--color-info-h), var(--color-info-s), var(--color-info-l);
61
-
62
- /* Danger */
63
- /* #db1f29; */
64
- /* rgb(219, 31, 41); */
65
- --color-danger-h: 357;
66
- --color-danger-s: 75%;
67
- --color-danger-l: 49%;
68
- --color-danger: var(--color-danger-h), var(--color-danger-s), var(--color-danger-l);
69
-
70
- /* Dark */
71
- /* #15282e; */
72
- /* rgb(21, 40, 46); */
73
- --color-dark-h: 194;
74
- --color-dark-s: 37.3%;
75
- --color-dark-l: 13.1%;
76
- --color-dark: var(--color-dark-h), var(--color-dark-s), var(--color-dark-l);
77
-
78
- /* dark-40 */
79
- --mg-color-dark-40-hsl: var(--color-dark-h), 7%, 43%;
80
- /* dark-5 */
81
- --mg-color-dark-5-hsl: var(--color-dark-h), 9%, 96%;
82
- /* dark-soft */
83
- --mg-color-dark-soft-hsl: var(--color-dark-h), var(--color-dark-s), 90%;
84
-
85
- /* Light */
86
- /* white; (#ffffff) */
87
- /* rgb(255, 255, 255); */
88
- --color-light-h: 0;
89
- --color-light-s: 0%;
90
- --color-light-l: 100%;
91
- --color-light: var(--color-light-h), var(--color-light-s), var(--color-light-l);
92
-
93
- /* Primary */
94
- --color-primary-h: var(--color-dark-h);
95
- --color-primary-s: var(--color-dark-s);
96
- --color-primary-l: var(--color-dark-l);
97
- --color-primary: hsl(var(--color-dark));
98
-
99
- /* Secondary */
100
- --color-secondary-h: var(--color-neutral-h);
101
- --color-secondary-s: var(--color-neutral-s);
102
- --color-secondary-l: var(--color-neutral-l);
103
- --color-secondary: hsl(var(--color-neutral));
104
-
105
- /* Shadow */
106
- --box-shadow: 0 0.3rem 0.8rem 0 hsl(var(--color-dark), 0.15);
107
-
108
- /* Soft style */
109
- --mg-color-soft-l: 90%;
110
-
111
- /*
112
- Global
113
- */
114
- --default-size: 3.5rem;
115
- --mg-disabled-opacity: 0.4;
116
-
117
- /*
118
- <mg-icon>
119
- */
120
- --mg-icon-small-size: 1.2rem;
121
- --mg-icon-regular-size: 1.6rem;
122
- --mg-icon-medium-size: 2rem;
123
- --mg-icon-large-size: 2.4rem;
124
- --mg-icon-extra-large-size: 3.2rem;
125
- --mg-icon-border-radius: 50%;
126
-
127
- /*
128
- <mg-button>
129
- */
130
-
131
- --mg-button-border-radius: 0.3rem;
132
- --mg-button-icon-border-radius: var(--default-size);
133
- --mg-button-disabled-opacity: var(--mg-disabled-opacity);
134
- --mg-button-gradient: 1; /* Can only be 1 or 0 to enable disable gradient */
135
- --mg-button-border-variation: 1; /* Can only be 1 or 0 to enable disable border variation */
136
-
137
- /* Primary */
138
- --mg-button-primary-color-h: var(--color-dark-h);
139
- --mg-button-primary-color-s: var(--color-dark-s);
140
- --mg-button-primary-color-l: var(--color-dark-l);
141
- --mg-button-primary-font-color: var(--color-neutral);
142
-
143
- /* Secondary */
144
- --mg-button-secondary-color-h: var(--color-neutral-h);
145
- --mg-button-secondary-color-s: var(--color-neutral-s);
146
- --mg-button-secondary-color-l: var(--color-neutral-l);
147
- --mg-button-secondary-font-color: var(--color-dark);
148
-
149
- /*
150
- <mg-tag>
151
- */
152
- --mg-tag-height: 2.3rem;
153
- --mg-tag-border-radius: 0.5rem;
154
- --mg-tag-font-size: 1.2rem;
155
-
156
- /*
157
- <mg-badge>
158
- */
159
- --mg-badge-size: 1.6rem;
160
- --mg-badge-font-size: 1.1rem;
161
-
162
- /*
163
- <mg-tooltip>
164
- */
165
- --mg-tooltip-border-radius: 0.5rem;
166
- --mg-tooltip-background-color: var(--color-dark);
167
- --mg-tooltip-font-color: var(--color-font-light);
168
-
169
- /*
170
- <mg-popover>
171
- */
172
- --mg-popover-background-color: var(--color-light);
173
- --mg-popover-font-color: var(--color-font-dark);
174
- --mg-popover-title-font-size: 1.4rem;
175
- --mg-popover-max-width: 40rem;
176
-
177
- /*
178
- <mg-message>
179
- */
180
- --mg-message-border-radius: 0.3rem;
181
-
182
- /*
183
- <mg-modal>
184
- */
185
- --mg-modal-border-radius: 0.5rem;
186
- --mg-modal-title-font-size: 1.8rem;
187
- --mg-modal-content-font-size: 1.2rem;
188
-
189
- /*
190
- <mg-panel>
191
- */
192
- --mg-panel-border-radius: 0.5rem;
193
- --mg-panel-background: var(--color-info-h) var(--color-info-s) calc(var(--color-info-l) + 68%);
194
- --mg-panel-box-shadow: var(--box-shadow);
195
- --mg-panel-content-padding: 1.5rem;
196
-
197
- /*
198
- <mg-illustrated-message>
199
- */
200
-
201
- --mg-illustrated-message-padding-vertical: 4rem;
202
-
203
- /*
204
- <mg-card>
205
- */
206
- --mg-card-padding-default: 1.6rem;
207
- --mg-card-border-radius-default: 0.5rem;
208
- --mg-card-background-default: hsl(var(--color-light));
209
- --mg-card-border-default: 0.1rem solid hsl(var(--color-dark), 0.05);
210
- --mg-card-box-shadow-default: var(--box-shadow);
211
-
212
- /*
213
- <mg-divider>
214
- */
215
- --mg-divider-background-color: hsl(var(--color-dark), 0.15);
216
- --mg-divider-thickness: 0.1rem;
217
- --mg-divider-vertical-spacing: 4rem;
218
-
219
- /*
220
- Layout
221
- */
222
- --mg-grid-spacing: 1rem;
223
-
224
- /*
225
- Forms
226
- */
227
-
228
- /*
229
- <mg-input-...>
230
- */
231
- --mg-inputs-border-width: 0.1rem;
232
- --mg-inputs-border-radius: 0.3rem;
233
- --mg-inputs-color: #b5c2c9;
234
- --mg-inputs-spacer: 1rem;
235
-
236
- /* Error message background */
237
- --mg-inputs-error-bg-color: var(--color-danger-h), calc(var(--color-danger-s) + 5%), calc(var(--color-danger-l) + 49%);
238
-
239
- /* Input focus shadow */
240
- /* #b5c2c9 */
241
- /* rgb(0, 221, 255); */
242
- /* hsl(188, 100%, 50%); */
243
- --mg-inputs-color-shadow-focus-hsl: 188, 100%, 50%;
244
-
245
- /*
246
- <mg-input-toggle>
247
- */
248
- --mg-input-toggle-border-radius-ratio: 2;
249
-
250
- /*
251
- <mg-input-checkbox>
252
- <mg-input-radio>
253
- */
254
- --mg-input-check-size: 1.3rem;
255
-
256
- /*
257
- <mg-menu-item>
258
- */
259
- --mg-menu-item-focused-background-color-hsl: var(--mg-color-app-hsl);
260
- --mg-menu-item-border-color-active-hsl: var(--mg-color-app-hsl);
261
- --mg-menu-item-color-active-hsl: var(--mg-color-app-hsl);
262
-
263
- /*
264
- <mg-tabs>
265
- */
266
- --mg-tabs-focused-background-color-hsl: var(--mg-color-app-hsl);
267
- --mg-tabs-border-color-active-hsl: var(--mg-color-app-hsl);
268
- --mg-tabs-color-active-hsl: var(--mg-color-app-hsl);
269
- --mg-tabs-border-bottom: solid 0.1rem hsl(var(--mg-color-dark-soft-hsl));
270
-
271
- /*
272
- <mg-details>
273
- */
274
- --mg-details-spacing: 1.5rem;
275
- }
1
+ :root{--font-size: 1.3rem;--line-height: 1.4;--font-family: "Open Sans", sans-serif;--font-family-heading: var(--font-family);--color-font-light: var(--color-light);--color-font-dark: var(--color-dark);--mg-color-app-h: var(--color-info-h);--mg-color-app-s: var(--color-info-s);--mg-color-app-l: var(--color-info-l);--mg-color-app-hsl: var(--mg-color-app-h) var(--mg-color-app-s) var(--mg-color-app-l);--color-neutral-h: 0;--color-neutral-s: 0%;--color-neutral-l: 99.6%;--color-neutral: var(--color-neutral-h) var(--color-neutral-s) var(--color-neutral-l);--color-warning-h: 41;--color-warning-s: 100%;--color-warning-l: 62.2%;--color-warning: var(--color-warning-h) var(--color-warning-s) var(--color-warning-l);--color-success-h: 159;--color-success-s: 66%;--color-success-l: 51.6%;--color-success: var(--color-success-h) var(--color-success-s) var(--color-success-l);--color-info-h: 204;--color-info-s: 100%;--color-info-l: 30.6%;--color-info: var(--color-info-h) var(--color-info-s) var(--color-info-l);--color-danger-h: 357;--color-danger-s: 75%;--color-danger-l: 49%;--color-danger: var(--color-danger-h) var(--color-danger-s) var(--color-danger-l);--color-dark-h: 194;--color-dark-s: 37.3%;--color-dark-l: 13.1%;--color-dark: var(--color-dark-h) var(--color-dark-s) var(--color-dark-l);--mg-color-dark-40-hsl: var(--color-dark-h) 7% 43%;--mg-color-dark-5-hsl: var(--color-dark-h) 9% 96%;--mg-color-dark-soft-hsl: var(--color-dark-h) var(--color-dark-s) 90%;--color-light-h: 0;--color-light-s: 0%;--color-light-l: 100%;--color-light: var(--color-light-h) var(--color-light-s) var(--color-light-l);--color-primary-h: var(--color-dark-h);--color-primary-s: var(--color-dark-s);--color-primary-l: var(--color-dark-l);--color-primary: hsl(var(--color-dark));--color-secondary-h: var(--color-neutral-h);--color-secondary-s: var(--color-neutral-s);--color-secondary-l: var(--color-neutral-l);--color-secondary: hsl(var(--color-neutral));--box-shadow: 0 0.3rem 0.8rem 0 hsl(var(--color-dark) / 15%);--mg-color-soft-l: 90%;--default-size: 3.5rem;--mg-disabled-opacity: 0.4;--mg-icon-small-size: 1.2rem;--mg-icon-regular-size: 1.6rem;--mg-icon-medium-size: 2rem;--mg-icon-large-size: 2.4rem;--mg-icon-extra-large-size: 3.2rem;--mg-icon-border-radius: 50%;--mg-button-border-radius: 0.3rem;--mg-button-icon-border-radius: var(--default-size);--mg-button-disabled-opacity: var(--mg-disabled-opacity);--mg-button-gradient: 1;--mg-button-border-variation: 1;--mg-button-primary-color-h: var(--color-dark-h);--mg-button-primary-color-s: var(--color-dark-s);--mg-button-primary-color-l: var(--color-dark-l);--mg-button-primary-font-color: var(--color-neutral);--mg-button-secondary-color-h: var(--color-neutral-h);--mg-button-secondary-color-s: var(--color-neutral-s);--mg-button-secondary-color-l: var(--color-neutral-l);--mg-button-secondary-font-color: var(--color-dark);--mg-tag-height: 2.3rem;--mg-tag-border-radius: 0.5rem;--mg-tag-font-size: 1.2rem;--mg-badge-size: 1.6rem;--mg-badge-font-size: 1.1rem;--mg-tooltip-border-radius: 0.5rem;--mg-tooltip-background-color: var(--color-dark);--mg-tooltip-font-color: var(--color-font-light);--mg-popover-background-color: var(--color-light);--mg-popover-font-color: var(--color-font-dark);--mg-popover-title-font-size: 1.4rem;--mg-popover-max-width: 40rem;--mg-message-border-radius: 0.3rem;--mg-modal-border-radius: 0.5rem;--mg-modal-title-font-size: 1.8rem;--mg-modal-content-font-size: 1.2rem;--mg-panel-border-radius: 0.5rem;--mg-panel-background: var(--color-info-h) var(--color-info-s) calc(var(--color-info-l) + 68%);--mg-panel-box-shadow: var(--box-shadow);--mg-panel-content-padding: 1.5rem;--mg-illustrated-message-padding-vertical: 4rem;--mg-card-padding-default: 1.6rem;--mg-card-border-radius-default: 0.5rem;--mg-card-background-default: hsl(var(--color-light));--mg-card-border-default: 0.1rem solid hsl(var(--color-dark) / 5%);--mg-card-box-shadow-default: var(--box-shadow);--mg-divider-background-color: hsl(var(--color-dark) / 15%);--mg-divider-thickness: 0.1rem;--mg-divider-vertical-spacing: 4rem;--mg-grid-spacing: 1rem;--mg-inputs-border-width: 0.1rem;--mg-inputs-border-radius: 0.3rem;--mg-inputs-color: #b5c2c9;--mg-inputs-spacer: 1rem;--mg-inputs-error-bg-color: var(--color-danger-h) calc(var(--color-danger-s) + 5%) calc(var(--color-danger-l) + 49%);--mg-inputs-color-shadow-focus-hsl: 188 100% 50%;--mg-input-toggle-border-radius-ratio: 2;--mg-input-check-size: 1.3rem;--mg-menu-item-focused-background-color-hsl: var(--mg-color-app-hsl);--mg-menu-item-border-color-active-hsl: var(--mg-color-app-hsl);--mg-menu-item-color-active-hsl: var(--mg-color-app-hsl);--mg-tabs-focused-background-color-hsl: var(--mg-color-app-hsl);--mg-tabs-border-color-active-hsl: var(--mg-color-app-hsl);--mg-tabs-color-active-hsl: var(--mg-color-app-hsl);--mg-tabs-border-bottom: solid 0.1rem hsl(var(--mg-color-dark-soft-hsl));--mg-details-spacing: 1.5rem}/*# sourceMappingURL=variables.css.map */
@@ -1,4 +1,5 @@
1
1
  import { h } from '@stencil/core/internal/client';
2
+ import { i as isValidString } from './components.utils.js';
2
3
 
3
4
  /**
4
5
  * Possible input width
@@ -26,27 +27,27 @@ const applyAriadescribedBy = (children, ariaDescribedbyIDs, utils) => utils.map(
26
27
  * @param props - MgInput Interface Props
27
28
  */
28
29
  const manageClasses = (props) => {
29
- props.classCollection.add('mg-input');
30
+ props.classCollection.add('mg-c-input');
30
31
  if (props.labelOnTop)
31
- props.classCollection.add('mg-input--label-on-top');
32
+ props.classCollection.add('mg-c-input--label-on-top');
32
33
  else
33
- props.classCollection.delete('mg-input--label-on-top');
34
+ props.classCollection.delete('mg-c-input--label-on-top');
34
35
  if (props.readonly)
35
- props.classCollection.add('mg-input--readonly');
36
+ props.classCollection.add('mg-c-input--readonly');
36
37
  else
37
- props.classCollection.delete('mg-input--readonly');
38
+ props.classCollection.delete('mg-c-input--readonly');
38
39
  widths.forEach(width => {
39
- props.classCollection.delete(`mg-input--width-${width}`);
40
+ props.classCollection.delete(`mg-c-input--width-${width}`);
40
41
  });
41
42
  if (props.mgWidth !== undefined)
42
- props.classCollection.add(`mg-input--width-${props.mgWidth}`);
43
+ props.classCollection.add(`mg-c-input--width-${props.mgWidth}`);
43
44
  };
44
45
  /**
45
46
  * Get tagname
46
47
  * @param isFieldset - is fieldset
47
48
  * @returns tag name
48
49
  */
49
- const getTagName = (isFieldset) => (isFieldset ? 'fieldset' : 'div');
50
+ const getTagName = (isFieldset, readOnly) => (!isFieldset || readOnly ? 'div' : 'fieldset');
50
51
  /**
51
52
  * Get input template
52
53
  * @param props - MgInput Interface Props
@@ -58,10 +59,10 @@ const MgInput = (props, children, utils) => {
58
59
  /**
59
60
  * Check required properties
60
61
  */
61
- if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
62
+ if (!isValidString(props.identifier)) {
62
63
  throw new Error('<mg-input> prop "identifier" is required.');
63
64
  }
64
- if (typeof props.label !== 'string' || props.label.trim() === '') {
65
+ if (!isValidString(props.label)) {
65
66
  throw new Error('<mg-input> prop "label" is required.');
66
67
  }
67
68
  if (props.labelOnTop && props.labelHide) {
@@ -105,7 +106,7 @@ const MgInput = (props, children, utils) => {
105
106
  *
106
107
  * Error message is based on this aria method: https://www.w3.org/WAI/tutorials/forms/notifications/#on-focus-change
107
108
  */
108
- const TagName = getTagName(props.isFieldset);
109
+ const TagName = getTagName(props.isFieldset, props.readonly);
109
110
  /**
110
111
  * Get tooltip node
111
112
  * @returns mg-tooltip
@@ -117,19 +118,19 @@ const MgInput = (props, children, utils) => {
117
118
  * Display asterisk only if not disabled and not readonly
118
119
  * @returns mg-input-title
119
120
  */
120
- const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
121
+ 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));
121
122
  return (h(TagName, { class: props.classCollection.join() },
122
- props.labelOnTop ? (h("div", { class: "mg-input__title" },
123
+ props.labelOnTop ? (h("div", { class: "mg-c-input__title" },
123
124
  getInputTitle(),
124
125
  !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()),
125
- props.readonly ? (h("div", { class: "mg-input__input-container" },
126
+ props.readonly ? (h("div", { class: "mg-c-input__input-container" },
126
127
  h("strong", null, props.readonlyValue),
127
- children.filter(child => child.$name$ === 'append-input'))) : (h("div", { class: "mg-input__input-container" },
128
- h("div", { class: { 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined } },
128
+ children.filter(child => Object.values(child).includes('append-input')))) : (h("div", { class: "mg-c-input__input-container" },
129
+ h("div", { class: { 'mg-c-input__input': true, 'mg-c-input__input--has-error': props.errorMessage !== undefined } },
129
130
  applyAriadescribedBy(children, ariaDescribedbyIDs, utils),
130
131
  !props.labelOnTop && props.tooltip && getTooltip()),
131
- props.helpText && h("div", { id: helpTextId, class: "mg-input__help-text", innerHTML: props.helpText }),
132
- props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
132
+ props.helpText && h("div", { id: helpTextId, class: "mg-c-input__help-text", innerHTML: props.helpText }),
133
+ props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-c-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
133
134
  };
134
135
 
135
136
  export { MgInput as M };
@@ -1 +1 @@
1
- {"file":"MgInput.js","mappings":";;AAAA;;;AAGO,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,CAAU;;ACCjD;;;;;;;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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KAAK,CAAC,QAAQ,GAAQ;MACpG,KAAK,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,KACvD,WAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAC,iBAAiB,EAAC,SAAS,EAAE,KAAK,CAAC,YAAY,eAAY,WAAW,GAAO,CAC9G,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","import { FunctionalComponent, h, VNode, FunctionalUtilities } from '@stencil/core';\nimport { widths, Width } from './MgInput.conf';\nimport { ClassList } from '../../../utils/components.utils';\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-input');\n\n if (props.labelOnTop) props.classCollection.add('mg-input--label-on-top');\n else props.classCollection.delete('mg-input--label-on-top');\n\n if (props.readonly) props.classCollection.add('mg-input--readonly');\n else props.classCollection.delete('mg-input--readonly');\n\n widths.forEach(width => {\n props.classCollection.delete(`mg-input--width-${width}`);\n });\n if (props.mgWidth !== undefined) props.classCollection.add(`mg-input--width-${props.mgWidth}`);\n};\n\n/**\n * Get tagname\n * @param isFieldset - is fieldset\n * @returns tag name\n */\nconst getTagName = (isFieldset: boolean): string => (isFieldset ? 'fieldset' : 'div');\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: boolean;\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 (typeof props.identifier !== 'string' || props.identifier.trim() === '') {\n throw new Error('<mg-input> prop \"identifier\" is required.');\n }\n if (typeof props.label !== 'string' || props.label.trim() === '') {\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: string = getTagName(props.isFieldset);\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 class={props.labelHide ? 'sr-only' : 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-input__title\">\n {getInputTitle()}\n {!props.readonly && props.tooltip && getTooltip()}\n </div>\n ) : (\n getInputTitle()\n )}\n {props.readonly ? (\n <div class=\"mg-input__input-container\">\n <strong>{props.readonlyValue}</strong>\n {children.filter(child => child.$name$ === 'append-input')}\n </div>\n ) : (\n <div class=\"mg-input__input-container\">\n <div class={{ 'mg-input__input': true, 'mg-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-input__help-text\" innerHTML={props.helpText}></div>}\n {props.errorMessage && !props.readonly && !props.disabled && (\n <div id={helpTextErrorId} class=\"mg-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;;ACCjD;;;;;;;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,CAAC,0BAA0B,CAAC,CAAC;EAE9D,IAAI,KAAK,CAAC,QAAQ;IAAE,KAAK,CAAC,eAA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AAE,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","import { FunctionalComponent, h, VNode, FunctionalUtilities } from '@stencil/core';\nimport { widths, Width } from './MgInput.conf';\nimport { ClassList, isValidString } from '../../../utils/components.utils';\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: boolean;\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}
@@ -132,7 +132,17 @@ const getChildWindows = (localWindow, windows = []) => {
132
132
  * @returns if string is valid
133
133
  */
134
134
  const isValidString = (value) => typeof value === 'string' && value.trim() !== '';
135
+ /**
136
+ * Clean string caraters
137
+ * @param text - text to cliean
138
+ * @returns cleanded string
139
+ */
140
+ const cleanString = (text) => typeof text === 'string' &&
141
+ text
142
+ .toLocaleLowerCase()
143
+ .normalize('NFD')
144
+ .replaceAll(/[\u0300-\u036f]/g, '');
135
145
 
136
- export { ClassList as C, allItemsAreString as a, isValidString as b, createID as c, focusableElements as f, getWindows as g, isTagName as i };
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 };
137
147
 
138
148
  //# sourceMappingURL=components.utils.js.map