@mgdis/mg-components 5.5.0 → 5.7.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 (242) hide show
  1. package/dist/cjs/{index-c3450336.js → index-5e7ede97.js} +120 -4
  2. package/dist/cjs/loader.cjs.js +4 -3
  3. package/dist/cjs/{mg-badge_30.cjs.entry.js → mg-action-more_31.cjs.entry.js} +1223 -547
  4. package/dist/cjs/mg-components.cjs.js +7 -3
  5. package/dist/collection/collection-manifest.json +6 -5
  6. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
  7. package/dist/collection/components/atoms/mg-badge/mg-badge.css +13 -0
  8. package/dist/collection/components/atoms/mg-badge/mg-badge.js +4 -4
  9. package/dist/collection/components/atoms/mg-button/mg-button.css +9 -22
  10. package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
  11. package/dist/collection/components/atoms/mg-card/mg-card.css +13 -6
  12. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +38 -28
  13. package/dist/collection/components/atoms/mg-icon/mg-icon.js +3 -3
  14. package/dist/collection/components/atoms/mg-tag/mg-tag.css +6 -6
  15. package/dist/collection/components/atoms/mg-tag/mg-tag.js +4 -4
  16. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +2 -0
  17. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +14 -17
  18. package/dist/collection/components/molecules/inputs/MgInput.js +6 -1
  19. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
  20. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +3 -2
  21. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +7 -3
  22. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +5 -2
  23. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +7 -3
  24. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +7 -3
  26. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
  27. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +2 -1
  28. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +7 -3
  29. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +8 -4
  30. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +7 -3
  31. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +7 -3
  32. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  33. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -4
  34. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +17 -0
  35. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +27 -0
  36. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +141 -19
  37. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +0 -4
  38. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +48 -21
  39. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +139 -71
  40. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js +1 -0
  41. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +38 -0
  42. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +252 -0
  43. package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
  44. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +4 -3
  45. package/dist/collection/components/molecules/mg-message/mg-message.css +7 -0
  46. package/dist/collection/components/molecules/mg-message/mg-message.js +54 -13
  47. package/dist/collection/components/molecules/mg-modal/mg-modal.css +8 -1
  48. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
  49. package/dist/collection/components/molecules/mg-panel/mg-panel.css +7 -0
  50. package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -2
  51. package/dist/collection/components/molecules/mg-popover/mg-popover.css +72 -15
  52. package/dist/collection/components/molecules/mg-popover/mg-popover.js +64 -7
  53. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +33 -1
  54. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +12 -7
  55. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +105 -57
  56. package/dist/collection/locales/en/messages.json +10 -1
  57. package/dist/collection/locales/fr/messages.json +10 -1
  58. package/dist/collection/locales/index.js +3 -26
  59. package/dist/collection/styles/a11y.scss +32 -0
  60. package/dist/collection/styles/components.scss +3 -0
  61. package/dist/collection/styles/fonts.scss +21 -0
  62. package/dist/collection/styles/form.scss +3 -0
  63. package/dist/collection/styles/global.scss +87 -0
  64. package/dist/collection/styles/layout.scss +29 -0
  65. package/dist/collection/styles/main.scss +23 -0
  66. package/dist/collection/styles/mg-icon-animation.scss +6 -0
  67. package/dist/collection/styles/navigation-button.scss +77 -0
  68. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +9 -0
  69. package/dist/collection/styles/typography.scss +75 -0
  70. package/dist/collection/styles/utilities.scss +21 -0
  71. package/dist/collection/utils/behaviors.utils.js +151 -0
  72. package/dist/collection/utils/components.utils.js +52 -0
  73. package/dist/collection/utils/locale.utils.js +28 -6
  74. package/dist/collection/utils/unit.test.utils.js +65 -32
  75. package/dist/collection/variables.css +11 -10
  76. package/dist/components/MgInput.js +6 -1
  77. package/dist/components/components.utils.js +53 -1
  78. package/dist/components/index.d.ts +10 -0
  79. package/dist/components/index.js +2 -1
  80. package/dist/components/index2.js +79 -20
  81. package/dist/components/mg-action-more.d.ts +11 -0
  82. package/dist/components/mg-action-more.js +215 -0
  83. package/dist/components/mg-badge2.js +5 -5
  84. package/dist/components/mg-button2.js +2 -2
  85. package/dist/components/mg-card2.js +1 -1
  86. package/dist/components/mg-form.js +2 -2
  87. package/dist/components/mg-icon2.js +41 -31
  88. package/dist/components/mg-illustrated-message.js +4 -3
  89. package/dist/components/mg-input-checkbox.js +3 -3
  90. package/dist/components/mg-input-date.js +7 -5
  91. package/dist/components/mg-input-numeric.js +3 -4
  92. package/dist/components/mg-input-password.js +1 -1
  93. package/dist/components/mg-input-radio.js +2 -2
  94. package/dist/components/mg-input-select2.js +9 -5
  95. package/dist/components/mg-input-text2.js +1 -1
  96. package/dist/components/mg-input-textarea.js +2 -2
  97. package/dist/components/mg-input-toggle.js +1 -1
  98. package/dist/components/mg-menu-item.js +1 -253
  99. package/dist/components/mg-menu-item2.js +520 -0
  100. package/dist/components/mg-menu.js +1 -129
  101. package/dist/components/mg-menu2.js +247 -0
  102. package/dist/components/mg-message.js +55 -14
  103. package/dist/components/mg-modal.js +1 -1
  104. package/dist/components/mg-pagination.js +3 -1
  105. package/dist/components/mg-panel.js +3 -3
  106. package/dist/components/mg-popover.js +1 -190
  107. package/dist/components/mg-popover2.js +226 -0
  108. package/dist/components/mg-skip-links.js +16 -2
  109. package/dist/components/mg-tabs.js +104 -55
  110. package/dist/components/mg-tag.js +5 -5
  111. package/dist/components/mg-tooltip2.js +15 -18
  112. package/dist/esm/{index-78edde1d.js → index-03cceb11.js} +120 -5
  113. package/dist/esm/loader.js +4 -3
  114. package/dist/esm/{mg-badge_30.entry.js → mg-action-more_31.entry.js} +1223 -548
  115. package/dist/esm/mg-components.js +4 -3
  116. package/dist/esm/polyfills/css-shim.js +1 -1
  117. package/dist/mg-components/locales/en/messages.json +10 -1
  118. package/dist/mg-components/locales/fr/messages.json +10 -1
  119. package/dist/mg-components/mg-components.css +1 -1
  120. package/dist/mg-components/mg-components.esm.js +1 -1
  121. package/dist/mg-components/p-4cfd5423.entry.js +1 -0
  122. package/dist/mg-components/p-e126dd84.js +2 -0
  123. package/dist/mg-components/styles/a11y.scss +32 -0
  124. package/dist/mg-components/styles/components.scss +3 -0
  125. package/dist/mg-components/styles/fonts.scss +21 -0
  126. package/dist/mg-components/styles/form.scss +3 -0
  127. package/dist/mg-components/styles/global.scss +87 -0
  128. package/dist/mg-components/styles/layout.scss +29 -0
  129. package/dist/mg-components/styles/main.scss +23 -0
  130. package/dist/mg-components/styles/mg-icon-animation.scss +6 -0
  131. package/dist/mg-components/styles/navigation-button.scss +77 -0
  132. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +9 -0
  133. package/dist/mg-components/styles/typography.scss +75 -0
  134. package/dist/mg-components/styles/utilities.scss +21 -0
  135. package/dist/mg-components/variables.css +11 -10
  136. package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +2 -2
  137. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -2
  138. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +2 -2
  139. package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +1 -1
  140. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -2
  141. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +2 -2
  142. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
  143. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
  144. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -1
  145. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +1 -1
  146. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +37 -0
  147. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +51 -3
  148. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +0 -8
  149. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +61 -15
  150. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +42 -0
  151. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +81 -0
  152. package/dist/types/components/molecules/mg-message/mg-message.d.ts +21 -4
  153. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +4 -0
  154. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +13 -0
  155. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +1 -1
  156. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +15 -0
  157. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +5 -3
  158. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +22 -12
  159. package/dist/types/components.d.ts +98 -12
  160. package/dist/types/locales/index.d.ts +21 -10
  161. package/dist/types/stencil-public-runtime.d.ts +48 -3
  162. package/dist/types/utils/behaviors.utils.d.ts +77 -0
  163. package/dist/types/utils/components.utils.d.ts +14 -0
  164. package/dist/types/utils/locale.utils.d.ts +16 -3
  165. package/dist/types/utils/unit.test.utils.d.ts +68 -14
  166. package/loader/index.d.ts +9 -0
  167. package/package.json +28 -27
  168. package/readme.md +22 -31
  169. package/dist/.storybook/utils.js +0 -24
  170. package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -27
  171. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -38
  172. package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +0 -18
  173. package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +0 -20
  174. package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +0 -18
  175. package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +0 -41
  176. package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +0 -21
  177. package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +0 -22
  178. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -50
  179. package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +0 -50
  180. package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +0 -43
  181. package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +0 -68
  182. package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +0 -46
  183. package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +0 -59
  184. package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +0 -77
  185. package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +0 -110
  186. package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +0 -54
  187. package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +0 -51
  188. package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +0 -87
  189. package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +0 -39
  190. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +0 -24
  191. package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +0 -47
  192. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +0 -19
  193. package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +0 -39
  194. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +0 -39
  195. package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +0 -20
  196. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +0 -22
  197. package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -34
  198. package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +0 -24
  199. package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +0 -51
  200. package/dist/collection/stories/grids.stories.js +0 -7
  201. package/dist/collection/stories/helpers.stories.js +0 -23
  202. package/dist/collection/stories/icons.stories.js +0 -25
  203. package/dist/collection/stories/typography.stories.js +0 -24
  204. package/dist/components/locale.utils.js +0 -40
  205. package/dist/components/mg-menu.conf.js +0 -10
  206. package/dist/mg-components/p-125c54ca.js +0 -2
  207. package/dist/mg-components/p-4961c96c.entry.js +0 -1
  208. package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -13
  209. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -16
  210. package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +0 -6
  211. package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -6
  212. package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +0 -6
  213. package/dist/types/components/atoms/mg-icon/doc/mg-icon.stories.d.ts +0 -26
  214. package/dist/types/components/atoms/mg-input-title/doc/mg-input-title.stories.d.ts +0 -6
  215. package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -6
  216. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -18
  217. package/dist/types/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.d.ts +0 -11
  218. package/dist/types/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.d.ts +0 -12
  219. package/dist/types/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.d.ts +0 -32
  220. package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +0 -22
  221. package/dist/types/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.d.ts +0 -20
  222. package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +0 -34
  223. package/dist/types/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.d.ts +0 -39
  224. package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +0 -19
  225. package/dist/types/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.d.ts +0 -12
  226. package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +0 -17
  227. package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +0 -12
  228. package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +0 -11
  229. package/dist/types/components/molecules/mg-form/doc/mg-form.stories.d.ts +0 -11
  230. package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +0 -6
  231. package/dist/types/components/molecules/mg-message/doc/mg-message.stories.d.ts +0 -26
  232. package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +0 -13
  233. package/dist/types/components/molecules/mg-pagination/doc/mg-pagination.stories.d.ts +0 -11
  234. package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +0 -11
  235. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -22
  236. package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +0 -11
  237. package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +0 -20
  238. package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +0 -1
  239. package/dist/types/stories/grids.stories.d.ts +0 -5
  240. package/dist/types/stories/helpers.stories.d.ts +0 -13
  241. package/dist/types/stories/icons.stories.d.ts +0 -13
  242. package/dist/types/stories/typography.stories.d.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgdis/mg-components",
