@mgdis/mg-components 3.3.0 → 4.1.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 (257) hide show
  1. package/dist/.storybook/utils.js +24 -0
  2. package/dist/cjs/{index-369388eb.js → index-179621c8.js} +108 -10
  3. package/dist/cjs/{index-bead7dbd.js → index-88560a66.js} +47 -48
  4. package/dist/cjs/loader.cjs.js +3 -17
  5. package/dist/cjs/mg-badge_24.cjs.entry.js +5687 -0
  6. package/dist/cjs/mg-components.cjs.js +3 -7
  7. package/dist/cjs/mg-modal.cjs.entry.js +12 -6
  8. package/dist/collection/collection-manifest.json +3 -1
  9. package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +10 -6
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -3
  12. package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +16 -13
  13. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
  14. package/dist/collection/components/atoms/mg-button/mg-button.css +6 -30
  15. package/dist/collection/components/atoms/mg-button/mg-button.js +53 -22
  16. package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +20 -0
  17. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +10 -47
  18. package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +12 -4
  19. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +99 -10
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.css +4 -0
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  22. package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +21 -0
  23. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +10 -8
  24. package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
  25. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +58 -0
  26. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +26 -0
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +71 -13
  28. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
  29. package/dist/collection/components/molecules/inputs/MgInput.js +5 -15
  30. package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +3 -15
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +22 -15
  32. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -21
  33. package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +3 -12
  34. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +22 -20
  35. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +19 -18
  36. package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +9 -13
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +23 -21
  38. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +43 -19
  39. package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +10 -12
  40. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +22 -20
  41. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -22
  42. package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +3 -14
  43. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +22 -15
  44. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +8 -15
  45. package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +10 -16
  46. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +23 -20
  47. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +24 -31
  48. package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +18 -25
  49. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +54 -30
  50. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +42 -43
  51. package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +11 -14
  52. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +54 -24
  53. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +64 -37
  54. package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +57 -0
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +21 -11
  56. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +25 -10
  57. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +25 -0
  58. package/dist/collection/components/molecules/mg-details/mg-details.css +14 -0
  59. package/dist/collection/components/molecules/mg-details/mg-details.js +141 -0
  60. package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +9 -6
  61. package/dist/collection/components/molecules/mg-form/mg-form.css +5 -1
  62. package/dist/collection/components/molecules/mg-form/mg-form.js +53 -7
  63. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +22 -0
  64. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +37 -0
  65. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +74 -0
  66. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +10 -16
  67. package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
  68. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +43 -0
  69. package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
  70. package/dist/collection/components/molecules/mg-modal/mg-modal.js +10 -4
  71. package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +20 -0
  72. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
  73. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +29 -0
  74. package/dist/collection/components/molecules/mg-panel/mg-panel.css +4 -2
  75. package/dist/collection/components/molecules/mg-panel/mg-panel.js +12 -16
  76. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +22 -16
  77. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  78. package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
  79. package/dist/collection/components/molecules/mg-popover/mg-popover.js +43 -13
  80. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +20 -15
  81. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
  82. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
  83. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +75 -29
  84. package/dist/collection/locales/index.js +33 -4
  85. package/dist/collection/stories/helpers.stories.js +41 -0
  86. package/dist/collection/stories/icons.stories.js +10 -2
  87. package/dist/collection/stories/typography.stories.js +8 -1
  88. package/dist/collection/utils/components.utils.js +10 -0
  89. package/dist/collection/utils/locale.utils.js +7 -4
  90. package/dist/collection/variables.css +10 -5
  91. package/dist/collection/variables.scss +10 -5
  92. package/dist/components/MgInput.js +6 -23
  93. package/dist/components/components.utils.js +11 -1
  94. package/dist/components/index.d.ts +25 -5
  95. package/dist/components/index.js +25 -0
  96. package/dist/components/index2.js +97 -8
  97. package/dist/components/locale.utils.js +7 -5
  98. package/dist/components/mg-badge2.js +16 -4
  99. package/dist/components/mg-button2.js +14 -17
  100. package/dist/components/mg-character-left2.js +4 -27
  101. package/dist/components/mg-details.d.ts +11 -0
  102. package/dist/components/mg-details.js +87 -0
  103. package/dist/components/mg-form.js +40 -8
  104. package/dist/components/mg-icon2.js +122 -17
  105. package/dist/components/mg-illustrated-message.d.ts +11 -0
  106. package/dist/components/mg-illustrated-message.js +68 -0
  107. package/dist/components/mg-input-checkbox.js +11 -27
  108. package/dist/components/mg-input-date.js +21 -25
  109. package/dist/components/mg-input-numeric.js +28 -26
  110. package/dist/components/mg-input-password.js +18 -28
  111. package/dist/components/mg-input-radio.js +10 -22
  112. package/dist/components/mg-input-select2.js +24 -35
  113. package/dist/components/mg-input-text2.js +38 -26
  114. package/dist/components/mg-input-textarea.js +43 -20
  115. package/dist/components/mg-input-toggle.js +27 -18
  116. package/dist/components/mg-message.js +16 -8
  117. package/dist/components/mg-modal.js +11 -5
  118. package/dist/components/mg-pagination.js +16 -22
  119. package/dist/components/mg-panel.js +9 -12
  120. package/dist/components/mg-popover.js +22 -12
  121. package/dist/components/mg-tabs.js +77 -22
  122. package/dist/components/mg-tag.js +20 -5
  123. package/dist/components/mg-tooltip2.js +74 -12
  124. package/dist/components/popper.js +6 -2
  125. package/dist/esm/{index-c346f52d.js → index-7efedd97.js} +107 -8
  126. package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
  127. package/dist/esm/loader.js +3 -17
  128. package/dist/esm/mg-badge_24.entry.js +5660 -0
  129. package/dist/esm/mg-components.js +3 -7
  130. package/dist/esm/mg-modal.entry.js +12 -6
  131. package/dist/index.js +1 -1
  132. package/dist/mg-components/mg-components.css +1 -1
  133. package/dist/mg-components/mg-components.esm.js +1 -1
  134. package/dist/mg-components/p-5f89600c.js +1 -0
  135. package/dist/mg-components/p-a2883dc7.entry.js +1 -0
  136. package/dist/mg-components/p-b14a3443.js +2 -0
  137. package/dist/mg-components/p-cffe0519.entry.js +1 -0
  138. package/dist/mg-components/variables.css +10 -5
  139. package/dist/mg-components/variables.scss +10 -5
  140. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
  141. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
  142. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +6 -0
  143. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +8 -0
  144. package/dist/types/components/atoms/mg-button/mg-button.d.ts +12 -1
  145. package/dist/types/{stories/tags.stories.d.ts → components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts} +2 -1
  146. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
  147. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  148. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  149. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  150. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
  151. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
  152. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +24 -0
  153. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +13 -0
  154. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +27 -2
  155. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
  156. package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
  157. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
  158. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
  159. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
  160. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
  161. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
  162. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
  163. package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
  164. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
  165. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
  166. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
  167. package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
  168. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
  169. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
  170. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
  171. package/dist/types/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.d.ts → doc/mg-input-textarea.stories.d.ts} +8 -0
  172. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +14 -6
  173. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
  174. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
  175. package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +11 -0
  176. package/dist/types/components/molecules/mg-details/mg-details.d.ts +49 -0
  177. package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
  178. package/dist/types/components/molecules/mg-form/mg-form.d.ts +14 -0
  179. package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +6 -0
  180. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +28 -0
  181. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
  182. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
  183. package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
  184. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
  185. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
  186. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
  187. package/dist/types/components/molecules/mg-panel/{mg-panel.stories.d.ts → doc/mg-panel.stories.d.ts} +0 -0
  188. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +5 -0
  189. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +28 -0
  190. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  191. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +15 -2
  192. package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +0 -0
  193. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
  194. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +44 -0
  195. package/dist/types/components.d.ts +240 -147
  196. package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +1 -0
  197. package/dist/types/locales/index.d.ts +109 -46
  198. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  199. package/dist/types/utils/components.utils.d.ts +8 -0
  200. package/dist/types/utils/locale.utils.d.ts +7 -3
  201. package/loader/index.js +1 -1
  202. package/package.json +16 -16
  203. package/readme.md +6 -35
  204. package/dist/cjs/css-shim-629916b0.js +0 -6
  205. package/dist/cjs/mg-badge_21.cjs.entry.js +0 -3358
  206. package/dist/cjs/mg-popover.cjs.entry.js +0 -161
  207. package/dist/cjs/popper-0c3964e7.js +0 -1786
  208. package/dist/cjs/shadow-css-546083ef.js +0 -390
  209. package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +0 -23
  210. package/dist/collection/components/atoms/mg-input-title/mg-input-title.stories.js +0 -21
  211. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.stories.js +0 -26
  212. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +0 -78
  213. package/dist/collection/components/molecules/mg-modal/mg-modal.stories.js +0 -51
  214. package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +0 -24
  215. package/dist/collection/components/molecules/mg-panel/mg-panel.stories.js +0 -39
  216. package/dist/collection/stories/buttons.stories.js +0 -43
  217. package/dist/collection/stories/messages.stories.js +0 -44
  218. package/dist/collection/stories/tags.stories.js +0 -13
  219. package/dist/esm/css-shim-0993aa3b.js +0 -4
  220. package/dist/esm/mg-badge_21.entry.js +0 -3334
  221. package/dist/esm/mg-popover.entry.js +0 -157
  222. package/dist/esm/popper-8874fd6c.js +0 -1784
  223. package/dist/esm/shadow-css-dfa0587f.js +0 -388
  224. package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
  225. package/dist/esm-es5/index-9e877561.js +0 -1
  226. package/dist/esm-es5/index-c346f52d.js +0 -1
  227. package/dist/esm-es5/index.js +0 -0
  228. package/dist/esm-es5/loader.js +0 -1
  229. package/dist/esm-es5/mg-badge_21.entry.js +0 -2
  230. package/dist/esm-es5/mg-components.js +0 -1
  231. package/dist/esm-es5/mg-modal.entry.js +0 -1
  232. package/dist/esm-es5/mg-popover.entry.js +0 -1
  233. package/dist/esm-es5/popper-8874fd6c.js +0 -1
  234. package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
  235. package/dist/mg-components/mg-components.js +0 -132
  236. package/dist/mg-components/p-136c8d6f.system.entry.js +0 -2
  237. package/dist/mg-components/p-3c14153d.js +0 -1
  238. package/dist/mg-components/p-50ea2036.system.js +0 -1
  239. package/dist/mg-components/p-55a22b35.system.js +0 -1
  240. package/dist/mg-components/p-5e796581.js +0 -12
  241. package/dist/mg-components/p-656b5efb.system.js +0 -1
  242. package/dist/mg-components/p-68d6f104.js +0 -1
  243. package/dist/mg-components/p-6d49ed95.js +0 -1
  244. package/dist/mg-components/p-6f173f62.system.entry.js +0 -1
  245. package/dist/mg-components/p-70177194.entry.js +0 -1
  246. package/dist/mg-components/p-8b2d8a2a.system.js +0 -13
  247. package/dist/mg-components/p-8cb61c3f.system.js +0 -1
  248. package/dist/mg-components/p-ace173b1.js +0 -1
  249. package/dist/mg-components/p-b7488a4c.entry.js +0 -1
  250. package/dist/mg-components/p-c1ffb2e1.entry.js +0 -1
  251. package/dist/mg-components/p-c90cc4bf.system.js +0 -1
  252. package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
  253. package/dist/mg-components/p-e4a502b5.system.js +0 -1
  254. package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +0 -16
  255. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  256. package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
  257. package/dist/types/stories/messages.stories.d.ts +0 -13
