@mgdis/mg-components 5.16.0 → 5.17.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 (462) hide show
  1. package/dist/cjs/{index-fede8ee2.js → index-c042e24b.js} +321 -68
  2. package/dist/cjs/index-c042e24b.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/index.cjs.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +5 -12
  6. package/dist/cjs/loader.cjs.js.map +1 -0
  7. package/dist/cjs/mg-action-more_34.cjs.entry.js +21 -6
  8. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -0
  9. package/dist/cjs/mg-components.cjs.js +5 -3
  10. package/dist/cjs/mg-components.cjs.js.map +1 -0
  11. package/dist/cjs/mg-item-more.cjs.entry.js +4 -2
  12. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -0
  13. package/dist/cjs/{mg-menu.conf-f9d0ddec.js → mg-menu.conf-43aacf30.js} +2 -0
  14. package/dist/cjs/mg-menu.conf-43aacf30.js.map +1 -0
  15. package/dist/collection/assets/icons/index.js +7 -2
  16. package/dist/collection/collection-manifest.json +37 -37
  17. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -0
  18. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js.map +1 -0
  19. package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -4
  20. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -0
  21. package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js +33 -0
  22. package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js.map +1 -0
  23. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +70 -0
  24. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +1 -0
  25. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -0
  26. package/dist/collection/components/atoms/mg-button/mg-button.conf.js.map +1 -0
  27. package/dist/collection/components/atoms/mg-button/mg-button.js +10 -6
  28. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -0
  29. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +91 -0
  30. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -0
  31. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +142 -0
  32. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -0
  33. package/dist/collection/components/atoms/mg-card/mg-card.conf.js +1 -0
  34. package/dist/collection/components/atoms/mg-card/mg-card.conf.js.map +1 -0
  35. package/dist/collection/components/atoms/mg-card/mg-card.js +8 -5
  36. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -0
  37. package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js +36 -0
  38. package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js.map +1 -0
  39. package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js +43 -0
  40. package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js.map +1 -0
  41. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +3 -2
  42. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -0
  43. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js +15 -0
  44. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js.map +1 -0
  45. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js +42 -0
  46. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js.map +1 -0
  47. package/dist/collection/components/atoms/mg-divider/mg-divider.js +2 -1
  48. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -0
  49. package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js +11 -0
  50. package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js.map +1 -0
  51. package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js +14 -0
  52. package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js.map +1 -0
  53. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -0
  54. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js.map +1 -0
  55. package/dist/collection/components/atoms/mg-icon/mg-icon.js +11 -7
  56. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -0
  57. package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js +55 -0
  58. package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js.map +1 -0
  59. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +84 -0
  60. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +1 -0
  61. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +2 -1
  62. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -0
  63. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js +18 -0
  64. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js.map +1 -0
  65. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js +27 -0
  66. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js.map +1 -0
  67. package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js +1 -0
  68. package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js.map +1 -0
  69. package/dist/collection/components/atoms/mg-tag/mg-tag.js +6 -4
  70. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -0
  71. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js +37 -0
  72. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js.map +1 -0
  73. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +71 -0
  74. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +1 -0
  75. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -1
  76. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -0
  77. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +1 -0
  78. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -0
  79. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -5
  80. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -0
  81. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +132 -0
  82. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -0
  83. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +264 -0
  84. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -0
  85. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -0
  86. package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +1 -0
  87. package/dist/collection/components/molecules/inputs/MgInput.js +3 -2
  88. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -0
  89. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -1
  90. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -0
  91. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +12 -7
  92. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -0
  93. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +1 -0
  94. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -0
  95. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +17 -11
  96. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -0
  97. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +243 -0
  98. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +1 -0
  99. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +581 -0
  100. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -0
  101. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +1 -0
  102. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -0
  103. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +9 -7
  104. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -0
  105. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js +123 -0
  106. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js.map +1 -0
  107. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +324 -0
  108. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -0
  109. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +1 -0
  110. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -0
  111. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +11 -8
  112. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -0
  113. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js +212 -0
  114. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js.map +1 -0
  115. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +401 -0
  116. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -0
  117. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +9 -6
  118. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -0
  119. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js +115 -0
  120. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js.map +1 -0
  121. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +234 -0
  122. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -0
  123. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.js +1 -0
  124. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.js.map +1 -0
  125. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +9 -6
  126. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -0
  127. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +154 -0
  128. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +1 -0
  129. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +295 -0
  130. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -0
  131. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js +1 -0
  132. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js.map +1 -0
  133. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +13 -8
  134. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -0
  135. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js +194 -0
  136. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js.map +1 -0
  137. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +344 -0
  138. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -0
  139. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +11 -7
  140. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -0
  141. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js +171 -0
  142. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js.map +1 -0
  143. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +280 -0
  144. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -0
  145. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +9 -6
  146. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -0
  147. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js +129 -0
  148. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js.map +1 -0
  149. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +255 -0
  150. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -0
  151. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js +1 -0
  152. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js.map +1 -0
  153. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +6 -4
  154. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -0
  155. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js +125 -0
  156. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js.map +1 -0
  157. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +203 -0
  158. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -0
  159. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +1 -0
  160. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -0
  161. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +9 -5
  162. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -0
  163. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.js +268 -0
  164. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.js.map +1 -0
  165. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js +175 -0
  166. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js.map +1 -0
  167. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +1 -0
  168. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -0
  169. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +10 -7
  170. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -0
  171. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js +119 -0
  172. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js.map +1 -0
  173. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js +295 -0
  174. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js.map +1 -0
  175. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js +1 -0
  176. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -0
  177. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +19 -13
  178. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -0
  179. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js +128 -0
  180. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js.map +1 -0
  181. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js +187 -0
  182. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js.map +1 -0
  183. package/dist/collection/components/molecules/mg-details/mg-details.js +2 -1
  184. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -0
  185. package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js +30 -0
  186. package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js.map +1 -0
  187. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +42 -0
  188. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +1 -0
  189. package/dist/collection/components/molecules/mg-form/mg-form.js +6 -4
  190. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -0
  191. package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js +169 -0
  192. package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js.map +1 -0
  193. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +277 -0
  194. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -0
  195. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +3 -2
  196. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -0
  197. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js +39 -0
  198. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js.map +1 -0
  199. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js +36 -0
  200. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js.map +1 -0
  201. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js +1 -0
  202. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js.map +1 -0
  203. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +11 -7
  204. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -0
  205. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js +85 -0
  206. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js.map +1 -0
  207. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js +106 -0
  208. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js.map +1 -0
  209. package/dist/collection/components/molecules/mg-message/mg-message.conf.js +1 -0
  210. package/dist/collection/components/molecules/mg-message/mg-message.conf.js.map +1 -0
  211. package/dist/collection/components/molecules/mg-message/mg-message.js +7 -5
  212. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -0
  213. package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js +64 -0
  214. package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js.map +1 -0
  215. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +109 -0
  216. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +1 -0
  217. package/dist/collection/components/molecules/mg-modal/mg-modal.conf.js +1 -0
  218. package/dist/collection/components/molecules/mg-modal/mg-modal.conf.js.map +1 -0
  219. package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -5
  220. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -0
  221. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +62 -0
  222. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -0
  223. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js +40 -0
  224. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js.map +1 -0
  225. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +26 -0
  226. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +1 -0
  227. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +122 -0
  228. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +1 -0
  229. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +1 -0
  230. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js.map +1 -0
  231. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +5 -4
  232. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -0
  233. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js +57 -0
  234. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js.map +1 -0
  235. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js +121 -0
  236. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js.map +1 -0
  237. package/dist/collection/components/molecules/mg-panel/mg-panel.conf.js +1 -0
  238. package/dist/collection/components/molecules/mg-panel/mg-panel.conf.js.map +1 -0
  239. package/dist/collection/components/molecules/mg-panel/mg-panel.js +9 -6
  240. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -0
  241. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +106 -0
  242. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -0
  243. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +223 -0
  244. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -0
  245. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -3
  246. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -0
  247. package/dist/collection/components/molecules/mg-popover/mg-popover.js +6 -4
  248. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -0
  249. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js +148 -0
  250. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +1 -0
  251. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +130 -0
  252. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +1 -0
  253. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js +1 -0
  254. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js.map +1 -0
  255. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -3
  256. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -0
  257. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js +55 -0
  258. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js.map +1 -0
  259. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js +55 -0
  260. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js.map +1 -0
  261. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +1 -0
  262. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js.map +1 -0
  263. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +8 -5
  264. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -0
  265. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js +76 -0
  266. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js.map +1 -0
  267. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +332 -0
  268. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +1 -0
  269. package/dist/collection/index.js +1 -0
  270. package/dist/collection/index.js.map +1 -0
  271. package/dist/collection/locales/index.js +4 -3
  272. package/dist/collection/locales/index.js.map +1 -0
  273. package/dist/collection/locales/index.spec.js +27 -0
  274. package/dist/collection/locales/index.spec.js.map +1 -0
  275. package/dist/collection/stories/icon-gallery.js +4 -3
  276. package/dist/collection/stories/icon-gallery.js.map +1 -0
  277. package/dist/collection/test/typography.e2e.playwright.js +12 -0
  278. package/dist/collection/test/typography.e2e.playwright.js.map +1 -0
  279. package/dist/collection/utils/behaviors.utils.js +1 -0
  280. package/dist/collection/utils/behaviors.utils.js.map +1 -0
  281. package/dist/collection/utils/behaviors.utils.spec.js +57 -0
  282. package/dist/collection/utils/behaviors.utils.spec.js.map +1 -0
  283. package/dist/collection/utils/components.utils.js +1 -0
  284. package/dist/collection/utils/components.utils.js.map +1 -0
  285. package/dist/collection/utils/components.utils.spec.js +120 -0
  286. package/dist/collection/utils/components.utils.spec.js.map +1 -0
  287. package/dist/collection/utils/e2e.test.utils.js +46 -0
  288. package/dist/collection/utils/e2e.test.utils.js.map +1 -0
  289. package/dist/collection/utils/locale.utils.js +1 -0
  290. package/dist/collection/utils/locale.utils.js.map +1 -0
  291. package/dist/collection/utils/locale.utils.spec.js +52 -0
  292. package/dist/collection/utils/locale.utils.spec.js.map +1 -0
  293. package/dist/collection/utils/playwright.e2e.test.utils.js +100 -0
  294. package/dist/collection/utils/playwright.e2e.test.utils.js.map +1 -0
  295. package/dist/collection/utils/stencil.e2e.test.utils.js +33 -0
  296. package/dist/collection/utils/stencil.e2e.test.utils.js.map +1 -0
  297. package/dist/collection/utils/unit.test.utils.js +2 -1
  298. package/dist/collection/utils/unit.test.utils.js.map +1 -0
  299. package/dist/components/MgInput.js +2 -0
  300. package/dist/components/MgInput.js.map +1 -0
  301. package/dist/components/components.utils.js +2 -0
  302. package/dist/components/components.utils.js.map +1 -0
  303. package/dist/components/index.d.ts +5 -37
  304. package/dist/components/index.js +3 -36
  305. package/dist/components/index.js.map +1 -0
  306. package/dist/components/index2.js +2 -0
  307. package/dist/components/index2.js.map +1 -0
  308. package/dist/components/mg-action-more.js +14 -4
  309. package/dist/components/mg-action-more.js.map +1 -0
  310. package/dist/components/mg-badge.js +2 -0
  311. package/dist/components/mg-badge.js.map +1 -0
  312. package/dist/components/mg-badge2.js +8 -1
  313. package/dist/components/mg-badge2.js.map +1 -0
  314. package/dist/components/mg-button.js +2 -0
  315. package/dist/components/mg-button.js.map +1 -0
  316. package/dist/components/mg-button2.js +8 -1
  317. package/dist/components/mg-button2.js.map +1 -0
  318. package/dist/components/mg-card.js +2 -0
  319. package/dist/components/mg-card.js.map +1 -0
  320. package/dist/components/mg-card2.js +6 -1
  321. package/dist/components/mg-card2.js.map +1 -0
  322. package/dist/components/mg-character-left.js +2 -0
  323. package/dist/components/mg-character-left.js.map +1 -0
  324. package/dist/components/mg-character-left2.js +5 -1
  325. package/dist/components/mg-character-left2.js.map +1 -0
  326. package/dist/components/mg-details.js +7 -1
  327. package/dist/components/mg-details.js.map +1 -0
  328. package/dist/components/mg-divider.js +3 -1
  329. package/dist/components/mg-divider.js.map +1 -0
  330. package/dist/components/mg-form.js +6 -1
  331. package/dist/components/mg-form.js.map +1 -0
  332. package/dist/components/mg-icon.js +2 -0
  333. package/dist/components/mg-icon.js.map +1 -0
  334. package/dist/components/mg-icon2.js +21 -3
  335. package/dist/components/mg-icon2.js.map +1 -0
  336. package/dist/components/mg-illustrated-message.js +3 -1
  337. package/dist/components/mg-illustrated-message.js.map +1 -0
  338. package/dist/components/mg-input-checkbox-paginated.js +2 -0
  339. package/dist/components/mg-input-checkbox-paginated.js.map +1 -0
  340. package/dist/components/mg-input-checkbox-paginated2.js +6 -1
  341. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -0
  342. package/dist/components/mg-input-checkbox.js +12 -1
  343. package/dist/components/mg-input-checkbox.js.map +1 -0
  344. package/dist/components/mg-input-date.js +10 -1
  345. package/dist/components/mg-input-date.js.map +1 -0
  346. package/dist/components/mg-input-numeric.js +11 -1
  347. package/dist/components/mg-input-numeric.js.map +1 -0
  348. package/dist/components/mg-input-password.js +8 -1
  349. package/dist/components/mg-input-password.js.map +1 -0
  350. package/dist/components/mg-input-radio.js +9 -1
  351. package/dist/components/mg-input-radio.js.map +1 -0
  352. package/dist/components/mg-input-select.js +2 -0
  353. package/dist/components/mg-input-select.js.map +1 -0
  354. package/dist/components/mg-input-select2.js +9 -1
  355. package/dist/components/mg-input-select2.js.map +1 -0
  356. package/dist/components/mg-input-text.js +2 -0
  357. package/dist/components/mg-input-text.js.map +1 -0
  358. package/dist/components/mg-input-text2.js +9 -1
  359. package/dist/components/mg-input-text2.js.map +1 -0
  360. package/dist/components/mg-input-textarea.js +9 -1
  361. package/dist/components/mg-input-textarea.js.map +1 -0
  362. package/dist/components/mg-input-title.js +2 -0
  363. package/dist/components/mg-input-title.js.map +1 -0
  364. package/dist/components/mg-input-title2.js +6 -1
  365. package/dist/components/mg-input-title2.js.map +1 -0
  366. package/dist/components/mg-input-toggle.js +11 -1
  367. package/dist/components/mg-input-toggle.js.map +1 -0
  368. package/dist/components/mg-item-more.js +7 -1
  369. package/dist/components/mg-item-more.js.map +1 -0
  370. package/dist/components/mg-menu-item.js +2 -0
  371. package/dist/components/mg-menu-item.js.map +1 -0
  372. package/dist/components/mg-menu-item2.js +9 -1
  373. package/dist/components/mg-menu-item2.js.map +1 -0
  374. package/dist/components/mg-menu.conf.js +2 -0
  375. package/dist/components/mg-menu.conf.js.map +1 -0
  376. package/dist/components/mg-menu.js +2 -0
  377. package/dist/components/mg-menu.js.map +1 -0
  378. package/dist/components/mg-menu2.js +8 -1
  379. package/dist/components/mg-menu2.js.map +1 -0
  380. package/dist/components/mg-message.js +8 -1
  381. package/dist/components/mg-message.js.map +1 -0
  382. package/dist/components/mg-modal.js +8 -2
  383. package/dist/components/mg-modal.js.map +1 -0
  384. package/dist/components/mg-pagination.js +2 -0
  385. package/dist/components/mg-pagination.js.map +1 -0
  386. package/dist/components/mg-pagination2.js +6 -1
  387. package/dist/components/mg-pagination2.js.map +1 -0
  388. package/dist/components/mg-panel.js +9 -1
  389. package/dist/components/mg-panel.js.map +1 -0
  390. package/dist/components/mg-popover-content.js +2 -0
  391. package/dist/components/mg-popover-content.js.map +1 -0
  392. package/dist/components/mg-popover-content2.js +3 -1
  393. package/dist/components/mg-popover-content2.js.map +1 -0
  394. package/dist/components/mg-popover.js +2 -0
  395. package/dist/components/mg-popover.js.map +1 -0
  396. package/dist/components/mg-popover2.js +7 -1
  397. package/dist/components/mg-popover2.js.map +1 -0
  398. package/dist/components/mg-skip-links.js +5 -1
  399. package/dist/components/mg-skip-links.js.map +1 -0
  400. package/dist/components/mg-tabs.js +8 -1
  401. package/dist/components/mg-tabs.js.map +1 -0
  402. package/dist/components/mg-tag.js +7 -1
  403. package/dist/components/mg-tag.js.map +1 -0
  404. package/dist/components/mg-tooltip-content.js +2 -0
  405. package/dist/components/mg-tooltip-content.js.map +1 -0
  406. package/dist/components/mg-tooltip-content2.js +3 -1
  407. package/dist/components/mg-tooltip-content2.js.map +1 -0
  408. package/dist/components/mg-tooltip.js +2 -0
  409. package/dist/components/mg-tooltip.js.map +1 -0
  410. package/dist/components/mg-tooltip2.js +7 -1
  411. package/dist/components/mg-tooltip2.js.map +1 -0
  412. package/dist/components/popper.js +2 -0
  413. package/dist/components/popper.js.map +1 -0
  414. package/dist/esm/{index-1d40b052.js → index-ce01e63b.js} +321 -68
  415. package/dist/esm/index-ce01e63b.js.map +1 -0
  416. package/dist/esm/index.js +2 -0
  417. package/dist/esm/index.js.map +1 -0
  418. package/dist/esm/loader.js +6 -13
  419. package/dist/esm/loader.js.map +1 -0
  420. package/dist/esm/mg-action-more_34.entry.js +21 -6
  421. package/dist/esm/mg-action-more_34.entry.js.map +1 -0
  422. package/dist/esm/mg-components.js +6 -4
  423. package/dist/esm/mg-components.js.map +1 -0
  424. package/dist/esm/mg-item-more.entry.js +4 -2
  425. package/dist/esm/mg-item-more.entry.js.map +1 -0
  426. package/dist/esm/{mg-menu.conf-2cc079ae.js → mg-menu.conf-012fc9b4.js} +2 -0
  427. package/dist/esm/mg-menu.conf-012fc9b4.js.map +1 -0
  428. package/dist/mg-components/index.esm.js +2 -0
  429. package/dist/mg-components/index.esm.js.map +1 -0
  430. package/dist/mg-components/mg-components.esm.js +2 -1
  431. package/dist/mg-components/mg-components.esm.js.map +1 -0
  432. package/dist/mg-components/p-1aa89acf.js +3 -0
  433. package/dist/mg-components/p-1aa89acf.js.map +1 -0
  434. package/dist/mg-components/p-1d7d6fa0.js +2 -0
  435. package/dist/mg-components/p-1d7d6fa0.js.map +1 -0
  436. package/dist/mg-components/p-9257e8f1.entry.js +2 -0
  437. package/dist/mg-components/p-9257e8f1.entry.js.map +1 -0
  438. package/dist/mg-components/p-caafc9cf.entry.js +2 -0
  439. package/dist/mg-components/p-caafc9cf.entry.js.map +1 -0
  440. package/dist/types/components/atoms/mg-badge/test/mg-badge.e2e.playwright.d.ts +1 -0
  441. package/dist/types/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.d.ts +1 -0
  442. package/dist/types/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.d.ts +2 -0
  443. package/dist/types/components/molecules/mg-details/test/mg-details.e2e.playwright.d.ts +1 -0
  444. package/dist/types/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.d.ts +1 -0
  445. package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.playwright.d.ts +1 -0
  446. package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.template.d.ts +12 -0
  447. package/dist/types/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.d.ts +1 -0
  448. package/dist/types/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.d.ts +1 -0
  449. package/dist/types/components/molecules/mg-panel/test/mg-panel.e2e.playwright.d.ts +1 -0
  450. package/dist/types/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.d.ts +1 -0
  451. package/dist/types/components.d.ts +20 -0
  452. package/dist/types/stencil-public-runtime.d.ts +43 -17
  453. package/dist/types/test/typography.e2e.playwright.d.ts +1 -0
  454. package/dist/types/utils/e2e.test.utils.d.ts +22 -0
  455. package/dist/types/utils/stencil.e2e.test.utils.d.ts +14 -0
  456. package/loader/index.d.ts +2 -2
  457. package/package.json +5 -5
  458. package/dist/esm/polyfills/css-shim.js +0 -1
  459. package/dist/mg-components/p-067080e4.js +0 -1
  460. package/dist/mg-components/p-3286bc46.entry.js +0 -1
  461. package/dist/mg-components/p-3bf1e2f0.js +0 -2
  462. package/dist/mg-components/p-91f4a30d.entry.js +0 -1
