@mgdis/mg-components 5.17.0 → 5.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/dist/cjs/{mg-menu.conf-43aacf30.js → components.utils-dc9c8a53.js} +160 -7
  2. package/dist/cjs/components.utils-dc9c8a53.js.map +1 -0
  3. package/dist/cjs/index-c042e24b.js +18 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/mg-action-more_34.cjs.entry.js +761 -582
  6. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  7. package/dist/cjs/mg-components.cjs.js +1 -1
  8. package/dist/cjs/mg-item-more.cjs.entry.js +5 -5
  9. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -9
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  12. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +5 -5
  13. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +1 -1
  14. package/dist/collection/components/atoms/mg-button/mg-button.js +12 -12
  15. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  16. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +4 -4
  17. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -1
  18. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +3 -3
  19. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -1
  20. package/dist/collection/components/atoms/mg-card/mg-card.js +9 -9
  21. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  22. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +3 -3
  23. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  24. package/dist/collection/components/atoms/mg-divider/mg-divider.js +4 -4
  25. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.js +13 -15
  27. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  28. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +4 -4
  29. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +1 -1
  30. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +5 -4
  31. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-tag/mg-tag.js +9 -9
  33. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  34. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +23 -0
  35. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +1 -0
  36. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +5 -5
  37. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +1 -1
  38. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
  39. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  40. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +37 -17
  41. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  42. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +7 -1
  43. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -1
  44. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +9 -1
  45. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/MgInput.js +12 -11
  47. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +4 -4
  49. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
  51. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  53. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +111 -38
  54. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  55. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +21 -27
  56. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +1 -1
  57. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +62 -6
  58. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +84 -13
  60. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  61. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +55 -0
  62. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -1
  63. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +115 -44
  64. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  65. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +55 -0
  66. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -1
  67. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +88 -15
  68. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  69. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +55 -0
  70. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -1
  71. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +87 -14
  72. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  73. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +1 -1
  74. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +1 -1
  75. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +60 -0
  76. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -1
  77. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +87 -14
  78. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  79. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +55 -0
  80. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -1
  81. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +5 -0
  82. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -0
  83. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +151 -34
  84. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  85. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +147 -0
  86. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +1 -0
  87. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +80 -7
  88. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
  89. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +110 -36
  90. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  91. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +69 -6
  92. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
  93. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -9
  94. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  95. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +2 -2
  96. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -1
  97. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +2 -2
  98. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  99. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +8 -9
  100. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  101. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +6 -6
  102. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  103. package/dist/collection/components/molecules/mg-details/mg-details.js +5 -4
  104. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  105. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +1 -1
  106. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +1 -1
  107. package/dist/collection/components/molecules/mg-form/mg-form.js +6 -6
  108. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  109. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +4 -4
  110. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -1
  111. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +7 -7
  112. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  113. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +5 -4
  114. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  115. package/dist/collection/components/molecules/mg-message/mg-message.js +8 -8
  116. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  117. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +11 -11
  118. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +1 -1
  119. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
  120. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  121. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +7 -7
  122. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -1
  123. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +3 -3
  124. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +1 -1
  125. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +1 -1
  126. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +1 -1
  127. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +3 -3
  128. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  129. package/dist/collection/components/molecules/mg-panel/mg-panel.js +17 -15
  130. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  131. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +3 -3
  132. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
  133. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +11 -21
  134. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -1
  135. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -4
  136. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  137. package/dist/collection/components/molecules/mg-popover/mg-popover.js +36 -16
  138. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  139. package/dist/collection/components/molecules/mg-popover/test/{mg-popover.e2e.js → mg-popover.e2e.playwright.js} +54 -62
  140. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +1 -0
  141. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +12 -0
  142. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +1 -1
  143. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -6
  144. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  145. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +34 -34
  146. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  147. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +13 -13
  148. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +1 -1
  149. package/dist/collection/locales/en/messages.json +3 -3
  150. package/dist/collection/locales/fr/messages.json +3 -3
  151. package/dist/collection/utils/components.utils.js +16 -0
  152. package/dist/collection/utils/components.utils.js.map +1 -1
  153. package/dist/collection/utils/components.utils.spec.js +22 -1
  154. package/dist/collection/utils/components.utils.spec.js.map +1 -1
  155. package/dist/collection/variables.css +1 -275
  156. package/dist/components/MgInput.js +17 -16
  157. package/dist/components/MgInput.js.map +1 -1
  158. package/dist/components/components.utils.js +17 -1
  159. package/dist/components/components.utils.js.map +1 -1
  160. package/dist/components/index2.js +6 -6
  161. package/dist/components/mg-action-more.js +5 -5
  162. package/dist/components/mg-action-more.js.map +1 -1
  163. package/dist/components/mg-badge2.js +8 -8
  164. package/dist/components/mg-badge2.js.map +1 -1
  165. package/dist/components/mg-button2.js +11 -11
  166. package/dist/components/mg-button2.js.map +1 -1
  167. package/dist/components/mg-card2.js +8 -8
  168. package/dist/components/mg-card2.js.map +1 -1
  169. package/dist/components/mg-character-left2.js +1 -1
  170. package/dist/components/mg-character-left2.js.map +1 -1
  171. package/dist/components/mg-details.js +4 -3
  172. package/dist/components/mg-details.js.map +1 -1
  173. package/dist/components/mg-divider.js +3 -3
  174. package/dist/components/mg-divider.js.map +1 -1
  175. package/dist/components/mg-form.js +4 -4
  176. package/dist/components/mg-form.js.map +1 -1
  177. package/dist/components/mg-icon2.js +12 -14
  178. package/dist/components/mg-icon2.js.map +1 -1
  179. package/dist/components/mg-illustrated-message.js +7 -7
  180. package/dist/components/mg-illustrated-message.js.map +1 -1
  181. package/dist/components/mg-input-checkbox-paginated2.js +8 -8
  182. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  183. package/dist/components/mg-input-checkbox.js +70 -34
  184. package/dist/components/mg-input-checkbox.js.map +1 -1
  185. package/dist/components/mg-input-date.js +45 -12
  186. package/dist/components/mg-input-date.js.map +1 -1
  187. package/dist/components/mg-input-numeric.js +76 -43
  188. package/dist/components/mg-input-numeric.js.map +1 -1
  189. package/dist/components/mg-input-password.js +49 -14
  190. package/dist/components/mg-input-password.js.map +1 -1
  191. package/dist/components/mg-input-radio.js +48 -13
  192. package/dist/components/mg-input-radio.js.map +1 -1
  193. package/dist/components/mg-input-select2.js +48 -13
  194. package/dist/components/mg-input-select2.js.map +1 -1
  195. package/dist/components/mg-input-text2.js +83 -33
  196. package/dist/components/mg-input-text2.js.map +1 -1
  197. package/dist/components/mg-input-textarea.js +69 -35
  198. package/dist/components/mg-input-textarea.js.map +1 -1
  199. package/dist/components/mg-input-title2.js +4 -3
  200. package/dist/components/mg-input-title2.js.map +1 -1
  201. package/dist/components/mg-input-toggle.js +9 -9
  202. package/dist/components/mg-input-toggle.js.map +1 -1
  203. package/dist/components/mg-item-more.js +4 -3
  204. package/dist/components/mg-item-more.js.map +1 -1
  205. package/dist/components/mg-menu-item2.js +7 -8
  206. package/dist/components/mg-menu-item2.js.map +1 -1
  207. package/dist/components/mg-menu2.js +1 -1
  208. package/dist/components/mg-menu2.js.map +1 -1
  209. package/dist/components/mg-message.js +7 -7
  210. package/dist/components/mg-message.js.map +1 -1
  211. package/dist/components/mg-modal.js +7 -7
  212. package/dist/components/mg-modal.js.map +1 -1
  213. package/dist/components/mg-pagination2.js +2 -2
  214. package/dist/components/mg-pagination2.js.map +1 -1
  215. package/dist/components/mg-panel.js +16 -15
  216. package/dist/components/mg-panel.js.map +1 -1
  217. package/dist/components/mg-popover-content2.js +4 -4
  218. package/dist/components/mg-popover-content2.js.map +1 -1
  219. package/dist/components/mg-popover2.js +33 -14
  220. package/dist/components/mg-popover2.js.map +1 -1
  221. package/dist/components/mg-skip-links.js +4 -5
  222. package/dist/components/mg-skip-links.js.map +1 -1
  223. package/dist/components/mg-tabs.js +33 -33
  224. package/dist/components/mg-tabs.js.map +1 -1
  225. package/dist/components/mg-tag.js +8 -8
  226. package/dist/components/mg-tag.js.map +1 -1
  227. package/dist/components/mg-tooltip-content2.js +1 -1
  228. package/dist/components/mg-tooltip-content2.js.map +1 -1
  229. package/dist/components/mg-tooltip2.js +34 -15
  230. package/dist/components/mg-tooltip2.js.map +1 -1
  231. package/dist/esm/{mg-menu.conf-012fc9b4.js → components.utils-0f76010d.js} +153 -8
  232. package/dist/esm/components.utils-0f76010d.js.map +1 -0
  233. package/dist/esm/index-ce01e63b.js +18 -1
  234. package/dist/esm/loader.js +1 -1
  235. package/dist/esm/mg-action-more_34.entry.js +697 -518
  236. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  237. package/dist/esm/mg-components.js +1 -1
  238. package/dist/esm/mg-item-more.entry.js +4 -4
  239. package/dist/esm/mg-item-more.entry.js.map +1 -1
  240. package/dist/mg-components/locales/en/messages.json +3 -3
  241. package/dist/mg-components/locales/fr/messages.json +3 -3
  242. package/dist/mg-components/mg-components.css +1 -1
  243. package/dist/mg-components/mg-components.esm.js +1 -1
  244. package/dist/mg-components/mg-components.esm.js.map +1 -1
  245. package/dist/mg-components/p-768fc594.entry.js +2 -0
  246. package/dist/mg-components/p-768fc594.entry.js.map +1 -0
  247. package/dist/mg-components/p-c9e2c669.js +2 -0
  248. package/dist/mg-components/p-c9e2c669.js.map +1 -0
  249. package/dist/mg-components/p-d2d6afec.entry.js +2 -0
  250. package/dist/mg-components/p-d2d6afec.entry.js.map +1 -0
  251. package/dist/mg-components/variables.css +1 -275
  252. package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
  253. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -1
  254. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +4 -3
  255. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +1 -1
  256. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +4 -4
  257. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +22 -1
  258. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +17 -2
  259. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +35 -20
  260. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -1
  261. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +16 -1
  262. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +16 -1
  263. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +12 -0
  264. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +30 -6
  265. package/dist/types/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.d.ts +1 -0
  266. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +17 -5
  267. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -1
  268. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  269. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +3 -3
  270. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +2 -1
  271. package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +1 -0
  272. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +6 -5
  273. package/dist/types/components.d.ts +71 -13
  274. package/dist/types/utils/components.utils.d.ts +12 -0
  275. package/package.json +17 -18
  276. package/readme.md +0 -31
  277. package/dist/cjs/mg-menu.conf-43aacf30.js.map +0 -1
  278. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -116
  279. package/dist/collection/components/atoms/mg-button/mg-button.css +0 -182
  280. package/dist/collection/components/atoms/mg-card/mg-card.css +0 -75
  281. package/dist/collection/components/atoms/mg-character-left/mg-character-left.css +0 -3
  282. package/dist/collection/components/atoms/mg-divider/mg-divider.css +0 -9
  283. package/dist/collection/components/atoms/mg-icon/mg-icon.css +0 -138
  284. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +0 -12
  285. package/dist/collection/components/atoms/mg-tag/mg-tag.css +0 -131
  286. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js +0 -37
  287. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js.map +0 -1
  288. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.css +0 -43
  289. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +0 -3
  290. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +0 -268
  291. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +0 -211
  292. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +0 -257
  293. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +0 -254
  294. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +0 -179
  295. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +0 -264
  296. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +0 -304
  297. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js +0 -171
  298. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js.map +0 -1
  299. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +0 -303
  300. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +0 -233
  301. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +0 -37
  302. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +0 -377
  303. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +0 -39
  304. package/dist/collection/components/molecules/mg-details/mg-details.css +0 -64
  305. package/dist/collection/components/molecules/mg-form/mg-form.css +0 -19
  306. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +0 -45
  307. package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +0 -30
  308. package/dist/collection/components/molecules/mg-message/mg-message.css +0 -82
  309. package/dist/collection/components/molecules/mg-modal/mg-modal.css +0 -67
  310. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +0 -47
  311. package/dist/collection/components/molecules/mg-panel/mg-panel.css +0 -64
  312. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.css +0 -135
  313. package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -11
  314. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +0 -1
  315. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +0 -28
  316. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -99
  317. package/dist/collection/styles/a11y.scss +0 -36
  318. package/dist/collection/styles/fonts.scss +0 -21
  319. package/dist/collection/styles/form.scss +0 -3
  320. package/dist/collection/styles/global.scss +0 -80
  321. package/dist/collection/styles/layout.scss +0 -29
  322. package/dist/collection/styles/main.scss +0 -23
  323. package/dist/collection/styles/mg-icon-animation.scss +0 -6
  324. package/dist/collection/styles/navigation-button.scss +0 -77
  325. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +0 -11
  326. package/dist/collection/styles/typography.scss +0 -82
  327. package/dist/collection/styles/utilities.scss +0 -21
  328. package/dist/collection/test/typography.e2e.playwright.js +0 -12
  329. package/dist/collection/test/typography.e2e.playwright.js.map +0 -1
  330. package/dist/esm/mg-menu.conf-012fc9b4.js.map +0 -1
  331. package/dist/mg-components/p-1d7d6fa0.js +0 -2
  332. package/dist/mg-components/p-1d7d6fa0.js.map +0 -1
  333. package/dist/mg-components/p-9257e8f1.entry.js +0 -2
  334. package/dist/mg-components/p-9257e8f1.entry.js.map +0 -1
  335. package/dist/mg-components/p-caafc9cf.entry.js +0 -2
  336. package/dist/mg-components/p-caafc9cf.entry.js.map +0 -1
  337. package/dist/mg-components/styles/a11y.scss +0 -36
  338. package/dist/mg-components/styles/fonts.scss +0 -21
  339. package/dist/mg-components/styles/form.scss +0 -3
  340. package/dist/mg-components/styles/global.scss +0 -80
  341. package/dist/mg-components/styles/layout.scss +0 -29
  342. package/dist/mg-components/styles/main.scss +0 -23
  343. package/dist/mg-components/styles/mg-icon-animation.scss +0 -6
  344. package/dist/mg-components/styles/navigation-button.scss +0 -77
  345. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +0 -11
  346. package/dist/mg-components/styles/typography.scss +0 -82
  347. package/dist/mg-components/styles/utilities.scss +0 -21
  348. /package/dist/types/{test/typography.e2e.playwright.d.ts → components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"mg-panel.e2e.playwright.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-panel/test/mg-panel.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,EAAY,IAAI,EAAE,MAAM,6CAA6C,CAAC;AAChJ,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAItF,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,MAAM,CAAU,CAAC;AAG3C,MAAM,QAAQ,GAAG;EACf,UAAU,EAAE,aAAa;CAC1B,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,IAAc,EAA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1B,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;MAC1B,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;MAC1B,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;MAE1B,MAAM,IAAI,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAAC,KAAK,EAAE,CAAC;MAE5E,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { setPageContent, expect, describe, testEach, updateScreenshotClass, PageType, test } from '../../../../utils/playwright.e2e.test.utils';\nimport { createID } from '../../../../utils/components.utils';\nimport { renderAttributes, renderProperties } from '../../../../utils/e2e.test.utils';\nimport { type MgPanel } from '../mg-panel';\n\ntype ArgsType = Partial<MgPanel> & { slot?: SlotType };\nconst slots = ['default', 'flex'] as const;\ntype SlotType = (typeof slots)[number] | string;\n\nconst baseArgs = {\n panelTitle: 'panel title',\n};\n\nconst createHTML = (args: ArgsType): string => {\n const identifier = createID();\n const slot: SlotType = Boolean(args.slot) ? args.slot : slots[0];\n delete args.slot;\n\n const flexSlotContainer = (content: string): string => '<mg-badge variant=\"primary\" value=\"1\" label=\"label\"></mg-badge><div>' + content + '</div>';\n const slotContent = `\n <mg-button variant=\"secondary\" style=\"margin-left: 200px;\">\n <mg-icon icon=\"file-upload\"></mg-icon> Upload\n </mg-button>\n <mg-button is-icon variant=\"secondary\" label=\"delete\">\n <mg-icon icon=\"trash\"></mg-icon>\n </mg-button>\n `;\n\n return `\n <mg-panel ${renderAttributes({ ...args, identifier })}>\n ${\n slots.includes(slot as (typeof slots)[number])\n ? `\n <div>Content</div>\n <div slot=\"header-right\" ${slot === 'flex' ? 'style=\"display:flex; justify-content:space-between; align-items:center; width:100%;\"' : ''}>\n ${slot === 'flex' ? flexSlotContainer(slotContent) : slotContent}\n </div>`\n : slot\n }\n </mg-panel>\n <script>${renderProperties(args, `[identifier=\"${identifier}\"]`)}</script>`;\n};\n\ndescribe('mg-panel', () => {\n testEach([\n { ...baseArgs },\n { ...baseArgs, titlePosition: 'left' },\n { ...baseArgs, titlePosition: 'right' },\n { ...baseArgs, titlePosition: 'right', titleEditable: true },\n { ...baseArgs, expandToggleDisplay: 'text' },\n { ...baseArgs, expandToggleDisplay: 'icon' },\n { ...baseArgs, expandToggleDisplay: 'icon', titleEditable: true },\n { ...baseArgs, expanded: true },\n { ...baseArgs, titleEditable: true },\n {\n ...baseArgs,\n panelTitle:\n 'very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title',\n },\n {\n ...baseArgs,\n titleEditable: true,\n panelTitle:\n 'very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title',\n },\n { ...baseArgs, slot: 'flex' },\n {\n ...baseArgs,\n slot: 'flex',\n panelTitle:\n 'very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title',\n },\n { ...baseArgs, expanded: true, style: '--mg-panel-content-padding: 0', slot: '<div>Content without padding.</div>' },\n { ...baseArgs, expanded: true, style: '--mg-panel-background: none; --mg-panel-border-radius: 0; --mg-panel-box-shadow: none', slot: '<div>Transparent mg-panel</div>' },\n {\n ...baseArgs,\n expanded: true,\n slot: '<div>header right items should be vertically aligned</div><div slot=\"header-right\"><mg-tag>Label</mg-tag><mg-icon size=\"small\" icon=\"check-circle\" variant=\"success\"></mg-icon></div>',\n },\n { ...baseArgs, expanded: true, style: '--mg-panel-background: var(--color-danger)', slot: '<mg-card>Content whith child card.</mg-card>' },\n ])('Should render with template %s', async (page: PageType, args: ArgsType) => {\n await setPageContent(\n page,\n createHTML({\n ...args,\n }),\n );\n\n await updateScreenshotClass(page, { width: '500px', height: '100%' });\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n\n await page.keyboard.press('Tab');\n await page.keyboard.press('Enter');\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n });\n\n describe('navigation', () => {\n testEach([\n { ...baseArgs, titleEditable: true },\n {\n ...baseArgs,\n titleEditable: true,\n panelTitle:\n 'very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title',\n },\n ])('Should navigate throw editabled panel %s', async (page: PageType, args: ArgsType) => {\n await setPageContent(\n page,\n createHTML({\n ...args,\n }),\n );\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n\n await page.locator('.mg-panel__header-title mg-button:last-of-type').click();\n\n // Hide caret for screenshots\n await page.locator('mg-panel input').evaluate(element => (element.style.caretColor = 'transparent'));\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n\n const input = await page.locator('mg-panel mg-input-text input');\n\n await input.press('Space');\n await input.press('KeyU');\n await input.press('KeyP');\n await input.press('KeyD');\n await input.press('KeyA');\n await input.press('KeyT');\n await input.press('KeyE');\n await input.press('KeyD');\n\n await page.locator('mg-panel mg-input-text mg-button:last-of-type').click();\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n });\n\n test('Should NOT update panel title, case input new value does NOT match pattern', async ({ page }) => {\n const args = {\n ...baseArgs,\n titleEditable: true,\n titlePattern: /^(?!(joker)$)[a-z A-Z0-9s]+$/ as unknown as string,\n titlePatternErrorMessage: \"You can't enter a bad guy !\",\n };\n\n await setPageContent(page, createHTML(args));\n\n await page.locator('.mg-panel__header-title mg-button:last-of-type').click();\n\n // Hide caret for screenshots\n await page.locator('mg-panel input').evaluate(element => (element.style.caretColor = 'transparent'));\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n\n const input = await page.locator('mg-panel mg-input-text input');\n\n await input.press('Backspace');\n await input.press('Backspace');\n await input.press('Backspace');\n await input.press('Backspace');\n await input.press('Backspace');\n await input.press('KeyJ');\n await input.press('KeyO');\n await input.press('KeyK');\n await input.press('KeyE');\n await input.press('KeyR');\n\n await page.locator('mg-panel mg-input-text mg-button:last-of-type').click();\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n });\n });\n});\n"]}