@@ -1,5 +1,6 @@
1
1
  import { h } from '@stencil/core';
2
- import { variants } from './mg-message.conf';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
3
+ import { variants } from '../mg-message.conf';
3
4
  export default {
4
5
  component: 'mg-message',
5
6
  title: 'Molecules/mg-message',
@@ -15,22 +16,15 @@ export default {
15
16
  parameters: { actions: { handles: ['component-show', 'component-hide'] } },
16
17
  };
17
18
  /**
18
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
19
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
19
+ * Template
20
+ *
21
+ * @param {any} args component arguments
22
+ * @returns {HTMLElement} HTMLElement
20
23
  */
21
- const Template = args => {
22
- // Extract slot so it won't be render as an attribute
23
- const slotContent = args.slotContent;
24
- delete args.slotContent;
25
- const slotActions = args.slotActions;
26
- delete args.slotActions;
27
- const closeButton = args.closeButton;
28
- delete args.closeButton;
29
- // return element
30
- return (h("mg-message", Object.assign({}, args, { "close-button": closeButton }),
31
- slotContent && h("span", { innerHTML: slotContent }),
32
- slotActions && h("span", { slot: "actions", innerHTML: slotActions })));
33
- };
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ const Template = (args) => (h("mg-message", Object.assign({}, filterArgs(args, { variant: variants[0] })),
26
+ args.slotContent && h("span", { innerHTML: args.slotContent }),
27
+ args.slotActions && h("span", { slot: "actions", innerHTML: args.slotActions })));
34
28
  export const MgMessage = Template.bind({});
35
29
  MgMessage.args = {
36
30
  slotContent: `<p>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.</p>`,
@@ -1,12 +1,15 @@
1
1
  import { Component, Element, Event, h, Prop, State, Watch } from '@stencil/core';
2
2
  import { createID, ClassList } from '../../../utils/components.utils';
3
3
  import { variants } from './mg-message.conf';
4
- import { messages } from '../../../locales';
4
+ import { initLocales } from '../../../locales';
5
5
  export class MgMessage {
6
6
  constructor() {
7
7
  /************
8
8
  * Internal *
9
9
  ************/
10
+ // classes
11
+ this.classHide = 'mg-message--hide';
12
+ // IDs
10
13
  this.closeButtonId = '';
11
14
  // Stored timer setted when hide action is run from setTimeOut
12
15
  this.storedTimer = null;
@@ -82,10 +85,12 @@ export class MgMessage {
82
85
  if (!variants.includes(newValue)) {
83
86
  throw new Error(`<mg-message> prop "variant" must be one of : ${variants.join(', ')}`);
84
87
  }
85
- if (oldValue !== undefined) {
86
- this.classList.delete(`mg-message--${oldValue}`);
88
+ else {
89
+ if (oldValue !== undefined) {
90
+ this.classList.delete(`mg-message--${oldValue}`);
91
+ }
92
+ this.classList.add(`mg-message--${newValue}`);
87
93
  }
88
- this.classList.add(`mg-message--${this.variant}`);
89
94
  }
90
95
  validateCloseButton(newValue) {
91
96
  if (newValue && this.hasActions) {
@@ -96,11 +101,11 @@ export class MgMessage {
96
101
  validateHide(newValue) {
97
102
  if (newValue) {
98
103
  this.componentHide.emit();
99
- this.classList.add('mg-message--hide');
104
+ this.classList.add(this.classHide);
100
105
  }
101
106
  else {
102
107
  this.componentShow.emit();
103
- this.classList.delete('mg-message--hide');
108
+ this.classList.delete(this.classHide);
104
109
  }
105
110
  this.hideWithDelay();
106
111
  }
@@ -111,6 +116,9 @@ export class MgMessage {
111
116
  * Check if component props are well configured on init
112
117
  */
113
118
  componentWillLoad() {
119
+ // Get locales
120
+ this.messages = initLocales(this.element).messages;
121
+ // Validate
114
122
  this.validateVariant(this.variant);
115
123
  // Check if close button is an can be activated
116
124
  this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
@@ -138,7 +146,7 @@ export class MgMessage {
138
146
  this.hasActions && (h("span", { class: "mg-message__content-actions-slot" },
139
147
  h("slot", { name: "actions" })))),
140
148
  this.closeButton && (h("span", { class: "mg-message__close-button" },
141
- h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.message.closeButton, onClick: this.handleClose },
149
+ h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose },
142
150
  h("mg-icon", { icon: "cross" }))))));
143
151
  }
144
152
  static get is() { return "mg-message"; }
@@ -0,0 +1,43 @@
1
+ /* eslint-disable react/jsx-no-bind */
2
+ import { h } from '@stencil/core';
3
+ import { filterArgs } from '../../../../../.storybook/utils';
4
+ export default {
5
+ component: 'mg-modal',
6
+ title: 'Molecules/mg-modal',
7
+ parameters: { actions: { handles: ['component-show', 'component-hide'] } },
8
+ };
9
+ /**
10
+ * Template
11
+ *
12
+ * @param {any} args component arguments
13
+ * @returns {HTMLElement} HTMLElement
14
+ */
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ const Template = (args) => (h("div", null,
17
+ h("mg-button", { controls: "identifier", haspopup: "dialog", onClick: () => {
18
+ const mgModal = document.querySelector('mg-modal');
19
+ const isHide = mgModal.hide === true;
20
+ if (isHide) {
21
+ mgModal.removeAttribute('hide'); // storybook first render is an attribute then we use property
22
+ mgModal.hide = false;
23
+ }
24
+ else {
25
+ mgModal.hide = true;
26
+ }
27
+ } }, "Open modal"),
28
+ h("mg-modal", Object.assign({}, filterArgs(args)),
29
+ args.slotContent && h("div", { slot: "content", innerHTML: args.slotContent }),
30
+ args.slotActions && h("div", { slot: "actions", innerHTML: args.slotActions }))));
31
+ export const MgModal = Template.bind({});
32
+ MgModal.args = {
33
+ slotContent: `<p>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.</p>`,
34
+ slotActions: ``,
35
+ modalTitle: 'Modal title',
36
+ identifier: 'identifier',
37
+ closeButton: false,
38
+ hide: true,
39
+ };
40
+ export const WithCloseButton = Template.bind({});
41
+ WithCloseButton.args = Object.assign(Object.assign({}, MgModal.args), { closeButton: true });
42
+ export const WithActions = Template.bind({});
43
+ WithActions.args = Object.assign(Object.assign({}, MgModal.args), { closeButton: true, slotActions: `<div class="mg-group-elements mg-group-elements--align-right"><mg-button>Primary</mg-button><mg-button variant="secondary">Secondary</mg-button></div>` });
@@ -9,13 +9,11 @@
9
9
  left: 0;
10
10
  z-index: 1000;
11
11
  padding: 2rem 0;
12
- background-color: hsla(var(--color-light), 70%);
12
+ background-color: hsla(var(--color-light), 85%);
13
13
  }
14
14
  .mg-modal__dialog {
15
15
  display: flex;
16
16
  flex-direction: column;
17
- flex: none;
18
- /* IE FIX */
19
17
  align-self: center;
20
18
  row-gap: 3rem;
21
19
  padding: 1.5rem 2.5rem;
@@ -37,16 +35,16 @@
37
35
  font-size: var(--mg-modal-title-font-size);
38
36
  font-weight: 600;
39
37
  }
40
- .mg-modal__content {
41
- overflow-y: auto;
42
- }
43
38
  .mg-modal__close-button {
44
39
  float: right;
45
40
  height: var(--mg-modal-title-font-size);
46
41
  margin-top: calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);
47
42
  margin-right: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1);
48
43
  }
49
- .mg-modal .mg-modal__content ::slotted(*) {
44
+ .mg-modal .mg-modal__content {
45
+ overflow-y: auto;
46
+ }
47
+ .mg-modal .mg-modal__content::slotted(*) {
50
48
  font-size: var(--mg-modal-content-font-size);
51
49
  }
52
50
  .mg-modal.mg-modal--hide {
@@ -1,11 +1,14 @@
1
1
  import { Component, h, Prop, State, Watch, Element, Event, Listen } from '@stencil/core';
2
2
  import { createID, ClassList } from '../../../utils/components.utils';
3
- import { messages } from '../../../locales';
3
+ import { initLocales } from '../../../locales';
4
4
  export class MgModal {
5
5
  constructor() {
6
6
  /************
7
7
  * Internal *
8
8
  ************/
9
+ // Classes
10
+ this.classHide = 'mg-modal--hide';
11
+ // IDs
9
12
  this.closeButtonId = '';
10
13
  this.titleId = '';
11
14
  /**
@@ -48,11 +51,11 @@ export class MgModal {
48
51
  validateHide(newValue) {
49
52
  if (newValue) {
50
53
  this.componentHide.emit();
51
- this.classList.add('mg-modal--hide');
54
+ this.classList.add(this.classHide);
52
55
  }
53
56
  else {
54
57
  this.componentShow.emit();
55
- this.classList.delete('mg-modal--hide');
58
+ this.classList.delete(this.classHide);
56
59
  }
57
60
  }
58
61
  /**
@@ -76,6 +79,9 @@ export class MgModal {
76
79
  * @returns {void}
77
80
  */
78
81
  componentWillLoad() {
82
+ // Get locales
83
+ this.messages = initLocales(this.element).messages;
84
+ // Validate
79
85
  this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
80
86
  this.hasContent = this.element.querySelector('[slot="content"]') !== null;
81
87
  if (this.closeButton) {
@@ -94,7 +100,7 @@ export class MgModal {
94
100
  h("article", { class: "mg-modal__dialog" },
95
101
  h("header", { class: "mg-modal__header" },
96
102
  this.closeButton && (h("span", { class: "mg-modal__close-button" },
97
- h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.modal.closeButton, onClick: this.handleClose },
103
+ h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose },
98
104
  h("mg-icon", { icon: "cross" })))),
99
105
  h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)),
100
106
  this.hasContent && (h("article", { class: "mg-modal__content" },
@@ -0,0 +1,20 @@
1
+ import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
3
+ export default {
4
+ component: 'mg-pagination',
5
+ title: 'Molecules/mg-pagination',
6
+ parameters: { actions: { handles: ['current-page-change'] } },
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-pagination", Object.assign({}, filterArgs(args)));
16
+ export const MgPagination = Template.bind({});
17
+ MgPagination.args = {
18
+ totalPages: 5,
19
+ currentPage: 1,
20
+ };
@@ -1,7 +1,7 @@
1
- import { Component, h, Prop, Watch, Event } from '@stencil/core';
1
+ import { Component, Element, h, Prop, Watch, Event } from '@stencil/core';
2
2
  import { createID } from '../../../utils/components.utils';
3
3
  import { NavigationAction } from './mg-pagination.conf';
4
- import { messages } from './../../../locales';
4
+ import { initLocales } from './../../../locales';
5
5
  /**
6
6
  * Range generator
7
7
  *
@@ -25,19 +25,11 @@ import { messages } from './../../../locales';
25
25
  const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
26
26
  export class MgPagination {
27
27
  constructor() {
28
- /**************
29
- * Decorators *
30
- **************/
31
28
  /**
32
29
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
33
30
  * If not set, it will be created.
34
31
  */
35
32
  this.identifier = createID('mg-pagination');
36
- /**
37
- * Panignation label. Is a short description.
38
- * Customize default value can be usefull to improve accessibility
39
- */
40
- this.label = 'pagination';
41
33
  /**
42
34
  * Component total pages
43
35
  */
@@ -101,8 +93,15 @@ export class MgPagination {
101
93
  * @returns {void}
102
94
  */
103
95
  componentWillLoad() {
96
+ // Get locales
97
+ this.messages = initLocales(this.element).messages;
98
+ // Validate
104
99
  this.validateTotalPages(this.totalPages);
105
100
  this.validateCurrentPage(this.currentPage);
101
+ // Set default label
102
+ if (this.label === undefined || this.label === '') {
103
+ this.label = this.messages.pagination.label;
104
+ }
106
105
  }
107
106
  /**
108
107
  * Render
@@ -110,24 +109,24 @@ export class MgPagination {
110
109
  * @returns {HTMLElement} HTML Element
111
110
  */
112
111
  render() {
113
- const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, class: "mg-pagination__button", label: messages.pagination[`${action}Page`],
112
+ const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, class: "mg-pagination__button", label: this.messages.pagination[`${action}Page`],
114
113
  // eslint-disable-next-line react/jsx-no-bind
115
114
  onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" },
116
115
  action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }),
117
- messages.general[action],
116
+ this.messages.general[action],
118
117
  action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
119
118
  return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination__nav" },
120
119
  navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS),
121
- h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }),
120
+ h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }),
122
121
  h("span", { class: "sr-only" },
123
- messages.pagination.page,
122
+ this.messages.pagination.page,
124
123
  " ",
125
124
  this.currentPage),
126
125
  h("span", null,
127
126
  "/ ",
128
127
  this.totalPages,
129
128
  " ",
130
- this.totalPages > 1 ? messages.pagination.pages : messages.pagination.page),
129
+ this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page),
131
130
  navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
132
131
  }
133
132
  static get is() { return "mg-pagination"; }
@@ -159,7 +158,7 @@ export class MgPagination {
159
158
  },
160
159
  "label": {
161
160
  "type": "string",
162
- "mutable": false,
161
+ "mutable": true,
163
162
  "complexType": {
164
163
  "original": "string",
165
164
  "resolved": "string",
@@ -172,8 +171,7 @@ export class MgPagination {
172
171
  "text": "Panignation label. Is a short description.\nCustomize default value can be usefull to improve accessibility"
173
172
  },
174
173
  "attribute": "label",
175
- "reflect": false,
176
- "defaultValue": "'pagination'"
174
+ "reflect": false
177
175
  },
178
176
  "totalPages": {
179
177
  "type": "number",
@@ -228,6 +226,7 @@ export class MgPagination {
228
226
  "references": {}
229
227
  }
230
228
  }]; }