@@ -0,0 +1,85 @@
1
+ import { OverflowBehaviorElements } from "../../../../utils/behaviors.utils";
2
+ import { setPageContent, expect, describe, testEach } from "../../../../utils/playwright.e2e.test.utils";
3
+ import { renderAttributes } from "../../../../utils/e2e.test.utils";
4
+ import { Status } from "../../menu/mg-menu-item/mg-menu-item.conf";
5
+ import { Direction, sizes } from "../../menu/mg-menu/mg-menu.conf";
6
+ const verticalFrameSizes = {
7
+ regular: {
8
+ height: 200,
9
+ width: 180,
10
+ },
11
+ medium: {
12
+ height: 300,
13
+ width: 180,
14
+ },
15
+ large: {
16
+ height: 400,
17
+ width: 180,
18
+ },
19
+ };
20
+ const getSubMenuSize = (size) => {
21
+ if (size === 'large')
22
+ return 'medium';
23
+ else if (size === 'medium')
24
+ return 'regular';
25
+ else
26
+ return 'regular';
27
+ };
28
+ const createHTML = args => `
29
+ <header class="menu-container menu-container--${args.direction}-small">
30
+ <mg-menu ${renderAttributes(Object.assign({ label: 'menu' }, args))}>
31
+ <mg-menu-item status="active">
32
+ <span slot="label">1 - head-1</span>
33
+ <mg-menu ${renderAttributes({ label: 'sub-menu 1', direction: Direction.VERTICAL, size: getSubMenuSize(args === null || args === void 0 ? void 0 : args.size) })}>
34
+ <mg-menu-item><span slot="label">Batman begins</span></mg-menu-item>
35
+ </mg-menu>
36
+ </mg-menu-item>
37
+ <mg-menu-item status="disabled"><span slot="label">1 - head-2 long</span></mg-menu-item>
38
+ <mg-menu-item href="#link">
39
+ <span slot="label">1 - head-3 very long</span>
40
+ <mg-icon icon='user' slot='image'></mg-icon>
41
+ </mg-menu-item>
42
+ <mg-menu-item>
43
+ <span slot="label">1 - head-4</span>
44
+ <mg-icon icon='user' slot='image'></mg-icon>
45
+ ${(args === null || args === void 0 ? void 0 : args.badge) ? "<mg-badge value='2' label='hello' slot='information'></mg-badge>" : ''}
46
+ </mg-menu-item>
47
+ <mg-menu-item>
48
+ <span slot="label">1 - head-5</span>
49
+ <mg-icon icon='user' slot='image'></mg-icon>
50
+ ${(args === null || args === void 0 ? void 0 : args.badge) ? "<mg-badge value='2' label='hello' slot='information'></mg-badge>" : ''}
51
+ <mg-menu ${renderAttributes({ label: 'sub-menu 2', direction: Direction.VERTICAL, size: getSubMenuSize(args === null || args === void 0 ? void 0 : args.size) })}>
52
+ <mg-menu-item><span slot="label">Batman begins with a longer title to go outide screen</span></mg-menu-item>
53
+ </mg-menu>
54
+ </mg-menu-item>
55
+ </mg-menu>
56
+ </header>
57
+ <style>
58
+ .menu-container.menu-container--vertical-small {
59
+ width: 180px;
60
+ }
61
+ .menu-container.menu-container--horizontal-small {
62
+ width: 200px;
63
+ }
64
+ </style>
65
+ `;
66
+ describe('mg-item-more', () => {
67
+ describe('mg-menu', () => {
68
+ testEach(sizes)(`should renders, case direction ${Direction.VERTICAL} size %s with small screen`, async (page, size) => {
69
+ await setPageContent(page, createHTML({ direction: Direction.VERTICAL, size }), verticalFrameSizes[size]);
70
+ await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
71
+ });
72
+ testEach([true, false])('should renders with overflow, case badge %s', async (page, badge) => {
73
+ await setPageContent(page, createHTML({ direction: Direction.HORIZONTAL, badge }), { width: 400, height: 250 });
74
+ await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
75
+ await page.$eval(`[${OverflowBehaviorElements.BASE_INDEX}="0"]`, (elm, status) => {
76
+ elm.setAttribute('status', status);
77
+ }, Status.VISIBLE);
78
+ await page.$eval(`[${OverflowBehaviorElements.BASE_INDEX}="2"]`, (elm, status) => {
79
+ elm.setAttribute('status', status);
80
+ }, Status.ACTIVE);
81
+ await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
82
+ });
83
+ });
84
+ });
85
+ //# sourceMappingURL=mg-item-more.e2e.playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-item-more.e2e.playwright.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAY,MAAM,6CAA6C,CAAC;AACnH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM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AG,EAAE,MAAM,EAAE,EAAE;QACd,GAAG,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAgB,CAAC,CAAC;MAC/C,CAAC,EACD,MAAM,CAAC,MAAM,CACd,CAAC;MAEF,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACnE,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { OverflowBehaviorElements } from '../../../../utils/behaviors.utils';\nimport { setPageContent, expect, describe, testEach, PageType } from '../../../../utils/playwright.e2e.test.utils';\nimport { renderAttributes } from '../../../../utils/e2e.test.utils';\nimport { Status } from '../../menu/mg-menu-item/mg-menu-item.conf';\nimport { Direction, MenuSizeType, sizes } from '../../menu/mg-menu/mg-menu.conf';\n\nconst verticalFrameSizes = {\n regular: {\n height: 200,\n width: 180,\n },\n medium: {\n height: 300,\n width: 180,\n },\n large: {\n height: 400,\n width: 180,\n },\n};\n\nconst getSubMenuSize = (size: MenuSizeType) => {\n if (size === 'large') return 'medium';\n else if (size === 'medium') return 'regular';\n else return 'regular';\n};\n\nconst createHTML = args => `\n <header class=\"menu-container menu-container--${args.direction}-small\">\n <mg-menu ${renderAttributes({ label: 'menu', ...args })}>\n <mg-menu-item status=\"active\">\n <span slot=\"label\">1 - head-1</span>\n <mg-menu ${renderAttributes({ label: 'sub-menu 1', direction: Direction.VERTICAL, size: getSubMenuSize(args?.size) })}>\n <mg-menu-item><span slot=\"label\">Batman begins</span></mg-menu-item>\n </mg-menu>\n </mg-menu-item>\n <mg-menu-item status=\"disabled\"><span slot=\"label\">1 - head-2 long</span></mg-menu-item>\n <mg-menu-item href=\"#link\">\n <span slot=\"label\">1 - head-3 very long</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n </mg-menu-item>\n <mg-menu-item>\n <span slot=\"label\">1 - head-4</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n ${args?.badge ? \"<mg-badge value='2' label='hello' slot='information'></mg-badge>\" : ''} \n </mg-menu-item>\n <mg-menu-item>\n <span slot=\"label\">1 - head-5</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n ${args?.badge ? \"<mg-badge value='2' label='hello' slot='information'></mg-badge>\" : ''} \n <mg-menu ${renderAttributes({ label: 'sub-menu 2', direction: Direction.VERTICAL, size: getSubMenuSize(args?.size) })}>\n <mg-menu-item><span slot=\"label\">Batman begins with a longer title to go outide screen</span></mg-menu-item>\n </mg-menu>\n </mg-menu-item>\n </mg-menu>\n </header>\n <style>\n .menu-container.menu-container--vertical-small {\n width: 180px;\n }\n .menu-container.menu-container--horizontal-small {\n width: 200px;\n }\n </style>\n `;\n\ndescribe('mg-item-more', () => {\n describe('mg-menu', () => {\n testEach(sizes)(`should renders, case direction ${Direction.VERTICAL} size %s with small screen`, async (page: PageType, size: string) => {\n await setPageContent(page, createHTML({ direction: Direction.VERTICAL, size }), verticalFrameSizes[size]);\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n\n testEach([true, false])('should renders with overflow, case badge %s', async (page: PageType, badge) => {\n await setPageContent(page, createHTML({ direction: Direction.HORIZONTAL, badge }), { width: 400, height: 250 });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n\n await page.$eval(\n `[${OverflowBehaviorElements.BASE_INDEX}=\"0\"]`,\n (elm, status) => {\n elm.setAttribute('status', status as string);\n },\n Status.VISIBLE,\n );\n\n await page.$eval(\n `[${OverflowBehaviorElements.BASE_INDEX}=\"2\"]`,\n (elm, status) => {\n elm.setAttribute('status', status as string);\n },\n Status.ACTIVE,\n );\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n });\n});\n"]}
@@ -0,0 +1,106 @@
1
+ import { h } from "@stencil/core/internal";
2
+ import { newSpecPage } from "@stencil/core/testing";
3
+ import { forcePopoverId, mockConsoleError, mockWindowFrames, setupMutationObserverMock, setupResizeObserverMock } from "../../../../utils/unit.test.utils";
4
+ import { MgItemMore } from "../mg-item-more";
5
+ import { MgMenuItem } from "../../menu/mg-menu-item/mg-menu-item";
6
+ import { MgMenu } from "../../menu/mg-menu/mg-menu";
7
+ import { Status } from "../../menu/mg-menu-item/mg-menu-item.conf";
8
+ import { MgPopover } from "../../mg-popover/mg-popover";
9
+ import { MgPopoverContent } from "../../mg-popover/mg-popover-content/mg-popover-content";
10
+ mockConsoleError();
11
+ mockWindowFrames();
12
+ const udpateItemMorePopoverId = page => {
13
+ const moreMenuItem = page.doc.querySelector('mg-item-more').shadowRoot.querySelector('mg-menu-item');
14
+ forcePopoverId(moreMenuItem, `mg-popover-test_more-item`);
15
+ };
16
+ let id;
17
+ /**
18
+ * set id if param is true
19
+ * @param hasId - true if need a generated id
20
+ * @returns genereted id
21
+ */
22
+ const setId = (hasId) => (hasId ? `my-id-${id++}` : undefined);
23
+ const getPage = async (args) => {
24
+ const page = await newSpecPage({
25
+ components: [MgMenu, MgMenuItem, MgItemMore, MgPopover, MgPopoverContent],
26
+ template: () => (h("mg-menu", Object.assign({}, args), h("mg-menu-item", { href: args.isHref ? '#' : undefined, id: setId(args.hasId) }, h("span", { slot: "label" }, "Batman")), h("mg-menu-item", { id: setId(args.hasId) }, h("span", { slot: "label" }, "Joker")), h("mg-menu-item", { id: setId(args.hasId) }, h("span", { slot: "label" }, "Bane")))),
27
+ });
28
+ jest.runAllTimers();
29
+ await page.waitForChanges();
30
+ jest.runOnlyPendingTimers();
31
+ udpateItemMorePopoverId(page);
32
+ return page;
33
+ };
34
+ describe('mg-item-more', () => {
35
+ beforeEach(() => {
36
+ id = 1;
37
+ jest.useFakeTimers();
38
+ setupResizeObserverMock({
39
+ observe: () => null,
40
+ disconnect: () => null,
41
+ });
42
+ setupMutationObserverMock({
43
+ disconnect: () => null,
44
+ observe: () => null,
45
+ takeRecords: () => null,
46
+ });
47
+ });
48
+ afterEach(() => jest.runOnlyPendingTimers());
49
+ describe('render', () => {
50
+ test.each([undefined, { icon: { icon: 'user' } }, { slotlabel: { display: true, label: 'more batman menu' } }, { size: 'large' }, { hasId: true }])('should manage resize with observer, case %s', async (args) => {
51
+ const page = await getPage(Object.assign({ label: 'batman' }, args));
52
+ expect(page.root).toMatchSnapshot();
53
+ });
54
+ });
55
+ describe('errors', () => {
56
+ test.each([
57
+ { props: { itemmore: { size: {} } }, error: '<mg-item-more> prop "size" must match MgItemMore[\'size\'] type' },
58
+ { props: { itemmore: { icon: '' } }, error: '<mg-item-more> prop "icon" must match MgItemMore[\'icon\'] type' },
59
+ { props: { itemmore: { icon: { icon: undefined } } }, error: '<mg-item-more> prop "icon" must match MgItemMore[\'icon\'] type' },
60
+ { props: { itemmore: { slotlabel: {} } }, error: '<mg-item-more> prop "slotlabel" must match MgItemMore[\'slotlabel\'] type' },
61
+ { props: { itemmore: { slotlabel: { label: undefined } } }, error: '<mg-item-more> prop "slotlabel" must match MgItemMore[\'slotlabel\'] type' },
62
+ { props: { itemmore: { slotlabel: { display: '' } } }, error: '<mg-item-more> prop "slotlabel" must match MgItemMore[\'slotlabel\'] type' },
63
+ ])('should throw an error, case %s', async ({ props, error }) => {
64
+ expect.assertions(1);
65
+ try {
66
+ await getPage(Object.assign({ label: 'batman' }, props));
67
+ }
68
+ catch (err) {
69
+ expect(err.message).toMatch(error);
70
+ }
71
+ });
72
+ });
73
+ describe('events', () => {
74
+ test('should update proxy status when base item status-change event was trigger', async () => {
75
+ const page = await getPage({ label: 'batman' });
76
+ expect(page.root).toMatchSnapshot();
77
+ const mgMenuItemBase = page.doc.querySelector('mg-menu-item');
78
+ const mgMenuItemProxy = page.doc.querySelector('mg-item-more').shadowRoot.querySelector('mg-menu mg-menu-item');
79
+ expect(mgMenuItemProxy).toHaveProperty('status', Status.VISIBLE);
80
+ mgMenuItemBase.dispatchEvent(new CustomEvent('status-change', { bubbles: true, detail: Status.ACTIVE }));
81
+ await page.waitForChanges();
82
+ expect(mgMenuItemProxy).toHaveProperty('status', Status.ACTIVE);
83
+ udpateItemMorePopoverId(page);
84
+ expect(page.root).toMatchSnapshot();
85
+ });
86
+ test.each([false, true])('should trigger base item click event when proxy item was clicked', async (isHref) => {
87
+ const page = await getPage({ label: 'batman', isHref });
88
+ const mgMenuItemBase = page.doc.querySelector('mg-menu-item');
89
+ const mgMenuItemProxy = page.doc.querySelector('mg-item-more').shadowRoot.querySelector('mg-menu mg-menu-item');
90
+ const spy = jest.spyOn(mgMenuItemBase.shadowRoot.querySelector(isHref ? 'a' : 'button'), 'click');
91
+ mgMenuItemProxy.dispatchEvent(new MouseEvent('click', { bubbles: true }));
92
+ await page.waitForChanges();
93
+ expect(spy).toBeCalledTimes(1);
94
+ udpateItemMorePopoverId(page);
95
+ expect(page.root).toMatchSnapshot();
96
+ });
97
+ });
98
+ test('should fire disconnect callback', async () => {
99
+ const page = await getPage({ label: 'batman' });
100
+ expect(page.root).toMatchSnapshot();
101
+ page.doc.querySelector('mg-item-more').remove();
102
+ await page.waitForChanges();
103
+ expect(page.root).toMatchSnapshot();
104
+ });
105
+ });
106
+ //# sourceMappingURL=mg-item-more.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-item-more.spec.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-item-more/test/mg-item-more.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC3J,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,SAAS,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CAAC,cAAc,CAAC,CAAC;MAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;MAChH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;MAElG,eAAe,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;MAC1E,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;MAE5B,MAAM,CAAC,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;MAE/B,uBAAuB,CAAC,IAAI,CAAC,CAAC;MAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;IACjD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEhD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC;IAEhD,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/internal';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { forcePopoverId, mockConsoleError, mockWindowFrames, setupMutationObserverMock, setupResizeObserverMock } from '../../../../utils/unit.test.utils';\nimport { MgItemMore } from '../mg-item-more';\nimport { MgMenuItem } from '../../menu/mg-menu-item/mg-menu-item';\nimport { MgMenu } from '../../menu/mg-menu/mg-menu';\nimport { Status } from '../../menu/mg-menu-item/mg-menu-item.conf';\nimport { MgPopover } from '../../mg-popover/mg-popover';\nimport { MgPopoverContent } from '../../mg-popover/mg-popover-content/mg-popover-content';\n\nmockConsoleError();\nmockWindowFrames();\n\nconst udpateItemMorePopoverId = page => {\n const moreMenuItem = page.doc.querySelector('mg-item-more').shadowRoot.querySelector('mg-menu-item');\n forcePopoverId(moreMenuItem, `mg-popover-test_more-item`);\n};\n\nlet id;\n/**\n * set id if param is true\n * @param hasId - true if need a generated id\n * @returns genereted id\n */\nconst setId = (hasId: boolean): string => (hasId ? `my-id-${id++}` : undefined);\n\nconst getPage = async args => {\n const page = await newSpecPage({\n components: [MgMenu, MgMenuItem, MgItemMore, MgPopover, MgPopoverContent],\n template: () => (\n <mg-menu {...args}>\n <mg-menu-item href={args.isHref ? '#' : undefined} id={setId(args.hasId)}>\n <span slot=\"label\">Batman</span>\n </mg-menu-item>\n <mg-menu-item id={setId(args.hasId)}>\n <span slot=\"label\">Joker</span>\n </mg-menu-item>\n <mg-menu-item id={setId(args.hasId)}>\n <span slot=\"label\">Bane</span>\n </mg-menu-item>\n </mg-menu>\n ),\n });\n\n jest.runAllTimers();\n\n await page.waitForChanges();\n\n jest.runOnlyPendingTimers();\n\n udpateItemMorePopoverId(page);\n\n return page;\n};\n\ndescribe('mg-item-more', () => {\n beforeEach(() => {\n id = 1;\n jest.useFakeTimers();\n setupResizeObserverMock({\n observe: () => null,\n disconnect: () => null,\n });\n setupMutationObserverMock({\n disconnect: () => null,\n observe: () => null,\n takeRecords: () => null,\n });\n });\n afterEach(() => jest.runOnlyPendingTimers());\n\n describe('render', () => {\n test.each([undefined, { icon: { icon: 'user' } }, { slotlabel: { display: true, label: 'more batman menu' } }, { size: 'large' }, { hasId: true }])(\n 'should manage resize with observer, case %s',\n async args => {\n const page = await getPage({ label: 'batman', ...args });\n\n expect(page.root).toMatchSnapshot();\n },\n );\n });\n\n describe('errors', () => {\n test.each([\n { props: { itemmore: { size: {} } }, error: '<mg-item-more> prop \"size\" must match MgItemMore[\\'size\\'] type' },\n { props: { itemmore: { icon: '' } }, error: '<mg-item-more> prop \"icon\" must match MgItemMore[\\'icon\\'] type' },\n { props: { itemmore: { icon: { icon: undefined } } }, error: '<mg-item-more> prop \"icon\" must match MgItemMore[\\'icon\\'] type' },\n { props: { itemmore: { slotlabel: {} } }, error: '<mg-item-more> prop \"slotlabel\" must match MgItemMore[\\'slotlabel\\'] type' },\n { props: { itemmore: { slotlabel: { label: undefined } } }, error: '<mg-item-more> prop \"slotlabel\" must match MgItemMore[\\'slotlabel\\'] type' },\n { props: { itemmore: { slotlabel: { display: '' } } }, error: '<mg-item-more> prop \"slotlabel\" must match MgItemMore[\\'slotlabel\\'] type' },\n ])('should throw an error, case %s', async ({ props, error }) => {\n expect.assertions(1);\n\n try {\n await getPage({ label: 'batman', ...props });\n } catch (err) {\n expect(err.message).toMatch(error);\n }\n });\n });\n\n describe('events', () => {\n test('should update proxy status when base item status-change event was trigger', async () => {\n const page = await getPage({ label: 'batman' });\n\n expect(page.root).toMatchSnapshot();\n\n const mgMenuItemBase = page.doc.querySelector('mg-menu-item');\n const mgMenuItemProxy = page.doc.querySelector('mg-item-more').shadowRoot.querySelector('mg-menu mg-menu-item');\n expect(mgMenuItemProxy).toHaveProperty('status', Status.VISIBLE);\n mgMenuItemBase.dispatchEvent(new CustomEvent('status-change', { bubbles: true, detail: Status.ACTIVE }));\n\n await page.waitForChanges();\n expect(mgMenuItemProxy).toHaveProperty('status', Status.ACTIVE);\n\n udpateItemMorePopoverId(page);\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([false, true])('should trigger base item click event when proxy item was clicked', async isHref => {\n const page = await getPage({ label: 'batman', isHref });\n\n const mgMenuItemBase = page.doc.querySelector('mg-menu-item');\n const mgMenuItemProxy = page.doc.querySelector('mg-item-more').shadowRoot.querySelector('mg-menu mg-menu-item');\n const spy = jest.spyOn(mgMenuItemBase.shadowRoot.querySelector(isHref ? 'a' : 'button'), 'click');\n\n mgMenuItemProxy.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(spy).toBeCalledTimes(1);\n\n udpateItemMorePopoverId(page);\n expect(page.root).toMatchSnapshot();\n });\n });\n\n test('should fire disconnect callback', async () => {\n const page = await getPage({ label: 'batman' });\n\n expect(page.root).toMatchSnapshot();\n\n page.doc.querySelector('mg-item-more').remove();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
@@ -2,3 +2,4 @@
2
2
  * List of all possibles message variants