1
+ {"version":3,"file":"mg-panel.e2e.playwright.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-panel/test/mg-panel.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,EAAY,IAAI,EAAE,MAAM,6CAA6C,CAAC;AAChJ,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAItF,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,MAAM,CAAU,CAAC;AAG3C,MAAM,QAAQ,GAAG;EACf,UAAU,EAAE,aAAa;CAC1B,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,IAAc,EAAU,EAAE;EAC5C,MAAM,UAAU,GAAG,QAAQ,EAAE,CAAC;EAC9B,MAAM,IAAI,GAAa,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;EACjE,OAAO,IAAI,CAAC,IAAI,CAAC;EAEjB,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,sEAAsE,GAAG,OAAO,GAAG,QAAQ,CAAC;EACnJ,MAAM,WAAW,GAAG;;;;;;;GAOnB,CAAC;EAEF,OAAO;gBACO,gBAAgB,iCAAM,IAAI,KAAE,UAAU,IAAG;QAEjD,KAAK,CAAC,QAAQ,CAAC,IAA8B,CAAC;IAC5C,CAAC,CAAC;;qCAEyB,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,sFAAsF,CAAC,CAAC,CAAC,EAAE;cACpI,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,W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,CAAC;MAErG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;MAE1D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC;MAEjE,MAAM,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;MAC/B,MAAM,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;MAC/B,MAAM,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;MAC/B,MAAM,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;MAC/B,MAAM,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;MAC/B,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;MAC1B,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;MAC1B,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;MAC1B,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;MAC1B,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;MAE1B,MAAM,IAAI,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAAC,KAAK,EAAE,CAAC;MAE5E,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { setPageContent, expect, describe, testEach, updateScreenshotClass, PageType, test } from '../../../../utils/playwright.e2e.test.utils';\nimport { createID } from '../../../../utils/components.utils';\nimport { renderAttributes, renderProperties } from '../../../../utils/e2e.test.utils';\nimport { type MgPanel } from '../mg-panel';\n\ntype ArgsType = Partial<MgPanel> & { slot?: SlotType };\nconst slots = ['default', 'flex'] as const;\ntype SlotType = (typeof slots)[number] | string;\n\nconst baseArgs = {\n panelTitle: 'panel title',\n};\n\nconst createHTML = (args: ArgsType): string => {\n const identifier = createID();\n const slot: SlotType = Boolean(args.slot) ? args.slot : slots[0];\n delete args.slot;\n\n const flexSlotContainer = (content: string): string => '<mg-badge variant=\"primary\" value=\"1\" label=\"label\"></mg-badge><div>' + content + '</div>';\n const slotContent = `\n <mg-button variant=\"secondary\" style=\"margin-left: 200px;\">\n <mg-icon icon=\"file-upload\"></mg-icon> Upload\n </mg-button>\n <mg-button is-icon variant=\"secondary\" label=\"delete\">\n <mg-icon icon=\"trash\"></mg-icon>\n </mg-button>\n `;\n\n return `\n <mg-panel ${renderAttributes({ ...args, identifier })}>\n ${\n slots.includes(slot as (typeof slots)[number])\n ? `\n <div>Content</div>\n <div slot=\"header-right\" ${slot === 'flex' ? 'style=\"display:flex; justify-content:space-between; align-items:center; width:100%;\"' : ''}>\n ${slot === 'flex' ? flexSlotContainer(slotContent) : slotContent}\n </div>`\n : slot\n }\n </mg-panel>\n <script>${renderProperties(args, `[identifier=\"${identifier}\"]`)}</script>`;\n};\n\ndescribe('mg-panel', () => {\n testEach([\n { ...baseArgs },\n { ...baseArgs, titlePosition: 'left' },\n { ...baseArgs, titlePosition: 'right' },\n { ...baseArgs, titlePosition: 'right', titleEditable: true },\n { ...baseArgs, expandToggleDisplay: 'text' },\n { ...baseArgs, expandToggleDisplay: 'icon' },\n { ...baseArgs, expandToggleDisplay: 'icon', titleEditable: true },\n { ...baseArgs, expanded: true },\n { ...baseArgs, titleEditable: true },\n {\n ...baseArgs,\n panelTitle:\n 'very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title',\n },\n {\n ...baseArgs,\n titleEditable: true,\n panelTitle:\n 'very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title',\n },\n { ...baseArgs, slot: 'flex' },\n {\n ...baseArgs,\n slot: 'flex',\n panelTitle:\n 'very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title',\n },\n { ...baseArgs, expanded: true, style: '--mg-panel-content-padding: 0', slot: '<div>Content without padding.</div>' },\n { ...baseArgs, expanded: true, style: '--mg-panel-background: none; --mg-panel-border-radius: 0; --mg-panel-box-shadow: none', slot: '<div>Transparent mg-panel</div>' },\n {\n ...baseArgs,\n expanded: true,\n slot: '<div>header right items should be vertically aligned</div><div slot=\"header-right\"><mg-tag>Label</mg-tag><mg-icon size=\"small\" icon=\"check-circle\" variant=\"success\"></mg-icon></div>',\n },\n { ...baseArgs, expanded: true, style: '--mg-panel-background: var(--color-danger)', slot: '<mg-card>Content whith child card.</mg-card>' },\n ])('Should render with template %s', async (page: PageType, args: ArgsType) => {\n await setPageContent(\n page,\n createHTML({\n ...args,\n }),\n );\n\n await updateScreenshotClass(page, { width: '500px', height: '100%' });\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n\n await page.keyboard.press('Tab');\n await page.keyboard.press('Enter');\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n });\n\n describe('navigation', () => {\n testEach([\n { ...baseArgs, titleEditable: true },\n {\n ...baseArgs,\n titleEditable: true,\n panelTitle:\n 'very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title very long panel title',\n },\n ])('Should navigate throw editabled panel %s', async (page: PageType, args: ArgsType) => {\n await setPageContent(\n page,\n createHTML({\n ...args,\n }),\n );\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n\n await page.locator('.mg-c-panel__header-title mg-button:last-of-type').click();\n\n // Hide caret for screenshots\n await page.locator('mg-panel input').evaluate(element => (element.style.caretColor = 'transparent'));\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n\n const input = await page.locator('mg-panel mg-input-text input');\n\n await input.press('Space');\n await input.press('KeyU');\n await input.press('KeyP');\n await input.press('KeyD');\n await input.press('KeyA');\n await input.press('KeyT');\n await input.press('KeyE');\n await input.press('KeyD');\n\n await page.locator('mg-panel mg-input-text mg-button:last-of-type').click();\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n });\n\n test('Should NOT update panel title, case input new value does NOT match pattern', async ({ page }) => {\n const args = {\n ...baseArgs,\n titleEditable: true,\n titlePattern: '^((?!joker).)*$',\n titlePatternErrorMessage: \"You can't enter a bad guy !\",\n };\n\n await setPageContent(page, createHTML(args));\n\n await page.locator('.mg-c-panel__header-title mg-button:last-of-type').click();\n\n // Hide caret for screenshots\n await page.locator('mg-panel input').evaluate(element => (element.style.caretColor = 'transparent'));\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n\n const input = await page.locator('mg-panel mg-input-text input');\n\n await input.press('Backspace');\n await input.press('Backspace');\n await input.press('Backspace');\n await input.press('Backspace');\n await input.press('Backspace');\n await input.press('KeyJ');\n await input.press('KeyO');\n await input.press('KeyK');\n await input.press('KeyE');\n await input.press('KeyR');\n\n await page.locator('mg-panel mg-input-text mg-button:last-of-type').click();\n\n await expect(page.locator('mg-panel')).toHaveScreenshot();\n });\n });\n});\n"]}
@@ -32,23 +32,13 @@ describe('mg-panel', () => {
32
32
  expect(root).toMatchSnapshot();
33
33
  });
