@mgdis/mg-components 5.28.2 → 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 (339) hide show
  1. package/{readme.md → README.md} +1 -1
  2. package/dist/cjs/{index-ce4f7698.js → index-08ee93bf.js} +57 -77
  3. package/dist/cjs/index-08ee93bf.js.map +1 -0
  4. package/dist/cjs/{index-792fd1c1.js → index-d57c96a9.js} +16 -15
  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 +622 -788
  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 +3 -3
  12. package/dist/cjs/mg-components.cjs.js.map +1 -1
  13. package/dist/cjs/mg-loader.cjs.entry.js +6 -6
  14. package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
  15. package/dist/collection/assets/icons/index.js +1 -1
  16. package/dist/collection/assets/icons/index.js.map +1 -1
  17. package/dist/collection/collection-manifest.json +6 -5
  18. package/dist/collection/components/atoms/{mg-character-left → internals/mg-character-left}/mg-character-left.js +9 -5
  19. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js.map +1 -0
  20. package/dist/collection/components/atoms/{mg-input-title → internals/mg-input-title}/mg-input-title.js +4 -4
  21. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js.map +1 -0
  22. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js.map +1 -1
  23. package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -6
  24. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  25. package/dist/collection/components/atoms/mg-button/mg-button.conf.js.map +1 -1
  26. package/dist/collection/components/atoms/mg-button/mg-button.js +4 -22
  27. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  28. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -113
  29. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  30. package/dist/collection/components/atoms/mg-divider/mg-divider.js +9 -9
  31. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -1
  33. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js.map +1 -1
  34. package/dist/collection/components/atoms/mg-icon/mg-icon.js +11 -11
  35. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  36. package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js.map +1 -1
  37. package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
  38. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  39. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
  40. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +6 -7
  41. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  42. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +36 -20
  43. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +0 -9
  45. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +15 -60
  47. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -3
  49. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +16 -48
  51. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +5 -23
  53. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +128 -32
  55. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +1 -8
  57. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -1
  58. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +21 -22
  59. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  60. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +1 -8
  61. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
  62. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +46 -31
  63. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  64. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +9 -9
  65. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  66. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +27 -16
  67. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  68. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js.map +1 -1
  69. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +13 -13
  70. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  71. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -1
  72. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +72 -36
  73. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  74. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +22 -22
  75. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  76. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +7 -7
  77. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  78. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.conf.js.map +1 -0
  79. package/dist/collection/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.js +24 -20
  80. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -0
  81. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +6 -7
  82. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -1
  83. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +21 -16
  84. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  85. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +7 -16
  86. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -1
  87. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +17 -17
  88. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  89. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  90. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +30 -15
  91. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  92. package/dist/collection/components/molecules/mg-alert/mg-alert.conf.js +9 -0
  93. package/dist/collection/components/molecules/mg-alert/mg-alert.conf.js.map +1 -0
  94. package/dist/collection/components/molecules/mg-alert/mg-alert.js +270 -0
  95. package/dist/collection/components/molecules/mg-alert/mg-alert.js.map +1 -0
  96. package/dist/collection/components/molecules/mg-details/mg-details.js +3 -3
  97. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  98. package/dist/collection/components/molecules/mg-form/mg-form.js +5 -5
  99. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  100. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.js +6 -0
  101. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.js.map +1 -0
  102. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +16 -10
  103. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  104. package/dist/collection/components/molecules/mg-loader/mg-loader.js +3 -3
  105. package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
  106. package/dist/collection/components/molecules/mg-message/mg-message.conf.js +5 -1
  107. package/dist/collection/components/molecules/mg-message/mg-message.conf.js.map +1 -1
  108. package/dist/collection/components/molecules/mg-message/mg-message.js +46 -230
  109. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  110. package/dist/collection/components/molecules/mg-modal/mg-modal.js +35 -121
  111. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  112. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +4 -5
  113. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js.map +1 -1
  114. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +7 -7
  115. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  116. package/dist/collection/components/molecules/mg-panel/mg-panel.js +9 -9
  117. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  118. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
  119. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  120. package/dist/collection/components/molecules/mg-popover/mg-popover.js +4 -3
  121. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  122. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -2
  123. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  124. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -8
  125. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js.map +1 -1
  126. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +24 -13
  127. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  128. package/dist/collection/locales/en/messages.json +1 -1
  129. package/dist/collection/locales/fr/messages.json +1 -1
  130. package/dist/collection/types/index.js +2 -0
  131. package/dist/collection/types/index.js.map +1 -0
  132. package/dist/collection/utils/behaviors.utils.js +8 -9
  133. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  134. package/dist/collection/utils/playwright.fixture.js +3 -3
  135. package/dist/collection/utils/playwright.fixture.js.map +1 -1
  136. package/dist/components/index.es.js +7 -7
  137. package/dist/components/index.es.js.map +1 -1
  138. package/dist/components/index2.js +6 -6
  139. package/dist/components/mg-action-more.js +34 -18
  140. package/dist/components/mg-action-more.js.map +1 -1
  141. package/dist/components/mg-alert.d.ts +11 -0
  142. package/dist/components/mg-alert.js +212 -0
  143. package/dist/components/mg-alert.js.map +1 -0
  144. package/dist/components/mg-badge2.js +8 -8
  145. package/dist/components/mg-badge2.js.map +1 -1
  146. package/dist/components/mg-button2.js +7 -9
  147. package/dist/components/mg-button2.js.map +1 -1
  148. package/dist/components/mg-card2.js +3 -68
  149. package/dist/components/mg-card2.js.map +1 -1
  150. package/dist/components/mg-character-left2.js +4 -3
  151. package/dist/components/mg-character-left2.js.map +1 -1
  152. package/dist/components/mg-details.js +5 -5
  153. package/dist/components/mg-details.js.map +1 -1
  154. package/dist/components/mg-divider.js +1 -40
  155. package/dist/components/mg-divider.js.map +1 -1
  156. package/dist/components/mg-divider2.js +44 -0
  157. package/dist/components/mg-divider2.js.map +1 -0
  158. package/dist/components/mg-form.js +5 -5
  159. package/dist/components/mg-form.js.map +1 -1
  160. package/dist/components/mg-icon2.js +11 -11
  161. package/dist/components/mg-icon2.js.map +1 -1
  162. package/dist/components/mg-illustrated-message.js +6 -6
  163. package/dist/components/mg-illustrated-message.js.map +1 -1
  164. package/dist/components/mg-input-checkbox-paginated.js +1 -1
  165. package/dist/components/mg-input-checkbox-paginated2.js +16 -47
  166. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  167. package/dist/components/mg-input-checkbox.js +82 -33
  168. package/dist/components/mg-input-checkbox.js.map +1 -1
  169. package/dist/components/mg-input-date.js +29 -38
  170. package/dist/components/mg-input-date.js.map +1 -1
  171. package/dist/components/mg-input-numeric.js +46 -38
  172. package/dist/components/mg-input-numeric.js.map +1 -1
  173. package/dist/components/mg-input-password.js +11 -11
  174. package/dist/components/mg-input-password.js.map +1 -1
  175. package/dist/components/mg-input-radio.js +28 -16
  176. package/dist/components/mg-input-radio.js.map +1 -1
  177. package/dist/components/mg-input-select2.js +14 -14
  178. package/dist/components/mg-input-select2.js.map +1 -1
  179. package/dist/components/mg-input-text2.js +58 -29
  180. package/dist/components/mg-input-text2.js.map +1 -1
  181. package/dist/components/mg-input-textarea.js +22 -22
  182. package/dist/components/mg-input-textarea.js.map +1 -1
  183. package/dist/components/mg-input-title2.js +4 -4
  184. package/dist/components/mg-input-title2.js.map +1 -1
  185. package/dist/components/mg-input-toggle.js +9 -9
  186. package/dist/components/mg-input-toggle.js.map +1 -1
  187. package/dist/components/mg-input2.js +19 -57
  188. package/dist/components/mg-input2.js.map +1 -1
  189. package/dist/components/mg-item-more2.js +35 -31
  190. package/dist/components/mg-item-more2.js.map +1 -1
  191. package/dist/components/mg-loader.js +5 -5
  192. package/dist/components/mg-loader.js.map +1 -1
  193. package/dist/components/mg-menu-item2.js +28 -38
  194. package/dist/components/mg-menu-item2.js.map +1 -1
  195. package/dist/components/mg-message.js +1 -224
  196. package/dist/components/mg-message.js.map +1 -1
  197. package/dist/components/mg-message2.js +135 -0
  198. package/dist/components/mg-message2.js.map +1 -0
  199. package/dist/components/mg-modal.js +32 -110
  200. package/dist/components/mg-modal.js.map +1 -1
  201. package/dist/components/mg-pagination2.js +12 -13
  202. package/dist/components/mg-pagination2.js.map +1 -1
  203. package/dist/components/mg-panel.js +10 -10
  204. package/dist/components/mg-panel.js.map +1 -1
  205. package/dist/components/mg-popover-content2.js +3 -3
  206. package/dist/components/mg-popover-content2.js.map +1 -1
  207. package/dist/components/mg-popover2.js +7 -6
  208. package/dist/components/mg-popover2.js.map +1 -1
  209. package/dist/components/mg-skip-links.js +4 -4
  210. package/dist/components/mg-skip-links.js.map +1 -1
  211. package/dist/components/mg-tabs.js +32 -22
  212. package/dist/components/mg-tabs.js.map +1 -1
  213. package/dist/components/mg-tag.js +5 -5
  214. package/dist/components/mg-tag.js.map +1 -1
  215. package/dist/components/mg-tooltip-content2.js +2 -2
  216. package/dist/components/mg-tooltip-content2.js.map +1 -1
  217. package/dist/components/mg-tooltip2.js +47 -32
  218. package/dist/components/mg-tooltip2.js.map +1 -1
  219. package/dist/esm/{index-9ed65b6d.js → index-089d0323.js} +57 -78
  220. package/dist/esm/index-089d0323.js.map +1 -0
  221. package/dist/esm/{index-2667a5c4.js → index-cc97a562.js} +13 -13
  222. package/dist/esm/index-cc97a562.js.map +1 -0
  223. package/dist/esm/loader.js +3 -3
  224. package/dist/esm/mg-action-more_36.entry.js +622 -788
  225. package/dist/esm/mg-action-more_36.entry.js.map +1 -1
  226. package/dist/esm/mg-alert.entry.js +157 -0
  227. package/dist/esm/mg-alert.entry.js.map +1 -0
  228. package/dist/esm/mg-components.js +4 -4
  229. package/dist/esm/mg-components.js.map +1 -1
  230. package/dist/esm/mg-loader.entry.js +6 -6
  231. package/dist/esm/mg-loader.entry.js.map +1 -1
  232. package/dist/mg-components/locales/en/messages.json +1 -1
  233. package/dist/mg-components/locales/fr/messages.json +1 -1
  234. package/dist/mg-components/mg-components.css +1 -1
  235. package/dist/mg-components/mg-components.esm.js +1 -1
  236. package/dist/mg-components/mg-components.esm.js.map +1 -1
  237. package/dist/mg-components/p-26b67dfd.entry.js +2 -0
  238. package/dist/mg-components/p-26b67dfd.entry.js.map +1 -0
  239. package/dist/mg-components/p-2b89fe8b.entry.js +2 -0
  240. package/dist/mg-components/p-2b89fe8b.entry.js.map +1 -0
  241. package/dist/mg-components/p-48e033cf.js +3 -0
  242. package/dist/mg-components/p-48e033cf.js.map +1 -0
  243. package/dist/mg-components/p-6f5c7ec5.entry.js +2 -0
  244. package/dist/mg-components/p-6f5c7ec5.entry.js.map +1 -0
  245. package/dist/mg-components/p-898d194f.js +2 -0
  246. package/dist/mg-components/p-898d194f.js.map +1 -0
  247. package/dist/types/assets/icons/index.d.ts +0 -1
  248. package/dist/types/components/atoms/{mg-character-left → internals/mg-character-left}/mg-character-left.d.ts +3 -0
  249. package/dist/types/components/atoms/{mg-input-title → internals/mg-input-title}/mg-input-title.d.ts +1 -1
  250. package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +2 -1
  251. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -1
  252. package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -4
  253. package/dist/types/components/atoms/mg-card/mg-card.d.ts +0 -33
  254. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
  255. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +5 -4
  256. package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +2 -1
  257. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +2 -6
  258. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +7 -2
  259. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +2 -6
  260. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +0 -9
  261. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +6 -13
  262. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +4 -18
  263. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +30 -3
  264. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +2 -7
  265. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +3 -7
  266. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +6 -1
  267. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
  268. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -3
  269. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +1 -1
  270. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +5 -0
  271. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +10 -4
  272. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +3 -3
  273. package/dist/types/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.conf.d.ts +2 -2
  274. package/dist/types/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.d.ts +3 -0
  275. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +9 -7
  276. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +2 -3
  277. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -17
  278. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +4 -4
  279. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +7 -1
  280. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -2
  281. package/dist/types/components/molecules/mg-alert/mg-alert.conf.d.ts +17 -0
  282. package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +89 -0
  283. package/dist/types/components/molecules/mg-details/mg-details.d.ts +4 -0
  284. package/dist/types/components/molecules/mg-form/mg-form.d.ts +4 -0
  285. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.d.ts +10 -0
  286. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +7 -1
  287. package/dist/types/components/molecules/mg-message/mg-message.conf.d.ts +11 -2
  288. package/dist/types/components/molecules/mg-message/mg-message.d.ts +11 -62
  289. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +13 -39
  290. package/dist/types/components/molecules/mg-pagination/mg-pagination.conf.d.ts +4 -4
  291. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -0
  292. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -11
  293. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +9 -0
  294. package/dist/types/components.d.ts +165 -174
  295. package/dist/types/locales/index.d.ts +1 -1
  296. package/dist/types/types/index.d.ts +27 -0
  297. package/dist/types/utils/behaviors.utils.d.ts +5 -5
  298. package/ide/intellij/web-types.json +791 -671
  299. package/ide/vscode/css-custom-data.json +389 -0
  300. package/ide/vscode/html-custom-data.json +217 -547
  301. package/package.json +26 -23
  302. package/dist/cjs/index-792fd1c1.js.map +0 -1
  303. package/dist/cjs/index-ce4f7698.js.map +0 -1
  304. package/dist/collection/components/atoms/mg-card/mg-card.conf.js +0 -9
  305. package/dist/collection/components/atoms/mg-card/mg-card.conf.js.map +0 -1
  306. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +0 -1
  307. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +0 -1
  308. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js.map +0 -1
  309. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +0 -1
  310. package/dist/collection/fonts/OpenSans-Bold.ttf +0 -0
  311. package/dist/collection/fonts/OpenSans-Regular.ttf +0 -0
  312. package/dist/collection/fonts/OpenSans-SemiBold.ttf +0 -0
  313. package/dist/collection/styles/fonts.css +0 -1
  314. package/dist/collection/styles/global.css +0 -1
  315. package/dist/collection/styles/main.css +0 -1
  316. package/dist/collection/styles/mg-components-utils.css +0 -1
  317. package/dist/collection/styles/variables.css +0 -1
  318. package/dist/collection/variables.css +0 -1
  319. package/dist/esm/index-2667a5c4.js.map +0 -1
  320. package/dist/esm/index-9ed65b6d.js.map +0 -1
  321. package/dist/mg-components/fonts/OpenSans-Bold.ttf +0 -0
  322. package/dist/mg-components/fonts/OpenSans-Regular.ttf +0 -0
  323. package/dist/mg-components/fonts/OpenSans-SemiBold.ttf +0 -0
  324. package/dist/mg-components/p-06a9d801.js +0 -3
  325. package/dist/mg-components/p-06a9d801.js.map +0 -1
  326. package/dist/mg-components/p-56cce4ec.entry.js +0 -2
  327. package/dist/mg-components/p-56cce4ec.entry.js.map +0 -1
  328. package/dist/mg-components/p-64eaef9e.entry.js +0 -2
  329. package/dist/mg-components/p-64eaef9e.entry.js.map +0 -1
  330. package/dist/mg-components/p-7cda52b6.js +0 -2
  331. package/dist/mg-components/p-7cda52b6.js.map +0 -1
  332. package/dist/mg-components/styles/fonts.css +0 -1
  333. package/dist/mg-components/styles/global.css +0 -1
  334. package/dist/mg-components/styles/main.css +0 -1
  335. package/dist/mg-components/styles/mg-components-utils.css +0 -1
  336. package/dist/mg-components/styles/variables.css +0 -1
  337. package/dist/mg-components/variables.css +0 -1
  338. package/dist/types/components/atoms/mg-card/mg-card.conf.d.ts +0 -16
  339. /package/dist/collection/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.conf.js +0 -0