3
- "version": "5.5.0",
3
+ "version": "5.7.0",
4
4
  "description": "MG Components",
5
5
  "packageManager": "pnpm@7.17.1",
6
6
  "engineStrict": true,
@@ -28,50 +28,51 @@
28
28
  "outputName": "junit.xml"
29
29
  },
30
30
  "dependencies": {
31
- "@popperjs/core": "^2.11.2",
32
- "@stencil/core": "^2.20.0",
31
+ "@popperjs/core": "^2.11.6",
32
+ "@stencil/core": "^2.22.1",
33
33
  "normalize.css": "^8.0.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@babel/core": "^7.20.5",
37
- "@babel/plugin-transform-react-jsx": "^7.14.9",
36
+ "@babel/core": "^7.20.12",
37
+ "@babel/plugin-transform-react-jsx": "^7.20.13",
38
38
  "@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
39
39
  "@stencil/eslint-plugin": "^0.4.0",
40
40
  "@stencil/sass": "^1.5.2",
41
- "@storybook/addon-a11y": "^6.5.14",
42
- "@storybook/addon-actions": "^6.5.14",
43
- "@storybook/addon-docs": "^6.5.14",
44
- "@storybook/addon-essentials": "^6.5.14",
45
- "@storybook/addon-links": "^6.5.14",
46
- "@storybook/html": "^6.5.14",
41
+ "@storybook/addon-a11y": "^6.5.16",
42
+ "@storybook/addon-actions": "^6.5.16",
43
+ "@storybook/addon-docs": "^6.5.16",
44
+ "@storybook/addon-essentials": "^6.5.16",
45
+ "@storybook/addon-links": "^6.5.16",
46
+ "@storybook/html": "^6.5.16",
47
47
  "@storybook/preset-scss": "^1.0.3",
48
48
  "@types/jest": "^26.0.24",
49
- "@types/jest-image-snapshot": "^4.3.1",
49
+ "@types/jest-image-snapshot": "^4.3.2",
50
+ "@types/node": "^18.14.0",
50
51
  "@typescript-eslint/eslint-plugin": "^4.33.0",
51
52
  "@typescript-eslint/parser": "^4.33.0",
52
- "babel-loader": "^8.2.2",
53
+ "babel-loader": "^8.3.0",
53
54
  "babel-plugin-jsx-pragmatic": "^1.0.2",
54
- "chromatic": "^6.10.1",
55
+ "chromatic": "^6.15.0",
55
56
  "css-loader": "^5.2.7",
56
57
  "eslint": "^7.32.0",
57
- "eslint-plugin-jsdoc": "^38.0.6",
58
- "eslint-plugin-jsx-a11y": "^6.6.1",
59
- "eslint-plugin-react": "^7.26.1",
60
- "eslint-plugin-storybook": "^0.6.8",
58
+ "eslint-plugin-jsdoc": "^38.1.6",
59
+ "eslint-plugin-jsx-a11y": "^6.7.1",
60
+ "eslint-plugin-react": "^7.32.2",
61
+ "eslint-plugin-storybook": "^0.6.10",
61
62
  "husky": "^7.0.4",
62
63
  "jest": "^26.6.3",
63
64
  "jest-cli": "^26.6.3",
64
65
  "jest-image-snapshot": "^4.5.1",
65
- "jest-junit": "^13.0.0",
66
- "jsx-dom": "^8.0.1-beta.1",
66
+ "jest-junit": "^13.2.0",
67
+ "jsx-dom": "^8.0.4",
67
68
  "npm-run-all": "^4.1.5",
68
- "prettier": "^2.5.1",
69
- "puppeteer": "^13.3.2",
70
- "sass": "^1.41.0",
71
- "sass-loader": "^10.2.0",
69
+ "prettier": "^2.8.3",
70
+ "puppeteer": "^13.7.0",
71
+ "sass": "^1.58.0",
72
+ "sass-loader": "^10.4.1",
72
73
  "style-loader": "^2.0.0",
73
- "ts-node": "^10.7.0",
74
- "turbo": "^1.6.3",
74
+ "ts-node": "^10.9.1",
75
+ "turbo": "^1.8.1",
75
76
  "typescript": "~4.4.4"
76
77
  },
