@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgdis/mg-components",
3
- "version": "5.21.1",
3
+ "version": "5.23.0",
4
4
  "description": "MG Components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -23,46 +23,47 @@
23
23
  "outputName": "junit.xml"
24
24
  },
25
25
  "dependencies": {
26
- "@popperjs/core": "^2.11.8",
27
- "@stencil/core": "4.9.0",
26
+ "@popperjs/core": "2.11.8",
27
+ "@stencil/core": "4.11.0",
28
28
  "@mgdis/img": "1.6.0",
29
- "@mgdis/styles": "1.0.2"
29
+ "@mgdis/stencil-helpers": "1.0.0",
30
+ "@mgdis/styles": "1.1.0"
30
31
  },
31
32
  "devDependencies": {
32
- "@playwright/test": "1.40.1",
33
- "@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
34
- "@storybook/addon-a11y": "^7.5.3",
35
- "@storybook/addon-actions": "^7.5.3",
36
- "@storybook/addon-essentials": "^7.5.3",
37
- "@storybook/addon-interactions": "^7.5.3",
38
- "@storybook/addon-links": "^7.5.3",
39
- "@storybook/addon-mdx-gfm": "^7.5.3",
40
- "@storybook/blocks": "^7.5.3",
41
- "@storybook/html": "^7.5.3",
42
- "@storybook/html-vite": "^7.5.3",
43
- "@storybook/testing-library": "^0.2.2",
44
- "@types/jest": "^29.5.8",
45
- "@types/node": "^20.9.0",
46
- "chromatic": "^10.0.0",
47
- "eslint": "^8.53.0",
48
- "eslint-plugin-storybook": "^0.6.15",
49
- "jest": "^29.7.0",
50
- "jest-cli": "^29.7.0",
51
- "jest-junit": "^16.0.0",
52
- "jest-transform-stub": "^2.0.0",
53
- "prettier": "^3.0.0",
54
- "puppeteer": "^21.0.0",
55
- "react": "^18.2.0",
56
- "react-dom": "^18.2.0",
57
- "react-textarea-autosize": "^8.5.3",
58
- "sass": "^1.69.5",
59
- "storybook": "^7.5.3",
60
- "ts-node": "^10.9.1",
33
+ "@playwright/test": "1.41.1",
34
+ "@pxtrn/storybook-addon-docs-stencil": "6.4.1",
35
+ "@storybook/addon-a11y": "7.6.10",
36
+ "@storybook/addon-actions": "7.6.10",
37
+ "@storybook/addon-essentials": "7.6.10",
38
+ "@storybook/addon-interactions": "7.6.10",
39
+ "@storybook/addon-links": "7.6.10",
40
+ "@storybook/addon-mdx-gfm": "7.6.10",
41
+ "@storybook/blocks": "7.6.10",
42
+ "@storybook/html": "7.6.10",
43
+ "@storybook/html-vite": "7.6.10",
44
+ "@storybook/testing-library": "0.2.2",
45
+ "@types/jest": "29.5.11",
46
+ "@types/node": "20.11.6",
47
+ "chromatic": "10.5.0",
48
+ "eslint": "8.56.0",
49
+ "eslint-plugin-storybook": "0.6.15",
50
+ "jest": "29.7.0",
51
+ "jest-cli": "29.7.0",
52
+ "jest-junit": "16.0.0",
53
+ "jest-transform-stub": "2.0.0",
54
+ "prettier": "3.2.4",
55
+ "puppeteer": "21.9.0",
56
+ "react": "18.2.0",
57
+ "react-dom": "18.2.0",
58
+ "react-textarea-autosize": "8.5.3",
59
+ "sass": "1.70.0",
60
+ "storybook": "7.6.10",
61
+ "ts-node": "10.9.2",
61
62
  "typescript": "5.3.3",
62
63
  "@mgdis/linting-stencil": "1.1.0",
63
64
  "@mgdis/playwright-helpers": "1.0.0",
64
- "tsconfig": "1.0.0",
65
- "eslint-config-stencil": "1.1.1"
65
+ "eslint-config-stencil": "1.1.1",
66
+ "tsconfig": "1.0.0"
66
67
  },
67
68
  "license": "BSD-3-Clause",
