@mgdis/mg-components 5.21.1 → 5.23.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 (248) hide show
  1. package/dist/cjs/{index-b4c6ee30.js → index-0cf3e6d5.js} +22 -13
  2. package/dist/cjs/index-0cf3e6d5.js.map +1 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/mg-action-more_34.cjs.entry.js +380 -285
  5. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  6. package/dist/cjs/mg-components.cjs.js +3 -3
  7. package/dist/cjs/mg-components.cjs.js.map +1 -1
  8. package/dist/cjs/mg-item-more.cjs.entry.js +7 -6
  9. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  10. package/dist/cjs/mg-menu.conf-0229bb75.js +333 -0
  11. package/dist/cjs/mg-menu.conf-0229bb75.js.map +1 -0
  12. package/dist/collection/assets/icons/index.js +91 -90
  13. package/dist/collection/assets/icons/index.js.map +1 -1
  14. package/dist/collection/collection-manifest.json +2 -2
  15. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
  16. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  17. package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
  18. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  19. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
  20. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  21. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  22. package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
  23. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  24. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -1
  25. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  26. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  27. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  28. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +4 -2
  29. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  30. package/dist/collection/components/molecules/inputs/MgInput.js +1 -1
  31. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  32. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +9 -5
  33. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  34. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +9 -0
  35. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  36. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +54 -39
  37. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  38. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +35 -6
  39. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  40. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -2
  41. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
  43. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
  45. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  47. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +1 -1
  49. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  51. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
  53. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  54. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  55. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -1
  56. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  57. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
  58. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  59. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  60. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  61. package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
  62. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  63. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  64. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  65. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +1 -1
  66. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  67. package/dist/collection/components/molecules/mg-message/mg-message.js +1 -1
  68. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  69. package/dist/collection/components/molecules/mg-modal/mg-modal.js +6 -5
  70. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  71. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +1 -1
  72. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  73. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
  74. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  75. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  76. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  77. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  78. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  79. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  80. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  81. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  82. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  83. package/dist/collection/locales/en/messages.json +13 -3
  84. package/dist/collection/locales/fr/messages.json +13 -3
  85. package/dist/collection/locales/index.js +2 -2
  86. package/dist/collection/locales/index.js.map +1 -1
  87. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  88. package/dist/collection/utils/behaviors.utils.spec.js +1 -1
  89. package/dist/collection/utils/behaviors.utils.spec.js.map +1 -1
  90. package/dist/collection/utils/unit.test.utils.js +0 -104
  91. package/dist/collection/utils/unit.test.utils.js.map +1 -1
  92. package/dist/components/MgInput.js +3 -3
  93. package/dist/components/MgInput.js.map +1 -1
  94. package/dist/components/index.es.js +75 -0
  95. package/dist/components/index.es.js.map +1 -0
  96. package/dist/components/index2.js +30 -65
  97. package/dist/components/index2.js.map +1 -1
  98. package/dist/components/mg-action-more.js +5 -4
  99. package/dist/components/mg-action-more.js.map +1 -1
  100. package/dist/components/mg-badge2.js +5 -4
  101. package/dist/components/mg-badge2.js.map +1 -1
  102. package/dist/components/mg-button2.js +6 -5
  103. package/dist/components/mg-button2.js.map +1 -1
  104. package/dist/components/mg-card2.js +4 -3
  105. package/dist/components/mg-card2.js.map +1 -1
  106. package/dist/components/mg-character-left2.js +2 -1
  107. package/dist/components/mg-character-left2.js.map +1 -1
  108. package/dist/components/mg-details.js +4 -3
  109. package/dist/components/mg-details.js.map +1 -1
  110. package/dist/components/mg-divider.js +2 -1
  111. package/dist/components/mg-divider.js.map +1 -1
  112. package/dist/components/mg-form.js +5 -4
  113. package/dist/components/mg-form.js.map +1 -1
  114. package/dist/components/mg-icon2.js +96 -93
  115. package/dist/components/mg-icon2.js.map +1 -1
  116. package/dist/components/mg-illustrated-message.js +4 -3
  117. package/dist/components/mg-illustrated-message.js.map +1 -1
  118. package/dist/components/mg-input-checkbox-paginated.js +1 -1
  119. package/dist/components/mg-input-checkbox-paginated2.js +19 -6
  120. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  121. package/dist/components/mg-input-checkbox.js +59 -43
  122. package/dist/components/mg-input-checkbox.js.map +1 -1
  123. package/dist/components/mg-input-date.js +41 -10
  124. package/dist/components/mg-input-date.js.map +1 -1
  125. package/dist/components/mg-input-numeric.js +7 -6
  126. package/dist/components/mg-input-numeric.js.map +1 -1
  127. package/dist/components/mg-input-password.js +5 -4
  128. package/dist/components/mg-input-password.js.map +1 -1
  129. package/dist/components/mg-input-radio.js +6 -5
  130. package/dist/components/mg-input-radio.js.map +1 -1
  131. package/dist/components/mg-input-select2.js +8 -7
  132. package/dist/components/mg-input-select2.js.map +1 -1
  133. package/dist/components/mg-input-text2.js +8 -7
  134. package/dist/components/mg-input-text2.js.map +1 -1
  135. package/dist/components/mg-input-textarea.js +8 -7
  136. package/dist/components/mg-input-textarea.js.map +1 -1
  137. package/dist/components/mg-input-title2.js +4 -3
  138. package/dist/components/mg-input-title2.js.map +1 -1
  139. package/dist/components/mg-input-toggle.js +6 -5
  140. package/dist/components/mg-input-toggle.js.map +1 -1
  141. package/dist/components/mg-item-more.js +4 -3
  142. package/dist/components/mg-item-more.js.map +1 -1
  143. package/dist/components/mg-menu-item2.js +6 -5
  144. package/dist/components/mg-menu-item2.js.map +1 -1
  145. package/dist/components/mg-menu2.js +2 -1
  146. package/dist/components/mg-menu2.js.map +1 -1
  147. package/dist/components/mg-message.js +5 -4
  148. package/dist/components/mg-message.js.map +1 -1
  149. package/dist/components/mg-modal.js +12 -10
  150. package/dist/components/mg-modal.js.map +1 -1
  151. package/dist/components/mg-pagination2.js +4 -3
  152. package/dist/components/mg-pagination2.js.map +1 -1
  153. package/dist/components/mg-panel.js +6 -5
  154. package/dist/components/mg-panel.js.map +1 -1
  155. package/dist/components/mg-popover-content2.js +5 -4
  156. package/dist/components/mg-popover-content2.js.map +1 -1
  157. package/dist/components/mg-popover2.js +5 -4
  158. package/dist/components/mg-popover2.js.map +1 -1
  159. package/dist/components/mg-skip-links.js +4 -3
  160. package/dist/components/mg-skip-links.js.map +1 -1
  161. package/dist/components/mg-tabs.js +8 -7
  162. package/dist/components/mg-tabs.js.map +1 -1
  163. package/dist/components/mg-tag.js +5 -4
  164. package/dist/components/mg-tag.js.map +1 -1
  165. package/dist/components/mg-tooltip-content2.js +2 -1
  166. package/dist/components/mg-tooltip-content2.js.map +1 -1
  167. package/dist/components/mg-tooltip2.js +11 -8
  168. package/dist/components/mg-tooltip2.js.map +1 -1
  169. package/dist/esm/{index-61c7cfb5.js → index-91977c3d.js} +22 -13
  170. package/dist/esm/index-91977c3d.js.map +1 -0
  171. package/dist/esm/loader.js +3 -3
  172. package/dist/esm/mg-action-more_34.entry.js +348 -253
  173. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  174. package/dist/esm/mg-components.js +4 -4
  175. package/dist/esm/mg-components.js.map +1 -1
  176. package/dist/esm/mg-item-more.entry.js +5 -4
  177. package/dist/esm/mg-item-more.entry.js.map +1 -1
  178. package/dist/esm/mg-menu.conf-4b2d2eab.js +315 -0
  179. package/dist/esm/mg-menu.conf-4b2d2eab.js.map +1 -0
  180. package/dist/mg-components/locales/en/messages.json +13 -3
  181. package/dist/mg-components/locales/fr/messages.json +13 -3
  182. package/dist/mg-components/mg-components.esm.js +1 -1
  183. package/dist/mg-components/mg-components.esm.js.map +1 -1
  184. package/dist/mg-components/p-1564df7a.js +2 -0
  185. package/dist/mg-components/p-1564df7a.js.map +1 -0
  186. package/dist/mg-components/p-49e1ffcb.js +3 -0
  187. package/dist/mg-components/p-49e1ffcb.js.map +1 -0
  188. package/dist/mg-components/p-6c68c7eb.entry.js +2 -0
  189. package/dist/mg-components/p-6c68c7eb.entry.js.map +1 -0
  190. package/dist/mg-components/p-d6d71404.entry.js +2 -0
  191. package/dist/mg-components/p-d6d71404.entry.js.map +1 -0
  192. package/dist/types/assets/icons/index.d.ts +1 -0
  193. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -1
  194. package/dist/types/components/atoms/mg-button/mg-button.d.ts +1 -1
  195. package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
  196. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +1 -1
  197. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +1 -1
  198. package/dist/types/components/molecules/inputs/MgInput.d.ts +1 -1
  199. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +8 -0
  200. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +15 -13
  201. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +18 -1
  202. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +1 -1
  203. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +1 -1
  204. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +1 -1
  205. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +1 -1
  206. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +1 -1
  207. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -1
  208. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +1 -1
  209. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +1 -1
  210. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  211. package/dist/types/components/molecules/mg-message/mg-message.d.ts +1 -1
  212. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -1
  213. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
  214. package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +1 -1
  215. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +1 -1
  216. package/dist/types/components.d.ts +2 -2
  217. package/dist/types/locales/index.d.ts +1 -176
  218. package/dist/types/utils/unit.test.utils.d.ts +0 -82
  219. package/package.json +36 -35
  220. package/dist/cjs/components.utils-cd908d4e.js +0 -443
  221. package/dist/cjs/components.utils-cd908d4e.js.map +0 -1
  222. package/dist/cjs/index-b4c6ee30.js.map +0 -1
  223. package/dist/collection/utils/components.utils.js +0 -147
  224. package/dist/collection/utils/components.utils.js.map +0 -1
  225. package/dist/collection/utils/components.utils.spec.js +0 -156
  226. package/dist/collection/utils/components.utils.spec.js.map +0 -1
  227. package/dist/collection/utils/e2e.test.utils.js +0 -46
  228. package/dist/collection/utils/e2e.test.utils.js.map +0 -1
  229. package/dist/collection/utils/locale.utils.js +0 -57
  230. package/dist/collection/utils/locale.utils.js.map +0 -1
  231. package/dist/collection/utils/locale.utils.spec.js +0 -52
  232. package/dist/collection/utils/locale.utils.spec.js.map +0 -1
  233. package/dist/components/components.utils.js +0 -150
  234. package/dist/components/components.utils.js.map +0 -1
  235. package/dist/esm/components.utils-0d67c31c.js +0 -427
  236. package/dist/esm/components.utils-0d67c31c.js.map +0 -1
  237. package/dist/esm/index-61c7cfb5.js.map +0 -1
  238. package/dist/mg-components/p-1c17516a.entry.js +0 -2
  239. package/dist/mg-components/p-1c17516a.entry.js.map +0 -1
  240. package/dist/mg-components/p-5b4eb029.entry.js +0 -2
  241. package/dist/mg-components/p-5b4eb029.entry.js.map +0 -1
  242. package/dist/mg-components/p-6e7aebeb.js +0 -3
  243. package/dist/mg-components/p-6e7aebeb.js.map +0 -1
  244. package/dist/mg-components/p-af42d17b.js +0 -2
  245. package/dist/mg-components/p-af42d17b.js.map +0 -1
  246. package/dist/types/utils/components.utils.d.ts +0 -87
  247. package/dist/types/utils/e2e.test.utils.d.ts +0 -22
  248. package/dist/types/utils/locale.utils.d.ts +0 -38