@@ -1,123 +1,51 @@
1
1
  import { h } from "@stencil/core";
2
- import { createID, ClassList, focusableElements, isValidString } from "@mgdis/stencil-helpers";
2
+ import { createID, ClassList, isValidString, toString } from "@mgdis/stencil-helpers";
3
3
  import { initLocales } from "../../../locales";
4
4
  import { dialogRoles } from "./mg-modal.conf";
5
- /*
6
- * @slot content - Modal content
5
+ /**
6
+ * @slot - Modal content
7
7
  * @slot actions - Actions content
8
8
  */
9
9
  export class MgModal {
10
10
  constructor() {
11
- /************
12
- * Internal *
13
- ************/
14
- // Modal focusable elements
15
- this.modalFocusableElements = [];
16
- // Classes
17
- this.classHide = 'mg-c-modal--hide';
18
11
  // IDs
19
12
  this.titleId = '';
13
+ /***********
14
+ * Handles *
15
+ ***********/
20
16
  /**
21
- * Handle last focusable element
22
- * @param event - keyboard event
23
- */
24
- this.handleLastFocusableElement = (event) => {
25
- if (event.key === 'Tab' && !event.shiftKey) {
26
- event.preventDefault();
27
- this.modalFocusableElements[0].focus();
28
- }
29
- };
30
- /**
31
- * Handle first focusable element
32
- * @param event - keyboard event
33
- */
34
- this.handleFirstFocusableElement = (event) => {
35
- if (event.key === 'Tab' && event.shiftKey) {
36
- event.preventDefault();
37
- this.getLastFocusableElement().focus();
38
- }
39
- };
40
- /**
41
- * Get last focusablmeElement
42
- * @returns last modal focusable element
43
- */
44
- this.getLastFocusableElement = () => (this.modalFocusableElements.length > 0 ? this.modalFocusableElements[this.modalFocusableElements.length - 1] : null);
45
- /**
46
- * Method to manage focus on modal focusable elements
47
- */
48
- this.setFocus = () => {
49
- // Get all focusable elements
50
- const slottedFocusableElements = Array.from(this.element.querySelectorAll(focusableElements));
51
- // If close button is enabled or at least one of the slotted element is focusable
52
- if (this.closeButton || slottedFocusableElements.length > 0) {
53
- // Check if slotted focusable elements have shadowDom with focusable elements
54
- this.modalFocusableElements = slottedFocusableElements.reduce((acc, focusableElement) => {
55
- acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(focusableElements) || focusableElement : focusableElement);
56
- return acc;
57
- }, []);
58
- // When close button is enabled it's the first focusable element.
59
- if (this.closeButton && this.closeButtonElement !== undefined) {
60
- this.modalFocusableElements.unshift(this.closeButtonElement);
61
- }
62
- // Add event listener on last element
63
- this.getLastFocusableElement().addEventListener('keydown', this.handleLastFocusableElement);
64
- // Add event listener on first element (case shift + tab)
65
- this.modalFocusableElements[0].addEventListener('keydown', this.handleFirstFocusableElement);
66
- }
67
- };
68
- /*************
69
- * Handlers *
70
- *************/
71
- /**
72
- * Handle close button
17
+ * Closes the modal.
73
18
  */
74
19
  this.handleClose = () => {
75
- this.hide = true;
20
+ this.open = false;
76
21
  };
77
22
  this.identifier = createID('mg-modal');
78
23
  this.dialogRole = dialogRoles[0];
79
24
  this.modalTitle = undefined;
80
25
  this.closeButton = false;
81
- this.hide = undefined;
26
+ this.open = false;
82
27
  this.hasActions = false;
83
- this.hasContent = false;
84
28
  this.classCollection = new ClassList(['mg-c-modal']);
85
29
  }
86
30
  validateDialogRole(newValue) {
87
31
  if (!dialogRoles.includes(newValue))
88
- throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}.`);
32
+ throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${toString(newValue)}.`);
89
33
  }