77
78
  "license": "BSD-3-Clause",
@@ -85,7 +86,7 @@
85
86
  "lint:prettier": "prettier --check **/*.{ts,tsx,scss,html,mdx,json}",
86
87
  "lint:prettier:fix": "prettier --write **/*.{ts,tsx,scss,html,mdx,json}",
87
88
  "test": "TZ=UTC stencil test --spec --e2e",
88
- "test:unit": "TZ=UTC stencil test --spec",
89
+ "test:unit": "TZ=UTC stencil test --spec --collectCoverage --reporters=\"default\" --reporters=\"jest-junit\"",
89
90
  "test:e2e": "stencil test --e2e",
90
91
  "test.watch": "stencil test --spec --e2e --watchAll",
91
92
  "generate": "stencil generate",
package/readme.md CHANGED
@@ -20,45 +20,47 @@ To run MG Components, clone this repository, go to your new directory and run:
20
20
  # This repository uses pnpm as package manager
21
21
  corepack enable
22
22
  pnpm i
23
- npm run start
23
+ pnpm start
24
24
  ```
25
25
 
26
26
  To build for production, run:
27
27
 
28
28
  ```bash
29
- npm run build
29
+ pnpm build
30
30
  ```
31
31
 
32
32
  To run tests for the components, run:
33
33
 
34
34
  ```bash
