@mgdis/mg-components 3.1.0 → 4.0.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 (241) hide show
  1. package/dist/cjs/{index-85a4a0b6.js → index-88560a66.js} +123 -48
  2. package/dist/cjs/index-a39c5567.js +233 -0
  3. package/dist/cjs/loader.cjs.js +3 -17
  4. package/dist/cjs/mg-badge_21.cjs.entry.js +3538 -0
  5. package/dist/cjs/mg-components.cjs.js +3 -7
  6. package/dist/cjs/mg-modal.cjs.entry.js +117 -0
  7. package/dist/cjs/mg-popover.cjs.entry.js +170 -0
  8. package/dist/cjs/popper-71bf3058.js +1790 -0
  9. package/dist/collection/collection-manifest.json +4 -1
  10. package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +4 -1
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
  12. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
  13. package/dist/collection/components/atoms/mg-badge/mg-badge.js +26 -10
  14. package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +7 -2
  15. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
  16. package/dist/collection/components/atoms/mg-button/mg-button.css +46 -49
  17. package/dist/collection/components/atoms/mg-button/mg-button.js +78 -4
  18. package/dist/collection/components/atoms/mg-character-left/{mg-character-left.stories.js → doc/mg-character-left.stories.js} +8 -0
  19. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +20 -46
  20. package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +1 -1
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +104 -9
  22. package/dist/collection/components/atoms/mg-icon/mg-icon.css +9 -7
  23. package/dist/collection/components/atoms/mg-icon/mg-icon.js +33 -7
  24. package/dist/collection/components/atoms/mg-input-title/{mg-input-title.stories.js → doc/mg-input-title.stories.js} +0 -0
  25. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +4 -4
  26. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +14 -3
  27. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +4 -1
  28. package/dist/collection/components/atoms/mg-tag/mg-tag.js +28 -6
  29. package/dist/collection/components/atoms/mg-tooltip/{mg-tooltip.stories.js → doc/mg-tooltip.stories.js} +14 -1
  30. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +20 -0
  31. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +16 -2
  32. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
  33. package/dist/collection/components/molecules/inputs/MgInput.js +25 -29
  34. package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +6 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +25 -11
  36. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +102 -52
  37. package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +6 -1
  38. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +37 -9
  39. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +136 -66
  40. package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +15 -3
  41. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +38 -10
  42. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +180 -80
  43. package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +16 -2
  44. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +37 -9
  45. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +108 -47
  46. package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +6 -1
  47. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +25 -11
  48. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +113 -42
  49. package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +22 -2
  50. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +39 -10
  51. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +145 -71
  52. package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +17 -8
  53. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +69 -19
  54. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +184 -83
  55. package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +16 -5
  56. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +69 -13
  57. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +163 -70
  58. package/dist/collection/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.js → doc/mg-input-toggle.stories.js} +6 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +22 -10
  60. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +68 -33
  61. package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +58 -0
  62. package/dist/collection/components/molecules/mg-form/mg-form.css +19 -0
  63. package/dist/collection/components/molecules/mg-form/mg-form.js +271 -0
  64. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +6 -2
  65. package/dist/collection/components/molecules/mg-message/mg-message.css +1 -1
  66. package/dist/collection/components/molecules/mg-message/mg-message.js +26 -11
  67. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +51 -0
  68. package/dist/collection/components/molecules/mg-modal/mg-modal.css +52 -0
  69. package/dist/collection/components/molecules/mg-modal/mg-modal.js +240 -0
  70. package/dist/collection/components/molecules/mg-pagination/{mg-pagination.stories.js → doc/mg-pagination.stories.js} +1 -0
  71. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +47 -28
  72. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +39 -0
  73. package/dist/collection/components/molecules/mg-panel/mg-panel.css +53 -0
  74. package/dist/collection/components/molecules/mg-panel/mg-panel.js +356 -0
  75. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +10 -0
  76. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  77. package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
  78. package/dist/collection/components/molecules/mg-popover/mg-popover.js +37 -12
  79. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +20 -4
  80. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +11 -1
  81. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +17 -3
  82. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +139 -26
  83. package/dist/collection/locales/index.js +33 -4
  84. package/dist/collection/stories/helpers.stories.js +33 -0
  85. package/dist/collection/utils/components.utils.js +16 -9
  86. package/dist/collection/utils/locale.utils.js +13 -7
  87. package/dist/collection/utils/test.utils.js +27 -15
  88. package/dist/collection/variables.css +39 -5
  89. package/dist/collection/variables.scss +39 -5
  90. package/dist/components/MgInput.js +26 -37
  91. package/dist/components/components.utils.js +16 -9
  92. package/dist/components/index.d.ts +24 -6
  93. package/dist/components/index.js +23 -0
  94. package/dist/components/index2.js +116 -17
  95. package/dist/components/locale.utils.js +13 -8
  96. package/dist/components/mg-badge2.js +25 -9
  97. package/dist/components/mg-button2.js +29 -5
  98. package/dist/components/mg-character-left2.js +14 -26
  99. package/dist/components/mg-form.d.ts +11 -0
  100. package/dist/components/mg-form.js +148 -0
  101. package/dist/components/mg-icon2.js +138 -17
  102. package/dist/components/mg-input-checkbox.js +66 -53
  103. package/dist/components/mg-input-date.js +100 -69
  104. package/dist/components/mg-input-numeric.js +125 -81
  105. package/dist/components/mg-input-password.js +69 -48
  106. package/dist/components/mg-input-radio.js +74 -46
  107. package/dist/components/mg-input-select2.js +103 -71
  108. package/dist/components/mg-input-text.js +1 -237
  109. package/dist/components/mg-input-text2.js +300 -0
  110. package/dist/components/mg-input-textarea.js +100 -46
  111. package/dist/components/mg-input-title2.js +13 -4
  112. package/dist/components/mg-input-toggle.js +39 -31
  113. package/dist/components/mg-message.js +25 -10
  114. package/dist/components/mg-modal.d.ts +11 -0
  115. package/dist/components/mg-modal.js +153 -0
  116. package/dist/components/mg-pagination.js +45 -31
  117. package/dist/components/mg-panel.d.ts +11 -0
  118. package/dist/components/mg-panel.js +244 -0
  119. package/dist/components/mg-popover.js +31 -11
  120. package/dist/components/mg-tabs.js +113 -23
  121. package/dist/components/mg-tag.js +27 -5
  122. package/dist/components/mg-tooltip2.js +10 -1
  123. package/dist/components/popper.js +6 -2
  124. package/dist/esm/{index-e3e84606.js → index-bca81100.js} +124 -46
  125. package/dist/esm/index-e51ae032.js +228 -0
  126. package/dist/esm/loader.js +3 -17
  127. package/dist/esm/mg-badge_21.entry.js +3514 -0
  128. package/dist/esm/mg-components.js +3 -7
  129. package/dist/esm/mg-modal.entry.js +113 -0
  130. package/dist/esm/mg-popover.entry.js +166 -0
  131. package/dist/esm/polyfills/css-shim.js +1 -1
  132. package/dist/esm/popper-93ecb064.js +1788 -0
  133. package/dist/index.js +1 -1
  134. package/dist/mg-components/mg-components.css +1 -1
  135. package/dist/mg-components/mg-components.esm.js +1 -1
  136. package/dist/mg-components/p-003a1344.entry.js +1 -0
  137. package/dist/mg-components/p-462d648a.entry.js +1 -0
  138. package/dist/mg-components/p-4c66f794.js +1 -0
  139. package/dist/mg-components/p-5126ab10.entry.js +1 -0
  140. package/dist/mg-components/p-780bd52d.js +1 -0
  141. package/dist/mg-components/p-b14a3443.js +2 -0
  142. package/dist/mg-components/variables.css +39 -5
  143. package/dist/mg-components/variables.scss +39 -5
  144. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +5 -0
  145. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +16 -5
  146. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +5 -0
  147. package/dist/types/components/atoms/mg-button/mg-button.d.ts +23 -3
  148. package/dist/types/components/atoms/mg-character-left/{mg-character-left.stories.d.ts → doc/mg-character-left.stories.d.ts} +9 -0
  149. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +16 -13
  150. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  151. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +1 -1
  152. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +14 -4
  153. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  154. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +11 -1
  155. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +5 -0
  156. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +18 -4
  157. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +29 -0
  158. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +8 -0
  159. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +13 -3
  160. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +6 -4
  161. package/dist/types/components/molecules/inputs/MgInput.d.ts +7 -8
  162. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +5 -0
  163. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +36 -13
  164. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +5 -0
  165. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +46 -15
  166. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +11 -0
  167. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +61 -16
  168. package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +22 -0
  169. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +35 -11
  170. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +5 -0
  171. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
  172. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +42 -9
  173. package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +34 -0
  174. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +1 -1
  175. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +37 -9
  176. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +13 -0
  177. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +52 -16
  178. package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +19 -0
  179. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +45 -17
  180. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +5 -0
  181. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +1 -1
  182. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +29 -12
  183. package/dist/types/components/molecules/{mg-popover/mg-popover.stories.d.ts → mg-form/doc/mg-form.stories.d.ts} +3 -4
  184. package/dist/types/components/molecules/mg-form/mg-form.d.ts +83 -0
  185. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +10 -0
  186. package/dist/types/components/molecules/mg-message/mg-message.d.ts +13 -4
  187. package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +13 -0
  188. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +85 -0
  189. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +5 -0
  190. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +31 -7
  191. package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +11 -0
  192. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +139 -0
  193. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +25 -0
  194. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  195. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +27 -4
  196. package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +20 -0
  197. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +11 -0
  198. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +70 -6
  199. package/dist/types/components.d.ts +528 -211
  200. package/dist/types/locales/index.d.ts +108 -38
  201. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  202. package/dist/types/utils/components.utils.d.ts +16 -9
  203. package/dist/types/utils/locale.utils.d.ts +13 -6
  204. package/dist/types/utils/test.utils.d.ts +13 -1
  205. package/loader/index.js +1 -1
  206. package/package.json +45 -14
  207. package/readme.md +9 -35
  208. package/dist/cjs/css-shim-a22512c4.js +0 -6
  209. package/dist/cjs/mg-badge_20.cjs.entry.js +0 -4661
  210. package/dist/cjs/shadow-css-8940f82d.js +0 -390
  211. package/dist/collection/stories/buttons.stories.js +0 -43
  212. package/dist/collection/stories/messages.stories.js +0 -44
  213. package/dist/collection/stories/tags.stories.js +0 -13
  214. package/dist/esm/css-shim-7c240feb.js +0 -4
  215. package/dist/esm/mg-badge_20.entry.js +0 -4638
  216. package/dist/esm/shadow-css-5d2d01ce.js +0 -388
  217. package/dist/esm-es5/css-shim-7c240feb.js +0 -1
  218. package/dist/esm-es5/index-e3e84606.js +0 -1
  219. package/dist/esm-es5/index.js +0 -0
  220. package/dist/esm-es5/loader.js +0 -1
  221. package/dist/esm-es5/mg-badge_20.entry.js +0 -2
  222. package/dist/esm-es5/mg-components.js +0 -1
  223. package/dist/esm-es5/shadow-css-5d2d01ce.js +0 -12
  224. package/dist/mg-components/mg-components.js +0 -132
  225. package/dist/mg-components/p-1cd24462.system.js +0 -1
  226. package/dist/mg-components/p-2e2f6b27.system.entry.js +0 -2
  227. package/dist/mg-components/p-366a224e.js +0 -1
  228. package/dist/mg-components/p-422c429b.system.js +0 -1
  229. package/dist/mg-components/p-50ea2036.system.js +0 -1
  230. package/dist/mg-components/p-62fa3797.js +0 -1
  231. package/dist/mg-components/p-71d57b8b.system.js +0 -13
  232. package/dist/mg-components/p-9a215712.system.js +0 -1
  233. package/dist/mg-components/p-cbf0464b.entry.js +0 -1
  234. package/dist/mg-components/p-f6455ab3.js +0 -12
  235. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  236. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.stories.d.ts +0 -9
  237. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.stories.d.ts +0 -14
  238. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.d.ts +0 -6
  239. package/dist/types/components/molecules/mg-tabs/mg-tabs.stories.d.ts +0 -7
  240. package/dist/types/stories/messages.stories.d.ts +0 -13
  241. package/dist/types/stories/tags.stories.d.ts +0 -5
