@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,15 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-bead7dbd.js');
3
+ const index = require('./index-88560a66.js');
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v2.15.1 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v2.17.4 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
  const patchBrowser = () => {
9
- {
10
- // shim css vars
11
- index.plt.$cssShim$ = index.win.__cssshim;
12
- }
13
9
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mg-components.cjs.js', document.baseURI).href));
14
10
  const opts = {};
15
11
  if (importMeta !== '') {
@@ -19,5 +15,5 @@ const patchBrowser = () => {
19
15
  };
20
16
 
21
17
  patchBrowser().then(options => {
22
- return index.bootstrapLazy([["mg-badge_21.cjs",[[1,"mg-pagination",{"identifier":[1],"label":[1],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1025,"title-pattern"],"titlePatternErrorMessage":[1025,"title-pattern-error-message"],"expanded":[1028],"expandToggleDisabled":[1028,"expand-toggle-disabled"],"titleEditable":[4,"title-editable"],"classList":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-input-checkbox",{"value":[1040],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"checkboxItems":[32],"displayError":[64]}],[1,"mg-input-date",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"min":[1],"max":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-numeric",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"width":[8],"tooltip":[1],"helpText":[1,"help-text"],"type":[1],"max":[2],"min":[2],"integerLength":[2,"integer-length"],"decimalLength":[2,"decimal-length"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"hasFocus":[32],"displayError":[64]}],[1,"mg-input-password",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"width":[8],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-radio",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"displayError":[64]}],[1,"mg-input-textarea",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"width":[8],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"rows":[2],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"characterLeftTemplate":[1,"character-left-template"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-toggle",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"isOnOff":[4,"is-on-off"],"isIcon":[4,"is-icon"],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"classList":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classList":[32],"hasActions":[32]}],[6,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classList":[32]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classList":[32],"displayError":[64]}],[1,"mg-tag",{"variant":[1],"outline":[4],"classList":[32]}],[1,"mg-input-select",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"placeholderHide":[4,"placeholder-hide"],"placeholderDisabled":[4,"placeholder-disabled"],"required":[4],"readonly":[4],"disabled":[4],"width":[8],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-input-text",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"type":[1],"icon":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"width":[8],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"characterLeftTemplate":[1,"character-left-template"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[1,"mg-badge",{"value":[1032],"label":[1],"variant":[1],"outline":[4],"classList":[32]}],[6,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"expanded":[4],"controls":[1],"haspopup":[8],"loading":[32],"classList":[32]}],[2,"mg-character-left",{"identifier":[1],"template":[1],"characters":[1],"maxlength":[2]}],[6,"mg-input-title",{"identifier":[1],"required":[4],"isLegend":[4,"is-legend"],"tagName":[32]}],[6,"mg-tooltip",{"identifier":[1],"message":[1],"placement":[1],"display":[1028],"disabled":[1028]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"spin":[4],"classList":[32]}]]],["mg-modal.cjs",[[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[1028,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classList":[32]},[[8,"keydown","handleKeyDown"]]]]],["mg-popover.cjs",[[6,"mg-popover",{"identifier":[1],"placement":[1],"closeButton":[4,"close-button"],"display":[1028],"disabled":[1028]}]]]], options);
18
+ return index.bootstrapLazy([["mg-badge_24.cjs",[[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1025,"title-pattern"],"titlePatternErrorMessage":[1025,"title-pattern-error-message"],"expanded":[1028],"expandToggleDisabled":[1028,"expand-toggle-disabled"],"titleEditable":[4,"title-editable"],"classList":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-pagination",{"identifier":[1],"label":[1025],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[1,"mg-input-textarea",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"rows":[2],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"resizable":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-checkbox",{"value":[1040],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"checkboxItems":[32],"displayError":[64]}],[1,"mg-input-date",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"min":[1],"max":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-numeric",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"type":[1],"currency":[1],"max":[2],"min":[2],"integerLength":[2,"integer-length"],"decimalLength":[2,"decimal-length"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"hasFocus":[32],"displayError":[64]}],[1,"mg-input-password",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-radio",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"displayError":[64]}],[1,"mg-input-toggle",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"isOnOff":[4,"is-on-off"],"isIcon":[4,"is-icon"],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"classList":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classList":[32],"hasActions":[32]}],[6,"mg-popover",{"identifier":[1],"placement":[1],"closeButton":[4,"close-button"],"display":[1028],"disabled":[1028]}],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classList":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"expanded":[1028]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classList":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1]}],[1,"mg-tag",{"variant":[1],"outline":[4],"classList":[32]}],[1,"mg-input-text",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"type":[1],"icon":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[1,"mg-input-select",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1025],"placeholderHide":[4,"placeholder-hide"],"placeholderDisabled":[4,"placeholder-disabled"],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-badge",{"value":[1032],"label":[1],"variant":[1],"outline":[4],"classList":[32]}],[2,"mg-character-left",{"identifier":[1],"characters":[1],"maxlength":[2]}],[6,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"type":[1],"form":[1025],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"expanded":[4],"controls":[1],"haspopup":[8],"loading":[32],"classList":[32]}],[6,"mg-input-title",{"identifier":[1],"required":[4],"isLegend":[4,"is-legend"],"tagName":[32]}],[6,"mg-tooltip",{"identifier":[1],"message":[1],"placement":[1],"display":[1028],"disabled":[1028]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"spin":[4],"classList":[32]}]]],["mg-modal.cjs",[[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[1028,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classList":[32]},[[8,"keydown","handleKeyDown"]]]]]], options);
23
19
  });
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-bead7dbd.js');
6
- const index$1 = require('./index-369388eb.js');
5
+ const index = require('./index-88560a66.js');
6
+ const index$1 = require('./index-179621c8.js');
7
7
 
8
- const mgModalCss = ".mg-modal{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 70%)}.mg-modal__dialog{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:none;flex:none;-ms-flex-item-align:center;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-width:100%;max-height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:hsl(var(--color-light));-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__content{overflow-y:auto}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal .mg-modal__content ::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
8
+ const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal .mg-modal__content{overflow-y:auto}.mg-modal .mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
9
9
 
10
10
  const MgModal = class {
11
11
  constructor(hostRef) {
@@ -15,6 +15,9 @@ const MgModal = class {
15
15
  /************
16
16
  * Internal *
17
17
  ************/
18
+ // Classes
19
+ this.classHide = 'mg-modal--hide';
20
+ // IDs
18
21
  this.closeButtonId = '';
19
22
  this.titleId = '';
20
23
  /**
@@ -57,11 +60,11 @@ const MgModal = class {
57
60
  validateHide(newValue) {
58
61
  if (newValue) {
59
62
  this.componentHide.emit();
60
- this.classList.add('mg-modal--hide');
63
+ this.classList.add(this.classHide);
61
64
  }
62
65
  else {
63
66
  this.componentShow.emit();
64
- this.classList.delete('mg-modal--hide');
67
+ this.classList.delete(this.classHide);
65
68
  }
66
69
  }
67
70
  /**
@@ -85,6 +88,9 @@ const MgModal = class {
85
88
  * @returns {void}
86
89
  */
87
90
  componentWillLoad() {
91
+ // Get locales
92
+ this.messages = index$1.initLocales(this.element).messages;
93
+ // Validate
88
94
  this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
89
95
  this.hasContent = this.element.querySelector('[slot="content"]') !== null;
90
96
  if (this.closeButton) {
@@ -99,7 +105,7 @@ const MgModal = class {
99
105
  * @returns {HTMLElement} HTML Element
100
106
  */
101
107
  render() {
102
- return (index.h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, index.h("article", { class: "mg-modal__dialog" }, index.h("header", { class: "mg-modal__header" }, this.closeButton && (index.h("span", { class: "mg-modal__close-button" }, index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: index$1.messages.modal.closeButton, onClick: this.handleClose }, index.h("mg-icon", { icon: "cross" })))), index.h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (index.h("article", { class: "mg-modal__content" }, index.h("slot", { name: "content" }))), this.hasActions && (index.h("footer", { class: "mg-modal__footer" }, index.h("slot", { name: "actions" }))))));
108
+ return (index.h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, index.h("article", { class: "mg-modal__dialog" }, index.h("header", { class: "mg-modal__header" }, this.closeButton && (index.h("span", { class: "mg-modal__close-button" }, index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, index.h("mg-icon", { icon: "cross" })))), index.h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (index.h("article", { class: "mg-modal__content" }, index.h("slot", { name: "content" }))), this.hasActions && (index.h("footer", { class: "mg-modal__footer" }, index.h("slot", { name: "actions" }))))));
103
109
  }
104
110
  get element() { return index.getElement(this); }
105
111
  static get watchers() { return {
@@ -16,7 +16,9 @@
16
16
  "./components/molecules/inputs/mg-input-text/mg-input-text.js",
17
17
  "./components/molecules/inputs/mg-input-textarea/mg-input-textarea.js",
18
18
  "./components/molecules/inputs/mg-input-toggle/mg-input-toggle.js",
19
+ "./components/molecules/mg-details/mg-details.js",
19
20
  "./components/molecules/mg-form/mg-form.js",
21
+ "./components/molecules/mg-illustrated-message/mg-illustrated-message.js",
20
22
  "./components/molecules/mg-message/mg-message.js",
21
23
  "./components/molecules/mg-modal/mg-modal.js",
22
24
  "./components/molecules/mg-pagination/mg-pagination.js",
@@ -26,7 +28,7 @@
26
28
  ],
27
29
  "compiler": {
28
30
  "name": "@stencil/core",
29
- "version": "2.15.1",
31
+ "version": "2.17.4",
30
32
  "typescriptVersion": "4.5.4"
31
33
  },
32
34
  "collections": [],
@@ -1,5 +1,6 @@
1
1
  import { h } from '@stencil/core';
2
- import { variants } from './mg-badge.conf';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
3
+ import { variants } from '../mg-badge.conf';
3
4
  export default {
4
5
  component: 'mg-badge',
5
6
  title: 'Atoms/mg-badge',
@@ -16,11 +17,14 @@ export default {
16
17
  },
17
18
  },
18
19
  };
19
- const Template = args => {
20
- // Extract slot so it won't be render as an attribute
21
- // return element
22
- return h("mg-badge", Object.assign({}, args));
23
- };
20
+ /**
21
+ * Template
22
+ *
23
+ * @param {any} args component arguments
24
+ * @returns {HTMLElement} HTMLElement
25
+ */
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ const Template = (args) => h("mg-badge", Object.assign({}, filterArgs(args, { variant: variants[0] })));
24
28
  export const MgBadge = Template.bind({});
25
29
  MgBadge.args = {
26
30
  value: '99',
@@ -28,8 +28,6 @@
28
28
  min-width: var(--mg-badge-size);
29
29
  box-sizing: border-box;
30
30
  border: 0.1rem solid;
31
- border-radius: 50%;
32
- /* IE FIX */
33
31
  border-radius: calc(var(--mg-badge-size) / 2);
34
32
  font-size: var(--mg-badge-font-size);
35
33
  font-weight: 600;
@@ -3,6 +3,11 @@ import { variants } from './mg-badge.conf';
3
3
  import { ClassList } from '../../../utils/components.utils';
4
4
  export class MgBadge {
5
5
  constructor() {
6
+ /************
7
+ * Internal *
8
+ ************/
9
+ // classes
10
+ this.classOutline = `mg-badge--outline`;
6
11
  /**
7
12
  * Define button variant
8
13
  */
@@ -17,15 +22,22 @@ export class MgBadge {
17
22
  throw new Error('<mg-badge> prop "value" must be interger or ponctuation character.');
18
23
  }
19
24
  }
20
- validateVariant(newValue) {
25
+ validateVariant(newValue, oldValue) {
21
26
  if (!variants.includes(newValue)) {
22
27
  throw new Error(`<mg-badge> prop "variant" must be one of : ${variants.join(', ')}.`);
23
28
  }
24
- this.classList.add(`mg-badge--${this.variant}`);
29
+ else {
30
+ if (oldValue !== undefined) {
31
+ this.classList.delete(`mg-badge--${oldValue}`);
32
+ }
33
+ this.classList.add(`mg-badge--${newValue}`);
34
+ }
25
35
  }
26
36
  validateOutline(newValue) {
27
37
  if (newValue)
28
- this.classList.add(`mg-badge--outline`);
38
+ this.classList.add(this.classOutline);
39
+ else
40
+ this.classList.delete(this.classOutline);
29
41
  }
30
42
  /**
31
43
  * Check if props are well configured on init
@@ -1,6 +1,7 @@
1
1
  import { h } from '@stencil/core';
2
- import { variants } from './mg-button.conf';
3
- import { icons } from '../mg-icon/mg-icon.conf';
2
+ import { variants, buttonTypes } from '../mg-button.conf';
3
+ import { icons } from '../../mg-icon/mg-icon.conf';
4
+ import { filterArgs } from '../../../../../.storybook/utils';
4
5
  export default {
5
6
  component: 'mg-button',
6
7
  title: 'Atoms/mg-button',
@@ -12,19 +13,20 @@ export default {
12
13
  defaultValue: { summary: variants[0] },
13
14
  },
14
15
  },
16
+ type: {
17
+ options: [undefined, ...buttonTypes],
18
+ control: { type: 'select' },
19
+ },
15
20
  },
16
21
  };
17
- const Template = args => {
18
- // Extract slot so it won't be render as an attribute
19
- const slot = args.slot;
20
- delete args.slot;
21
- const disableOnClick = args.disableOnClick;
22
- delete args.disableOnClick;
23
- const isIcon = args.isIcon;
24
- delete args.isIcon;
25
- // return element
26
- return (h("mg-button", Object.assign({}, args, { "disable-on-click": disableOnClick, "is-icon": isIcon }), slot));
27
- };
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) => h("mg-button", Object.assign({}, filterArgs(args, { variant: variants[0] })), args.slot);
28
30
  export const MgButton = Template.bind({});
29
31
  MgButton.args = {
30
32
  slot: 'Text button',
@@ -36,6 +38,7 @@ MgButton.args = {
36
38
  isIcon: false,
37
39
  expanded: false,
38
40
  controls: undefined,
41
+ type: undefined,
39
42
  };
40
43
  export const IsIcon = Template.bind({});
41
44
  IsIcon.args = Object.assign(Object.assign({}, MgButton.args), { isIcon: true, slot: h("mg-icon", { icon: Object.keys(icons)[0] }) });
@@ -2,3 +2,7 @@
2
2
  * List of all possibles variants
3
3
  */
4
4
  export const variants = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success'];
5
+ /**
6
+ * List of all possibles button types
7
+ */
8
+ export const buttonTypes = ['button', 'submit', 'reset'];
@@ -43,72 +43,48 @@
43
43
  line-height: var(--font-size);
44
44
  }
45
45
  .mg-button.mg-button--primary {
46
- border-color: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));
47
- /* IE FIX */
48
- border-color: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - 10%));
46
+ border-color: hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));
49
47
  color: hsl(var(--mg-button-primary-font-color));
50
- background: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));
51
- /* IE FIX */
52
48
  background: linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)));
53
49
  }
54
50
  .mg-button.mg-button--primary:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--primary:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--primary:active:not([disabled], [aria-disabled=true], .disabled) {
55
51
  background: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));
56
52
  }
57
53
  .mg-button.mg-button--secondary {
58
- border-color: hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));
59
- /* IE FIX */
60
- border-color: hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - 10%));
54
+ border-color: hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));
61
55
  color: hsl(var(--mg-button-secondary-font-color));
