@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
@@ -11,16 +11,9 @@
11
11
  min-height: var(--default-size);
12
12
  max-width: 100%;
13
13
  margin-bottom: var(--mg-inputs-margin-bottom, 0);
14
- /* Style when input is not valid */
15
14
  /* Label */
16
15
  /* Label-on-top */
17
16
  }
18
- .mg-input.is-not-valid {
19
- color: hsl(var(--color-danger));
20
- }
21
- .mg-input.is-not-valid .mg-input__box {
22
- border-color: hsl(var(--color-danger));
23
- }
24
17
  .mg-input mg-input-title {
25
18
  flex-shrink: var(--mg-inputs-shrink, 1);
26
19
  width: var(--mg-inputs-title-width, auto);
@@ -71,8 +64,10 @@
71
64
  height: var(--mg-icon-regular-size);
72
65
  margin-left: var(--mg-inputs-spacer);
73
66
  }
74
- .mg-input__input-container mg-icon {
75
- display: flex;
67
+ .mg-input__input-container .mg-input__help-text,
68
+ .mg-input__input-container .mg-input__error {
69
+ text-align: start;
70
+ font-size: 1.2rem;
76
71
  }
77
72
 
78
73
  .mg-input__input {
@@ -82,11 +77,26 @@
82
77
  .mg-input__input mg-tooltip {
83
78
  margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
84
79
  }
85
- .mg-input__input + * {
86
- text-align: start;
80
+ .mg-input__input.mg-input__input--has-error .mg-input__box {
81
+ border-color: hsl(var(--color-danger));
82
+ }
83
+ .mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
87
84
  margin-top: 0.5rem;
88
85
  }
89
86
 
87
+ .mg-input__error {
88
+ display: inline-block;
89
+ margin-top: 0.2rem;
90
+ padding: 0.3rem 0.8rem;
91
+ border-radius: 0.3rem;
92
+ background: hsl(var(--mg-inputs-error-bg-color));
93
+ color: hsl(var(--color-danger));
94
+ }
95
+
96
+ .mg-input__input mg-icon, .mg-input__error mg-icon {
97
+ display: flex;
98
+ }
99
+
90
100
  /**
91
101
  * Style for input "box":
92
102
  * - input[type="text"]
@@ -97,7 +107,6 @@
97
107
  */
98
108
  .mg-input__box {
99
109
  padding: calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);
100
- width: 100%;
101
110
  height: var(--default-size);
102
111
  box-sizing: border-box;
103
112
  border-width: var(--mg-inputs-border-width);
@@ -108,6 +117,7 @@
108
117
  font-family: inherit;
109
118
  color: hsl(var(--color-dark));
110
119
  font-size: var(--font-size);
120
+ text-align: var(--mg-inputs-text-align, left);
111
121
  }
112
122
  .mg-input__box::placeholder {
113
123
  color: var(--mg-inputs-color);
@@ -155,10 +165,6 @@
155
165
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]) {
156
166
  --mg-button-border-radius-top-right: 0;
157
167
  --mg-button-border-radius-bottom-right: 0;
158
- --mg-button-border-radius-top-left: 0;
159
- /* IE FIX */
160
- --mg-button-border-radius-bottom-left: 0;
161
- /* IE FIX */
162
168
  }
163
169
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)) {
164
170
  --mg-button-border-right-width: 0;
@@ -166,10 +172,6 @@
166
172
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type) {
167
173
  --mg-button-border-radius-top-right: var(--mg-inputs-border-radius);
168
174
  --mg-button-border-radius-bottom-right: var(--mg-inputs-border-radius);
169
- --mg-button-border-radius-top-left: 0;
170
- /* IE FIX */
171
- --mg-button-border-radius-bottom-left: 0;
172
- /* IE FIX */
173
175
  }
174
176
 
175
177
  .mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]) {
@@ -222,5 +224,5 @@
222
224
  }
223
225
 
224
226
  .mg-input .mg-input__box {
225
- text-align: right;
227
+ text-align: var(--mg-inputs-text-align, right);
226
228
  }
@@ -1,14 +1,13 @@
1
1
  import { Component, Element, Event, h, Prop, State, Watch, Method } from '@stencil/core';