35
- npm run test
35
+ pnpm test
36
36
 
37
37
  # only unit tests
38
- npm run test:unit
38
+ pnpm test:unit
39
39
 
40
40
  # only e2e tests
41
- npm run test:e2e
41
+ pnpm test:e2e
42
42
 
43
43
  # filter on filename
44
- npm run test -- mg-icon
45
- npm run test:unit -- mg-icon
44
+ pnpm test -- mg-icon
45
+ pnpm test:unit -- mg-icon
46
46
  ```
47
47
 
48
48
  <!-- Not working for now: To regenerate snapshot you must add the `-u` parameter. -->
49
49
 
50
+ To regenerate snapshot you must add the `--updateSnapshot` parameter.
51
+
50
52
  For E2E tests you **must** use [WSL](https://docs.microsoft.com/fr-fr/windows/wsl/install) or a Linux OS to get the same screenshots as the GitLab CI.
51
53
 
52
54
  To add a component, run:
53
55
 
54
56
  ```bash
55
- npm run generate component-path
57
+ pnpm generate component-path
56
58
 
57
59
  # example for an atom
58
- npm run generate atoms/mg-icon
60
+ pnpm generate atoms/mg-icon
59
61
 
60
62
  # example for a molecule
61
- npm run generate molecules/mg-message
63
+ pnpm generate molecules/mg-message
62
64
  ```
63
65
 
64
66
  ## Naming Components
@@ -100,24 +102,6 @@ When a selector contains too many declaration it is recommended to organize them
100
102
  }
101
103
  ```