34
34
  describe('errors', () => {
35
- test.each([
36
- { props: { identifier: 'identifier', panelTitle: 'panel title', titlePattern: /joker/ }, error: '<mg-panel> prop "titleEditable" must be set to `true`.' },
37
- {
38
- props: { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, titlePattern: '^(?!(joker)$)[a-z A-Z0-9s]+$' },
39
- error: '<mg-panel> prop "titlePattern" must be paired with the prop "titlePatternErrorMessage".',
40
- },
41
- {
42
- props: { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, titlePattern: '^(?!(joker)$)[a-z A-Z0-9s]+$', titlePatternErrorMessage: '' },
43
- error: '<mg-panel> prop "titlePattern" must be paired with the prop "titlePatternErrorMessage".',
44
- },
45
- ])('Should throw error when props association are unauthorized %s:', async ({ props, error }) => {
35
+ test('Should throw error when props association are unauthorized %s:', async () => {
46
36
  expect.assertions(1);
47
37
  try {
48
- await getPage(props);
38
+ await getPage({ identifier: 'identifier', panelTitle: 'panel title', titlePattern: /joker/ });
49
39
  }
50
40
  catch (err) {
51
- expect(err.message).toBe(error);
41
+ expect(err.message).toBe('<mg-panel> prop "titleEditable" must be set to "true".');
52
42
  }
53
43
  });
54
44
  test.each(['', ' ', undefined])('Should not render with invalid panelTitle property: %s', async (panelTitle) => {
@@ -104,7 +94,7 @@ describe('mg-panel', () => {
104
94
  test.each([true, false])('Should toggle edit panel title', async (titleEditable) => {
105
95
  const page = await getPage({ identifier: 'identifier', panelTitle: 'panel title', titleEditable });
106
96
  const mgPanel = page.doc.querySelector('mg-panel');
107
- const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');
97
+ const editButton = mgPanel.shadowRoot.querySelector('.mg-c-panel__header-title mg-button[is-icon]');
108
98
  expect(page.root).toMatchSnapshot();
109
99
  if (titleEditable) {
110
100
  editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
@@ -121,7 +111,7 @@ describe('mg-panel', () => {
121
111
  const args = { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true };
122
112
  const page = await getPage(args);
123
113
  const mgPanel = page.doc.querySelector('mg-panel');
124
- const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');
114
+ const editButton = mgPanel.shadowRoot.querySelector('.mg-c-panel__header-title mg-button[is-icon]');
125
115
  expect(page.root).toMatchSnapshot();
126
116
  jest.spyOn(page.rootInstance.titleChange, 'emit');
127
117
  editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
@@ -134,7 +124,7 @@ describe('mg-panel', () => {
134
124
  await page.waitForChanges();
135
125
  input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
136
126
  await page.waitForChanges();
137
- const afterInputAction = mgPanel.shadowRoot.querySelector(`.mg-panel__header-title mg-input-text mg-button:${lastAction}`);
127
+ const afterInputAction = mgPanel.shadowRoot.querySelector(`.mg-c-panel__header-title mg-input-text mg-button:${lastAction}`);
138
128
  afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));
139
129
  jest.runOnlyPendingTimers();
140
130
  await page.waitForChanges();
@@ -153,7 +143,7 @@ describe('mg-panel', () => {
153
143
  const args = { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true };
154
144
  const page = await getPage(args);
155
145
  const mgPanel = page.doc.querySelector('mg-panel');
156
- const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');
146
+ const editButton = mgPanel.shadowRoot.querySelector('.mg-c-panel__header-title mg-button[is-icon]');
157
147
  expect(page.root).toMatchSnapshot();
158
148
  jest.spyOn(page.rootInstance.titleChange, 'emit');
159
149
  editButton.dispatchEvent(new CustomEvent('click', { bubbles: true }));
@@ -163,7 +153,7 @@ describe('mg-panel', () => {
163
153
  const input = mgInputText.shadowRoot.querySelector('input');
164
154
  input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
165
155
  await page.waitForChanges();
166
- const afterInputAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');
156
+ const afterInputAction = mgPanel.shadowRoot.querySelector('.mg-c-panel__header-title mg-input-text mg-button:last-of-type');
167
157
  afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));
168
158
  jest.runOnlyPendingTimers();
169
159
  await page.waitForChanges();
@@ -182,7 +172,7 @@ describe('mg-panel', () => {
182
172
  };
183
173
  const page = await getPage(args);
184
174
  const mgPanel = page.doc.querySelector('mg-panel');
185
- const editButton = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-button[is-icon]');
175
+ const editButton = mgPanel.shadowRoot.querySelector('.mg-c-panel__header-title mg-button[is-icon]');
186
176
  expect(page.root).toMatchSnapshot();
187
177
  jest.spyOn(page.rootInstance.titleChange, 'emit');
188
178
  // first switch to title edition
@@ -204,7 +194,7 @@ describe('mg-panel', () => {
204
194
  input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
205
195
  await page.waitForChanges();
206
196
  // and click on validate button
207
- const afterInputAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');
197
+ const afterInputAction = mgPanel.shadowRoot.querySelector('.mg-c-panel__header-title mg-input-text mg-button:last-of-type');
208
198
  afterInputAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));
209
199
  jest.runOnlyPendingTimers();
210
200
  await page.waitForChanges();
@@ -212,7 +202,7 @@ describe('mg-panel', () => {
212
202
  expect(mgPanel.panelTitle).toBe(args.panelTitle);
213
203
  expect(page.rootInstance.titleChange.emit).not.toHaveBeenCalledWith(updatedPanelTitle);
214
204
  // finaly return to default view by clicking on cancel button
215
- const cancelAction = mgPanel.shadowRoot.querySelector('.mg-panel__header-title mg-input-text mg-button:last-of-type');
205
+ const cancelAction = mgPanel.shadowRoot.querySelector('.mg-c-panel__header-title mg-input-text mg-button:last-of-type');
216
206
  cancelAction.dispatchEvent(new CustomEvent('click', { bubbles: true }));
217
207
  jest.runOnlyPendingTimers();
218
208
  await page.waitForChanges();
@@ -1 +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,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,IAAK,EAAE,EAAE;EAC9B,MAAM,IAAI,GAAG,WAAW,CAAC;IACvB,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC;IAC5C,QAAQ,EAAE,GAAG,E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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.each([\n { props: { identifier: 'identifier', panelTitle: 'panel title', titlePattern: /joker/ }, error: '<mg-panel> prop \"titleEditable\" must be set to `true`.' },\n {\n props: { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, titlePattern: '^(?!(joker)$)[a-z A-Z0-9s]+$' },\n error: '<mg-panel> prop \"titlePattern\" must be paired with the prop \"titlePatternErrorMessage\".',\n },\n {\n props: { identifier: 'identifier', panelTitle: 'panel title', titleEditable: true, titlePattern: '^(?!(joker)$)[a-z A-Z0-9s]+$', titlePatternErrorMessage: '' },\n error: '<mg-panel> prop \"titlePattern\" must be paired with the prop \"titlePatternErrorMessage\".',\n },\n ])('Should throw error when props association are unauthorized %s:', async ({ props, error }) => {\n expect.assertions(1);\n try {\n await getPage(props);\n } catch (err) {\n expect(err.message).toBe(error);\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
+ {"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,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,IAAK,EAAE,EAAE;EAC9B,MAAM,IAAI,GAAG,WAAW,CAAC;IACvB,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC;IAC5C,QAAQ,EAAE,GAAG,EAAE,CAAC,gCAAc,IAAI,GAAG,IAAI,CAAY;GACtD,CAAC,CAAC;EACH,IAAI,CAAC,YAAY,EAAE,CAAC;EAEpB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;EACxB,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;EACvE,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;EAE/D,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;EACvC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;EAE7C,IAAI,CAAC,IAAI,CAAC;IACR,EAA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C,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-c-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-c-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-c-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-c-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-c-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-c-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-c-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-c-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"]}
@@ -10,7 +10,7 @@ export class MgPopoverContent {
10
10
  this.hideContent.emit();
11
11
  };
12
12
  this.closeButton = false;
13
- this.classCollection = new ClassList(['mg-popover-content']);
13
+ this.classCollection = new ClassList(['mg-c-popover-content']);
14
14
  }
15
15
  /*************
16
16
  * Lifecycle *
@@ -37,18 +37,18 @@ export class MgPopoverContent {
37
37
  * @returns HTML Element
38
38
  */
39
39
  render() {
40
- return (h(Host, null, h("mg-card", { class: this.classCollection.join() }, this.closeButton && (h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover-content__title" }, h("slot", { name: "title" })), h("slot", { name: "content" })), h("slot", { name: "arrow" })));
40
+ return (h(Host, null, h("mg-card", { class: this.classCollection.join() }, this.closeButton && (h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-c-popover-content__title" }, h("slot", { name: "title" })), h("slot", { name: "content" })), h("slot", { name: "arrow" })));
41
41
  }
42
42
  static get is() { return "mg-popover-content"; }
43
43
  static get encapsulation() { return "shadow"; }
44
44
  static get originalStyleUrls() {
45
45
  return {
46
- "$": ["mg-popover-content.scss"]
46
+ "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-popover-content.css"]
47
47
  };
48
48
  }
49
49
  static get styleUrls() {
50
50
  return {
51
- "$": ["mg-popover-content.css"]
51
+ "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-popover-content.css"]
52
52
  };
53
53
  }
54
54
  static get properties() {
@@ -1 +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,eAAe,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,MAAM,O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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
+ {"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,eAAe,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,MAAM,OAAO,gBAAgB;;IAgC3B;;OAEG;IACK,sBAAiB,GAAG,GAAS,EAAE;MACrC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC,CAAC;uBAjBoB,KAAK;2BAKW,IAAI,SAAS,CAAC,CAAC,sBAAsB,CAAC,CAAC;;EAc7E;;iBAEe;EAEf;;KAEG;EACH,iBAAiB;IACf,cAAc;IACd,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;EACrD,CAAC;EAED;;KAEG;EACH,gBAAgB;IACd,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAEzD,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACzE,IAAI,mBAAmB,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,WAAW,CAAC,EAAE;MACvE,MAAM,IAAI,KAAK,CAAC,iDAAiD,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KAC5F;EACH,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,EAAC,IAAI;MACH,eAAS,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE;QACxC,IAAI,CAAC,WAAW,IAAI,CACnB,kCAAmB,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,iBAAiB;UACnG,eAAS,IAAI,EAAC,OAAO,GAAW,CACtB,CACb;QACD,WAAK,KAAK,EAAC,6BAA6B;UACtC,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: '../../../../../node_modules/@mgdis/styles/dist/components/mg-popover-content.css',\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-c-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-c-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"]}
@@ -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
@@ -166,12 +183,12 @@ export class MgPopover {
166
183
  static get encapsulation() { return "shadow"; }
167
184
  static get originalStyleUrls() {
168
185
  return {
169
- "$": ["mg-popover.scss"]
186
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-popover.css"]
170
187
  };
171
188
  }
172
189
  static get styleUrls() {
173
190
  return {
174
- "$": ["mg-popover.css"]
191
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-popover.css"]
175
192
  };
176
193
  }
177
194
  static get properties() {
@@ -313,6 +330,9 @@ export class MgPopover {
313
330
  static get elementRef() { return "element"; }
314
331
  static get watchers() {
315
332
  return [{
333
+ "propName": "identifier",
334
+ "methodName": "validateIdentifier"
335
+ }, {
316
336
  "propName": "arrowHide",
317
337
  "methodName": "validateArrowHide"
318
338
  }, {
@@ -1 +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;;IAyEpB;;;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,gB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OAAO,EAAE;YACP,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;WACf;SACF;OACF;KACF,CAAC,CAAC;IAEH,sBAAsB;IACtB,IAAI,cAAc,CAAC,GAAG,EAAE;MACtB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAE7D,+BAA+B;IAC/B,kBAAkB,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;MAChD,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,6BAA6B;IAC7B,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE;MAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;QACzC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,kBAAkB,CAAC,KAAK,EAAE,CAAC;OAC5B;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;EACnC,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,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\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 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 };\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.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 });\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"]}
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,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,CAAC,CAAC,CAAC;IAE7D,+BAA+B;IAC/B,kBAAkB,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;MAChD,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,6BAA6B;IAC7B,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE;MAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;QACzC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,kBAAkB,CAAC,KAAK,EAAE,CAAC;OAC5B;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;EACnC,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,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: '../../../../node_modules/@mgdis/styles/dist/components/mg-popover.css',\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['closeButton']): 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"]}