229
+ static get elementRef() { return "element"; }
231
230
  static get watchers() { return [{
232
231
  "propName": "totalPages",
233
232
  "methodName": "validateTotalPages"
@@ -0,0 +1,29 @@
1
+ import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
3
+ export default {
4
+ component: 'mg-panel',
5
+ title: 'Molecules/mg-panel',
6
+ parameters: { actions: { handles: ['title-change', 'expanded-change'] } },
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-panel", Object.assign({}, filterArgs(args)),
16
+ h("div", null, "Content"),
17
+ h("div", { slot: "header-right" },
18
+ h("mg-button", { variant: "secondary" },
19
+ h("mg-icon", { icon: "file-upload" }),
20
+ " Upload"),
21
+ h("mg-button", Object.assign({}, filterArgs({ isIcon: true }), { variant: "secondary", label: "delete" }),
22
+ h("mg-icon", { icon: "trash" })))));
23
+ export const MgPanel = Template.bind({});
24
+ MgPanel.args = {
25
+ panelTitle: 'title',
26
+ expanded: false,
27
+ titleEditable: true,
28
+ expandToggleDisabled: false,
29
+ };
@@ -30,11 +30,13 @@
30
30
  flex-grow: 1;
31
31
  }
32
32
 
33
- .mg-panel__collapse-button {
33
+ .mg-panel__header-left mg-button:not([slot=append-input]) {
34
+ margin: 0 0.3rem 0 0;
35
+ }
36
+ .mg-panel__header-left mg-button:not([slot=append-input]) > *:first-of-type {
34
37
  font-family: var(--font-family-heading);
35
38
  font-size: 1.4rem;
36
39
  font-weight: 500;
37
- margin: 0 0.3rem 0 0;
38
40
  }
39
41
 
40
42
  .mg-panel__content {
@@ -1,11 +1,8 @@
1
- import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
1
+ import { Component, Element, h, Prop, State, Watch, Event } from '@stencil/core';
2
2
  import { createID, ClassList } from '../../../utils/components.utils';
3
- import { messages } from '../../../locales';
3
+ import { initLocales } from '../../../locales';
4
4
  export class MgPanel {
5
5
  constructor() {
6
- /**************
7
- * Decorators *
8
- **************/
9
6
  /**
10
7
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
11
8
  * If not set, it will be created.
@@ -15,10 +12,6 @@ export class MgPanel {
15
12
  * Panel is opened
16
13
  */
17
14
  this.expanded = false;
18
- /**
19
- * Disable possibility to toggle expand
20
- */
21
- this.expandToggleDisabled = false;
22
15
  /**
23
16
  * Panel title is editabled
24
17
  */
@@ -100,23 +93,23 @@ export class MgPanel {
100
93
  * @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
101
94
  */
102
95
  this.headerLeft = () => {
103
- const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", class: "mg-panel__collapse-button", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content`, disabled: this.expandToggleDisabled },
96
+ const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content`, disabled: this.expandToggleDisabled },
104
97
  h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }),
105
98
  !this.isEditing && this.panelTitle));
106
99
  if (this.titleEditable && !this.isEditing) {
107
100
  return [
108
101
  collapseButton(),
109
- h("mg-button", { "is-icon": true, variant: "flat", label: messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` },
102
+ h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` },
110
103
  h("mg-icon", { icon: "pen" })),
111
104
  ];
112
105
  }
113
106
  if (this.titleEditable && this.isEditing) {
114
107
  return [
115
108
  collapseButton(),
116
- h("mg-input-text", { label: messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) },
117
- h("mg-button", { slot: "append-input", label: messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` },
109
+ h("mg-input-text", { label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) },
110
+ h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` },
118
111
  h("mg-icon", { icon: "cross" })),
119
- h("mg-button", { slot: "append-input", label: messages.general.validate, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` },
112
+ h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` },
120
113
  h("mg-icon", { icon: "check" }))),
121
114
  ];
122
115
  }
@@ -146,6 +139,9 @@ export class MgPanel {
146
139
  * @returns {void}
147
140
  */
148
141
  componentWillLoad() {
142
+ // Get locales
143
+ this.messages = initLocales(this.element).messages;
144
+ // Validate
149
145
  this.validatetitlePattern(this.titlePattern);
150
146
  }
151
147
  /**
@@ -284,8 +280,7 @@ export class MgPanel {
284
280
  "text": "Disable possibility to toggle expand"
285
281
  },
286
282
  "attribute": "expand-toggle-disabled",
287
- "reflect": false,
288
- "defaultValue": "false"
283
+ "reflect": false
289
284
  },
290
285
  "titleEditable": {
291
286
  "type": "boolean",
@@ -342,6 +337,7 @@ export class MgPanel {
342
337
  "references": {}
343
338
  }
344
339
  }]; }
340
+ static get elementRef() { return "element"; }
345
341
  static get watchers() { return [{
346
342
  "propName": "panelTitle",
347
343
  "methodName": "handelTileChange"
@@ -1,30 +1,35 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
3
+ import { placements } from '../mg-popover.conf';
2
4
  export default {
3
5
  component: 'mg-popover',
4
6
  title: 'Molecules/mg-popover',
5
7
  parameters: {
6
8
  layout: 'centered',
7
9
  docs: { iframeHeight: 600 },
10
+ actions: { handles: ['display-change'] },
11
+ },
12
+ argTypes: {
13
+ placement: {
14
+ options: placements,
15
+ control: { type: 'select' },
16
+ table: {
17
+ defaultValue: { summary: 'bottom' },
18
+ },
19
+ },
8
20
  },
9
21
  };
10
22
  /**
11
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
12
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
23
+ * Template
24
+ *
25
+ * @param {any} args component arguments
26
+ * @returns {HTMLElement} HTMLElement
13
27
  */
14
- const Template = args => {
15
- // Extract slot so it won't be render as an attribute
16
- const slotTitle = args.slotTitle;
17
- delete args.slotTitle;
18
- const slotContent = args.slotContent;
19
- delete args.slotContent;
20
- const closeButton = args.closeButton;
21
- delete args.closeButton;
22
- // return element
23
- return (h("mg-popover", Object.assign({}, args, { "close-button": closeButton }),
24
- h("mg-button", null, "Button"),
25
- slotTitle && h("h2", { slot: "title" }, slotTitle),
26
- slotContent && h("p", { slot: "content" }, slotContent)));
27
- };
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ const Template = (args) => (h("mg-popover", Object.assign({}, filterArgs(args, { placement: 'bottom' })),
30
+ h("mg-button", null, "Button"),
31
+ args.slotTitle && h("h2", { slot: "title" }, args.slotTitle),
32
+ args.slotContent && h("p", { slot: "content" }, args.slotContent)));
28
33
  export const MgPopover = Template.bind({});
29
34
  MgPopover.args = {
30
35
  slotTitle: `Blu bli blo bla`,
@@ -33,4 +38,5 @@ MgPopover.args = {
33
38
  closeButton: false,
34
39
  disabled: false,
35
40
  display: false,
41
+ placement: undefined,
36
42
  };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * List of all possibles placements
3
+ */
4
+ export const placements = [
5
+ 'auto',
6
+ 'auto-start',
7
+ 'auto-end',
8
+ 'top',
9
+ 'top-start',
10
+ 'top-end',
11
+ 'bottom',
12
+ 'bottom-start',
13
+ 'bottom-end',
14
+ 'right',
15
+ 'right-start',
16
+ 'right-end',
17
+ 'left',
18
+ 'left-start',
19
+ 'left-end',
20
+ ];
@@ -52,7 +52,7 @@ mg-popover::slotted(*) {
52
52
  left: -6px;
53
53
  }
54
54
 
55
- .mg-popover__title ::slotted(*) {
55
+ .mg-popover__title ::slotted([slot=title]) {
56
56
  margin: 0 0 1rem;
57
57
  font-size: var(--mg-popover-title-font-size);
58
58
  font-weight: 600;