102
104
 
103
- ### Accessibility
104
-
105
- A good pratice is to manage hover, focus and active state at the same place.
106
-
107
- ```SCSS
108
- /* SCSS */
109
- button {
110
- &:hover, &:focus, &:active {
111
- text-decoration: underline;
112
- }
113
- }
114
-
115
- /* CSS */
116
- button:hover, button:focus, button:active {
117
- text-decoration: underline;
118
- }
119
- ```
120
-
121
105
  ## Storybook
122
106
 
123
107
  The plugin [storybook-addon-docs-stencil
@@ -126,10 +110,17 @@ The plugin [storybook-addon-docs-stencil
126
110
  ### run
127
111
 
128
112
  ```bash
129
- npm run storybook
113
+ pnpm storybook
130
114
  ```
131
115
 
132
116
  ### Notes
133
117
 
134
- - camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
135
- - Boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
118
+ To display components in our `stories`, we use the `filterArgs` method to only show the necessary arguments in the code example. It takes in the first parameter an object containing the arguments to be used, and in the second parameter, an object containing the component default values.
119
+
120
+ ```JS
121
+ const Template = (args: any): HTMLElement => (
122
+ <mg-tooltip {...filterArgs(args, { placement: 'bottom' })}>
123
+ <mg-icon icon="info-circle"></mg-icon>
124
+ </mg-tooltip>
125
+ );
126
+ ```
@@ -1,24 +0,0 @@
1
- export const filterArgs = (args, defaultValues) => {
2
- const filteredArgs = {};
3
- for (const k in args) {
4
- if (!k.startsWith('slot')) {
5
- const arg = args[k];
6
- // Change camelCase k to kebab-case
7
- const key = k.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
8
- // Change value to boolean true value, will be replace during render
9
- if (typeof arg === 'boolean' && arg === true) {
10
- filteredArgs[key] = 'mg__storybook__boolean-true';
11
- }
12
- // Do not add args if is default value
13
- else if (!defaultValues || !Object.keys(defaultValues).includes(k) || defaultValues[k] !== arg) {
14
- filteredArgs[key] = arg;
15
- }
16
- }
17
- }
18
- // Add comment when args contain object, will be replace during render
19
- const argsObjects = Object.entries(args).filter(arg => typeof arg[1] === 'object');
20
- if (argsObjects.length > 0) {
21
- filteredArgs['mg__storybook__comment'] = `/!\\ Object props are not rendered in the code example: ${argsObjects.map(([a]) => a).join(', ')}.`;
22
- }
23
- return filteredArgs;
24
- };
@@ -1,27 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- import { variants } from '../mg-badge.conf';
4
- export default {
5
- component: 'mg-badge',
6
- title: 'Atoms/mg-badge',
7
- argTypes: {
8
- value: {
9
- control: { type: 'text' },
10
- },
11
- },
12
- };
13
- /**
14
- * Template
15
- *
16
- * @param {any} args component arguments
17
- * @returns {HTMLElement} HTMLElement
18
- */
19
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
- const Template = (args) => h("mg-badge", Object.assign({}, filterArgs(args, { variant: variants[0] })));
21
- export const MgBadge = Template.bind({});
22
- MgBadge.args = {
23
- value: '99',
24
- label: 'unread messages',
25
- variant: variants[0],
26
- outline: false,
27
- };
@@ -1,38 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { variants, buttonTypes } from '../mg-button.conf';
3
- import { icons } from '../../mg-icon/mg-icon.conf';
4
- import { filterArgs } from '../../../../../.storybook/utils';
5
- export default {
6
- component: 'mg-button',
7
- title: 'Atoms/mg-button',
8
- argTypes: {
9
- type: {
10
- options: [undefined, ...buttonTypes],
11
- control: { type: 'select' },
12
- },
13
- },
14
- };
15
- /**
16
- * Template
17
- *
18
- * @param {any} args component arguments
19
- * @returns {HTMLElement} HTMLElement
20
- */
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- const Template = (args) => h("mg-button", Object.assign({}, filterArgs(args, { variant: variants[0] })), args.slot);
23
- export const MgButton = Template.bind({});
24
- MgButton.args = {
25
- slot: 'Text button',
26
- variant: variants[0],
27
- label: 'Explicit aria label',
28
- identifier: undefined,
29
- disabled: false,
30
- disableOnClick: false,
31
- isIcon: false,
32
- type: undefined,
33
- fullWidth: undefined,
34
- };
35
- export const IsIcon = Template.bind({});
36
- IsIcon.args = Object.assign(Object.assign({}, MgButton.args), { isIcon: true, slot: h("mg-icon", { icon: Object.keys(icons)[0] }) });
37
- export const DisableOnClick = Template.bind({});
38
- DisableOnClick.args = Object.assign(Object.assign({}, MgButton.args), { disableOnClick: true });
@@ -1,18 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-card',
5
- title: 'Atoms/mg-card',
6
- };
7
- /**
8
- * Template
9
- *
10
- * @param {any} args component arguments
11
- * @returns {HTMLElement} HTMLElement
12
- */
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- const Template = (args) => h("mg-card", Object.assign({}, filterArgs(args)), args.slot);
15
- export const MgCard = Template.bind({});
16
- MgCard.args = {
17
- slot: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
18
- };
@@ -1,20 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-character-left',
5
- title: 'Atoms/mg-character-left',
6
- };
7
- /**
8
- * Template
9
- *
10
- * @param {any} args component arguments
11
- * @returns {HTMLElement} HTMLElement
12
- */
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- const Template = (args) => h("mg-character-left", Object.assign({}, filterArgs(args)));
15
- export const MgCharacterLeft = Template.bind({});
16
- MgCharacterLeft.args = {
17
- identifier: 'identifier',
18
- characters: '',
19
- maxlength: 400,
20
- };
@@ -1,18 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-divider',
5
- title: 'Atoms/mg-divider',
6
- };
7
- /**
8
- * Template
9
- *
10
- * @param {any} args component arguments
11
- * @returns {HTMLElement} HTMLElement
12
- */
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- const Template = (args) => h("mg-divider", Object.assign({}, filterArgs(args, { size: 'regular' })));
15
- export const MgDivider = Template.bind({});
16
- MgDivider.args = {
17
- size: 'regular',
18
- };
@@ -1,41 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- import { icons, sizes, variants } from '../mg-icon.conf';
4
- export default {
5
- component: 'mg-icon',
6
- title: 'Atoms/mg-icon',
7
- argTypes: {
8
- icon: {
9
- options: Object.keys(icons),
10
- control: { type: 'select' },
11
- },
12
- size: {
13
- options: sizes,
14
- control: { type: 'select' },
15
- },
16
- variant: {
17
- options: [undefined, ...variants],
18
- control: { type: 'select' },
19
- },
20
- },
21
- };
22
- /**
23
- * Template
24
- *
25
- * @param {any} args component arguments
26
- * @returns {HTMLElement} HTMLElement
27
- */
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- const Template = (args) => {
30
- const color = args.color;
31
- delete args.color;
32
- // return element
33
- return (h("div", { style: { color } }, h("mg-icon", Object.assign({}, filterArgs(args, { size: sizes[1] })))));
34
- };
35
- export const MgIcon = Template.bind({});
36
- MgIcon.args = {
37
- color: '',
38
- icon: Object.keys(icons)[0],
39
- size: undefined,
40
- spin: false,
41
- };
@@ -1,21 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-input-title',
5
- title: 'Atoms/mg-input-title',
6
- };
7
- /**
8
- * Template
9
- *
10
- * @param {any} args component arguments
11
- * @returns {HTMLElement} HTMLElement
12
- */
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- const Template = (args) => h("mg-input-title", Object.assign({}, filterArgs(args)), args.slot);
15
- export const MgInputTitle = Template.bind({});
16
- MgInputTitle.args = {
17
- slot: 'Label',
18
- identifier: 'identifier',
19
- required: true,
20
- isLegend: false,
21
- };
@@ -1,22 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- import { variants } from '../mg-tag.conf';
4
- export default {
5
- component: 'mg-tag',
6
- title: 'Atoms/mg-tag',
7
- };
8
- /**
9
- * Template
10
- *
11
- * @param {any} args component arguments
12
- * @returns {HTMLElement} HTMLElement
13
- */
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- const Template = (args) => h("mg-tag", Object.assign({}, filterArgs(args, { variant: variants[0] })), args.slot);
16
- export const MgTag = Template.bind({});
17
- MgTag.args = {
18
- slot: 'Label',
19
- variant: variants[0],
20
- outline: false,
21
- soft: false,
22
- };
@@ -1,50 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-tooltip',
5
- title: 'Atoms/mg-tooltip',
6
- parameters: {
7
- layout: 'centered',
8
- },
9
- argTypes: {
10
- placement: {
11
- control: { type: 'select' },
12
- },
13
- },
14
- };
15
- /**
16
- * Template
17
- *
18
- * @param {any} args component arguments
19
- * @returns {HTMLElement} HTMLElement
20
- */
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- const Template = (args) => (h("mg-tooltip", Object.assign({}, filterArgs(args, { placement: 'bottom' })), h("mg-icon", { icon: "info-circle" })));
23
- export const MgTooltip = Template.bind({});
24
- MgTooltip.args = {
25
- identifier: 'identifier',
26
- message: 'This is a tooltip message',
27
- placement: undefined,
28
- display: false,
29
- disabled: false,
30
- };
31
- /**
32
- * Template
33
- *
34
- * @param {any} args component arguments
35
- * @returns {HTMLElement} HTMLElement
36
- */
37
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- const TemplateButton = (args) => (h("mg-tooltip", Object.assign({}, filterArgs(args, { placement: 'bottom' })), h("mg-button", null, "Action")));
39
- export const MgTooltipOnButton = TemplateButton.bind({});
40
- MgTooltipOnButton.args = Object.assign({}, MgTooltip.args);
41
- /**
42
- * Template
43
- *
44
- * @param {any} args component arguments
45
- * @returns {HTMLElement} HTMLElement
46
- */
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- const TemplateSpan = (args) => (h("mg-tooltip", Object.assign({}, filterArgs(args, { placement: 'bottom' })), h("span", null, "any text")));
49
- export const MgTooltipOnSpan = TemplateSpan.bind({});
50
- MgTooltipOnSpan.args = Object.assign({}, MgTooltip.args);
@@ -1,50 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-input-checkbox',
5
- title: 'Molecules/Inputs/mg-input-checkbox',
6
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
7
- };
8
- /**
9
- * Template
10
- *
11
- * @param {any} args component arguments
12
- * @returns {HTMLElement} HTMLElement
13
- */
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- const Template = (args) => h("mg-input-checkbox", Object.assign({}, filterArgs(args)));
16
- export const MgInputCheckbox = Template.bind({});
17
- MgInputCheckbox.args = {
18
- // Global
19
- value: [
20
- {
21
- title: 'HT',
22
- value: true,
23
- },
24
- {
25
- title: 'TTC',
26
- value: false,
27
- disabled: true,
28
- },
29
- {
30
- title: 'Mixte (HT/TTC)',
31
- value: null,
32
- },
33
- ],
34
- identifier: 'identifier',
35
- name: 'input-name',
36
- // Label
37
- label: 'Option',
38
- labelOnTop: false,
39
- labelHide: false,
40
- // placement
41
- inputVerticalList: false,
42
- // Input
43
- required: false,
44
- disabled: false,
45
- readonly: false,
46
- // Tooltip
47
- tooltip: 'This is a tooltip',
48
- // Help Text
49
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
50
- };
@@ -1,43 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-input-date',
5
- title: 'Molecules/Inputs/mg-input-date',
6
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
7
- };
8
- /**
9
- * Template
10
- *
11
- * @param {any} args component arguments
12
- * @returns {HTMLElement} HTMLElement
13
- */
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- const Template = (args) => h("mg-input-date", Object.assign({}, filterArgs(args)));
16
- const date = new Date();
17
- const getFormatedNumber = (number) => {
18
- return `${number > 9 ? number : '0' + number}`;
19
- };
20
- export const MgInputDate = Template.bind({});
21
- MgInputDate.args = {
22
- // Global
23
- value: `${date.getFullYear()}-${getFormatedNumber(date.getMonth())}-${getFormatedNumber(date.getDate())}`,
24
- identifier: 'identifier',
25
- name: 'input-name',
26
- // Label
27
- label: 'Label',
28
- labelOnTop: false,
29
- labelHide: false,
30
- // Input
31
- required: true,
32
- readonly: false,
33
- disabled: false,
34
- // Tooltip
35
- tooltip: 'This is a tooltip',
36
- // Help Text
37
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
38
- };
39
- export const MgInputDateMinMax = Template.bind({});
40
- MgInputDateMinMax.args = Object.assign(Object.assign({}, MgInputDate.args), {
41
- // date range
42
- min: `${date.getFullYear()}-01-01`, max: `${date.getFullYear() + 1}-12-31`
43
- });
@@ -1,68 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- import { types } from '../mg-input-numeric.conf';
4
- export default {
5
- component: 'mg-input-numeric',
6
- title: 'Molecules/Inputs/mg-input-numeric',
7
- argTypes: {
8
- type: {
9
- options: types,
10
- control: { type: 'select' },
11
- },
12
- mgWidth: {
13
- options: [undefined, 2, 4, 16, 'full'],
14
- control: { type: 'select' },
15
- },
16
- },
17
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
18
- };
19
- /**
20
- * Template
21
- *
22
- * @param {any} args component arguments
23
- * @returns {HTMLElement} HTMLElement
24
- */
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- const Template = (args) => h("mg-input-numeric", Object.assign({}, filterArgs(args)));
27
- /**
28
- * Global use
29
- */
30
- export const MgInputNumeric = Template.bind({});
31
- MgInputNumeric.args = {
32
- // Global
33
- value: '',
34
- identifier: 'identifier',
35
- name: 'input-name',
36
- type: types[0],
37
- // Label
38
- label: 'Label',
39
- labelOnTop: false,
40
- labelHide: false,
41
- // Input
42
- placeholder: 'placeholder',
43
- required: true,
44
- disabled: false,
45
- readonly: false,
46
- max: undefined,
47
- min: undefined,
48
- mgWidth: undefined,
49
- // Tooltip
50
- tooltip: 'This is a tooltip',
51
- // Help Text
52
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
53
- };
54
- const TemplateSlot = args => {
55
- const labelOnTop = args.labelOnTop;
56
- delete args.labelOnTop;
57
- const labelHide = args.labelHide;
58
- delete args.labelHide;
59
- const helpText = args.helpText;
60
- delete args.helpText;
61
- // return element
62
- return (h("mg-input-numeric", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText }), h("span", { slot: "append-input" }, "km")));
63
- };
64
- /**
65
- * Global use
66
- */
67
- export const AppendSlot = TemplateSlot.bind({});
68
- AppendSlot.args = Object.assign({}, MgInputNumeric.args);