@mgdis/mg-components 5.29.0 → 6.0.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 (332) hide show
  1. package/{readme.md → README.md} +1 -1
  2. package/dist/cjs/{index-8a3adbd1.js → index-08ee93bf.js} +18 -70
  3. package/dist/cjs/index-08ee93bf.js.map +1 -0
  4. package/dist/cjs/{index-e1a25816.js → index-d57c96a9.js} +14 -13
  5. package/dist/cjs/index-d57c96a9.js.map +1 -0
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/mg-action-more_36.cjs.entry.js +606 -781
  8. package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
  9. package/dist/cjs/mg-alert.cjs.entry.js +161 -0
  10. package/dist/cjs/mg-alert.cjs.entry.js.map +1 -0
  11. package/dist/cjs/mg-components.cjs.js +2 -2
  12. package/dist/cjs/mg-loader.cjs.entry.js +6 -6
  13. package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
  14. package/dist/collection/assets/icons/index.js +1 -1
  15. package/dist/collection/assets/icons/index.js.map +1 -1
  16. package/dist/collection/collection-manifest.json +4 -3
  17. package/dist/collection/components/atoms/{mg-character-left → internals/mg-character-left}/mg-character-left.js +9 -5
  18. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js.map +1 -0
  19. package/dist/collection/components/atoms/{mg-input-title → internals/mg-input-title}/mg-input-title.js +4 -4
  20. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js.map +1 -0
  21. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js.map +1 -1
  22. package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -6
  23. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  24. package/dist/collection/components/atoms/mg-button/mg-button.conf.js.map +1 -1
  25. package/dist/collection/components/atoms/mg-button/mg-button.js +4 -22
  26. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  27. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -113
  28. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  29. package/dist/collection/components/atoms/mg-divider/mg-divider.js +9 -9
  30. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  31. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -1
  32. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js.map +1 -1
  33. package/dist/collection/components/atoms/mg-icon/mg-icon.js +11 -11
  34. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  35. package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js.map +1 -1
  36. package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
  37. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  38. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
  39. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +6 -7
  40. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  41. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +36 -20
  42. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  43. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +0 -9
  44. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -1
  45. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +15 -60
  46. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
  47. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +16 -48
  48. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  49. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +5 -23
  50. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  51. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +127 -30
  52. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  53. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +1 -8
  54. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -1
  55. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +20 -21
  56. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  57. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +1 -8
  58. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +45 -30
  60. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  61. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +8 -8
  62. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  63. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -10
  64. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  65. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js.map +1 -1
  66. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +12 -12
  67. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  68. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -1
  69. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +71 -35
  70. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  71. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +21 -21
  72. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  73. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +7 -7
  74. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  75. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.conf.js.map +1 -0
  76. package/dist/collection/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.js +24 -20
  77. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -0
  78. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +6 -7
  79. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -1
  80. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +21 -16
  81. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  82. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +7 -16
  83. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -1
  84. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +17 -17
  85. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  86. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  87. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +30 -15
  88. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  89. package/dist/collection/components/molecules/mg-alert/mg-alert.conf.js +9 -0
  90. package/dist/collection/components/molecules/mg-alert/mg-alert.conf.js.map +1 -0
  91. package/dist/collection/components/molecules/mg-alert/mg-alert.js +270 -0
  92. package/dist/collection/components/molecules/mg-alert/mg-alert.js.map +1 -0
  93. package/dist/collection/components/molecules/mg-details/mg-details.js +3 -3
  94. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  95. package/dist/collection/components/molecules/mg-form/mg-form.js +5 -5
  96. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  97. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.js +6 -0
  98. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.js.map +1 -0
  99. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +16 -10
  100. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  101. package/dist/collection/components/molecules/mg-loader/mg-loader.js +3 -3
  102. package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
  103. package/dist/collection/components/molecules/mg-message/mg-message.conf.js +5 -1
  104. package/dist/collection/components/molecules/mg-message/mg-message.conf.js.map +1 -1
  105. package/dist/collection/components/molecules/mg-message/mg-message.js +46 -230
  106. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  107. package/dist/collection/components/molecules/mg-modal/mg-modal.js +35 -121
  108. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  109. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +4 -5
  110. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js.map +1 -1
  111. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +7 -7
  112. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  113. package/dist/collection/components/molecules/mg-panel/mg-panel.js +9 -9
  114. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  115. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
  116. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  117. package/dist/collection/components/molecules/mg-popover/mg-popover.js +4 -3
  118. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  119. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  120. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -8
  121. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js.map +1 -1
  122. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +24 -13
  123. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  124. package/dist/collection/locales/en/messages.json +1 -1
  125. package/dist/collection/locales/fr/messages.json +1 -1
  126. package/dist/collection/types/index.js +2 -0
  127. package/dist/collection/types/index.js.map +1 -0
  128. package/dist/collection/utils/behaviors.utils.js +8 -9
  129. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  130. package/dist/collection/utils/playwright.fixture.js +3 -3
  131. package/dist/collection/utils/playwright.fixture.js.map +1 -1
  132. package/dist/components/index.es.js +6 -6
  133. package/dist/components/index.es.js.map +1 -1
  134. package/dist/components/index2.js +6 -6
  135. package/dist/components/mg-action-more.js +34 -18
  136. package/dist/components/mg-action-more.js.map +1 -1
  137. package/dist/components/mg-alert.d.ts +11 -0
  138. package/dist/components/mg-alert.js +212 -0
  139. package/dist/components/mg-alert.js.map +1 -0
  140. package/dist/components/mg-badge2.js +8 -8
  141. package/dist/components/mg-badge2.js.map +1 -1
  142. package/dist/components/mg-button2.js +7 -9
  143. package/dist/components/mg-button2.js.map +1 -1
  144. package/dist/components/mg-card2.js +3 -68
  145. package/dist/components/mg-card2.js.map +1 -1
  146. package/dist/components/mg-character-left2.js +4 -3
  147. package/dist/components/mg-character-left2.js.map +1 -1
  148. package/dist/components/mg-details.js +5 -5
  149. package/dist/components/mg-details.js.map +1 -1
  150. package/dist/components/mg-divider.js +1 -40
  151. package/dist/components/mg-divider.js.map +1 -1
  152. package/dist/components/mg-divider2.js +44 -0
  153. package/dist/components/mg-divider2.js.map +1 -0
  154. package/dist/components/mg-form.js +5 -5
  155. package/dist/components/mg-form.js.map +1 -1
  156. package/dist/components/mg-icon2.js +11 -11
  157. package/dist/components/mg-icon2.js.map +1 -1
  158. package/dist/components/mg-illustrated-message.js +6 -6
  159. package/dist/components/mg-illustrated-message.js.map +1 -1
  160. package/dist/components/mg-input-checkbox-paginated.js +1 -1
  161. package/dist/components/mg-input-checkbox-paginated2.js +15 -44
  162. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  163. package/dist/components/mg-input-checkbox.js +82 -33
  164. package/dist/components/mg-input-checkbox.js.map +1 -1
  165. package/dist/components/mg-input-date.js +27 -36
  166. package/dist/components/mg-input-date.js.map +1 -1
  167. package/dist/components/mg-input-numeric.js +46 -38
  168. package/dist/components/mg-input-numeric.js.map +1 -1
  169. package/dist/components/mg-input-password.js +11 -11
  170. package/dist/components/mg-input-password.js.map +1 -1
  171. package/dist/components/mg-input-radio.js +12 -12
  172. package/dist/components/mg-input-radio.js.map +1 -1
  173. package/dist/components/mg-input-select2.js +14 -14
  174. package/dist/components/mg-input-select2.js.map +1 -1
  175. package/dist/components/mg-input-text2.js +58 -29
  176. package/dist/components/mg-input-text2.js.map +1 -1
  177. package/dist/components/mg-input-textarea.js +22 -22
  178. package/dist/components/mg-input-textarea.js.map +1 -1
  179. package/dist/components/mg-input-title2.js +4 -4
  180. package/dist/components/mg-input-title2.js.map +1 -1
  181. package/dist/components/mg-input-toggle.js +9 -9
  182. package/dist/components/mg-input-toggle.js.map +1 -1
  183. package/dist/components/mg-input2.js +19 -57
  184. package/dist/components/mg-input2.js.map +1 -1
  185. package/dist/components/mg-item-more2.js +35 -31
  186. package/dist/components/mg-item-more2.js.map +1 -1
  187. package/dist/components/mg-loader.js +5 -5
  188. package/dist/components/mg-loader.js.map +1 -1
  189. package/dist/components/mg-menu-item2.js +28 -38
  190. package/dist/components/mg-menu-item2.js.map +1 -1
  191. package/dist/components/mg-message.js +1 -224
  192. package/dist/components/mg-message.js.map +1 -1
  193. package/dist/components/mg-message2.js +135 -0
  194. package/dist/components/mg-message2.js.map +1 -0
  195. package/dist/components/mg-modal.js +32 -110
  196. package/dist/components/mg-modal.js.map +1 -1
  197. package/dist/components/mg-pagination2.js +12 -13
  198. package/dist/components/mg-pagination2.js.map +1 -1
  199. package/dist/components/mg-panel.js +10 -10
  200. package/dist/components/mg-panel.js.map +1 -1
  201. package/dist/components/mg-popover-content2.js +3 -3
  202. package/dist/components/mg-popover-content2.js.map +1 -1
  203. package/dist/components/mg-popover2.js +7 -6
  204. package/dist/components/mg-popover2.js.map +1 -1
  205. package/dist/components/mg-skip-links.js +4 -4
  206. package/dist/components/mg-skip-links.js.map +1 -1
  207. package/dist/components/mg-tabs.js +32 -22
  208. package/dist/components/mg-tabs.js.map +1 -1
  209. package/dist/components/mg-tag.js +5 -5
  210. package/dist/components/mg-tag.js.map +1 -1
  211. package/dist/components/mg-tooltip-content2.js +2 -2
  212. package/dist/components/mg-tooltip-content2.js.map +1 -1
  213. package/dist/components/mg-tooltip2.js +47 -32
  214. package/dist/components/mg-tooltip2.js.map +1 -1
  215. package/dist/esm/{index-0df3b137.js → index-089d0323.js} +18 -71
  216. package/dist/esm/index-089d0323.js.map +1 -0
  217. package/dist/esm/{index-eed80cc2.js → index-cc97a562.js} +12 -12
  218. package/dist/esm/index-cc97a562.js.map +1 -0
  219. package/dist/esm/loader.js +3 -3
  220. package/dist/esm/mg-action-more_36.entry.js +606 -781
  221. package/dist/esm/mg-action-more_36.entry.js.map +1 -1
  222. package/dist/esm/mg-alert.entry.js +157 -0
  223. package/dist/esm/mg-alert.entry.js.map +1 -0
  224. package/dist/esm/mg-components.js +3 -3
  225. package/dist/esm/mg-loader.entry.js +6 -6
  226. package/dist/esm/mg-loader.entry.js.map +1 -1
  227. package/dist/mg-components/locales/en/messages.json +1 -1
  228. package/dist/mg-components/locales/fr/messages.json +1 -1
  229. package/dist/mg-components/mg-components.css +1 -1
  230. package/dist/mg-components/mg-components.esm.js +1 -1
  231. package/dist/mg-components/mg-components.esm.js.map +1 -1
  232. package/dist/mg-components/p-26b67dfd.entry.js +2 -0
  233. package/dist/mg-components/p-26b67dfd.entry.js.map +1 -0
  234. package/dist/mg-components/p-2b89fe8b.entry.js +2 -0
  235. package/dist/mg-components/p-2b89fe8b.entry.js.map +1 -0
  236. package/dist/mg-components/p-48e033cf.js +3 -0
  237. package/dist/mg-components/p-48e033cf.js.map +1 -0
  238. package/dist/mg-components/p-6f5c7ec5.entry.js +2 -0
  239. package/dist/mg-components/p-6f5c7ec5.entry.js.map +1 -0
  240. package/dist/mg-components/p-898d194f.js +2 -0
  241. package/dist/mg-components/p-898d194f.js.map +1 -0
  242. package/dist/types/assets/icons/index.d.ts +0 -1
  243. package/dist/types/components/atoms/{mg-character-left → internals/mg-character-left}/mg-character-left.d.ts +3 -0
  244. package/dist/types/components/atoms/{mg-input-title → internals/mg-input-title}/mg-input-title.d.ts +1 -1
  245. package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +2 -1
  246. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -1
  247. package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -4
  248. package/dist/types/components/atoms/mg-card/mg-card.d.ts +0 -33
  249. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
  250. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +5 -4
  251. package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +2 -1
  252. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +2 -6
  253. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +7 -2
  254. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +2 -6
  255. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +0 -9
  256. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +6 -13
  257. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +4 -18
  258. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +30 -3
  259. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +2 -7
  260. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +3 -7
  261. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +6 -1
  262. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -3
  263. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +5 -0
  264. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +10 -4
  265. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +3 -3
  266. package/dist/types/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.conf.d.ts +2 -2
  267. package/dist/types/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.d.ts +3 -0
  268. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +9 -7
  269. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +2 -3
  270. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -17
  271. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +4 -4
  272. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +7 -1
  273. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -2
  274. package/dist/types/components/molecules/mg-alert/mg-alert.conf.d.ts +17 -0
  275. package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +89 -0
  276. package/dist/types/components/molecules/mg-details/mg-details.d.ts +4 -0
  277. package/dist/types/components/molecules/mg-form/mg-form.d.ts +4 -0
  278. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.d.ts +10 -0
  279. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +7 -1
  280. package/dist/types/components/molecules/mg-message/mg-message.conf.d.ts +11 -2
  281. package/dist/types/components/molecules/mg-message/mg-message.d.ts +11 -62
  282. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +13 -39
  283. package/dist/types/components/molecules/mg-pagination/mg-pagination.conf.d.ts +4 -4
  284. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -0
  285. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -11
  286. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +9 -0
  287. package/dist/types/components.d.ts +157 -166
  288. package/dist/types/locales/index.d.ts +1 -1
  289. package/dist/types/types/index.d.ts +27 -0
  290. package/dist/types/utils/behaviors.utils.d.ts +5 -5
  291. package/ide/intellij/web-types.json +791 -671
  292. package/ide/vscode/css-custom-data.json +389 -0
  293. package/ide/vscode/html-custom-data.json +217 -547
  294. package/package.json +8 -5
  295. package/dist/cjs/index-8a3adbd1.js.map +0 -1
  296. package/dist/cjs/index-e1a25816.js.map +0 -1
  297. package/dist/collection/components/atoms/mg-card/mg-card.conf.js +0 -9
  298. package/dist/collection/components/atoms/mg-card/mg-card.conf.js.map +0 -1
  299. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +0 -1
  300. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +0 -1
  301. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js.map +0 -1
  302. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +0 -1
  303. package/dist/collection/fonts/OpenSans-Bold.ttf +0 -0
  304. package/dist/collection/fonts/OpenSans-Regular.ttf +0 -0
  305. package/dist/collection/fonts/OpenSans-SemiBold.ttf +0 -0
  306. package/dist/collection/styles/fonts.css +0 -1
  307. package/dist/collection/styles/global.css +0 -1
  308. package/dist/collection/styles/main.css +0 -1
  309. package/dist/collection/styles/mg-components-utils.css +0 -1
  310. package/dist/collection/styles/variables.css +0 -1
  311. package/dist/collection/variables.css +0 -1
  312. package/dist/esm/index-0df3b137.js.map +0 -1
  313. package/dist/esm/index-eed80cc2.js.map +0 -1
  314. package/dist/mg-components/fonts/OpenSans-Bold.ttf +0 -0
  315. package/dist/mg-components/fonts/OpenSans-Regular.ttf +0 -0
  316. package/dist/mg-components/fonts/OpenSans-SemiBold.ttf +0 -0
  317. package/dist/mg-components/p-88f6c2f9.entry.js +0 -2
  318. package/dist/mg-components/p-88f6c2f9.entry.js.map +0 -1
  319. package/dist/mg-components/p-e5db08c5.entry.js +0 -2
  320. package/dist/mg-components/p-e5db08c5.entry.js.map +0 -1
  321. package/dist/mg-components/p-efce3d8c.js +0 -2
  322. package/dist/mg-components/p-efce3d8c.js.map +0 -1
  323. package/dist/mg-components/p-f95b4418.js +0 -3
  324. package/dist/mg-components/p-f95b4418.js.map +0 -1
  325. package/dist/mg-components/styles/fonts.css +0 -1
  326. package/dist/mg-components/styles/global.css +0 -1
  327. package/dist/mg-components/styles/main.css +0 -1
  328. package/dist/mg-components/styles/mg-components-utils.css +0 -1
  329. package/dist/mg-components/styles/variables.css +0 -1
  330. package/dist/mg-components/variables.css +0 -1
  331. package/dist/types/components/atoms/mg-card/mg-card.conf.d.ts +0 -16
  332. /package/dist/collection/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.conf.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"mg-menu.js","sourceRoot":"","sources":["../../../../../src/components/molecules/menu/mg-menu/mg-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;GAEG;AAMH,MAAM,OAAO,MAAM;;QACjB;;sBAEc;QAEG,SAAI,GAAG,SAAS,CAAC;QAC1B,cAAS,GAA4B,EAAE,CAAC;QACxC,oBAAe,GAAG,CAAC,CAAC;QAiE5B;;uBAEe;QAEf;;;;WAIG;QACK,kBAAa,GAAG,CAAC,IAA2B,EAAE,SAAkB,EAAQ,EAAE;YAChF,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,SAAS,EAAE,CAAC;gBACnC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACxB,CAAC;QACH,CAAC,CAAC;QAEF;;;WAGG;QACK,wBAAmB,GAAG,GAA0B,EAAE,eAAC,OAAA,MAAA,MAAA,IAAI,CAAC,eAAe,0CAAE,UA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AAG,EAAE;YACrB,uBAAuB;YACvB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,cAAc,CAA4B,CAAC;YACjI,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;YAEjE,8CAA8C;YAC9C,qFAAqF;YACrF,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,+DAA+D;YAC/D,IAAI,gBAAgB,CAAC,GAAG,EAAE;gBACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,IAAI,EAAC,MAAM,gBAAa,IAAI,CAAC,KAAK;YACtC,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element, Watch, Host } from '@stencil/core';\nimport { Direction, sizes } from './mg-menu.conf';\nimport type { MenuSizeType, ItemMoreType } from './mg-menu.conf';\n\n/**\n * @slot - Menu content\n */\n@Component({\n tag: 'mg-menu',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-menu.css',\n shadow: true,\n})\nexport class MgMenu {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-menu';\n private menuItems: HTMLMgMenuItemElement[] = [];\n private focusedMenuItem = 0;\n private itemMoreElement: HTMLMgItemMoreElement;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMenuElement;\n\n /**\n * Menu label. Include short menu description.\n * Required to define accessibility required attribute `aria-label`\n */\n @Prop() label!: string;\n @Watch('label')\n validateLabel(newValue: MgMenu['label']): void {\n if (newValue === undefined && !this.element.getAttribute('aria-label')) {\n throw new Error(`<${this.name}> prop \"label\" is required.`);\n }\n }\n\n /**\n * Component display direction.\n */\n @Prop({ reflect: true }) direction: Direction = Direction.HORIZONTAL;\n @Watch('direction')\n validateDirection(newValue: MgMenu['direction']): void {\n if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {\n throw new Error(`<${this.name}> prop \"direction\" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);\n }\n }\n\n /**\n * Customize \"mg-item-more\" element\n * Used with direction: 'vertical' to manage overflow\n */\n @Prop() itemmore?: ItemMoreType;\n @Watch('itemmore')\n validateItemMore(newValue: MgMenu['itemmore']): void {\n if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {\n throw new Error(`<${this.name}> prop \"itemmore\" must be paired with direction ${Direction.HORIZONTAL}.`);\n } else if (newValue) {\n this.renderMgItemMore();\n }\n }\n\n /**\n * Define mg-menu size\n */\n @Prop() size: MenuSizeType = 'regular';\n @Watch('size')\n validateSize(newValue: MgMenu['size']): void {\n if (!sizes.includes(newValue)) {\n throw new Error(`<${this.name}> prop \"size\" must be one of: ${sizes.join(', ')}.`);\n }\n }\n\n /**\n * is this menu a child menu. Used for conditional render.\n */\n @State() isChildMenu: boolean;\n\n /*************\n * Methods *\n *************/\n\n /**\n * Close matching menu-item\n * @param item - menu-item to close\n * @param condition - addionnal condition\n */\n private closeMenuItem = (item: HTMLMgMenuItemElement, condition: boolean): void => {\n if (!this.isChildMenu && condition) {\n item.expanded = false;\n }\n };\n\n /**\n * get mg-item-more child mg-menu-item element\n * @returns mg-menu-item element\n */\n private getItemMoreMenuItem = (): HTMLMgMenuItemElement => this.itemMoreElement?.shadowRoot?.querySelector('mg-menu-item');\n\n /**\n * Set item listend\n * @param item - mg-menu-item element\n * @param index - number\n */\n private setItemListener = (item: HTMLMgMenuItemElement, index: MgMenu['focusedMenuItem']): void => {\n ['click', 'focus'].forEach(trigger => {\n item.shadowRoot.querySelector('button,a').addEventListener(trigger, () => {\n this.focusedMenuItem = index;\n // reset expanded on previous active menu item\n (this.getItemMoreMenuItem() ? [...this.menuItems, this.getItemMoreMenuItem()] : this.menuItems).forEach((item, index) => {\n this.closeMenuItem(item, index !== this.focusedMenuItem);\n });\n });\n });\n };\n\n /**\n * Store menu-items on component init and add listeners\n */\n private initMenuItemsListeners = (): void => {\n // add listeners on menu item and edit index\n this.menuItems.forEach((item, index) => {\n this.setItemListener(item, index);\n });\n };\n\n /**\n * Handle item-loaded event on mg-item-more element\n */\n private handleItemLoaded = (): void => {\n this.setItemListener(this.getItemMoreMenuItem(), this.menuItems.length);\n };\n\n /**\n * render mg-item-more\n */\n private renderMgItemMore = (): void => {\n if (this.direction !== Direction.HORIZONTAL || this.isChildMenu || this.element.children.length <= 1) {\n return;\n }\n\n // Insert mg-item-more outside the mg-menu shadowdom\n if (!this.itemMoreElement) {\n this.itemMoreElement = document.createElement('mg-item-more');\n this.itemMoreElement.addEventListener('item-loaded', this.handleItemLoaded);\n this.element.appendChild(this.itemMoreElement);\n }\n\n // update mg-item-more props\n for (const attribute in this.itemmore) {\n const newValue = this.itemmore[attribute];\n // to improve rendering we use HTML attributes as much as possible\n if (['string', 'number'].includes(typeof newValue)) {\n this.itemMoreElement.setAttribute(attribute, newValue);\n } else {\n this.itemMoreElement[attribute] = newValue;\n }\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n this.validateDirection(this.direction);\n this.validateLabel(this.label);\n this.validateItemMore(this.itemmore);\n this.validateSize(this.size);\n }\n\n /**\n * Check if component slots configuration\n * @returns timeout\n */\n componentDidLoad(): ReturnType<typeof setTimeout> {\n // update props and states after componentDidLoad hook\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n // store all menu-items\n this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM') as HTMLMgMenuItemElement[];\n this.isChildMenu = this.element.closest('mg-menu-item') !== null;\n\n // add mg-item-more to manage OverflowBehavior\n // when all props, states and DOM are already rendered we can render the mg-item-more\n this.renderMgItemMore();\n // then use mutation observer on children to improve reactivity\n new MutationObserver(() => {\n this.renderMgItemMore();\n }).observe(this.element, { childList: true });\n });\n }\n\n /**\n * Add listeners to items\n */\n componentDidRender(): void {\n this.initMenuItemsListeners();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"list\" aria-label={this.label}>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-menu.js","sourceRoot":"","sources":["../../../../../src/components/molecules/menu/mg-menu/mg-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD;;GAEG;AAMH,MAAM,OAAO,MAAM;;QACjB;;sBAEc;QAEG,SAAI,GAAG,SAAS,CAAC;QAC1B,cAAS,GAA4B,EAAE,CAAC;QACxC,oBAAe,GAAG,CAAC,CAAC;QAiE5B;;uBAEe;QAEf;;;;WAIG;QACK,kBAAa,GAAG,CAAC,IAA2B,EAAE,SAAkB,EAAQ,EAAE;YAChF,IAAI,CAAC,IAAI,CAAC,WA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AGG;IACH,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,IAAI,EAAC,MAAM,gBAAa,IAAI,CAAC,KAAK;YACtC,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element, Watch, Host } from '@stencil/core';\nimport { Direction, sizes } from './mg-menu.conf';\nimport type { MenuSizeType, ItemMoreType, DirectionType } from './mg-menu.conf';\nimport { toString } from '@mgdis/stencil-helpers';\n\n/**\n * @slot - Menu content\n */\n@Component({\n tag: 'mg-menu',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-menu.css',\n shadow: true,\n})\nexport class MgMenu {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-menu';\n private menuItems: HTMLMgMenuItemElement[] = [];\n private focusedMenuItem = 0;\n private itemMoreElement: HTMLMgItemMoreElement;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMenuElement;\n\n /**\n * Menu label. Include short menu description.\n * Required to define accessibility required attribute `aria-label`\n */\n @Prop() label!: string;\n @Watch('label')\n validateLabel(newValue: MgMenu['label']): void {\n if (newValue === undefined && !this.element.hasAttribute('aria-label')) {\n throw new Error(`<${this.name}> prop \"label\" is required. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Component display direction.\n */\n @Prop({ reflect: true }) direction: DirectionType = Direction.HORIZONTAL;\n @Watch('direction')\n validateDirection(newValue: MgMenu['direction']): void {\n if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {\n throw new Error(`<${this.name}> prop \"direction\" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Customize \"mg-item-more\" element\n * Used with direction: 'vertical' to manage overflow\n */\n @Prop() itemmore?: ItemMoreType;\n @Watch('itemmore')\n validateItemMore(newValue: MgMenu['itemmore']): void {\n if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {\n throw new Error(`<${this.name}> prop \"itemmore\" must be paired with direction ${Direction.HORIZONTAL}.`);\n } else if (newValue !== undefined) {\n this.renderMgItemMore();\n }\n }\n\n /**\n * Define mg-menu size\n */\n @Prop() size: MenuSizeType = 'medium';\n @Watch('size')\n validateSize(newValue: MgMenu['size']): void {\n if (!sizes.includes(newValue)) {\n throw new Error(`<${this.name}> prop \"size\" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * is this menu a child menu. Used for conditional render.\n */\n @State() isChildMenu: boolean;\n\n /*************\n * Methods *\n *************/\n\n /**\n * Close matching menu-item\n * @param item - menu-item to close\n * @param condition - addionnal condition\n */\n private closeMenuItem = (item: HTMLMgMenuItemElement, condition: boolean): void => {\n if (!this.isChildMenu && condition) {\n item.expanded = false;\n }\n };\n\n /**\n * get mg-item-more child mg-menu-item element\n * @returns mg-menu-item element\n */\n private getItemMoreMenuItem = (): HTMLMgMenuItemElement => this.itemMoreElement?.shadowRoot?.querySelector('mg-menu-item');\n\n /**\n * Set item listend\n * @param item - mg-menu-item element\n * @param index - number\n */\n private setItemListener = (item: HTMLMgMenuItemElement, index: MgMenu['focusedMenuItem']): void => {\n ['click', 'focus'].forEach(trigger => {\n item.shadowRoot.querySelector('button,a').addEventListener(trigger, () => {\n this.focusedMenuItem = index;\n // reset expanded on previous active menu item\n const itemMoreMenuItem = this.getItemMoreMenuItem();\n (![null, undefined].includes(itemMoreMenuItem) ? [...this.menuItems, itemMoreMenuItem] : this.menuItems).forEach((item, index) => {\n this.closeMenuItem(item, index !== this.focusedMenuItem);\n });\n });\n });\n };\n\n /**\n * Store menu-items on component init and add listeners\n */\n private initMenuItemsListeners = (): void => {\n // add listeners on menu item and edit index\n this.menuItems.forEach((item, index) => {\n this.setItemListener(item, index);\n });\n };\n\n /**\n * Handle item-loaded event on mg-item-more element\n */\n private handleItemLoaded = (): void => {\n this.setItemListener(this.getItemMoreMenuItem(), this.menuItems.length);\n };\n\n /**\n * render mg-item-more\n */\n private renderMgItemMore = (): void => {\n if (this.direction !== Direction.HORIZONTAL || this.isChildMenu || this.element.children.length <= 1) {\n return;\n }\n\n // Insert mg-item-more outside the mg-menu shadowdom\n if (this.itemMoreElement === undefined) {\n this.itemMoreElement = document.createElement('mg-item-more');\n this.itemMoreElement.addEventListener('item-loaded', this.handleItemLoaded);\n this.element.appendChild(this.itemMoreElement);\n }\n\n // update mg-item-more props\n for (const attribute in this.itemmore) {\n const newValue = this.itemmore[attribute];\n // to improve rendering we use HTML attributes as much as possible\n if (['string', 'number'].includes(typeof newValue)) {\n this.itemMoreElement.setAttribute(attribute, newValue);\n } else {\n this.itemMoreElement[attribute] = newValue;\n }\n }\n if (this.itemmore?.size === undefined) this.itemMoreElement.size = this.size;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n this.validateDirection(this.direction);\n this.validateLabel(this.label);\n this.validateItemMore(this.itemmore);\n this.validateSize(this.size);\n }\n\n /**\n * Check if component slots configuration\n * @returns timeout\n */\n componentDidLoad(): ReturnType<typeof setTimeout> {\n // update props and states after componentDidLoad hook\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n // store all menu-items\n this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM') as HTMLMgMenuItemElement[];\n this.isChildMenu = this.element.closest('mg-menu-item') !== null;\n\n // add mg-item-more to manage OverflowBehavior\n // when all props, states and DOM are already rendered we can render the mg-item-more\n this.renderMgItemMore();\n // then use mutation observer on children to improve reactivity\n new MutationObserver(() => {\n this.renderMgItemMore();\n }).observe(this.element, { childList: true });\n });\n }\n\n /**\n * Add listeners to items\n */\n componentDidRender(): void {\n this.initMenuItemsListeners();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"list\" aria-label={this.label}>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
@@ -1,21 +1,12 @@
1
1
  /**
2
- * Available menu-item positions
2
+ * Available menu item status values
3
3
  */
4
- export var ElementPosition;
5
- (function (ElementPosition) {
6
- ElementPosition["FIRST"] = "first";
7
- ElementPosition["LAST"] = "last";
8
- })(ElementPosition || (ElementPosition = {}));
9
- /**
10
- * Available menu item status
11
- */
12
- export var Status;
13
- (function (Status) {
14
- Status["VISIBLE"] = "visible";
15
- Status["HIDDEN"] = "hidden";
16
- Status["DISABLED"] = "disabled";
17
- Status["ACTIVE"] = "active";
18
- })(Status || (Status = {}));
4
+ export const Status = {
5
+ VISIBLE: 'visible',
6
+ HIDDEN: 'hidden',
7
+ DISABLED: 'disabled',
8
+ ACTIVE: 'active',
9
+ };
19
10
  /**
20
11
  * List of all possibles target
21
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mg-menu-item.conf.js","sourceRoot":"","sources":["../../../../../src/components/molecules/menu/mg-menu-item/mg-menu-item.conf.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;IACrB,2BAAiB,CAAA;AACnB,CAAC,EALW,MAAM,KAAN,MAAM,QAKjB;AAOD;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC","sourcesContent":["import { MgMenu } from '../mg-menu/mg-menu';\n\n/**\n * Available menu-item positions\n */\nexport enum ElementPosition {\n FIRST = 'first',\n LAST = 'last',\n}\n\n/**\n * Available menu item status\n */\nexport enum Status {\n VISIBLE = 'visible',\n HIDDEN = 'hidden',\n DISABLED = 'disabled',\n ACTIVE = 'active',\n}\n\n/**\n * Direction type\n */\nexport type DirectionType = MgMenu['direction'];\n\n/**\n * List of all possibles target\n */\nexport const targets = ['_blank', '_self', '_parent', '_top'] as const;\n\n/**\n * VariantType type from link target\n */\nexport type TargetType = (typeof targets)[number];\n"]}
1
+ {"version":3,"file":"mg-menu-item.conf.js","sourceRoot":"","sources":["../../../../../src/components/molecules/menu/mg-menu-item/mg-menu-item.conf.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAA+B;IAChD,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC","sourcesContent":["import { Status as StatusType } from '../../../../types';\n\n/**\n * Available menu item status type\n */\nexport type MgMenuStatusType = StatusType & ('visible' | 'hidden' | 'disabled' | 'active');\n\n/**\n * Available menu item status values\n */\nexport const Status: Record<string, StatusType> = {\n VISIBLE: 'visible',\n HIDDEN: 'hidden',\n DISABLED: 'disabled',\n ACTIVE: 'active',\n};\n\n/**\n * List of all possibles target\n */\nexport const targets = ['_blank', '_self', '_parent', '_top'] as const;\n\n/**\n * VariantType type from link target\n */\nexport type TargetType = (typeof targets)[number];\n"]}
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import { ClassList, createID, isValidString, nextTick } from "@mgdis/stencil-helpers";
2
+ import { ClassList, createID, isValidString, nextTick, toString } from "@mgdis/stencil-helpers";
3
3
  import { initLocales } from "../../../../locales";
4
4
  import { Direction } from "../mg-menu/mg-menu.conf";
5
5
  import { Status, targets } from "./mg-menu-item.conf";
@@ -47,8 +47,7 @@ export class MgMenuItem {
47
47
  this.updateDisplayNotificationBadge = () => {
48
48
  const childMenu = this.element.querySelector('mg-menu');
49
49
  this.displayNotificationBadge =
50
- childMenu !== null &&
51
- Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && subItem.getAttribute('hidden') === null);
50
+ childMenu !== null && Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && !subItem.hasAttribute('hidden'));
52
51
  };
53
52
  /**
54
53
  * Method to control if one of component children have active status
@@ -56,7 +55,7 @@ export class MgMenuItem {
56
55
  */
57
56
  this.hasActiveChild = () => {
58
57
  var _a;
59
- return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).some((element) => element.nodeName === 'MG-MENU-ITEM' && this.hasStatus(element, Status.ACTIVE) && element.getAttribute('hidden') === null);
58
+ return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).some((element) => element.nodeName === 'MG-MENU-ITEM' && this.hasStatus(element, Status.ACTIVE) && !element.hasAttribute('hidden'));
60
59
  };
