@mgdis/mg-components 5.17.0 → 5.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) 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 +761 -582
  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 +5 -5
  9. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -9
  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 +12 -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 +9 -9
  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 +13 -15
  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 +5 -4
  31. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-tag/mg-tag.js +9 -9
  33. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  34. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +23 -0
  35. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +1 -0
  36. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +5 -5
  37. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +1 -1
  38. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
  39. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  40. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +37 -17
  41. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  42. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +7 -1
  43. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -1
  44. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +9 -1
  45. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/MgInput.js +12 -11
  47. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +4 -4
  49. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
  51. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  53. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +111 -38
  54. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  55. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +21 -27
  56. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +1 -1
  57. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +62 -6
  58. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +84 -13
  60. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  61. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +55 -0
  62. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -1
  63. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +115 -44
  64. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  65. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +55 -0
  66. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -1
  67. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +88 -15
  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-password/test/mg-input-password.spec.js +55 -0
  70. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -1
  71. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +87 -14
  72. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  73. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +1 -1
  74. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +1 -1
  75. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +60 -0
  76. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -1
  77. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +87 -14
  78. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  79. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +55 -0
  80. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -1
  81. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +5 -0
  82. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -0
  83. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +151 -34
  84. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  85. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +147 -0
  86. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +1 -0
  87. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +80 -7
  88. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
  89. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +110 -36
  90. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  91. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +69 -6
  92. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
  93. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -9
  94. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  95. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +2 -2
  96. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -1
  97. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +2 -2
  98. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  99. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +8 -9
  100. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  101. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +6 -6
  102. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  103. package/dist/collection/components/molecules/mg-details/mg-details.js +5 -4
  104. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  105. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +1 -1
  106. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +1 -1
  107. package/dist/collection/components/molecules/mg-form/mg-form.js +6 -6
  108. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  109. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +4 -4
  110. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -1
  111. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +7 -7
  112. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  113. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +5 -4
  114. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  115. package/dist/collection/components/molecules/mg-message/mg-message.js +8 -8
  116. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  117. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +11 -11
  118. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +1 -1
  119. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
  120. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  121. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +7 -7
  122. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -1
  123. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +3 -3
  124. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +1 -1
  125. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +1 -1
  126. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +1 -1
  127. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +3 -3
  128. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  129. package/dist/collection/components/molecules/mg-panel/mg-panel.js +17 -15
  130. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  131. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +3 -3
  132. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
  133. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +11 -21
  134. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -1
  135. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -4
  136. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  137. package/dist/collection/components/molecules/mg-popover/mg-popover.js +36 -16
  138. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  139. package/dist/collection/components/molecules/mg-popover/test/{mg-popover.e2e.js → mg-popover.e2e.playwright.js} +54 -62
  140. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +1 -0
  141. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +12 -0
  142. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +1 -1
  143. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -6
  144. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  145. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +34 -34
  146. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  147. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +13 -13
  148. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +1 -1
  149. package/dist/collection/locales/en/messages.json +3 -3
  150. package/dist/collection/locales/fr/messages.json +3 -3
  151. package/dist/collection/utils/components.utils.js +16 -0
  152. package/dist/collection/utils/components.utils.js.map +1 -1
  153. package/dist/collection/utils/components.utils.spec.js +22 -1
  154. package/dist/collection/utils/components.utils.spec.js.map +1 -1
  155. package/dist/collection/variables.css +1 -275
  156. package/dist/components/MgInput.js +17 -16
  157. package/dist/components/MgInput.js.map +1 -1
  158. package/dist/components/components.utils.js +17 -1
  159. package/dist/components/components.utils.js.map +1 -1
  160. package/dist/components/index2.js +6 -6
  161. package/dist/components/mg-action-more.js +5 -5
  162. package/dist/components/mg-action-more.js.map +1 -1
  163. package/dist/components/mg-badge2.js +8 -8
  164. package/dist/components/mg-badge2.js.map +1 -1
  165. package/dist/components/mg-button2.js +11 -11
  166. package/dist/components/mg-button2.js.map +1 -1
  167. package/dist/components/mg-card2.js +8 -8
  168. package/dist/components/mg-card2.js.map +1 -1
  169. package/dist/components/mg-character-left2.js +1 -1
  170. package/dist/components/mg-character-left2.js.map +1 -1
  171. package/dist/components/mg-details.js +4 -3
  172. package/dist/components/mg-details.js.map +1 -1
  173. package/dist/components/mg-divider.js +3 -3
  174. package/dist/components/mg-divider.js.map +1 -1
  175. package/dist/components/mg-form.js +4 -4
  176. package/dist/components/mg-form.js.map +1 -1
  177. package/dist/components/mg-icon2.js +12 -14
  178. package/dist/components/mg-icon2.js.map +1 -1
  179. package/dist/components/mg-illustrated-message.js +7 -7
  180. package/dist/components/mg-illustrated-message.js.map +1 -1
  181. package/dist/components/mg-input-checkbox-paginated2.js +8 -8
  182. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  183. package/dist/components/mg-input-checkbox.js +70 -34
  184. package/dist/components/mg-input-checkbox.js.map +1 -1
  185. package/dist/components/mg-input-date.js +45 -12
  186. package/dist/components/mg-input-date.js.map +1 -1
  187. package/dist/components/mg-input-numeric.js +76 -43
  188. package/dist/components/mg-input-numeric.js.map +1 -1
  189. package/dist/components/mg-input-password.js +49 -14
  190. package/dist/components/mg-input-password.js.map +1 -1
  191. package/dist/components/mg-input-radio.js +48 -13
  192. package/dist/components/mg-input-radio.js.map +1 -1
  193. package/dist/components/mg-input-select2.js +48 -13
  194. package/dist/components/mg-input-select2.js.map +1 -1
  195. package/dist/components/mg-input-text2.js +83 -33
  196. package/dist/components/mg-input-text2.js.map +1 -1
  197. package/dist/components/mg-input-textarea.js +69 -35
  198. package/dist/components/mg-input-textarea.js.map +1 -1
  199. package/dist/components/mg-input-title2.js +4 -3
  200. package/dist/components/mg-input-title2.js.map +1 -1
  201. package/dist/components/mg-input-toggle.js +9 -9
  202. package/dist/components/mg-input-toggle.js.map +1 -1
  203. package/dist/components/mg-item-more.js +4 -3
  204. package/dist/components/mg-item-more.js.map +1 -1
  205. package/dist/components/mg-menu-item2.js +7 -8
  206. package/dist/components/mg-menu-item2.js.map +1 -1
  207. package/dist/components/mg-menu2.js +1 -1
  208. package/dist/components/mg-menu2.js.map +1 -1
  209. package/dist/components/mg-message.js +7 -7
  210. package/dist/components/mg-message.js.map +1 -1
  211. package/dist/components/mg-modal.js +7 -7
  212. package/dist/components/mg-modal.js.map +1 -1
  213. package/dist/components/mg-pagination2.js +2 -2
  214. package/dist/components/mg-pagination2.js.map +1 -1
  215. package/dist/components/mg-panel.js +16 -15
  216. package/dist/components/mg-panel.js.map +1 -1
  217. package/dist/components/mg-popover-content2.js +4 -4
  218. package/dist/components/mg-popover-content2.js.map +1 -1
  219. package/dist/components/mg-popover2.js +33 -14
  220. package/dist/components/mg-popover2.js.map +1 -1
  221. package/dist/components/mg-skip-links.js +4 -5
  222. package/dist/components/mg-skip-links.js.map +1 -1
  223. package/dist/components/mg-tabs.js +33 -33
  224. package/dist/components/mg-tabs.js.map +1 -1
  225. package/dist/components/mg-tag.js +8 -8
  226. package/dist/components/mg-tag.js.map +1 -1
  227. package/dist/components/mg-tooltip-content2.js +1 -1
  228. package/dist/components/mg-tooltip-content2.js.map +1 -1
  229. package/dist/components/mg-tooltip2.js +34 -15
  230. package/dist/components/mg-tooltip2.js.map +1 -1
  231. package/dist/esm/{mg-menu.conf-012fc9b4.js → components.utils-0f76010d.js} +153 -8
  232. package/dist/esm/components.utils-0f76010d.js.map +1 -0
  233. package/dist/esm/index-ce01e63b.js +18 -1
  234. package/dist/esm/loader.js +1 -1
  235. package/dist/esm/mg-action-more_34.entry.js +697 -518
  236. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  237. package/dist/esm/mg-components.js +1 -1
  238. package/dist/esm/mg-item-more.entry.js +4 -4
  239. package/dist/esm/mg-item-more.entry.js.map +1 -1
  240. package/dist/mg-components/locales/en/messages.json +3 -3
  241. package/dist/mg-components/locales/fr/messages.json +3 -3
  242. package/dist/mg-components/mg-components.css +1 -1
  243. package/dist/mg-components/mg-components.esm.js +1 -1
  244. package/dist/mg-components/mg-components.esm.js.map +1 -1
  245. package/dist/mg-components/p-768fc594.entry.js +2 -0
  246. package/dist/mg-components/p-768fc594.entry.js.map +1 -0
  247. package/dist/mg-components/p-c9e2c669.js +2 -0
  248. package/dist/mg-components/p-c9e2c669.js.map +1 -0
  249. package/dist/mg-components/p-d2d6afec.entry.js +2 -0
  250. package/dist/mg-components/p-d2d6afec.entry.js.map +1 -0
  251. package/dist/mg-components/variables.css +1 -275
  252. package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
  253. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -1
  254. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +4 -3
  255. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +1 -1
  256. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +4 -4
  257. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +22 -1
  258. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +17 -2
  259. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +35 -20
  260. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -1
  261. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +16 -1
  262. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +16 -1
  263. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +12 -0
  264. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +30 -6
  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-textarea/mg-input-textarea.d.ts +17 -5
  267. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -1
  268. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  269. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +3 -3
  270. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +2 -1
  271. package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +1 -0
  272. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +6 -5
  273. package/dist/types/components.d.ts +71 -13
  274. package/dist/types/utils/components.utils.d.ts +12 -0
  275. package/package.json +17 -18
  276. package/readme.md +0 -31
  277. package/dist/cjs/mg-menu.conf-43aacf30.js.map +0 -1
  278. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -116
  279. package/dist/collection/components/atoms/mg-button/mg-button.css +0 -182
  280. package/dist/collection/components/atoms/mg-card/mg-card.css +0 -75
  281. package/dist/collection/components/atoms/mg-character-left/mg-character-left.css +0 -3
  282. package/dist/collection/components/atoms/mg-divider/mg-divider.css +0 -9
  283. package/dist/collection/components/atoms/mg-icon/mg-icon.css +0 -138
  284. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +0 -12
  285. package/dist/collection/components/atoms/mg-tag/mg-tag.css +0 -131
  286. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js +0 -37
  287. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js.map +0 -1
  288. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.css +0 -43
  289. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +0 -3
  290. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +0 -268
  291. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +0 -211
  292. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +0 -257
  293. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +0 -254
  294. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +0 -179
  295. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +0 -264
  296. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +0 -304
  297. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js +0 -171
  298. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js.map +0 -1
  299. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +0 -303
  300. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +0 -233
  301. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +0 -37
  302. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +0 -377
  303. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +0 -39
  304. package/dist/collection/components/molecules/mg-details/mg-details.css +0 -64
  305. package/dist/collection/components/molecules/mg-form/mg-form.css +0 -19
  306. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +0 -45
  307. package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +0 -30
  308. package/dist/collection/components/molecules/mg-message/mg-message.css +0 -82
  309. package/dist/collection/components/molecules/mg-modal/mg-modal.css +0 -67
  310. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +0 -47
  311. package/dist/collection/components/molecules/mg-panel/mg-panel.css +0 -64
  312. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.css +0 -135
  313. package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -11
  314. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +0 -1
  315. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +0 -28
  316. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -99
  317. package/dist/collection/styles/a11y.scss +0 -36
  318. package/dist/collection/styles/fonts.scss +0 -21
  319. package/dist/collection/styles/form.scss +0 -3
  320. package/dist/collection/styles/global.scss +0 -80
  321. package/dist/collection/styles/layout.scss +0 -29
  322. package/dist/collection/styles/main.scss +0 -23
  323. package/dist/collection/styles/mg-icon-animation.scss +0 -6
  324. package/dist/collection/styles/navigation-button.scss +0 -77
  325. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +0 -11
  326. package/dist/collection/styles/typography.scss +0 -82
  327. package/dist/collection/styles/utilities.scss +0 -21
  328. package/dist/collection/test/typography.e2e.playwright.js +0 -12
  329. package/dist/collection/test/typography.e2e.playwright.js.map +0 -1
  330. package/dist/esm/mg-menu.conf-012fc9b4.js.map +0 -1
  331. package/dist/mg-components/p-1d7d6fa0.js +0 -2
  332. package/dist/mg-components/p-1d7d6fa0.js.map +0 -1
  333. package/dist/mg-components/p-9257e8f1.entry.js +0 -2
  334. package/dist/mg-components/p-9257e8f1.entry.js.map +0 -1
  335. package/dist/mg-components/p-caafc9cf.entry.js +0 -2
  336. package/dist/mg-components/p-caafc9cf.entry.js.map +0 -1
  337. package/dist/mg-components/styles/a11y.scss +0 -36
  338. package/dist/mg-components/styles/fonts.scss +0 -21
  339. package/dist/mg-components/styles/form.scss +0 -3
  340. package/dist/mg-components/styles/global.scss +0 -80
  341. package/dist/mg-components/styles/layout.scss +0 -29
  342. package/dist/mg-components/styles/main.scss +0 -23
  343. package/dist/mg-components/styles/mg-icon-animation.scss +0 -6
  344. package/dist/mg-components/styles/navigation-button.scss +0 -77
  345. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +0 -11
  346. package/dist/mg-components/styles/typography.scss +0 -82
  347. package/dist/mg-components/styles/utilities.scss +0 -21
  348. /package/dist/types/{test/typography.e2e.playwright.d.ts → components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts} +0 -0
