@mgdis/mg-components 5.16.0 → 5.18.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 (475) 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 +485 -163
  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 +38 -16
  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 +138 -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 +272 -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 +109 -27
  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 +638 -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 +88 -15
  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 +379 -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 +120 -46
  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 +456 -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 +92 -16
  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 +289 -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 +91 -15
  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 +355 -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 +95 -17
  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 +399 -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 +104 -27
  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 +343 -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 +108 -31
  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 +318 -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 +8 -6
  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 +17 -12
  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 +213 -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 +40 -18
  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 +159 -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 +142 -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 +7 -0
  284. package/dist/collection/utils/components.utils.js.map +1 -0
  285. package/dist/collection/utils/components.utils.spec.js +128 -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 +9 -1
  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 +7 -2
  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 +64 -14
  343. package/dist/components/mg-input-checkbox.js.map +1 -0
  344. package/dist/components/mg-input-date.js +51 -9
  345. package/dist/components/mg-input-date.js.map +1 -0
  346. package/dist/components/mg-input-numeric.js +82 -39
  347. package/dist/components/mg-input-numeric.js.map +1 -0
  348. package/dist/components/mg-input-password.js +53 -11
  349. package/dist/components/mg-input-password.js.map +1 -0
  350. package/dist/components/mg-input-radio.js +53 -10
  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 +53 -10
  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 +64 -23
  359. package/dist/components/mg-input-text2.js.map +1 -0
  360. package/dist/components/mg-input-textarea.js +69 -27
  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 +16 -7
  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 +40 -15
  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 +37 -12
  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 +485 -163
  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-ff3ca349.entry.js +2 -0
  439. package/dist/mg-components/p-ff3ca349.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/atoms/mg-tooltip/mg-tooltip.d.ts +2 -1
  442. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +22 -1
  443. package/dist/types/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.d.ts +1 -0
  444. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +17 -2
  445. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +35 -20
  446. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -1
  447. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +16 -1
  448. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +16 -1
  449. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +17 -5
  450. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +17 -5
  451. package/dist/types/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.d.ts +2 -0
  452. package/dist/types/components/molecules/mg-details/test/mg-details.e2e.playwright.d.ts +1 -0
  453. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  454. package/dist/types/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.d.ts +1 -0
  455. package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.playwright.d.ts +1 -0
  456. package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.template.d.ts +12 -0
  457. package/dist/types/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.d.ts +1 -0
  458. package/dist/types/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.d.ts +1 -0
  459. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
  460. package/dist/types/components/molecules/mg-panel/test/mg-panel.e2e.playwright.d.ts +1 -0
  461. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -0
  462. package/dist/types/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.d.ts +1 -0
  463. package/dist/types/components.d.ts +79 -11
  464. package/dist/types/stencil-public-runtime.d.ts +43 -17
  465. package/dist/types/test/typography.e2e.playwright.d.ts +1 -0
  466. package/dist/types/utils/components.utils.d.ts +6 -0
  467. package/dist/types/utils/e2e.test.utils.d.ts +22 -0
  468. package/dist/types/utils/stencil.e2e.test.utils.d.ts +14 -0
  469. package/loader/index.d.ts +2 -2
  470. package/package.json +5 -5
  471. package/dist/esm/polyfills/css-shim.js +0 -1
  472. package/dist/mg-components/p-067080e4.js +0 -1
  473. package/dist/mg-components/p-3286bc46.entry.js +0 -1
  474. package/dist/mg-components/p-3bf1e2f0.js +0 -2
  475. package/dist/mg-components/p-91f4a30d.entry.js +0 -1