62
- background: hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));
63
- /* IE FIX */
64
56
  background: linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)));
65
57
  }
66
58
  .mg-button.mg-button--secondary:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--secondary:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--secondary:active:not([disabled], [aria-disabled=true], .disabled) {
67
59
  background: hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));
68
60
  }
69
61
  .mg-button.mg-button--danger {
70
- border-color: hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));
71
- /* IE FIX */
72
- border-color: hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - 10%));
62
+ border-color: hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));
73
63
  color: hsl(var(--color-neutral));
74
- background: hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));
75
- /* IE FIX */
76
64
  background: linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)));
77
65
  }
78
66
  .mg-button.mg-button--danger:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--danger:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--danger:active:not([disabled], [aria-disabled=true], .disabled) {
79
67
  background: hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));
80
68
  }
81
69
  .mg-button.mg-button--danger-alt {
82
- border-color: hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));
83
- /* IE FIX */
84
- border-color: hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - 10%));
70
+ border-color: hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));
85
71
  color: hsl(var(--color-danger));
86
- background: hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));
87
- /* IE FIX */
88
72
  background: linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)));
89
73
  }
90
74
  .mg-button.mg-button--danger-alt:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--danger-alt:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--danger-alt:active:not([disabled], [aria-disabled=true], .disabled) {
91
75
  background: hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));