@@ -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 */
@@ -76,6 +76,21 @@
76
76
  --color-light-l: 100%;
77
77
  --color-light: var(--color-light-h), var(--color-light-s), var(--color-light-l);
78
78
 
79
+ /* Primary */
80
+ --color-primary-h: hsl(var(--color-dark-h));
81
+ --color-primary-s: hsl(var(--color-dark-s));
82
+ --color-primary-l: hsl(var(--color-dark-l));
83
+ --color-primary: hsl(var(--color-dark));
84
+
85
+ /* Secondary */
86
+ --color-secondary-h: hsl(var(--color-neutral-h));
87
+ --color-secondary-s: hsl(var(--color-neutral-s));
88
+ --color-secondary-l: hsl(var(--color-neutral-l));
89
+ --color-secondary: hsl(var(--color-neutral));
90
+
91
+ /* Shadow */
92
+ --box-shadow: 0 0.3rem 0.8rem 0 rgba(0, 0, 0, 0.1);
93
+
79
94
  /*
80
95
  Global
81
96
  */
@@ -84,6 +99,7 @@
84
99
  /*
85
100
  <mg-icon>
86
101
  */
102
+ --mg-icon-small-size: 1.2rem;
87
103
  --mg-icon-regular-size: 1.6rem;
88
104
  --mg-icon-large-size: 2.4rem;
