@mgdis/mg-components 5.18.0 → 5.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/dist/cjs/{mg-menu.conf-43aacf30.js → components.utils-dc9c8a53.js} +160 -7
  2. package/dist/cjs/components.utils-dc9c8a53.js.map +1 -0
  3. package/dist/cjs/index-c042e24b.js +18 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/mg-action-more_34.cjs.entry.js +381 -465
  6. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  7. package/dist/cjs/mg-components.cjs.js +1 -1
  8. package/dist/cjs/mg-item-more.cjs.entry.js +7 -6
  9. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.js +10 -10
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  12. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +5 -5
  13. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +1 -1
  14. package/dist/collection/components/atoms/mg-button/mg-button.js +13 -12
  15. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  16. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +4 -4
  17. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -1
  18. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +3 -3
  19. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -1
  20. package/dist/collection/components/atoms/mg-card/mg-card.js +13 -13
  21. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  22. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +3 -3
  23. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  24. package/dist/collection/components/atoms/mg-divider/mg-divider.js +4 -4
  25. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.js +15 -17
  27. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  28. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +4 -4
  29. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +1 -1
  30. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +24 -5
  31. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js +12 -0
  33. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js.map +1 -0
  34. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js +1 -5
  35. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js.map +1 -1
  36. package/dist/collection/components/atoms/mg-tag/mg-tag.js +9 -9
  37. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  38. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +23 -0
  39. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +1 -0
  40. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +5 -5
  41. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +1 -1
  42. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
  43. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  44. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -7
  45. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  46. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +1 -1
  47. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -1
  48. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +1 -1
  49. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/MgInput.js +14 -13
  51. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +7 -4
  53. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +20 -2
  55. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  57. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +25 -27
  58. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +21 -27
  60. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +1 -1
  61. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +9 -7
  62. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
  63. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +6 -6
  64. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  65. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +11 -10
  66. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  67. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -6
  68. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  69. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +6 -6
  70. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  71. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +1 -1
  72. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +1 -1
  73. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +8 -8
  74. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  75. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +6 -0
  76. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -0
  77. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +52 -14
  78. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  79. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +147 -0
  80. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +1 -0
  81. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +12 -2
  82. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
  83. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +12 -12
  84. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  85. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +2 -2
  86. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
  87. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +86 -10
  88. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  89. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js +108 -0
  90. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js.map +1 -0
  91. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +46 -2
  92. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -1
  93. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +3 -3
  94. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  95. package/dist/collection/components/molecules/menu/mg-menu/test/{mg-menu.e2e.js → mg-menu.e2e.playwright.js} +67 -96
  96. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js.map +1 -0
  97. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +8 -9
  98. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  99. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js +100 -0
  100. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js.map +1 -0
  101. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  102. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +7 -7
  103. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  104. package/dist/collection/components/molecules/mg-details/mg-details.js +5 -4
  105. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  106. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +1 -1
  107. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +1 -1
  108. package/dist/collection/components/molecules/mg-form/mg-form.js +6 -5
  109. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  110. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +4 -4
  111. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -1
  112. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +7 -7
  113. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  114. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +5 -4
  115. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  116. package/dist/collection/components/molecules/mg-message/mg-message.js +8 -8
  117. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  118. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +11 -11
  119. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +1 -1
  120. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
  121. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  122. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +7 -7
  123. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -1
  124. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +3 -3
  125. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +1 -1
  126. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +1 -1
  127. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +1 -1
  128. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +3 -3
  129. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  130. package/dist/collection/components/molecules/mg-panel/mg-panel.js +9 -9
  131. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  132. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +2 -2
  133. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
  134. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +8 -8
  135. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -1
  136. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -4
  137. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  138. package/dist/collection/components/molecules/mg-popover/mg-popover.js +2 -2
  139. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  140. package/dist/collection/components/molecules/mg-popover/test/{mg-popover.e2e.js → mg-popover.e2e.playwright.js} +46 -65
  141. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +1 -0
  142. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -6
  143. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  144. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +34 -34
  145. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  146. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +13 -13
  147. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +1 -1
  148. package/dist/collection/locales/en/messages.json +3 -3
  149. package/dist/collection/locales/fr/messages.json +3 -3
  150. package/dist/collection/utils/behaviors.utils.js +2 -1
  151. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  152. package/dist/collection/utils/components.utils.js +10 -0
  153. package/dist/collection/utils/components.utils.js.map +1 -1
  154. package/dist/collection/utils/components.utils.spec.js +14 -1
  155. package/dist/collection/utils/components.utils.spec.js.map +1 -1
  156. package/dist/collection/utils/playwright.e2e.test.utils.js +3 -3
  157. package/dist/collection/utils/playwright.e2e.test.utils.js.map +1 -1
  158. package/dist/collection/utils/unit.test.utils.js +0 -3
  159. package/dist/collection/utils/unit.test.utils.js.map +1 -1
  160. package/dist/collection/variables.css +1 -275
  161. package/dist/components/MgInput.js +19 -18
  162. package/dist/components/MgInput.js.map +1 -1
  163. package/dist/components/components.utils.js +11 -1
  164. package/dist/components/components.utils.js.map +1 -1
  165. package/dist/components/index2.js +6 -6
  166. package/dist/components/mg-action-more.js +6 -6
  167. package/dist/components/mg-action-more.js.map +1 -1
  168. package/dist/components/mg-badge2.js +9 -9
  169. package/dist/components/mg-badge2.js.map +1 -1
  170. package/dist/components/mg-button2.js +12 -11
  171. package/dist/components/mg-button2.js.map +1 -1
  172. package/dist/components/mg-card2.js +12 -12
  173. package/dist/components/mg-card2.js.map +1 -1
  174. package/dist/components/mg-character-left2.js +1 -1
  175. package/dist/components/mg-character-left2.js.map +1 -1
  176. package/dist/components/mg-details.js +4 -3
  177. package/dist/components/mg-details.js.map +1 -1
  178. package/dist/components/mg-divider.js +3 -3
  179. package/dist/components/mg-divider.js.map +1 -1
  180. package/dist/components/mg-form.js +5 -4
  181. package/dist/components/mg-form.js.map +1 -1
  182. package/dist/components/mg-icon2.js +14 -16
  183. package/dist/components/mg-icon2.js.map +1 -1
  184. package/dist/components/mg-illustrated-message.js +7 -7
  185. package/dist/components/mg-illustrated-message.js.map +1 -1
  186. package/dist/components/mg-input-checkbox-paginated2.js +13 -8
  187. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  188. package/dist/components/mg-input-checkbox.js +24 -26
  189. package/dist/components/mg-input-checkbox.js.map +1 -1
  190. package/dist/components/mg-input-date.js +5 -5
  191. package/dist/components/mg-input-date.js.map +1 -1
  192. package/dist/components/mg-input-numeric.js +10 -9
  193. package/dist/components/mg-input-numeric.js.map +1 -1
  194. package/dist/components/mg-input-password.js +5 -5
  195. package/dist/components/mg-input-password.js.map +1 -1
  196. package/dist/components/mg-input-radio.js +5 -5
  197. package/dist/components/mg-input-radio.js.map +1 -1
  198. package/dist/components/mg-input-select2.js +7 -7
  199. package/dist/components/mg-input-select2.js.map +1 -1
  200. package/dist/components/mg-input-text2.js +29 -12
  201. package/dist/components/mg-input-text2.js.map +1 -1
  202. package/dist/components/mg-input-textarea.js +12 -12
  203. package/dist/components/mg-input-textarea.js.map +1 -1
  204. package/dist/components/mg-input-title2.js +7 -4
  205. package/dist/components/mg-input-title2.js.map +1 -1
  206. package/dist/components/mg-input-toggle.js +48 -10
  207. package/dist/components/mg-input-toggle.js.map +1 -1
  208. package/dist/components/mg-item-more.js +6 -4
  209. package/dist/components/mg-item-more.js.map +1 -1
  210. package/dist/components/mg-menu-item2.js +7 -8
  211. package/dist/components/mg-menu-item2.js.map +1 -1
  212. package/dist/components/mg-menu2.js +2 -2
  213. package/dist/components/mg-menu2.js.map +1 -1
  214. package/dist/components/mg-message.js +7 -7
  215. package/dist/components/mg-message.js.map +1 -1
  216. package/dist/components/mg-modal.js +7 -7
  217. package/dist/components/mg-modal.js.map +1 -1
  218. package/dist/components/mg-pagination2.js +2 -2
  219. package/dist/components/mg-pagination2.js.map +1 -1
  220. package/dist/components/mg-panel.js +8 -8
  221. package/dist/components/mg-panel.js.map +1 -1
  222. package/dist/components/mg-popover-content2.js +4 -4
  223. package/dist/components/mg-popover-content2.js.map +1 -1
  224. package/dist/components/mg-popover2.js.map +1 -1
  225. package/dist/components/mg-skip-links.js +4 -5
  226. package/dist/components/mg-skip-links.js.map +1 -1
  227. package/dist/components/mg-tabs.js +33 -33
  228. package/dist/components/mg-tabs.js.map +1 -1
  229. package/dist/components/mg-tag.js +8 -8
  230. package/dist/components/mg-tag.js.map +1 -1
  231. package/dist/components/mg-tooltip-content2.js +1 -1
  232. package/dist/components/mg-tooltip-content2.js.map +1 -1
  233. package/dist/components/mg-tooltip2.js +5 -5
  234. package/dist/components/mg-tooltip2.js.map +1 -1
  235. package/dist/esm/{mg-menu.conf-012fc9b4.js → components.utils-0f76010d.js} +153 -8
  236. package/dist/esm/components.utils-0f76010d.js.map +1 -0
  237. package/dist/esm/index-ce01e63b.js +18 -1
  238. package/dist/esm/loader.js +1 -1
  239. package/dist/esm/mg-action-more_34.entry.js +315 -399
  240. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  241. package/dist/esm/mg-components.js +1 -1
  242. package/dist/esm/mg-item-more.entry.js +6 -5
  243. package/dist/esm/mg-item-more.entry.js.map +1 -1
  244. package/dist/mg-components/locales/en/messages.json +3 -3
  245. package/dist/mg-components/locales/fr/messages.json +3 -3
  246. package/dist/mg-components/mg-components.css +1 -1
  247. package/dist/mg-components/mg-components.esm.js +1 -1
  248. package/dist/mg-components/mg-components.esm.js.map +1 -1
  249. package/dist/mg-components/p-01ebc95a.entry.js +2 -0
  250. package/dist/mg-components/p-01ebc95a.entry.js.map +1 -0
  251. package/dist/mg-components/p-71a5a848.entry.js +2 -0
  252. package/dist/mg-components/p-71a5a848.entry.js.map +1 -0
  253. package/dist/mg-components/p-c9e2c669.js +2 -0
  254. package/dist/mg-components/p-c9e2c669.js.map +1 -0
  255. package/dist/mg-components/variables.css +1 -275
  256. package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
  257. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +5 -1
  258. package/dist/types/components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts +1 -0
  259. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -2
  260. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +5 -1
  261. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +5 -8
  262. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +2 -2
  263. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +9 -0
  264. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +13 -1
  265. package/dist/types/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.d.ts +1 -0
  266. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +22 -0
  267. package/dist/types/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.d.ts +1 -0
  268. package/dist/types/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.d.ts +1 -0
  269. package/dist/types/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.d.ts +1 -0
  270. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +1 -3
  271. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -1
  272. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +2 -2
  273. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
  274. package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +1 -0
  275. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +6 -5
  276. package/dist/types/components.d.ts +34 -2
  277. package/dist/types/utils/components.utils.d.ts +6 -0
  278. package/package.json +21 -22
  279. package/readme.md +0 -31
  280. package/dist/cjs/mg-menu.conf-43aacf30.js.map +0 -1
  281. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -116
  282. package/dist/collection/components/atoms/mg-button/mg-button.css +0 -182
  283. package/dist/collection/components/atoms/mg-card/mg-card.css +0 -75
  284. package/dist/collection/components/atoms/mg-character-left/mg-character-left.css +0 -3
  285. package/dist/collection/components/atoms/mg-divider/mg-divider.css +0 -9
  286. package/dist/collection/components/atoms/mg-icon/mg-icon.css +0 -138
  287. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +0 -12
  288. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js +0 -18
  289. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js.map +0 -1
  290. package/dist/collection/components/atoms/mg-tag/mg-tag.css +0 -131
  291. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js +0 -37
  292. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js.map +0 -1
  293. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.css +0 -43
  294. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +0 -3
  295. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +0 -268
  296. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +0 -211
  297. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +0 -257
  298. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +0 -254
  299. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +0 -179
  300. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +0 -264
  301. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +0 -304
  302. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js +0 -171
  303. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js.map +0 -1
  304. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +0 -303
  305. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +0 -233
  306. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js +0 -125
  307. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js.map +0 -1
  308. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +0 -37
  309. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.js.map +0 -1
  310. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +0 -377
  311. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js +0 -119
  312. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js.map +0 -1
  313. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +0 -39
  314. package/dist/collection/components/molecules/mg-details/mg-details.css +0 -64
  315. package/dist/collection/components/molecules/mg-form/mg-form.css +0 -19
  316. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +0 -45
  317. package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +0 -30
  318. package/dist/collection/components/molecules/mg-message/mg-message.css +0 -82
  319. package/dist/collection/components/molecules/mg-modal/mg-modal.css +0 -67
  320. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +0 -47
  321. package/dist/collection/components/molecules/mg-panel/mg-panel.css +0 -64
  322. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.css +0 -135
  323. package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -11
  324. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +0 -1
  325. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +0 -28
  326. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -99
  327. package/dist/collection/styles/a11y.scss +0 -36
  328. package/dist/collection/styles/fonts.scss +0 -21
  329. package/dist/collection/styles/form.scss +0 -3
  330. package/dist/collection/styles/global.scss +0 -80
  331. package/dist/collection/styles/layout.scss +0 -29
  332. package/dist/collection/styles/main.scss +0 -23
  333. package/dist/collection/styles/mg-icon-animation.scss +0 -6
  334. package/dist/collection/styles/navigation-button.scss +0 -77
  335. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +0 -11
  336. package/dist/collection/styles/typography.scss +0 -82
  337. package/dist/collection/styles/utilities.scss +0 -21
  338. package/dist/collection/test/typography.e2e.playwright.js +0 -12
  339. package/dist/collection/test/typography.e2e.playwright.js.map +0 -1
  340. package/dist/esm/mg-menu.conf-012fc9b4.js.map +0 -1
  341. package/dist/mg-components/p-1d7d6fa0.js +0 -2
  342. package/dist/mg-components/p-1d7d6fa0.js.map +0 -1
  343. package/dist/mg-components/p-9257e8f1.entry.js +0 -2
  344. package/dist/mg-components/p-9257e8f1.entry.js.map +0 -1
  345. package/dist/mg-components/p-ff3ca349.entry.js +0 -2
  346. package/dist/mg-components/p-ff3ca349.entry.js.map +0 -1
  347. package/dist/mg-components/styles/a11y.scss +0 -36
  348. package/dist/mg-components/styles/fonts.scss +0 -21
  349. package/dist/mg-components/styles/form.scss +0 -3
  350. package/dist/mg-components/styles/global.scss +0 -80
  351. package/dist/mg-components/styles/layout.scss +0 -29
  352. package/dist/mg-components/styles/main.scss +0 -23
  353. package/dist/mg-components/styles/mg-icon-animation.scss +0 -6
  354. package/dist/mg-components/styles/navigation-button.scss +0 -77
  355. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +0 -11
  356. package/dist/mg-components/styles/typography.scss +0 -82
  357. package/dist/mg-components/styles/utilities.scss +0 -21
  358. /package/dist/types/{test/typography.e2e.playwright.d.ts → components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.d.ts} +0 -0