@@ -1,7 +1,8 @@
1
- import { createPage } from "../../../../utils/stencil.e2e.test.utils";
1
+ import { setPageContent, expect, describe, describeEach, testEach, test } from "../../../../utils/playwright.e2e.test.utils";
2
2
  import { renderAttributes } from "../../../../utils/e2e.test.utils";
3
+ const TIMEOUT = 1000;
3
4
  describe('mg-popover', () => {
4
- describe.each([
5
+ describeEach([
5
6
  'auto',
6
7
  'auto-start',
7
8
  'auto-end',
@@ -18,8 +19,8 @@ describe('mg-popover', () => {
18
19
  'left-start',
19
20
  'left-end',
20
21
  ])('placement %s', placement => {
21
- test.each([true, false])('Should render, case hide arrow %s', async (arrowHide) => {
22
- const page = await createPage(`<style>mg-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>
22
+ testEach([true, false])('Should render, case hide arrow %s', async (page, arrowHide) => {
23
+ await setPageContent(page, `<style>mg-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>
23
24
  <mg-popover ${renderAttributes({ placement, arrowHide })}>
24
25
  <mg-button>Button</mg-button>
25
26
  <h2 slot="title">Blu bli blo bla</h2>
@@ -31,43 +32,36 @@ describe('mg-popover', () => {
31
32
  cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
32
33
  non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
33
34
  </p>
34
- </mg-popover>`);
35
- const mgPopover = await page.find('mg-popover');
36
- const mgButton = await page.find('mg-button');
37
- const popover = await page.find('mg-popover mg-popover-content');
38
- expect(mgPopover).toHaveClass('hydrated');
35
+ </mg-popover>`, { height: 900, width: 900 });
36
+ const mgPopover = await page.locator('mg-popover');
37
+ const mgButton = await page.locator('mg-button');
38
+ const mgPopoverContent = await page.locator('mg-popover-content');
39
+ await mgPopover.waitFor({ timeout: TIMEOUT });
39
40
  // display popover on click on slotted element
40
- mgButton.triggerEvent('click');
41
- await page.waitForChanges();
42
- await page.waitForNetworkIdle();
43
- expect(popover).toHaveAttribute('data-show');
44
- await page.setViewport({ width: 800, height: 800 });
45
- const screenshot = await page.screenshot();
46
- expect(screenshot).toMatchImageSnapshot();
41
+ await mgButton.click();
42
+ await mgPopoverContent.waitFor({ timeout: TIMEOUT });
43
+ expect(await mgPopoverContent.getAttribute('data-show')).toEqual('');
44
+ await expect(page.locator('body')).toHaveScreenshot();
47
45
  // hide popover on click on slotted element
48
- mgButton.triggerEvent('click');
49
- await page.waitForChanges();
50
- await page.waitForNetworkIdle();
51
- expect(popover).not.toHaveAttribute('data-show');
46
+ await mgButton.click();
47
+ expect(await mgPopoverContent.getAttribute('data-show')).toEqual(null);
52
48
  // display popover on keyboad click event on slotted element
53
49
  await page.keyboard.down('Tab');
50
+ await page.keyboard.down('Tab');
54
51
  await page.keyboard.down('Enter');
55
- await page.waitForChanges();
56
- await page.waitForNetworkIdle();
57
- expect(popover).toHaveAttribute('data-show');
52
+ await mgPopoverContent.waitFor({ timeout: TIMEOUT });
53
+ expect(await mgPopoverContent.getAttribute('data-show')).toEqual('');
58
54
  // hide popover on keyboad escape key
59
55
  await page.keyboard.down('Escape');
60
- await page.waitForChanges();
61
- await page.waitForNetworkIdle();
62
- expect(popover).not.toHaveAttribute('data-show');
56
+ expect(await mgPopoverContent.getAttribute('data-show')).toEqual(null);
63
57
  });
64
58
  });
65
- describe.each([
59
+ describeEach([
66
60
  '',
67
61
  '<h2 slot="title">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>',
68
- ])('with or without title', title => {
69
- test('Should render with close button', async () => {
70
- const page = await createPage(`<mg-popover display close-button>
62
+ ])('with or without title %s', title => {
63
+ test('Should render with close button', async ({ page }) => {
64
+ await setPageContent(page, `<mg-popover display close-button>
71
65
  <mg-button>Button</mg-button>
72
66
  ${title}
73
67
  <p slot="content">
@@ -78,37 +72,41 @@ describe('mg-popover', () => {
78
72
  cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
79
73
  non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
80
74
  </p>
81
- </mg-popover>`);
82
- const mgPopover = await page.find('mg-popover');
83
- expect(mgPopover).toHaveClass('hydrated');
84
- await page.setViewport({ width: 500, height: 350 });
85
- const screenshot = await page.screenshot();
86
- expect(screenshot).toMatchImageSnapshot();
75
+ </mg-popover>`, { width: 400, height: 350 });
76
+ await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });
77
+ await expect(page.locator('body')).toHaveScreenshot();
87
78
  });
88
79
  });
89
- describe.each(['title', 'content'])('re-position %s slot', slot => {
90
- test('should re-position when slot size change', async () => {
80
+ describeEach(['title', 'content'])('re-position %s slot', slot => {
81
+ test('should re-position when slot size change', async ({ page }) => {
91
82
  const tagName = slot === 'title' ? 'h2' : 'p';
92
- const page = await createPage(`<style>mg-button{position:fixed;left:50%;transform:translateX(-50%)}</style>
83
+ await setPageContent(page, `<style>mg-button{position:fixed;left:50%;transform:translateX(-50%)}</style>
93
84
  <mg-popover ${renderAttributes({ placement: 'bottom-start', display: true })}>
94
85
  <mg-button>Button</mg-button>
95
86
  <${tagName} slot="${slot}">
96
87
  Lorem ipsum
97
88
  </${tagName}>
98
- </mg-popover>`, { width: 400, height: 100 });
99
- let screenshot = await page.screenshot();
100
- expect(screenshot).toMatchImageSnapshot();
89
+ </mg-popover>`, { width: 400, height: 130 });
90
+ await expect(page.locator('body')).toHaveScreenshot();
101
91
  await page.$eval(`mg-popover-content [slot="${slot}"]`, el => {
102
92
  el.textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
103
93
  });
104
- await page.waitForChanges();
105
- screenshot = await page.screenshot();
106
- expect(screenshot).toMatchImageSnapshot();
94
+ await expect(page.locator('body')).toHaveScreenshot();
107
95
  });
108
96
  });
97
+ test(`should position popover where it have enough place`, async ({ page }) => {
98
+ await setPageContent(page, `<style>mg-button{position:fixed;left:0;bottom:0}</style>
99
+ <mg-popover ${renderAttributes({ display: true })}>
100
+ <mg-button>Button</mg-button>
101
+ <p slot="content">
102
+ Lorem ipsum
103
+ </p>
104
+ </mg-popover>`, { width: 400, height: 100 });
105
+ await expect(page.locator('body')).toHaveScreenshot();
106
+ });
109
107
  describe('style', () => {
110
- test('Should render with child mg-card', async () => {
111
- const page = await createPage(`<mg-popover display close-button class="custom-popover-card">
108
+ test('Should render with child mg-card', async ({ page }) => {
109
+ await setPageContent(page, `<mg-popover display close-button class="custom-popover-card">
112
110
  <mg-button>Button</mg-button>
113
111
  <mg-card slot="content">
114
112
  My custom card
@@ -119,15 +117,12 @@ describe('mg-popover', () => {
119
117
  --mg-popover-background-color: var(--color-danger);
120
118
  }
121
119
  </style>
122
- `);
123
- const mgPopover = await page.find('mg-popover');
124
- expect(mgPopover).toHaveClass('hydrated');
125
- await page.setViewport({ width: 500, height: 300 });
126
- const screenshot = await page.screenshot();
127
- expect(screenshot).toMatchImageSnapshot();
120
+ `, { width: 150, height: 180 });
121
+ await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });
122
+ await expect(page.locator('body')).toHaveScreenshot();
128
123
  });
129
- test.each(['content', 'title'])('Should render with --mg-popover-max-width', async (slot) => {
130
- const page = await createPage(`<mg-popover display close-button class="custom-popover">
124
+ testEach(['content', 'title'])('Should render with --mg-popover-max-width %s', async (page, slot) => {
125
+ await setPageContent(page, `<mg-popover display close-button class="custom-popover">
131
126
  <mg-button>Button</mg-button>
132
127
  <h2 slot="${slot}">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>
133
128
  </mg-popover>
@@ -136,13 +131,10 @@ describe('mg-popover', () => {
136
131
  --mg-popover-max-width: 10rem;
137
132
  }
138
133
  </style>
139
- `);
140
- const mgPopover = await page.find('mg-popover');
141
- expect(mgPopover).toHaveClass('hydrated');
142
- await page.setViewport({ width: 500, height: 300 });
143
- const screenshot = await page.screenshot();
144
- expect(screenshot).toMatchImageSnapshot();
134
+ `, { width: 300, height: 300 });
135
+ await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });
136
+ await expect(page.locator('body')).toHaveScreenshot();
145
137
  });
146
138
  });
147
139
  });
148
- //# sourceMappingURL=mg-popover.e2e.js.map
140
+ //# sourceMappingURL=mg-popover.e2e.playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-popover.e2e.playwright.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-popover/test/mg-popover.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAY,IAAI,EAAE,MAAM,6CAA6C,CAAC;AACvI,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,OAAO,GAAG,IAAI,CAAC;AAErB,QAAQ,CAAC,YAAY,EAAE,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F,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;EACxD,CAAC,CAAC,CAAC;EAEH,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,CAAC,kCAAkC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;MAC1D,MAAM,cAAc,CAClB,IAAI,EACJ;;;;;;;;;;;SAWC,EACD,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAC5B,CAAC;MAEF,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;MAExE,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,8CAA8C,EAAE,KAAK,EAAE,IAAc,EAAE,IAAI,EAAE,EAAE;MAC5G,MAAM,cAAc,CAClB,IAAI,EACJ;;oBAEY,IAAI;;;;;;;SAOf,EACD,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAC5B,CAAC;MAEF,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;MAExE,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { setPageContent, expect, describe, describeEach, testEach, PageType, test } from '../../../../utils/playwright.e2e.test.utils';\nimport { renderAttributes } from '../../../../utils/e2e.test.utils';\n\nconst TIMEOUT = 1000;\n\ndescribe('mg-popover', () => {\n describeEach([\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'top-start',\n 'top-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'right',\n 'right-start',\n 'right-end',\n 'left',\n 'left-start',\n 'left-end',\n ])('placement %s', placement => {\n testEach([true, false])('Should render, case hide arrow %s', async (page: PageType, arrowHide) => {\n await setPageContent(\n page,\n `<style>mg-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>\n <mg-popover ${renderAttributes({ placement, arrowHide })}>\n <mg-button>Button</mg-button>\n <h2 slot=\"title\">Blu bli blo bla</h2>\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n </mg-popover>`,\n { height: 900, width: 900 },\n );\n\n const mgPopover = await page.locator('mg-popover');\n const mgButton = await page.locator('mg-button');\n const mgPopoverContent = await page.locator('mg-popover-content');\n\n await mgPopover.waitFor({ timeout: TIMEOUT });\n\n // display popover on click on slotted element\n await mgButton.click();\n\n await mgPopoverContent.waitFor({ timeout: TIMEOUT });\n\n expect(await mgPopoverContent.getAttribute('data-show')).toEqual('');\n\n await expect(page.locator('body')).toHaveScreenshot();\n\n // hide popover on click on slotted element\n await mgButton.click();\n\n expect(await mgPopoverContent.getAttribute('data-show')).toEqual(null);\n\n // display popover on keyboad click event on slotted element\n await page.keyboard.down('Tab');\n await page.keyboard.down('Tab');\n await page.keyboard.down('Enter');\n\n await mgPopoverContent.waitFor({ timeout: TIMEOUT });\n expect(await mgPopoverContent.getAttribute('data-show')).toEqual('');\n\n // hide popover on keyboad escape key\n await page.keyboard.down('Escape');\n\n expect(await mgPopoverContent.getAttribute('data-show')).toEqual(null);\n });\n });\n\n describeEach([\n '',\n '<h2 slot=\"title\">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>',\n ])('with or without title %s', title => {\n test('Should render with close button', async ({ page }) => {\n await setPageContent(\n page,\n `<mg-popover display close-button>\n <mg-button>Button</mg-button>\n ${title}\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n </mg-popover>`,\n { width: 400, height: 350 },\n );\n\n await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n });\n\n describeEach(['title', 'content'])('re-position %s slot', slot => {\n test('should re-position when slot size change', async ({ page }) => {\n const tagName = slot === 'title' ? 'h2' : 'p';\n await setPageContent(\n page,\n `<style>mg-button{position:fixed;left:50%;transform:translateX(-50%)}</style>\n <mg-popover ${renderAttributes({ placement: 'bottom-start', display: true })}>\n <mg-button>Button</mg-button>\n <${tagName} slot=\"${slot}\">\n Lorem ipsum\n </${tagName}>\n </mg-popover>`,\n { width: 400, height: 130 },\n );\n\n await expect(page.locator('body')).toHaveScreenshot();\n\n await page.$eval(`mg-popover-content [slot=\"${slot}\"]`, el => {\n el.textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';\n });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n });\n\n test(`should position popover where it have enough place`, async ({ page }) => {\n await setPageContent(\n page,\n `<style>mg-button{position:fixed;left:0;bottom:0}</style>\n <mg-popover ${renderAttributes({ display: true })}>\n <mg-button>Button</mg-button>\n <p slot=\"content\">\n Lorem ipsum\n </p>\n </mg-popover>`,\n { width: 400, height: 100 },\n );\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n\n describe('style', () => {\n test('Should render with child mg-card', async ({ page }) => {\n await setPageContent(\n page,\n `<mg-popover display close-button class=\"custom-popover-card\">\n <mg-button>Button</mg-button>\n <mg-card slot=\"content\">\n My custom card\n </mg-card>\n </mg-popover>\n <style>\n .custom-popover-card {\n --mg-popover-background-color: var(--color-danger);\n }\n </style>\n `,\n { width: 150, height: 180 },\n );\n\n await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n\n testEach(['content', 'title'])('Should render with --mg-popover-max-width %s', async (page: PageType, slot) => {\n await setPageContent(\n page,\n `<mg-popover display close-button class=\"custom-popover\">\n <mg-button>Button</mg-button>\n <h2 slot=\"${slot}\">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>\n </mg-popover>\n <style>\n .custom-popover {\n --mg-popover-max-width: 10rem;\n }\n </style>\n `,\n { width: 300, height: 300 },\n );\n\n await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n });\n});\n"]}
@@ -126,5 +126,17 @@ describe('mg-popover', () => {
126
126
  expect(spy).toHaveBeenCalled();
127
127
  expect(page.root).toMatchSnapshot();
128
128
  });
129
+ test('should update mg-popover-content id when identifier is updated', async () => {
130
+ const page = await getPage({ identifier: 'identifier' }, [
131
+ h("h2", { slot: "title" }, "Blu bli blo bla"),
132
+ h("p", { slot: "content" }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."),
133
+ h("mg-button", { identifier: "identifier-btn" }, "mg-button"),
134
+ ]);
135
+ expect(page.root).toMatchSnapshot();
136
+ fireRo([]);
137
+ page.doc.querySelector('mg-popover').identifier = 'new-identifier';
138
+ await page.waitForChanges();
139
+ expect(page.root).toMatchSnapshot();
140
+ });
129
141
  });
130
142
  //# sourceMappingURL=mg-popover.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mg-popover.spec.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-popover/test/mg-popover.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,gBAAgB,EAAE,CAAC;AACnB,gBAAgB,EAAE,CAAC;AAEnB,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAgB,EAAE,EAAE;EAC/C,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,kCAAgB,IAAI,GAAG,IAAI,CAAc,CAAC;EAChE,OAAO,WAAW,CAAC;IACjB,UAAU,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,QAAQ,CAAC;IACnD,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,qCAA6B,IAAI,CAAC,UAAU,IAAG,OAAO,EAAE,CAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;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C,CAAC,SAAS,CAAC,gDAAgD,CAAC,CAAC;KACjF;EACH,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;IACnE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;MACtE,UAAI,IAAI,EAAC,OAAO,sBAAqB;MACrC,SAAG,IAAI,EAAC,SAAS,ocAIb;MACJ,iBAAW,UAAU,EAAC,gBAAgB,gBAAsB;KAC7D,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE3D,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX,MAAM,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC/B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgPopover } from '../mg-popover';\nimport { MgButton } from '../../../atoms/mg-button/mg-button';\nimport { mockConsoleError, mockWindowFrames, setupResizeObserverMock } from '../../../../utils/unit.test.utils';\nimport { MgPopoverContent } from '../mg-popover-content/mg-popover-content';\n\nmockConsoleError();\nmockWindowFrames();\n\nconst getPage = (args, slot, parent?: boolean) => {\n const popover = () => <mg-popover {...args}>{slot}</mg-popover>;\n return newSpecPage({\n components: [MgPopover, MgPopoverContent, MgButton],\n template: () => (parent ? <span data-mg-popover-guard={args.identifier}>{popover()}</span> : popover()),\n });\n};\n\ndescribe('mg-popover', () => {\n let fireRo;\n beforeEach(() => {\n jest.useFakeTimers();\n setupResizeObserverMock({\n observe: function () {\n fireRo = this.cb;\n },\n disconnect: function () {\n return null;\n },\n });\n });\n afterEach(() => jest.clearAllTimers());\n\n test.each([\n { identifier: 'identifier' },\n { identifier: 'identifier', placement: 'auto' },\n { identifier: 'identifier', display: true },\n { identifier: 'identifier', closeButton: true },\n { identifier: 'identifier', display: true },\n { identifier: 'identifier', closeButton: true, lang: 'fr' },\n { identifier: 'identifier', closeButton: true, lang: 'xx' },\n { identifier: 'identifier', arrowHide: true },\n ])('Should render with element', async args => {\n const { root } = await getPage(args, [\n <h2 slot=\"title\">Blu bli blo bla</h2>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ]);\n expect(root).toMatchSnapshot();\n });\n\n test.each([\n { eventIn: 'click', eventOut: 'clickBtn' },\n { eventIn: 'click', eventOut: { code: 'Escape' } },\n { eventIn: 'click', eventOut: 'clickCross' },\n { eventIn: 'click', eventOut: 'clickDocument' },\n { eventIn: 'click', eventOut: 'clickPopover' },\n { eventIn: 'click', eventOut: 'clickGuard' },\n ])('Should manage display on events %s', async ({ eventIn, eventOut }) => {\n const args = { identifier: 'identifier', closeButton: true };\n const page = await getPage(\n args,\n [\n <h2 slot=\"title\">Blu bli blo bla</h2>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ],\n eventOut === 'clickGuard',\n );\n\n const mgPopover = page.doc.querySelector('mg-popover');\n const interactiveElement = mgPopover.querySelector(`[aria-controls*='${args.identifier}']`) as HTMLElement;\n const popover = mgPopover.querySelector(`#${args.identifier}`);\n const popoverButton = popover.shadowRoot.querySelector(`mg-button`);\n const dataGuard = page.doc.querySelector('[data-mg-popover-guard]');\n\n const focusSpy = jest.spyOn(interactiveElement, 'focus');\n const displayChangeSpy = jest.spyOn(page.rootInstance.displayChange, 'emit');\n\n interactiveElement.dispatchEvent(new CustomEvent(eventIn, { bubbles: true }));\n await page.waitForChanges();\n jest.runAllTimers();\n\n expect(popover).toHaveAttribute('data-show');\n\n if (typeof eventOut === 'string') {\n if (eventOut === 'clickBtn') {\n interactiveElement.dispatchEvent(new Event('click', { bubbles: true }));\n } else if (eventOut === 'clickCross') {\n popoverButton.dispatchEvent(new Event('click', { bubbles: true }));\n } else if (eventOut === 'clickDocument') {\n document.dispatchEvent(new Event('click', { bubbles: true }));\n } else if (eventOut === 'clickPopover') {\n popover.dispatchEvent(new Event('click', { bubbles: true }));\n } else if (eventOut === 'clickGuard') {\n dataGuard.dispatchEvent(new Event('click', { bubbles: true }));\n }\n } else {\n mgPopover.dispatchEvent(new KeyboardEvent('keydown', { code: eventOut.code }));\n expect(focusSpy).toHaveBeenCalled();\n }\n await page.waitForChanges();\n\n if (typeof eventOut === 'string' && ['clickPopover', 'clickGuard'].includes(eventOut)) {\n expect(popover).toHaveAttribute('data-show');\n expect(displayChangeSpy).toHaveBeenCalledWith(true);\n } else {\n expect(popover).not.toHaveAttribute('data-show');\n expect(displayChangeSpy).toHaveBeenCalledWith(false);\n }\n });\n\n test('Should throw error if slot title element is not a heading', async () => {\n expect.assertions(1);\n try {\n const args = { identifier: 'identifier', closeButton: true };\n await getPage(args, [\n <span slot=\"title\">Blu bli blo bla</span>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ]);\n } catch (err) {\n expect(err.message).toContain('<mg-popover> Slotted title must be a heading: ');\n }\n });\n\n test('should update popper instance when slot %s update', async () => {\n const page = await getPage({ identifier: 'identifier', display: true }, [\n <h2 slot=\"title\">Blu bli blo bla</h2>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ]);\n expect(page.root).toMatchSnapshot();\n\n const spy = jest.spyOn(page.rootInstance.popper, 'update');\n\n fireRo([]);\n\n expect(spy).toHaveBeenCalled();\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
1
+ {"version":3,"file":"mg-popover.spec.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-popover/test/mg-popover.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAA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,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;IAChF,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE;MACvD,UAAI,IAAI,EAAC,OAAO,sBAAqB;MACrC,SAAG,IAAI,EAAC,SAAS,ocAIb;MACJ,iBAAW,UAAU,EAAC,gBAAgB,gBAAsB;KAC7D,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,UAAU,GAAG,gBAAgB,CAAC;IAEnE,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgPopover } from '../mg-popover';\nimport { MgButton } from '../../../atoms/mg-button/mg-button';\nimport { mockConsoleError, mockWindowFrames, setupResizeObserverMock } from '../../../../utils/unit.test.utils';\nimport { MgPopoverContent } from '../mg-popover-content/mg-popover-content';\n\nmockConsoleError();\nmockWindowFrames();\n\nconst getPage = (args, slot, parent?: boolean) => {\n const popover = () => <mg-popover {...args}>{slot}</mg-popover>;\n return newSpecPage({\n components: [MgPopover, MgPopoverContent, MgButton],\n template: () => (parent ? <span data-mg-popover-guard={args.identifier}>{popover()}</span> : popover()),\n });\n};\n\ndescribe('mg-popover', () => {\n let fireRo;\n beforeEach(() => {\n jest.useFakeTimers();\n setupResizeObserverMock({\n observe: function () {\n fireRo = this.cb;\n },\n disconnect: function () {\n return null;\n },\n });\n });\n afterEach(() => jest.clearAllTimers());\n\n test.each([\n { identifier: 'identifier' },\n { identifier: 'identifier', placement: 'auto' },\n { identifier: 'identifier', display: true },\n { identifier: 'identifier', closeButton: true },\n { identifier: 'identifier', display: true },\n { identifier: 'identifier', closeButton: true, lang: 'fr' },\n { identifier: 'identifier', closeButton: true, lang: 'xx' },\n { identifier: 'identifier', arrowHide: true },\n ])('Should render with element', async args => {\n const { root } = await getPage(args, [\n <h2 slot=\"title\">Blu bli blo bla</h2>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ]);\n expect(root).toMatchSnapshot();\n });\n\n test.each([\n { eventIn: 'click', eventOut: 'clickBtn' },\n { eventIn: 'click', eventOut: { code: 'Escape' } },\n { eventIn: 'click', eventOut: 'clickCross' },\n { eventIn: 'click', eventOut: 'clickDocument' },\n { eventIn: 'click', eventOut: 'clickPopover' },\n { eventIn: 'click', eventOut: 'clickGuard' },\n ])('Should manage display on events %s', async ({ eventIn, eventOut }) => {\n const args = { identifier: 'identifier', closeButton: true };\n const page = await getPage(\n args,\n [\n <h2 slot=\"title\">Blu bli blo bla</h2>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ],\n eventOut === 'clickGuard',\n );\n\n const mgPopover = page.doc.querySelector('mg-popover');\n const interactiveElement = mgPopover.querySelector(`[aria-controls*='${args.identifier}']`) as HTMLElement;\n const popover = mgPopover.querySelector(`#${args.identifier}`);\n const popoverButton = popover.shadowRoot.querySelector(`mg-button`);\n const dataGuard = page.doc.querySelector('[data-mg-popover-guard]');\n\n const focusSpy = jest.spyOn(interactiveElement, 'focus');\n const displayChangeSpy = jest.spyOn(page.rootInstance.displayChange, 'emit');\n\n interactiveElement.dispatchEvent(new CustomEvent(eventIn, { bubbles: true }));\n await page.waitForChanges();\n jest.runAllTimers();\n\n expect(popover).toHaveAttribute('data-show');\n\n if (typeof eventOut === 'string') {\n if (eventOut === 'clickBtn') {\n interactiveElement.dispatchEvent(new Event('click', { bubbles: true }));\n } else if (eventOut === 'clickCross') {\n popoverButton.dispatchEvent(new Event('click', { bubbles: true }));\n } else if (eventOut === 'clickDocument') {\n document.dispatchEvent(new Event('click', { bubbles: true }));\n } else if (eventOut === 'clickPopover') {\n popover.dispatchEvent(new Event('click', { bubbles: true }));\n } else if (eventOut === 'clickGuard') {\n dataGuard.dispatchEvent(new Event('click', { bubbles: true }));\n }\n } else {\n mgPopover.dispatchEvent(new KeyboardEvent('keydown', { code: eventOut.code }));\n expect(focusSpy).toHaveBeenCalled();\n }\n await page.waitForChanges();\n\n if (typeof eventOut === 'string' && ['clickPopover', 'clickGuard'].includes(eventOut)) {\n expect(popover).toHaveAttribute('data-show');\n expect(displayChangeSpy).toHaveBeenCalledWith(true);\n } else {\n expect(popover).not.toHaveAttribute('data-show');\n expect(displayChangeSpy).toHaveBeenCalledWith(false);\n }\n });\n\n test('Should throw error if slot title element is not a heading', async () => {\n expect.assertions(1);\n try {\n const args = { identifier: 'identifier', closeButton: true };\n await getPage(args, [\n <span slot=\"title\">Blu bli blo bla</span>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ]);\n } catch (err) {\n expect(err.message).toContain('<mg-popover> Slotted title must be a heading: ');\n }\n });\n\n test('should update popper instance when slot %s update', async () => {\n const page = await getPage({ identifier: 'identifier', display: true }, [\n <h2 slot=\"title\">Blu bli blo bla</h2>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ]);\n expect(page.root).toMatchSnapshot();\n\n const spy = jest.spyOn(page.rootInstance.popper, 'update');\n\n fireRo([]);\n\n expect(spy).toHaveBeenCalled();\n expect(page.root).toMatchSnapshot();\n });\n\n test('should update mg-popover-content id when identifier is updated', async () => {\n const page = await getPage({ identifier: 'identifier' }, [\n <h2 slot=\"title\">Blu bli blo bla</h2>,\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud\n exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>,\n <mg-button identifier=\"identifier-btn\">mg-button</mg-button>,\n ]);\n expect(page.root).toMatchSnapshot();\n\n fireRo([]);\n page.doc.querySelector('mg-popover').identifier = 'new-identifier';\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable jsx-a11y/no-redundant-roles */
2
2
  import { h } from "@stencil/core";
3
3
  import { initLocales } from "../../../locales";
4
+ import { isValidString } from "../../../utils/components.utils";
4
5
  export class MgSkipLinks {
5
6
  constructor() {
6
7
  /***********
@@ -17,9 +18,7 @@ export class MgSkipLinks {
17
18
  this.links = undefined;
18
19
  }
19
20
  validateLinks(links) {
20
- if (links === undefined ||
21
- links.length === 0 ||
22
- links.some(link => link.href === undefined || !link.href.startsWith('#') || link.label === undefined || link.label.trim() === '')) {
21
+ if (links === undefined || links.length === 0 || links.some(link => !isValidString(link.href) || !link.href.startsWith('#') || !isValidString(link.label))) {
23
22
  throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
24
23
  }
25
24
  }
@@ -38,18 +37,18 @@ export class MgSkipLinks {
38
37
  * @returns HTML Element
39
38
  */
40
39
  render() {
41
- return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
40
+ return (h("nav", { class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
42
41
  }
43
42
  static get is() { return "mg-skip-links"; }
44
43
  static get encapsulation() { return "shadow"; }
45
44
  static get originalStyleUrls() {
46
45
  return {
47
- "$": ["mg-skip-links.scss"]
46
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-skip-links.css"]
48
47
  };
49
48
  }
50
49
  static get styleUrls() {
51
50
  return {
52
- "$": ["mg-skip-links.css"]
51
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-skip-links.css"]
53
52
  };
54
53
  }
55
54
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"mg-skip-links.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-skip-links/mg-skip-links.tsx"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,MAAM,OAAO,WAAW;;IAoCtB;;gBAEY;IAEZ;;;OAGG;IACK,oBAAe,GAAG,CAAC,KAAkD,EAAQ,EAAE;MACrF,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;MAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;;;EA1BF,aAAa,CAAC,KAAiB;IAC7B,IACE,KAAK,KAAK,SAAS;MACnB,KAAK,CAAC,MAAM,KAAK,CAAC;MAClB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EACjI;MACA,MAAM,IAAI,KAAK,CAAC,yIAAyI,CAAC,CAAC;KAC5J;EACH,CAAC;EAoBD;;iBAEe;EAEf;;KAEG;EACH,iBAAiB;IACf,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;EACrD,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,WAAK,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,YAAY,gBAAa,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ;MACvF,UAAI,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAC,MAAM,IACxC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACtB,UAAI,GAAG,EAAE,IAAI,CAAC,IAAI;QAChB,SAAG,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,IAC1E,IAAI,CAAC,KAAK,CACT,CACD,CACN,CAAC,CACC,CACD,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/* eslint-disable jsx-a11y/no-redundant-roles */\nimport { Component, Element, Event, EventEmitter, h, Prop, Watch } from '@stencil/core';\nimport { SkipLink } from './mg-skip-links.conf';\nimport { initLocales } from '../../../locales';\n\n@Component({\n tag: 'mg-skip-links',\n styleUrl: 'mg-skip-links.scss',\n shadow: true,\n})\nexport class MgSkipLinks {\n /************\n * Internal *\n ************/\n\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgSkipLinksElement;\n\n /**\n * Skip links\n */\n @Prop() links: SkipLink[];\n @Watch('links')\n validateLinks(links: SkipLink[]): void {\n if (\n links === undefined ||\n links.length === 0 ||\n links.some(link => link.href === undefined || !link.href.startsWith('#') || link.label === undefined || link.label.trim() === '')\n ) {\n throw new Error(`<mg-skip-links> prop \"links\": Cannot be empty and each link must contains an href starting with a \"#\" and a non empty label attributes.`);\n }\n }\n\n /**\n * Emited event when link is clicked\n */\n @Event({ eventName: 'go-to-anchor' }) goToAnchor: EventEmitter<string>;\n\n /***********\n * Methods *\n **********/\n\n /**\n * Handle link click and emit go-to-anchor event\n * @param event - mouse event\n */\n private handleLinkCLick = (event: MouseEvent & { currentTarget: HTMLElement }): void => {\n event.currentTarget.blur();\n this.goToAnchor.emit(event.currentTarget.getAttribute('href'));\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateLinks(this.links);\n this.messages = initLocales(this.element).messages;\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <nav class=\"mg-skip-links\" role=\"navigation\" aria-label={this.messages.skipLinks.navLabel}>\n <ul class=\"mg-skip-links__list\" role=\"list\">\n {this.links.map(link => (\n <li key={link.href}>\n <a class=\"mg-skip-links__link\" href={link.href} onClick={this.handleLinkCLick}>\n {link.label}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-skip-links.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-skip-links/mg-skip-links.tsx"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAOhE,MAAM,OAAO,WAAW;;IAgCtB;;gBAEY;IAEZ;;;OAGG;IACK,oBAAe,GAAG,CAAC,KAAkD,EAAQ,EAAE;MACrF,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;MAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAA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ter, h, Prop, Watch } from '@stencil/core';\nimport { SkipLink } from './mg-skip-links.conf';\nimport { initLocales } from '../../../locales';\nimport { isValidString } from '../../../utils/components.utils';\n\n@Component({\n tag: 'mg-skip-links',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-skip-links.css',\n shadow: true,\n})\nexport class MgSkipLinks {\n /************\n * Internal *\n ************/\n\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgSkipLinksElement;\n\n /**\n * Skip links\n */\n @Prop() links: SkipLink[];\n @Watch('links')\n validateLinks(links: SkipLink[]): void {\n if (links === undefined || links.length === 0 || links.some(link => !isValidString(link.href) || !link.href.startsWith('#') || !isValidString(link.label))) {\n throw new Error(`<mg-skip-links> prop \"links\": Cannot be empty and each link must contains an href starting with a \"#\" and a non empty label attributes.`);\n }\n }\n\n /**\n * Emited event when link is clicked\n */\n @Event({ eventName: 'go-to-anchor' }) goToAnchor: EventEmitter<string>;\n\n /***********\n * Methods *\n **********/\n\n /**\n * Handle link click and emit go-to-anchor event\n * @param event - mouse event\n */\n private handleLinkCLick = (event: MouseEvent & { currentTarget: HTMLElement }): void => {\n event.currentTarget.blur();\n this.goToAnchor.emit(event.currentTarget.getAttribute('href'));\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateLinks(this.links);\n this.messages = initLocales(this.element).messages;\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <nav class=\"mg-c-skip-links\" role=\"navigation\" aria-label={this.messages.skipLinks.navLabel}>\n <ul class=\"mg-c-skip-links__list\" role=\"list\">\n {this.links.map(link => (\n <li key={link.href}>\n <a class=\"mg-c-skip-links__link\" href={link.href} onClick={this.handleLinkCLick}>\n {link.label}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n );\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { h } from "@stencil/core";
2
- import { createID, ClassList, allItemsAreString } from "../../../utils/components.utils";
2
+ import { createID, ClassList, allItemsAreString, isValidString } from "../../../utils/components.utils";
3
3
  import { sizes, Status } from "./mg-tabs.conf";
4
4
  /**
5
5
  * type TabItem validation function
@@ -14,8 +14,14 @@ export class MgTabs {
14
14
  ************/
15
15
  // classes
16
16
  this.tabPanel = 'panel';
17
- this.buttonTabBaseClass = 'mg-tabs__navigation-button';
17
+ this.buttonTabBaseClass = 'mg-c-tabs__navigation-button';
18
18
  this.startIndex = 1;
19
+ /**
20
+ * Validate that new tab status can be `Status.ACTIVE`
21
+ * @param tab - tab item
22
+ * @returns true when tab match condition to get a `Status.ACTIVE`
23
+ */
24
+ this.isActivableTab = (tab) => [undefined, Status.ACTIVE, Status.VISIBLE].includes(tab.status);
19
25
  /**
20
26
  * Method to know if given tab has the given status
21
27
  * @param tab - item tab key to set to ACTIVE status
@@ -36,19 +42,13 @@ export class MgTabs {
36
42
  * @returns index
37
43
  */
38
44
  this.getTabItemIndex = (index) => index + this.startIndex;
39
- /**
40
- * Method to get the active-tab value
41
- * @returns of the active-tab
42
- */
43
- this.getActiveTab = () => this.activeTab || this.getTabItemIndex(this.tabs.map((tab, index) => (Object.assign(Object.assign({}, tab), { index }))).find(tab => this.tabHasStatus(tab, Status.ACTIVE)).index);
44
45
  /**
45
46
  * Handle click events on tabs
46
47
  * @param event - mouse event
47
48
  */
48
49
  this.handleClick = (event) => {
49
50
  const tabId = event.currentTarget.dataset.index;
50
- const tab = this.tabs[Number(tabId) - this.startIndex];
51
- if (this.tabHasStatus(tab, Status.HIDDEN) || this.tabHasStatus(tab, Status.DISABLED)) {
51
+ if (!this.isActivableTab(this.tabs[Number(tabId) - this.startIndex])) {
52
52
  event.preventDefault();
53
53
  }
54
54
  else {
@@ -108,7 +108,7 @@ export class MgTabs {
108
108
  setTimeout(() => {
109
109
  this.tabFocus = undefined;
110
110
  Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
111
- tab.setAttribute('tabindex', this.getActiveTab() - this.startIndex !== index ? '-1' : '0');
111
+ tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
112
112
  });
113
113
  }, 0);
114
114
  };
@@ -126,10 +126,10 @@ export class MgTabs {
126
126
  this.items = undefined;
127
127
  this.activeTab = undefined;
128
128
  this.tabs = [];
129
- this.classCollection = new ClassList(['mg-tabs']);
129
+ this.classCollection = new ClassList(['mg-c-tabs']);
130
130
  }
131
131
  validateLabel(newValue) {
132
- if (typeof newValue !== 'string' || newValue.trim() === '') {
132
+ if (!isValidString(newValue)) {
133
133
  throw new Error('<mg-tabs> prop "label" is required.');
134
134
  }
135
135
  }
@@ -137,42 +137,42 @@ export class MgTabs {
137
137
  if (!sizes.includes(newValue)) {
138
138
  throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}`);
139
139
  }
140
- this.classCollection.add(`mg-tabs--size-${this.size}`);
140
+ this.classCollection.add(`mg-c-tabs--size-${this.size}`);
141
141
  }
142
142
  validateItems(newValue) {
143
143
  // String array
144
- if (allItemsAreString(newValue)) {
145
- this.tabs = newValue.map((item, index) => ({ label: item, status: index === 0 ? Status.ACTIVE : Status.VISIBLE }));
146
- }
144
+ if (allItemsAreString(newValue))
145
+ this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
147
146
  // Object array
148
- else if (newValue && newValue.length > 0 && newValue.every(item => isTabItem(item))) {
147
+ else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
149
148
  this.tabs = newValue;
150
- // init active tabs if not set. Default: index 0.
151
- if (this.tabs.find(tab => this.tabHasStatus(tab, Status.ACTIVE)) === undefined)
152
- this.tabs[0].status = Status.ACTIVE;
153
- }
154
- else {
149
+ else
155
150
  throw new Error('<mg-tabs> prop "items" is required and all items must be the same type: TabItem.');
156
- }
157
151
  }
158
152
  validateActiveTab(newValue) {
159
- if (typeof newValue === 'number' && newValue >= 1 && newValue <= this.tabs.length) {
153
+ // when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
154
+ // after setting new value to `active-tab` the validate will be triggered again with the updated value and process the tab update
155
+ if (newValue === undefined) {
156
+ this.activeTab = this.tabs.some(tab => this.tabHasStatus(tab, Status.ACTIVE))
157
+ ? this.getTabItemIndex(this.tabs.findIndex(tab => this.tabHasStatus(tab, Status.ACTIVE)))
158
+ : this.startIndex;
159
+ }
160
+ else if (typeof newValue === 'number' && newValue >= this.startIndex && newValue <= this.tabs.length && this.isActivableTab(this.tabs[newValue - this.startIndex])) {
161
+ // if new 'active-tab' is activable we update tab status to ACTIVE and toggle past ACTIVE to VISIBLE
160
162
  this.tabs.forEach((tab, index) => {
161
163
  const isNewActiveTab = index === newValue - this.startIndex;
162
164
  // reset active tabs
163
165
  if (this.tabHasStatus(tab, Status.ACTIVE) && !isNewActiveTab)
164
166
  tab.status = Status.VISIBLE;
165
167
  // set active tab from given tab key
166
- else if ((tab.status === undefined || this.tabHasStatus(tab, Status.VISIBLE)) && isNewActiveTab)
168
+ else if (this.isActivableTab(tab) && isNewActiveTab)
167
169
  tab.status = Status.ACTIVE;
168
170
  });
169
171
  // emit change active tab key event
170
- if (this.tabs.find(tab => this.tabHasStatus(tab, Status.ACTIVE)) !== undefined) {
171
- this.activeTabChange.emit(newValue);
172
- }
172
+ this.activeTabChange.emit(newValue);
173
173
  }
174
- else if (newValue !== undefined) {
175
- throw new Error('<mg-tabs> prop "activeTab" must be between 1 and tabs length.');
174
+ else {
175
+ throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable".`);
176
176
  }
177
177
  }
178
178
  /*************
@@ -203,24 +203,24 @@ export class MgTabs {
203
203
  * @returns HTML Element
204
204
  */
205
205
  render() {
206
- return (h("div", { class: this.classCollection.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
206
+ return (h("div", { class: this.classCollection.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
207
207
  [`${this.buttonTabBaseClass}`]: true,
208
208
  [`${this.buttonTabBaseClass}--horizontal`]: true,
209
209
  [`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
210
210
  [`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasStatus(tab, Status.DISABLED),
211
211
  [`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasStatus(tab, Status.HIDDEN),
212
- }, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
212
+ }, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-c-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
213
213
  }
214
214
  static get is() { return "mg-tabs"; }
215
215
  static get encapsulation() { return "shadow"; }
216
216
  static get originalStyleUrls() {
217
217
  return {
218
- "$": ["mg-tabs.scss"]
218
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-tabs.css"]
219
219
  };
220
220
  }
221
221
  static get styleUrls() {
222
222
  return {
223
- "$": ["mg-tabs.css"]
223
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-tabs.css"]
224
224
  };
225
225
  }
226
226
  static get properties() {