68
69
  "scripts": {
@@ -1,443 +0,0 @@
1
- 'use strict';
2
-
3
- const errors$1 = {
4
- required: "This field is required.",
5
- date: {
6
- 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}",
7
- min: "The date cannot be earlier than {min}",
8
- max: "The date cannot be later than {max}",
9
- minMax: "The date must be between {min} and {max}"
10
- },
11
- numeric: {
12
- min: "The value cannot be less than {min}",
13
- max: "The value cannot be greater than {max}",
14
- minMax: "The value must be between {min} et {max}"
15
- }
16
- };
17
- const nbCharLeft$1 = "{counter} characters left.";
18
- const input$1 = {
19
- select: {
20
- placeholder: "Select a value"
21
- },
22
- checkbox: {
23
- selectedValues: "{nb} selected values",
24
- selectedValue: "{nb} selected value",
25
- editButton: "Edit",
26
- selectButton: "Select values",
27
- showButton: "Show",
28
- label: "Enter a value",
29
- result: "result",
30
- results: "results",
31
- searchResults: "Search result(s) list.",
32
- noResult: "No result.",
33
- sections: {
34
- selected: {
35
- title: "Selected",
36
- titlePlurial: "Selected",
37
- action: "Unselect all"
38
- },
39
- notSelected: {
40
- title: "Not selected",
41
- titlePlurial: "Not selected",
42
- action: "Select all"
43
- }
44
- }
45
- }
46
- };
47
- const form$1 = {
48
- required: "Fields with a <strong class=\"mg-u-is-asterisk\">*</strong> are required",
49
- requiredSingle: "Field with a <strong class=\"mg-u-is-asterisk\">*</strong> is required",
50
- allRequired: "All fields are required",
51
- allRequiredSingle: "The field is required"
52
- };
53
- const message$1 = {
54
- closeButton: "Close message"
55
- };
56
- const modal$1 = {
57
- closeButton: "Close modal"
58
- };
59
- const pagination$1 = {
60
- label: "Pagination",
61
- page: "page",
62
- pages: "pages",
63
- nextPage: "Next page",
64
- previousPage: "Previous page",
65
- selectPage: "Select the page to display."
66
- };
67
- const panel$1 = {
68
- editLabel: "Edit section title."
69
- };
70
- const skipLinks$1 = {
71
- navLabel: "Quick access"
72
- };
73
- const general$1 = {
74
- confirm: "Confirm",
75
- cancel: "Cancel",
76
- close: "Close",
77
- next: "next",
78
- previous: "previous"
79
- };
80
- const plusMenu$1 = {
81
- moreLabel: "Additional menu",
82
- badgeLabel: "Include notification(s)"
83
- };
84
- const actionMore$1 = {
85
- label: "Actions"
86
- };
87
- const en = {
88
- errors: errors$1,
89
- nbCharLeft: nbCharLeft$1,
90
- input: input$1,
91
- form: form$1,
92
- message: message$1,
93
- modal: modal$1,
94
- pagination: pagination$1,
95
- panel: panel$1,
96
- skipLinks: skipLinks$1,
97
- general: general$1,
98
- plusMenu: plusMenu$1,
99
- actionMore: actionMore$1
100
- };
101
-
102
- const errors = {
103
- required: "Ce champ est obligatoire.",
104
- date: {
105
- 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}",
106
- min: "La date ne peut pas être antérieure au {min}",
107
- max: "La date ne peut pas être postérieure au {max}",
108
- minMax: "La date doit être comprise entre le {min} et le {max}"
109
- },
110
- numeric: {
111
- min: "La valeur ne peut pas être inférieure à {min}",
112
- max: "La valeur ne peut pas être supérieure à {max}",
113
- minMax: "La valeur doit être comprise entre {min} et {max}"
114
- }
115
- };
116
- const nbCharLeft = "{counter} caractères disponibles.";
117
- const input = {
118
- select: {
119
- placeholder: "Sélectionnez une valeur"
120
- },
121
- checkbox: {
122
- selectedValues: "{nb} valeurs selectionnées",
123
- selectedValue: "{nb} valeur selectionnée",
124
- editButton: "Modifier",
125
- selectButton: "Sélectionner des valeurs",
126
- showButton: "Voir",
127
- label: "Saisissez une valeur",
128
- result: "résultat",
129
- results: "résultats",
130
- searchResults: "List de résultat(s) de la recherche.",
131
- noResult: "Aucun résultat.",
132
- sections: {
133
- selected: {
134
- title: "Sélectionné",
135
- titlePlurial: "Sélectionnés",
136
- action: "Tout désélectionner"
137
- },
138
- notSelected: {
139
- title: "Non sélectionné",
140
- titlePlurial: "Non sélectionnés",
141
- action: "Tout sélectionner"
142
- }
143
- }
144
- }
145
- };
146
- const form = {
147
- required: "Les champs marqués d'un <strong class=\"mg-u-is-asterisk\">*</strong> sont obligatoires",
148
- requiredSingle: "Le champ marqué d'un <strong class=\"mg-u-is-asterisk\">*</strong> est obligatoire",
149
- allRequired: "Tous les champs sont obligatoires",
150
- allRequiredSingle: "Le champ est obligatoire"
151
- };
152
- const message = {
153
- closeButton: "Fermer le message"
154
- };
155
- const modal = {
156
- closeButton: "Fermer la modale"
157
- };
158
- const pagination = {
159
- label: "Pagination",
160
- page: "page",
161
- pages: "pages",
162
- nextPage: "Page suivante",
163
- previousPage: "Page précédente",
164
- selectPage: "Sélectionner la page à afficher."
165
- };
166
- const panel = {
167
- editLabel: "Modifier le titre de la section."
168
- };
169
- const skipLinks = {
170
- navLabel: "Accès rapide"
171
- };
172
- const general = {
173
- confirm: "Valider",
174
- cancel: "Annuler",
175
- close: "Fermer",
176
- next: "suivant",
177
- previous: "précédent"
178
- };
179
- const plusMenu = {
180
- moreLabel: "Menu complémentaire",
181
- badgeLabel: "Notification(s) incluse(s)"
182
- };
183
- const actionMore = {
184
- label: "Actions"
185
- };
186
- const fr = {
187
- errors: errors,
188
- nbCharLeft: nbCharLeft,
189
- input: input,
190
- form: form,
191
- message: message,
192
- modal: modal,
193
- pagination: pagination,
194
- panel: panel,
195
- skipLinks: skipLinks,
196
- general: general,
197
- plusMenu: plusMenu,
198
- actionMore: actionMore
199
- };
200
-
201
- /**
202
- * Format number to the locale currency
203
- * @param number - number to format
204
- * @param locale - locale to apply
205
- * @param currency - currency to apply
206
- * @returns formatted currency
207
- */
208
- const localeCurrency = (number, locale, currency) => {
209
- return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);
210
- };
211
- /**
212
- * Format number to locale
213
- * @param number - number to format
214
- * @param locale - locale to apply
215
- * @returns formatted number
216
- */
217
- const localeNumber = (number, locale) => {
218
- return new Intl.NumberFormat(locale).format(number);
219
- };
220
- /**
221
- * Date RegExp
222
- */
223
- const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
224
- /**
225
- * Locale date format
226
- * @param date - date to format
227
- * @param locale - locale to apply
228
- * @returns formatted date
229
- */
230
- const localeDate = (date, locale) => {
231
- if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {
232
- return '';
233
- }
234
- return new Intl.DateTimeFormat(locale).format(new Date(date));
235
- };
236
- /**
237
- * Get locale and messages
238
- * We load the defined locale but for now we only support the first subtag for messages
239
- * @param element - element we need to get the language
240
- * @param messages - messages to use
241
- * @param defaultLocale - default messages locale
242
- * @returns messages object
243
- */
244
- const getLocaleMessages = (element, messages, defaultLocale) => {
245
- // Get local
246
- const closestLangAttribute = element.closest('[lang]');
247
- const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute === null || closestLangAttribute === void 0 ? void 0 : closestLangAttribute.lang);
248
- const locale = closestLang.length > 0 ? closestLang[0] : navigator.language || defaultLocale;
249
- // Only keep first subtag
250
- const localeSubtag = locale.split('-').shift();
251
- // Return
252
- return {
253
- locale,
254
- messages: messages[localeSubtag] || messages[defaultLocale],
255
- };
256
- };
257
-
258
- const defaultLocale = 'en';
259
- const messages = { en, fr };
260
- /**
261
- * Get Intl object
262
- * @param element - element we need to get the language
263
- * @returns messages object
264
- */
265
- const initLocales = (element) => getLocaleMessages(element, messages, defaultLocale);
266
-
267
- /**
268
- * Menu direction type
269
- */
270
- exports.Direction = void 0;
271
- (function (Direction) {
272
- Direction["VERTICAL"] = "vertical";
273
- Direction["HORIZONTAL"] = "horizontal";
274
- })(exports.Direction || (exports.Direction = {}));
275
- /**
276
- * List of all possibles sizes
277
- */
278
- const sizes = ['regular', 'medium', 'large'];
279
-
280
- /**
281
- * Create random ID
282
- * @param prefix - add prefix to created ID
283
- * @param length - ID length
284
- * @returns ID
285
- */
286
- const createID = (prefix = '', length = 10) => {
287
- const randomBytes = new Uint8Array(length);
288
- crypto.getRandomValues(randomBytes);
289
- const hexString = Array.from(randomBytes)
290
- .map(byte => byte.toString(16).padStart(2, '0'))
291
- .join('')
292
- .slice(0, length);
293
- return prefix !== '' ? `${prefix}-${hexString}` : hexString;
294
- };
295
- /**
296
- * Class to manage component classlist
297
- * Set() are not working when imported in project
298
- */
299
- class ClassList {
300
- constructor(classlist = []) {
301
- /**
302
- * Add class
303
- * @param className - class name to add
304
- */
305
- this.add = (className) => {
306
- if (!this.has(className)) {
307
- this.classes.push(className);
308
- }
309
- };
310
- /**
311
- * Delete class
312
- * @param className - class name to delete
313
- */
314
- this.delete = (className) => {
315
- const index = this.classes.indexOf(className);
316
- if (index > -1) {
317
- this.classes.splice(index, 1);
318
- }
319
- };
320
- /**
321
- * Check if class exist in list
322
- * @param className - class name to check
323
- * @returns class name is in the list
324
- */
325
- this.has = (className) => {
326
- return this.classes.includes(className);
327
- };
328
- /**
329
- * Join classes seperated by spaces
330
- * @returns joined values
331
- */
332
- this.join = () => {
333
- return this.classes.join(' ');
334
- };
335
- this.classes = classlist;
336
- }
337
- }
338
- /**
339
- * Check if all items are string
340
- * @param items - items to check
341
- * @returns all items are string
342
- */
343
- const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
344
- /**
345
- * Check if element is a heading
346
- * @param element - slotted element
347
- * @param tagNames - allowed tag names list
348
- * @returns element is a heading
349
- */
350
- const isTagName = (element, tagNames) => {
351
- return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
352
- };
353
- /**
354
- * Focusable elements query selector
355
- */
356
- const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
357
- /**
358
- * Get windows
359
- * @param localWindow - the window we are lookink for other windows
360
- * @returns The list of windows found
361
- */
362
- const getWindows = (localWindow) => {
363
- const parentWindows = getParentWindows(localWindow);
364
- const childWindows = getChildWindows(localWindow);
365
- return [localWindow, ...parentWindows, ...childWindows];
366
- };
367
- /**
368
- * Get parent windows
369
- * @param localWindow - the window we are lookink for parents
370
- * @param windows - The list of allready found windows
371
- * @returns The list of windows found
372
- */
373
- const getParentWindows = (localWindow, windows = []) => {
374
- // Check if is in iframe
375
- if (localWindow.self !== localWindow.top) {
376
- // Check if we have permission to access parent
377
- try {
378
- const parentWindow = localWindow.parent;
379
- windows.push(parentWindow);
380
- return getParentWindows(parentWindow, windows);
381
- }
382
- catch (err) {
383
- console.error('Different hosts between iframes:', err);
384
- return windows;
385
- }
386
- }
387
- return windows;
388
- };
389
- /**
390
- * Get child windows
391
- * @param localWindow - the window we are lookink for children
392
- * @param windows - The list of allready found windows
393
- * @returns The list of windows found
394
- */
395
- const getChildWindows = (localWindow, windows = []) => {
396
- if (localWindow.frames.length > 0) {
397
- for (const childWindow of Array.from(localWindow.frames)) {
398
- windows.push(childWindow);
399
- getChildWindows(childWindow, windows);
400
- }
401
- }
402
- return windows;
403
- };
404
- /**
405
- * Validate string
406
- * @param value - value to check
407
- * @returns if string is valid
408
- */
409
- const isValidString = (value) => typeof value === 'string' && value.trim() !== '';
410
- /**
411
- * Clean string caraters
412
- * @param text - text to cliean
413
- * @returns cleanded string
414
- */
415
- const cleanString = (text) => typeof text === 'string' &&
416
- text
417
- .toLocaleLowerCase()
418
- .normalize('NFD')
419
- .replaceAll(/[\u0300-\u036f]/g, '');
420
- /**
421
- * Use to process code next tick in the event loop
422
- * @param callback - code to excute on next tick
423
- * @returns differed code excution
424
- */
425
- const nextTick = async (callback) => callback();
426
-
427
- exports.ClassList = ClassList;
428
- exports.allItemsAreString = allItemsAreString;
429
- exports.cleanString = cleanString;
430
- exports.createID = createID;
431
- exports.dateRegExp = dateRegExp;
432
- exports.focusableElements = focusableElements;
433
- exports.getWindows = getWindows;
434
- exports.initLocales = initLocales;
435
- exports.isTagName = isTagName;
436
- exports.isValidString = isValidString;
437
- exports.localeCurrency = localeCurrency;
438
- exports.localeDate = localeDate;
439
- exports.localeNumber = localeNumber;
440
- exports.nextTick = nextTick;
441
- exports.sizes = sizes;
442
-
443
- //# sourceMappingURL=components.utils-cd908d4e.js.map
@@ -1 +0,0 @@
1
- {"file":"components.utils-cd908d4e.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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direction"],"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"],"version":3}