@@ -1,2 +0,0 @@
1
- const e={required:"This field is required.",date:{badInput:'The date format must be <span aria-hidden="true">mm/dd/yyyy</span><span class="mg-u-visually-hidden">m m / d d / y y y y</span> and the date must be greater than {min}',min:"The date cannot be earlier than {min}",max:"The date cannot be later than {max}",minMax:"The date must be between {min} and {max}"},numeric:{min:"The value cannot be less than {min}",max:"The value cannot be greater than {max}",minMax:"The value must be between {min} et {max}"}};const t="{counter} characters left.";const s={select:{placeholder:"Select a value"},checkbox:{selectedValues:"{nb} selected values",selectedValue:"{nb} selected value",editButton:"Edit",selectButton:"Select values",showButton:"Show",label:"Enter a value",result:"result",results:"results",searchResults:"Search result(s) list.",noResult:"No result.",sections:{selected:{title:"Selected",titlePlurial:"Selected",action:"Unselect all"},notSelected:{title:"Not selected",titlePlurial:"Not selected",action:"Select all"}}}};const n={required:'Fields with a <strong class="mg-u-is-asterisk">*</strong> are required',requiredSingle:'Field with a <strong class="mg-u-is-asterisk">*</strong> is required',allRequired:"All fields are required",allRequiredSingle:"The field is required"};const a={closeButton:"Close message"};const i={closeButton:"Close modal"};const r={label:"Pagination",page:"page",pages:"pages",nextPage:"Next page",previousPage:"Previous page",selectPage:"Select the page to display."};const l={editLabel:"Edit section title."};const o={navLabel:"Quick access"};const c={confirm:"Confirm",cancel:"Cancel",close:"Close",next:"next",previous:"previous"};const u={moreLabel:"Additional menu",badgeLabel:"Include notification(s)"};const d={label:"Actions"};const m={errors:e,nbCharLeft:t,input:s,form:n,message:a,modal:i,pagination:r,panel:l,skipLinks:o,general:c,plusMenu:u,actionMore:d};const p={required:"Ce champ est obligatoire.",date:{badInput:'Le format de la date doit être du type <span aria-hidden="true">jj/mm/aaaa</span><span class="mg-u-visually-hidden">j j / m m / a a a a</span> et la date supérieure au {min}',min:"La date ne peut pas être antérieure au {min}",max:"La date ne peut pas être postérieure au {max}",minMax:"La date doit être comprise entre le {min} et le {max}"},numeric:{min:"La valeur ne peut pas être inférieure à {min}",max:"La valeur ne peut pas être supérieure à {max}",minMax:"La valeur doit être comprise entre {min} et {max}"}};const g="{counter} caractères disponibles.";const h={select:{placeholder:"Sélectionnez une valeur"},checkbox:{selectedValues:"{nb} valeurs selectionnées",selectedValue:"{nb} valeur selectionnée",editButton:"Modifier",selectButton:"Sélectionner des valeurs",showButton:"Voir",label:"Saisissez une valeur",result:"résultat",results:"résultats",searchResults:"List de résultat(s) de la recherche.",noResult:"Aucun résultat.",sections:{selected:{title:"Sélectionné",titlePlurial:"Sélectionnés",action:"Tout désélectionner"},notSelected:{title:"Non sélectionné",titlePlurial:"Non sélectionnés",action:"Tout sélectionner"}}}};const b={required:'Les champs marqués d\'un <strong class="mg-u-is-asterisk">*</strong> sont obligatoires',requiredSingle:'Le champ marqué d\'un <strong class="mg-u-is-asterisk">*</strong> est obligatoire',allRequired:"Tous les champs sont obligatoires",allRequiredSingle:"Le champ est obligatoire"};const f={closeButton:"Fermer le message"};const v={closeButton:"Fermer la modale"};const x={label:"Pagination",page:"page",pages:"pages",nextPage:"Page suivante",previousPage:"Page précédente",selectPage:"Sélectionner la page à afficher."};const y={editLabel:"Modifier le titre de la section."};const L={navLabel:"Accès rapide"};const S={confirm:"Valider",cancel:"Annuler",close:"Fermer",next:"suivant",previous:"précédent"};const q={moreLabel:"Menu complémentaire",badgeLabel:"Notification(s) incluse(s)"};const P={label:"Actions"};const w={errors:p,nbCharLeft:g,input:h,form:b,message:f,modal:v,pagination:x,panel:y,skipLinks:L,general:S,plusMenu:q,actionMore:P};const k=(e,t,s)=>new Intl.NumberFormat(t,{style:"currency",currency:s}).format(e);const T=(e,t)=>new Intl.NumberFormat(t).format(e);const A=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;const M=(e,t)=>{if(typeof e!=="string"||e===""||!A.test(e)){return""}return new Intl.DateTimeFormat(t).format(new Date(e))};const B=(e,t,s)=>{const n=e.closest("[lang]");const a=Intl.NumberFormat.supportedLocalesOf(n===null||n===void 0?void 0:n.lang);const i=a.length>0?a[0]:navigator.language||s;const r=i.split("-").shift();return{locale:i,messages:t[r]||t[s]}};const C="en";const N={en:m,fr:w};const R=e=>B(e,N,C);var I;(function(e){e["VERTICAL"]="vertical";e["HORIZONTAL"]="horizontal"})(I||(I={}));const F=["regular","medium","large"];const V=(e="",t=10)=>{const s=new Uint8Array(t);crypto.getRandomValues(s);const n=Array.from(s).map((e=>e.toString(16).padStart(2,"0"))).join("").slice(0,t);return e!==""?`${e}-${n}`:n};class j{constructor(e=[]){this.add=e=>{if(!this.has(e)){this.classes.push(e)}};this.delete=e=>{const t=this.classes.indexOf(e);if(t>-1){this.classes.splice(t,1)}};this.has=e=>this.classes.includes(e);this.join=()=>this.classes.join(" ");this.classes=e}}const D=e=>Array.isArray(e)&&e.every((e=>typeof e==="string"));const z=(e,t)=>t.includes(e===null||e===void 0?void 0:e.tagName.toLowerCase());const E='a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';const $=e=>{const t=U(e);const s=Q(e);return[e,...t,...s]};const U=(e,t=[])=>{if(e.self!==e.top){try{const s=e.parent;t.push(s);return U(s,t)}catch(e){console.error("Different hosts between iframes:",e);return t}}return t};const Q=(e,t=[])=>{if(e.frames.length>0){for(const s of Array.from(e.frames)){t.push(s);Q(s,t)}}return t};const G=e=>typeof e==="string"&&e.trim()!=="";const H=e=>typeof e==="string"&&e.toLocaleLowerCase().normalize("NFD").replaceAll(/[\u0300-\u036f]/g,"");const J=async e=>e();export{j as C,I as D,G as a,z as b,V as c,H as d,A as e,k as f,T as g,D as h,R as i,E as j,$ as k,M as l,J as n,F as s};
2
- //# sourceMappingURL=p-af42d17b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["localeCurrency","number","locale","currency","Intl","NumberFormat","style","format","localeNumber","dateRegExp","localeDate","date","test","DateTimeFormat","Date","getLocaleMessages","element","messages","defaultLocale","closestLangAttribute","closest","closestLang","supportedLocalesOf","lang","length","navigator","language","localeSubtag","split","shift","en","fr","initLocales","Direction","sizes","createID","prefix","randomBytes","Uint8Array","crypto","getRandomValues","hexString","Array","from","map","byte","toString","padStart","join","slice","ClassList","constructor","classlist","this","add","className","has","classes","push","delete","index","indexOf","splice","includes","allItemsAreString","items","isArray","every","item","isTagName","tagNames","tagName","toLowerCase","focusableElements","getWindows","localWindow","parentWindows","getParentWindows","childWindows","getChildWindows","windows","self","top","parentWindow","parent","err","console","error","frames","childWindow","isValidString","value","trim","cleanString","text","toLocaleLowerCase","normalize","replaceAll","nextTick","async","callback"],"sources":["src/utils/locale.utils.ts","src/locales/index.ts","src/components/molecules/menu/mg-menu/mg-menu.conf.ts","src/utils/components.utils.ts"],"sourcesContent":["/**\n * Format number to the locale currency\n * @param number - number to format\n * @param locale - locale to apply\n * @param currency - currency to apply\n * @returns formatted currency\n */\nexport const localeCurrency = (number: number, locale: string, currency: string): string => {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);\n};\n\n/**\n * Format number to locale\n * @param number - number to format\n * @param locale - locale to apply\n * @returns formatted number\n */\nexport const localeNumber = (number: number, locale: string): string => {\n return new Intl.NumberFormat(locale).format(number);\n};\n\n/**\n * Date RegExp\n */\nexport const dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n\n/**\n * Locale date format\n * @param date - date to format\n * @param locale - locale to apply\n * @returns formatted date\n */\nexport const localeDate = (date: string, locale: string): string => {\n if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {\n return '';\n }\n return new Intl.DateTimeFormat(locale).format(new Date(date));\n};\n\n/**\n * Get locale and messages\n * We load the defined locale but for now we only support the first subtag for messages\n * @param element - element we need to get the language\n * @param messages - messages to use\n * @param defaultLocale - default messages locale\n * @returns messages object\n */\nexport const getLocaleMessages = (element: HTMLElement, messages: unknown, defaultLocale: string): { locale: string; messages: Record<string, unknown> } => {\n // Get local\n const closestLangAttribute: HTMLElement = element.closest('[lang]');\n const closestLang: string[] = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);\n const locale = closestLang.length > 0 ? closestLang[0] : navigator.language || defaultLocale;\n // Only keep first subtag\n const localeSubtag = locale.split('-').shift();\n // Return\n return {\n locale,\n messages: messages[localeSubtag] || messages[defaultLocale],\n };\n};\n","import en from './en/messages.json';\nimport fr from './fr/messages.json';\nimport { getLocaleMessages } from '../utils/locale.utils';\n\nconst defaultLocale = 'en';\nconst messages = { en, fr };\n\n/**\n * Get Intl object\n * @param element - element we need to get the language\n * @returns messages object\n */\nexport const initLocales = (element: HTMLElement): { locale: string; messages: Record<string, unknown> } => getLocaleMessages(element, messages, defaultLocale);\n","import { MgItemMore } from '../../mg-item-more/mg-item-more';\n\n/**\n * Menu direction type\n */\nexport enum Direction {\n VERTICAL = 'vertical',\n HORIZONTAL = 'horizontal',\n}\n\n/**\n * ItemMore prop type\n */\nexport type ItemMoreType = Pick<MgItemMore, 'icon' | 'slotlabel' | 'size'>;\n\n/**\n * List of all possibles sizes\n */\nexport const sizes = ['regular', 'medium', 'large'] as const;\n\n/**\n * item Size from sizes\n */\nexport type MenuSizeType = (typeof sizes)[number];\n","/**\n * Create random ID\n * @param prefix - add prefix to created ID\n * @param length - ID length\n * @returns ID\n */\nexport const createID = (prefix = '', length = 10): string => {\n const randomBytes = new Uint8Array(length);\n\n crypto.getRandomValues(randomBytes);\n\n const hexString = Array.from(randomBytes)\n .map(byte => byte.toString(16).padStart(2, '0'))\n .join('')\n .slice(0, length);\n\n return prefix !== '' ? `${prefix}-${hexString}` : hexString;\n};\n\n/**\n * Class to manage component classlist\n * Set() are not working when imported in project\n */\nexport class ClassList {\n /**\n * Available classes\n */\n classes: string[];\n\n constructor(classlist: string[] = []) {\n this.classes = classlist;\n }\n\n /**\n * Add class\n * @param className - class name to add\n */\n add = (className: string): void => {\n if (!this.has(className)) {\n this.classes.push(className);\n }\n };\n\n /**\n * Delete class\n * @param className - class name to delete\n */\n delete = (className: string): void => {\n const index = this.classes.indexOf(className);\n if (index > -1) {\n this.classes.splice(index, 1);\n }\n };\n\n /**\n * Check if class exist in list\n * @param className - class name to check\n * @returns class name is in the list\n */\n has = (className: string): boolean => {\n return this.classes.includes(className);\n };\n\n /**\n * Join classes seperated by spaces\n * @returns joined values\n */\n join = (): string => {\n return this.classes.join(' ');\n };\n}\n\n/**\n * Check if all items are string\n * @param items - items to check\n * @returns all items are string\n */\nexport const allItemsAreString = (items: unknown): items is string[] => Array.isArray(items) && items.every(item => typeof item === 'string');\n\n/**\n * Check if element is a heading\n * @param element - slotted element\n * @param tagNames - allowed tag names list\n * @returns element is a heading\n */\nexport const isTagName = (element: Element, tagNames: string[]): boolean => {\n return tagNames.includes(element?.tagName.toLowerCase());\n};\n\n/**\n * Focusable elements query selector\n */\nexport const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier]';\n\n/**\n * Get windows\n * @param localWindow - the window we are lookink for other windows\n * @returns The list of windows found\n */\nexport const getWindows = (localWindow: Window): Window[] => {\n const parentWindows = getParentWindows(localWindow);\n const childWindows = getChildWindows(localWindow);\n return [localWindow, ...parentWindows, ...childWindows];\n};\n\n/**\n * Get parent windows\n * @param localWindow - the window we are lookink for parents\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nexport const getParentWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n // Check if is in iframe\n if (localWindow.self !== localWindow.top) {\n // Check if we have permission to access parent\n try {\n const parentWindow: Window = localWindow.parent;\n windows.push(parentWindow);\n return getParentWindows(parentWindow, windows);\n } catch (err) {\n console.error('Different hosts between iframes:', err);\n return windows;\n }\n }\n return windows;\n};\n\n/**\n * Get child windows\n * @param localWindow - the window we are lookink for children\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getChildWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n if (localWindow.frames.length > 0) {\n for (const childWindow of Array.from(localWindow.frames)) {\n windows.push(childWindow);\n getChildWindows(childWindow, windows);\n }\n }\n return windows;\n};\n\n/**\n * Validate string\n * @param value - value to check\n * @returns if string is valid\n */\nexport const isValidString = (value: unknown): boolean => typeof value === 'string' && value.trim() !== '';\n\n/**\n * Clean string caraters\n * @param text - text to cliean\n * @returns cleanded string\n */\nexport const cleanString = (text: string): string =>\n typeof text === 'string' &&\n text\n .toLocaleLowerCase()\n .normalize('NFD')\n .replaceAll(/[\\u0300-\\u036f]/g, '');\n\n/**\n * Use to process code next tick in the event loop\n * @param callback - code to excute on next tick\n * @returns differed code excution\n */\nexport const nextTick = async (callback: () => void): Promise<void> => callback();\n"],"mappings":"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"}
@@ -1,87 +0,0 @@
1
- /**
2
- * Create random ID
3
- * @param prefix - add prefix to created ID
4
- * @param length - ID length
5
- * @returns ID
6
- */
7
- export declare const createID: (prefix?: string, length?: number) => string;
8
- /**
9
- * Class to manage component classlist
10
- * Set() are not working when imported in project
11
- */
12
- export declare class ClassList {
13
- /**
14
- * Available classes
15
- */
16
- classes: string[];
17
- constructor(classlist?: string[]);
18
- /**
19
- * Add class
20
- * @param className - class name to add
21
- */
22
- add: (className: string) => void;
23
- /**
24
- * Delete class
25
- * @param className - class name to delete
26
- */
27
- delete: (className: string) => void;
28
- /**
29
- * Check if class exist in list
30
- * @param className - class name to check
31
- * @returns class name is in the list
32
- */
33
- has: (className: string) => boolean;
34
- /**
35
- * Join classes seperated by spaces
36
- * @returns joined values
37
- */
38
- join: () => string;
39
- }
40
- /**
41
- * Check if all items are string
42
- * @param items - items to check
43
- * @returns all items are string
44
- */
45
- export declare const allItemsAreString: (items: unknown) => items is string[];
46
- /**
47
- * Check if element is a heading
48
- * @param element - slotted element
49
- * @param tagNames - allowed tag names list
50
- * @returns element is a heading
51
- */
52
- export declare const isTagName: (element: Element, tagNames: string[]) => boolean;
53
- /**
54
- * Focusable elements query selector
55
- */
56
- export declare const focusableElements = "a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier]";
57
- /**
58
- * Get windows
59
- * @param localWindow - the window we are lookink for other windows
60
- * @returns The list of windows found
61
- */
62
- export declare const getWindows: (localWindow: Window) => Window[];
63
- /**
64
- * Get parent windows
65
- * @param localWindow - the window we are lookink for parents
66
- * @param windows - The list of allready found windows
67
- * @returns The list of windows found
68
- */
69
- export declare const getParentWindows: (localWindow: Window, windows?: Window[]) => Window[];
70
- /**
71
- * Validate string
72
- * @param value - value to check
73
- * @returns if string is valid
74
- */
75
- export declare const isValidString: (value: unknown) => boolean;
76
- /**
77
- * Clean string caraters
78
- * @param text - text to cliean
79
- * @returns cleanded string
80
- */
81
- export declare const cleanString: (text: string) => string;
82
- /**
83
- * Use to process code next tick in the event loop
84
- * @param callback - code to excute on next tick
85
- * @returns differed code excution
86
- */
87
- export declare const nextTick: (callback: () => void) => Promise<void>;
@@ -1,22 +0,0 @@
1
- /**
2
- * Add a darker background
3
- * usefull for light rendered element
4
- * @param condition - condition to add darker background
5
- * @param html - html to update
6
- * @returns html to render
7
- */
8
- export declare const darkBackground: (condition: boolean, html: string) => string;
9
- /**
10
- * Render attributes from props objects
11
- * @param args - argument to render as string. ex: `{status: 'visible'}`
12
- * @returns formated inline attributed. ex: 'status="visible"'
13
- */
14
- export declare const renderAttributes: (args: unknown) => string;
15
- /**
16
- * Render properties from props objects.
17
- * Insert return value in <script></script> element
18
- * @param args - argument to render as script. ex: `{status: 'visible'}`
19
- * @param selector - querySelector get targetted element and bind properties on it
20
- * @returns stringified properties script
21
- */
22
- export declare const renderProperties: (args: unknown, selector: string) => string;
@@ -1,38 +0,0 @@
1
- /**
2
- * Format number to the locale currency
3
- * @param number - number to format
4
- * @param locale - locale to apply
5
- * @param currency - currency to apply
6
- * @returns formatted currency
7
- */
8
- export declare const localeCurrency: (number: number, locale: string, currency: string) => string;
9
- /**
10
- * Format number to locale
11
- * @param number - number to format
12
- * @param locale - locale to apply
13
- * @returns formatted number
14
- */
15
- export declare const localeNumber: (number: number, locale: string) => string;
16
- /**
17
- * Date RegExp
18
- */
19
- export declare const dateRegExp: RegExp;
20
- /**
21
- * Locale date format
22
- * @param date - date to format
23
- * @param locale - locale to apply
24
- * @returns formatted date
25
- */
26
- export declare const localeDate: (date: string, locale: string) => string;
27
- /**
28
- * Get locale and messages
29
- * We load the defined locale but for now we only support the first subtag for messages
30
- * @param element - element we need to get the language
31
- * @param messages - messages to use
32
- * @param defaultLocale - default messages locale
33
- * @returns messages object
34
- */
35
- export declare const getLocaleMessages: (element: HTMLElement, messages: unknown, defaultLocale: string) => {
36
- locale: string;
37
- messages: Record<string, unknown>;
38
- };