61
60
  /**
62
61
  * Validate slots
@@ -71,7 +70,7 @@ export class MgMenuItem {
71
70
  Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
72
71
  if (!isValidString(element.textContent))
73
72
  throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
74
- if ((guard && element.getAttribute('title') === null) || !guard)
73
+ if ((guard && !element.hasAttribute('title')) || !guard)
75
74
  element.setAttribute('title', element.textContent);
76
75
  });
77
76
  });
@@ -143,7 +142,7 @@ export class MgMenuItem {
143
142
  this.target = undefined;
144
143
  this.status = Status.VISIBLE;
145
144
  this.expanded = false;
146
- this.size = 'regular';
145
+ this.size = 'medium';
147
146
  this.navigationButtonClassList = new ClassList([this.navigationButton]);
148
147
  this.direction = undefined;
149
148
  this.isInMainMenu = undefined;
@@ -153,7 +152,7 @@ export class MgMenuItem {
153
152
  }
154
153
  watchTarget(newValue) {
155
154
  if (newValue && !targets.includes(newValue)) {
156
- throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}`);
155
+ throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${toString(newValue)}.`);
157
156
  }
158
157
  }
159
158
  validateStatus(newValue, oldValue) {
@@ -165,7 +164,7 @@ export class MgMenuItem {
165
164
  }
166
165
  validateExpanded(newValue) {
167
166
  if (typeof newValue !== 'boolean')
168
- throw new Error(`<${this.name}> prop "expanded" must be a boolean.`);
167
+ throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${toString(newValue)}.`);
169
168
  // if menu-item has sub-menu we have to apply some updates:
170
169
  if (this.hasChildren) {
171
170
  const subItems = Array.from(this.element.querySelectorAll(this.name));
@@ -211,7 +210,7 @@ export class MgMenuItem {
211
210
  updatePopoverGuard() {
212
211
  if (this.displayPopover())
213
212
  Array.from(this.element.children)
214
- .filter((child) => child.getAttribute('slot') === null && child.nodeName !== 'MG-MENU' && Boolean(child.dataset))
213
+ .filter((child) => !child.hasAttribute('slot') && child.nodeName !== 'MG-MENU' && Boolean(child.dataset))
215
214
  .forEach((slot) => (slot.dataset.mgPopoverGuard = this.getPopoverIdentifier()));
216
215
  }
217
216
  /*************
@@ -279,16 +278,17 @@ export class MgMenuItem {
279
278
  */