92
76
  }
93
77
  .mg-button.mg-button--info {
94
- border-color: hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));
95
- /* IE FIX */
96
- border-color: hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - 10%));
78
+ border-color: hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));
97
79
  color: hsl(var(--color-neutral));
98
- background: hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));
99
- /* IE FIX */
100
80
  background: linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)));
101
81
  }
102
82
  .mg-button.mg-button--info:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--info:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--info:active:not([disabled], [aria-disabled=true], .disabled) {
103
83
  background: hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));
104
84
  }
105
85
  .mg-button.mg-button--success {
106
- border-color: hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l));
107
- /* IE FIX */
108
- border-color: hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - 10%));
86
+ border-color: hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));
109
87
  color: hsl(var(--color-dark));
110
- background: hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l));
111
- /* IE FIX */
112
88
  background: linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)));
113
89
  }
114
90
  .mg-button.mg-button--success:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--success:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--success:active:not([disabled], [aria-disabled=true], .disabled) {
@@ -16,10 +16,6 @@ export class MgButton {
16
16
  * If not set, it will be created.
17
17
  */
18
18
  this.identifier = createID('mg-button');
19
- /**
20
- * Disable button
21
- */
22
- this.disabled = false;
23
19
  /**
24
20
  * Define if button is round.
25
21
  * Used for icon button.
@@ -30,15 +26,6 @@ export class MgButton {
30
26
  * Parent component have to remove the attribute 'disabled' when the process ends.
31
27
  */
32
28
  this.disableOnClick = false;
33
- /**
34
- * Prop to set aria-expanded on button element
35
- */
36
- this.expanded = false;
37
- /**
38
- * Option to set aria-haspopup
39
- * The aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity.
40
- */
41
- this.haspopup = false;
42
29
  /**
43
30
  * Define if button is loading, default to false.
44
31
  * Trigger when button is clicked or key-up ['enter', 'space], then value change to true.
@@ -65,11 +52,16 @@ export class MgButton {
65
52
  }
66
53
  };
67
54
  }
68
- validateVariant(newValue) {
55
+ validateVariant(newValue, oldValue) {
69
56
  if (!variants.includes(newValue)) {
70
57
  throw new Error(`<mg-button> prop "variant" must be one of : ${variants.join(', ')}`);
71
58
  }
72
- this.classList.add(`mg-button--${this.variant}`);
59
+ else {
60
+ if (oldValue !== undefined) {
61
+ this.classList.delete(`mg-button--${oldValue}`);
62
+ }
63
+ this.classList.add(`mg-button--${newValue}`);
64
+ }
73
65
  }
74
66
  disabledHandler(isDisabled) {
75
67
  // Remove loading when enable
@@ -112,7 +104,10 @@ export class MgButton {
112
104
  * @returns {HTMLElement} html element
113
105
  */
114
106
  render() {
115
- return (h("button", { id: this.identifier, class: this.classList.join(), "aria-label": this.label, "aria-disabled": this.disabled.toString(), "aria-expanded": this.expanded, "aria-controls": this.controls, "aria-haspopup": this.haspopup, onClick: this.handleClick },
107
+ return (h("button", { id: this.identifier, class: this.classList.join(), type: this.type, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": this.controls, "aria-haspopup": this.haspopup !== undefined && this.haspopup.toString(), onClick: this.handleClick,
108
+ // has stencil does not support form attribute on button, we set the attribute from the ref
109
+ // https://github.com/ionic-team/stencil/issues/2703#issuecomment-1050943715
110
+ ref: btn => this.form && btn.setAttribute('form', this.form) },
116
111
  this.loading && h("mg-icon", { icon: "loader", spin: true }),
117
112
  h("div", { class: "mg-button__content" },
118
113
  h("slot", null))));
@@ -179,6 +174,45 @@ export class MgButton {
179
174
  "attribute": "label",
180
175
  "reflect": false
181
176
  },
177
+ "type": {
178
+ "type": "string",
179
+ "mutable": false,
180
+ "complexType": {
181
+ "original": "ButtonType",
182
+ "resolved": "\"button\" | \"reset\" | \"submit\"",
183
+ "references": {
184
+ "ButtonType": {
185
+ "location": "import",
186
+ "path": "./mg-button.conf"
187
+ }
188
+ }
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "Define button type\nDefault: 'submit', as HTMLButtonElement type is submit by default"
195
+ },
196
+ "attribute": "type",
197
+ "reflect": false
198
+ },
199
+ "form": {
200
+ "type": "string",
201
+ "mutable": true,
202
+ "complexType": {
203
+ "original": "string",
204
+ "resolved": "string",
205
+ "references": {}
206
+ },
207
+ "required": false,
208
+ "optional": false,
209
+ "docs": {
210
+ "tags": [],
211
+ "text": "Define form id to attach button with.\nIf this attribute is not set, the <button> is associated with its ancestor <form> element."
212
+ },
213
+ "attribute": "form",
214
+ "reflect": false
215
+ },
182
216
  "disabled": {
183
217
  "type": "boolean",
184
218
  "mutable": true,
@@ -194,8 +228,7 @@ export class MgButton {
194
228
  "text": "Disable button"
195
229
  },
196
230
  "attribute": "disabled",
197
- "reflect": false,
198
- "defaultValue": "false"
231
+ "reflect": false
199
232
  },
200
233
  "isIcon": {
201
234
  "type": "boolean",
@@ -248,8 +281,7 @@ export class MgButton {
248
281
  "text": "Prop to set aria-expanded on button element"
249
282
  },
250
283
  "attribute": "expanded",
251
- "reflect": false,
252
- "defaultValue": "false"
284
+ "reflect": false
253
285
  },
254
286
  "controls": {
255
287
  "type": "string",
@@ -283,8 +315,7 @@ export class MgButton {
283
315
  "text": "Option to set aria-haspopup\nThe aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity."
284
316
  },
285
317
  "attribute": "haspopup",
286
- "reflect": false,
287
- "defaultValue": "false"
318
+ "reflect": false
288
319
  }
289
320
  }; }
290
321
  static get states() { return {
@@ -0,0 +1,20 @@
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,33 +1,11 @@
1
- import { Component, h, Prop, Watch } from '@stencil/core';
2
- import { messages } from '../../../locales';
1
+ import { Component, Element, h, Prop, Watch } from '@stencil/core';
2
+ import { initLocales } from '../../../locales';
3
3
  export class MgCharacterLeft {
4
4
  constructor() {
5
- /************
6
- * Internal *
7
- ************/
8
- this.mustacheCounter = '{counter}';
9
- /**
10
- * Template to display remaining characters.
11
- * Must have {counter} inside
12
- */
13
- this.template = messages.nbCharLeft;
14
5
  /**
15
6
  * Sets the characters to count
16
7
  */
17
8
  this.characters = '';
18
- /**
19
- * Calculate number character left
20
- *
21
- * @returns {string} message
22
- */
23
- this.getMessage = () => {
24
- return this.template.replace(this.mustacheCounter, `<strong>${this.maxlength - this.characters.length}</strong>`);
25
- };
26
- }
27
- validateTemplate(newValue) {
28
- if (typeof newValue !== 'string' || newValue === '' || newValue.indexOf(this.mustacheCounter) === -1) {
29
- throw new Error(`<mg-character-left> prop "template" must contain "${this.mustacheCounter}".`);
30
- }
31
9
  }
32
10
  validateMaxlength(newValue) {
33
11
  if (typeof newValue !== 'number') {
@@ -43,8 +21,8 @@ export class MgCharacterLeft {
43
21
  * @returns {void}
44
22
  */
45
23
  componentWillLoad() {
46
- this.validateTemplate(this.template);
47
24
  this.validateMaxlength(this.maxlength);
25
+ this.messages = initLocales(this.element).messages;
48
26
  }
49
27
  /**
50
28
  * Render component
@@ -52,7 +30,12 @@ export class MgCharacterLeft {
52
30
  * @returns {HTMLElement} HTML Element
53
31
  */
54
32
  render() {
55
- return h("span", { id: this.identifier, innerHTML: this.getMessage(), "aria-live": "polite" });
33
+ return (h("span", { id: this.identifier, "aria-live": "polite" },
34
+ h("span", { "aria-hidden": "true" },
35
+ this.maxlength - this.characters.length,
36
+ "/",
37
+ this.maxlength),
38
+ h("span", { class: "sr-only" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
56
39
  }
57
40
  static get is() { return "mg-character-left"; }
58
41
  static get encapsulation() { return "scoped"; }
@@ -80,24 +63,6 @@ export class MgCharacterLeft {
80
63
  "attribute": "identifier",
81
64
  "reflect": false
82
65
  },
83
- "template": {
84
- "type": "string",
85
- "mutable": false,
86
- "complexType": {
87
- "original": "string",
88
- "resolved": "string",
89
- "references": {}
90
- },
91
- "required": false,
92
- "optional": false,
93
- "docs": {
94
- "tags": [],
95
- "text": "Template to display remaining characters.\nMust have {counter} inside"
96
- },
97
- "attribute": "template",
98
- "reflect": false,
99
- "defaultValue": "messages.nbCharLeft"
100
- },
101
66
  "characters": {
102
67
  "type": "string",
103
68
  "mutable": false,
@@ -134,10 +99,8 @@ export class MgCharacterLeft {
134
99
  "reflect": false
135
100
  }
136
101
  }; }
102
+ static get elementRef() { return "element"; }
137
103
  static get watchers() { return [{
138
- "propName": "template",
139
- "methodName": "validateTemplate"
140
- }, {
141
104
  "propName": "maxlength",
142
105
  "methodName": "validateMaxlength"
143
106
  }]; }