@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,7 +1,7 @@
1
- import { Component, Element, Host, h, Prop, Watch } from '@stencil/core';
2
- import { createID } from '../../../utils/components.utils';
1
+ import { Component, Element, Host, h, Prop, Watch, Event } from '@stencil/core';
2
+ import { createID, isTagName } from '../../../utils/components.utils';
3
3
  import { createPopper } from '@popperjs/core';
4
- import { messages } from '../../../locales';
4
+ import { initLocales } from '../../../locales';
5
5
  export class MgPopover {
6
6
  constructor() {
7
7
  this.closeButtonId = '';
@@ -66,7 +66,7 @@ export class MgPopover {
66
66
  this.popover.removeAttribute('data-show');
67
67
  // Disable the event listeners
68
68
  this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
69
- // Remove even listener
69
+ // Remove event listener
70
70
  document.removeEventListener('click', this.clickOutside, false);
71
71
  };
72
72
  /**
@@ -78,28 +78,37 @@ export class MgPopover {
78
78
  this.display = false;
79
79
  };
80
80
  }
81
- handleDisplay(newVal) {
82
- if (newVal) {
81
+ handleDisplay(newValue) {
82
+ if (newValue) {
83
83
  this.show();
84
84
  }
85
85
  else {
86
86
  this.hide();
87
87
  }
88
+ this.displayChange.emit(newValue);
88
89
  }
89
90
  /*************
90
91
  * Lifecycle *
91
92
  *************/
93
+ /**
94
+ * Check if component props are well configured on init
95
+ *
96
+ * @returns {void} timeout
97
+ */
98
+ componentWillLoad() {
99
+ // Get locales
100
+ this.messages = initLocales(this.element).messages;
101
+ }
92
102
  /**
93
103
  * Check if component props are well configured on init
94
104
  *
95
105
  * @returns {void}
96
106
  */
97
107
  componentDidLoad() {
98
- //Check if slotted title is a heading
99
- const headingElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
108
+ const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
100
109
  const slotedTitleElement = this.element.querySelector('[slot="title"]');
101
- if (slotedTitleElement !== null && !headingElements.includes(slotedTitleElement.tagName.toLowerCase())) {
102
- throw new Error(`<mg-popover> Slotted title must be a heading: ${headingElements.join(', ')}.`);
110
+ if (slotedTitleElement && !isTagName(slotedTitleElement, headingTags)) {
111
+ throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
103
112
  }
104
113
  // Set close button id
105
114
  if (this.closeButton) {
@@ -145,7 +154,7 @@ export class MgPopover {
145
154
  return (h(Host, null,
146
155
  h("slot", null),
147
156
  h("div", { id: this.identifier, class: "mg-popover" },
148
- !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.general.close, onClick: this.handleCloseButton },
157
+ !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton },
149
158
  h("mg-icon", { icon: "cross" }))),
150
159
  h("div", { class: "mg-popover__title" },
151
160
  h("slot", { name: "title" })),
@@ -183,9 +192,14 @@ export class MgPopover {
183
192
  "type": "string",
184
193
  "mutable": false,
185
194
  "complexType": {
186
- "original": "| 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end'",
195
+ "original": "Placement",
187
196
  "resolved": "\"auto\" | \"auto-end\" | \"auto-start\" | \"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
188
- "references": {}
197
+ "references": {
198
+ "Placement": {
199
+ "location": "import",
200
+ "path": "./mg-popover.conf"
201
+ }
202
+ }
189
203
  },
190
204
  "required": false,
191
205
  "optional": false,
@@ -252,6 +266,22 @@ export class MgPopover {
252
266
  "defaultValue": "false"
253
267
  }
254
268
  }; }
269
+ static get events() { return [{
270
+ "method": "displayChange",
271
+ "name": "display-change",
272
+ "bubbles": true,
273
+ "cancelable": true,
274
+ "composed": true,
275
+ "docs": {
276
+ "tags": [],
277
+ "text": "Emited event when display value change"
278
+ },
279
+ "complexType": {
280
+ "original": "boolean",
281
+ "resolved": "boolean",
282
+ "references": {}
283
+ }
284
+ }]; }
255
285
  static get elementRef() { return "element"; }
256
286
  static get watchers() { return [{
257
287
  "propName": "display",
@@ -1,5 +1,6 @@
1
1
  import { h } from '@stencil/core';
2
- import { sizes } from './mg-tabs.conf';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
3
+ import { sizes, Status } from '../mg-tabs.conf';
3
4
  export default {
4
5
  component: 'mg-tabs',
5
6
  title: 'Molecules/mg-tabs',
@@ -12,27 +13,26 @@ export default {
12
13
  parameters: { actions: { handles: ['active-tab-change'] } },
13
14
  };
14
15
  /**
15
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
16
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
16
+ * Template
17
+ *
18
+ * @param {any} args component arguments
19
+ * @returns {HTMLElement} HTMLElement
17
20
  */
18
- const Template = args => {
19
- // return element
20
- const activeTab = args.activeTab;
21
- delete args.activeTab;
22
- return (h("mg-tabs", Object.assign({}, args, { "active-tab": activeTab }),
23
- h("div", { slot: "tab_content-1" }, "Content 1"),
24
- h("div", { slot: "tab_content-2" }, "Content 2"),
25
- h("div", { slot: "tab_content-3" }, "Content 3")));
26
- };
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ const Template = (args) => (h("mg-tabs", Object.assign({}, filterArgs(args, { size: sizes[0], activeTab: 1 })),
23
+ h("div", { slot: "tab_content-1" }, "Content 1"),
24
+ h("div", { slot: "tab_content-2" }, "Content 2"),
25
+ h("div", { slot: "tab_content-3" }, "Content 3"),
26
+ h("div", { slot: "tab_content-4" }, "Content 4")));
27
27
  export const MgTabs = Template.bind({});
28
28
  MgTabs.args = {
29
- items: ['Tab 1', 'Tab 2', 'Tab 3'],
29
+ items: ['Tab 1', 'Tab 2', 'Tab 3', 'Tab 4'],
30
30
  label: 'Short tabs description. Needed for accessibility',
31
31
  activeTab: undefined,
32
32
  size: sizes[0], // regular
33
33
  };
34
34
  export const MgTabsItems = Template.bind({});
35
- MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { items: [
35
+ MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { activeTab: 3, items: [
36
36
  {
37
37
  label: 'Tab 1',
38
38
  icon: 'check',
@@ -41,10 +41,15 @@ MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { items: [
41
41
  {
42
42
  label: 'Tab 2',
43
43
  badge: { value: 5, label: 'messages' },
44
- disabled: true,
44
+ status: Status.DISABLED,
45
45
  },
46
46
  {
47
47
  label: 'Tab 3',
48
48
  icon: 'cross',
49
49
  },
50
+ {
51
+ label: 'Tab 4',
52
+ icon: 'trash',
53
+ status: Status.HIDDEN,
54
+ },
50
55
  ] });
@@ -1,3 +1,10 @@
1
+ export var Status;
2
+ (function (Status) {
3
+ Status["VISIBLE"] = "visible";
4
+ Status["HIDDEN"] = "hidden";
5
+ Status["DISABLED"] = "disabled";
6
+ Status["ACTIVE"] = "active";
7
+ })(Status || (Status = {}));
1
8
  /**
2
9
  * List of all possibles sizes
3
10
  */
@@ -35,6 +35,9 @@
35
35
  border-bottom-color: hsl(var(--color-info));
36
36
  font-weight: 700;
37
37
  }
38
+ .mg-tabs__navigation-button.mg-tabs__navigation-button--hidden {
39
+ display: none;
40
+ }
38
41
 
39
42
  .mg-tabs__content-container:focus-visible {
40
43
  outline: none;
@@ -1,6 +1,6 @@
1
- import { Component, Event, h, Host, Prop, State, Element, Watch } from '@stencil/core';
1
+ import { Component, Event, h, Prop, State, Element, Watch } from '@stencil/core';
2
2
  import { createID, ClassList, allItemsAreString } from '../../../utils/components.utils';
3
- import { sizes } from './mg-tabs.conf';
3
+ import { sizes, Status } from './mg-tabs.conf';
4
4
  /**
5
5
  * type TabItem validation function
6
6
  *
@@ -10,6 +10,12 @@ import { sizes } from './mg-tabs.conf';
10
10
  const isTabItem = (tab) => typeof tab === 'object' && typeof tab.label === 'string';
11
11
  export class MgTabs {
12
12
  constructor() {
13
+ /************
14
+ * Internal *
15
+ ************/
16
+ this.tabPanel = 'panel';
17
+ this.startIndex = 1;
18
+ this.buttonTabBaseClass = 'mg-tabs__navigation-button';
13
19
  /**
14
20
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
15
21
  * If not set, it will be created.
@@ -32,6 +38,46 @@ export class MgTabs {
32
38
  * Component classes
33
39
  */
34
40
  this.classList = new ClassList(['mg-tabs']);
41
+ /**
42
+ * Method to set active tab
43
+ *
44
+ * @param {number} tabKey item tab key to set to ACTIVE status
45
+ * @returns {void}
46
+ */
47
+ this.setActiveTab = (tabKey) => {
48
+ // reset active tabs
49
+ this.tabs.forEach(tab => {
50
+ if (this.tabHasGivenStatus(tab, Status.ACTIVE))
51
+ tab.status = Status.VISIBLE;
52
+ });
53
+ // set active tab from given tab key
54
+ this.tabs[tabKey - this.startIndex].status = Status.ACTIVE;
55
+ // emit change active tab key event
56
+ this.activeTabChange.emit(tabKey);
57
+ };
58
+ /**
59
+ * Method to know if given tab has the given status
60
+ *
61
+ * @param {TabItem} tab item tab key to set to ACTIVE status
62
+ * @param {Status} status status to valide
63
+ * @returns {boolean} status comparaison
64
+ */
65
+ this.tabHasGivenStatus = (tab, status) => tab.status === status;
66
+ /**
67
+ * Method to get element id from index
68
+ *
69
+ * @param {string} element to get id
70
+ * @param {number} index to generate id
71
+ * @returns {string} generated element id
72
+ */
73
+ this.getElementId = (element, index) => `${element}-${this.getTabIndex(index)}`;
74
+ /**
75
+ * Method to get tab index
76
+ *
77
+ * @param {number} index to get
78
+ * @returns {number} index
79
+ */
80
+ this.getTabIndex = (index) => index + this.startIndex;
35
81
  /**
36
82
  * Handle click events on tabs
37
83
  *
@@ -41,6 +87,14 @@ export class MgTabs {
41
87
  const tabId = event.currentTarget.getAttribute('data-index');
42
88
  this.activeTab = Number(tabId);
43
89
  };
90
+ /**
91
+ * get navigation button class from given status
92
+ *
93
+ * @param {Status} status button tab status
94
+ * @param {boolean} isSelector set if we need a CSS selector with the dot '.' at the begin. default value = false.
95
+ * @returns {string} button class/selector variant
96
+ */
97
+ this.getNavigationButtonClass = (status, isSelector = false) => `${isSelector ? '.' : ''}${this.buttonTabBaseClass}--${status}`;
44
98
  /**
45
99
  * Handle keyboard event on tabs
46
100
  *
@@ -51,16 +105,14 @@ export class MgTabs {
51
105
  let tabId = Number(event.target.getAttribute('data-index'));
52
106
  const parent = event.target.parentElement;
53
107
  // change selected id from key code
54
- // /* IE FIX */ delete 'Right'
55
- if (['ArrowRight', 'Right'].includes(event.key)) {
108
+ if (event.key === 'ArrowRight') {
56
109
  tabId++;
57
- // /* IE FIX */ delete 'Left'
58
110
  }
59
- else if (['ArrowLeft', 'Left'].includes(event.key)) {
111
+ else if (event.key === 'ArrowLeft') {
60
112
  tabId--;
61
113
  }
62
- // get selected tab
63
- const selectedTab = parent.querySelector(`[data-index="${tabId}"]`);
114
+ // get selected tab if NOT hidden, disabled
115
+ const selectedTab = parent.querySelector(`[data-index="${tabId}"]:not(${[this.getNavigationButtonClass(Status.HIDDEN, true), this.getNavigationButtonClass(Status.DISABLED, true)].join()})`);
64
116
  // apply selected tab if exist
65
117
  if (selectedTab !== null) {
66
118
  selectedTab.focus();
@@ -86,7 +138,7 @@ export class MgTabs {
86
138
  validateItems(newValue) {
87
139
  // String array
88
140
  if (allItemsAreString(newValue)) {
89
- this.tabs = newValue.map(item => ({ label: item, disabled: false }));
141
+ this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
90
142
  }
91
143
  // Object array
92
144
  else if (newValue && newValue.every(item => isTabItem(item))) {
@@ -101,7 +153,7 @@ export class MgTabs {
101
153
  throw new Error('<mg-tabs> prop "activeTab" must be between 1 and tabs length.');
102
154
  }
103
155
  else {
104
- this.activeTabChange.emit(newValue);
156
+ this.setActiveTab(newValue);
105
157
  }
106
158
  }
107
159
  /*************
@@ -125,27 +177,21 @@ export class MgTabs {
125
177
  * @returns {HTMLElement} HTML Element
126
178
  */
127
179
  render() {
128
- return (h(Host, null,
129
- h("div", { class: this.classList.join() },
130
- h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => {
131
- const tabIndex = index + 1;
132
- return (h("button", { role: "tab", id: `${this.identifier}-${tabIndex}`, class: {
133
- 'mg-tabs__navigation-button': true,
134
- 'mg-tabs__navigation-button--active': tabIndex === this.activeTab,
135
- 'mg-tabs__navigation-button--disabled': tab.disabled,
136
- }, tabindex: tabIndex === this.activeTab ? 0 : -1, "aria-selected": (tabIndex === this.activeTab).toString(), "aria-controls": `pannel-${tabIndex}`, onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": tabIndex, disabled: tab.disabled },
137
- tab.icon !== undefined && h("mg-icon", { icon: tab.icon }),
138
- tab.label,
139
- tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label })));
140
- })),
141
- this.tabs.map((_tab, index) => {
142
- const tabIndex = index + 1;
143
- return (h("article", { role: "tabpanel", id: `pannel-${tabIndex}`, hidden: tabIndex !== this.activeTab, "aria-labelledby": `${this.identifier}-${this.activeTab}`, tabindex: tabIndex === this.activeTab ? 0 : -1, class: "mg-tabs__content-container" },
144
- h("slot", { name: `tab_content-${tabIndex}` })));
145
- }))));
180
+ return (h("div", { class: this.classList.join() },
181
+ h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { role: "tab", id: this.getElementId(this.identifier, index), class: {
182
+ [`${this.buttonTabBaseClass}`]: true,
183
+ [`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasGivenStatus(tab, Status.ACTIVE),
184
+ [`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasGivenStatus(tab, Status.DISABLED),
185
+ [`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasGivenStatus(tab, Status.HIDDEN),
186
+ }, tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasGivenStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabIndex(index), disabled: this.tabHasGivenStatus(tab, Status.DISABLED) },
187
+ tab.icon !== undefined && h("mg-icon", { icon: tab.icon }),
188
+ tab.label,
189
+ tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label }))))),
190
+ this.tabs.map((tab, index) => (h("article", { role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasGivenStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" },
191
+ h("slot", { name: this.getElementId('tab_content', index) }))))));
146
192
  }
147
193
  static get is() { return "mg-tabs"; }
148
- static get encapsulation() { return "scoped"; }
194
+ static get encapsulation() { return "shadow"; }
149
195
  static get originalStyleUrls() { return {
150
196
  "$": ["mg-tabs.scss"]
151
197
  }; }
@@ -1,4 +1,33 @@
1
- export const locale = 'fr-FR';
2
- import fr from './fr-FR/messages.json';
3
- export const messages = fr;
4
- export const currency = 'EUR';
1
+ import en from './en/messages.json';
2
+ import fr from './fr/messages.json';
3
+ const defaultLocale = 'en';
4
+ const messages = { en, fr };
5
+ /**
6
+ * Get locale
7
+ *
8
+ * @param {HTMLElement} element element that needs to know the locale to use
9
+ * @returns {string} locale
10
+ */
11
+ const getLocale = (element) => {
12
+ var _a;
13
+ return ((_a = element.closest('[lang]')) === null || _a === void 0 ? void 0 : _a.lang) || navigator.language || defaultLocale;
14
+ };
15
+ /**
16
+ * Get Intl object
17
+ * We load the defined locale but for now we only support the first subtag for messages
18
+ *
19
+ * @param {HTMLElement} element element we need to get the language
20
+ * @returns {{ locale: string; messages: unknown }} messages object
21
+ */
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ export const initLocales = (element) => {
24
+ // Get local
25
+ const locale = getLocale(element);
26
+ // Only keep first subtag
27
+ const localeSubtag = locale.split('-').shift();
28
+ // Return
29
+ return {
30
+ locale,
31
+ messages: messages[localeSubtag] || messages[defaultLocale],
32
+ };
33
+ };
@@ -0,0 +1,41 @@
1
+ import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../.storybook/utils';
3
+ export default {
4
+ title: 'Style/Helpers',
5
+ argTypes: {
6
+ align: {
7
+ options: ['left', 'right'],
8
+ control: { type: 'select' },
9
+ },
10
+ },
11
+ };
12
+ /**
13
+ * Template
14
+ *
15
+ * @param {any} args component arguments
16
+ * @returns {HTMLElement} HTMLElement
17
+ */
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ const Template = (args) => (h("div", null,
20
+ h("h1", null, "Helpers"),
21
+ h("h2", null, ".mg-group-elements"),
22
+ h("p", null,
23
+ "Buttons can be grouped in an HTMLelement using the ",
24
+ h("code", null, ".mg-group-elements"),
25
+ " class, it will ensure a 10px margin space between them, even verticaly. Above exemples are using it."),
26
+ h("p", null,
27
+ "By adding the ",
28
+ h("code", null, ".mg-group-elements--align-right"),
29
+ " class you 'll set a right alignment of the button, even when line breaks."),
30
+ h("h3", null, "Demo"),
31
+ h("div", { class: `mg-group-elements${args.align === 'right' ? ' mg-group-elements--align-right' : ''}` },
32
+ h("mg-button", null, "First Button"),
33
+ h("mg-button", null,
34
+ h("mg-icon", { icon: "info-circle" }),
35
+ "Second Button"),
36
+ h("mg-button", Object.assign({}, filterArgs({ isIcon: true }), { label: "Third button" }),
37
+ h("mg-icon", { icon: "info-circle" })))));
38
+ export const Helpers = Template.bind({});
39
+ Helpers.args = {
40
+ align: 'left',
41
+ };
@@ -1,4 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../.storybook/utils';
2
3
  import { icons, sizes } from '../components/atoms/mg-icon/mg-icon.conf';
3
4
  export default {
4
5
  title: 'Style/Icons',
@@ -9,9 +10,16 @@ export default {
9
10
  },
10
11
  },
11
12
  };
12
- const Template = args => (h("ul", { style: { display: 'flex', flexWrap: 'wrap', margin: '0', padding: '0', listStyle: 'none', textAlign: 'center' } }, Object.keys(icons).map((icon) => (h("li", { style: { margin: '1rem', padding: '1rem', width: '100px' } },
13
+ /**
14
+ * Template
15
+ *
16
+ * @param {any} args component arguments
17
+ * @returns {HTMLElement} HTMLElement
18
+ */
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ const Template = (args) => (h("ul", { style: { display: 'flex', flexWrap: 'wrap', margin: '0', padding: '0', listStyle: 'none', textAlign: 'center' } }, Object.keys(icons).map((icon) => (h("li", { style: { margin: '1rem', padding: '1rem', width: '100px' } },
13
21
  h("div", { style: { color: args.color, margin: '1rem' } },
14
- h("mg-icon", { icon: icon, size: args.size })),
22
+ h("mg-icon", Object.assign({}, filterArgs({ icon, size: args.size }, { size: 'regular' })))),
15
23
  h("div", null, icon))))));
16
24
  export const Icons = Template.bind({});
17
25
  Icons.args = {
@@ -2,7 +2,14 @@ import { h } from '@stencil/core';
2
2
  export default {
3
3
  title: 'Style/Typography',
4
4
  };
5
- const Template = args => (h("div", null,
5
+ /**
6
+ * Template
7
+ *
8
+ * @param {any} args component arguments
9
+ * @returns {HTMLElement} HTMLElement
10
+ */
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ const Template = (args) => (h("div", null,
6
13
  h("h1", null, args.h1),
7
14
  h("h2", null, args.h2),
8
15
  h("h3", null, args.h3),
@@ -72,3 +72,13 @@ export class ClassList {
72
72
  export function allItemsAreString(items) {
73
73
  return items && items.every(item => typeof item === 'string');
74
74
  }
75
+ /**
76
+ * Check if element is a heading
77
+ *
78
+ * @param {Element} element slotted element
79
+ * @param {string[]} tagNames allowed tag names list
80
+ * @returns {boolean} element is a heading
81
+ */
82
+ export function isTagName(element, tagNames) {
83
+ return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
84
+ }
@@ -1,20 +1,22 @@
1
- import { locale, currency } from '../locales';
2
1
  /**
3
2
  * Format number to the locale currency
4
3
  *
5
4
  * @param {number} number number to format
5
+ * @param {string} locale locale to apply
6
+ * @param {string} currency currency to apply
6
7
  * @returns {string} formatted currency
7
8
  */
8
- export function localeCurrency(number) {
9
+ export function localeCurrency(number, locale, currency) {
9
10
  return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);
10
11
  }
11
12
  /**
12
13
  * Format number to locale
13
14
  *
14
15
  * @param {number} number number to format
16
+ * @param {string} locale locale to apply
15
17
  * @returns {string} formatted number
16
18
  */
17
- export function localeNumber(number) {
19
+ export function localeNumber(number, locale) {
18
20
  return new Intl.NumberFormat(locale).format(number);
19
21
  }
20
22
  /**
@@ -25,9 +27,10 @@ export const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
25
27
  * Locale date format
26
28
  *
27
29
  * @param {string} date date to format
30
+ * @param {string} locale locale to apply
28
31
  * @returns {string} formatted date
29
32
  */
30
- export function localeDate(date) {
33
+ export function localeDate(date, locale) {
31
34
  if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {
32
35
  return '';
33
36
  }
@@ -53,11 +53,11 @@
53
53
  --color-info: var(--color-info-h), var(--color-info-s), var(--color-info-l);
54
54
 
55
55
  /* Danger */
56
- /* #df242c; */
57
- /* rgb(223, 36, 44); */
56
+ /* #db1f29; */
57
+ /* rgb(219, 31, 41); */
58
58
  --color-danger-h: 357;
59
- --color-danger-s: 74.5%;
60
- --color-danger-l: 50.8%;
59
+ --color-danger-s: 75%;
60
+ --color-danger-l: 49%;
61
61
  --color-danger: var(--color-danger-h), var(--color-danger-s), var(--color-danger-l);
62
62
 
63
63
  /* Dark */
@@ -99,6 +99,7 @@
99
99
  /*
100
100
  <mg-icon>
101
101
  */
102
+ --mg-icon-small-size: 1.2rem;
102
103
  --mg-icon-regular-size: 1.6rem;
103
104
  --mg-icon-large-size: 2.4rem;
104
105
  --mg-icon-extra-large-size: 3.6rem;
@@ -111,6 +112,7 @@
111
112
  --mg-button-icon-border-radius: var(--default-size);
112
113
  --mg-button-disabled-opacity: 0.6;
113
114
  --mg-button-gradient: 1; /* Can only be 1 or 0 to enable disable gradient */
115
+ --mg-button-border-variation: 1; /* Can only be 1 or 0 to enable disable border variation */
114
116
 
115
117
  /* Primary */
116
118
  --mg-button-primary-color-h: var(--color-dark-h);
@@ -161,7 +163,7 @@
161
163
  */
162
164
  --mg-modal-border-radius: 0.5rem;
163
165
  --mg-modal-title-font-size: 1.8rem;
164
- --mg-modal-content-font-size: 1.3rem;
166
+ --mg-modal-content-font-size: 1.2rem;
165
167
 
166
168
  /*
167
169
  <mg-panel>
@@ -187,6 +189,9 @@
187
189
  --mg-inputs-color: #b5c2c9;
188
190
  --mg-inputs-spacer: 1rem;
189
191
 
192
+ /* Error message background */
193
+ --mg-inputs-error-bg-color: var(--color-danger-h), calc(var(--color-danger-s) + 5%), calc(var(--color-danger-l) + 49%);
194
+
190
195
  /* Input focus shadow */
191
196
  /* #b5c2c9 */
192
197
  /* rgb(0, 221, 255); */
@@ -53,11 +53,11 @@
53
53
  --color-info: var(--color-info-h), var(--color-info-s), var(--color-info-l);
54
54
 
55
55
  /* Danger */
56
- /* #df242c; */
57
- /* rgb(223, 36, 44); */
56
+ /* #db1f29; */
57
+ /* rgb(219, 31, 41); */
58
58
  --color-danger-h: 357;
59
- --color-danger-s: 74.5%;
60
- --color-danger-l: 50.8%;
59
+ --color-danger-s: 75%;
60
+ --color-danger-l: 49%;
61
61
  --color-danger: var(--color-danger-h), var(--color-danger-s), var(--color-danger-l);
62
62
 
63
63
  /* Dark */
@@ -99,6 +99,7 @@
99
99
  /*
100
100
  <mg-icon>
101
101
  */
102
+ --mg-icon-small-size: 1.2rem;
102
103
  --mg-icon-regular-size: 1.6rem;
103
104
  --mg-icon-large-size: 2.4rem;
104
105
  --mg-icon-extra-large-size: 3.6rem;
@@ -111,6 +112,7 @@
111
112
  --mg-button-icon-border-radius: var(--default-size);
112
113
  --mg-button-disabled-opacity: 0.6;
113
114
  --mg-button-gradient: 1; /* Can only be 1 or 0 to enable disable gradient */
115
+ --mg-button-border-variation: 1; /* Can only be 1 or 0 to enable disable border variation */
114
116
 
115
117
  /* Primary */
116
118
  --mg-button-primary-color-h: var(--color-dark-h);
@@ -161,7 +163,7 @@
161
163
  */
162
164
  --mg-modal-border-radius: 0.5rem;
163
165
  --mg-modal-title-font-size: 1.8rem;
164
- --mg-modal-content-font-size: 1.3rem;
166
+ --mg-modal-content-font-size: 1.2rem;
165
167
 
166
168
  /*
167
169
  <mg-panel>
@@ -187,6 +189,9 @@
187
189
  --mg-inputs-color: #b5c2c9;
188
190
  --mg-inputs-spacer: 1rem;
189
191
 
192
+ /* Error message background */
193
+ --mg-inputs-error-bg-color: var(--color-danger-h), calc(var(--color-danger-s) + 5%), calc(var(--color-danger-l) + 49%);
194
+
190
195
  /* Input focus shadow */
191
196
  /* #b5c2c9 */
192
197
  /* rgb(0, 221, 255); */