89
105
  --mg-icon-extra-large-size: 3.6rem;
@@ -95,6 +111,8 @@
95
111
  --mg-button-border-radius: 0.3rem;
96
112
  --mg-button-icon-border-radius: var(--default-size);
97
113
  --mg-button-disabled-opacity: 0.6;
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 */
98
116
 
99
117
  /* Primary */
100
118
  --mg-button-primary-color-h: var(--color-dark-h);
@@ -140,6 +158,20 @@
140
158
  */
141
159
  --mg-message-border-radius: 0.3rem;
142
160
 
161
+ /*
162
+ <mg-modal>
163
+ */
164
+ --mg-modal-border-radius: 0.5rem;
165
+ --mg-modal-title-font-size: 1.8rem;
166
+ --mg-modal-content-font-size: 1.2rem;
167
+
168
+ /*
169
+ <mg-panel>
170
+ */
171
+
172
+ --mg-panel-border-radius: 0.5rem;
173
+ --mg-panel-background: var(--color-info-h) var(--color-info-s) calc(var(--color-info-l) + 68%);
174
+
143
175
  /*
144
176
  Layout
145
177
  */
@@ -148,7 +180,6 @@
148
180
  /*
149
181
  Forms
150
182
  */
151
- --mg-form-group-vertical-space: 1.5rem;
152
183
 
153
184
  /*
154
185
  <mg-input-...>
@@ -158,6 +189,9 @@
158
189
  --mg-inputs-color: #b5c2c9;
159
190
  --mg-inputs-spacer: 1rem;
160
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
+
161
195
  /* Input focus shadow */
162
196
  /* #b5c2c9 */