280
279
  renderInteractiveElement() {
281
280
  const TagName = this.href !== undefined ? 'a' : 'button';
282
- return (h(TagName, { href: this.href, class: this.navigationButtonClassList.join(), tabindex: [Status.DISABLED, Status.HIDDEN].includes(this.status) ? -1 : undefined, disabled: this.status === Status.DISABLED, hidden: this.status === Status.HIDDEN, target: this.href && this.target ? this.target : undefined, "aria-expanded": this.hasChildren && this.expanded.toString(), "aria-current": this.status === Status.ACTIVE && 'page', onClick: this.handleElementCLick }, h("slot", { name: "image" }), h("div", { class: `${this.navigationButton}-center` }, h("div", { class: `${this.navigationButton}-text-content` }, h("slot", { name: "label" }), !this.displayNotificationBadge && h("slot", { name: "information" }), this.displayNotificationBadge && (h("span", { class: `${this.navigationButton}-text-content-notification` }, h("mg-badge", { label: this.messages.badgeLabel, value: "!", variant: "text-color", slot: "information" }))), this.target === '_blank' && [
281
+ return (h(TagName, { href: this.href, class: this.navigationButtonClassList.join(), tabindex: [Status.DISABLED, Status.HIDDEN].includes(this.status) ? -1 : undefined, disabled: this.status === Status.DISABLED, hidden: this.status === Status.HIDDEN, target: this.href !== undefined && this.target !== undefined ? this.target : undefined, "aria-expanded": this.hasChildren && this.expanded.toString(), "aria-current": this.status === Status.ACTIVE && 'page', onClick: this.handleElementCLick }, h("slot", { name: "image" }), h("div", { class: `${this.navigationButton}-center` }, h("div", { class: `${this.navigationButton}-text-content` }, h("slot", { name: "label" }), !this.displayNotificationBadge && h("slot", { name: "information" }), this.displayNotificationBadge && (h("span", { class: `${this.navigationButton}-text-content-notification` }, h("mg-badge", { label: this.messages.badgeLabel, value: "!", variant: "text-color", slot: "information" }))), this.target === '_blank' && [
283
282
  h("mg-icon", { key: "icon-new-tab", class: `${this.navigationButton}-new-tab`, icon: "arrow-up-right-square" }),
284
283
  h("span", { key: "a11y-new-tab", class: "mg-u-visually-hidden" }, this.messages.openNewTab),
285
- ]), this.size !== 'regular' && h("slot", { name: "metadata" })), this.hasChildren && this.href === undefined && (h("span", { class: {
284
+ ]), this.size !== 'medium' && h("slot", { name: "metadata" })), this.hasChildren && this.href === undefined && (h("span", { class: {
286
285
  [`${this.navigationButton}-chevron`]: true,
287
286
  [`${this.navigationButton}-chevron--rotate`]: this.expanded === true,
288
287
  } }, h("mg-icon", { icon: "chevron-down", size: "small" })))));
289
288
  }
290
289
  /**
291
290
  * Emit event when component is updated
291
+ * @returns promise process wich emit the 'item-updated' event
292
292
  */
293
293
  componentShouldUpdate() {
294
294
  return nextTick(() => {
@@ -304,7 +304,7 @@ export class MgMenuItem {
304
304
  ['mg-c-menu-item__collapse-container']: true,
305
305
  ['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
306
306
  });
307
- return (h(Host, { key: '60370b187c28dfd2f0a070b3d21ff4447f6bd1c6', role: this.isItemMore ? 'presentation' : 'listitem' }, this.displayPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier(), "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
307
+ return (h(Host, { key: 'be4538374c9b944ee6492805817d58b1dbb18e4b', role: this.isItemMore ? 'presentation' : 'listitem' }, this.displayPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier(), "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
308
308
  }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
309
309
  this.renderInteractiveElement(),
310
310
  h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
@@ -386,13 +386,13 @@ export class MgMenuItem {
386
386
  "type": "string",
387
387
  "mutable": true,
388
388
  "complexType": {
389
- "original": "Status",
390
- "resolved": "Status.ACTIVE | Status.DISABLED | Status.HIDDEN | Status.VISIBLE",
389
+ "original": "MgMenuStatusType",
390
+ "resolved": "\"active\" | \"disabled\" | \"hidden\" | \"visible\"",
391
391
  "references": {
392
- "Status": {
392
+ "MgMenuStatusType": {
393
393
  "location": "import",
394
394
  "path": "./mg-menu-item.conf",
395
- "id": "src/components/molecules/menu/mg-menu-item/mg-menu-item.conf.ts::Status"
395
+ "id": "src/components/molecules/menu/mg-menu-item/mg-menu-item.conf.ts::MgMenuStatusType"
396
396
  }
397
397
  }
398
398
  },
@@ -450,7 +450,7 @@ export class MgMenuItem {
450
450
  },
451
451
  "complexType": {
452
452
  "original": "HTMLMgMenuItemElement['status']",
453
- "resolved": "Status.ACTIVE | Status.DISABLED | Status.HIDDEN | Status.VISIBLE",
453
+ "resolved": "\"active\" | \"disabled\" | \"hidden\" | \"visible\"",
454
454
  "references": {
455
455
  "HTMLMgMenuItemElement": {
456
456
  "location": "global",
@@ -1 +1 @@
1
- {"version":3,"file":"mg-menu-item.js","sourceRoot":"","sources":["../../../../../src/components/molecules/menu/mg-menu-item/mg-menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAMtD;;;;;;GAMG;AAMH,MAAM,OAAO,UAAU;;QACrB;;sBAEc;QAEG,SAAI,GAAG,cAAc,CAAC;QACtB,qBAAgB,GAAG,mCAAmC,CAAC;QA+JxE;;oBAEY;QAEZ;;WAEG;QACK,mBAAc,GAAG,GAAS,EAAE;YAClC,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACjC,CAAC,CAAC;QAEF;;;;;WAKG;QACK,cAAS,GAAG,CAAC,iBAAwC,EAAE,MAA4B,EAAW,EAAE,CAAC,iBAAiB,CAAC,MAAM,KAAK,MAAM,CAAC;QAE7I;;;;;WAKG;QACK,gBAAW,GAAG,CAAC,SAAkC,EAAE,WAAW,GAAG,IAAI,CAAC,SAAS,EAAW,EAAE,CAAC,SAAS,KAAK,WAAW,CAAC;QAE/H;;;WAGG;QACK,mCAA8B,GAAG,GAAS,EAAE;YAClD,MAAM,SAA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AAE,mBAAmB,EAAE,EAAE,IAAI,EAAC,SAAS,IAC9C,IAAI,CAAC,UAAU,EAAE,CACd,CACK,CACd,CAAC,CAAC,CAAC,CACF;YACE,IAAI,CAAC,wBAAwB,EAAE;YAC/B,WAAK,GAAG,EAAC,oBAAoB,EAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,IAC/E,IAAI,CAAC,UAAU,EAAE,CACd;SACP,CACF,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Host, Watch, Element, Event, EventEmitter } from '@stencil/core';\nimport { ClassList, createID, isValidString, nextTick } from '@mgdis/stencil-helpers';\nimport { initLocales } from '../../../../locales';\nimport { Direction } from '../mg-menu/mg-menu.conf';\nimport { Status, targets } from './mg-menu-item.conf';\nimport type { MenuSizeType } from '../mg-menu/mg-menu.conf';\nimport type { DirectionType, TargetType } from './mg-menu-item.conf';\nimport type { MgPopover } from '../../mg-popover/mg-popover';\nimport type { MessageType } from '../../../../locales/index.conf';\n\n/**\n * @slot - Menu item content\n * @slot image - Menu item image content\n * @slot label - Menu item label content\n * @slot information - Menu item information content\n * @slot metadata - Menu item metadata content\n */\n@Component({\n tag: 'mg-menu-item',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-menu-item.css',\n shadow: true,\n})\nexport class MgMenuItem {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-menu-item';\n private readonly navigationButton = 'mg-c-menu-item__navigation-button';\n private messages: MessageType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMenuItemElement;\n\n /************\n * Props *\n ************/\n\n /**\n * Identifier is used to control mg-popover\n */\n @Prop({ reflect: true }) identifier = createID('mg-menu-item');\n\n /**\n * Define menu-item href\n * when defined menu-item contain an anchor instead of button\n */\n @Prop() href?: string;\n\n /**\n * Define target type\n */\n @Prop() target?: TargetType;\n @Watch('target')\n watchTarget(newValue: MgMenuItem['target']): void {\n if (newValue && !targets.includes(newValue)) {\n throw new Error(`<mg-link> prop \"target\" must be one of: ${targets.join(', ')}`);\n }\n }\n\n /**\n * Define menu-item status.\n */\n @Prop({ reflect: true, mutable: true }) status?: Status = Status.VISIBLE;\n @Watch('status')\n validateStatus(newValue: MgMenuItem['status'], oldValue?: MgMenuItem['status']): void {\n if (oldValue !== undefined) {\n this.navigationButtonClassList.delete(`${this.navigationButton}--${oldValue}`);\n }\n this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);\n this.statusChange.emit(newValue);\n }\n\n /**\n * Define menu-item content expanded.\n */\n @Prop({ mutable: true }) expanded? = false;\n @Watch('expanded')\n validateExpanded(newValue: MgMenuItem['expanded']): void {\n if (typeof newValue !== 'boolean') throw new Error(`<${this.name}> prop \"expanded\" must be a boolean.`);\n\n // if menu-item has sub-menu we have to apply some updates:\n if (this.hasChildren) {\n const subItems = Array.from(this.element.querySelectorAll(this.name));\n if (!newValue) {\n // - when main menu item is NOT expanded we need NOT expanded sub-items and NOT expanded sub-content\n subItems.forEach(item => {\n item.expanded = false;\n });\n } else if (this.element.querySelector(`${this.name}[status=\"${Status.ACTIVE}\"]`) !== null) {\n // - when expanded and contain an active item parents are expended too\n subItems.forEach(item => {\n if (this.hasStatus(item, Status.ACTIVE)) {\n item.expanded = true;\n }\n });\n }\n }\n }\n\n /**********\n * Events *\n *********/\n\n /**\n * Emited event when status change\n */\n @Event({ eventName: 'status-change' }) statusChange: EventEmitter<HTMLMgMenuItemElement['status']>;\n\n /**\n * Emited event when item is loaded\n */\n @Event({ eventName: 'item-loaded' }) itemLoaded: EventEmitter<void>;\n\n /**\n * Emited event when item is updated\n */\n @Event({ eventName: 'item-updated' }) itemUpdated: EventEmitter<void>;\n\n /**********\n * States *\n *********/\n\n /**\n * Define menu-item size.\n */\n @State() size: MenuSizeType = 'regular';\n @Watch('size')\n validateSize(newValue: MgMenuItem['size'], oldValue?: MgMenuItem['size']): void {\n this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);\n this.navigationButtonClassList.add(`${this.navigationButton}--size-${newValue}`);\n }\n\n /**\n * Component button classes\n */\n @State() navigationButtonClassList: ClassList = new ClassList([this.navigationButton]);\n\n /**\n * Parent menu direction\n */\n @State() direction: DirectionType;\n @Watch('direction')\n validateDirection(newValue: MgMenuItem['direction']): void {\n // manage menu items style depending to parent menu horientation\n this.element.setAttribute('data-style-direction', newValue);\n this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);\n // manage all sub levels child menu-items level with data-level attribut\n if (this.isDirection(Direction.VERTICAL, newValue)) {\n Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {\n item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;\n });\n }\n }\n\n /**\n * Does component is in main menu\n */\n @State() isInMainMenu: boolean;\n\n /**\n * Does element is item-more\n */\n @State() isItemMore: boolean;\n\n /**\n * Does component have children.\n */\n @State() hasChildren = false;\n @Watch('hasChildren')\n validateHasChildren(newValue: boolean): void {\n if (newValue && this.element.href !== undefined) {\n throw new Error(`<${this.name}> prop \"href\" is unauthorizied when element is a parent.`);\n }\n }\n\n /**\n * Does component should display notification badge.\n */\n @State() displayNotificationBadge: boolean;\n\n /***********\n * Methods *\n **********/\n\n /**\n * Toggle expanded prop value\n */\n private toggleExpanded = (): void => {\n this.expanded = !this.expanded;\n };\n\n /**\n * Does an Element have given Status\n * @param mgMenuItemElement - to parse\n * @param status - to check\n * @returns true if element with status is found\n */\n private hasStatus = (mgMenuItemElement: HTMLMgMenuItemElement, status: MgMenuItem['status']): boolean => mgMenuItemElement.status === status;\n\n /**\n * Is component contextual direction match the given direction\n * @param direction - in parent menu\n * @param compareWith - direction to compare with. Default: `this.direction`\n * @returns true is direction match the direction propertie\n */\n private isDirection = (direction: MgMenuItem['direction'], compareWith = this.direction): boolean => direction === compareWith;\n\n /**\n * Update displayNotificationBadge\n * current component notification badge have priority over the slot badge when submenu contain badge\n */\n private updateDisplayNotificationBadge = (): void => {\n const childMenu = this.element.querySelector('mg-menu');\n this.displayNotificationBadge =\n childMenu !== null &&\n Array.from(childMenu.children).some((subItem: HTMLMgMenuItemElement) => subItem.querySelector('mg-badge') !== null && subItem.getAttribute('hidden') === null);\n };\n\n /**\n * Method to control if one of component children have active status\n * @returns truthy if component has active child\n */\n private hasActiveChild = (): boolean =>\n Array.from(this.element.querySelector('mg-menu')?.children || []).some(\n (element: HTMLMgMenuItemElement) => element.nodeName === 'MG-MENU-ITEM' && this.hasStatus(element, Status.ACTIVE) && element.getAttribute('hidden') === null,\n );\n\n /**\n * Validate slots\n * @param guard - prevent action with guard. Default: false.\n */\n private validateSlot = (guard = false): void => {\n // slot title AND metadata validation\n // add title on label AND metada slots due to text-overflow on these element\n if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined) throw new Error(`<${this.name}> slot \"label\" is required.`);\n ['label', 'metadata'].forEach(slot => {\n Array.from(this.element.querySelectorAll(`[slot=\"${slot}\"]`)).forEach(element => {\n if (!isValidString(element.textContent)) throw new Error(`<${this.name}> slot \"${slot}\" must have text content.`);\n if ((guard && element.getAttribute('title') === null) || !guard) element.setAttribute('title', element.textContent);\n });\n });\n };\n\n /**\n * Update status\n * @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].\n */\n private updateStatus = (guard = []): void => {\n if (![Status.HIDDEN, Status.DISABLED, ...guard].includes(this.status)) {\n this.status = this.hasActiveChild() ? Status.ACTIVE : Status.VISIBLE;\n }\n };\n\n /**\n * Init event-listeners\n */\n private initListeners = (): void => {\n // manage first sub-level menu-items\n Array.from(this.element.querySelector('mg-menu')?.children || []).forEach(item => {\n if (item.nodeName === 'MG-MENU-ITEM') {\n // manage child menu listener\n item.addEventListener('status-change', () => {\n this.updateStatus();\n });\n }\n });\n };\n\n /**\n * Get mg-popover identifier\n * @returns generated mg-popover identifier\n */\n private getPopoverIdentifier = (): MgPopover['identifier'] => `${this.identifier}-popover`;\n\n /**\n * Render popover clickoutside guard for content slot\n */\n private updatePopoverGuard(): void {\n if (this.displayPopover())\n Array.from(this.element.children)\n .filter((child: HTMLElement) => child.getAttribute('slot') === null && child.nodeName !== 'MG-MENU' && Boolean(child.dataset))\n .forEach((slot: HTMLElement) => (slot.dataset.mgPopoverGuard = this.getPopoverIdentifier()));\n }\n\n /**\n * Condition to know if component should display a mg-popover\n * @returns truthy if component display popover\n */\n private displayPopover = (): boolean => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;\n\n /************\n * Handlers *\n ************/\n\n /**\n * Handle interacrtive element click\n * @param event - click on element\n */\n private handleElementCLick = (event: MouseEvent): void => {\n if ((this.hasChildren && !this.isInMainMenu) || this.status === Status.DISABLED) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // toggle expanded when mg-menu-item has child items\n if (this.hasChildren) this.toggleExpanded();\n };\n\n /**\n * Handle popover element display-change event\n * @param event - popover display event\n */\n private handlePopoverDisplay = (event: CustomEvent): void => {\n this.expanded = event.detail;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n // has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element\n // we store only matching elements\n this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));\n this.messages = initLocales(this.element).messages.menuItem as MessageType;\n this.isItemMore = this.element.dataset.overflowMore !== undefined;\n\n // Validate props\n this.validateStatus(this.status);\n this.validateExpanded(this.expanded);\n this.watchTarget(this.target);\n\n // Validate states\n this.validateSize(this.size);\n }\n\n /**\n * Check if component slots configuration\n * @returns timeout\n */\n componentDidLoad(): ReturnType<typeof setTimeout> {\n // validation\n this.validateSlot(true);\n\n // update props and states after componentDidLoad hook\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n // define menu-item context states\n const menu = this.element.closest('mg-menu');\n this.direction = this.isItemMore || menu === null ? Direction.HORIZONTAL : menu.direction;\n this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;\n if (menu?.size !== undefined) this.size = menu.size;\n\n if (this.isItemMore) this.size = this.element.dataset.size as MgMenuItem['size'];\n\n // when main menu item contain an active item it will get the active style\n // AND if item is in vertical menu it will be expanded\n if (this.hasActiveChild() && this.isInMainMenu) this.expanded = this.isDirection(Direction.VERTICAL);\n\n this.updateStatus([Status.ACTIVE]);\n this.updateDisplayNotificationBadge();\n this.updatePopoverGuard();\n\n // manage child dom changes with mutationObserver and listners\n this.initListeners();\n\n // emit loaded event when component is fully loaded\n this.itemLoaded.emit();\n\n new MutationObserver(mutationsList => {\n if (mutationsList.some(mutation => mutation.attributeName === 'hidden')) this.updateStatus(this.hasChildren ? undefined : [Status.ACTIVE]);\n if (mutationsList.some(mutation => mutation.type === 'characterData')) this.validateSlot();\n this.updateDisplayNotificationBadge();\n this.itemUpdated.emit();\n }).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });\n }, 0);\n }\n\n /**\n * Render ineractive element\n * @returns HTML Element\n */\n private renderInteractiveElement(): HTMLElement {\n const TagName: string = this.href !== undefined ? 'a' : 'button';\n return (\n <TagName\n href={this.href}\n class={this.navigationButtonClassList.join()}\n tabindex={[Status.DISABLED, Status.HIDDEN].includes(this.status) ? -1 : undefined}\n disabled={this.status === Status.DISABLED}\n hidden={this.status === Status.HIDDEN}\n target={this.href && this.target ? this.target : undefined}\n aria-expanded={this.hasChildren && this.expanded.toString()}\n aria-current={this.status === Status.ACTIVE && 'page'}\n onClick={this.handleElementCLick}\n >\n <slot name=\"image\"></slot>\n <div class={`${this.navigationButton}-center`}>\n <div class={`${this.navigationButton}-text-content`}>\n <slot name=\"label\"></slot>\n {!this.displayNotificationBadge && <slot name=\"information\"></slot>}\n {this.displayNotificationBadge && (\n <span class={`${this.navigationButton}-text-content-notification`}>\n <mg-badge label={this.messages.badgeLabel} value=\"!\" variant=\"text-color\" slot=\"information\"></mg-badge>\n </span>\n )}\n {this.target === '_blank' && [\n <mg-icon key=\"icon-new-tab\" class={`${this.navigationButton}-new-tab`} icon=\"arrow-up-right-square\"></mg-icon>,\n <span key=\"a11y-new-tab\" class=\"mg-u-visually-hidden\">\n {this.messages.openNewTab}\n </span>,\n ]}\n </div>\n {this.size !== 'regular' && <slot name=\"metadata\"></slot>}\n </div>\n {this.hasChildren && this.href === undefined && (\n <span\n class={{\n [`${this.navigationButton}-chevron`]: true,\n [`${this.navigationButton}-chevron--rotate`]: this.expanded === true,\n }}\n >\n <mg-icon icon=\"chevron-down\" size=\"small\"></mg-icon>\n </span>\n )}\n </TagName>\n );\n }\n\n /**\n * Render slot\n * @returns HTML Element\n */\n private renderSlot = (): HTMLElement => <slot></slot>;\n\n /**\n * Emit event when component is updated\n */\n componentShouldUpdate(): Promise<void> {\n return nextTick(() => {\n this.itemUpdated.emit();\n });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const getContainerClasses = () => ({\n ['mg-c-menu-item__collapse-container']: true,\n ['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),\n });\n\n return (\n <Host role={this.isItemMore ? 'presentation' : 'listitem'}>\n {this.displayPopover() ? (\n <mg-popover\n display={this.expanded}\n placement=\"bottom-start\"\n arrowHide={true}\n onDisplay-change={this.handlePopoverDisplay}\n identifier={this.getPopoverIdentifier()}\n data-fallback-placement=\"bottom-end\" // use for the last element of the menu if it is placed on the right side\n >\n {this.renderInteractiveElement()}\n <div class={getContainerClasses()} slot=\"content\">\n {this.renderSlot()}\n </div>\n </mg-popover>\n ) : (\n [\n this.renderInteractiveElement(),\n <div key=\"vertical-container\" class={getContainerClasses()} hidden={!this.expanded}>\n {this.renderSlot()}\n </div>,\n ]\n )}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-menu-item.js","sourceRoot":"","sources":["../../../../../src/components/molecules/menu/mg-menu-item/mg-menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAyC,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAyB,MAAM,EAAE,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAI9F;;;;;;GAMG;AAMH,MAAM,OAAO,UAAU;;QACrB;;sBAEc;QAEG,SAAI,GAAG,cAAc,CAAC;QACtB,qBAAgB,GAAG,mCAAmC,CAAC;QA+JxE;;oBAEY;QAEZ;;WAEG;QACK,mBAAc,GAAG,GAAS,EAAE;YAClC,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACjC,CAAC,CAAC;QAEF;;;;;WAKG;QACK,cAAS,GAAG,CAAC,iBAAwC,EAAE,MAA4B,EAAW,EAAE,CAAC,iBAAiB,CAAC,MAAM,KAAK,MAAM,CAAC;QAE7I;;;;;WAKG;QACK,gBAAW,GAAG,CAAC,SAAkC,EAAE,WAAW,GAAG,IAAI,CAAC,SAAS,EAAW,EAAE,CAAC,SAAS,KAAK,WAAW,CAAC;QAE/H;;;WAGG;QACK,mCAA8B,GAAG,GAAS,EAAE;YAClD,MAAM,SAAS,GA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C,yEAAyE;;YAE7G,IAAI,CAAC,wBAAwB,EAAE;YAChC,WAAK,KAAK,EAAE,mBAAmB,EAAE,EAAE,IAAI,EAAC,SAAS,IAC9C,IAAI,CAAC,UAAU,EAAE,CACd,CACK,CACd,CAAC,CAAC,CAAC,CACF;YACE,IAAI,CAAC,wBAAwB,EAAE;YAC/B,WAAK,GAAG,EAAC,oBAAoB,EAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,IAC/E,IAAI,CAAC,UAAU,EAAE,CACd;SACP,CACF,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Host, Watch, Element, Event, EventEmitter } from '@stencil/core';\nimport { ClassList, createID, isValidString, nextTick, toString } from '@mgdis/stencil-helpers';\nimport { initLocales } from '../../../../locales';\nimport { Direction, type MenuSizeType, type DirectionType } from '../mg-menu/mg-menu.conf';\nimport { type MgMenuStatusType, Status, targets, type TargetType } from './mg-menu-item.conf';\nimport type { MgPopover } from '../../mg-popover/mg-popover';\nimport type { MessageType } from '../../../../locales/index.conf';\n\n/**\n * @slot - Menu item content\n * @slot image - Menu item image content\n * @slot label - Menu item label content\n * @slot information - Menu item information content\n * @slot metadata - Menu item metadata content\n */\n@Component({\n tag: 'mg-menu-item',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-menu-item.css',\n shadow: true,\n})\nexport class MgMenuItem {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-menu-item';\n private readonly navigationButton = 'mg-c-menu-item__navigation-button';\n private messages: MessageType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMenuItemElement;\n\n /************\n * Props *\n ************/\n\n /**\n * Identifier is used to control mg-popover\n */\n @Prop({ reflect: true }) identifier = createID('mg-menu-item');\n\n /**\n * Define menu-item href\n * when defined menu-item contain an anchor instead of button\n */\n @Prop() href?: string;\n\n /**\n * Define target type\n */\n @Prop() target?: TargetType;\n @Watch('target')\n watchTarget(newValue: MgMenuItem['target']): void {\n if (newValue && !targets.includes(newValue)) {\n throw new Error(`<mg-link> prop \"target\" must be one of: ${targets.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define menu-item status.\n */\n @Prop({ reflect: true, mutable: true }) status?: MgMenuStatusType = Status.VISIBLE;\n @Watch('status')\n validateStatus(newValue: MgMenuItem['status'], oldValue?: MgMenuItem['status']): void {\n if (oldValue !== undefined) {\n this.navigationButtonClassList.delete(`${this.navigationButton}--${oldValue}`);\n }\n this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);\n this.statusChange.emit(newValue);\n }\n\n /**\n * Define menu-item content expanded.\n */\n @Prop({ mutable: true }) expanded? = false;\n @Watch('expanded')\n validateExpanded(newValue: MgMenuItem['expanded']): void {\n if (typeof newValue !== 'boolean') throw new Error(`<${this.name}> prop \"expanded\" must be a boolean. Passed value: ${toString(newValue)}.`);\n\n // if menu-item has sub-menu we have to apply some updates:\n if (this.hasChildren) {\n const subItems = Array.from(this.element.querySelectorAll(this.name));\n if (!newValue) {\n // - when main menu item is NOT expanded we need NOT expanded sub-items and NOT expanded sub-content\n subItems.forEach(item => {\n item.expanded = false;\n });\n } else if (this.element.querySelector(`${this.name}[status=\"${Status.ACTIVE}\"]`) !== null) {\n // - when expanded and contain an active item parents are expended too\n subItems.forEach(item => {\n if (this.hasStatus(item, Status.ACTIVE)) {\n item.expanded = true;\n }\n });\n }\n }\n }\n\n /**********\n * Events *\n *********/\n\n /**\n * Emited event when status change\n */\n @Event({ eventName: 'status-change' }) statusChange: EventEmitter<HTMLMgMenuItemElement['status']>;\n\n /**\n * Emited event when item is loaded\n */\n @Event({ eventName: 'item-loaded' }) itemLoaded: EventEmitter<void>;\n\n /**\n * Emited event when item is updated\n */\n @Event({ eventName: 'item-updated' }) itemUpdated: EventEmitter<void>;\n\n /**********\n * States *\n *********/\n\n /**\n * Define menu-item size.\n */\n @State() size: MenuSizeType = 'medium';\n @Watch('size')\n validateSize(newValue: MgMenuItem['size'], oldValue?: MgMenuItem['size']): void {\n this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);\n this.navigationButtonClassList.add(`${this.navigationButton}--size-${newValue}`);\n }\n\n /**\n * Component button classes\n */\n @State() navigationButtonClassList: ClassList = new ClassList([this.navigationButton]);\n\n /**\n * Parent menu direction\n */\n @State() direction: DirectionType;\n @Watch('direction')\n validateDirection(newValue: MgMenuItem['direction']): void {\n // manage menu items style depending to parent menu horientation\n this.element.setAttribute('data-style-direction', newValue);\n this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);\n // manage all sub levels child menu-items level with data-level attribut\n if (this.isDirection(Direction.VERTICAL, newValue)) {\n Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {\n item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;\n });\n }\n }\n\n /**\n * Does component is in main menu\n */\n @State() isInMainMenu: boolean;\n\n /**\n * Does element is item-more\n */\n @State() isItemMore: boolean;\n\n /**\n * Does component have children.\n */\n @State() hasChildren = false;\n @Watch('hasChildren')\n validateHasChildren(newValue: boolean): void {\n if (newValue && this.element.href !== undefined) {\n throw new Error(`<${this.name}> prop \"href\" is unauthorizied when element is a parent.`);\n }\n }\n\n /**\n * Does component should display notification badge.\n */\n @State() displayNotificationBadge: boolean;\n\n /***********\n * Methods *\n **********/\n\n /**\n * Toggle expanded prop value\n */\n private toggleExpanded = (): void => {\n this.expanded = !this.expanded;\n };\n\n /**\n * Does an Element have given Status\n * @param mgMenuItemElement - to parse\n * @param status - to check\n * @returns true if element with status is found\n */\n private hasStatus = (mgMenuItemElement: HTMLMgMenuItemElement, status: MgMenuItem['status']): boolean => mgMenuItemElement.status === status;\n\n /**\n * Is component contextual direction match the given direction\n * @param direction - in parent menu\n * @param compareWith - direction to compare with. Default: `this.direction`\n * @returns true is direction match the direction propertie\n */\n private isDirection = (direction: MgMenuItem['direction'], compareWith = this.direction): boolean => direction === compareWith;\n\n /**\n * Update displayNotificationBadge\n * current component notification badge have priority over the slot badge when submenu contain badge\n */\n private updateDisplayNotificationBadge = (): void => {\n const childMenu = this.element.querySelector('mg-menu');\n this.displayNotificationBadge =\n childMenu !== null && Array.from(childMenu.children).some((subItem: HTMLMgMenuItemElement) => subItem.querySelector('mg-badge') !== null && !subItem.hasAttribute('hidden'));\n };\n\n /**\n * Method to control if one of component children have active status\n * @returns truthy if component has active child\n */\n private hasActiveChild = (): boolean =>\n Array.from(this.element.querySelector('mg-menu')?.children || []).some(\n (element: HTMLMgMenuItemElement) => element.nodeName === 'MG-MENU-ITEM' && this.hasStatus(element, Status.ACTIVE) && !element.hasAttribute('hidden'),\n );\n\n /**\n * Validate slots\n * @param guard - prevent action with guard. Default: false.\n */\n private validateSlot = (guard = false): void => {\n // slot title AND metadata validation\n // add title on label AND metada slots due to text-overflow on these element\n if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined) throw new Error(`<${this.name}> slot \"label\" is required.`);\n ['label', 'metadata'].forEach(slot => {\n Array.from(this.element.querySelectorAll(`[slot=\"${slot}\"]`)).forEach(element => {\n if (!isValidString(element.textContent)) throw new Error(`<${this.name}> slot \"${slot}\" must have text content.`);\n if ((guard && !element.hasAttribute('title')) || !guard) element.setAttribute('title', element.textContent);\n });\n });\n };\n\n /**\n * Update status\n * @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].\n */\n private updateStatus = (guard = []): void => {\n if (![Status.HIDDEN, Status.DISABLED, ...guard].includes(this.status)) {\n this.status = this.hasActiveChild() ? Status.ACTIVE : Status.VISIBLE;\n }\n };\n\n /**\n * Init event-listeners\n */\n private initListeners = (): void => {\n // manage first sub-level menu-items\n Array.from(this.element.querySelector('mg-menu')?.children || []).forEach(item => {\n if (item.nodeName === 'MG-MENU-ITEM') {\n // manage child menu listener\n item.addEventListener('status-change', () => {\n this.updateStatus();\n });\n }\n });\n };\n\n /**\n * Get mg-popover identifier\n * @returns generated mg-popover identifier\n */\n private getPopoverIdentifier = (): MgPopover['identifier'] => `${this.identifier}-popover`;\n\n /**\n * Render popover clickoutside guard for content slot\n */\n private updatePopoverGuard(): void {\n if (this.displayPopover())\n Array.from(this.element.children)\n .filter((child: HTMLElement) => !child.hasAttribute('slot') && child.nodeName !== 'MG-MENU' && Boolean(child.dataset))\n .forEach((slot: HTMLElement) => (slot.dataset.mgPopoverGuard = this.getPopoverIdentifier()));\n }\n\n /**\n * Condition to know if component should display a mg-popover\n * @returns truthy if component display popover\n */\n private displayPopover = (): boolean => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;\n\n /************\n * Handlers *\n ************/\n\n /**\n * Handle interacrtive element click\n * @param event - click on element\n */\n private handleElementCLick = (event: MouseEvent): void => {\n if ((this.hasChildren && !this.isInMainMenu) || this.status === Status.DISABLED) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n // toggle expanded when mg-menu-item has child items\n if (this.hasChildren) this.toggleExpanded();\n };\n\n /**\n * Handle popover element display-change event\n * @param event - popover display event\n */\n private handlePopoverDisplay = (event: CustomEvent): void => {\n this.expanded = event.detail;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n // has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element\n // we store only matching elements\n this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));\n this.messages = initLocales(this.element).messages.menuItem as MessageType;\n this.isItemMore = this.element.dataset.overflowMore !== undefined;\n\n // Validate props\n this.validateStatus(this.status);\n this.validateExpanded(this.expanded);\n this.watchTarget(this.target);\n\n // Validate states\n this.validateSize(this.size);\n }\n\n /**\n * Check if component slots configuration\n * @returns timeout\n */\n componentDidLoad(): ReturnType<typeof setTimeout> {\n // validation\n this.validateSlot(true);\n\n // update props and states after componentDidLoad hook\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n // define menu-item context states\n const menu = this.element.closest('mg-menu');\n this.direction = this.isItemMore || menu === null ? Direction.HORIZONTAL : menu.direction;\n this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;\n if (menu?.size !== undefined) this.size = menu.size;\n\n if (this.isItemMore) this.size = this.element.dataset.size as MgMenuItem['size'];\n\n // when main menu item contain an active item it will get the active style\n // AND if item is in vertical menu it will be expanded\n if (this.hasActiveChild() && this.isInMainMenu) this.expanded = this.isDirection(Direction.VERTICAL);\n\n this.updateStatus([Status.ACTIVE]);\n this.updateDisplayNotificationBadge();\n this.updatePopoverGuard();\n\n // manage child dom changes with mutationObserver and listners\n this.initListeners();\n\n // emit loaded event when component is fully loaded\n this.itemLoaded.emit();\n\n new MutationObserver(mutationsList => {\n if (mutationsList.some(mutation => mutation.attributeName === 'hidden')) this.updateStatus(this.hasChildren ? undefined : [Status.ACTIVE]);\n if (mutationsList.some(mutation => mutation.type === 'characterData')) this.validateSlot();\n this.updateDisplayNotificationBadge();\n this.itemUpdated.emit();\n }).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });\n }, 0);\n }\n\n /**\n * Render ineractive element\n * @returns HTML Element\n */\n private renderInteractiveElement(): HTMLElement {\n const TagName: string = this.href !== undefined ? 'a' : 'button';\n return (\n <TagName\n href={this.href}\n class={this.navigationButtonClassList.join()}\n tabindex={[Status.DISABLED, Status.HIDDEN].includes(this.status) ? -1 : undefined}\n disabled={this.status === Status.DISABLED}\n hidden={this.status === Status.HIDDEN}\n target={this.href !== undefined && this.target !== undefined ? this.target : undefined}\n aria-expanded={this.hasChildren && this.expanded.toString()}\n aria-current={this.status === Status.ACTIVE && 'page'}\n onClick={this.handleElementCLick}\n >\n <slot name=\"image\"></slot>\n <div class={`${this.navigationButton}-center`}>\n <div class={`${this.navigationButton}-text-content`}>\n <slot name=\"label\"></slot>\n {!this.displayNotificationBadge && <slot name=\"information\"></slot>}\n {this.displayNotificationBadge && (\n <span class={`${this.navigationButton}-text-content-notification`}>\n <mg-badge label={this.messages.badgeLabel} value=\"!\" variant=\"text-color\" slot=\"information\"></mg-badge>\n </span>\n )}\n {this.target === '_blank' && [\n <mg-icon key=\"icon-new-tab\" class={`${this.navigationButton}-new-tab`} icon=\"arrow-up-right-square\"></mg-icon>,\n <span key=\"a11y-new-tab\" class=\"mg-u-visually-hidden\">\n {this.messages.openNewTab}\n </span>,\n ]}\n </div>\n {this.size !== 'medium' && <slot name=\"metadata\"></slot>}\n </div>\n {this.hasChildren && this.href === undefined && (\n <span\n class={{\n [`${this.navigationButton}-chevron`]: true,\n [`${this.navigationButton}-chevron--rotate`]: this.expanded === true,\n }}\n >\n <mg-icon icon=\"chevron-down\" size=\"small\"></mg-icon>\n </span>\n )}\n </TagName>\n );\n }\n\n /**\n * Render slot\n * @returns HTML Element\n */\n private renderSlot = (): HTMLElement => <slot></slot>;\n\n /**\n * Emit event when component is updated\n * @returns promise process wich emit the 'item-updated' event\n */\n componentShouldUpdate(): Promise<void> {\n return nextTick(() => {\n this.itemUpdated.emit();\n });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const getContainerClasses = () => ({\n ['mg-c-menu-item__collapse-container']: true,\n ['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),\n });\n\n return (\n <Host role={this.isItemMore ? 'presentation' : 'listitem'}>\n {this.displayPopover() ? (\n <mg-popover\n display={this.expanded}\n placement=\"bottom-start\"\n arrowHide={true}\n onDisplay-change={this.handlePopoverDisplay}\n identifier={this.getPopoverIdentifier()}\n data-fallback-placement=\"bottom-end\" // use for the last element of the menu if it is placed on the right side\n >\n {this.renderInteractiveElement()}\n <div class={getContainerClasses()} slot=\"content\">\n {this.renderSlot()}\n </div>\n </mg-popover>\n ) : (\n [\n this.renderInteractiveElement(),\n <div key=\"vertical-container\" class={getContainerClasses()} hidden={!this.expanded}>\n {this.renderSlot()}\n </div>,\n ]\n )}\n </Host>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mg-action-more.conf.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-action-more/mg-action-more.conf.ts"],"names":[],"mappings":"","sourcesContent":["import type { MgBadge } from '../../atoms/mg-badge/mg-badge';\nimport type { MgButton } from '../../atoms/mg-button/mg-button';\nimport type { MgIcon } from '../../atoms/mg-icon/mg-icon';\nimport type { MgMenuItem } from '../menu/mg-menu-item/mg-menu-item';\n\n/**\n * prop icon type\n */\nexport type MgActionMoreIconType = Pick<MgIcon, 'icon'>;\n\n/**\n * prop button type\n */\nexport type MgActionMoreButtonType = Pick<MgButton, 'isIcon' | 'variant' | 'label' | 'disabled'>;\n\n/**\n * locals message type\n */\nexport type MgActionMoreMessageType = { label: string };\n\n/**\n * prop item type\n */\nexport type MgActionMoreItemType = Pick<MgMenuItem, 'status' | 'href' | 'target'> & {\n label: string;\n mouseEventHandler: IMouseEventHandler;\n icon?: MgIcon['icon'];\n badge?: Pick<MgBadge, 'value' | 'label'>;\n};\n\n/**\n * MouseEvent callback interface\n */\ntype IMouseEventHandler = (event: MouseEvent) => void;\n"]}
1
+ {"version":3,"file":"mg-action-more.conf.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-action-more/mg-action-more.conf.ts"],"names":[],"mappings":"","sourcesContent":["import type { MgBadge } from '../../atoms/mg-badge/mg-badge';\nimport type { MgButton } from '../../atoms/mg-button/mg-button';\nimport type { MgIcon } from '../../atoms/mg-icon/mg-icon';\nimport type { MgMenuItem } from '../menu/mg-menu-item/mg-menu-item';\n\n/**\n * prop icon type\n */\nexport type MgActionMoreIconType = Pick<MgIcon, 'icon'>;\n\n/**\n * prop button type\n */\nexport type MgActionMoreButtonType = Pick<MgButton, 'isIcon' | 'variant' | 'label' | 'disabled'>;\n\n/**\n * locals message type\n */\nexport type MgActionMoreMessageType = { label: string };\n\n/**\n * prop item type\n */\nexport type MgActionMoreItemType = Pick<MgMenuItem, 'status' | 'href' | 'target'> & {\n label: string;\n mouseEventHandler: IMouseEventHandler;\n icon?: Pick<MgIcon, 'icon'> & Partial<Pick<MgIcon, 'variant' | 'variantStyle'>>;\n badge?: Pick<MgBadge, 'value' | 'label'>;\n};\n\n/**\n * prop item divider type\n */\nexport type MgActionMoreDividerType = { isDivider: boolean };\n\n/**\n * MouseEvent callback interface\n */\ntype IMouseEventHandler = (event: MouseEvent) => void;\n"]}
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import { createID } from "@mgdis/stencil-helpers";
2
+ import { createID, toString } from "@mgdis/stencil-helpers";
3
3
  import { Status } from "../menu/mg-menu-item/mg-menu-item.conf";
4
4
  import { Direction } from "../menu/mg-menu/mg-menu.conf";
5
5
  import { initLocales } from "../../../locales";
@@ -10,8 +10,15 @@ import { initLocales } from "../../../locales";
10
10
  */
11
11
  const isMgActionMoreItems = (prop) => {
12
12
  const items = prop;
13
- return typeof items === 'object' && items.every(item => typeof item === 'object' && typeof item.label === 'string' && typeof item.mouseEventHandler === 'function');
13
+ return (typeof items === 'object' &&
14
+ items.every(item => (typeof item === 'object' && typeof item.label === 'string' && typeof item.mouseEventHandler === 'function') || isMgActionMoreDivider(item)));
14
15
  };
16
+ /**
17
+ * MgActionMoreDividerType type guard
18
+ * @param item - component item
19
+ * @returns return true if type is valid
20
+ */
21
+ const isMgActionMoreDivider = (item) => typeof item === 'object' && item.isDivider;
15
22
  /**
16
23
  * MgActionMore['button'] type guard
17
24
  * @param prop - commponent button prop
@@ -77,20 +84,23 @@ export class MgActionMore {
77
84
  }
78
85
  validateItems(newValue) {
79
86
  if (!isMgActionMoreItems(newValue)) {
80
- throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType.`);
87
+ throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${toString(newValue)}.`);
88
+ }
89
+ else if (isMgActionMoreItems(newValue) && newValue.length > 0 && (isMgActionMoreDivider(newValue[0]) || isMgActionMoreDivider(newValue[newValue.length - 1]))) {
90
+ throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${toString(newValue)}.`);
81
91
  }
82
92
  }
83
93
  validateIcon(newValue) {
84
94
  if (newValue && !isMgActionMoreIcon(newValue)) {
85
- throw new Error(`<${this.name}> prop icon must match MgActionMoreIconType.`);
95
+ throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${toString(newValue)}.`);
86
96
  }
87
- else if (!(newValue === null || newValue === void 0 ? void 0 : newValue.icon) && Boolean(this.button.isIcon)) {
97
+ else if ((newValue === null || newValue === void 0 ? void 0 : newValue.icon) === undefined && Boolean(this.button.isIcon)) {
88
98
  this.icon = { icon: 'ellipsis' };
89
99
  }
90
100
  }
91
101
  validateButton(newValue) {
92
102
  if (newValue && !isMgActionMoreButton(newValue)) {
93
- throw new Error(`<${this.name}> prop button must match MgActionMoreButtonType.`);
103
+ throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${toString(newValue)}.`);
94
104
  }
95
105
  }
96
106
  validateDisplayChevron(newValue) {
@@ -124,11 +134,11 @@ export class MgActionMore {
124
134
  [`${this.classBase}__chevron--rotate`]: this.expanded === true,
125
135
  } }, h("mg-icon", { icon: "chevron-down", size: "small" })));
126
136
  }
127
- return (h(Host, { key: '3833ffe89499015c991ac366c5bb87283948962b', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: '3393bfd576f5bbef7570090a5813a4eecc944559', class: "mg-action-more" }, h("mg-popover", { key: '6c589e9efbbfef4adba6f2c59eb3f562c621daf1', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, h("mg-button", { key: '485538eb6f660de92c372ebd395e18ff7ef66c96', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && h("mg-icon", Object.assign({ key: 'd385d7c69f118b8f20d59547357dad7d8a56766d' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: '553f7704a5fc0b1a89062ce234607296d8bf53f2', slot: "content" }, h("mg-menu", { key: '4a161502b2d1dec2b17cd7c44cd492ec745cb7dd', direction: Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
128
- var _a;
129
- return (
130
- // eslint-disable-next-line react/jsx-no-bind
131
- h("mg-menu-item", { key: item.label, status: item.status || Status.VISIBLE, target: item.target, href: item.href, onClick: e => this.handleItemClick(e, item.mouseEventHandler) }, item.icon && h("mg-icon", { icon: item.icon, slot: "image" }), h("span", { slot: "label" }, item.label), ((_a = item.badge) === null || _a === void 0 ? void 0 : _a.label) && h("mg-badge", { label: item.badge.label, value: item.badge.value, slot: "information", variant: "text-color" })));
137
+ return (h(Host, { key: 'ad081e085753770cfdf1d922d7a2dd574e31a632', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: 'abb29bf36c86f205dd3893709473523f6263506c', class: this.classBase }, h("mg-popover", { key: '5604deaf66f1316aaccf40b90945982f840081d2', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, h("mg-button", { key: '22adde17802161738698deca40d94b9e12a8d406', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && h("mg-icon", Object.assign({ key: '18f31a4008af5dc74d1306dc9ebbbe566aefa0b7' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: 'a3b9d6de82629fbb1253eb0338e3186f43bc7583', slot: "content" }, h("mg-menu", { key: '67793ea91ade7c31ed4aa55a507c86bf221bd094', direction: Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
138
+ var _a, _b;
139
+ return isMgActionMoreDivider(item) ? (h("mg-divider", { class: "mg-c-action-more__divider", key: "divider" })) : (h("mg-menu-item", { key: item.label, status: item.status || Status.VISIBLE, target: item.target, href: item.href,
140
+ // eslint-disable-next-line react/jsx-no-bind
141
+ onClick: e => this.handleItemClick(e, item.mouseEventHandler) }, ((_a = item.icon) === null || _a === void 0 ? void 0 : _a.icon) && h("mg-icon", { icon: item.icon.icon, variant: item.icon.variant, variantStyle: item.icon.variantStyle, slot: "image" }), h("span", { slot: "label" }, item.label), ((_b = item.badge) === null || _b === void 0 ? void 0 : _b.label) && h("mg-badge", { label: item.badge.label, value: item.badge.value, slot: "information", variant: "text-color" })));
132
142
  })))))));
133
143
  }
134
144
  static get is() { return "mg-action-more"; }
@@ -149,13 +159,18 @@ export class MgActionMore {
149
159
  "type": "unknown",
150
160
  "mutable": false,
151
161
  "complexType": {
152
- "original": "MgActionMoreItemType[]",
153
- "resolved": "MgActionMoreItemType[]",
162
+ "original": "(MgActionMoreItemType | MgActionMoreDividerType)[]",
163
+ "resolved": "(MgActionMoreItemType | MgActionMoreDividerType)[]",
154
164
  "references": {
155
165
  "MgActionMoreItemType": {
156
166
  "location": "import",
157
167
  "path": "./mg-action-more.conf",
158
168
  "id": "src/components/molecules/mg-action-more/mg-action-more.conf.ts::MgActionMoreItemType"
169
+ },
170
+ "MgActionMoreDividerType": {
171
+ "location": "import",
172
+ "path": "./mg-action-more.conf",
173
+ "id": "src/components/molecules/mg-action-more/mg-action-more.conf.ts::MgActionMoreDividerType"
159
174
  }
160
175
  }
161
176
  },
@@ -171,7 +186,7 @@ export class MgActionMore {
171
186
  "mutable": true,
172
187
  "complexType": {
173
188
  "original": "MgActionMoreIconType",
174
- "resolved": "{ icon: \"filter\" | \"copy\" | \"link\" | \"picture\" | \"table\" | \"circle\" | \"download\" | \"history\" | \"location\" | \"key\" | \"loader\" | \"address-card\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building-outline\" | \"calculator\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-outline\" | \"comment-sms\" | \"conversation\" | \"conversation-outline\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-slash\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-download\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-up\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"laptop\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"list\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-slash\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"question-circle\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"tag\" | \"tags\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"; }",
189
+ "resolved": "{ icon: \"filter\" | \"copy\" | \"link\" | \"picture\" | \"table\" | \"circle\" | \"download\" | \"history\" | \"location\" | \"key\" | \"loader\" | \"address-card\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building-outline\" | \"calculator\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-outline\" | \"comment-sms\" | \"conversation\" | \"conversation-outline\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-slash\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-download\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-up\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"laptop\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"list\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-slash\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"tag\" | \"tags\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"; }",
175
190
  "references": {
176
191
  "MgActionMoreIconType": {
177
192
  "location": "import",
@@ -192,7 +207,7 @@ export class MgActionMore {
192
207
  "mutable": false,
193
208
  "complexType": {
194
209
  "original": "MgActionMoreButtonType",
195
- "resolved": "{ label?: string; disabled?: boolean; variant: \"flat\" | \"info\" | \"success\" | \"link\" | \"primary\" | \"secondary\" | \"danger\" | \"danger-alt\"; isIcon: boolean; }",
210
+ "resolved": "{ label?: string; disabled?: boolean; variant: \"flat\" | \"info\" | \"success\" | \"link\" | \"danger\" | \"danger-alt\" | \"primary\" | \"secondary\"; isIcon: boolean; }",
196
211
  "references": {
197
212
  "MgActionMoreButtonType": {
198
213
  "location": "import",
@@ -1 +1 @@
1
- {"version":3,"file":"mg-action-more.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-action-more/mg-action-more.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,CAAC,IAAa,EAAkC,EAAE;IAC5E,MAAM,KAAK,GAAG,IAA8B,CAAC;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,iBAAiB,KAAK,UAAU,CAAC,CAAC;AACtK,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,CAAC,IAAa,EAAkC,EAAE;IAC7E,MAAM,MAAM,GAAG,IAA8B,CAAC;IAC9C,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC;AAChH,CAAC,CAAC;AAE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CAAC,IAAI,CAAC,EAAE;;4BAAC,OAAA;4BACtB,6CAA6C;4BAC7C,oBACE,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,EACrC,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC;gCAE5D,IAAI,CAAC,IAAI,IAAI,eAAS,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAC,OAAO,GAAW;gCAC/D,YAAM,IAAI,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAQ;gCACrC,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,KAAK,KAAI,gBAAU,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAC,aAAa,EAAC,OAAO,EAAC,YAAY,GAAY,CACxH,CAChB,CAAA;yBAAA,CAAC,CACM,CACN,CACK,CACR,CACF,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Element, Prop, Watch, State, Host } from '@stencil/core';\nimport { createID } from '@mgdis/stencil-helpers';\nimport { Status } from '../menu/mg-menu-item/mg-menu-item.conf';\nimport { Direction } from '../menu/mg-menu/mg-menu.conf';\nimport { initLocales } from '../../../locales';\nimport type { MessageType } from '../../../locales/index.conf';\nimport type { MgActionMoreItemType, MgActionMoreButtonType, MgActionMoreIconType } from './mg-action-more.conf';\n\n/**\n * MgActionMore['items'] type guard\n * @param prop - commponent items prop\n * @returns return true if type is valid\n */\nconst isMgActionMoreItems = (prop: unknown): prop is MgActionMoreItemType[] => {\n const items = prop as MgActionMoreItemType[];\n return typeof items === 'object' && items.every(item => typeof item === 'object' && typeof item.label === 'string' && typeof item.mouseEventHandler === 'function');\n};\n\n/**\n * MgActionMore['button'] type guard\n * @param prop - commponent button prop\n * @returns return true if type is valid\n */\nconst isMgActionMoreButton = (prop: unknown): prop is MgActionMoreButtonType => {\n const button = prop as MgActionMoreButtonType;\n return typeof button === 'object' && typeof button.variant === 'string' && typeof button.isIcon === 'boolean';\n};\n\n/**\n * MgActionMore['icon'] type guard\n * @param prop - commponent icon prop\n * @returns return true if type is valid\n */\nconst isMgActionMoreIcon = (prop: unknown): prop is MgActionMoreIconType => {\n const icon = prop as MgActionMoreIconType;\n return typeof icon === 'object' && typeof icon.icon === 'string';\n};\n\n@Component({\n tag: 'mg-action-more',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-action-more.css',\n shadow: true,\n})\nexport class MgActionMore {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-action-more';\n private readonly classBase = 'mg-c-action-more';\n private readonly mgPopoverIdentifier = createID(this.name);\n private messages: MessageType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgActionMoreElement;\n\n /**\n * Define the menu-items elements\n */\n @Prop() items!: MgActionMoreItemType[];\n @Watch('items')\n validateItems(newValue: MgActionMore['items']): void {\n if (!isMgActionMoreItems(newValue)) {\n throw new Error(`<${this.name}> prop \"items\" is required and all values must be the same type, MgActionMoreItemType.`);\n }\n }\n\n /**\n * Define displayed icon\n */\n @Prop({ mutable: true }) icon?: MgActionMoreIconType;\n @Watch('icon')\n validateIcon(newValue: MgActionMore['icon']): void {\n if (newValue && !isMgActionMoreIcon(newValue)) {\n throw new Error(`<${this.name}> prop icon must match MgActionMoreIconType.`);\n } else if (!newValue?.icon && Boolean(this.button.isIcon)) {\n this.icon = { icon: 'ellipsis' };\n }\n }\n\n /**\n * Define button properties\n */\n @Prop() button?: MgActionMoreButtonType = { variant: 'flat', isIcon: true };\n @Watch('button')\n validateButton(newValue: MgActionMore['button']): void {\n if (newValue && !isMgActionMoreButton(newValue)) {\n throw new Error(`<${this.name}> prop button must match MgActionMoreButtonType.`);\n }\n }\n\n /**\n * Define if chevron is display\n */\n @Prop() displayChevron?: boolean;\n @Watch('displayChevron')\n validateDisplayChevron(newValue: MgActionMore['displayChevron']): void {\n if (newValue && this.button.isIcon === true) {\n throw new Error(`<${this.name}> prop \"displayChevron\" can't be used with a 'button\" prop \"isIcon\" attribute.`);\n }\n }\n /**\n * Menu expanded state\n */\n @State() expanded = false;\n\n /************\n * Methods *\n ***********/\n\n /**\n * Toggle expanded props\n */\n private toggleExpanded = (): void => {\n this.expanded = !this.expanded;\n };\n\n /**\n * Handle popover display change value\n * @param event - display change updated value\n */\n private handleDisplayChange = (event: CustomEvent): void => {\n this.expanded = event.detail;\n };\n\n /**\n * Button click handler\n */\n private handleButton = (): void => {\n this.toggleExpanded();\n };\n\n /**\n * Item click handler\n * @param event - click event\n * @param customHandler - item['mouseEventHandler']\n */\n private handleItemClick = (event: MouseEvent, customHandler: MgActionMoreItemType['mouseEventHandler']) => {\n this.expanded = false;\n customHandler(event);\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n this.messages = initLocales(this.element).messages.actionMore as MessageType;\n this.validateItems(this.items);\n this.validateButton(this.button);\n this.validateIcon(this.icon);\n this.validateDisplayChevron(this.displayChevron);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const buttonLabel = this.button.label || this.messages.label;\n const buttonContent = [buttonLabel];\n\n if (!this.button.isIcon && this.displayChevron) {\n buttonContent.push(\n <span\n class={{\n [`${this.classBase}__chevron`]: true,\n [`${this.classBase}__chevron--rotate`]: this.expanded === true,\n }}\n >\n <mg-icon icon=\"chevron-down\" size=\"small\"></mg-icon>\n </span>,\n );\n }\n\n return (\n <Host data-mg-popover-guard={this.mgPopoverIdentifier}>\n <span class=\"mg-action-more\">\n <mg-popover identifier={this.mgPopoverIdentifier} display={this.expanded} onDisplay-change={this.handleDisplayChange}>\n <mg-button variant={this.button.variant} isIcon={this.button.isIcon} disabled={this.button.disabled} type=\"button\" label={buttonLabel} onClick={this.handleButton}>\n {this.icon && <mg-icon {...this.icon}></mg-icon>}\n {!this.button.isIcon && buttonContent}\n </mg-button>\n <div slot=\"content\">\n <mg-menu direction={Direction.VERTICAL} label={this.messages.label}>\n {this.items.map(item => (\n // eslint-disable-next-line react/jsx-no-bind\n <mg-menu-item\n key={item.label}\n status={item.status || Status.VISIBLE}\n target={item.target}\n href={item.href}\n onClick={e => this.handleItemClick(e, item.mouseEventHandler)}\n >\n {item.icon && <mg-icon icon={item.icon} slot=\"image\"></mg-icon>}\n <span slot=\"label\">{item.label}</span>\n {item.badge?.label && <mg-badge label={item.badge.label} value={item.badge.value} slot=\"information\" variant=\"text-color\"></mg-badge>}\n </mg-menu-item>\n ))}\n </mg-menu>\n </div>\n </mg-popover>\n </span>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-action-more.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-action-more/mg-action-more.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,CAAC,IAAa,EAAkC,EAAE;IAC5E,MAAM,KAAK,GAAG,IAA8B,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Y,KAAK,EAAC,2BAA2B,EAAC,GAAG,EAAC,SAAS,GAAc,CAC1E,CAAC,CAAC,CAAC,CACF,oBACE,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,EACrC,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,IAAI,EAAE,IAAI,CAAC,IAAI;gCACf,6CAA6C;gCAC7C,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC;gCAE5D,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,KAAI,eAAS,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAC,OAAO,GAAW;gCAC5I,YAAM,IAAI,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAQ;gCACrC,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,KAAK,KAAI,gBAAU,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAC,aAAa,EAAC,OAAO,EAAC,YAAY,GAAY,CACxH,CAChB,CAAA;yBAAA,CACF,CACO,CACN,CACK,CACR,CACF,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Element, Prop, Watch, State, Host } from '@stencil/core';\nimport { createID, toString } from '@mgdis/stencil-helpers';\nimport { Status } from '../menu/mg-menu-item/mg-menu-item.conf';\nimport { Direction } from '../menu/mg-menu/mg-menu.conf';\nimport { initLocales } from '../../../locales';\nimport type { MessageType } from '../../../locales/index.conf';\nimport type { MgActionMoreItemType, MgActionMoreButtonType, MgActionMoreIconType, MgActionMoreDividerType } from './mg-action-more.conf';\n\n/**\n * MgActionMore['items'] type guard\n * @param prop - commponent items prop\n * @returns return true if type is valid\n */\nconst isMgActionMoreItems = (prop: unknown): prop is MgActionMoreItemType[] => {\n const items = prop as MgActionMoreItemType[];\n return (\n typeof items === 'object' &&\n items.every(item => (typeof item === 'object' && typeof item.label === 'string' && typeof item.mouseEventHandler === 'function') || isMgActionMoreDivider(item))\n );\n};\n\n/**\n * MgActionMoreDividerType type guard\n * @param item - component item\n * @returns return true if type is valid\n */\nconst isMgActionMoreDivider = (item: unknown): item is MgActionMoreDividerType => typeof item === 'object' && (item as MgActionMoreDividerType).isDivider;\n\n/**\n * MgActionMore['button'] type guard\n * @param prop - commponent button prop\n * @returns return true if type is valid\n */\nconst isMgActionMoreButton = (prop: unknown): prop is MgActionMoreButtonType => {\n const button = prop as MgActionMoreButtonType;\n return typeof button === 'object' && typeof button.variant === 'string' && typeof button.isIcon === 'boolean';\n};\n\n/**\n * MgActionMore['icon'] type guard\n * @param prop - commponent icon prop\n * @returns return true if type is valid\n */\nconst isMgActionMoreIcon = (prop: unknown): prop is MgActionMoreIconType => {\n const icon = prop as MgActionMoreIconType;\n return typeof icon === 'object' && typeof icon.icon === 'string';\n};\n\n@Component({\n tag: 'mg-action-more',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-action-more.css',\n shadow: true,\n})\nexport class MgActionMore {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-action-more';\n private readonly classBase = 'mg-c-action-more';\n private readonly mgPopoverIdentifier = createID(this.name);\n private messages: MessageType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgActionMoreElement;\n\n /**\n * Define the menu-items elements\n */\n @Prop() items!: (MgActionMoreItemType | MgActionMoreDividerType)[];\n @Watch('items')\n validateItems(newValue: MgActionMore['items']): void {\n if (!isMgActionMoreItems(newValue)) {\n throw new Error(\n `<${this.name}> prop \"items\" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${toString(newValue)}.`,\n );\n } else if (isMgActionMoreItems(newValue) && newValue.length > 0 && (isMgActionMoreDivider(newValue[0]) || isMgActionMoreDivider(newValue[newValue.length - 1]))) {\n throw new Error(`<${this.name}> prop \"items\" can’t have a divider at the beginning or the end of the array. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define displayed icon\n */\n @Prop({ mutable: true }) icon?: MgActionMoreIconType;\n @Watch('icon')\n validateIcon(newValue: MgActionMore['icon']): void {\n if (newValue && !isMgActionMoreIcon(newValue)) {\n throw new Error(`<${this.name}> prop \"icon\" must match MgActionMoreIconType. Passed value: ${toString(newValue)}.`);\n } else if (newValue?.icon === undefined && Boolean(this.button.isIcon)) {\n this.icon = { icon: 'ellipsis' };\n }\n }\n\n /**\n * Define button properties\n */\n @Prop() button?: MgActionMoreButtonType = { variant: 'flat', isIcon: true };\n @Watch('button')\n validateButton(newValue: MgActionMore['button']): void {\n if (newValue && !isMgActionMoreButton(newValue)) {\n throw new Error(`<${this.name}> prop \"button\" must match MgActionMoreButtonType. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define if chevron is display\n */\n @Prop() displayChevron?: boolean;\n @Watch('displayChevron')\n validateDisplayChevron(newValue: MgActionMore['displayChevron']): void {\n if (newValue && this.button.isIcon === true) {\n throw new Error(`<${this.name}> prop \"displayChevron\" can't be used with a 'button\" prop \"isIcon\" attribute.`);\n }\n }\n /**\n * Menu expanded state\n */\n @State() expanded = false;\n\n /************\n * Methods *\n ***********/\n\n /**\n * Toggle expanded props\n */\n private toggleExpanded = (): void => {\n this.expanded = !this.expanded;\n };\n\n /**\n * Handle popover display change value\n * @param event - display change updated value\n */\n private handleDisplayChange = (event: CustomEvent): void => {\n this.expanded = event.detail;\n };\n\n /**\n * Button click handler\n */\n private handleButton = (): void => {\n this.toggleExpanded();\n };\n\n /**\n * Item click handler\n * @param event - click event\n * @param customHandler - item['mouseEventHandler']\n */\n private handleItemClick = (event: MouseEvent, customHandler: MgActionMoreItemType['mouseEventHandler']) => {\n this.expanded = false;\n customHandler(event);\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n this.messages = initLocales(this.element).messages.actionMore as MessageType;\n this.validateItems(this.items);\n this.validateButton(this.button);\n this.validateIcon(this.icon);\n this.validateDisplayChevron(this.displayChevron);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const buttonLabel = this.button.label || this.messages.label;\n const buttonContent = [buttonLabel];\n\n if (!this.button.isIcon && this.displayChevron) {\n buttonContent.push(\n <span\n class={{\n [`${this.classBase}__chevron`]: true,\n [`${this.classBase}__chevron--rotate`]: this.expanded === true,\n }}\n >\n <mg-icon icon=\"chevron-down\" size=\"small\"></mg-icon>\n </span>,\n );\n }\n\n return (\n <Host data-mg-popover-guard={this.mgPopoverIdentifier}>\n <span class={this.classBase}>\n <mg-popover identifier={this.mgPopoverIdentifier} display={this.expanded} onDisplay-change={this.handleDisplayChange}>\n <mg-button variant={this.button.variant} isIcon={this.button.isIcon} disabled={this.button.disabled} type=\"button\" label={buttonLabel} onClick={this.handleButton}>\n {this.icon && <mg-icon {...this.icon}></mg-icon>}\n {!this.button.isIcon && buttonContent}\n </mg-button>\n <div slot=\"content\">\n <mg-menu direction={Direction.VERTICAL} label={this.messages.label}>\n {this.items.map(item =>\n isMgActionMoreDivider(item) ? (\n <mg-divider class=\"mg-c-action-more__divider\" key=\"divider\"></mg-divider>\n ) : (\n <mg-menu-item\n key={item.label}\n status={item.status || Status.VISIBLE}\n target={item.target}\n href={item.href}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={e => this.handleItemClick(e, item.mouseEventHandler)}\n >\n {item.icon?.icon && <mg-icon icon={item.icon.icon} variant={item.icon.variant} variantStyle={item.icon.variantStyle} slot=\"image\"></mg-icon>}\n <span slot=\"label\">{item.label}</span>\n {item.badge?.label && <mg-badge label={item.badge.label} value={item.badge.value} slot=\"information\" variant=\"text-color\"></mg-badge>}\n </mg-menu-item>\n ),\n )}\n </mg-menu>\n </div>\n </mg-popover>\n </span>\n </Host>\n );\n }\n}\n"]}