@@ -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,I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B;UACnG,eAAS,IAAI,EAAC,OAAO,GAAW,CACtB,CACb;QACD,WAAK,KAAK,EAAC,2BAA2B;UACpC,YAAM,IAAI,EAAC,OAAO,GAAQ,CACtB;QACN,YAAM,IAAI,EAAC,SAAS,GAAQ,CACpB;MACV,YAAM,IAAI,EAAC,OAAO,GAAQ,CACrB,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, h, Prop, EventEmitter, Event, State } from '@stencil/core';\nimport { isTagName, ClassList } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\n\n@Component({\n tag: 'mg-popover-content',\n styleUrl: 'mg-popover-content.scss',\n shadow: true,\n})\nexport class MgPopoverContent {\n /************\n * Internal *\n ************/\n\n // Locales\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPopoverContentElement;\n\n /**\n * Define if popover has a cross button\n */\n @Prop() closeButton = false;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-popover-content']);\n\n /**\n * Emited event when close button is clicked\n */\n @Event({ eventName: 'hide-content' }) hideContent: EventEmitter<string>;\n\n /**\n * Handle action for close button\n */\n private handleCloseButton = (): void => {\n this.hideContent.emit();\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are valide\n */\n componentWillLoad(): void {\n // Get locales\n this.messages = initLocales(this.element).messages;\n }\n\n /**\n * Check if component slots are valide\n */\n componentDidLoad(): void {\n const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\n\n const slottedTitleElement = this.element.querySelector('[slot=\"title\"]');\n if (slottedTitleElement && !isTagName(slottedTitleElement, headingTags)) {\n throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);\n }\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <mg-card class={this.classCollection.join()}>\n {this.closeButton && (\n <mg-button is-icon variant=\"flat\" label={this.messages.general.close} onClick={this.handleCloseButton}>\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n )}\n <div class=\"mg-popover-content__title\">\n <slot name=\"title\"></slot>\n </div>\n <slot name=\"content\"></slot>\n </mg-card>\n <slot name=\"arrow\"></slot>\n </Host>\n );\n }\n}\n"]}
1
+ {"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"]}
@@ -183,12 +183,12 @@ export class MgPopover {
183
183
  static get encapsulation() { return "shadow"; }
184
184
  static get originalStyleUrls() {
185
185
  return {
186
- "$": ["mg-popover.scss"]
186
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-popover.css"]
187
187
  };
188
188
  }
189
189
  static get styleUrls() {
190
190
  return {
191
- "$": ["mg-popover.css"]
191
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-popover.css"]
192
192
  };
193
193
  }
194
194
  static get properties() {
@@ -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,E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event } from '@stencil/core';\nimport { createID, getWindows } from '../../../utils/components.utils';\nimport { Instance as PopperInstance, createPopper, Placement } from '@popperjs/core';\n\n@Component({\n tag: 'mg-popover',\n styleUrl: 'mg-popover.scss',\n shadow: true,\n})\nexport class MgPopover {\n /************\n * Internal *\n ************/\n\n private popper: PopperInstance;\n private mgPopover: HTMLElement;\n private mgPopoverContent: HTMLMgPopoverContentElement;\n private windows: Window[];\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPopoverElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-popover');\n @Watch('identifier')\n validateIdentifier(): void {\n // use renderPopoverContent to update popover-content id\n this.renderPopoverContent();\n }\n\n /**\n * Popover placement\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Hide popover arrow\n */\n @Prop() arrowHide = false;\n @Watch('arrowHide')\n validateArrowHide(newValue: MgPopover['arrowHide']): void {\n if (newValue) this.mgPopoverContent.dataset.arrowHide = '';\n else delete this.mgPopoverContent.dataset.arrowHide;\n }\n\n /**\n * Define if popover has a cross button\n */\n @Prop() closeButton = false;\n @Watch('closeButton')\n validateCloseButton(newValue: MgPopover['arrowHide']): void {\n this.mgPopoverContent.closeButton = newValue;\n }\n\n /**\n * Display popover\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n handleDisplay(newValue: boolean): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n this.displayChange.emit(newValue);\n }\n\n /**\n * Disable popover\n */\n @Prop() disabled = false;\n\n /**\n * Emited event when display value change\n */\n @Event({ eventName: 'display-change' }) displayChange: EventEmitter<boolean>;\n\n /**\n * Check if clicked outside of component\n * @param event - mouse event\n */\n private clickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n const closestElement: HTMLElement = event.target.closest(`[data-mg-popover-guard]`);\n if (!this.disabled && event.target.closest('mg-popover') !== this.element && closestElement?.dataset.mgPopoverGuard !== this.identifier) {\n this.display = false;\n }\n };\n\n /**\n * Show popover\n */\n private show = (): void => {\n // Make the popover visible\n this.mgPopover.dataset.show = '';\n // Enable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }],\n }));\n // hide when click outside\n // setTimeout is used to prevent event to trigger after creation\n setTimeout(() => {\n this.windows.forEach((localWindow: Window) => {\n localWindow.addEventListener('click', this.clickOutside, false);\n });\n }, 0);\n };\n\n /**\n * Hide popover\n */\n private hide = (): void => {\n // Hide the popover\n this.mgPopover.removeAttribute('data-show');\n // Disable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }],\n }));\n // Remove event listener\n this.windows.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.clickOutside, false);\n });\n };\n\n /**\n * Handle content hide event\n */\n private handleHideContent = (): void => {\n this.display = false;\n };\n\n /**\n * Render popover content element\n */\n private renderPopoverContent = (): void => {\n const mgPopoverContent = this.element.querySelector('mg-popover-content');\n if (mgPopoverContent === null) {\n this.mgPopoverContent = document.createElement('mg-popover-content');\n this.mgPopoverContent.setAttribute('slot', 'content');\n this.mgPopoverContent.setAttribute('id', this.identifier);\n this.mgPopoverContent.addEventListener('hide-content', this.handleHideContent);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.popperArrow = '';\n this.mgPopoverContent.appendChild(arrow);\n\n // insert elements in DOM\n ['[slot=\"title\"]', '[slot=\"content\"]:not(mg-popover-content)'].forEach(slotType => {\n Array.from(this.element.querySelectorAll(slotType)).forEach(slot => {\n this.mgPopoverContent.appendChild(slot);\n });\n });\n this.element.appendChild(this.mgPopoverContent);\n } else {\n mgPopoverContent.setAttribute('id', this.identifier);\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.popper.update();\n }\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n // render mg-popover-content slot\n this.renderPopoverContent();\n this.validateCloseButton(this.closeButton);\n this.validateIdentifier();\n this.validateArrowHide(this.arrowHide);\n }\n\n /**\n * Check if component props are well configured on init\n */\n componentDidLoad(): void {\n // Get popover content\n this.mgPopover = this.element.querySelector(`#${this.identifier}`);\n\n //Get interactive element (first element without slot attribute)\n const interactiveElement: HTMLElement = this.element.querySelector(':not([slot])');\n // Add aria attributes\n interactiveElement.setAttribute('aria-controls', this.identifier);\n interactiveElement.setAttribute('aria-expanded', `${this.display}`);\n\n // Create popperjs popover\n this.popper = createPopper(interactiveElement, this.mgPopover, {\n placement: this.placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 0],\n },\n },\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['auto'],\n },\n },\n ],\n });\n\n // add resize observer\n new ResizeObserver(() => {\n this.popper.update();\n }).observe(this.element.querySelector('mg-popover-content'));\n\n // Add events to toggle display\n interactiveElement.addEventListener('click', () => {\n if (!this.disabled) this.display = !this.display;\n });\n\n // Add events to hide popover\n this.element.addEventListener('keydown', e => {\n if (!this.disabled && e.code === 'Escape') {\n this.display = false;\n interactiveElement.focus();\n }\n });\n\n this.handleDisplay(this.display);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"]}
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;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AAO,EAAE;YACP,kBAAkB,EAAE,CAAC,MAAM,CAAC;WAC7B;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: '../../../../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"]}
@@ -1,7 +1,8 @@
1
- import { createPage } from "../../../../utils/stencil.e2e.test.utils";
1
+ import { setPageContent, expect, describe, describeEach, testEach, test } from "../../../../utils/playwright.e2e.test.utils";
2
2
  import { renderAttributes } from "../../../../utils/e2e.test.utils";
3
+ const TIMEOUT = 1000;
3
4
  describe('mg-popover', () => {
4
- describe.each([
5
+ describeEach([
5
6
  'auto',
6
7
  'auto-start',
7
8
  'auto-end',
@@ -18,8 +19,8 @@ describe('mg-popover', () => {
18
19
  'left-start',
19
20
  'left-end',
20
21
  ])('placement %s', placement => {
21
- test.each([true, false])('Should render, case hide arrow %s', async (arrowHide) => {
22
- const page = await createPage(`<style>mg-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>
22
+ testEach([true, false])('Should render, case hide arrow %s', async (page, arrowHide) => {
23
+ await setPageContent(page, `<style>mg-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>
23
24
  <mg-popover ${renderAttributes({ placement, arrowHide })}>
24
25
  <mg-button>Button</mg-button>
25
26
  <h2 slot="title">Blu bli blo bla</h2>
@@ -31,43 +32,36 @@ describe('mg-popover', () => {
31
32
  cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
32
33
  non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
33
34
  </p>
34
- </mg-popover>`);
35
- const mgPopover = await page.find('mg-popover');
36
- const mgButton = await page.find('mg-button');
37
- const popover = await page.find('mg-popover mg-popover-content');
38
- expect(mgPopover).toHaveClass('hydrated');
35
+ </mg-popover>`, { height: 900, width: 900 });
36
+ const mgPopover = await page.locator('mg-popover');
37
+ const mgButton = await page.locator('mg-button');
38
+ const mgPopoverContent = await page.locator('mg-popover-content');
39
+ await mgPopover.waitFor({ timeout: TIMEOUT });
39
40
  // display popover on click on slotted element
40
- mgButton.triggerEvent('click');
41
- await page.waitForChanges();
42
- await page.waitForNetworkIdle();
43
- expect(popover).toHaveAttribute('data-show');
44
- await page.setViewport({ width: 1200, height: 1200 });
45
- const screenshot = await page.screenshot();
46
- expect(screenshot).toMatchImageSnapshot();
41
+ await mgButton.click();
42
+ await mgPopoverContent.waitFor({ timeout: TIMEOUT });
43
+ expect(await mgPopoverContent.getAttribute('data-show')).toEqual('');
44
+ await expect(page.locator('body')).toHaveScreenshot();
47
45
  // hide popover on click on slotted element
48
- mgButton.triggerEvent('click');
49
- await page.waitForChanges();
50
- await page.waitForNetworkIdle();
51
- expect(popover).not.toHaveAttribute('data-show');
46
+ await mgButton.click();
47
+ expect(await mgPopoverContent.getAttribute('data-show')).toEqual(null);
52
48
  // display popover on keyboad click event on slotted element
53
49
  await page.keyboard.down('Tab');
50
+ await page.keyboard.down('Tab');
54
51
  await page.keyboard.down('Enter');
55
- await page.waitForChanges();
56
- await page.waitForNetworkIdle();
57
- expect(popover).toHaveAttribute('data-show');
52
+ await mgPopoverContent.waitFor({ timeout: TIMEOUT });
53
+ expect(await mgPopoverContent.getAttribute('data-show')).toEqual('');
58
54
  // hide popover on keyboad escape key
59
55
  await page.keyboard.down('Escape');
60
- await page.waitForChanges();
61
- await page.waitForNetworkIdle();
62
- expect(popover).not.toHaveAttribute('data-show');
56
+ expect(await mgPopoverContent.getAttribute('data-show')).toEqual(null);
63
57
  });
64
58
  });
65
- describe.each([
59
+ describeEach([
66
60
  '',
67
61
  '<h2 slot="title">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>',
68
- ])('with or without title', title => {
69
- test('Should render with close button', async () => {
70
- const page = await createPage(`<mg-popover display close-button>
62
+ ])('with or without title %s', title => {
63
+ test('Should render with close button', async ({ page }) => {
64
+ await setPageContent(page, `<mg-popover display close-button>
71
65
  <mg-button>Button</mg-button>
72
66
  ${title}
73
67
  <p slot="content">
@@ -78,48 +72,41 @@ describe('mg-popover', () => {
78
72
  cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
79
73
  non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
80
74
  </p>
81
- </mg-popover>`);
82
- const mgPopover = await page.find('mg-popover');
83
- expect(mgPopover).toHaveClass('hydrated');
84
- await page.setViewport({ width: 500, height: 350 });
85
- const screenshot = await page.screenshot();
86
- expect(screenshot).toMatchImageSnapshot();
75
+ </mg-popover>`, { width: 400, height: 350 });
76
+ await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });
77
+ await expect(page.locator('body')).toHaveScreenshot();
87
78
  });
88
79
  });
89
- describe.each(['title', 'content'])('re-position %s slot', slot => {
90
- test('should re-position when slot size change', async () => {
80
+ describeEach(['title', 'content'])('re-position %s slot', slot => {
81
+ test('should re-position when slot size change', async ({ page }) => {
91
82
  const tagName = slot === 'title' ? 'h2' : 'p';
92
- const page = await createPage(`<style>mg-button{position:fixed;left:50%;transform:translateX(-50%)}</style>
83
+ await setPageContent(page, `<style>mg-button{position:fixed;left:50%;transform:translateX(-50%)}</style>
93
84
  <mg-popover ${renderAttributes({ placement: 'bottom-start', display: true })}>
94
85
  <mg-button>Button</mg-button>
95
86
  <${tagName} slot="${slot}">
96
87
  Lorem ipsum
97
88
  </${tagName}>
98
89
  </mg-popover>`, { width: 400, height: 130 });
99
- let screenshot = await page.screenshot();
100
- expect(screenshot).toMatchImageSnapshot();
90
+ await expect(page.locator('body')).toHaveScreenshot();
101
91
  await page.$eval(`mg-popover-content [slot="${slot}"]`, el => {
102
92
  el.textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
103
93
  });
104
- await page.waitForChanges();
105
- screenshot = await page.screenshot();
106
- expect(screenshot).toMatchImageSnapshot();
94
+ await expect(page.locator('body')).toHaveScreenshot();
107
95
  });
108
96
  });
109
- test(`should position popover where it have enough place`, async () => {
110
- const page = await createPage(`<style>mg-button{position:fixed;left:0;bottom:0}</style>
97
+ test(`should position popover where it have enough place`, async ({ page }) => {
98
+ await setPageContent(page, `<style>mg-button{position:fixed;left:0;bottom:0}</style>
111
99
  <mg-popover ${renderAttributes({ display: true })}>
112
100
  <mg-button>Button</mg-button>
113
101
  <p slot="content">
114
102
  Lorem ipsum
115
103
  </p>
116
104
  </mg-popover>`, { width: 400, height: 100 });
117
- const screenshot = await page.screenshot();
118
- expect(screenshot).toMatchImageSnapshot();
105
+ await expect(page.locator('body')).toHaveScreenshot();
119
106
  });
120
107
  describe('style', () => {
121
- test('Should render with child mg-card', async () => {
122
- const page = await createPage(`<mg-popover display close-button class="custom-popover-card">
108
+ test('Should render with child mg-card', async ({ page }) => {
109
+ await setPageContent(page, `<mg-popover display close-button class="custom-popover-card">
123
110
  <mg-button>Button</mg-button>
124
111
  <mg-card slot="content">
125
112
  My custom card
@@ -130,15 +117,12 @@ describe('mg-popover', () => {
130
117
  --mg-popover-background-color: var(--color-danger);
131
118
  }
132
119
  </style>
133
- `);
134
- const mgPopover = await page.find('mg-popover');
135
- expect(mgPopover).toHaveClass('hydrated');
136
- await page.setViewport({ width: 500, height: 300 });
137
- const screenshot = await page.screenshot();
138
- expect(screenshot).toMatchImageSnapshot();
120
+ `, { width: 150, height: 180 });
121
+ await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });
122
+ await expect(page.locator('body')).toHaveScreenshot();
139
123
  });
140
- test.each(['content', 'title'])('Should render with --mg-popover-max-width', async (slot) => {
141
- const page = await createPage(`<mg-popover display close-button class="custom-popover">
124
+ testEach(['content', 'title'])('Should render with --mg-popover-max-width %s', async (page, slot) => {
125
+ await setPageContent(page, `<mg-popover display close-button class="custom-popover">
142
126
  <mg-button>Button</mg-button>
143
127
  <h2 slot="${slot}">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>
144
128
  </mg-popover>
@@ -147,13 +131,10 @@ describe('mg-popover', () => {
147
131
  --mg-popover-max-width: 10rem;
148
132
  }
149
133
  </style>
150
- `);
151
- const mgPopover = await page.find('mg-popover');
152
- expect(mgPopover).toHaveClass('hydrated');
153
- await page.setViewport({ width: 500, height: 300 });
154
- const screenshot = await page.screenshot();
155
- expect(screenshot).toMatchImageSnapshot();
134
+ `, { width: 300, height: 300 });
135
+ await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });
136
+ await expect(page.locator('body')).toHaveScreenshot();
156
137
  });
157
138
  });
158
139
  });
159
- //# sourceMappingURL=mg-popover.e2e.js.map
140
+ //# sourceMappingURL=mg-popover.e2e.playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-popover.e2e.playwright.js","sourceRoot":"","sources":["../../../../../src/components/molecules/mg-popover/test/mg-popover.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAY,IAAI,EAAE,MAAM,6CAA6C,CAAC;AACvI,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,OAAO,GAAG,IAAI,CAAC;AAErB,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,YAAY,CAAC;IACX,MAAM;IACN,YAAY;IACZ,UAAU;IACV,KAAK;IACL,WAAW;IACX,SAAS;IACT,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,OAAO;IACP,aAAa;IACb,WAAW;IACX,MAAM;IACN,YAAY;IACZ,UAAU;GACX,CAAC,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE;IAC7B,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,mCAAmC,EAAE,KAAK,EAAE,IAAc,EAAE,SAAS,EAAE,EAAE;MAC/F,MAAM,cAAc,CAClB,IAAI,EACJ;sBACc,gBAAgB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;;;;;;;;;;;sBAW1C,EACd,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAC5B,CAAC;MAEF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;MACnD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;MACjD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;MAElE,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;MAE9C,8CAA8C;MAC9C,MAAM,QAAQ,C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C,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;MAExE,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { setPageContent, expect, describe, describeEach, testEach, PageType, test } from '../../../../utils/playwright.e2e.test.utils';\nimport { renderAttributes } from '../../../../utils/e2e.test.utils';\n\nconst TIMEOUT = 1000;\n\ndescribe('mg-popover', () => {\n describeEach([\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'top-start',\n 'top-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'right',\n 'right-start',\n 'right-end',\n 'left',\n 'left-start',\n 'left-end',\n ])('placement %s', placement => {\n testEach([true, false])('Should render, case hide arrow %s', async (page: PageType, arrowHide) => {\n await setPageContent(\n page,\n `<style>mg-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>\n <mg-popover ${renderAttributes({ placement, arrowHide })}>\n <mg-button>Button</mg-button>\n <h2 slot=\"title\">Blu bli blo bla</h2>\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n </mg-popover>`,\n { height: 900, width: 900 },\n );\n\n const mgPopover = await page.locator('mg-popover');\n const mgButton = await page.locator('mg-button');\n const mgPopoverContent = await page.locator('mg-popover-content');\n\n await mgPopover.waitFor({ timeout: TIMEOUT });\n\n // display popover on click on slotted element\n await mgButton.click();\n\n await mgPopoverContent.waitFor({ timeout: TIMEOUT });\n\n expect(await mgPopoverContent.getAttribute('data-show')).toEqual('');\n\n await expect(page.locator('body')).toHaveScreenshot();\n\n // hide popover on click on slotted element\n await mgButton.click();\n\n expect(await mgPopoverContent.getAttribute('data-show')).toEqual(null);\n\n // display popover on keyboad click event on slotted element\n await page.keyboard.down('Tab');\n await page.keyboard.down('Tab');\n await page.keyboard.down('Enter');\n\n await mgPopoverContent.waitFor({ timeout: TIMEOUT });\n expect(await mgPopoverContent.getAttribute('data-show')).toEqual('');\n\n // hide popover on keyboad escape key\n await page.keyboard.down('Escape');\n\n expect(await mgPopoverContent.getAttribute('data-show')).toEqual(null);\n });\n });\n\n describeEach([\n '',\n '<h2 slot=\"title\">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>',\n ])('with or without title %s', title => {\n test('Should render with close button', async ({ page }) => {\n await setPageContent(\n page,\n `<mg-popover display close-button>\n <mg-button>Button</mg-button>\n ${title}\n <p slot=\"content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n </p>\n </mg-popover>`,\n { width: 400, height: 350 },\n );\n\n await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n });\n\n describeEach(['title', 'content'])('re-position %s slot', slot => {\n test('should re-position when slot size change', async ({ page }) => {\n const tagName = slot === 'title' ? 'h2' : 'p';\n await setPageContent(\n page,\n `<style>mg-button{position:fixed;left:50%;transform:translateX(-50%)}</style>\n <mg-popover ${renderAttributes({ placement: 'bottom-start', display: true })}>\n <mg-button>Button</mg-button>\n <${tagName} slot=\"${slot}\">\n Lorem ipsum\n </${tagName}>\n </mg-popover>`,\n { width: 400, height: 130 },\n );\n\n await expect(page.locator('body')).toHaveScreenshot();\n\n await page.$eval(`mg-popover-content [slot=\"${slot}\"]`, el => {\n el.textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';\n });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n });\n\n test(`should position popover where it have enough place`, async ({ page }) => {\n await setPageContent(\n page,\n `<style>mg-button{position:fixed;left:0;bottom:0}</style>\n <mg-popover ${renderAttributes({ display: true })}>\n <mg-button>Button</mg-button>\n <p slot=\"content\">\n Lorem ipsum\n </p>\n </mg-popover>`,\n { width: 400, height: 100 },\n );\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n\n describe('style', () => {\n test('Should render with child mg-card', async ({ page }) => {\n await setPageContent(\n page,\n `<mg-popover display close-button class=\"custom-popover-card\">\n <mg-button>Button</mg-button>\n <mg-card slot=\"content\">\n My custom card\n </mg-card>\n </mg-popover>\n <style>\n .custom-popover-card {\n --mg-popover-background-color: var(--color-danger);\n }\n </style>\n `,\n { width: 150, height: 180 },\n );\n\n await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n\n testEach(['content', 'title'])('Should render with --mg-popover-max-width %s', async (page: PageType, slot) => {\n await setPageContent(\n page,\n `<mg-popover display close-button class=\"custom-popover\">\n <mg-button>Button</mg-button>\n <h2 slot=\"${slot}\">Titre un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long un peu plus long</h2>\n </mg-popover>\n <style>\n .custom-popover {\n --mg-popover-max-width: 10rem;\n }\n </style>\n `,\n { width: 300, height: 300 },\n );\n\n await page.locator('mg-popover.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n });\n});\n"]}
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable jsx-a11y/no-redundant-roles */
2
2
  import { h } from "@stencil/core";
3
3
  import { initLocales } from "../../../locales";
4
+ import { isValidString } from "../../../utils/components.utils";
4
5
  export class MgSkipLinks {
5
6
  constructor() {
6
7
  /***********
@@ -17,9 +18,7 @@ export class MgSkipLinks {
17
18
  this.links = undefined;
18
19
  }
19
20
  validateLinks(links) {
20
- if (links === undefined ||
21
- links.length === 0 ||
22
- links.some(link => link.href === undefined || !link.href.startsWith('#') || link.label === undefined || link.label.trim() === '')) {
21
+ if (links === undefined || links.length === 0 || links.some(link => !isValidString(link.href) || !link.href.startsWith('#') || !isValidString(link.label))) {
23
22
  throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
24
23
  }
25
24
  }
@@ -38,18 +37,18 @@ export class MgSkipLinks {
38
37
  * @returns HTML Element
39
38
  */
40
39
  render() {
41
- return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
40
+ return (h("nav", { class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
42
41
  }
43
42
  static get is() { return "mg-skip-links"; }
44
43
  static get encapsulation() { return "shadow"; }
45
44
  static get originalStyleUrls() {
46
45
  return {
47
- "$": ["mg-skip-links.scss"]
46
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-skip-links.css"]
48
47
  };
49
48
  }
50
49
  static get styleUrls() {
51
50
  return {
52
- "$": ["mg-skip-links.css"]
51
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-skip-links.css"]
53
52
  };
54
53
  }
55
54
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"mg-skip-links.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-skip-links/mg-skip-links.tsx"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,MAAM,OAAO,WAAW;;IAoCtB;;gBAEY;IAEZ;;;OAGG;IACK,oBAAe,GAAG,CAAC,KAAkD,EAAQ,EAAE;MACrF,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;MAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;;;EA1BF,aAAa,CAAC,KAAiB;IAC7B,IACE,KAAK,KAAK,SAAS;MACnB,KAAK,CAAC,MAAM,KAAK,CAAC;MAClB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EACjI;MACA,MAAM,IAAI,KAAK,CAAC,yIAAyI,CAAC,CAAC;KAC5J;EACH,CAAC;EAoBD;;iBAEe;EAEf;;KAEG;EACH,iBAAiB;IACf,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;EACrD,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,WAAK,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,YAAY,gBAAa,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ;MACvF,UAAI,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAC,MAAM,IACxC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACtB,UAAI,GAAG,EAAE,IAAI,CAAC,IAAI;QAChB,SAAG,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,IAC1E,IAAI,CAAC,KAAK,CACT,CACD,CACN,CAAC,CACC,CACD,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/* eslint-disable jsx-a11y/no-redundant-roles */\nimport { Component, Element, Event, EventEmitter, h, Prop, Watch } from '@stencil/core';\nimport { SkipLink } from './mg-skip-links.conf';\nimport { initLocales } from '../../../locales';\n\n@Component({\n tag: 'mg-skip-links',\n styleUrl: 'mg-skip-links.scss',\n shadow: true,\n})\nexport class MgSkipLinks {\n /************\n * Internal *\n ************/\n\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgSkipLinksElement;\n\n /**\n * Skip links\n */\n @Prop() links: SkipLink[];\n @Watch('links')\n validateLinks(links: SkipLink[]): void {\n if (\n links === undefined ||\n links.length === 0 ||\n links.some(link => link.href === undefined || !link.href.startsWith('#') || link.label === undefined || link.label.trim() === '')\n ) {\n throw new Error(`<mg-skip-links> prop \"links\": Cannot be empty and each link must contains an href starting with a \"#\" and a non empty label attributes.`);\n }\n }\n\n /**\n * Emited event when link is clicked\n */\n @Event({ eventName: 'go-to-anchor' }) goToAnchor: EventEmitter<string>;\n\n /***********\n * Methods *\n **********/\n\n /**\n * Handle link click and emit go-to-anchor event\n * @param event - mouse event\n */\n private handleLinkCLick = (event: MouseEvent & { currentTarget: HTMLElement }): void => {\n event.currentTarget.blur();\n this.goToAnchor.emit(event.currentTarget.getAttribute('href'));\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateLinks(this.links);\n this.messages = initLocales(this.element).messages;\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <nav class=\"mg-skip-links\" role=\"navigation\" aria-label={this.messages.skipLinks.navLabel}>\n <ul class=\"mg-skip-links__list\" role=\"list\">\n {this.links.map(link => (\n <li key={link.href}>\n <a class=\"mg-skip-links__link\" href={link.href} onClick={this.handleLinkCLick}>\n {link.label}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-skip-links.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-skip-links/mg-skip-links.tsx"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAOhE,MAAM,OAAO,WAAW;;IAgCtB;;gBAEY;IAEZ;;;OAGG;IACK,oBAAe,GAAG,CAAC,KAAkD,EAAQ,EAAE;MACrF,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;MAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;;;EAtBF,aAAa,CAAC,KAAiB;IAC7B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;MAC1J,MAAM,IAAI,KAAK,CAAC,yIAAyI,CAAC,CAAC;KAC5J;EACH,CAAC;EAoBD;;iBAEe;EAEf;;KAEG;EACH,iBAAiB;IACf,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;EACrD,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,WAAK,KAAK,EAAC,iBAAiB,EAAC,IAAI,EAAC,YAAY,gBAAa,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ;MACzF,UAAI,KAAK,EAAC,uBAAuB,EAAC,IAAI,EAAC,MAAM,IAC1C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACtB,UAAI,GAAG,EAAE,IAAI,CAAC,IAAI;QAChB,SAAG,KAAK,EAAC,uBAAuB,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,IAC5E,IAAI,CAAC,KAAK,CACT,CACD,CACN,CAAC,CACC,CACD,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/* eslint-disable jsx-a11y/no-redundant-roles */\nimport { Component, Element, Event, EventEmitter, h, Prop, Watch } from '@stencil/core';\nimport { SkipLink } from './mg-skip-links.conf';\nimport { initLocales } from '../../../locales';\nimport { isValidString } from '../../../utils/components.utils';\n\n@Component({\n tag: 'mg-skip-links',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-skip-links.css',\n shadow: true,\n})\nexport class MgSkipLinks {\n /************\n * Internal *\n ************/\n\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgSkipLinksElement;\n\n /**\n * Skip links\n */\n @Prop() links: SkipLink[];\n @Watch('links')\n validateLinks(links: SkipLink[]): void {\n if (links === undefined || links.length === 0 || links.some(link => !isValidString(link.href) || !link.href.startsWith('#') || !isValidString(link.label))) {\n throw new Error(`<mg-skip-links> prop \"links\": Cannot be empty and each link must contains an href starting with a \"#\" and a non empty label attributes.`);\n }\n }\n\n /**\n * Emited event when link is clicked\n */\n @Event({ eventName: 'go-to-anchor' }) goToAnchor: EventEmitter<string>;\n\n /***********\n * Methods *\n **********/\n\n /**\n * Handle link click and emit go-to-anchor event\n * @param event - mouse event\n */\n private handleLinkCLick = (event: MouseEvent & { currentTarget: HTMLElement }): void => {\n event.currentTarget.blur();\n this.goToAnchor.emit(event.currentTarget.getAttribute('href'));\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateLinks(this.links);\n this.messages = initLocales(this.element).messages;\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <nav class=\"mg-c-skip-links\" role=\"navigation\" aria-label={this.messages.skipLinks.navLabel}>\n <ul class=\"mg-c-skip-links__list\" role=\"list\">\n {this.links.map(link => (\n <li key={link.href}>\n <a class=\"mg-c-skip-links__link\" href={link.href} onClick={this.handleLinkCLick}>\n {link.label}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n );\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { h } from "@stencil/core";
2
- import { createID, ClassList, allItemsAreString } from "../../../utils/components.utils";
2
+ import { createID, ClassList, allItemsAreString, isValidString } from "../../../utils/components.utils";
3
3
  import { sizes, Status } from "./mg-tabs.conf";
4
4
  /**
5
5
  * type TabItem validation function
@@ -14,8 +14,14 @@ export class MgTabs {
14
14
  ************/
15
15
  // classes
16
16
  this.tabPanel = 'panel';
17
- this.buttonTabBaseClass = 'mg-tabs__navigation-button';
17
+ this.buttonTabBaseClass = 'mg-c-tabs__navigation-button';
18
18
  this.startIndex = 1;
19
+ /**
20
+ * Validate that new tab status can be `Status.ACTIVE`
21
+ * @param tab - tab item
22
+ * @returns true when tab match condition to get a `Status.ACTIVE`
23
+ */
24
+ this.isActivableTab = (tab) => [undefined, Status.ACTIVE, Status.VISIBLE].includes(tab.status);
19
25
  /**
20
26
  * Method to know if given tab has the given status
21
27
  * @param tab - item tab key to set to ACTIVE status
@@ -36,19 +42,13 @@ export class MgTabs {
36
42
  * @returns index
37
43
  */
38
44
  this.getTabItemIndex = (index) => index + this.startIndex;
39
- /**
40
- * Method to get the active-tab value
41
- * @returns of the active-tab
42
- */
43
- this.getActiveTab = () => this.activeTab || this.getTabItemIndex(this.tabs.map((tab, index) => (Object.assign(Object.assign({}, tab), { index }))).find(tab => this.tabHasStatus(tab, Status.ACTIVE)).index);
44
45
  /**
45
46
  * Handle click events on tabs
46
47
  * @param event - mouse event
47
48
  */
48
49
  this.handleClick = (event) => {
49
50
  const tabId = event.currentTarget.dataset.index;
50
- const tab = this.tabs[Number(tabId) - this.startIndex];
51
- if (this.tabHasStatus(tab, Status.HIDDEN) || this.tabHasStatus(tab, Status.DISABLED)) {
51
+ if (!this.isActivableTab(this.tabs[Number(tabId) - this.startIndex])) {
52
52
  event.preventDefault();
53
53
  }
54
54
  else {
@@ -108,7 +108,7 @@ export class MgTabs {
108
108
  setTimeout(() => {
109
109
  this.tabFocus = undefined;
110
110
  Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
111
- tab.setAttribute('tabindex', this.getActiveTab() - this.startIndex !== index ? '-1' : '0');
111
+ tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
112
112
  });
113
113
  }, 0);
114
114
  };
@@ -126,10 +126,10 @@ export class MgTabs {
126
126
  this.items = undefined;
127
127
  this.activeTab = undefined;
128
128
  this.tabs = [];
129
- this.classCollection = new ClassList(['mg-tabs']);
129
+ this.classCollection = new ClassList(['mg-c-tabs']);
130
130
  }
131
131
  validateLabel(newValue) {
132
- if (typeof newValue !== 'string' || newValue.trim() === '') {
132
+ if (!isValidString(newValue)) {
133
133
  throw new Error('<mg-tabs> prop "label" is required.');
134
134
  }
135
135
  }
@@ -137,42 +137,42 @@ export class MgTabs {
137
137
  if (!sizes.includes(newValue)) {
138
138
  throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}`);
139
139
  }
140
- this.classCollection.add(`mg-tabs--size-${this.size}`);
140
+ this.classCollection.add(`mg-c-tabs--size-${this.size}`);
141
141
  }
142
142
  validateItems(newValue) {
143
143
  // String array
144
- if (allItemsAreString(newValue)) {
145
- this.tabs = newValue.map((item, index) => ({ label: item, status: index === 0 ? Status.ACTIVE : Status.VISIBLE }));
146
- }
144
+ if (allItemsAreString(newValue))
145
+ this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
147
146
  // Object array
148
- else if (newValue && newValue.length > 0 && newValue.every(item => isTabItem(item))) {
147
+ else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
149
148
  this.tabs = newValue;
150
- // init active tabs if not set. Default: index 0.
151
- if (this.tabs.find(tab => this.tabHasStatus(tab, Status.ACTIVE)) === undefined)
152
- this.tabs[0].status = Status.ACTIVE;
153
- }
154
- else {
149
+ else
155
150
  throw new Error('<mg-tabs> prop "items" is required and all items must be the same type: TabItem.');
156
- }
157
151
  }
158
152
  validateActiveTab(newValue) {
159
- if (typeof newValue === 'number' && newValue >= 1 && newValue <= this.tabs.length) {
153
+ // when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
154
+ // after setting new value to `active-tab` the validate will be triggered again with the updated value and process the tab update
155
+ if (newValue === undefined) {
156
+ this.activeTab = this.tabs.some(tab => this.tabHasStatus(tab, Status.ACTIVE))
157
+ ? this.getTabItemIndex(this.tabs.findIndex(tab => this.tabHasStatus(tab, Status.ACTIVE)))
158
+ : this.startIndex;
159
+ }
160
+ else if (typeof newValue === 'number' && newValue >= this.startIndex && newValue <= this.tabs.length && this.isActivableTab(this.tabs[newValue - this.startIndex])) {
161
+ // if new 'active-tab' is activable we update tab status to ACTIVE and toggle past ACTIVE to VISIBLE
160
162
  this.tabs.forEach((tab, index) => {
161
163
  const isNewActiveTab = index === newValue - this.startIndex;
162
164
  // reset active tabs
163
165
  if (this.tabHasStatus(tab, Status.ACTIVE) && !isNewActiveTab)
164
166
  tab.status = Status.VISIBLE;
165
167
  // set active tab from given tab key
166
- else if ((tab.status === undefined || this.tabHasStatus(tab, Status.VISIBLE)) && isNewActiveTab)
168
+ else if (this.isActivableTab(tab) && isNewActiveTab)
167
169
  tab.status = Status.ACTIVE;
168
170
  });
169
171
  // emit change active tab key event
170
- if (this.tabs.find(tab => this.tabHasStatus(tab, Status.ACTIVE)) !== undefined) {
171
- this.activeTabChange.emit(newValue);
172
- }
172
+ this.activeTabChange.emit(newValue);
173
173
  }
174
- else if (newValue !== undefined) {
175
- throw new Error('<mg-tabs> prop "activeTab" must be between 1 and tabs length.');
174
+ else {
175
+ throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable".`);
176
176
  }
177
177
  }
178
178
  /*************
@@ -203,24 +203,24 @@ export class MgTabs {
203
203
  * @returns HTML Element
204
204
  */
205
205
  render() {
206
- return (h("div", { class: this.classCollection.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
206
+ return (h("div", { class: this.classCollection.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
207
207
  [`${this.buttonTabBaseClass}`]: true,
208
208
  [`${this.buttonTabBaseClass}--horizontal`]: true,
209
209
  [`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
210
210
  [`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasStatus(tab, Status.DISABLED),
211
211
  [`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasStatus(tab, Status.HIDDEN),
212
- }, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
212
+ }, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-c-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
213
213
  }
214
214
  static get is() { return "mg-tabs"; }
215
215
  static get encapsulation() { return "shadow"; }
216
216
  static get originalStyleUrls() {
217
217
  return {
218
- "$": ["mg-tabs.scss"]
218
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-tabs.css"]
219
219
  };
220
220
  }
221
221
  static get styleUrls() {
222
222
  return {
223
- "$": ["mg-tabs.css"]
223
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-tabs.css"]
224
224
  };
225
225
  }
226
226
  static get properties() {