3
3
  */
4
4
  export const variants = ['info', 'warning', 'success', 'danger'];
5
+ //# sourceMappingURL=mg-message.conf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-message.conf.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-message/mg-message.conf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC","sourcesContent":["/**\n * List of all possibles message variants\n */\nexport const variants = ['info', 'warning', 'success', 'danger'] as const;\n\n/**\n * Variant type\n */\nexport type VariantType = (typeof variants)[number];\n"]}
@@ -1,7 +1,7 @@
1
- import { h } from '@stencil/core';
2
- import { createID, ClassList } from '../../../utils/components.utils';
3
- import { variants } from './mg-message.conf';
4
- import { initLocales } from '../../../locales';
1
+ import { h } from "@stencil/core";
2
+ import { createID, ClassList } from "../../../utils/components.utils";
3
+ import { variants } from "./mg-message.conf";
4
+ import { initLocales } from "../../../locales";
5
5
  export class MgMessage {
6
6
  constructor() {
7
7
  /************
@@ -210,7 +210,8 @@ export class MgMessage {
210
210
  "references": {
211
211
  "VariantType": {
212
212
  "location": "import",
213
- "path": "./mg-message.conf"
213
+ "path": "./mg-message.conf",
214
+ "id": "src/components/molecules/mg-message/mg-message.conf.ts::VariantType"
214
215
  }
215
216
  }
216
217
  },
@@ -318,3 +319,4 @@ export class MgMessage {
318
319
  }];
319
320
  }
320
321
  }
322
+ //# sourceMappingURL=mg-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-message.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-message/mg-message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAe,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ/C,MAAM,OAAO,SAAS;;IACpB;;kBAEc;IAEd,UAAU;IACO,cAAS,GAAG,kBAAkB,CAAC;IAEhD,MAAM;IACE,kBAAa,GAAG,EAAE,CAAC;IAE3B,8DAA8D;IACtD,gBAAW,GAAkC,IAAI,CAAC;IAE1D,eAAe;IACP,cAAS,GAAG,KAAK,CAAC;IAClB,cAAS,GAAG,KAAK,CAAC;IA+G1B;;OAEG;IACK,aAAQ,GAAG,GAAS,EAAE;MAC5B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC7E,CAAC,CAAC;IAEF;;OAEG;IACK,eAAU,GAAG,GAAS,EAAE;MAC9B,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC,CAAC;IAEF;;;OAGG;IACK,gBAAW,GAAG,CAAC,KAA8B,EAAQ,EAAE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EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;MAC9G,eAAS,OAAO,EAAE,IAAI,CAAC,OAAO,mBAAgB,UAAU;QACtD,YAAM,KAAK,EAAC,kBAAkB;UAC5B,eAAS,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,GAAY,CACpC;QACP,WAAK,KAAK,EAAC,qBAAqB;UAC9B,YAAM,KAAK,EAAC,0BAA0B;YACpC,eAAa,CACR;UACN,IAAI,CAAC,UAAU,IAAI,YAAM,KAAK,EAAC,+BAA+B,GAAQ;UACtE,IAAI,CAAC,UAAU,IAAI,CAClB,YAAM,KAAK,EAAC,kCAAkC;YAC5C,YAAM,IAAI,EAAC,SAAS,GAAQ,CACvB,CACR,CACG;QACL,IAAI,CAAC,WAAW,IAAI,CACnB,YAAM,KAAK,EAAC,0BAA0B;UACpC,iBAAW,UAAU,EAAE,IAAI,CAAC,aAAa,mBAAU,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW;YACnI,eAAS,IAAI,EAAC,OAAO,GAAW,CACtB,CACP,CACR,CACO,CACN,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Prop, State, Watch } from '@stencil/core';\nimport { createID, ClassList } from '../../../utils/components.utils';\nimport { variants, VariantType } from './mg-message.conf';\nimport { initLocales } from '../../../locales';\nimport { type MgIcon } from '../../atoms/mg-icon/mg-icon';\n\n@Component({\n tag: 'mg-message',\n styleUrl: 'mg-message.scss',\n shadow: true,\n})\nexport class MgMessage {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classHide = 'mg-message--hide';\n\n // IDs\n private closeButtonId = '';\n\n // Stored timer setted when hide action is run from setTimeOut\n private storedTimer: ReturnType<typeof setTimeout> = null;\n\n // Manage hover\n private isFocused = false;\n private isHovered = false;\n\n // Locales\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMessageElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n * If not set, it will be created.\n */\n @Prop() identifier: string = createID('mg-message');\n\n /**\n * Add a delay to hide/close message when it passed\n * Value is defined in seconds and must greater than 2 seconds (PDA9-314 RG-06)\n */\n @Prop() delay: number;\n @Watch('delay')\n validateDelay(newValue: MgMessage['delay']): void {\n if (newValue !== undefined && newValue < 2) {\n throw new Error(`<mg-message> prop \"delay\" must be greater than 2 seconds.`);\n }\n }\n\n /**\n * Message variant\n */\n @Prop() variant: VariantType = variants[0]; // info\n @Watch('variant')\n validateVariant(newValue: MgMessage['variant'], oldValue?: MgMessage['variant']): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-message> prop \"variant\" must be one of: ${variants.join(', ')}`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-message--${oldValue}`);\n }\n this.classCollection.add(`mg-message--${newValue}`);\n }\n }\n\n /**\n * Define if message has a cross button\n * RG 01: https://jira.mgdis.fr/browse/PDA9-140\n */\n @Prop({ mutable: true }) closeButton = false;\n @Watch('closeButton')\n validateCloseButton(newValue: MgMessage['closeButton']): void {\n if (newValue && this.hasActions) {\n this.closeButton = false;\n throw new Error('<mg-message> prop \"close-button\" can\\'t be used with the actions slot.');\n }\n }\n\n /**\n * Define if message is hidden\n */\n @Prop({ mutable: true }) hide = false;\n @Watch('hide')\n validateHide(newValue: MgMessage['hide']): void {\n if (newValue) {\n this.componentHide.emit();\n this.classCollection.add(this.classHide);\n // Remove event Listener\n ['focusin', 'mouseenter'].forEach(event => {\n this.element.removeEventListener(event, this.timerEvents);\n });\n // Clear Timer\n this.clearTimer();\n } else {\n this.componentShow.emit();\n this.classCollection.delete(this.classHide);\n // If delay is set\n if (this.delay > 1) {\n // Start timer\n this.setTimer();\n // Stop timer when get focus or mouse enter\n ['focusin', 'mouseenter'].forEach(event => {\n this.element.addEventListener(event, this.timerEvents);\n });\n }\n }\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-message']);\n\n /**\n * Define if component is using actions slot\n */\n @State() hasActions = false;\n\n /**\n * Emited event when message is diplayed\n */\n @Event({ eventName: 'component-show' }) componentShow: EventEmitter<string>;\n\n /**\n * Emited event when message is hidden\n */\n @Event({ eventName: 'component-hide' }) componentHide: EventEmitter<string>;\n\n /**\n * Set timer\n */\n private setTimer = (): void => {\n this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);\n };\n\n /**\n * Clear timer\n */\n private clearTimer = (): void => {\n clearTimeout(this.storedTimer);\n };\n\n /**\n * Event to add on element\n * @param event - event\n */\n private timerEvents = (event: MouseEvent | FocusEvent): void => {\n this.clearTimer();\n const isMouseEvent: boolean = event.type === 'mouseenter';\n // Needed to ensure we don't start the timer\n this[isMouseEvent ? 'isHovered' : 'isFocused'] = true;\n\n // Restart timer when loose focus AND mouse leave\n this.element.addEventListener(\n isMouseEvent ? 'mouseleave' : 'focusout',\n eventOut => {\n this[eventOut.type === 'mouseleave' ? 'isHovered' : 'isFocused'] = false;\n // Start timer if needed\n if (!this.isFocused && !this.isHovered) this.setTimer();\n },\n { once: true },\n );\n };\n\n /**\n * Handle close button\n */\n private handleClose = (): void => {\n this.hide = true;\n };\n\n /**\n * Get icon corresponding to variant\n * @returns icon\n */\n private getIcon = (): MgIcon['icon'] => {\n switch (this.variant) {\n case 'info':\n return 'info-circle';\n case 'warning':\n return 'exclamation-triangle';\n case 'success':\n return 'check-circle';\n case 'danger':\n return 'exclamation-circle';\n default:\n break;\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.validateVariant(this.variant);\n // Check if close button is an can be activated\n this.hasActions = this.element.querySelector('[slot=\"actions\"]') !== null;\n this.validateCloseButton(this.closeButton);\n if (this.closeButton) {\n this.classCollection.add('mg-message--close-button');\n this.closeButtonId = `${this.identifier}-close-button`;\n }\n this.validateDelay(this.delay);\n this.validateHide(this.hide);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <div id={this.identifier} class={this.classCollection.join()} role={this.variant === 'info' ? 'status' : 'alert'}>\n <mg-card variant={this.variant} variant-style=\"bar-left\">\n <span class=\"mg-message__icon\">\n <mg-icon icon={this.getIcon()}></mg-icon>\n </span>\n <div class=\"mg-message__content\">\n <span class=\"mg-message__content-slot\">\n <slot></slot>\n </span>\n {this.hasActions && <span class=\"mg-message__content-separator\"></span>}\n {this.hasActions && (\n <span class=\"mg-message__content-actions-slot\">\n <slot name=\"actions\"></slot>\n </span>\n )}\n </div>\n {this.closeButton && (\n <span class=\"mg-message__close-button\">\n <mg-button identifier={this.closeButtonId} is-icon variant=\"flat\" label={this.messages.message.closeButton} onClick={this.handleClose}>\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n </span>\n )}\n </mg-card>\n </div>\n );\n }\n}\n"]}
@@ -0,0 +1,64 @@
1
+ import { createPage } from "../../../../utils/stencil.e2e.test.utils";
2
+ import { variants } from "../mg-message.conf";
3
+ const getContent = (contentSize, withAction) => {
4
+ let content = '<strong>Strong</strong> content!';
5
+ let actions = '';
6
+ if (contentSize === 'long') {
7
+ content =
8
+ '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.';
9
+ }
10
+ if (withAction) {
11
+ actions = `<div slot="actions" class="mg-group-elements mg-group-elements--align-right"><mg-button>Primary</mg-button><mg-button variant="secondary">Secondary</mg-button></div>`;
12
+ }
13
+ return `<p>${content}</p>${actions}`;
14
+ };
15
+ describe('mg-message', () => {
16
+ test('Should render', async () => {
17
+ const html = variants
18
+ .map(variant => {
19
+ const props = [
20
+ { contentSize: 'short', withAction: false, closeButton: false },
21
+ { contentSize: 'long', withAction: false, closeButton: false },
22
+ { contentSize: 'short', withAction: true, closeButton: false },
23
+ { contentSize: 'long', withAction: true, closeButton: false },
24
+ { contentSize: 'short', withAction: false, closeButton: true },
25
+ { contentSize: 'long', withAction: false, closeButton: true },
26
+ ];
27
+ return props
28
+ .map(({ contentSize, withAction, closeButton }) => `<mg-message variant="${variant}" close-button="${closeButton}">${getContent(contentSize, withAction)}</mg-message>`)
29
+ .join('');
30
+ })
31
+ .join('');
32
+ const page = await createPage(html);
33
+ const screenshot = await page.screenshot();
34
+ expect(screenshot).toMatchImageSnapshot();
35
+ });
36
+ test('Should render with child mg-card', async () => {
37
+ const page = await createPage(`
38
+ <mg-message class="custom-message-card">
39
+ <mg-card>child card</mg-card>
40
+ </mg-message>
41
+ <style>
42
+ .custom-message-card {
43
+ --mg-card-background: hsl(var(--color-danger));
44
+ }
45
+ </style>
46
+ `);
47
+ const screenshot = await page.screenshot();
48
+ expect(screenshot).toMatchImageSnapshot();
49
+ });
50
+ test('Should hide message on close button click', async () => {
51
+ const page = await createPage(`<mg-message close-button><p>Blu</p></mg-message>`);
52
+ const mgMessage = await page.find('mg-message');
53
+ expect(mgMessage).not.toHaveAttribute('hide');
54
+ const mgButton = await page.find('mg-message >>> mg-button');
55
+ mgButton.triggerEvent('click');
56
+ await page.waitForChanges();
57
+ const mgMessageHideProp = await mgMessage.getProperty('hide');
58
+ expect(mgMessageHideProp).toEqual(true);
59
+ await page.setViewport({ width: 600, height: 100 });
60
+ const screenshot = await page.screenshot();
61
+ expect(screenshot).toMatchImageSnapshot();
62
+ });
63
+ });
64
+ //# sourceMappingURL=mg-message.e2e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-message.e2e.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-message/test/mg-message.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE;EAC7C,IAAI,OAAO,GAAG,kCAAkC,CAAC;EACjD,IAAI,OAAO,GAAG,EAAE,CAAC;EACjB,IAAI,WAAW,KAAK,MAAM,EAAE;IAC1B,OAAO;MACL,+bAA+b,CAAC;GACnc;EACD,IAAI,UAAU,EAAE;IACd,OAAO,GAAG,uKAAuK,CAAC;GACnL;EACD,OAAO,MAAM,OAAO,OAAO,OAAO,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,IAAI,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,IAAI,GAAG,QAAQ;OAClB,GAAG,CAAC,OAAO,CAAC,EAAE;MACb,MAAM,KAAK,GAAG;QACZ,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE;QAC/D,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE;QAC9D,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE;QAC9D,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE;QAC7D,EAAE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,0BAA0B,CAAC,CAAC;IAC7D,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,iBAAiB,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAEpD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;EAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { createPage } from '../../../../utils/stencil.e2e.test.utils';\nimport { variants } from '../mg-message.conf';\n\nconst getContent = (contentSize, withAction) => {\n let content = '<strong>Strong</strong> content!';\n let actions = '';\n if (contentSize === 'long') {\n 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 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.';\n }\n if (withAction) {\n actions = `<div slot=\"actions\" class=\"mg-group-elements mg-group-elements--align-right\"><mg-button>Primary</mg-button><mg-button variant=\"secondary\">Secondary</mg-button></div>`;\n }\n return `<p>${content}</p>${actions}`;\n};\n\ndescribe('mg-message', () => {\n test('Should render', async () => {\n const html = variants\n .map(variant => {\n const props = [\n { contentSize: 'short', withAction: false, closeButton: false },\n { contentSize: 'long', withAction: false, closeButton: false },\n { contentSize: 'short', withAction: true, closeButton: false },\n { contentSize: 'long', withAction: true, closeButton: false },\n { contentSize: 'short', withAction: false, closeButton: true },\n { contentSize: 'long', withAction: false, closeButton: true },\n ];\n return props\n .map(({ contentSize, withAction, closeButton }) => `<mg-message variant=\"${variant}\" close-button=\"${closeButton}\">${getContent(contentSize, withAction)}</mg-message>`)\n .join('');\n })\n .join('');\n const page = await createPage(html);\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test('Should render with child mg-card', async () => {\n const page = await createPage(`\n <mg-message class=\"custom-message-card\">\n <mg-card>child card</mg-card>\n </mg-message>\n <style>\n .custom-message-card {\n --mg-card-background: hsl(var(--color-danger));\n }\n </style>\n `);\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test('Should hide message on close button click', async () => {\n const page = await createPage(`<mg-message close-button><p>Blu</p></mg-message>`);\n\n const mgMessage = await page.find('mg-message');\n expect(mgMessage).not.toHaveAttribute('hide');\n\n const mgButton = await page.find('mg-message >>> mg-button');\n mgButton.triggerEvent('click');\n await page.waitForChanges();\n\n const mgMessageHideProp = await mgMessage.getProperty('hide');\n expect(mgMessageHideProp).toEqual(true);\n\n await page.setViewport({ width: 600, height: 100 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n});\n"]}
@@ -0,0 +1,109 @@
1
+ import { h } from "@stencil/core";
2
+ import { newSpecPage } from "@stencil/core/testing";
3
+ import { MgMessage } from "../mg-message";
4
+ import { variants } from "../mg-message.conf";
5
+ const getDefaultContent = () => (h("p", null, h("strong", null, "Strong"), " content!"));
6
+ const getPage = (args, content) => newSpecPage({
7
+ components: [MgMessage],
8
+ template: () => h("mg-message", Object.assign({}, args), content),
9
+ });
10
+ describe('mg-message', () => {
11
+ describe.each(variants)('Should render a %s message', variant => {
12
+ test.each([
13
+ { identifier: 'identifier' },
14
+ { identifier: 'identifier', closeButton: true },
15
+ { identifier: 'identifier', closeButton: true, lang: 'fr' },
16
+ { identifier: 'identifier', closeButton: true, lang: 'xx' },
17
+ ])('with args %s', async (args) => {
18
+ const { root } = await getPage(Object.assign(Object.assign({}, args), { variant }), getDefaultContent());
19
+ expect(root).toMatchSnapshot();
20
+ });
21
+ });
22
+ test('Should replace classes on variant changes', async () => {
23
+ const page = await getPage({ identifier: 'identifier' }, getDefaultContent());
24
+ const element = page.doc.querySelector('mg-message');
25
+ let classInfo = element.shadowRoot.querySelector('.mg-message--info');
26
+ expect(classInfo).not.toBeNull();
27
+ element.variant = 'danger';
28
+ await page.waitForChanges();
29
+ classInfo = element.shadowRoot.querySelector('.mg-message--info');
30
+ const classDanger = element.shadowRoot.querySelector('.mg-message--danger');
31
+ expect(classInfo).toBeNull();
32
+ expect(classDanger).not.toBeNull();
33
+ });
34
+ test.each(['', 'blu'])('Should throw error with invalid variant property: %s', async (variant) => {
35
+ expect.assertions(1);
36
+ try {
37
+ await getPage({ identifier: 'identifier', variant }, getDefaultContent());
38
+ }
39
+ catch (err) {
40
+ expect(err.message).toMatch('<mg-message> prop "variant" must be one of:');
41
+ }
42
+ });
43
+ test('Should throw error with invalid delay property: 50ms', async () => {
44
+ expect.assertions(1);
45
+ try {
46
+ await getPage({ identifier: 'identifier', delay: 1 }, getDefaultContent());
47
+ }
48
+ catch (err) {
49
+ expect(err.message).toMatch('<mg-message> prop "delay" must be greater than 2 seconds.');
50
+ }
51
+ });
52
+ test('Should throw error when using prop "close-button" with an action slot', async () => {
53
+ expect.assertions(1);
54
+ try {
55
+ await getPage({ identifier: 'identifier', closeButton: true }, [
56
+ getDefaultContent(),
57
+ h("div", { slot: "actions", class: "mg-group-elements mg-group-elements--align-right" }, h("mg-button", null, "Primary"), h("mg-button", { variant: "secondary" }, "Secondary")),
58
+ ]);
59
+ }
60
+ catch (err) {
61
+ expect(err.message).toMatch('<mg-message> prop "close-button" can\'t be used with the actions slot.');
62
+ }
63
+ });
64
+ test('Should hide message on close button', async () => {
65
+ const args = { identifier: 'identifier', closeButton: true };
66
+ const page = await getPage(args, getDefaultContent());
67
+ const element = page.doc.querySelector('mg-message');
68
+ const button = element.shadowRoot.querySelector('mg-button');
69
+ jest.spyOn(page.rootInstance.componentHide, 'emit');
70
+ button.dispatchEvent(new CustomEvent('click', { bubbles: true }));
71
+ await page.waitForChanges();
72
+ expect(page.rootInstance.componentHide.emit).toHaveBeenCalledTimes(1);
73
+ expect(page.rootInstance.classCollection.join()).toContain('mg-message--hide');
74
+ });
75
+ test('Should hide message on delay', async () => {
76
+ const args = { identifier: 'identifier', delay: 2 };
77
+ const page = await getPage(args, getDefaultContent());
78
+ jest.spyOn(page.rootInstance.componentHide, 'emit');
79
+ jest.spyOn(page.rootInstance.componentShow, 'emit');
80
+ expect(page.rootInstance.classCollection.join()).not.toContain('mg-message--hide');
81
+ jest.advanceTimersByTime(args.delay * 1000);
82
+ expect(page.rootInstance.classCollection.join()).toContain('mg-message--hide');
83
+ expect(page.rootInstance.componentHide.emit).toHaveBeenCalledTimes(1);
84
+ page.rootInstance.hide = false;
85
+ await page.waitForChanges();
86
+ expect(page.rootInstance.classCollection.join()).not.toContain('mg-message--hide');
87
+ expect(page.rootInstance.componentShow.emit).toHaveBeenCalledTimes(1);
88
+ jest.advanceTimersByTime(args.delay * 1000);
89
+ expect(page.rootInstance.classCollection.join()).toContain('mg-message--hide');
90
+ expect(page.rootInstance.componentHide.emit).toHaveBeenCalledTimes(2);
91
+ });
92
+ test.each(['focus', 'mouse'])('Should manage event %s with delay', async (eventType) => {
93
+ const args = { identifier: 'identifier', delay: 2 };
94
+ const page = await getPage(args, getDefaultContent());
95
+ jest.spyOn(page.rootInstance.componentHide, 'emit');
96
+ jest.spyOn(page.rootInstance.componentShow, 'emit');
97
+ const element = page.doc.querySelector('mg-message');
98
+ expect(page.rootInstance.classCollection.join()).not.toContain('mg-message--hide');
99
+ jest.advanceTimersByTime((args.delay / 2) * 1000);
100
+ element.dispatchEvent(eventType === 'focus' ? new FocusEvent('focusin') : new MouseEvent('mouseenter'));
101
+ jest.advanceTimersByTime(args.delay * 1000);
102
+ expect(page.rootInstance.classCollection.join()).not.toContain('mg-message--hide');
103
+ element.dispatchEvent(eventType === 'focus' ? new FocusEvent('focusout') : new MouseEvent('mouseleave'));
104
+ jest.advanceTimersByTime(args.delay * 1000);
105
+ expect(page.rootInstance.classCollection.join()).toContain('mg-message--hide');
106
+ expect(page.rootInstance.componentHide.emit).toHaveBeenCalledTimes(1);
107
+ });
108
+ });
109
+ //# sourceMappingURL=mg-message.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-message.spec.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-message/test/mg-message.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,oBAAoB,CAAC;AAE9C,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAC9B;EACE,2BAAuB;cACrB,CACL,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAChC,WAAW,CAAC;EACV,UAAU,EAAE,CAAC,SAAS,CAAC;EACvB,QAAQ,EAAE,GAAG,EAAE,CAAC,kCAAgB,IAAI,GAAG,OAAO,CAAc;CAC7D,CAAC,CAAC;AAEL,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,4BAA4B,EAAE,OAAO,CAAC,EAAE;IAC9D,IAAI,CAAC,IAAI,CAAC;MACR,EAAE,UAAU,EAAE,YAAY,EAAE;MAC5B,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE;MAC/C,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EA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C;IAC/E,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;EACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgMessage } from '../mg-message';\nimport { variants } from '../mg-message.conf';\n\nconst getDefaultContent = () => (\n <p>\n <strong>Strong</strong> content!\n </p>\n);\n\nconst getPage = (args, content) =>\n newSpecPage({\n components: [MgMessage],\n template: () => <mg-message {...args}>{content}</mg-message>,\n });\n\ndescribe('mg-message', () => {\n describe.each(variants)('Should render a %s message', variant => {\n test.each([\n { identifier: 'identifier' },\n { identifier: 'identifier', closeButton: true },\n { identifier: 'identifier', closeButton: true, lang: 'fr' },\n { identifier: 'identifier', closeButton: true, lang: 'xx' },\n ])('with args %s', async args => {\n const { root } = await getPage({ ...args, variant }, getDefaultContent());\n expect(root).toMatchSnapshot();\n });\n });\n\n test('Should replace classes on variant changes', async () => {\n const page = await getPage({ identifier: 'identifier' }, getDefaultContent());\n const element = page.doc.querySelector('mg-message');\n let classInfo = element.shadowRoot.querySelector('.mg-message--info');\n\n expect(classInfo).not.toBeNull();\n\n element.variant = 'danger';\n await page.waitForChanges();\n\n classInfo = element.shadowRoot.querySelector('.mg-message--info');\n const classDanger = element.shadowRoot.querySelector('.mg-message--danger');\n\n expect(classInfo).toBeNull();\n expect(classDanger).not.toBeNull();\n });\n\n test.each(['', 'blu'])('Should throw error with invalid variant property: %s', async variant => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', variant }, getDefaultContent());\n } catch (err) {\n expect(err.message).toMatch('<mg-message> prop \"variant\" must be one of:');\n }\n });\n\n test('Should throw error with invalid delay property: 50ms', async () => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', delay: 1 }, getDefaultContent());\n } catch (err) {\n expect(err.message).toMatch('<mg-message> prop \"delay\" must be greater than 2 seconds.');\n }\n });\n\n test('Should throw error when using prop \"close-button\" with an action slot', async () => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', closeButton: true }, [\n getDefaultContent(),\n <div slot=\"actions\" class=\"mg-group-elements mg-group-elements--align-right\">\n <mg-button>Primary</mg-button>\n <mg-button variant=\"secondary\">Secondary</mg-button>\n </div>,\n ]);\n } catch (err) {\n expect(err.message).toMatch('<mg-message> prop \"close-button\" can\\'t be used with the actions slot.');\n }\n });\n\n test('Should hide message on close button', async () => {\n const args = { identifier: 'identifier', closeButton: true };\n const page = await getPage(args, getDefaultContent());\n\n const element = page.doc.querySelector('mg-message');\n const button = element.shadowRoot.querySelector('mg-button');\n\n jest.spyOn(page.rootInstance.componentHide, 'emit');\n\n button.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.rootInstance.componentHide.emit).toHaveBeenCalledTimes(1);\n expect(page.rootInstance.classCollection.join()).toContain('mg-message--hide');\n });\n\n test('Should hide message on delay', async () => {\n const args = { identifier: 'identifier', delay: 2 };\n const page = await getPage(args, getDefaultContent());\n\n jest.spyOn(page.rootInstance.componentHide, 'emit');\n jest.spyOn(page.rootInstance.componentShow, 'emit');\n\n expect(page.rootInstance.classCollection.join()).not.toContain('mg-message--hide');\n\n jest.advanceTimersByTime(args.delay * 1000);\n\n expect(page.rootInstance.classCollection.join()).toContain('mg-message--hide');\n expect(page.rootInstance.componentHide.emit).toHaveBeenCalledTimes(1);\n\n page.rootInstance.hide = false;\n await page.waitForChanges();\n\n expect(page.rootInstance.classCollection.join()).not.toContain('mg-message--hide');\n expect(page.rootInstance.componentShow.emit).toHaveBeenCalledTimes(1);\n\n jest.advanceTimersByTime(args.delay * 1000);\n\n expect(page.rootInstance.classCollection.join()).toContain('mg-message--hide');\n expect(page.rootInstance.componentHide.emit).toHaveBeenCalledTimes(2);\n });\n\n test.each(['focus', 'mouse'])('Should manage event %s with delay', async eventType => {\n const args = { identifier: 'identifier', delay: 2 };\n const page = await getPage(args, getDefaultContent());\n\n jest.spyOn(page.rootInstance.componentHide, 'emit');\n jest.spyOn(page.rootInstance.componentShow, 'emit');\n\n const element = page.doc.querySelector('mg-message');\n\n expect(page.rootInstance.classCollection.join()).not.toContain('mg-message--hide');\n\n jest.advanceTimersByTime((args.delay / 2) * 1000);\n\n element.dispatchEvent(eventType === 'focus' ? new FocusEvent('focusin') : new MouseEvent('mouseenter'));\n\n jest.advanceTimersByTime(args.delay * 1000);\n\n expect(page.rootInstance.classCollection.join()).not.toContain('mg-message--hide');\n\n element.dispatchEvent(eventType === 'focus' ? new FocusEvent('focusout') : new MouseEvent('mouseleave'));\n\n jest.advanceTimersByTime(args.delay * 1000);\n\n expect(page.rootInstance.classCollection.join()).toContain('mg-message--hide');\n expect(page.rootInstance.componentHide.emit).toHaveBeenCalledTimes(1);\n });\n});\n"]}
@@ -2,3 +2,4 @@
2
2
  * List of all possibles dialog roles
3
3
  */
4
4
  export const dialogRoles = ['dialog', 'alertdialog'];
5
+ //# sourceMappingURL=mg-modal.conf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-modal.conf.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-modal/mg-modal.conf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAU,CAAC","sourcesContent":["/**\n * List of all possibles dialog roles\n */\nexport const dialogRoles = ['dialog', 'alertdialog'] as const;\n\n/**\n * DialogRole type from dialog roles\n */\nexport type DialogRoleType = (typeof dialogRoles)[number];\n"]}
@@ -1,7 +1,7 @@
1
- import { h } from '@stencil/core';
2
- import { createID, ClassList, focusableElements } from '../../../utils/components.utils';
3
- import { initLocales } from '../../../locales';
4
- import { dialogRoles } from './mg-modal.conf';
1
+ import { h } from "@stencil/core";
2
+ import { createID, ClassList, focusableElements } from "../../../utils/components.utils";
3
+ import { initLocales } from "../../../locales";
4
+ import { dialogRoles } from "./mg-modal.conf";
5
5
  export class MgModal {
6
6
  constructor() {
7
7
  /************
@@ -201,7 +201,8 @@ export class MgModal {
201
201
  "references": {
202
202
  "DialogRoleType": {
203
203
  "location": "import",
204
- "path": "./mg-modal.conf"
204
+ "path": "./mg-modal.conf",
205
+ "id": "src/components/molecules/mg-modal/mg-modal.conf.ts::DialogRoleType"
205
206
  }
206
207
  }
207
208
  },
@@ -332,3 +333,4 @@ export class MgModal {
332
333
  }];
333
334
  }
334
335
  }
336
+ //# sourceMappingURL=mg-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-modal.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-modal/mg-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAkB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9D,MAAM,OAAO,OAAO;;IAClB;;kBAEc;IAEd,2BAA2B;IACnB,2BAAsB,GAAkB,EAAE,CAAC;IAGnD,UAAU;IACO,cAAS,GAAG,gBAAgB,CAAC;IAE9C,MAAM;IACE,YAAO,GAAG,EAAE,CAAC;IA4GrB;;;OAGG;IACK,+BAA0B,GAAG,CAAC,KAAK,EAAQ,EAAE;MACnD,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;QAC1C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;OACxC;IACH,CAAC,CAAC;IAEF;;;OAGG;IACK,gCAA2B,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Q,CAAC,KAAK,CAAC,WAAW,EACtC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,GAAG,EAAE,CAAC,EAAuB,EAAE,EAAE;kBAC/B,IAAI,EAAE,KAAK,IAAI,EAAE;oBACf,4BAA4B;oBAC5B,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;oBAC7B,uEAAuE;oBACvE,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;mBAC9D;gBACH,CAAC;gBAED,eAAS,IAAI,EAAC,OAAO,GAAW,CACtB,CACP,CACR;YACD,UAAI,KAAK,EAAC,iBAAiB,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,IACzC,IAAI,CAAC,UAAU,CACb,CACE;UAER,IAAI,CAAC,UAAU,IAAI,CAClB,eAAS,KAAK,EAAC,mBAAmB;YAChC,YAAM,IAAI,EAAC,SAAS,GAAQ,CACpB,CACX;UAEA,IAAI,CAAC,UAAU,IAAI,CAClB,cAAQ,KAAK,EAAC,kBAAkB;YAC9B,YAAM,IAAI,EAAC,SAAS,GAAQ,CACrB,CACV,CACG,CACE,CACN,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch, Element, Event, EventEmitter, Listen } from '@stencil/core';\nimport { createID, ClassList, focusableElements } from '../../../utils/components.utils';\nimport { initLocales } from '../../../locales';\nimport { DialogRoleType, dialogRoles } from './mg-modal.conf';\n\n@Component({\n tag: 'mg-modal',\n styleUrl: 'mg-modal.scss',\n shadow: true,\n})\nexport class MgModal {\n /************\n * Internal *\n ************/\n\n // Modal focusable elements\n private modalFocusableElements: HTMLElement[] = [];\n private closeButtonElement: HTMLMgButtonElement;\n\n // Classes\n private readonly classHide = 'mg-modal--hide';\n\n // IDs\n private titleId = '';\n\n // Locales\n private messages;\n\n // body overflow default\n private bodyOverflow: string;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgModalElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n * If not set, it will be created.\n */\n @Prop() identifier: string = createID('mg-modal');\n\n /**\n * Modal dialog role.\n */\n @Prop() dialogRole: DialogRoleType = dialogRoles[0];\n @Watch('dialogRole')\n validateDialogRole(newValue: MgModal['dialogRole']): void {\n if (!dialogRoles.includes(newValue)) throw new Error(`<mg-modal> prop \"dialogRole\" must be one of: ${dialogRoles.join(', ')}.`);\n }\n\n /**\n * Displayed modal title\n */\n @Prop() modalTitle!: string;\n @Watch('modalTitle')\n validateModalTitle(newValue: MgModal['modalTitle']): void {\n if (typeof newValue !== 'string' || newValue.trim() === '') {\n throw new Error('<mg-modal> prop \"modalTitle\" is required.');\n }\n }\n\n /**\n * Define if modal has a cross button\n */\n @Prop() closeButton = false;\n\n /**\n * Define if modal is hidden\n */\n @Prop({ mutable: true }) hide: boolean;\n @Watch('hide')\n validateHide(newValue: MgModal['hide']): void {\n if (newValue) {\n this.componentHide.emit();\n this.classCollection.add(this.classHide);\n document.body.style.overflow = this.bodyOverflow;\n // reset focus handlers\n this.getLastFocusableElement()?.removeEventListener('keydown', this.handleLastFocusableElement);\n if (this.modalFocusableElements.length > 0) this.modalFocusableElements[0].removeEventListener('keydown', this.handleFirstFocusableElement);\n } else if (newValue === false) {\n this.componentShow.emit();\n this.classCollection.delete(this.classHide);\n document.body.style.overflow = 'hidden';\n this.setFocus();\n }\n }\n\n /**\n * Define if component is using actions slot\n */\n @State() hasActions = false;\n\n /**\n * Define if component is using content slot\n */\n @State() hasContent = false;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-modal']);\n\n /**\n * Emmited event when modal is diplayed\n */\n @Event({ eventName: 'component-show' }) componentShow: EventEmitter<string>;\n\n /**\n * Emmited event when modal is hidden\n */\n @Event({ eventName: 'component-hide' }) componentHide: EventEmitter<string>;\n\n /**\n * Handle 'escape' key down\n * @param event - keydown event\n */\n @Listen('keydown', {\n target: 'window',\n })\n handleKeyDown(event: KeyboardEvent): void {\n // we can use 'Escape button\" when this not a blocking modal, induced by closeButton value.\n if (this.closeButton && event.key === 'Escape') {\n this.hide = true;\n }\n }\n\n /**\n * Handle last focusable element\n * @param event - keyboard event\n */\n private handleLastFocusableElement = (event): void => {\n if (event.key === 'Tab' && !event.shiftKey) {\n event.preventDefault();\n this.modalFocusableElements[0].focus();\n }\n };\n\n /**\n * Handle first focusable element\n * @param event - keyboard event\n */\n private handleFirstFocusableElement = (event): void => {\n if (event.key === 'Tab' && event.shiftKey) {\n event.preventDefault();\n this.getLastFocusableElement().focus();\n }\n };\n\n /**\n * Get last focusablmeElement\n * @returns last modal focusable element\n */\n private getLastFocusableElement = (): HTMLElement | null => (this.modalFocusableElements.length > 0 ? this.modalFocusableElements[this.modalFocusableElements.length - 1] : null);\n\n /**\n * Method to manage focus on modal focusable elements\n */\n private setFocus = (): void => {\n // Get all focusable elements\n const allFocusableElements = Array.from(this.element.querySelectorAll(focusableElements));\n // If at least one\n if (allFocusableElements.length > 0) {\n this.modalFocusableElements = allFocusableElements.reduce((acc, focusableElement) => {\n acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(focusableElements) || focusableElement : focusableElement);\n return acc;\n }, []);\n // When close button is enabled it's the first focusable element.\n if (this.closeButton && this.closeButtonElement !== undefined) {\n this.modalFocusableElements.unshift(this.closeButtonElement);\n }\n // Add event listener on last element\n this.getLastFocusableElement().addEventListener('keydown', this.handleLastFocusableElement);\n // Add event listener on first element (case shift + tab)\n this.modalFocusableElements[0].addEventListener('keydown', this.handleFirstFocusableElement);\n }\n };\n\n /*************\n * Handlers *\n *************/\n\n /**\n * Handle close button\n */\n private handleClose = (): void => {\n this.hide = true;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n // Store body overflow\n this.bodyOverflow = document.body.style.overflow;\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.hasActions = this.element.querySelector('[slot=\"actions\"]') !== null;\n this.hasContent = this.element.querySelector('[slot=\"content\"]') !== null;\n this.titleId = `${this.identifier}-title`;\n this.validateModalTitle(this.modalTitle);\n this.validateHide(this.hide);\n this.validateDialogRole(this.dialogRole);\n }\n\n /**\n * Add observer on component to set focus when displayed\n */\n componentDidLoad(): void {\n new MutationObserver(mutationList => {\n // as mutation.target is null on chrome and '' or undefined on firefox we test both with the 'aria-hidden' attribute mutation\n if (mutationList.some(mutation => mutation.attributeName === 'aria-hidden' && ['', null, undefined].includes((mutation.target as HTMLElement).ariaHidden))) {\n // Set focus on first element\n this.modalFocusableElements[0].focus();\n }\n }).observe(this.element.shadowRoot.getElementById(this.identifier), { attributes: true });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <div role={this.dialogRole} id={this.identifier} class={this.classCollection.join()} tabindex=\"-1\" aria-labelledby={this.titleId} aria-modal=\"true\" aria-hidden={this.hide}>\n <mg-card>\n <div class=\"mg-modal__dialog\">\n <header class=\"mg-modal__header\">\n {this.closeButton && (\n <span class=\"mg-modal__close-button\">\n <mg-button\n identifier={`${this.identifier}-close-button`}\n is-icon\n variant=\"flat\"\n label={this.messages.modal.closeButton}\n onClick={this.handleClose}\n ref={(el: HTMLMgButtonElement) => {\n if (el !== null) {\n // store closeButton Element\n this.closeButtonElement = el;\n // add close button element to modalFocusableElements when it is render\n this.modalFocusableElements.unshift(this.closeButtonElement);\n }\n }}\n >\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n </span>\n )}\n <h1 class=\"mg-modal__title\" id={this.titleId}>\n {this.modalTitle}\n </h1>\n </header>\n\n {this.hasContent && (\n <article class=\"mg-modal__content\">\n <slot name=\"content\"></slot>\n </article>\n )}\n\n {this.hasActions && (\n <footer class=\"mg-modal__footer\">\n <slot name=\"actions\"></slot>\n </footer>\n )}\n </div>\n </mg-card>\n </div>\n );\n }\n}\n"]}