163
197
  /* rgb(0, 221, 255); */
@@ -1,19 +1,12 @@
1
1
  import { h } from '@stencil/core/internal/client';
2
2
 
3
- /**
4
- * Possible input classes
5
- */
6
- var InputClass;
7
- (function (InputClass) {
8
- InputClass["ERROR"] = "is-not-valid";
9
- })(InputClass || (InputClass = {}));
10
-
11
3
  /**
12
4
  * Apply in all input child node the aria-describedby attribute
13
- * @param children
14
- * @param ariaDescribedbyIDs
15
- * @param utils
16
- * @returns {VNode[]}
5
+ *
6
+ * @param {VNode[]} children Represent scoped elements
7
+ * @param {Set<string>} ariaDescribedbyIDs List of IDs
8
+ * @param {FunctionalUtilities} utils Stencil.js utils
9
+ * @returns {VNode[]} Children with aria-describedby attribute
17
10
  */
18
11
  const applyAriadescribedBy = (children, ariaDescribedbyIDs, utils) => utils.map(children, child => {
19
12
  if (['input', 'select', 'textarea'].includes(child.vtag)) {
@@ -26,7 +19,8 @@ const applyAriadescribedBy = (children, ariaDescribedbyIDs, utils) => utils.map(
26
19
  });
27
20
  /**
28
21
  * Add classes based on props
29
- * @param props
22
+ *
23
+ * @param {MgInputProps} props MgInput Interface Props
30
24
  */
31
25
  const manageClasses = (props) => {
32
26
  props.classList.add('mg-input');
@@ -34,24 +28,23 @@ const manageClasses = (props) => {
34
28
  props.classList.add('mg-input--label-on-top');
35
29
  if (props.readonly)
36
30
  props.classList.add('mg-input--readonly');
37
- if (props.width !== undefined)
38
- props.classList.add(`mg-input--width-${props.width}`);
39
- if (props.readonly || props.disabled) {
40
- props.classList.delete(InputClass.ERROR);
41
- }
31
+ if (props.mgWidth !== undefined)
32
+ props.classList.add(`mg-input--width-${props.mgWidth}`);
42
33
  };
43
34
  /**
44
- * Define tagname based on props
45
- * @param isFieldset
35
+ * Get tagname
36
+ *
37
+ * @param {boolean} isFieldset is fieldset
46
38
  * @returns {string} tag name
47
39
  */
48
40
  const getTagName = (isFieldset) => (isFieldset ? 'fieldset' : 'div');
49
41
  /**
50
42
  * Get input template
51
- * @param props MgInput Interface Props
52
- * @param children Represent scoped elements
53
- * @param utils Stencil.js utils
54
- * @returns JSX template
43
+ *
44
+ * @param {MgInputProps} props MgInput Interface Props
45
+ * @param {VNode[]} children Represent scoped elements
46
+ * @param {FunctionalUtilities} utils Stencil.js utils
47
+ * @returns {VNode[]} input template
55
48
  */
56
49
  const MgInput = (props, children, utils) => {
57
50
  /**
@@ -70,12 +63,7 @@ const MgInput = (props, children, utils) => {
70
63
  /**
71
64
  * a11y IDs
72
65
  */
73
- const ariaDescribedbyIDs = new Set();
74
- // Character Left
75
- const characterLeftId = `${props.identifier}-character-left`;
76
- if (props.classList.has('is-focused') && props.displayCharacterLeft) {
77
- ariaDescribedbyIDs.add(characterLeftId);
78
- }
66
+ const ariaDescribedbyIDs = new Set(props.ariaDescribedbyIDs);
79
67
  // Help text
80
68
  const helpTextId = `${props.identifier}-help-text`;
81
69
  if (typeof props.helpText === 'string' && props.helpText !== '') {
@@ -113,15 +101,17 @@ const MgInput = (props, children, utils) => {
113
101
  const TagName = getTagName(props.isFieldset);
114
102
  /**
115
103
  * Get tooltip node
116
- * @returns mg-tooltip
104
+ *
105
+ * @returns {VNode[]} mg-tooltip
117
106
  */
118
107
  const getTooltip = () => (h("mg-tooltip", { identifier: `${props.identifier}-tooltip`, message: props.tooltip },
119
108
  h("mg-icon", { icon: "info-circle" })));
120
109
  /**
121
110
  * Get input title (label) node
122
- * @returns mg-input-title
111
+ *
112
+ * @returns {VNode[]} mg-input-title
123
113
  */
124
- const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required, "is-legend": props.isFieldset }, props.label));
114
+ const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required && !props.disabled, "is-legend": props.isFieldset }, props.label));
125
115
  return (h(TagName, { class: props.classList.join() },
126
116
  props.labelOnTop ? (h("div", { class: "mg-input__title" },
127
117
  getInputTitle(),
@@ -129,12 +119,11 @@ const MgInput = (props, children, utils) => {
129
119
  props.readonly ? (h("div", { class: "mg-input__input-container" },
130
120
  h("strong", null, props.readonlyValue || props.value),
131
121
  children)) : (h("div", { class: "mg-input__input-container" },
132
- h("div", { class: "mg-input__input" },
122
+ h("div", { class: { 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined } },
133
123
  children,
134
124
  !props.labelOnTop && props.tooltip && getTooltip()),
135
- props.displayCharacterLeft && props.maxlength && props.classList.has('is-focused') && (h("mg-character-left", { identifier: characterLeftId, characters: props.value, maxlength: props.maxlength, template: props.characterLeftTemplate })),
136
125
  props.helpText && h("div", { id: helpTextId, class: "mg-input__help-text", innerHTML: props.helpText }),
137
- props.errorMessage && h("div", { id: helpTextErrorId, class: "mg-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" })))));
126
+ props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
138
127
  };
139
128
 
140
- export { InputClass as I, MgInput as M };
129
+ export { MgInput as M };
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * Create random ID
3
- * @param prefix {string} add prefix to created ID
3
+ *
4
+ * @param {string} prefix add prefix to created ID
5
+ * @param {number} length ID length
4
6
  * @returns {string} ID
5
7
  */
6
8
  function createID(prefix = '', length = 10) {
7
9
  let ID = '';
8
10
  const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
9
11
  const charsLength = chars.length;
10
- for (var i = 0; i < length; i++) {
12
+ for (let i = 0; i < length; i++) {
11
13
  ID += chars.charAt(Math.floor(Math.random() * charsLength));
12
14
  }
13
15
  return (prefix !== '' ? `${prefix}-` : '') + ID;
@@ -20,7 +22,8 @@ class ClassList {
20
22
  constructor(classlist = []) {
21
23
  /**
22
24
  * Add class
23
- * @param className
25
+ *
26
+ * @param {string} className class name to add
24
27
  * @returns {void}
25
28
  */
26
29
  this.add = (className) => {
@@ -30,7 +33,8 @@ class ClassList {
30
33
  };
31
34
  /**
32
35
  * Delete class
33
- * @param className
36
+ *
37
+ * @param {string} className class name to delete
34
38
  * @returns {void}
35
39
  */
36
40
  this.delete = (className) => {
@@ -41,15 +45,17 @@ class ClassList {
41
45
  };
42
46
  /**
43
47
  * Check if class exist in list
44
- * @param className
45
- * @returns {boolean}
48
+ *
49
+ * @param {string} className class name to check
50
+ * @returns {boolean} class name is in the list
46
51
  */
47
52
  this.has = (className) => {
48
53
  return this.classes.includes(className);
49
54
  };
50
55
  /**
51
56
  * Join classes seperated by spaces
52
- * @returns {string}
57
+ *
58
+ * @returns {string} joined values
53
59
  */
54
60
  this.join = () => {
55
61
  return this.classes.join(' ');
@@ -59,8 +65,9 @@ class ClassList {
59
65
  }
60
66
  /**
61
67
  * Check if all items are string
62
- * @param items
63
- * @returns {boolean}
68
+ *
69
+ * @param {string[]} items items to check
70
+ * @returns {boolean} all items are string
64
71
  */
65
72
  function allItemsAreString(items) {
66
73
  return items && items.every(item => typeof item === 'string');
@@ -1,6 +1,27 @@
1
1
  /* MgComponents custom elements */
2
-
3
- import type { Components, JSX } from "../types/components";
2
+ export { MgBadge as MgBadge } from '../types/components/mg-badge/mg-badge';
3
+ export { MgButton as MgButton } from '../types/components/mg-button/mg-button';
4
+ export { MgCharacterLeft as MgCharacterLeft } from '../types/components/mg-character-left/mg-character-left';
5
+ export { MgForm as MgForm } from '../types/components/mg-form/mg-form';
6
+ export { MgIcon as MgIcon } from '../types/components/mg-icon/mg-icon';
7
+ export { MgInputCheckbox as MgInputCheckbox } from '../types/components/mg-input-checkbox/mg-input-checkbox';
8
+ export { MgInputDate as MgInputDate } from '../types/components/mg-input-date/mg-input-date';
9
+ export { MgInputNumeric as MgInputNumeric } from '../types/components/mg-input-numeric/mg-input-numeric';
10
+ export { MgInputPassword as MgInputPassword } from '../types/components/mg-input-password/mg-input-password';
11
+ export { MgInputRadio as MgInputRadio } from '../types/components/mg-input-radio/mg-input-radio';
12
+ export { MgInputSelect as MgInputSelect } from '../types/components/mg-input-select/mg-input-select';
13
+ export { MgInputText as MgInputText } from '../types/components/mg-input-text/mg-input-text';
14
+ export { MgInputTextarea as MgInputTextarea } from '../types/components/mg-input-textarea/mg-input-textarea';
15
+ export { MgInputTitle as MgInputTitle } from '../types/components/mg-input-title/mg-input-title';
16
+ export { MgInputToggle as MgInputToggle } from '../types/components/mg-input-toggle/mg-input-toggle';
17
+ export { MgMessage as MgMessage } from '../types/components/mg-message/mg-message';
18
+ export { MgModal as MgModal } from '../types/components/mg-modal/mg-modal';
19
+ export { MgPagination as MgPagination } from '../types/components/mg-pagination/mg-pagination';
20
+ export { MgPanel as MgPanel } from '../types/components/mg-panel/mg-panel';
21
+ export { MgPopover as MgPopover } from '../types/components/mg-popover/mg-popover';
22
+ export { MgTabs as MgTabs } from '../types/components/mg-tabs/mg-tabs';
23
+ export { MgTag as MgTag } from '../types/components/mg-tag/mg-tag';
24
+ export { MgTooltip as MgTooltip } from '../types/components/mg-tooltip/mg-tooltip';
4
25
 
5
26
  /**
6
27
  * Used to manually set the base path where assets can be found.
@@ -9,7 +30,7 @@ import type { Components, JSX } from "../types/components";
9
30
  * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
10
31
  * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
11
32
  * But do note that this configuration depends on how your script is bundled, or lack of
12
- * bunding, and where your assets can be loaded from. Additionally custom bundling
33
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
13
34
  * will have to ensure the static assets are copied to its build directory.
14
35
  */
15
36
  export declare const setAssetPath: (path: string) => void;
@@ -20,7 +41,4 @@ export interface SetPlatformOptions {
20
41
  rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
21
42
  }
22
43
  export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
23
-
24
- export type { Components, JSX };
25
-
26
44
  export * from '../types';
@@ -1 +1,24 @@
1
1
  export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
2
+ export { MgBadge, defineCustomElement as defineCustomElementMgBadge } from './mg-badge.js';
3
+ export { MgButton, defineCustomElement as defineCustomElementMgButton } from './mg-button.js';
4
+ export { MgCharacterLeft, defineCustomElement as defineCustomElementMgCharacterLeft } from './mg-character-left.js';
5
+ export { MgForm, defineCustomElement as defineCustomElementMgForm } from './mg-form.js';
6
+ export { MgIcon, defineCustomElement as defineCustomElementMgIcon } from './mg-icon.js';
7
+ export { MgInputCheckbox, defineCustomElement as defineCustomElementMgInputCheckbox } from './mg-input-checkbox.js';
8
+ export { MgInputDate, defineCustomElement as defineCustomElementMgInputDate } from './mg-input-date.js';
9
+ export { MgInputNumeric, defineCustomElement as defineCustomElementMgInputNumeric } from './mg-input-numeric.js';
10
+ export { MgInputPassword, defineCustomElement as defineCustomElementMgInputPassword } from './mg-input-password.js';
11
+ export { MgInputRadio, defineCustomElement as defineCustomElementMgInputRadio } from './mg-input-radio.js';
12
+ export { MgInputSelect, defineCustomElement as defineCustomElementMgInputSelect } from './mg-input-select.js';
13
+ export { MgInputText, defineCustomElement as defineCustomElementMgInputText } from './mg-input-text.js';
14
+ export { MgInputTextarea, defineCustomElement as defineCustomElementMgInputTextarea } from './mg-input-textarea.js';
15
+ export { MgInputTitle, defineCustomElement as defineCustomElementMgInputTitle } from './mg-input-title.js';
16
+ export { MgInputToggle, defineCustomElement as defineCustomElementMgInputToggle } from './mg-input-toggle.js';
17
+ export { MgMessage, defineCustomElement as defineCustomElementMgMessage } from './mg-message.js';
18
+ export { MgModal, defineCustomElement as defineCustomElementMgModal } from './mg-modal.js';
19
+ export { MgPagination, defineCustomElement as defineCustomElementMgPagination } from './mg-pagination.js';
20
+ export { MgPanel, defineCustomElement as defineCustomElementMgPanel } from './mg-panel.js';
21
+ export { MgPopover, defineCustomElement as defineCustomElementMgPopover } from './mg-popover.js';
22
+ export { MgTabs, defineCustomElement as defineCustomElementMgTabs } from './mg-tabs.js';
23
+ export { MgTag, defineCustomElement as defineCustomElementMgTag } from './mg-tag.js';
24
+ export { MgTooltip, defineCustomElement as defineCustomElementMgTooltip } from './mg-tooltip.js';
@@ -1,10 +1,70 @@
1
+ const errors$1 = {
2
+ required: "This field is required.",
3
+ date: {
4
+ badInput: "The date format must be <span aria-hidden=\"true\">mm/dd/yyyy</span><span class=\"sr-only\">m m / d d / y y y y</span> and the date must be greater than {min}",
5
+ min: "The date cannot be earlier than {min}",
6
+ max: "The date cannot be later than {max}",
7
+ minMax: "The date must be between {min} and {max}"
8
+ },
9
+ numeric: {
10
+ min: "The value cannot be less than {min}",
11
+ max: "The value cannot be greater than {max}",
12
+ minMax: "The value must be between {min} et {max}"
13
+ }
14
+ };
15
+ const nbCharLeft$1 = "{counter} characters left.";
16
+ const input$1 = {
17
+ select: {
18
+ placeholder: "Select a value"
19
+ }
20
+ };
21
+ const form$1 = {
22
+ required: "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
23
+ allRequired: "All fields are required"
24
+ };
25
+ const message$1 = {
26
+ closeButton: "Close message"
27
+ };
28
+ const modal$1 = {
29
+ closeButton: "Close modal"
30
+ };
31
+ const pagination$1 = {
32
+ label: "Pagination",
33
+ page: "page",
34
+ pages: "pages",
35
+ nextPage: "Next page",
36
+ previousPage: "Previous page",
37
+ selectPage: "Select the page to display."
38
+ };
39
+ const panel$1 = {
40
+ editLabel: "Edit section title."
41
+ };
42
+ const general$1 = {
43
+ confirm: "Confirm",
44
+ cancel: "Cancel",
45
+ close: "Close",
46
+ next: "next",
47
+ previous: "previous"
48
+ };
49
+ const en = {
50
+ errors: errors$1,
51
+ nbCharLeft: nbCharLeft$1,
52
+ input: input$1,
53
+ form: form$1,
54
+ message: message$1,
55
+ modal: modal$1,
56
+ pagination: pagination$1,
57
+ panel: panel$1,
58
+ general: general$1
59
+ };
60
+
1
61
  const errors = {
2
62
  required: "Ce champ est obligatoire.",
3
63
  date: {
4
64
  badInput: "Le format de la date doit être du type <span aria-hidden=\"true\">jj/mm/aaaa</span><span class=\"sr-only\">j j / m m / a a a a</span> et la date supérieure au {min}",
5
65
  min: "La date ne peut pas être antérieure au {min}",
6
66
  max: "La date ne peut pas être postérieure au {max}",
7
- minMax: "La date doit être comprise entre {min} et {max}"
67
+ minMax: "La date doit être comprise entre le {min} et le {max}"
8
68
  },
9
69
  numeric: {
10
70
  min: "La valeur ne peut pas être inférieure à {min}",
@@ -15,40 +75,79 @@ const errors = {
15
75
  const nbCharLeft = "{counter} caractères disponibles.";
16
76
  const input = {
17
77
  select: {
18
- placeholder: "Veuillez sélectionner une valeur"
19
- },
20
- checkbox: {
21
- "true": "Oui",
22
- "false": "Non",
23
- indeterminate: "Indéterminé"
78
+ placeholder: "Sélectionnez une valeur"
24
79
  }
25
80
  };
81
+ const form = {
82
+ required: "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
83
+ allRequired: "Tous les champs sont obligatoires"
84
+ };
26
85
  const message = {
27
86
  closeButton: "Fermer le message"
28
87
  };
29
- const popover = {
30
- closeButton: "Fermer"
88
+ const modal = {
89
+ closeButton: "Fermer la modale"
31
90
  };
32
91
  const pagination = {
92
+ label: "Pagination",
33
93
  page: "page",
34
94
  pages: "pages",
35
- next: "suivant",
36
- previous: "précédent",
37
95
  nextPage: "Page suivante",
38
96
  previousPage: "Page précédente",
39
97
  selectPage: "Sélectionner la page à afficher."
40
98
  };
99
+ const panel = {
100
+ editLabel: "Modifier le titre de la section."
101
+ };
102
+ const general = {
103
+ confirm: "Valider",
104
+ cancel: "Annuler",
105
+ close: "Fermer",
106
+ next: "suivant",
107
+ previous: "précédent"
108
+ };
41
109
  const fr = {
42
110
  errors: errors,
43
111
  nbCharLeft: nbCharLeft,
44
112
  input: input,
113
+ form: form,
45
114
  message: message,
46
- popover: popover,
47
- pagination: pagination
115
+ modal: modal,
116
+ pagination: pagination,
117
+ panel: panel,
118
+ general: general
48
119
  };
49
120
 
50
- const locale = 'fr-FR';
51
- const messages = fr;
52
- const currency = 'EUR';
121
+ const defaultLocale = 'en';
122
+ const messages = { en, fr };
123
+ /**
124
+ * Get locale
125
+ *
126
+ * @param {HTMLElement} element element that needs to know the locale to use
127
+ * @returns {string} locale
128
+ */
129
+ const getLocale = (element) => {
130
+ var _a;
131
+ return ((_a = element.closest('[lang]')) === null || _a === void 0 ? void 0 : _a.lang) || navigator.language || defaultLocale;
132
+ };
133
+ /**
134
+ * Get Intl object
135
+ * We load the defined locale but for now we only support the first subtag for messages
136
+ *
137
+ * @param {HTMLElement} element element we need to get the language
138
+ * @returns {{ locale: string; messages: unknown }} messages object
139
+ */
140
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
141
+ const initLocales = (element) => {
142
+ // Get local
143
+ const locale = getLocale(element);
144
+ // Only keep first subtag
145
+ const localeSubtag = locale.split('-').shift();
146
+ // Return
147
+ return {
148
+ locale,
149
+ messages: messages[localeSubtag] || messages[defaultLocale],
150
+ };
151
+ };
53
152
 
54
- export { currency as c, locale as l, messages as m };
153
+ export { initLocales as i };
@@ -1,19 +1,22 @@
1
- import { l as locale, c as currency } from './index2.js';
2
-
3
1
  /**
4
2
  * Format number to the locale currency
5
- * @param number {number}
3
+ *
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
- function localeCurrency(number) {
9
+ 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
- * @param number {number}
14
+ *
15
+ * @param {number} number number to format
16
+ * @param {string} locale locale to apply
14
17
  * @returns {string} formatted number
15
18
  */
16
- function localeNumber(number) {
19
+ function localeNumber(number, locale) {
17
20
  return new Intl.NumberFormat(locale).format(number);
18
21
  }
19
22
  /**
@@ -22,10 +25,12 @@ function localeNumber(number) {
22
25
  const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
23
26
  /**
24
27
  * Locale date format
25
- * @param date {string}
28
+ *
29
+ * @param {string} date date to format
30
+ * @param {string} locale locale to apply
26
31
  * @returns {string} formatted date
27
32
  */
28
- function localeDate(date) {
33
+ function localeDate(date, locale) {
29
34
  if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {
30
35
  return '';
31
36
  }
@@ -4,55 +4,71 @@ import { C as ClassList } from './components.utils.js';
4
4
  /**
5
5
  * List of all possibles variants
6
6
  */
7
- const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'];
7
+ const variants = ['info', 'primary', 'secondary', 'success', 'warning', 'danger'];
8
8
 
9
- const mgBadgeCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-badge{padding:0 0.4rem;height:var(--mg-badge-size);min-width:var(--mg-badge-size);-webkit-box-sizing:border-box;box-sizing:border-box;border:0.1rem solid;border-radius:50%;border-radius:calc(var(--mg-badge-size) / 2);font-size:var(--mg-badge-font-size);font-weight:600;text-align:center;line-height:var(--mg-badge-size)}.mg-badge.mg-badge--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-badge.mg-badge--primary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-badge.mg-badge--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-badge.mg-badge--success.mg-badge--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-badge.mg-badge--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-badge.mg-badge--warning.mg-badge--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-badge.mg-badge--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-badge.mg-badge--danger.mg-badge--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-badge.mg-badge--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-badge.mg-badge--info.mg-badge--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-badge,mg-badge{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}";
9
+ const mgBadgeCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-badge{padding:0 0.4rem;height:var(--mg-badge-size);min-width:var(--mg-badge-size);box-sizing:border-box;border:0.1rem solid;border-radius:calc(var(--mg-badge-size) / 2);font-size:var(--mg-badge-font-size);font-weight:600;text-align:center;line-height:var(--mg-badge-size)}.mg-badge.mg-badge--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-badge.mg-badge--primary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-badge.mg-badge--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-badge.mg-badge--success.mg-badge--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-badge.mg-badge--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-badge.mg-badge--warning.mg-badge--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-badge.mg-badge--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-badge.mg-badge--danger.mg-badge--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-badge.mg-badge--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-badge.mg-badge--info.mg-badge--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-badge,mg-badge{display:inline-flex;align-items:center;justify-content:center}";
10
10
 
11
11
  const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
12
12
  constructor() {
13
13
  super();
14
14
  this.__registerHost();
15
15
  this.__attachShadow();
16
+ /************
17
+ * Internal *
18
+ ************/
19
+ // classes
20
+ this.classOutline = `mg-badge--outline`;
16
21
  /**
17
22
  * Define button variant
18
23
  */
19
- this.variant = variants[variants.length - 1];
24
+ this.variant = variants[0]; // info
20
25
  /**
21
26
  * Component classes
22
27
  */
23
28
  this.classList = new ClassList(['mg-badge']);
24
29
  }
25
- valideValue(newValue) {
30
+ validateValue(newValue) {
26
31
  if (`${newValue}`.match(/^(\d+|[?*!a-z])$/i) === null) {
27
32
  throw new Error('<mg-badge> prop "value" must be interger or ponctuation character.');
28
33
  }
29
34
  }
30
- validateVariant(newValue) {
35
+ validateVariant(newValue, oldValue) {
31
36
  if (!variants.includes(newValue)) {
32
37
  throw new Error(`<mg-badge> prop "variant" must be one of : ${variants.join(', ')}.`);
33
38
  }
34
- this.classList.add(`mg-badge--${this.variant}`);
39
+ else {
40
+ if (oldValue !== undefined) {
41
+ this.classList.delete(`mg-badge--${oldValue}`);
42
+ }
43
+ this.classList.add(`mg-badge--${newValue}`);
44
+ }
35
45
  }
36
46
  validateOutline(newValue) {
37
47
  if (newValue)
38
- this.classList.add(`mg-badge--outline`);
48
+ this.classList.add(this.classOutline);
49
+ else
50
+ this.classList.delete(this.classOutline);
39
51
  }
40
52
  /**
41
53
  * Check if props are well configured on init
54
+ *
55
+ * @returns {void}
42
56
  */
43
57
  componentWillLoad() {
44
- this.valideValue(this.value);
58
+ this.validateValue(this.value);
45
59
  this.validateVariant(this.variant);
46
60
  this.validateOutline(this.outline);
47
61
  }
48
62
  /**
49
63
  * Render
64
+ *
65
+ * @returns {HTMLElement} HTML Element
50
66
  */
51
67
  render() {
52
68
  return (h("span", { class: this.classList.join() }, this.value, h("span", { class: "sr-only" }, this.label)));
53
69
  }
54
70
  static get watchers() { return {
55
- "value": ["valideValue"],
71
+ "value": ["validateValue"],
56
72
  "variant": ["validateVariant"],
57
73
  "outline": ["validateOutline"]
58
74
  }; }