90
34
  validateModalTitle(newValue) {
91
35
  if (!isValidString(newValue)) {
92
- throw new Error('<mg-modal> prop "modalTitle" is required.');
36
+ throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${toString(newValue)}.`);
93
37
  }
94
38
  }
95
- validateHide(newValue) {
96
- var _a;
39
+ watchOpen(newValue) {
97
40
  if (newValue) {
98
- this.componentHide.emit();
99
- this.classCollection.add(this.classHide);
100
- document.body.style.overflow = this.bodyOverflow;
101
- // reset focus handlers
102
- (_a = this.getLastFocusableElement()) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', this.handleLastFocusableElement);
103
- if (this.modalFocusableElements.length > 0)
104
- this.modalFocusableElements[0].removeEventListener('keydown', this.handleFirstFocusableElement);
105
- }
106
- else if (newValue === false) {
41
+ this.dialog.showModal();
107
42
  this.componentShow.emit();
108
- this.classCollection.delete(this.classHide);
109
43
  document.body.style.overflow = 'hidden';
110
- this.setFocus();
111
44
  }
112
- }
113
- /**
114
- * Handle 'escape' key down
115
- * @param event - keydown event
116
- */
117
- handleKeyDown(event) {
118
- // we can use 'Escape button" when this not a blocking modal, induced by closeButton value.
119
- if (this.closeButton && event.key === 'Escape') {
120
- this.hide = true;
45
+ else {
46
+ this.dialog.close();
47
+ this.componentHide.emit();
48
+ document.body.style.overflow = this.bodyOverflow;
121
49
  }
122
50
  }
123
51
  /*************
@@ -133,37 +61,32 @@ export class MgModal {
133
61
  this.messages = initLocales(this.element).messages;
134
62
  // Validate
135
63
  this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
136
- this.hasContent = this.element.querySelector('[slot="content"]') !== null;
137
64
  this.titleId = `${this.identifier}-title`;
138
65
  this.validateModalTitle(this.modalTitle);
139
- this.validateHide(this.hide);
140
66
  this.validateDialogRole(this.dialogRole);
141
67
  }
142
68
  /**
143
- * Add observer on component to set focus when displayed
69
+ * Define open state on component load
144
70
  */
145
71
  componentDidLoad() {
146
- new MutationObserver(mutationList => {
147
- // as mutation.target is null on chrome and '' or undefined on firefox we test both with the 'aria-hidden' attribute mutation
148
- if (mutationList.some(mutation => mutation.attributeName === 'aria-hidden' && ['', null, undefined].includes(mutation.target.ariaHidden))) {
149
- // Set focus on first element
150
- this.modalFocusableElements[0].focus();
151
- }
152
- }).observe(this.element.shadowRoot.getElementById(this.identifier), { attributes: true });
72
+ this.watchOpen(this.open);
73
+ // update open prop when use escape key
74
+ this.dialog.addEventListener('close', () => {
75
+ this.open = false;
76
+ });
153
77
  }
154
78
  /**
155
79
  * Render
156
80
  * @returns HTML Element
157
81
  */
158
82
  render() {
159
- return (h("div", { key: '472cae1bd3a5291e14265d00ee594c726f179a1f', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", { key: '870e59e1126988fefe5c04380b5bbd593e8629af' }, h("div", { key: '9d49127cf8bf68b55549f379b760c6597b1a2d6c', class: "mg-c-modal__dialog" }, h("header", { key: 'b8629ece3524f5dd64b248080fa06f21980ddf7b', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: 'f38d648290d1db901fb2cc09ae8b8ed13bf7e0b6', class: "mg-c-modal__close-button" }, h("mg-button", { key: 'b12aecfd77b5fb7588c3b2f6487c10c2cba9f097', identifier: `${this.identifier}-close-button`, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose, ref: (el) => {
83
+ return (h("dialog", { key: '1b3de14b6dddfc77dc5906353a93689d3af9d8c8', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
160
84
  if (el !== null) {
161
- // store closeButton Element
162
- this.closeButtonElement = el;
163
- // add close button element to modalFocusableElements when it is render
164
- this.modalFocusableElements.unshift(this.closeButtonElement);
85
+ this.dialog = el;
165
86
  }
166
- } }, h("mg-icon", { key: '2e5590b14d6b4da659f4f6d8630606a9bafdb9c6', icon: "cross" })))), h("h1", { key: '6ca12328af9955d0716c330c32004c68cca11b4c', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { key: '0873f01de1bfe75c2e91ea89b762d433006e7878', class: "mg-c-modal__content" }, h("slot", { key: 'dd8fd2e6527d640c40261dcbae76846d107337dc', name: "content" }))), this.hasActions && (h("footer", { key: 'e97c6d3ad9bbca892afcabeb5b15e63425d05070', class: "mg-c-modal__footer" }, h("slot", { key: 'c865f0b4244f5ea4ed5e7733813a8b10bc985504', name: "actions" })))))));
87
+ } }, h("mg-card", { key: 'e3d8e671d49f39a0173663fbae37f93c50c0a028' }, h("div", { key: '249b985c471aca4b06548b7e89f68f94a7ee2976', class: "mg-c-modal__dialog" }, h("header", { key: '1c5a329670e1b789c55806a044fa73330582313e', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: 'a0d0b831d05ef09e78b31dc579df2c204a38b41a', class: "mg-c-modal__close-button" }, h("mg-button", { key: '26d93a8bc8a3fc7578ad4127acad645da28a035c', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton,
88
+ // eslint-disable-next-line react/jsx-no-bind
89
+ onClick: this.handleClose }, h("mg-icon", { key: 'adbbd878cf4967f02d636bbf815a79a8fe4c08b1', icon: "cross" })))), h("h1", { key: '274ad2b5d4f030725d6bf6201945d668b9ba056e', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: 'd0bf1bee2472a49da0826a8013fc7f84262d2b4b', class: "mg-c-modal__content" }, h("slot", { key: '83901bde6eeab22c14873e5b8d714826d194cff0' })), this.hasActions && (h("footer", { key: '16ea5be07e639f12373b79be575f9bd142b4c426', class: "mg-c-modal__footer" }, h("slot", { key: 'ca1204b8f12322795a28cadece382be9001b4684', name: "actions" })))))));
167
90
  }
168
91
  static get is() { return "mg-modal"; }
169
92
  static get encapsulation() { return "shadow"; }
@@ -256,7 +179,7 @@ export class MgModal {
256
179
  "reflect": false,
257
180
  "defaultValue": "false"
258
181
  },
259
- "hide": {
182
+ "open": {
260
183
  "type": "boolean",
261
184
  "mutable": true,
262
185
  "complexType": {
@@ -268,17 +191,17 @@ export class MgModal {
268
191
  "optional": false,
269
192
  "docs": {
270
193
  "tags": [],
271
- "text": "Define if modal is hidden"
194
+ "text": "Define if modal is open"
272
195
  },
273
- "attribute": "hide",
274
- "reflect": false
196
+ "attribute": "open",
197
+ "reflect": false,
198
+ "defaultValue": "false"
275
199
  }
276
200
  };
277
201
  }
278
202
  static get states() {
279
203
  return {
280
204
  "hasActions": {},
281
- "hasContent": {},
282
205
  "classCollection": {}
283
206
  };
284
207
  }
@@ -324,17 +247,8 @@ export class MgModal {
324
247
  "propName": "modalTitle",
325
248
  "methodName": "validateModalTitle"
326
249
  }, {
327
- "propName": "hide",
328
- "methodName": "validateHide"
329
- }];
330
- }
331
- static get listeners() {
332
- return [{
333
- "name": "keydown",
334
- "method": "handleKeyDown",
335
- "target": "window",
336
- "capture": false,
337
- "passive": false
250
+ "propName": "open",
251
+ "methodName": "watchOpen"
338
252
  }];
339
253
  }
340
254
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mg-modal.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-modal/mg-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,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2DAAI,KAAK,EAAC,mBAAmB,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,IAC3C,IAAI,CAAC,UAAU,CACb,CACE;oBAER,IAAI,CAAC,UAAU,IAAI,CAClB,gEAAS,KAAK,EAAC,qBAAqB;wBAClC,6DAAM,IAAI,EAAC,SAAS,GAAQ,CACpB,CACX;oBAEA,IAAI,CAAC,UAAU,IAAI,CAClB,+DAAQ,KAAK,EAAC,oBAAoB;wBAChC,6DAAM,IAAI,EAAC,SAAS,GAAQ,CACrB,CACV,CACG,CACE,CACN,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch, Element, Event, EventEmitter, Listen } from '@stencil/core';\nimport { createID, ClassList, focusableElements, isValidString } from '@mgdis/stencil-helpers';\nimport { initLocales } from '../../../locales';\nimport { DialogRoleType, dialogRoles } from './mg-modal.conf';\n\n/*\n * @slot content - Modal content\n * @slot actions - Actions content\n */\n@Component({\n tag: 'mg-modal',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-modal.css',\n shadow: true,\n})\nexport class MgModal {\n /************\n * Internal *\n ************/\n\n // Modal focusable elements\n private modalFocusableElements: HTMLElement[] = [];\n private closeButtonElement: HTMLMgButtonElement;\n\n // Classes\n private readonly classHide = 'mg-c-modal--hide';\n\n // IDs\n private titleId = '';\n\n // Locales\n private messages;\n\n // body overflow default\n private bodyOverflow: string;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgModalElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n * If not set, it will be created.\n */\n @Prop() identifier: string = createID('mg-modal');\n\n /**\n * Modal dialog role.\n */\n @Prop() dialogRole: DialogRoleType = dialogRoles[0];\n @Watch('dialogRole')\n validateDialogRole(newValue: MgModal['dialogRole']): void {\n if (!dialogRoles.includes(newValue)) throw new Error(`<mg-modal> prop \"dialogRole\" must be one of: ${dialogRoles.join(', ')}.`);\n }\n\n /**\n * Displayed modal title\n */\n @Prop() modalTitle!: string;\n @Watch('modalTitle')\n validateModalTitle(newValue: MgModal['modalTitle']): void {\n if (!isValidString(newValue)) {\n throw new Error('<mg-modal> prop \"modalTitle\" is required.');\n }\n }\n\n /**\n * Define if modal has a cross button\n */\n @Prop() closeButton = false;\n\n /**\n * Define if modal is hidden\n */\n @Prop({ mutable: true }) hide: boolean;\n @Watch('hide')\n validateHide(newValue: MgModal['hide']): void {\n if (newValue) {\n this.componentHide.emit();\n this.classCollection.add(this.classHide);\n document.body.style.overflow = this.bodyOverflow;\n // reset focus handlers\n this.getLastFocusableElement()?.removeEventListener('keydown', this.handleLastFocusableElement);\n if (this.modalFocusableElements.length > 0) this.modalFocusableElements[0].removeEventListener('keydown', this.handleFirstFocusableElement);\n } else if (newValue === false) {\n this.componentShow.emit();\n this.classCollection.delete(this.classHide);\n document.body.style.overflow = 'hidden';\n this.setFocus();\n }\n }\n\n /**\n * Define if component is using actions slot\n */\n @State() hasActions = false;\n\n /**\n * Define if component is using content slot\n */\n @State() hasContent = false;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-modal']);\n\n /**\n * Emmited event when modal is diplayed\n */\n @Event({ eventName: 'component-show' }) componentShow: EventEmitter<void>;\n\n /**\n * Emmited event when modal is hidden\n */\n @Event({ eventName: 'component-hide' }) componentHide: EventEmitter<void>;\n\n /**\n * Handle 'escape' key down\n * @param event - keydown event\n */\n @Listen('keydown', {\n target: 'window',\n })\n handleKeyDown(event: KeyboardEvent): void {\n // we can use 'Escape button\" when this not a blocking modal, induced by closeButton value.\n if (this.closeButton && event.key === 'Escape') {\n this.hide = true;\n }\n }\n\n /**\n * Handle last focusable element\n * @param event - keyboard event\n */\n private handleLastFocusableElement = (event): void => {\n if (event.key === 'Tab' && !event.shiftKey) {\n event.preventDefault();\n this.modalFocusableElements[0].focus();\n }\n };\n\n /**\n * Handle first focusable element\n * @param event - keyboard event\n */\n private handleFirstFocusableElement = (event): void => {\n if (event.key === 'Tab' && event.shiftKey) {\n event.preventDefault();\n this.getLastFocusableElement().focus();\n }\n };\n\n /**\n * Get last focusablmeElement\n * @returns last modal focusable element\n */\n private getLastFocusableElement = (): HTMLElement | null => (this.modalFocusableElements.length > 0 ? this.modalFocusableElements[this.modalFocusableElements.length - 1] : null);\n\n /**\n * Method to manage focus on modal focusable elements\n */\n private setFocus = (): void => {\n // Get all focusable elements\n const slottedFocusableElements = Array.from(this.element.querySelectorAll(focusableElements));\n // If close button is enabled or at least one of the slotted element is focusable\n if (this.closeButton || slottedFocusableElements.length > 0) {\n // Check if slotted focusable elements have shadowDom with focusable elements\n this.modalFocusableElements = slottedFocusableElements.reduce((acc, focusableElement) => {\n acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(focusableElements) || focusableElement : focusableElement);\n return acc;\n }, []);\n // When close button is enabled it's the first focusable element.\n if (this.closeButton && this.closeButtonElement !== undefined) {\n this.modalFocusableElements.unshift(this.closeButtonElement);\n }\n // Add event listener on last element\n this.getLastFocusableElement().addEventListener('keydown', this.handleLastFocusableElement);\n // Add event listener on first element (case shift + tab)\n this.modalFocusableElements[0].addEventListener('keydown', this.handleFirstFocusableElement);\n }\n };\n\n /*************\n * Handlers *\n *************/\n\n /**\n * Handle close button\n */\n private handleClose = (): void => {\n this.hide = true;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n // Store body overflow\n this.bodyOverflow = document.body.style.overflow;\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.hasActions = this.element.querySelector('[slot=\"actions\"]') !== null;\n this.hasContent = this.element.querySelector('[slot=\"content\"]') !== null;\n this.titleId = `${this.identifier}-title`;\n this.validateModalTitle(this.modalTitle);\n this.validateHide(this.hide);\n this.validateDialogRole(this.dialogRole);\n }\n\n /**\n * Add observer on component to set focus when displayed\n */\n componentDidLoad(): void {\n new MutationObserver(mutationList => {\n // as mutation.target is null on chrome and '' or undefined on firefox we test both with the 'aria-hidden' attribute mutation\n if (mutationList.some(mutation => mutation.attributeName === 'aria-hidden' && ['', null, undefined].includes((mutation.target as HTMLElement).ariaHidden))) {\n // Set focus on first element\n this.modalFocusableElements[0].focus();\n }\n }).observe(this.element.shadowRoot.getElementById(this.identifier), { attributes: true });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <div role={this.dialogRole} id={this.identifier} class={this.classCollection.join()} tabindex=\"-1\" aria-labelledby={this.titleId} aria-modal=\"true\" aria-hidden={this.hide}>\n <mg-card>\n <div class=\"mg-c-modal__dialog\">\n <header class=\"mg-c-modal__header\">\n {this.closeButton && (\n <span class=\"mg-c-modal__close-button\">\n <mg-button\n identifier={`${this.identifier}-close-button`}\n is-icon\n variant=\"flat\"\n label={this.messages.modal.closeButton}\n onClick={this.handleClose}\n ref={(el: HTMLMgButtonElement) => {\n if (el !== null) {\n // store closeButton Element\n this.closeButtonElement = el;\n // add close button element to modalFocusableElements when it is render\n this.modalFocusableElements.unshift(this.closeButtonElement);\n }\n }}\n >\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n </span>\n )}\n <h1 class=\"mg-c-modal__title\" id={this.titleId}>\n {this.modalTitle}\n </h1>\n </header>\n\n {this.hasContent && (\n <article class=\"mg-c-modal__content\">\n <slot name=\"content\"></slot>\n </article>\n )}\n\n {this.hasActions && (\n <footer class=\"mg-c-modal__footer\">\n <slot name=\"actions\"></slot>\n </footer>\n )}\n </div>\n </mg-card>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-modal.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-modal/mg-modal.tsx"],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AAU,EACnB,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,qBACjB,IAAI,CAAC,OAAO,EAC7B,GAAG,EAAE,CAAC,EAAqB,EAAE,EAAE;gBAC7B,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;oBAChB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;gBACnB,CAAC;YACH,CAAC;YAED;gBACE,4DAAK,KAAK,EAAC,oBAAoB;oBAC7B,+DAAQ,KAAK,EAAC,oBAAoB;wBAC/B,IAAI,CAAC,WAAW,IAAI,CACnB,6DAAM,KAAK,EAAC,0BAA0B;4BACpC,mFAEE,OAAO,EAAC,MAAM,EACd,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW;gCACtC,6CAA6C;gCAC7C,OAAO,EAAE,IAAI,CAAC,WAAW;gCAEzB,gEAAS,IAAI,EAAC,OAAO,GAAW,CACtB,CACP,CACR;wBACD,2DAAI,KAAK,EAAC,mBAAmB,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,IAC3C,IAAI,CAAC,UAAU,CACb,CACE;oBACT,gEAAS,KAAK,EAAC,qBAAqB;wBAClC,8DAAa,CACL;oBACT,IAAI,CAAC,UAAU,IAAI,CAClB,+DAAQ,KAAK,EAAC,oBAAoB;wBAChC,6DAAM,IAAI,EAAC,SAAS,GAAQ,CACrB,CACV,CACG,CACE,CACH,CACV,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch, Element, Event, EventEmitter } from '@stencil/core';\nimport { createID, ClassList, isValidString, toString } from '@mgdis/stencil-helpers';\nimport { initLocales } from '../../../locales';\nimport { DialogRoleType, dialogRoles } from './mg-modal.conf';\n\n/**\n * @slot - Modal content\n * @slot actions - Actions content\n */\n@Component({\n tag: 'mg-modal',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-modal.css',\n shadow: true,\n})\nexport class MgModal {\n /************\n * Internal *\n ************/\n\n // Modal focusable elements\n private dialog: HTMLDialogElement;\n\n // IDs\n private titleId = '';\n\n // Locales\n private messages;\n\n // body overflow default\n private bodyOverflow: string;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgModalElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n * If not set, it will be created.\n */\n @Prop() identifier: string = createID('mg-modal');\n\n /**\n * Modal dialog role.\n */\n @Prop() dialogRole: DialogRoleType = dialogRoles[0];\n @Watch('dialogRole')\n validateDialogRole(newValue: MgModal['dialogRole']): void {\n if (!dialogRoles.includes(newValue)) throw new Error(`<mg-modal> prop \"dialogRole\" must be one of: ${dialogRoles.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Displayed modal title\n */\n @Prop() modalTitle!: string;\n @Watch('modalTitle')\n validateModalTitle(newValue: MgModal['modalTitle']): void {\n if (!isValidString(newValue)) {\n throw new Error(`<mg-modal> prop \"modalTitle\" is required. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define if modal has a cross button\n */\n @Prop() closeButton = false;\n\n /**\n * Define if modal is open\n */\n @Prop({ mutable: true }) open = false;\n @Watch('open')\n watchOpen(newValue: boolean): void {\n if (newValue) {\n this.dialog.showModal();\n this.componentShow.emit();\n document.body.style.overflow = 'hidden';\n } else {\n this.dialog.close();\n this.componentHide.emit();\n document.body.style.overflow = this.bodyOverflow;\n }\n }\n\n /**\n * Define if component is using actions slot\n */\n @State() hasActions = false;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-modal']);\n\n /**\n * Emmited event when modal is diplayed\n */\n @Event({ eventName: 'component-show' }) componentShow: EventEmitter<void>;\n\n /**\n * Emmited event when modal is hidden\n */\n @Event({ eventName: 'component-hide' }) componentHide: EventEmitter<void>;\n\n /***********\n * Handles *\n ***********/\n\n /**\n * Closes the modal.\n */\n private handleClose = (): void => {\n this.open = false;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n // Store body overflow\n this.bodyOverflow = document.body.style.overflow;\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.hasActions = this.element.querySelector('[slot=\"actions\"]') !== null;\n this.titleId = `${this.identifier}-title`;\n this.validateModalTitle(this.modalTitle);\n this.validateDialogRole(this.dialogRole);\n }\n\n /**\n * Define open state on component load\n */\n componentDidLoad(): void {\n this.watchOpen(this.open);\n // update open prop when use escape key\n this.dialog.addEventListener('close', () => {\n this.open = false;\n });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <dialog\n role={this.dialogRole}\n id={this.identifier}\n class={this.classCollection.join()}\n aria-labelledby={this.titleId}\n ref={(el: HTMLDialogElement) => {\n if (el !== null) {\n this.dialog = el;\n }\n }}\n >\n <mg-card>\n <div class=\"mg-c-modal__dialog\">\n <header class=\"mg-c-modal__header\">\n {this.closeButton && (\n <span class=\"mg-c-modal__close-button\">\n <mg-button\n is-icon\n variant=\"flat\"\n label={this.messages.modal.closeButton}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={this.handleClose}\n >\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n </span>\n )}\n <h1 class=\"mg-c-modal__title\" id={this.titleId}>\n {this.modalTitle}\n </h1>\n </header>\n <article class=\"mg-c-modal__content\">\n <slot></slot>\n </article>\n {this.hasActions && (\n <footer class=\"mg-c-modal__footer\">\n <slot name=\"actions\"></slot>\n </footer>\n )}\n </div>\n </mg-card>\n </dialog>\n );\n }\n}\n"]}
@@ -1,6 +1,5 @@
1
- export var NavigationAction;
2
- (function (NavigationAction) {
3
- NavigationAction["NEXT"] = "next";
4
- NavigationAction["PREVIOUS"] = "previous";
5
- })(NavigationAction || (NavigationAction = {}));
1
+ export const NavigationAction = {
2
+ NEXT: 'next',
3
+ PREVIOUS: 'previous',
4
+ };
6
5
  //# sourceMappingURL=mg-pagination.conf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mg-pagination.conf.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-pagination/mg-pagination.conf.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,yCAAqB,CAAA;AACvB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B","sourcesContent":["export enum NavigationAction {\n NEXT = 'next',\n PREVIOUS = 'previous',\n}\n"]}
1
+ {"version":3,"file":"mg-pagination.conf.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-pagination/mg-pagination.conf.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACrB,CAAC","sourcesContent":["export const NavigationAction = {\n NEXT: 'next',\n PREVIOUS: 'previous',\n};\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 { NavigationAction } from "./mg-pagination.conf";
4
4
  import { initLocales } from "./../../../locales";
5
5
  /**
@@ -61,15 +61,15 @@ export class MgPagination {
61
61
  }
62
62
  validateTotalPages(newValue) {
63
63
  if (newValue < 1) {
64
- throw new Error('<mg-pagination> prop "totalPages" must be greater than 0');
64
+ throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${toString(newValue)}.`);
65
65
  }
66
66
  }
67
67
  validateCurrentPage(newValue) {
68
68
  if (newValue < 1) {
69
- throw new Error('<mg-pagination> prop "currentPage" must be greater than 0');
69
+ throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${toString(newValue)}.`);
70
70
  }
71
71
  else if (newValue > this.totalPages) {
72
- throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page');
72
+ throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page.');
73
73
  }
74
74
  this.currentPageChange.emit(newValue);
75
75
  }
@@ -95,10 +95,10 @@ export class MgPagination {
95
95
  * @returns HTML Element
96
96
  */
97
97
  render() {
98
- const navigationActionButton = (disabled, action) => (h("mg-button", { key: 'b708c70615e0fb49d1628dc6cf83e54ea5ab0a61', identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
98
+ const navigationActionButton = (disabled, action) => (h("mg-button", { key: '76bdc93c328042ef6d6d8dafce5a701629f59903', label: this.messages.pagination[`${action}Page`],
99
99
  // eslint-disable-next-line react/jsx-no-bind
100
- onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { key: '1c8375c68fd7729fb7ea91220ffb4f7267ac3a47', icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { key: '1af0c20c2d5ce86e593b2eca82dee410a782c193', icon: "chevron-right" })));
101
- return (h(Host, { key: '4490a0b9d3c0ac55519d052b4d76ab8f682f0f3a', hidden: this.totalPages < 2 }, h("nav", { key: 'eaf362cd327e88290f3af5dcfd1d46fff6178ff9', role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("mg-input-select", { key: '06c9786c833302a4ee88ed7f2217875112ee7a20', identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true })), h("span", { key: '7877dbee55a509b13c8cf881154d96bbe1c5cee7', class: "mg-u-visually-hidden" }, this.messages.pagination.page, " ", this.currentPage), h("span", { key: 'd4615625b40108526f7aaa8f8a8505b2a61e43e9', class: { 'mg-u-visually-hidden': this.hidePageCount } }, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
100
+ onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { key: '336f048488682bfbdd7510d52519ed495ff5f1b6', icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { key: '454f119cb4a20e794be2f708e4f4f5df198da114', icon: "chevron-right" })));
101
+ return (h(Host, { key: 'b260a359ad34cc05ed6304f6d3312dcecc940f1c', hidden: this.totalPages < 2 }, h("nav", { key: '66e2400d787d7decaabf8bb982842fdc07a7be56', role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("div", { key: '9cea1e9d1e65f15a1e96bb36e924c99f0b383348', class: "mg-c-pagination__page-count" }, h("mg-input-select", { key: '8232db02df5ce94af250b00ccf000bead9897f88', identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { key: '449f4c3790d159a9703135dd0e9c3e2e09df44a7', class: "mg-u-visually-hidden" }, this.messages.pagination.page, " ", this.currentPage), "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page)), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
102
102
  }
103
103
  static get is() { return "mg-pagination"; }
104
104
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"mg-pagination.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-pagination/mg-pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,IAAI,GAAG,CAAC,EAAY,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AAO3J,MAAM,OAAO,YAAY;;QAsEvB;;;WAGG;QACK,aAAQ,GAAG,CAAC,MAAc,EAAQ,EAAE;YAC1C,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC5B,CAAC,CAAC;QAEF;;sBAEc;QAEd;;;WAGG;QACK,iBAAY,GAAG,CAAC,KAAgD,EAAQ,EAAE;YAChF,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC;QAEF;;;;WAIG;QACK,mBAAc,GAAG,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,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAC7D,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,gBAC9B,IAAI,qBACC,IAAI,CAAC,YAAY,EAClC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,6BAEjB,CACpB;gBACD,6DAAM,KAAK,EAAC,sBAAsB;oBAC/B,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI;;oBAAG,IAAI,CAAC,WAAW,CAC5C;gBACP,6DAAM,KAAK,EAAE,EAAE,sBAAsB,EAAE,IAAI,CAAC,aAAa,EAAE;;oBACtD,IAAI,CAAC,UAAU;;oBAAG,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CACpG;gBACN,sBAAsB,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAC/E,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, Watch, Event, EventEmitter, Host } from '@stencil/core';\nimport { createID } from '@mgdis/stencil-helpers';\nimport { NavigationAction } from './mg-pagination.conf';\nimport { initLocales } from './../../../locales';\n\n/**\n * Range generator\n *\n * ```\n * start by get the range length, add \"+ 1\" to include last value, ex: Math.ceil((3 + 1 - 1) / 1) => 3\n * then with Array(Math.ceil...) we get the final array with empty values, ex: Array(Math.ceil(2 + 1 - 1) / 1)) => [empty, empty, empty]\n * then with Array(Math.ceil...).keys() we get the Array Iterator from empty values\n * then with Array.from(Array(...)) we get the complete array with \"index\" values instead of \"empty\" values\n * ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()) => [0, 1, 2]\n * finaly we map values from \"start\" range and apply the \"step\" coefficiant,\n * ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()).map(x => 1 + x * 1) => [1, 2, 3]\n * ```\n *\n * range(1, 1) = [1]\n * range(1, 5) = [1, 2, 3, 4, 5]\n * range(10, 20, 2) = [10, 12, 14, 16, 18, 20]\n * @param start - start range\n * @param end - start end\n * @param step - step size\n * @returns range numbers\n */\nconst range = (start: number, end: number, step = 1): number[] => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);\n\n@Component({\n tag: 'mg-pagination',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-pagination.css',\n shadow: true,\n})\nexport class MgPagination {\n /************\n * Internal *\n ************/\n\n // Locales\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPaginationElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n * If not set, it will be created.\n */\n @Prop() identifier: string = createID('mg-pagination');\n\n /**\n * Panignation label. Is a short description.\n * Customize default value can be usefull to improve accessibility\n */\n @Prop({ mutable: true }) label: string;\n\n /**\n * Hide navigation label\n */\n @Prop() hideNavigationLabels?: boolean;\n\n /**\n * Hide select input\n */\n @Prop() hidePageCount?: boolean;\n\n /**\n * Component total pages\n */\n @Prop() totalPages = 1;\n @Watch('totalPages')\n validateTotalPages(newValue: number): void {\n if (newValue < 1) {\n throw new Error('<mg-pagination> prop \"totalPages\" must be greater than 0');\n }\n }\n\n /**\n * Component current page\n */\n @Prop({ reflect: true, mutable: true }) currentPage = 1;\n @Watch('currentPage')\n validateCurrentPage(newValue: number): void {\n if (newValue < 1) {\n throw new Error('<mg-pagination> prop \"currentPage\" must be greater than 0');\n } else if (newValue > this.totalPages) {\n throw new Error('<mg-pagination> prop \"currentPage\" can not be greater than total page');\n }\n\n this.currentPageChange.emit(newValue);\n }\n\n /**\n * Emmited event when current page change\n */\n @Event({ eventName: 'current-page-change' }) currentPageChange: EventEmitter<number>;\n\n /**\n * Change current page from target\n * @param target - target page\n */\n private goToPage = (target: number): void => {\n this.currentPage = target;\n };\n\n /************\n * Handlers *\n ************/\n\n /**\n * select handler\n * @param event - value change event\n */\n private handleSelect = (event: InputEvent & { target: HTMLInputElement }): void => {\n const to = Number(event.target.value);\n this.goToPage(to > 0 ? to : 1);\n };\n\n /**\n * Go to 'previous/next' page button handler\n * @param action - navigation action\n * @param disabled - button disable state\n */\n private handleGoToPage = (action: string, disabled: boolean): void => {\n !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.validateTotalPages(this.totalPages);\n this.validateCurrentPage(this.currentPage);\n // Set default label\n if (this.label === undefined || this.label === '') {\n this.label = this.messages.pagination.label;\n }\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const navigationActionButton = (disabled: boolean, action: string) => (\n <mg-button\n identifier={`${this.identifier}-button-${action}`}\n label={this.messages.pagination[`${action}Page`]}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => this.handleGoToPage(action, disabled)}\n disabled={disabled}\n variant=\"flat\"\n isIcon={this.hideNavigationLabels}\n >\n {action === NavigationAction.PREVIOUS && <mg-icon icon=\"chevron-left\"></mg-icon>}\n {!this.hideNavigationLabels && this.messages.general[action]}\n {action === NavigationAction.NEXT && <mg-icon icon=\"chevron-right\"></mg-icon>}\n </mg-button>\n );\n\n return (\n <Host hidden={this.totalPages < 2}>\n <nav role=\"navigation\" aria-label={this.label} id={this.identifier} class={{ 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount }}>\n {navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS)}\n {!this.hidePageCount && (\n <mg-input-select\n identifier={`${this.identifier}-select`}\n items={range(1, this.totalPages).map(page => page.toString())}\n label={this.messages.pagination.selectPage}\n label-hide={true}\n on-value-change={this.handleSelect}\n value={this.currentPage.toString()}\n placeholder-hide\n ></mg-input-select>\n )}\n <span class=\"mg-u-visually-hidden\">\n {this.messages.pagination.page} {this.currentPage}\n </span>\n <span class={{ 'mg-u-visually-hidden': this.hidePageCount }}>\n / {this.totalPages} {this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page}\n </span>\n {navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)}\n </nav>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-pagination.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-pagination/mg-pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,IAAI,GAAG,CAAC,EAAY,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, Watch, Event, EventEmitter, Host } from '@stencil/core';\nimport { createID, toString } from '@mgdis/stencil-helpers';\nimport { NavigationAction } from './mg-pagination.conf';\nimport { initLocales } from './../../../locales';\n\n/**\n * Range generator\n *\n * ```\n * start by get the range length, add \"+ 1\" to include last value, ex: Math.ceil((3 + 1 - 1) / 1) => 3\n * then with Array(Math.ceil...) we get the final array with empty values, ex: Array(Math.ceil(2 + 1 - 1) / 1)) => [empty, empty, empty]\n * then with Array(Math.ceil...).keys() we get the Array Iterator from empty values\n * then with Array.from(Array(...)) we get the complete array with \"index\" values instead of \"empty\" values\n * ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()) => [0, 1, 2]\n * finaly we map values from \"start\" range and apply the \"step\" coefficiant,\n * ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()).map(x => 1 + x * 1) => [1, 2, 3]\n * ```\n *\n * range(1, 1) = [1]\n * range(1, 5) = [1, 2, 3, 4, 5]\n * range(10, 20, 2) = [10, 12, 14, 16, 18, 20]\n * @param start - start range\n * @param end - start end\n * @param step - step size\n * @returns range numbers\n */\nconst range = (start: number, end: number, step = 1): number[] => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);\n\n@Component({\n tag: 'mg-pagination',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-pagination.css',\n shadow: true,\n})\nexport class MgPagination {\n /************\n * Internal *\n ************/\n\n // Locales\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPaginationElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n * If not set, it will be created.\n */\n @Prop() identifier: string = createID('mg-pagination');\n\n /**\n * Panignation label. Is a short description.\n * Customize default value can be usefull to improve accessibility\n */\n @Prop({ mutable: true }) label: string;\n\n /**\n * Hide navigation label\n */\n @Prop() hideNavigationLabels?: boolean;\n\n /**\n * Hide select input\n */\n @Prop() hidePageCount?: boolean;\n\n /**\n * Component total pages\n */\n @Prop() totalPages = 1;\n @Watch('totalPages')\n validateTotalPages(newValue: number): void {\n if (newValue < 1) {\n throw new Error(`<mg-pagination> prop \"totalPages\" must be greater than 0. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Component current page\n */\n @Prop({ reflect: true, mutable: true }) currentPage = 1;\n @Watch('currentPage')\n validateCurrentPage(newValue: number): void {\n if (newValue < 1) {\n throw new Error(`<mg-pagination> prop \"currentPage\" must be greater than 0. Passed value: ${toString(newValue)}.`);\n } else if (newValue > this.totalPages) {\n throw new Error('<mg-pagination> prop \"currentPage\" can not be greater than total page.');\n }\n\n this.currentPageChange.emit(newValue);\n }\n\n /**\n * Emmited event when current page change\n */\n @Event({ eventName: 'current-page-change' }) currentPageChange: EventEmitter<number>;\n\n /**\n * Change current page from target\n * @param target - target page\n */\n private goToPage = (target: number): void => {\n this.currentPage = target;\n };\n\n /************\n * Handlers *\n ************/\n\n /**\n * select handler\n * @param event - value change event\n */\n private handleSelect = (event: InputEvent & { target: HTMLInputElement }): void => {\n const to = Number(event.target.value);\n this.goToPage(to > 0 ? to : 1);\n };\n\n /**\n * Go to 'previous/next' page button handler\n * @param action - navigation action\n * @param disabled - button disable state\n */\n private handleGoToPage = (action: string, disabled: boolean): void => {\n !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.validateTotalPages(this.totalPages);\n this.validateCurrentPage(this.currentPage);\n // Set default label\n if (this.label === undefined || this.label === '') {\n this.label = this.messages.pagination.label;\n }\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const navigationActionButton = (disabled: boolean, action: string) => (\n <mg-button\n label={this.messages.pagination[`${action}Page`]}\n // eslint-disable-next-line react/jsx-no-bind\n onClick={() => this.handleGoToPage(action, disabled)}\n disabled={disabled}\n variant=\"flat\"\n isIcon={this.hideNavigationLabels}\n >\n {action === NavigationAction.PREVIOUS && <mg-icon icon=\"chevron-left\"></mg-icon>}\n {!this.hideNavigationLabels && this.messages.general[action]}\n {action === NavigationAction.NEXT && <mg-icon icon=\"chevron-right\"></mg-icon>}\n </mg-button>\n );\n\n return (\n <Host hidden={this.totalPages < 2}>\n <nav role=\"navigation\" aria-label={this.label} id={this.identifier} class={{ 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount }}>\n {navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS)}\n {!this.hidePageCount && (\n <div class=\"mg-c-pagination__page-count\">\n <mg-input-select\n identifier={`${this.identifier}-select`}\n items={range(1, this.totalPages).map(page => page.toString())}\n label={this.messages.pagination.selectPage}\n label-hide={true}\n on-value-change={this.handleSelect}\n value={this.currentPage.toString()}\n placeholder-hide\n ></mg-input-select>\n <span class=\"mg-u-visually-hidden\">\n {this.messages.pagination.page} {this.currentPage}\n </span>\n / {this.totalPages} {this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page}\n </div>\n )}\n {navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)}\n </nav>\n </Host>\n );\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { h } from "@stencil/core";
2
- import { createID, ClassList, isValidString } from "@mgdis/stencil-helpers";
2
+ import { createID, ClassList, isValidString, toString } from "@mgdis/stencil-helpers";
3
3
  import { initLocales } from "../../../locales";
4
4
  import { expandToggleDisplays, titlePositions } from "./mg-panel.conf";
5
- /*
5
+ /**
6
6
  * @slot - Panel content
7
7
  * @slot header-right - Header right panel content
8
8
  */
@@ -64,17 +64,17 @@ export class MgPanel {
64
64
  * Render collapse button
65
65
  * @returns collpase button
66
66
  */
67
- this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.panelTitle }, h("span", { class: "mg-c-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: { 'mg-c-panel__collapse-button-icon': true, 'mg-c-panel__collapse-button-icon--reverse': !this.expanded } }), !this.isEditing && this.expandToggleDisplay !== 'icon' && this.panelTitle)));
67
+ this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", "aria-expanded": this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.panelTitle }, h("span", { class: "mg-c-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: { 'mg-c-panel__collapse-button-icon': true, 'mg-c-panel__collapse-button-icon--reverse': !this.expanded } }), !this.isEditing && this.expandToggleDisplay !== 'icon' && this.panelTitle)));
68
68
  /**
69
69
  * Render edit button
70
70
  * @returns edit Button
71
71
  */
72
- this.renderEditButton = () => (h("mg-button", { key: "edit-button", "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })));
72
+ this.renderEditButton = () => (h("mg-button", { key: "edit-button", "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton }, h("mg-icon", { icon: "pen" })));
73
73
  /**
74
74
  * Render input button
75
75
  * @returns edit title input
76
76
  */
77
- this.renderEditInput = () => (h("mg-input-text", { key: "edition-input", label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: (el) => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` }, h("mg-icon", { icon: "check" }))));
77
+ this.renderEditInput = () => (h("mg-input-text", { key: "edition-input", label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, characterLeftHide: true, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: (el) => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton }, h("mg-icon", { icon: "check" }))));
78
78
  /**
79
79
  * Render title
80
80
  * @returns title element
@@ -115,7 +115,7 @@ export class MgPanel {
115
115
  }
116
116
  validatePanelTitle(newValue) {
117
117
  if (!isValidString(newValue))
118
- throw new Error('<mg-panel> prop "panelTitle" is required.');
118
+ throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${toString(newValue)}.`);
119
119
  this.titleChange.emit(newValue);
120
120
  }
121
121
  validateTitlePattern(newValue) {
@@ -124,14 +124,14 @@ export class MgPanel {
124
124
  }
125
125
  validateTitlePosition(newValue) {
126
126
  if (!titlePositions.includes(newValue))
127
- throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}.`);
127
+ throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${toString(newValue)}.`);
128
128
  }
129
129
  handleExpanded(newValue) {
130
130
  this.expandedChange.emit(newValue);
131
131
  }
132
132
  validateExpandToggleDisplay(newValue) {
133
133
  if (!expandToggleDisplays.includes(newValue))
134
- throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}.`);
134
+ throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${toString(newValue)}.`);
135
135
  if (newValue === 'icon' && this.titleEditable)
136
136
  this.titleEditable = false;
137
137
  }
@@ -165,7 +165,7 @@ export class MgPanel {
165
165
  */
166
166
  render() {
167
167
  const headerId = `${this.identifier}-header`;
168
- return (h("section", { key: 'd01136210425cb7790aab87d6c137ba74fc02af5', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '84084da775de623fd20c069de5e49d2542755907' }, h("header", { key: '9f3ef1d0d7b2dc275d0c7b39175e0f775cbb1e1b', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: '4b6cd2b1b604515d657368642fe21b21eb33b55b', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '45db8591e0b85ed5e9704dc1a42fa75d24e96e39' })))));
168
+ return (h("section", { key: '3999a8ed86a5b7eb4329e4c2aa9064535f6fad99', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: 'bc777219b2e11f08975d6daa911b237a5a71f0b1' }, h("header", { key: '8e740323476aaa2f7c4f10c52b2107f05e156f1a', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: '9afe2db9371628027e8c2feff6b11235432f98d2', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '3a6592a91938b6dee66e7b59f7a7e490256582eb' })))));
169
169
  }
170
170
  static get is() { return "mg-panel"; }
171
171
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"mg-panel.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-panel/mg-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAwD,oBAAoB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE7H;;;GAGG;AAMH,MAAM,OAAO,OAAO;;QAkHlB;;sBAEc;QAEd;;WAEG;QACK,oBAAe,GAAG,GAAS,EAAE;YACnC,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;QACnC,CAAC,CAAC;QAEF;;sBAEc;QAEd;;WAEG;QACK,yBAAoB,GAAG,GAAS,EAAE;YACxC,IAAI,CAAC,IAAI,CAAC,oBAAoB;gBAAE,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACjE,CAAC,CAAC;QAEF;;WAEG;QACK,qBAAgB,GAAG,GAAS,EAAE;YACpC,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,CAAC,CAAC;QAEF;;;WAGG;QACK,sBAAiB,GAAG,CAAC,KAA0B,EAAQ,EAAE;YAC/D,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC;QACxC,CAAC,CAAC;QAEF;;WAEG;QACK,2BAAsB,GAAG,GAAS,EAAE;YAC1C,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;YACnC,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,CAAC,CAAC;QAEF;;WAEG;QACK,6BA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BAAgB,CAAC,QAAQ,EAAE,CAAC;IACvD,CAAC;IA+GD;;;OAGG;IACH,MAAM;QACJ,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,UAAU,SAAS,CAAC;QAC7C,OAAO,CACL,gEAAS,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU;YAC9D;gBACE,+DAAQ,KAAK,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,CAAC,aAAa,KAAK,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,IACvH,IAAI,CAAC,oBAAoB,EAAE,CACrB;gBACT,gEAAS,KAAK,EAAC,qBAAqB,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,UAAU,qBAAmB,QAAQ,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ;oBACtH,8DAAa,CACL,CACF,CACF,CACX,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, State, EventEmitter, Watch, Event } from '@stencil/core';\nimport { createID, ClassList, isValidString } from '@mgdis/stencil-helpers';\nimport { initLocales } from '../../../locales';\nimport { type ExpandToggleDisplayType, type TitlePositionType, expandToggleDisplays, titlePositions } from './mg-panel.conf';\n\n/*\n * @slot - Panel content\n * @slot header-right - Header right panel content\n */\n@Component({\n tag: 'mg-panel',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-panel.css',\n shadow: true,\n})\nexport class MgPanel {\n /************\n * Internal *\n ************/\n\n // HTML selector\n private editInputElement: HTMLMgInputTextElement;\n\n // Locales\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPanelElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n * If not set, it will be created.\n */\n @Prop() identifier: string = createID('mg-panel');\n\n /**\n * Panel title\n */\n @Prop({ mutable: true }) panelTitle!: string;\n @Watch('panelTitle')\n validatePanelTitle(newValue: MgPanel['panelTitle']): void {\n if (!isValidString(newValue)) throw new Error('<mg-panel> prop \"panelTitle\" is required.');\n this.titleChange.emit(newValue);\n }\n\n /**\n * Panel title pattern\n */\n @Prop() titlePattern?: string;\n\n /**\n * Panel title pattern error message\n */\n @Prop() titlePatternErrorMessage?: string;\n @Watch('titlePattern')\n @Watch('titlePatternErrorMessage')\n validateTitlePattern(newValue: string): void {\n if (newValue !== undefined && !this.titleEditable) throw new Error(`<mg-panel> prop \"titleEditable\" must be set to \"true\".`);\n }\n\n /**\n * Define if panel title is editable\n */\n @Prop({ mutable: true }) titleEditable = false;\n\n /**\n * Define title position\n */\n @Prop() titlePosition: TitlePositionType = titlePositions[0];\n @Watch('titlePosition')\n validateTitlePosition(newValue: MgPanel['titlePosition']) {\n if (!titlePositions.includes(newValue)) throw new Error(`<mg-panel> prop \"titlePosition\" must be one of: ${titlePositions.join(', ')}.`);\n }\n\n /**\n * Panel is opened\n */\n @Prop({ mutable: true }) expanded = false;\n @Watch('expanded')\n handleExpanded(newValue: MgPanel['expanded']): void {\n this.expandedChange.emit(newValue);\n }\n\n /**\n * Define expand toggle button display\n */\n @Prop() expandToggleDisplay: ExpandToggleDisplayType = expandToggleDisplays[0];\n @Watch('expandToggleDisplay')\n validateExpandToggleDisplay(newValue: MgPanel['expandToggleDisplay']) {\n if (!expandToggleDisplays.includes(newValue)) throw new Error(`<mg-panel> prop \"expandToggleDisplay\" must be one of: ${expandToggleDisplays.join(', ')}.`);\n if (newValue === 'icon' && this.titleEditable) this.titleEditable = false;\n }\n\n /**\n * Disable possibility to toggle expand\n */\n @Prop() expandToggleDisabled?: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-panel']);\n\n /**\n * Title is in edition mode\n */\n @State() isEditing = false;\n\n /**\n * Cache for updated panel title before validation\n */\n @State() updatedPanelTitle: string;\n\n /**\n * Emmited event when title change\n */\n @Event({ eventName: 'title-change' }) titleChange: EventEmitter<HTMLMgPanelElement['panelTitle']>;\n\n /**\n * Emmited event when expanded change\n */\n @Event({ eventName: 'expanded-change' }) expandedChange: EventEmitter<HTMLMgPanelElement['expanded']>;\n\n /************\n * Methods *\n ************/\n\n /**\n * Toggle is editing state\n */\n private toggleIsEditing = (): void => {\n this.isEditing = !this.isEditing;\n };\n\n /************\n * Handlers *\n ************/\n\n /**\n * Collapse button click handler\n */\n private handleCollapseButton = (): void => {\n if (!this.expandToggleDisabled) this.expanded = !this.expanded;\n };\n\n /**\n * Edit button click handler\n */\n private handleEditButton = (): void => {\n this.toggleIsEditing();\n };\n\n /**\n * Update title handler\n * @param event - input value change event\n */\n private handleUpdateTitle = (event: CustomEvent<string>): void => {\n this.updatedPanelTitle = event.detail;\n };\n\n /**\n * Cancel edition button handler\n */\n private handleCancelEditButton = (): void => {\n this.updatedPanelTitle = undefined;\n this.toggleIsEditing();\n };\n\n /**\n * Validate edition button handler\n */\n private handleValidateEditButton = (): void => {\n if (!this.editInputElement.valid) return;\n if (this.updatedPanelTitle !== undefined) this.panelTitle = this.updatedPanelTitle;\n this.toggleIsEditing();\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.validateTitlePattern(this.titlePattern);\n this.validateTitlePattern(this.titlePatternErrorMessage);\n this.validatePanelTitle(this.panelTitle);\n this.validateExpandToggleDisplay(this.expandToggleDisplay);\n this.validateTitlePosition(this.titlePosition);\n }\n\n /**\n * Edit DOM after render\n */\n componentDidRender(): void {\n // when we are editing we get focus on edition input\n if (this.isEditing) this.editInputElement.setFocus();\n }\n\n /*************\n * Render *\n *************/\n\n /**\n * Render collapse button\n * @returns collpase button\n */\n private renderCollapseButton = (): HTMLMgButtonElement => (\n <mg-button\n onClick={this.handleCollapseButton}\n variant=\"flat\"\n identifier={`${this.identifier}-collapse-button`}\n aria-expanded={this.expanded.toString()}\n aria-controls={`${this.identifier}-content`}\n disabled={this.expandToggleDisabled}\n isIcon={this.expandToggleDisplay === 'icon'}\n label={this.panelTitle}\n >\n <span class=\"mg-c-panel__collapse-button-content\">\n <mg-icon icon=\"chevron-up\" class={{ 'mg-c-panel__collapse-button-icon': true, 'mg-c-panel__collapse-button-icon--reverse': !this.expanded }}></mg-icon>\n {!this.isEditing && this.expandToggleDisplay !== 'icon' && this.panelTitle}\n </span>\n </mg-button>\n );\n\n /**\n * Render edit button\n * @returns edit Button\n */\n private renderEditButton = (): HTMLMgButtonElement => (\n <mg-button key=\"edit-button\" is-icon variant=\"flat\" label={this.messages.panel.editLabel} onClick={this.handleEditButton} identifier={`${this.identifier}-edit-button`}>\n <mg-icon icon=\"pen\"></mg-icon>\n </mg-button>\n );\n\n /**\n * Render input button\n * @returns edit title input\n */\n private renderEditInput = (): HTMLMgInputTextElement => (\n <mg-input-text\n key=\"edition-input\"\n label={this.messages.panel.editLabel}\n label-hide\n value={this.panelTitle}\n onValue-change={this.handleUpdateTitle}\n displayCharacterLeft={false}\n pattern={this.titlePattern}\n pattern-error-message={this.titlePatternErrorMessage}\n identifier={`${this.identifier}-edition-input`}\n ref={(el: HTMLMgInputTextElement) => (this.editInputElement = el)}\n >\n <mg-button\n slot=\"append-input\"\n label={this.messages.general.cancel}\n is-icon\n variant=\"secondary\"\n onClick={this.handleCancelEditButton}\n identifier={`${this.identifier}-edition-button-cancel`}\n >\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n <mg-button\n slot=\"append-input\"\n label={this.messages.general.confirm}\n is-icon\n variant=\"secondary\"\n onClick={this.handleValidateEditButton}\n identifier={`${this.identifier}-edition-button-validate`}\n >\n <mg-icon icon=\"check\"></mg-icon>\n </mg-button>\n </mg-input-text>\n );\n\n /**\n * Render title\n * @returns title element\n */\n private renderTitle = (): HTMLElement[] => {\n const elementsToRender: HTMLElement[] = [this.renderCollapseButton()];\n if (this.titleEditable) {\n if (!this.isEditing) elementsToRender.push(this.renderEditButton());\n else elementsToRender.push(this.renderEditInput());\n }\n\n return this.titlePosition === 'right' ? elementsToRender.reverse() : elementsToRender;\n };\n\n /**\n * Render header children\n * @returns header child\n */\n private renderHeaderChildren = (): HTMLElement[] => {\n const children = [\n <div\n class={{ 'mg-c-panel__header-title': true, 'mg-c-panel__header-title--full': this.isEditing, 'mg-c-panel__header-title--reverse': this.titlePosition === 'right' }}\n key={this.panelTitle}\n >\n {this.renderTitle()}\n </div>,\n <div class=\"mg-c-panel__header-content\" key=\"slot-header\">\n <slot name=\"header-right\"></slot>\n </div>,\n ];\n return this.titlePosition === 'right' ? children.reverse() : children;\n };\n\n /**\n * Render component\n * @returns rendered component\n */\n render(): HTMLElement {\n const headerId = `${this.identifier}-header`;\n return (\n <section class={this.classCollection.join()} id={this.identifier}>\n <mg-card>\n <header class={{ 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }} id={headerId}>\n {this.renderHeaderChildren()}\n </header>\n <article class=\"mg-c-panel__content\" id={`${this.identifier}-content`} aria-labelledby={headerId} hidden={!this.expanded}>\n <slot></slot>\n </article>\n </mg-card>\n </section>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-panel.js","sourceRoot":"","sources":["../../../../src/components/molecules/mg-panel/mg-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/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AAE,EAAE,QAAQ,IACvH,IAAI,CAAC,oBAAoB,EAAE,CACrB;gBACT,gEAAS,KAAK,EAAC,qBAAqB,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,UAAU,qBAAmB,QAAQ,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ;oBACtH,8DAAa,CACL,CACF,CACF,CACX,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, State, EventEmitter, Watch, Event } from '@stencil/core';\nimport { createID, ClassList, isValidString, toString } from '@mgdis/stencil-helpers';\nimport { initLocales } from '../../../locales';\nimport { type ExpandToggleDisplayType, type TitlePositionType, expandToggleDisplays, titlePositions } from './mg-panel.conf';\n\n/**\n * @slot - Panel content\n * @slot header-right - Header right panel content\n */\n@Component({\n tag: 'mg-panel',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-panel.css',\n shadow: true,\n})\nexport class MgPanel {\n /************\n * Internal *\n ************/\n\n // HTML selector\n private editInputElement: HTMLMgInputTextElement;\n\n // Locales\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgPanelElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n * If not set, it will be created.\n */\n @Prop() identifier: string = createID('mg-panel');\n\n /**\n * Panel title\n */\n @Prop({ mutable: true }) panelTitle!: string;\n @Watch('panelTitle')\n validatePanelTitle(newValue: MgPanel['panelTitle']): void {\n if (!isValidString(newValue)) throw new Error(`<mg-panel> prop \"panelTitle\" is required and must be a string. Passed value: ${toString(newValue)}.`);\n this.titleChange.emit(newValue);\n }\n\n /**\n * Panel title pattern\n */\n @Prop() titlePattern?: string;\n\n /**\n * Panel title pattern error message\n */\n @Prop() titlePatternErrorMessage?: string;\n @Watch('titlePattern')\n @Watch('titlePatternErrorMessage')\n validateTitlePattern(newValue: string): void {\n if (newValue !== undefined && !this.titleEditable) throw new Error(`<mg-panel> prop \"titleEditable\" must be set to \"true\".`);\n }\n\n /**\n * Define if panel title is editable\n */\n @Prop({ mutable: true }) titleEditable = false;\n\n /**\n * Define title position\n */\n @Prop() titlePosition: TitlePositionType = titlePositions[0];\n @Watch('titlePosition')\n validateTitlePosition(newValue: MgPanel['titlePosition']) {\n if (!titlePositions.includes(newValue)) throw new Error(`<mg-panel> prop \"titlePosition\" must be one of: ${titlePositions.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Panel is opened\n */\n @Prop({ mutable: true }) expanded = false;\n @Watch('expanded')\n handleExpanded(newValue: MgPanel['expanded']): void {\n this.expandedChange.emit(newValue);\n }\n\n /**\n * Define expand toggle button display\n */\n @Prop() expandToggleDisplay: ExpandToggleDisplayType = expandToggleDisplays[0];\n @Watch('expandToggleDisplay')\n validateExpandToggleDisplay(newValue: MgPanel['expandToggleDisplay']) {\n if (!expandToggleDisplays.includes(newValue))\n throw new Error(`<mg-panel> prop \"expandToggleDisplay\" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${toString(newValue)}.`);\n if (newValue === 'icon' && this.titleEditable) this.titleEditable = false;\n }\n\n /**\n * Disable possibility to toggle expand\n */\n @Prop() expandToggleDisabled?: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-panel']);\n\n /**\n * Title is in edition mode\n */\n @State() isEditing = false;\n\n /**\n * Cache for updated panel title before validation\n */\n @State() updatedPanelTitle: string;\n\n /**\n * Emmited event when title change\n */\n @Event({ eventName: 'title-change' }) titleChange: EventEmitter<HTMLMgPanelElement['panelTitle']>;\n\n /**\n * Emmited event when expanded change\n */\n @Event({ eventName: 'expanded-change' }) expandedChange: EventEmitter<HTMLMgPanelElement['expanded']>;\n\n /************\n * Methods *\n ************/\n\n /**\n * Toggle is editing state\n */\n private toggleIsEditing = (): void => {\n this.isEditing = !this.isEditing;\n };\n\n /************\n * Handlers *\n ************/\n\n /**\n * Collapse button click handler\n */\n private handleCollapseButton = (): void => {\n if (!this.expandToggleDisabled) this.expanded = !this.expanded;\n };\n\n /**\n * Edit button click handler\n */\n private handleEditButton = (): void => {\n this.toggleIsEditing();\n };\n\n /**\n * Update title handler\n * @param event - input value change event\n */\n private handleUpdateTitle = (event: CustomEvent<HTMLMgInputTextElement['value']>): void => {\n this.updatedPanelTitle = event.detail;\n };\n\n /**\n * Cancel edition button handler\n */\n private handleCancelEditButton = (): void => {\n this.updatedPanelTitle = undefined;\n this.toggleIsEditing();\n };\n\n /**\n * Validate edition button handler\n */\n private handleValidateEditButton = (): void => {\n if (!this.editInputElement.valid) return;\n if (this.updatedPanelTitle !== undefined) this.panelTitle = this.updatedPanelTitle;\n this.toggleIsEditing();\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.validateTitlePattern(this.titlePattern);\n this.validateTitlePattern(this.titlePatternErrorMessage);\n this.validatePanelTitle(this.panelTitle);\n this.validateExpandToggleDisplay(this.expandToggleDisplay);\n this.validateTitlePosition(this.titlePosition);\n }\n\n /**\n * Edit DOM after render\n */\n componentDidRender(): void {\n // when we are editing we get focus on edition input\n if (this.isEditing) this.editInputElement.setFocus();\n }\n\n /*************\n * Render *\n *************/\n\n /**\n * Render collapse button\n * @returns collpase button\n */\n private renderCollapseButton = (): HTMLMgButtonElement => (\n <mg-button\n onClick={this.handleCollapseButton}\n variant=\"flat\"\n aria-expanded={this.expanded.toString()}\n aria-controls={`${this.identifier}-content`}\n disabled={this.expandToggleDisabled}\n isIcon={this.expandToggleDisplay === 'icon'}\n label={this.panelTitle}\n >\n <span class=\"mg-c-panel__collapse-button-content\">\n <mg-icon icon=\"chevron-up\" class={{ 'mg-c-panel__collapse-button-icon': true, 'mg-c-panel__collapse-button-icon--reverse': !this.expanded }}></mg-icon>\n {!this.isEditing && this.expandToggleDisplay !== 'icon' && this.panelTitle}\n </span>\n </mg-button>\n );\n\n /**\n * Render edit button\n * @returns edit Button\n */\n private renderEditButton = (): HTMLMgButtonElement => (\n <mg-button key=\"edit-button\" is-icon variant=\"flat\" label={this.messages.panel.editLabel} onClick={this.handleEditButton}>\n <mg-icon icon=\"pen\"></mg-icon>\n </mg-button>\n );\n\n /**\n * Render input button\n * @returns edit title input\n */\n private renderEditInput = (): HTMLMgInputTextElement => (\n <mg-input-text\n key=\"edition-input\"\n label={this.messages.panel.editLabel}\n label-hide\n value={this.panelTitle}\n onValue-change={this.handleUpdateTitle}\n characterLeftHide={true}\n pattern={this.titlePattern}\n pattern-error-message={this.titlePatternErrorMessage}\n identifier={`${this.identifier}-edition-input`}\n ref={(el: HTMLMgInputTextElement) => (this.editInputElement = el)}\n >\n <mg-button slot=\"append-input\" label={this.messages.general.cancel} is-icon variant=\"secondary\" onClick={this.handleCancelEditButton}>\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n <mg-button slot=\"append-input\" label={this.messages.general.confirm} is-icon variant=\"secondary\" onClick={this.handleValidateEditButton}>\n <mg-icon icon=\"check\"></mg-icon>\n </mg-button>\n </mg-input-text>\n );\n\n /**\n * Render title\n * @returns title element\n */\n private renderTitle = (): HTMLElement[] => {\n const elementsToRender: HTMLElement[] = [this.renderCollapseButton()];\n if (this.titleEditable) {\n if (!this.isEditing) elementsToRender.push(this.renderEditButton());\n else elementsToRender.push(this.renderEditInput());\n }\n\n return this.titlePosition === 'right' ? elementsToRender.reverse() : elementsToRender;\n };\n\n /**\n * Render header children\n * @returns header child\n */\n private renderHeaderChildren = (): HTMLElement[] => {\n const children = [\n <div\n class={{ 'mg-c-panel__header-title': true, 'mg-c-panel__header-title--full': this.isEditing, 'mg-c-panel__header-title--reverse': this.titlePosition === 'right' }}\n key={this.panelTitle}\n >\n {this.renderTitle()}\n </div>,\n <div class=\"mg-c-panel__header-content\" key=\"slot-header\">\n <slot name=\"header-right\"></slot>\n </div>,\n ];\n return this.titlePosition === 'right' ? children.reverse() : children;\n };\n\n /**\n * Render component\n * @returns rendered component\n */\n render(): HTMLElement {\n const headerId = `${this.identifier}-header`;\n return (\n <section class={this.classCollection.join()} id={this.identifier}>\n <mg-card>\n <header class={{ 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }} id={headerId}>\n {this.renderHeaderChildren()}\n </header>\n <article class=\"mg-c-panel__content\" id={`${this.identifier}-content`} aria-labelledby={headerId} hidden={!this.expanded}>\n <slot></slot>\n </article>\n </mg-card>\n </section>\n );\n }\n}\n"]}
@@ -32,7 +32,7 @@ export class MgPopoverContent {
32
32
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
33
33
  const slottedTitleElement = this.element.querySelector('[slot="title"]');
34
34
  if (slottedTitleElement && !isTagName(slottedTitleElement, headingTags)) {
35
- throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
35
+ throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}.`);
36
36
  }
37
37
  }
38
38
  /**
@@ -40,7 +40,7 @@ export class MgPopoverContent {
40
40
  * @returns HTML Element
41
41
  */
42
42
  render() {
43
- return (h(Host, { key: 'ffe73fca1c2d8ffa0f5ac2359b50a453b37df7be' }, h("mg-card", { key: 'f6e04d90892104abf496cf3ca3a601cb747346c9', class: this.classCollection.join() }, this.closeButton && (h("mg-button", { key: '53b6f7360b07321c0433fb2f44f1b1dd9016f204', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: 'aa638786bca9af815d36e1de905559d60e68e44c', icon: "cross" }))), h("div", { key: '0b9f1319e409a0b1d75d16236806fd024c8b804e', class: "mg-c-popover-content__title" }, h("slot", { key: '7f52704d2ed49ea048ffd06b763a238d288ccaf3', name: "title" })), h("slot", { key: '7a2fd6b013e592acb616793439b2f4e8458ec372', name: "content" })), h("slot", { key: 'ceb0a6453ece1b861fe5ab3d63e803b1f41cb148', name: "arrow" })));
43
+ return (h(Host, { key: '8d2dd7d21518de744c18f0280b7b418f3a76acca' }, h("mg-card", { key: '8beab7c9fb692c1983515709a1ee888dc7e5157a', class: this.classCollection.join() }, this.closeButton && (h("mg-button", { key: 'e636569be26b0c741e0b03e806787d91b47ded5c', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: '3edc717cbe542494d892566c182883e20b1ca4cb', icon: "cross" }))), h("div", { key: 'd18525218972d92b6932984edb50844658e12970', class: "mg-c-popover-content__title" }, h("slot", { key: '2cceb41fd4ebb00b889e71cab211431e5894d04c', name: "title" })), h("slot", { key: 'a6615d9d7c85b32fb63d3d89db02fae2f8d5c1b2', name: "content" })), h("slot", { key: '0ff4bf72de19a3d56aafb64391cfc276d70e2f18', name: "arrow" })));
44
44
  }
45
45
  static get is() { return "mg-popover-content"; }
46
46
  static get encapsulation() { return "shadow"; }