@@ -0,0 +1,213 @@
1
+ import { h } from "@stencil/core";
2
+ import { newSpecPage } from "@stencil/core/testing";
3
+ import { MgPanel } from "../mg-panel";
4
+ import { MgButton } from "../../../atoms/mg-button/mg-button";
5
+ import { MgInputText } from "../../inputs/mg-input-text/mg-input-text";
6
+ import { expandToggleDisplays, titlePositions } from "../mg-panel.conf";
7
+ const getPage = (args, slot) => {
8
+ const page = newSpecPage({
9
+ components: [MgPanel, MgButton, MgInputText],
10
+ template: () => h("mg-panel", Object.assign({}, args), slot),
11
+ });
12
+ jest.runAllTimers();
13
+ return page;
14
+ };
15
+ describe('mg-panel', () => {
16
+ beforeAll(() => (global.HTMLInputElement.prototype.focus = jest.fn()));
17
+ afterAll(() => delete global.HTMLInputElement.prototype.focus);
18
+ beforeEach(() => jest.useFakeTimers());
19
+ afterEach(() => jest.runOnlyPendingTimers());
20
+ test.each([
21
+ { identifier: 'identifier', panelTitle: 'panel title' },
22
+ { identifier: 'identifier', panelTitle: 'panel title', expanded: true },
23
+ { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true },
24
+ { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, titlePattern: /joker/, titlePatternErrorMessage: "You can't enter a bad guy !" },
25
+ { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, lang: 'fr' },
26
+ { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, lang: 'xx' },
27
+ ...titlePositions.map(titlePosition => ({ identifier: 'identifier', panelTitle: 'panel title', titlePosition })),
28
+ ...expandToggleDisplays.map(expandToggleDisplay => ({ identifier: 'identifier', panelTitle: 'panel title', expandToggleDisplay })),
29
+ ...expandToggleDisplays.map(expandToggleDisplay => ({ identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, expandToggleDisplay })),
30
+ ])('Should render with args %s:', async (args) => {
31
+ const { root } = await getPage(args);
32
+ expect(root).toMatchSnapshot();
33
+ });
34
+ describe('errors', () => {
35
+ test('Should throw error when props association are unauthorized %s:', async () => {
36
+ expect.assertions(1);
37
+ try {
38
+ await getPage({ identifier: 'identifier', panelTitle: 'panel title', titlePattern: /joker/ });
39
+ }
40
+ catch (err) {
41
+ expect(err.message).toBe('<mg-panel> prop "titleEditable" must be set to "true".');
42
+ }
43
+ });
44
+ test.each(['', ' ', undefined])('Should not render with invalid panelTitle property: %s', async (panelTitle) => {
45
+ expect.assertions(1);
46
+ try {
47
+ await getPage({ panelTitle });
48
+ }
49
+ catch (err) {
50
+ expect(err.message).toMatch('<mg-panel> prop "panelTitle" is required.');
51
+ }
52
+ });
53
+ test.each(['', ' ', 'batman'].map(titlePosition => ({ panelTitle: 'panel title', titlePosition })))('Should throw an error when prop "titlePosition" is invalid', async (props) => {
54
+ try {
55
+ await getPage(props);
56
+ }
57
+ catch (err) {
58
+ expect(err.message).toMatch(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}.`);
59
+ }
60
+ });
61
+ test.each(['', ' ', 'batman'].map(expandToggleDisplay => ({ panelTitle: 'panel title', expandToggleDisplay })))('Should throw an error when prop "expandToggleDisplay" is invalid', async (props) => {
62
+ try {
63
+ await getPage(props);
64
+ }
65
+ catch (err) {
66
+ expect(err.message).toMatch(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}.`);
67
+ }
68
+ });
69
+ });
70
+ describe('navigation', () => {
71
+ test.each([true, false])('Should toggle collapse panel, expanded %s', async (expanded) => {
72
+ const page = await getPage({ identifier: 'identifier', panelTitle: 'panel title', expanded });
73
+ const mgPanel = page.doc.querySelector('mg-panel');
74
+ const collapseButton = mgPanel.shadowRoot.querySelector('mg-button:first-of-type');
75
+ const spy = jest.spyOn(page.rootInstance.expandedChange, 'emit');
76
+ expect(page.root).toMatchSnapshot();
77
+ collapseButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
78
+ await page.waitForChanges();
79
+ expect(page.root).toMatchSnapshot();
80
+ collapseButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
81
+ await page.waitForChanges();
82
+ expect(page.root).toMatchSnapshot();
83
+ expect(spy).toBeCalledTimes(2);
84
+ });
85
+ test.each([true, false])('Should NOT collapse panel, case expandToggleDisabled = true', async (expanded) => {
86
+ const page = await getPage({ identifier: 'identifier', panelTitle: 'panel title', expanded, expandToggleDisabled: true });
87
+ const mgPanel = page.doc.querySelector('mg-panel');
88
+ const collapseButton = mgPanel.shadowRoot.querySelector('mg-button:first-of-type');
89
+ expect(page.root).toMatchSnapshot();
90
+ collapseButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
91
+ await page.waitForChanges();
92
+ expect(page.root).toMatchSnapshot();
93
+ });
94
+ test.each([true, false])('Should toggle edit panel title', async (titleEditable) => {
95
+ const page = await getPage({ identifier: 'identifier', panelTitle: 'panel title', titleEditable });
96
+ const mgPanel = page.doc.querySelector('mg-panel');
97
+ const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');
98
+ expect(page.root).toMatchSnapshot();
99
+ if (titleEditable) {
100
+ editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
101
+ await page.waitForChanges();
102
+ expect(page.root).toMatchSnapshot();
103
+ editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
104
+ jest.runOnlyPendingTimers();
105
+ await page.waitForChanges();
106
+ expect(page.root).toMatchSnapshot();
107
+ }
108
+ });
109
+ test.each(['first-of-type', 'last-of-type'])('should update panel title, case %s', async (lastAction) => {
110
+ const updatedPanelTitle = 'Updated panel title';
111
+ const args = { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true };
112
+ const page = await getPage(args);
113
+ const mgPanel = page.doc.querySelector('mg-panel');
114
+ const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');
115
+ expect(page.root).toMatchSnapshot();
116
+ jest.spyOn(page.rootInstance.titleChange, 'emit');
117
+ editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
118
+ await page.waitForChanges();
119
+ expect(page.root).toMatchSnapshot();
120
+ const mgInputText = mgPanel.shadowRoot.querySelector('mg-input-text');
121
+ const input = mgInputText.shadowRoot.querySelector('input');
122
+ input.value = updatedPanelTitle;
123
+ input.dispatchEvent(new CustomEvent('input', { bubbles: true }));
124
+ await page.waitForChanges();
125
+ input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
126
+ await page.waitForChanges();
127
+ const afterInputAction = mgPanel.shadowRoot.querySelector(`.mg-panel__header-title mg-input-text mg-button:${lastAction}`);
128
+ afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));
129
+ jest.runOnlyPendingTimers();
130
+ await page.waitForChanges();
131
+ expect(page.root).toMatchSnapshot();
132
+ if (lastAction === 'last-of-type') {
133
+ expect(mgPanel.panelTitle).toBe(updatedPanelTitle);
134
+ expect(page.rootInstance.titleChange.emit).toHaveBeenCalledWith(updatedPanelTitle);
135
+ }
136
+ else {
137
+ expect(mgPanel.panelTitle).toBe(args.panelTitle);
138
+ expect(page.rootInstance.titleChange.emit).not.toHaveBeenCalled();
139
+ }
140
+ });
141
+ test('should NOT update panel title, case no enter in input', async () => {
142
+ const updatedPanelTitle = 'Updated panel title';
143
+ const args = { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true };
144
+ const page = await getPage(args);
145
+ const mgPanel = page.doc.querySelector('mg-panel');
146
+ const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');
147
+ expect(page.root).toMatchSnapshot();
148
+ jest.spyOn(page.rootInstance.titleChange, 'emit');
149
+ editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
150
+ await page.waitForChanges();
151
+ expect(page.root).toMatchSnapshot();
152
+ const mgInputText = mgPanel.shadowRoot.querySelector('mg-input-text');
153
+ const input = mgInputText.shadowRoot.querySelector('input');
154
+ input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
155
+ await page.waitForChanges();
156
+ const afterInputAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');
157
+ afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));
158
+ jest.runOnlyPendingTimers();
159
+ await page.waitForChanges();
160
+ expect(page.root).toMatchSnapshot();
161
+ expect(mgPanel.panelTitle).toBe(args.panelTitle);
162
+ expect(page.rootInstance.titleChange.emit).not.toHaveBeenCalledWith(updatedPanelTitle);
163
+ });
164
+ test('Should NOT update panel title, case input new value does NOT match pattern', async () => {
165
+ const updatedPanelTitle = 'joker';
166
+ const args = {
167
+ identifier: 'identifier',
168
+ panelTitle: 'panel title',
169
+ titleEditable: true,
170
+ titlePattern: '^(?!(joker)$)[a-z A-Z0-9s]+$',
171
+ titlePatternErrorMessage: "You can't enter a bad guy !",
172
+ };
173
+ const page = await getPage(args);
174
+ const mgPanel = page.doc.querySelector('mg-panel');
175
+ const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');
176
+ expect(page.root).toMatchSnapshot();
177
+ jest.spyOn(page.rootInstance.titleChange, 'emit');
178
+ // first switch to title edition
179
+ editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
180
+ await page.waitForChanges();
181
+ expect(page.root).toMatchSnapshot();
182
+ const mgInputText = mgPanel.shadowRoot.querySelector('mg-input-text');
183
+ const input = mgInputText.shadowRoot.querySelector('input');
184
+ input.checkValidity = jest.fn(() => false);
185
+ Object.defineProperty(input, 'validity', {
186
+ get: jest.fn(() => ({
187
+ patternMismatch: false,
188
+ })),
189
+ });
190
+ // second update title with a falsy update title
191
+ input.value = updatedPanelTitle;
192
+ input.dispatchEvent(new CustomEvent('input', { bubbles: true }));
193
+ await page.waitForChanges();
194
+ input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
195
+ await page.waitForChanges();
196
+ // and click on validate button
197
+ const afterInputAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');
198
+ afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));
199
+ jest.runOnlyPendingTimers();
200
+ await page.waitForChanges();
201
+ expect(page.root).toMatchSnapshot();
202
+ expect(mgPanel.panelTitle).toBe(args.panelTitle);
203
+ expect(page.rootInstance.titleChange.emit).not.toHaveBeenCalledWith(updatedPanelTitle);
204
+ // finaly return to default view by clicking on cancel button
205
+ const cancelAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');
206
+ cancelAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));
207
+ jest.runOnlyPendingTimers();
208
+ await page.waitForChanges();
209
+ expect(page.root).toMatchSnapshot();
210
+ });
211
+ });
212
+ });
213
+ //# sourceMappingURL=mg-panel.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-panel.spec.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-panel/test/mg-panel.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,cAAc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AAC;MAE1H,gBAAgB,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;MAC5E,IAAI,CAAC,oBAAoB,EAAE,CAAC;MAC5B,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;MAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;MAEpC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;MACjD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;MAEvF,6DAA6D;MAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,8DAA8D,CAAC,CAAC;MAEtH,YAAY,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;MACxE,IAAI,CAAC,oBAAoB,EAAE,CAAC;MAC5B,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;MAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgPanel } from '../mg-panel';\n\nimport { MgButton } from '../../../atoms/mg-button/mg-button';\nimport { MgInputText } from '../../inputs/mg-input-text/mg-input-text';\nimport { expandToggleDisplays, titlePositions } from '../mg-panel.conf';\n\nconst getPage = (args, slot?) => {\n const page = newSpecPage({\n components: [MgPanel, MgButton, MgInputText],\n template: () => <mg-panel {...args}>{slot}</mg-panel>,\n });\n jest.runAllTimers();\n\n return page;\n};\n\ndescribe('mg-panel', () => {\n beforeAll(() => (global.HTMLInputElement.prototype.focus = jest.fn()));\n afterAll(() => delete global.HTMLInputElement.prototype.focus);\n\n beforeEach(() => jest.useFakeTimers());\n afterEach(() => jest.runOnlyPendingTimers());\n\n test.each([\n { identifier: 'identifier', panelTitle: 'panel title' },\n { identifier: 'identifier', panelTitle: 'panel title', expanded: true },\n { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true },\n { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, titlePattern: /joker/, titlePatternErrorMessage: \"You can't enter a bad guy !\" },\n { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, lang: 'fr' },\n { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, lang: 'xx' },\n ...titlePositions.map(titlePosition => ({ identifier: 'identifier', panelTitle: 'panel title', titlePosition })),\n ...expandToggleDisplays.map(expandToggleDisplay => ({ identifier: 'identifier', panelTitle: 'panel title', expandToggleDisplay })),\n ...expandToggleDisplays.map(expandToggleDisplay => ({ identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, expandToggleDisplay })),\n ])('Should render with args %s:', async args => {\n const { root } = await getPage(args);\n expect(root).toMatchSnapshot();\n });\n\n describe('errors', () => {\n test('Should throw error when props association are unauthorized %s:', async () => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', panelTitle: 'panel title', titlePattern: /joker/ });\n } catch (err) {\n expect(err.message).toBe('<mg-panel> prop \"titleEditable\" must be set to \"true\".');\n }\n });\n\n test.each(['', ' ', undefined])('Should not render with invalid panelTitle property: %s', async panelTitle => {\n expect.assertions(1);\n try {\n await getPage({ panelTitle });\n } catch (err) {\n expect(err.message).toMatch('<mg-panel> prop \"panelTitle\" is required.');\n }\n });\n\n test.each(['', ' ', 'batman'].map(titlePosition => ({ panelTitle: 'panel title', titlePosition })))(\n 'Should throw an error when prop \"titlePosition\" is invalid',\n async props => {\n try {\n await getPage(props);\n } catch (err) {\n expect(err.message).toMatch(`<mg-panel> prop \"titlePosition\" must be one of: ${titlePositions.join(', ')}.`);\n }\n },\n );\n\n test.each(['', ' ', 'batman'].map(expandToggleDisplay => ({ panelTitle: 'panel title', expandToggleDisplay })))(\n 'Should throw an error when prop \"expandToggleDisplay\" is invalid',\n async props => {\n try {\n await getPage(props);\n } catch (err) {\n expect(err.message).toMatch(`<mg-panel> prop \"expandToggleDisplay\" must be one of: ${expandToggleDisplays.join(', ')}.`);\n }\n },\n );\n });\n\n describe('navigation', () => {\n test.each([true, false])('Should toggle collapse panel, expanded %s', async expanded => {\n const page = await getPage({ identifier: 'identifier', panelTitle: 'panel title', expanded });\n const mgPanel = page.doc.querySelector('mg-panel');\n const collapseButton = mgPanel.shadowRoot.querySelector('mg-button:first-of-type');\n\n const spy = jest.spyOn(page.rootInstance.expandedChange, 'emit');\n\n expect(page.root).toMatchSnapshot();\n\n collapseButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n collapseButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n expect(spy).toBeCalledTimes(2);\n });\n\n test.each([true, false])('Should NOT collapse panel, case expandToggleDisabled = true', async expanded => {\n const page = await getPage({ identifier: 'identifier', panelTitle: 'panel title', expanded, expandToggleDisabled: true });\n const mgPanel = page.doc.querySelector('mg-panel');\n const collapseButton = mgPanel.shadowRoot.querySelector('mg-button:first-of-type');\n\n expect(page.root).toMatchSnapshot();\n\n collapseButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([true, false])('Should toggle edit panel title', async titleEditable => {\n const page = await getPage({ identifier: 'identifier', panelTitle: 'panel title', titleEditable });\n const mgPanel = page.doc.querySelector('mg-panel');\n const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');\n\n expect(page.root).toMatchSnapshot();\n\n if (titleEditable) {\n editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n jest.runOnlyPendingTimers();\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n }\n });\n\n test.each(['first-of-type', 'last-of-type'])('should update panel title, case %s', async lastAction => {\n const updatedPanelTitle = 'Updated panel title';\n const args = { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true };\n const page = await getPage(args);\n const mgPanel = page.doc.querySelector('mg-panel');\n const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');\n\n expect(page.root).toMatchSnapshot();\n\n jest.spyOn(page.rootInstance.titleChange, 'emit');\n\n editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n const mgInputText = mgPanel.shadowRoot.querySelector('mg-input-text');\n const input = mgInputText.shadowRoot.querySelector('input');\n\n input.value = updatedPanelTitle;\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n const afterInputAction = mgPanel.shadowRoot.querySelector(`.mg-panel__header-title mg-input-text mg-button:${lastAction}`);\n\n afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n jest.runOnlyPendingTimers();\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n if (lastAction === 'last-of-type') {\n expect(mgPanel.panelTitle).toBe(updatedPanelTitle);\n expect(page.rootInstance.titleChange.emit).toHaveBeenCalledWith(updatedPanelTitle);\n } else {\n expect(mgPanel.panelTitle).toBe(args.panelTitle);\n expect(page.rootInstance.titleChange.emit).not.toHaveBeenCalled();\n }\n });\n\n test('should NOT update panel title, case no enter in input', async () => {\n const updatedPanelTitle = 'Updated panel title';\n const args = { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true };\n const page = await getPage(args);\n const mgPanel = page.doc.querySelector('mg-panel');\n const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');\n\n expect(page.root).toMatchSnapshot();\n\n jest.spyOn(page.rootInstance.titleChange, 'emit');\n\n editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n const mgInputText = mgPanel.shadowRoot.querySelector('mg-input-text');\n const input = mgInputText.shadowRoot.querySelector('input');\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n const afterInputAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');\n\n afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n jest.runOnlyPendingTimers();\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n expect(mgPanel.panelTitle).toBe(args.panelTitle);\n expect(page.rootInstance.titleChange.emit).not.toHaveBeenCalledWith(updatedPanelTitle);\n });\n\n test('Should NOT update panel title, case input new value does NOT match pattern', async () => {\n const updatedPanelTitle = 'joker';\n const args = {\n identifier: 'identifier',\n panelTitle: 'panel title',\n titleEditable: true,\n titlePattern: '^(?!(joker)$)[a-z A-Z0-9s]+$',\n titlePatternErrorMessage: \"You can't enter a bad guy !\",\n };\n const page = await getPage(args);\n const mgPanel = page.doc.querySelector('mg-panel');\n const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');\n\n expect(page.root).toMatchSnapshot();\n\n jest.spyOn(page.rootInstance.titleChange, 'emit');\n\n // first switch to title edition\n editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n const mgInputText = mgPanel.shadowRoot.querySelector('mg-input-text');\n const input = mgInputText.shadowRoot.querySelector('input');\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n patternMismatch: false,\n })),\n });\n\n // second update title with a falsy update title\n input.value = updatedPanelTitle;\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n // and click on validate button\n const afterInputAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');\n\n afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n jest.runOnlyPendingTimers();\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n expect(mgPanel.panelTitle).toBe(args.panelTitle);\n expect(page.rootInstance.titleChange.emit).not.toHaveBeenCalledWith(updatedPanelTitle);\n\n // finaly return to default view by clicking on cancel button\n const cancelAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');\n\n cancelAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n jest.runOnlyPendingTimers();\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n });\n});\n"]}
@@ -1,6 +1,6 @@
1
- import { Host, h } from '@stencil/core';
2
- import { isTagName, ClassList } from '../../../../utils/components.utils';
3
- import { initLocales } from '../../../../locales';
1
+ import { Host, h } from "@stencil/core";
2
+ import { isTagName, ClassList } from "../../../../utils/components.utils";
3
+ import { initLocales } from "../../../../locales";
4
4
  export class MgPopoverContent {
5
5
  constructor() {
6
6
  /**
@@ -98,3 +98,4 @@ export class MgPopoverContent {
98
98
  }
99
99
  static get elementRef() { return "element"; }
100
100
  }
101
+ //# sourceMappingURL=mg-popover-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-popover-content.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-popover/mg-popover-content/mg-popover-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,e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AAC,2BAA2B;UACpC,YAAM,IAAI,EAAC,OAAO,GAAQ,CACtB;QACN,YAAM,IAAI,EAAC,SAAS,GAAQ,CACpB;MACV,YAAM,IAAI,EAAC,OAAO,GAAQ,CACrB,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, h, Prop, EventEmitter, Event, State } from '@stencil/core';\nimport { isTagName, ClassList } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\n\n@Component({\n tag: 'mg-popover-content',\n styleUrl: 'mg-popover-content.scss',\n shadow: true,\n})\nexport class MgPopoverContent {\n /************\n * Internal *\n ************/\n\n // Locales\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPopoverContentElement;\n\n /**\n * Define if popover has a cross button\n */\n @Prop() closeButton = false;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-popover-content']);\n\n /**\n * Emited event when close button is clicked\n */\n @Event({ eventName: 'hide-content' }) hideContent: EventEmitter<string>;\n\n /**\n * Handle action for close button\n */\n private handleCloseButton = (): void => {\n this.hideContent.emit();\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are valide\n */\n componentWillLoad(): void {\n // Get locales\n this.messages = initLocales(this.element).messages;\n }\n\n /**\n * Check if component slots are valide\n */\n componentDidLoad(): void {\n const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\n\n const slottedTitleElement = this.element.querySelector('[slot=\"title\"]');\n if (slottedTitleElement && !isTagName(slottedTitleElement, headingTags)) {\n throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);\n }\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <mg-card class={this.classCollection.join()}>\n {this.closeButton && (\n <mg-button is-icon variant=\"flat\" label={this.messages.general.close} onClick={this.handleCloseButton}>\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n )}\n <div class=\"mg-popover-content__title\">\n <slot name=\"title\"></slot>\n </div>\n <slot name=\"content\"></slot>\n </mg-card>\n <slot name=\"arrow\"></slot>\n </Host>\n );\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { Host, h } from '@stencil/core';
2
- import { createID, getWindows } from '../../../utils/components.utils';
3
- import { createPopper } from '@popperjs/core';
1
+ import { Host, h } from "@stencil/core";
2
+ import { createID, getWindows } from "../../../utils/components.utils";
3
+ import { createPopper } from "@popperjs/core";
4
4
  export class MgPopover {
5
5
  constructor() {
6
6
  /**
@@ -52,21 +52,27 @@ export class MgPopover {
52
52
  * Render popover content element
53
53
  */
54
54
  this.renderPopoverContent = () => {
55
- this.mgPopoverContent = document.createElement('mg-popover-content');
56
- this.mgPopoverContent.setAttribute('slot', 'content');
57
- this.mgPopoverContent.setAttribute('id', this.identifier);
58
- this.mgPopoverContent.addEventListener('hide-content', this.handleHideContent);
59
- const arrow = document.createElement('div');
60
- arrow.setAttribute('slot', 'arrow');
61
- arrow.dataset.popperArrow = '';
62
- this.mgPopoverContent.appendChild(arrow);
63
- // insert elements in DOM
64
- ['[slot="title"]', '[slot="content"]:not(mg-popover-content)'].forEach(slotType => {
65
- Array.from(this.element.querySelectorAll(slotType)).forEach(slot => {
66
- this.mgPopoverContent.appendChild(slot);
55
+ const mgPopoverContent = this.element.querySelector('mg-popover-content');
56
+ if (mgPopoverContent === null) {
57
+ this.mgPopoverContent = document.createElement('mg-popover-content');
58
+ this.mgPopoverContent.setAttribute('slot', 'content');
59
+ this.mgPopoverContent.setAttribute('id', this.identifier);
60
+ this.mgPopoverContent.addEventListener('hide-content', this.handleHideContent);
61
+ const arrow = document.createElement('div');
62
+ arrow.setAttribute('slot', 'arrow');
63
+ arrow.dataset.popperArrow = '';
64
+ this.mgPopoverContent.appendChild(arrow);
65
+ // insert elements in DOM
66
+ ['[slot="title"]', '[slot="content"]:not(mg-popover-content)'].forEach(slotType => {
67
+ Array.from(this.element.querySelectorAll(slotType)).forEach(slot => {
68
+ this.mgPopoverContent.appendChild(slot);
69
+ });
67
70
  });
68
- });
69
- this.element.appendChild(this.mgPopoverContent);
71
+ this.element.appendChild(this.mgPopoverContent);
72
+ }
73
+ else {
74
+ mgPopoverContent.setAttribute('id', this.identifier);
75
+ }
70
76
  };
71
77
  this.identifier = createID('mg-popover');
72
78
  this.placement = 'bottom';
@@ -75,6 +81,10 @@ export class MgPopover {
75
81
  this.display = false;
76
82
  this.disabled = false;
77
83
  }
84
+ validateIdentifier() {
85
+ // use renderPopoverContent to update popover-content id
86
+ this.renderPopoverContent();
87
+ }
78
88
  validateArrowHide(newValue) {
79
89
  if (newValue)
80
90
  this.mgPopoverContent.dataset.arrowHide = '';
@@ -111,6 +121,7 @@ export class MgPopover {
111
121
  // render mg-popover-content slot
112
122
  this.renderPopoverContent();
113
123
  this.validateCloseButton(this.closeButton);
124
+ this.validateIdentifier();
114
125
  this.validateArrowHide(this.arrowHide);
115
126
  }
116
127
  /**
@@ -135,6 +146,12 @@ export class MgPopover {
135
146
  offset: [0, 0],
136
147
  },
137
148
  },
149
+ {
150
+ name: 'flip',
151
+ options: {
152
+ fallbackPlacements: ['auto'],
153
+ },
154
+ },
138
155
  ],
139
156
  });
140
157
  // add resize observer
@@ -203,7 +220,8 @@ export class MgPopover {
203
220
  "references": {
204
221
  "Placement": {
205
222
  "location": "import",
206
- "path": "@popperjs/core"
223
+ "path": "@popperjs/core",
224
+ "id": "../../node_modules/.pnpm/@popperjs+core@2.11.7/node_modules/@popperjs/core/index.d.ts::Placement"
207
225
  }
208
226
  }
209
227
  },
@@ -312,6 +330,9 @@ export class MgPopover {
312
330
  static get elementRef() { return "element"; }
313
331
  static get watchers() {
314
332
  return [{
333
+ "propName": "identifier",
334
+ "methodName": "validateIdentifier"
335
+ }, {
315
336
  "propName": "arrowHide",
316
337
  "methodName": "validateArrowHide"
317
338
  }, {
@@ -323,3 +344,4 @@ export class MgPopover {
323
344
  }];
324
345
  }
325
346
  }
347
+ //# sourceMappingURL=mg-popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-popover.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-popover/mg-popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAA8B,YAAY,EAAa,MAAM,gBAAgB,CAAC;AAOrF,MAAM,OAAO,SAAS;;IA8EpB;;;OAGG;IACK,iBAAY,GAAG,CAAC,KAA2C,EAAQ,EAAE;MAC3E,MAAM,cAAc,GAAgB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;MACpF,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,OAAO,IAAI,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAC,cAAc,MAAK,IAAI,CAAC,UAAU,EAAE;QACvI,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;OACtB;IACH,CAAC,CAAC;IAEF;;OAEG;IACK,SAAI,GAAG,GAAS,EAAE;MACxB,2BAA2B;MAC3B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC;MACjC,6BAA6B;MAC7B,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,iCAC7B,OAAO,KACV,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAC5E,CAAC,CAAC;MACJ,0B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AO,CACL,EAAC,IAAI;MACH,eAAa;MACb,YAAM,IAAI,EAAC,SAAS,GAAQ,CACvB,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, h, Prop, Watch, EventEmitter, Event } from '@stencil/core';\nimport { createID, getWindows } from '../../../utils/components.utils';\nimport { Instance as PopperInstance, createPopper, Placement } from '@popperjs/core';\n\n@Component({\n tag: 'mg-popover',\n styleUrl: 'mg-popover.scss',\n shadow: true,\n})\nexport class MgPopover {\n /************\n * Internal *\n ************/\n\n private popper: PopperInstance;\n private mgPopover: HTMLElement;\n private mgPopoverContent: HTMLMgPopoverContentElement;\n private windows: Window[];\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPopoverElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-popover');\n @Watch('identifier')\n validateIdentifier(): void {\n // use renderPopoverContent to update popover-content id\n this.renderPopoverContent();\n }\n\n /**\n * Popover placement\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Hide popover arrow\n */\n @Prop() arrowHide = false;\n @Watch('arrowHide')\n validateArrowHide(newValue: MgPopover['arrowHide']): void {\n if (newValue) this.mgPopoverContent.dataset.arrowHide = '';\n else delete this.mgPopoverContent.dataset.arrowHide;\n }\n\n /**\n * Define if popover has a cross button\n */\n @Prop() closeButton = false;\n @Watch('closeButton')\n validateCloseButton(newValue: MgPopover['arrowHide']): void {\n this.mgPopoverContent.closeButton = newValue;\n }\n\n /**\n * Display popover\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n handleDisplay(newValue: boolean): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n this.displayChange.emit(newValue);\n }\n\n /**\n * Disable popover\n */\n @Prop() disabled = false;\n\n /**\n * Emited event when display value change\n */\n @Event({ eventName: 'display-change' }) displayChange: EventEmitter<boolean>;\n\n /**\n * Check if clicked outside of component\n * @param event - mouse event\n */\n private clickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n const closestElement: HTMLElement = event.target.closest(`[data-mg-popover-guard]`);\n if (!this.disabled && event.target.closest('mg-popover') !== this.element && closestElement?.dataset.mgPopoverGuard !== this.identifier) {\n this.display = false;\n }\n };\n\n /**\n * Show popover\n */\n private show = (): void => {\n // Make the popover visible\n this.mgPopover.dataset.show = '';\n // Enable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }],\n }));\n // hide when click outside\n // setTimeout is used to prevent event to trigger after creation\n setTimeout(() => {\n this.windows.forEach((localWindow: Window) => {\n localWindow.addEventListener('click', this.clickOutside, false);\n });\n }, 0);\n };\n\n /**\n * Hide popover\n */\n private hide = (): void => {\n // Hide the popover\n this.mgPopover.removeAttribute('data-show');\n // Disable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }],\n }));\n // Remove event listener\n this.windows.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.clickOutside, false);\n });\n };\n\n /**\n * Handle content hide event\n */\n private handleHideContent = (): void => {\n this.display = false;\n };\n\n /**\n * Render popover content element\n */\n private renderPopoverContent = (): void => {\n const mgPopoverContent = this.element.querySelector('mg-popover-content');\n if (mgPopoverContent === null) {\n this.mgPopoverContent = document.createElement('mg-popover-content');\n this.mgPopoverContent.setAttribute('slot', 'content');\n this.mgPopoverContent.setAttribute('id', this.identifier);\n this.mgPopoverContent.addEventListener('hide-content', this.handleHideContent);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.popperArrow = '';\n this.mgPopoverContent.appendChild(arrow);\n\n // insert elements in DOM\n ['[slot=\"title\"]', '[slot=\"content\"]:not(mg-popover-content)'].forEach(slotType => {\n Array.from(this.element.querySelectorAll(slotType)).forEach(slot => {\n this.mgPopoverContent.appendChild(slot);\n });\n });\n this.element.appendChild(this.mgPopoverContent);\n } else {\n mgPopoverContent.setAttribute('id', this.identifier);\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.popper.update();\n }\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n // render mg-popover-content slot\n this.renderPopoverContent();\n this.validateCloseButton(this.closeButton);\n this.validateIdentifier();\n this.validateArrowHide(this.arrowHide);\n }\n\n /**\n * Check if component props are well configured on init\n */\n componentDidLoad(): void {\n // Get popover content\n this.mgPopover = this.element.querySelector(`#${this.identifier}`);\n\n //Get interactive element (first element without slot attribute)\n const interactiveElement: HTMLElement = this.element.querySelector(':not([slot])');\n // Add aria attributes\n interactiveElement.setAttribute('aria-controls', this.identifier);\n interactiveElement.setAttribute('aria-expanded', `${this.display}`);\n\n // Create popperjs popover\n this.popper = createPopper(interactiveElement, this.mgPopover, {\n placement: this.placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 0],\n },\n },\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['auto'],\n },\n },\n ],\n });\n\n // add resize observer\n new ResizeObserver(() => {\n this.popper.update();\n }).observe(this.element.querySelector('mg-popover-content'));\n\n // Add events to toggle display\n interactiveElement.addEventListener('click', () => {\n if (!this.disabled) this.display = !this.display;\n });\n\n // Add events to hide popover\n this.element.addEventListener('keydown', e => {\n if (!this.disabled && e.code === 'Escape') {\n this.display = false;\n interactiveElement.focus();\n }\n });\n\n this.handleDisplay(this.display);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"]}
@@ -0,0 +1,159 @@
1
+ import { createPage } from "../../../../utils/stencil.e2e.test.utils";
2
+ import { renderAttributes } from "../../../../utils/e2e.test.utils";
3
+ describe('mg-popover', () => {
4
+ describe.each([
5
+ 'auto',
6
+ 'auto-start',
7
+ 'auto-end',
8
+ 'top',
9
+ 'top-start',
10
+ 'top-end',
11
+ 'bottom',
12
+ 'bottom-start',
13
+ 'bottom-end',
14
+ 'right',
15
+ 'right-start',
16
+ 'right-end',
17
+ 'left',
18
+ 'left-start',
19
+ 'left-end',
20
+ ])('placement %s', placement => {
21
+ test.each([true, false])('Should render, case hide arrow %s', async (arrowHide) => {
22
+ const page = await createPage(`<style>mg-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>
23
+ <mg-popover ${renderAttributes({ placement, arrowHide })}>
24
+ <mg-button>Button</mg-button>
25
+ <h2 slot="title">Blu bli blo bla</h2>
26
+ <p slot="content">
27
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
28
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
29
+ quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
30
+ consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
31
+ cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
32
+ non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
33
+ </p>
34
+ </mg-popover>`);
35
+ const mgPopover = await page.find('mg-popover');
36
+ const mgButton = await page.find('mg-button');
37
+ const popover = await page.find('mg-popover mg-popover-content');
38
+ expect(mgPopover).toHaveClass('hydrated');
39
+ // display popover on click on slotted element
40
+ mgButton.triggerEvent('click');
41
+ await page.waitForChanges();
42
+ await page.waitForNetworkIdle();
43
+ expect(popover).toHaveAttribute('data-show');
44
+ await page.setViewport({ width: 1200, height: 1200 });
45
+ const screenshot = await page.screenshot();
46
+ expect(screenshot).toMatchImageSnapshot();
47
+ // hide popover on click on slotted element
48
+ mgButton.triggerEvent('click');
49
+ await page.waitForChanges();
50
+ await page.waitForNetworkIdle();
51
+ expect(popover).not.toHaveAttribute('data-show');
52
+ // display popover on keyboad click event on slotted element
53
+ await page.keyboard.down('Tab');
54
+ await page.keyboard.down('Enter');
55
+ await page.waitForChanges();
56
+ await page.waitForNetworkIdle();
57
+ expect(popover).toHaveAttribute('data-show');
58
+ // hide popover on keyboad escape key
59
+ await page.keyboard.down('Escape');
60
+ await page.waitForChanges();
61
+ await page.waitForNetworkIdle();
62
+ expect(popover).not.toHaveAttribute('data-show');
63
+ });
64
+ });
65
+ describe.each([
66
+ '',
67
+ '<h2 slot="title">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>',
68
+ ])('with or without title', title => {
69
+ test('Should render with close button', async () => {
70
+ const page = await createPage(`<mg-popover display close-button>
71
+ <mg-button>Button</mg-button>
72
+ ${title}
73
+ <p slot="content">
74
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
75
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
76
+ quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
77
+ consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
78
+ cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
79
+ non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
80
+ </p>
81
+ </mg-popover>`);
82
+ const mgPopover = await page.find('mg-popover');
83
+ expect(mgPopover).toHaveClass('hydrated');
84
+ await page.setViewport({ width: 500, height: 350 });
85
+ const screenshot = await page.screenshot();
86
+ expect(screenshot).toMatchImageSnapshot();
87
+ });
88
+ });
89
+ describe.each(['title', 'content'])('re-position %s slot', slot => {
90
+ test('should re-position when slot size change', async () => {
91
+ const tagName = slot === 'title' ? 'h2' : 'p';
92
+ const page = await createPage(`<style>mg-button{position:fixed;left:50%;transform:translateX(-50%)}</style>
93
+ <mg-popover ${renderAttributes({ placement: 'bottom-start', display: true })}>
94
+ <mg-button>Button</mg-button>
95
+ <${tagName} slot="${slot}">
96
+ Lorem ipsum
97
+ </${tagName}>
98
+ </mg-popover>`, { width: 400, height: 130 });
99
+ let screenshot = await page.screenshot();
100
+ expect(screenshot).toMatchImageSnapshot();
101
+ await page.$eval(`mg-popover-content [slot="${slot}"]`, el => {
102
+ el.textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
103
+ });
104
+ await page.waitForChanges();
105
+ screenshot = await page.screenshot();
106
+ expect(screenshot).toMatchImageSnapshot();
107
+ });
108
+ });
109
+ test(`should position popover where it have enough place`, async () => {
110
+ const page = await createPage(`<style>mg-button{position:fixed;left:0;bottom:0}</style>
111
+ <mg-popover ${renderAttributes({ display: true })}>
112
+ <mg-button>Button</mg-button>
113
+ <p slot="content">
114
+ Lorem ipsum
115
+ </p>
116
+ </mg-popover>`, { width: 400, height: 100 });
117
+ const screenshot = await page.screenshot();
118
+ expect(screenshot).toMatchImageSnapshot();
119
+ });
120
+ describe('style', () => {
121
+ test('Should render with child mg-card', async () => {
122
+ const page = await createPage(`<mg-popover display close-button class="custom-popover-card">
123
+ <mg-button>Button</mg-button>
124
+ <mg-card slot="content">
125
+ My custom card
126
+ </mg-card>
127
+ </mg-popover>
128
+ <style>
129
+ .custom-popover-card {
130
+ --mg-popover-background-color: var(--color-danger);
131
+ }
132
+ </style>
133
+ `);
134
+ const mgPopover = await page.find('mg-popover');
135
+ expect(mgPopover).toHaveClass('hydrated');
136
+ await page.setViewport({ width: 500, height: 300 });
137
+ const screenshot = await page.screenshot();
138
+ expect(screenshot).toMatchImageSnapshot();
139
+ });
140
+ test.each(['content', 'title'])('Should render with --mg-popover-max-width', async (slot) => {
141
+ const page = await createPage(`<mg-popover display close-button class="custom-popover">
142
+ <mg-button>Button</mg-button>
143
+ <h2 slot="${slot}">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>
144
+ </mg-popover>
145
+ <style>
146
+ .custom-popover {
147
+ --mg-popover-max-width: 10rem;
148
+ }
149
+ </style>
150
+ `);
151
+ const mgPopover = await page.find('mg-popover');
152
+ expect(mgPopover).toHaveClass('hydrated');
153
+ await page.setViewport({ width: 500, height: 300 });
154
+ const screenshot = await page.screenshot();
155
+ expect(screenshot).toMatchImageSnapshot();
156
+ });
157
+ });
158
+ });
159
+ //# sourceMappingURL=mg-popover.e2e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-popover.e2e.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-popover/test/mg-popover.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,QAAQ,CAAC,IAAI,CAAC;IACZ,MAAM;IACN,YAAY;IACZ,UAAU;IACV,KAAK;IACL,WAAW;IACX,SAAS;IACT,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,OAAO;IACP,aAAa;IACb,WAAW;IACX,MAAM;IACN,YAAY;IACZ,UAAU;GACX,CAAC,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE;IAC7B,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,mCAAmC,EAAE,KAAK,EAAC,SAAS,EAAC,EAAE;MAC9E,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B;sBACc,gBAAgB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;;;;;;;;;;;sBAW1C,CACf,CAAC;MAEF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;MAChD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAA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AM,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;MAE1C,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;MAEpD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;MAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,2CAA2C,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;MACxF,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B;;oBAEY,IAAI;;;;;;;SAOf,CACF,CAAC;MAEF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;MAEhD,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;MAE1C,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;MAEpD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;MAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { createPage } from '../../../../utils/stencil.e2e.test.utils';\nimport { renderAttributes } from '../../../../utils/e2e.test.utils';\n\ndescribe('mg-popover', () => {\n describe.each([\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'top-start',\n 'top-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'right',\n 'right-start',\n 'right-end',\n 'left',\n 'left-start',\n 'left-end',\n ])('placement %s', placement => {\n test.each([true, false])('Should render, case hide arrow %s', async arrowHide => {\n const page = await createPage(\n `<style>mg-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>\n <mg-popover ${renderAttributes({ placement, arrowHide })}>\n <mg-button>Button</mg-button>\n <h2 slot=\"title\">Blu bli blo bla</h2>\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n </mg-popover>`,\n );\n\n const mgPopover = await page.find('mg-popover');\n const mgButton = await page.find('mg-button');\n const popover = await page.find('mg-popover mg-popover-content');\n\n expect(mgPopover).toHaveClass('hydrated');\n\n // display popover on click on slotted element\n mgButton.triggerEvent('click');\n await page.waitForChanges();\n await page.waitForNetworkIdle();\n\n expect(popover).toHaveAttribute('data-show');\n\n await page.setViewport({ width: 1200, height: 1200 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n // hide popover on click on slotted element\n mgButton.triggerEvent('click');\n await page.waitForChanges();\n await page.waitForNetworkIdle();\n\n expect(popover).not.toHaveAttribute('data-show');\n\n // display popover on keyboad click event on slotted element\n await page.keyboard.down('Tab');\n await page.keyboard.down('Enter');\n await page.waitForChanges();\n await page.waitForNetworkIdle();\n\n expect(popover).toHaveAttribute('data-show');\n\n // hide popover on keyboad escape key\n await page.keyboard.down('Escape');\n await page.waitForChanges();\n await page.waitForNetworkIdle();\n\n expect(popover).not.toHaveAttribute('data-show');\n });\n });\n\n describe.each([\n '',\n '<h2 slot=\"title\">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>',\n ])('with or without title', title => {\n test('Should render with close button', async () => {\n const page = await createPage(\n `<mg-popover display close-button>\n <mg-button>Button</mg-button>\n ${title}\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n </mg-popover>`,\n );\n\n const mgPopover = await page.find('mg-popover');\n\n expect(mgPopover).toHaveClass('hydrated');\n\n await page.setViewport({ width: 500, height: 350 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n });\n\n describe.each(['title', 'content'])('re-position %s slot', slot => {\n test('should re-position when slot size change', async () => {\n const tagName = slot === 'title' ? 'h2' : 'p';\n const page = await createPage(\n `<style>mg-button{position:fixed;left:50%;transform:translateX(-50%)}</style>\n <mg-popover ${renderAttributes({ placement: 'bottom-start', display: true })}>\n <mg-button>Button</mg-button>\n <${tagName} slot=\"${slot}\">\n Lorem ipsum\n </${tagName}>\n </mg-popover>`,\n { width: 400, height: 130 },\n );\n\n let screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.$eval(`mg-popover-content [slot=\"${slot}\"]`, el => {\n el.textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';\n });\n\n await page.waitForChanges();\n\n screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n });\n\n test(`should position popover where it have enough place`, async () => {\n const page = await createPage(\n `<style>mg-button{position:fixed;left:0;bottom:0}</style>\n <mg-popover ${renderAttributes({ display: true })}>\n <mg-button>Button</mg-button>\n <p slot=\"content\">\n Lorem ipsum\n </p>\n </mg-popover>`,\n { width: 400, height: 100 },\n );\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n describe('style', () => {\n test('Should render with child mg-card', async () => {\n const page = await createPage(\n `<mg-popover display close-button class=\"custom-popover-card\">\n <mg-button>Button</mg-button>\n <mg-card slot=\"content\">\n My custom card\n </mg-card>\n </mg-popover>\n <style>\n .custom-popover-card {\n --mg-popover-background-color: var(--color-danger);\n }\n </style>\n `,\n );\n\n const mgPopover = await page.find('mg-popover');\n\n expect(mgPopover).toHaveClass('hydrated');\n\n await page.setViewport({ width: 500, height: 300 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test.each(['content', 'title'])('Should render with --mg-popover-max-width', async slot => {\n const page = await createPage(\n `<mg-popover display close-button class=\"custom-popover\">\n <mg-button>Button</mg-button>\n <h2 slot=\"${slot}\">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>\n </mg-popover>\n <style>\n .custom-popover {\n --mg-popover-max-width: 10rem;\n }\n </style>\n `,\n );\n\n const mgPopover = await page.find('mg-popover');\n\n expect(mgPopover).toHaveClass('hydrated');\n\n await page.setViewport({ width: 500, height: 300 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n });\n});\n"]}