2
2
  import { MgInput } from '../MgInput';
3
- import { InputClass } from '../MgInput.conf';
4
3
  import { types, InputError } from './mg-input-numeric.conf';
5
4
  import { createID, ClassList } from '../../../../utils/components.utils';
6
- import { messages } from '../../../../locales';
5
+ import { initLocales } from '../../../../locales/';
7
6
  import { localeCurrency, localeNumber } from '../../../../utils/locale.utils';
8
7
  export class MgInputNumeric {
9
8
  constructor() {
10
- // Classes
11
- this.classError = InputClass.ERROR;
9
+ // hasError (triggered by blur event)
10
+ this.hasError = false;
12
11
  /**
13
12
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
14
13
  * If not set, it will be created.
@@ -39,6 +38,10 @@ export class MgInputNumeric {
39
38
  * Define numeric type
40
39
  */
41
40
  this.type = types[0];
41
+ /**
42
+ * Define currency
43
+ */
44
+ this.currency = 'USD';
42
45
  /**
43
46
  * Override integer length
44
47
  * integer is the number before the decimal point
@@ -65,6 +68,9 @@ export class MgInputNumeric {
65
68
  this.handleInput = () => {
66
69
  // Check validity
67
70
  this.checkValidity();
71
+ if (this.hasError) {
72
+ this.checkError();
73
+ }
68
74
  this.value = this.input.value;
69
75
  };
70
76
  /**
@@ -81,9 +87,8 @@ export class MgInputNumeric {
81
87
  * @returns {void}
82
88
  */
83
89
  this.handleBlur = () => {
84
- // Check validity
85
- this.checkValidity();
86
- this.checkError();
90
+ // Display Error
91
+ this.displayError();
87
92
  this.hasFocus = false;
88
93
  };
89
94
  /**
@@ -109,10 +114,10 @@ export class MgInputNumeric {
109
114
  this.setErrorMessage = () => {
110
115
  const inputError = this.getInputError();
111
116
  if (inputError === InputError.REQUIRED) {
112
- this.errorMessage = messages.errors[inputError];
117
+ this.errorMessage = this.messages.errors[inputError];
113
118
  }
114
119
  else {
115
- this.errorMessage = messages.errors.numeric[inputError].replace('{min}', `${this.formatValue(this.min)}`).replace('{max}', `${this.formatValue(this.max)}`);
120
+ this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', `${this.formatValue(this.min)}`).replace('{max}', `${this.formatValue(this.max)}`);
116
121
  }
117
122
  };
118
123
  /**
@@ -126,10 +131,6 @@ export class MgInputNumeric {
126
131
  // Update class
127
132
  if (!this.valid) {
128
133
  this.setErrorMessage();
129
- this.classList.add(this.classError);
130
- }
131
- else {
132
- this.classList.delete(this.classError);
133
134
  }
134
135
  };
135
136
  /**
@@ -166,7 +167,7 @@ export class MgInputNumeric {
166
167
  * @param {number} value value to format
167
168
  * @returns {string} formated local value
168
169
  */
169
- this.formatValue = (value) => (this.type === 'currency' ? localeCurrency(value) : localeNumber(value));
170
+ this.formatValue = (value) => (this.type === 'currency' ? localeCurrency(value, this.locale, this.currency) : localeNumber(value, this.locale));
170
171
  /**
171
172
  * Validate append slot
172
173
  *
@@ -202,7 +203,7 @@ export class MgInputNumeric {
202
203
  // emit numeric value
203
204
  this.numericValue = this.value !== '' && this.value !== null ? parseFloat(this.value.replace(',', '.')) : null;
204
205
  this.valueChange.emit(this.numericValue);
205
- // Set readOnlyValue
206
+ // Set readonlyValue
206
207
  this.readonlyValue = this.numericValue !== null ? this.formatValue(this.numericValue) : '';
207
208
  }
208
209
  }
@@ -210,7 +211,6 @@ export class MgInputNumeric {
210
211
  if (!types.includes(newValue)) {
211
212
  throw new Error(`<mg-input-numeric> prop "type" must be one of : ${types.join(', ')}`);
212
213
  }
213
- this.classList.add(`mg-input--numeric--${this.type}`);
214
214
  }
215
215
  validateIntegerLength(newValue) {
216
216
  if (newValue < 1) {
@@ -230,6 +230,7 @@ export class MgInputNumeric {
230
230
  async displayError() {
231
231
  this.checkValidity();
232
232
  this.checkError();
233
+ this.hasError = this.invalid;
233
234
  }
234
235
  /**
235
236
  * Displayed value in input
@@ -249,6 +250,11 @@ export class MgInputNumeric {
249
250
  * @returns {ReturnType<typeof setTimeout>} timeout
250
251
  */
251
252
  componentWillLoad() {
253
+ // Get locales
254
+ const locales = initLocales(this.element);
255
+ this.locale = locales.locale;
256
+ this.messages = locales.messages;
257
+ // Validate
252
258
  this.validateValue(this.value);
253
259
  this.validateType(this.type);
254
260
  this.validateIntegerLength(this.integerLength);
@@ -267,7 +273,7 @@ export class MgInputNumeric {
267
273
  * @returns {HTMLElement} HTML Element
268
274
  */
269
275
  render() {
270
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, width: this.width, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
276
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
271
277
  h("input", { type: "text", class: "mg-input__box", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }),
272
278
  h("slot", { name: "append-input" })));
273
279
  }
@@ -456,7 +462,7 @@ export class MgInputNumeric {
456
462
  "reflect": false,
457
463
  "defaultValue": "false"
458
464
  },
459
- "width": {
465
+ "mgWidth": {
460
466
  "type": "any",
461
467
  "mutable": false,
462
468
  "complexType": {
@@ -475,7 +481,7 @@ export class MgInputNumeric {
475
481
  "tags": [],
476
482
  "text": "Define input width"
477
483
  },
478
- "attribute": "width",
484
+ "attribute": "mg-width",
479
485
  "reflect": false
480
486
  },
481
487
  "tooltip": {
@@ -530,6 +536,24 @@ export class MgInputNumeric {
530
536
  "reflect": false,
531
537
  "defaultValue": "types[0]"
532
538
  },
539
+ "currency": {
540
+ "type": "string",
541
+ "mutable": false,
542
+ "complexType": {
543
+ "original": "string",
544
+ "resolved": "string",
545
+ "references": {}
546
+ },
547
+ "required": false,
548
+ "optional": false,
549
+ "docs": {
550
+ "tags": [],
551
+ "text": "Define currency"
552
+ },
553
+ "attribute": "currency",
554
+ "reflect": false,
555
+ "defaultValue": "'USD'"
556
+ },
533
557
  "max": {
534
558
  "type": "number",
535
559
  "mutable": false,
@@ -1,27 +1,24 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../../.storybook/utils';
2
3
  export default {
3
4
  component: 'mg-input-password',
4
5
  title: 'Molecules/Inputs/mg-input-password',
6
+ argTypes: {
7
+ mgWidth: {
8
+ options: [2, 4, 16, 'full'],
9
+ control: { type: 'select' },
10
+ },
11
+ },
5
12
  parameters: { actions: { handles: ['value-change', 'input-valid'] } },
6
13
  };
7
14
  /**
8
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
9
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
15
+ * Template
10
16
  *
11
17
  * @param {any} args component arguments
12
18
  * @returns {HTMLElement} HTMLElement
13
19
  */
14
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- const Template = (args) => {
16
- const labelOnTop = args.labelOnTop;
17
- delete args.labelOnTop;
18
- const labelHide = args.labelHide;
19
- delete args.labelHide;
20
- const helpText = args.helpText;
21
- delete args.helpText;
22
- // return element
23
- return h("mg-input-password", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText }));
24
- };
21
+ const Template = (args) => h("mg-input-password", Object.assign({}, filterArgs(args)));
25
22
  /**
26
23
  * Global use
27
24
  */
@@ -41,6 +38,7 @@ MgInputPassword.args = {
41
38
  required: true,
42
39
  disabled: false,
43
40
  readonly: false,
41
+ mgWidth: 'full',
44
42
  // Tooltip
45
43
  tooltip: 'This is a tooltip',
46
44
  // Help Text
@@ -11,16 +11,9 @@
11
11
  min-height: var(--default-size);
12
12
  max-width: 100%;
13
13
  margin-bottom: var(--mg-inputs-margin-bottom, 0);
14
- /* Style when input is not valid */
15
14
  /* Label */
16
15
  /* Label-on-top */
17
16
  }
18
- .mg-input.is-not-valid {
19
- color: hsl(var(--color-danger));
20
- }
21
- .mg-input.is-not-valid .mg-input__box {
22
- border-color: hsl(var(--color-danger));
23
- }
24
17
  .mg-input mg-input-title {
25
18
  flex-shrink: var(--mg-inputs-shrink, 1);
26
19
  width: var(--mg-inputs-title-width, auto);
@@ -71,8 +64,10 @@
71
64
  height: var(--mg-icon-regular-size);
72
65
  margin-left: var(--mg-inputs-spacer);
73
66
  }
74
- .mg-input__input-container mg-icon {
75
- display: flex;
67
+ .mg-input__input-container .mg-input__help-text,
68
+ .mg-input__input-container .mg-input__error {
69
+ text-align: start;
70
+ font-size: 1.2rem;
76
71
  }
77
72
 
78
73
  .mg-input__input {
@@ -82,11 +77,26 @@
82
77
  .mg-input__input mg-tooltip {
83
78
  margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
84
79
  }
85
- .mg-input__input + * {
86
- text-align: start;
80
+ .mg-input__input.mg-input__input--has-error .mg-input__box {
81
+ border-color: hsl(var(--color-danger));
82
+ }
83
+ .mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
87
84
  margin-top: 0.5rem;
88
85
  }
89
86
 
87
+ .mg-input__error {
88
+ display: inline-block;
89
+ margin-top: 0.2rem;
90
+ padding: 0.3rem 0.8rem;
91
+ border-radius: 0.3rem;
92
+ background: hsl(var(--mg-inputs-error-bg-color));
93
+ color: hsl(var(--color-danger));
94
+ }
95
+
96
+ .mg-input__input mg-icon, .mg-input__error mg-icon {
97
+ display: flex;
98
+ }
99
+
90
100
  /**
91
101
  * Style for input "box":
92
102
  * - input[type="text"]
@@ -97,7 +107,6 @@
97
107
  */
98
108
  .mg-input__box {
99
109
  padding: calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);
100
- width: 100%;
101
110
  height: var(--default-size);
102
111
  box-sizing: border-box;
103
112
  border-width: var(--mg-inputs-border-width);
@@ -108,6 +117,7 @@
108
117
  font-family: inherit;
109
118
  color: hsl(var(--color-dark));
110
119
  font-size: var(--font-size);
120
+ text-align: var(--mg-inputs-text-align, left);
111
121
  }
112
122
  .mg-input__box::placeholder {
113
123
  color: var(--mg-inputs-color);
@@ -155,10 +165,6 @@
155
165
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]) {
156
166
  --mg-button-border-radius-top-right: 0;
157
167
  --mg-button-border-radius-bottom-right: 0;
158
- --mg-button-border-radius-top-left: 0;
159
- /* IE FIX */
160
- --mg-button-border-radius-bottom-left: 0;
161
- /* IE FIX */
162
168
  }
163
169
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)) {
164
170
  --mg-button-border-right-width: 0;
@@ -166,10 +172,6 @@
166
172
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type) {
167
173
  --mg-button-border-radius-top-right: var(--mg-inputs-border-radius);
168
174
  --mg-button-border-radius-bottom-right: var(--mg-inputs-border-radius);
169
- --mg-button-border-radius-top-left: 0;
170
- /* IE FIX */
171
- --mg-button-border-radius-bottom-left: 0;
172
- /* IE FIX */
173
175
  }
174
176
 
175
177
  .mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]) {
@@ -1,15 +1,11 @@
1
- import { Component, Event, h, Prop, State, Method, Watch } from '@stencil/core';
1
+ import { Component, Element, Event, h, Prop, State, Method, Watch } from '@stencil/core';
2
2
  import { MgInput } from '../MgInput';
3
- import { InputClass } from '../MgInput.conf';
4
3
  import { createID, ClassList } from '../../../../utils/components.utils';
5
- import { messages } from '../../../../locales';
4
+ import { initLocales } from '../../../../locales';
6
5
  export class MgInputPassword {
7
6
  constructor() {
8
- /************
9
- * Internal *
10
- ************/
11
- // classes
12
- this.classError = InputClass.ERROR;
7
+ // hasError (triggered by blur event)
8
+ this.hasError = false;
13
9
  /**
14
10
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
15
11
  * If not set, it will be created.
@@ -39,7 +35,7 @@ export class MgInputPassword {
39
35
  /**
40
36
  * Define input width
41
37
  */
42
- this.width = 'full';
38
+ this.mgWidth = 'full';
43
39
  /**
44
40
  * Component classes
45
41
  */
@@ -49,14 +45,16 @@ export class MgInputPassword {
49
45
  */
50
46
  this.handleInput = () => {
51
47
  this.checkValidity();
48
+ if (this.hasError) {
49
+ this.checkError();
50
+ }
52
51
  this.value = this.input.value;
53
52
  };
54
53
  /**
55
54
  * Handle blur event
56
55
  */
57
56
  this.handleBlur = () => {
58
- this.checkValidity();
59
- this.checkError();
57
+ this.displayError();
60
58
  };
61
59
  /**
62
60
  * Check if input is valid
@@ -79,14 +77,7 @@ export class MgInputPassword {
79
77
  this.errorMessage = undefined;
80
78
  // required
81
79
  if (!this.valid && this.input.validity.valueMissing) {
82
- this.errorMessage = messages.errors.required;
83
- }
84
- // Update class
85
- if (this.valid) {
86
- this.classList.delete(this.classError);
87
- }
88
- else {
89
- this.classList.add(this.classError);
80
+ this.errorMessage = this.messages.errors.required;
90
81
  }
91
82
  };
92
83
  }
@@ -101,6 +92,7 @@ export class MgInputPassword {
101
92
  async displayError() {
102
93
  this.checkValidity();
103
94
  this.checkError();
95
+ this.hasError = this.invalid;
104
96
  }
105
97
  /*************
106
98
  * Lifecycle *
@@ -111,6 +103,8 @@ export class MgInputPassword {
111
103
  * @returns {ReturnType<typeof setTimeout>} timeout
112
104
  */
113
105
  componentWillLoad() {
106
+ // Get locales
107
+ this.messages = initLocales(this.element).messages;
114
108
  // Check validity when component is ready
115
109
  // return a promise to process action only in the FIRST render().
116
110
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
@@ -124,7 +118,7 @@ export class MgInputPassword {
124
118
  * @returns {HTMLElement} HTML Element
125
119
  */
126
120
  render() {
127
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, width: this.width, disabled: this.disabled, value: this.value, readonlyValue: this.value !== undefined ? '•'.repeat(this.value.length) : undefined, tooltip: this.tooltip, displayCharacterLeft: false, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
121
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.value !== undefined ? '•'.repeat(this.value.length) : undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
128
122
  h("input", { type: "password", class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => (this.input = el) })));
129
123
  }
130
124
  static get is() { return "mg-input-password"; }
@@ -312,7 +306,7 @@ export class MgInputPassword {
312
306
  "reflect": false,
313
307
  "defaultValue": "false"
314
308
  },
315
- "width": {
309
+ "mgWidth": {
316
310
  "type": "any",
317
311
  "mutable": false,
318
312
  "complexType": {
@@ -331,7 +325,7 @@ export class MgInputPassword {
331
325
  "tags": [],
332
326
  "text": "Define input width"
333
327
  },
334
- "attribute": "width",
328
+ "attribute": "mg-width",
335
329
  "reflect": false,
336
330
  "defaultValue": "'full'"
337
331
  },
@@ -460,6 +454,7 @@ export class MgInputPassword {
460
454
  }
461
455
  }
462
456
  }; }
457
+ static get elementRef() { return "element"; }
463
458
  static get watchers() { return [{
464
459
  "propName": "value",
465
460
  "methodName": "handleValue"
@@ -1,4 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../../.storybook/utils';
2
3
  export default {
3
4
  component: 'mg-input-radio',
4
5
  title: 'Molecules/Inputs/mg-input-radio',
@@ -11,25 +12,13 @@ export default {
11
12
  parameters: { actions: { handles: ['value-change', 'input-valid'] } },
12
13
  };
13
14
  /**
14
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
15
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
15
+ * Template
16
16
  *
17
17
  * @param {any} args component arguments
18
18
  * @returns {HTMLElement} HTMLElement
19
19
  */
20
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
- const Template = (args) => {
22
- const labelOnTop = args.labelOnTop;
23
- delete args.labelOnTop;
24
- const helpText = args.helpText;
25
- delete args.helpText;
26
- const inputVerticalList = args.inputVerticalList;
27
- delete args.inputVerticalList;
28
- const labelHide = args.labelHide;
29
- delete args.labelHide;
30
- // return element
31
- return h("mg-input-radio", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "input-vertical-list": inputVerticalList }));
32
- };
21
+ const Template = (args) => h("mg-input-radio", Object.assign({}, filterArgs(args)));
33
22
  export const MgInputRadio = Template.bind({});
34
23
  MgInputRadio.args = {
35
24
  // Global
@@ -11,16 +11,9 @@
11
11
  min-height: var(--default-size);
12
12
  max-width: 100%;
13
13
  margin-bottom: var(--mg-inputs-margin-bottom, 0);
14
- /* Style when input is not valid */
15
14
  /* Label */
16
15
  /* Label-on-top */
17
16
  }
18
- .mg-input.is-not-valid {
19
- color: hsl(var(--color-danger));
20
- }
21
- .mg-input.is-not-valid .mg-input__box {
22
- border-color: hsl(var(--color-danger));
23
- }
24
17
  .mg-input mg-input-title {
25
18
  flex-shrink: var(--mg-inputs-shrink, 1);
26
19
  width: var(--mg-inputs-title-width, auto);
@@ -71,8 +64,10 @@
71
64
  height: var(--mg-icon-regular-size);
72
65
  margin-left: var(--mg-inputs-spacer);
73
66
  }
74
- .mg-input__input-container mg-icon {
75
- display: flex;
67
+ .mg-input__input-container .mg-input__help-text,
68
+ .mg-input__input-container .mg-input__error {
69
+ text-align: start;
70
+ font-size: 1.2rem;
76
71
  }
77
72
 
78
73
  .mg-input__input {
@@ -82,11 +77,26 @@
82
77
  .mg-input__input mg-tooltip {
83
78
  margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
84
79
  }
85
- .mg-input__input + * {
86
- text-align: start;
80
+ .mg-input__input.mg-input__input--has-error .mg-input__box {
81
+ border-color: hsl(var(--color-danger));
82
+ }
83
+ .mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
87
84
  margin-top: 0.5rem;
88
85
  }
89
86
 
87
+ .mg-input__error {
88
+ display: inline-block;
89
+ margin-top: 0.2rem;
90
+ padding: 0.3rem 0.8rem;
91
+ border-radius: 0.3rem;
92
+ background: hsl(var(--mg-inputs-error-bg-color));
93
+ color: hsl(var(--color-danger));
94
+ }
95
+
96
+ .mg-input__input mg-icon, .mg-input__error mg-icon {
97
+ display: flex;
98
+ }
99
+
90
100
  /**
91
101
  * Manage style when input needs to be a fieldset, like checkbox and radio.
92
102
  */
@@ -110,12 +120,9 @@ fieldset.mg-input input[type=checkbox] {
110
120
  fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container {
111
121
  margin-top: 0.7rem;
112
122
  }
113
- fieldset.mg-input.is-not-valid .mg-input__input-group {
114
- color: initial;
115
- }
116
123
 
117
124
  .mg-input__input-container mg-tooltip {
118
- margin-left: 2rem;
125
+ margin-left: 3rem;
119
126
  }
120
127
 
121
128
  /* input group container */