@mgdis/mg-components 3.3.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist/.storybook/utils.js +24 -0
  2. package/dist/cjs/{index-369388eb.js → index-179621c8.js} +108 -10
  3. package/dist/cjs/{index-bead7dbd.js → index-88560a66.js} +47 -48
  4. package/dist/cjs/loader.cjs.js +3 -17
  5. package/dist/cjs/mg-badge_24.cjs.entry.js +5687 -0
  6. package/dist/cjs/mg-components.cjs.js +3 -7
  7. package/dist/cjs/mg-modal.cjs.entry.js +12 -6
  8. package/dist/collection/collection-manifest.json +3 -1
  9. package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +10 -6
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -3
  12. package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +16 -13
  13. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
  14. package/dist/collection/components/atoms/mg-button/mg-button.css +6 -30
  15. package/dist/collection/components/atoms/mg-button/mg-button.js +53 -22
  16. package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +20 -0
  17. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +10 -47
  18. package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +12 -4
  19. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +99 -10
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.css +4 -0
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  22. package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +21 -0
  23. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +10 -8
  24. package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
  25. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +58 -0
  26. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +26 -0
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +71 -13
  28. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
  29. package/dist/collection/components/molecules/inputs/MgInput.js +5 -15
  30. package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +3 -15
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +22 -15
  32. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -21
  33. package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +3 -12
  34. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +22 -20
  35. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +19 -18
  36. package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +9 -13
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +23 -21
  38. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +43 -19
  39. package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +10 -12
  40. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +22 -20
  41. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -22
  42. package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +3 -14
  43. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +22 -15
  44. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +8 -15
  45. package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +10 -16
  46. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +23 -20
  47. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +24 -31
  48. package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +18 -25
  49. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +54 -30
  50. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +42 -43
  51. package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +11 -14
  52. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +54 -24
  53. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +64 -37
  54. package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +57 -0
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +21 -11
  56. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +25 -10
  57. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +25 -0
  58. package/dist/collection/components/molecules/mg-details/mg-details.css +14 -0
  59. package/dist/collection/components/molecules/mg-details/mg-details.js +141 -0
  60. package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +9 -6
  61. package/dist/collection/components/molecules/mg-form/mg-form.css +5 -1
  62. package/dist/collection/components/molecules/mg-form/mg-form.js +53 -7
  63. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +22 -0
  64. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +37 -0
  65. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +74 -0
  66. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +10 -16
  67. package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
  68. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +43 -0
  69. package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
  70. package/dist/collection/components/molecules/mg-modal/mg-modal.js +10 -4
  71. package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +20 -0
  72. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
  73. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +29 -0
  74. package/dist/collection/components/molecules/mg-panel/mg-panel.css +4 -2
  75. package/dist/collection/components/molecules/mg-panel/mg-panel.js +12 -16
  76. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +22 -16
  77. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  78. package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
  79. package/dist/collection/components/molecules/mg-popover/mg-popover.js +43 -13
  80. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +20 -15
  81. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
  82. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
  83. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +75 -29
  84. package/dist/collection/locales/index.js +33 -4
  85. package/dist/collection/stories/helpers.stories.js +41 -0
  86. package/dist/collection/stories/icons.stories.js +10 -2
  87. package/dist/collection/stories/typography.stories.js +8 -1
  88. package/dist/collection/utils/components.utils.js +10 -0
  89. package/dist/collection/utils/locale.utils.js +7 -4
  90. package/dist/collection/variables.css +10 -5
  91. package/dist/collection/variables.scss +10 -5
  92. package/dist/components/MgInput.js +6 -23
  93. package/dist/components/components.utils.js +11 -1
  94. package/dist/components/index.d.ts +25 -5
  95. package/dist/components/index.js +25 -0
  96. package/dist/components/index2.js +97 -8
  97. package/dist/components/locale.utils.js +7 -5
  98. package/dist/components/mg-badge2.js +16 -4
  99. package/dist/components/mg-button2.js +14 -17
  100. package/dist/components/mg-character-left2.js +4 -27
  101. package/dist/components/mg-details.d.ts +11 -0
  102. package/dist/components/mg-details.js +87 -0
  103. package/dist/components/mg-form.js +40 -8
  104. package/dist/components/mg-icon2.js +122 -17
  105. package/dist/components/mg-illustrated-message.d.ts +11 -0
  106. package/dist/components/mg-illustrated-message.js +68 -0
  107. package/dist/components/mg-input-checkbox.js +11 -27
  108. package/dist/components/mg-input-date.js +21 -25
  109. package/dist/components/mg-input-numeric.js +28 -26
  110. package/dist/components/mg-input-password.js +18 -28
  111. package/dist/components/mg-input-radio.js +10 -22
  112. package/dist/components/mg-input-select2.js +24 -35
  113. package/dist/components/mg-input-text2.js +38 -26
  114. package/dist/components/mg-input-textarea.js +43 -20
  115. package/dist/components/mg-input-toggle.js +27 -18
  116. package/dist/components/mg-message.js +16 -8
  117. package/dist/components/mg-modal.js +11 -5
  118. package/dist/components/mg-pagination.js +16 -22
  119. package/dist/components/mg-panel.js +9 -12
  120. package/dist/components/mg-popover.js +22 -12
  121. package/dist/components/mg-tabs.js +77 -22
  122. package/dist/components/mg-tag.js +20 -5
  123. package/dist/components/mg-tooltip2.js +74 -12
  124. package/dist/components/popper.js +6 -2
  125. package/dist/esm/{index-c346f52d.js → index-7efedd97.js} +107 -8
  126. package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
  127. package/dist/esm/loader.js +3 -17
  128. package/dist/esm/mg-badge_24.entry.js +5660 -0
  129. package/dist/esm/mg-components.js +3 -7
  130. package/dist/esm/mg-modal.entry.js +12 -6
  131. package/dist/index.js +1 -1
  132. package/dist/mg-components/mg-components.css +1 -1
  133. package/dist/mg-components/mg-components.esm.js +1 -1
  134. package/dist/mg-components/p-5f89600c.js +1 -0
  135. package/dist/mg-components/p-a2883dc7.entry.js +1 -0
  136. package/dist/mg-components/p-b14a3443.js +2 -0
  137. package/dist/mg-components/p-cffe0519.entry.js +1 -0
  138. package/dist/mg-components/variables.css +10 -5
  139. package/dist/mg-components/variables.scss +10 -5
  140. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
  141. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
  142. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +6 -0
  143. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +8 -0
  144. package/dist/types/components/atoms/mg-button/mg-button.d.ts +12 -1
  145. package/dist/types/{stories/tags.stories.d.ts → components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts} +2 -1
  146. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
  147. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  148. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  149. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  150. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
  151. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
  152. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +24 -0
  153. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +13 -0
  154. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +27 -2
  155. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
  156. package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
  157. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
  158. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
  159. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
  160. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
  161. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
  162. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
  163. package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
  164. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
  165. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
  166. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
  167. package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
  168. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
  169. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
  170. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
  171. package/dist/types/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.d.ts → doc/mg-input-textarea.stories.d.ts} +8 -0
  172. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +14 -6
  173. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
  174. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
  175. package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +11 -0
  176. package/dist/types/components/molecules/mg-details/mg-details.d.ts +49 -0
  177. package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
  178. package/dist/types/components/molecules/mg-form/mg-form.d.ts +14 -0
  179. package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +6 -0
  180. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +28 -0
  181. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
  182. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
  183. package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
  184. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
  185. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
  186. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
  187. package/dist/types/components/molecules/mg-panel/{mg-panel.stories.d.ts → doc/mg-panel.stories.d.ts} +0 -0
  188. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +5 -0
  189. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +28 -0
  190. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  191. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +15 -2
  192. package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +0 -0
  193. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
  194. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +44 -0
  195. package/dist/types/components.d.ts +240 -147
  196. package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +1 -0
  197. package/dist/types/locales/index.d.ts +109 -46
  198. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  199. package/dist/types/utils/components.utils.d.ts +8 -0
  200. package/dist/types/utils/locale.utils.d.ts +7 -3
  201. package/loader/index.js +1 -1
  202. package/package.json +16 -16
  203. package/readme.md +6 -35
  204. package/dist/cjs/css-shim-629916b0.js +0 -6
  205. package/dist/cjs/mg-badge_21.cjs.entry.js +0 -3358
  206. package/dist/cjs/mg-popover.cjs.entry.js +0 -161
  207. package/dist/cjs/popper-0c3964e7.js +0 -1786
  208. package/dist/cjs/shadow-css-546083ef.js +0 -390
  209. package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +0 -23
  210. package/dist/collection/components/atoms/mg-input-title/mg-input-title.stories.js +0 -21
  211. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.stories.js +0 -26
  212. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +0 -78
  213. package/dist/collection/components/molecules/mg-modal/mg-modal.stories.js +0 -51
  214. package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +0 -24
  215. package/dist/collection/components/molecules/mg-panel/mg-panel.stories.js +0 -39
  216. package/dist/collection/stories/buttons.stories.js +0 -43
  217. package/dist/collection/stories/messages.stories.js +0 -44
  218. package/dist/collection/stories/tags.stories.js +0 -13
  219. package/dist/esm/css-shim-0993aa3b.js +0 -4
  220. package/dist/esm/mg-badge_21.entry.js +0 -3334
  221. package/dist/esm/mg-popover.entry.js +0 -157
  222. package/dist/esm/popper-8874fd6c.js +0 -1784
  223. package/dist/esm/shadow-css-dfa0587f.js +0 -388
  224. package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
  225. package/dist/esm-es5/index-9e877561.js +0 -1
  226. package/dist/esm-es5/index-c346f52d.js +0 -1
  227. package/dist/esm-es5/index.js +0 -0
  228. package/dist/esm-es5/loader.js +0 -1
  229. package/dist/esm-es5/mg-badge_21.entry.js +0 -2
  230. package/dist/esm-es5/mg-components.js +0 -1
  231. package/dist/esm-es5/mg-modal.entry.js +0 -1
  232. package/dist/esm-es5/mg-popover.entry.js +0 -1
  233. package/dist/esm-es5/popper-8874fd6c.js +0 -1
  234. package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
  235. package/dist/mg-components/mg-components.js +0 -132
  236. package/dist/mg-components/p-136c8d6f.system.entry.js +0 -2
  237. package/dist/mg-components/p-3c14153d.js +0 -1
  238. package/dist/mg-components/p-50ea2036.system.js +0 -1
  239. package/dist/mg-components/p-55a22b35.system.js +0 -1
  240. package/dist/mg-components/p-5e796581.js +0 -12
  241. package/dist/mg-components/p-656b5efb.system.js +0 -1
  242. package/dist/mg-components/p-68d6f104.js +0 -1
  243. package/dist/mg-components/p-6d49ed95.js +0 -1
  244. package/dist/mg-components/p-6f173f62.system.entry.js +0 -1
  245. package/dist/mg-components/p-70177194.entry.js +0 -1
  246. package/dist/mg-components/p-8b2d8a2a.system.js +0 -13
  247. package/dist/mg-components/p-8cb61c3f.system.js +0 -1
  248. package/dist/mg-components/p-ace173b1.js +0 -1
  249. package/dist/mg-components/p-b7488a4c.entry.js +0 -1
  250. package/dist/mg-components/p-c1ffb2e1.entry.js +0 -1
  251. package/dist/mg-components/p-c90cc4bf.system.js +0 -1
  252. package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
  253. package/dist/mg-components/p-e4a502b5.system.js +0 -1
  254. package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +0 -16
  255. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  256. package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
  257. package/dist/types/stories/messages.stories.d.ts +0 -13
@@ -1,10 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import { Component, Event, h, Prop, State, Watch, Method } from '@stencil/core';
3
+ import { Component, Element, Event, h, Prop, State, Watch, Method } from '@stencil/core';
4
4
  import { MgInput } from '../MgInput';
5
5
  import { createID, ClassList, allItemsAreString } from '../../../../utils/components.utils';
6
- import { messages } from '../../../../locales';
7
- import { InputClass } from '../MgInput.conf';
6
+ import { initLocales } from '../../../../locales';
8
7
  /**
9
8
  * type Option validation function
10
9
  *
@@ -17,8 +16,6 @@ export class MgInputRadio {
17
16
  /************
18
17
  * Internal *
19
18
  ************/
20
- // classes
21
- this.classError = InputClass.ERROR;
22
19
  // HTML selector
23
20
  this.inputs = [];
24
21
  /**
@@ -103,14 +100,7 @@ export class MgInputRadio {
103
100
  // Set error message
104
101
  this.errorMessage = undefined;
105
102
  if (!this.valid && invalidElement.validity.valueMissing) {
106
- this.errorMessage = messages.errors.required;
107
- }
108
- // Update class
109
- if (this.valid) {
110
- this.classList.delete(this.classError);
111
- }
112
- else {
113
- this.classList.add(this.classError);
103
+ this.errorMessage = this.messages.errors.required;
114
104
  }
115
105
  };
116
106
  /**
@@ -158,7 +148,9 @@ export class MgInputRadio {
158
148
  * @returns {ReturnType<typeof setTimeout>} timeout
159
149
  */
160
150
  componentWillLoad() {
161
- // Check items format
151
+ // Get locales
152
+ this.messages = initLocales(this.element).messages;
153
+ // Validate
162
154
  this.validateItems(this.items);
163
155
  // Check validity when component is ready
164
156
  // return a promise to process action only in the FIRST render().
@@ -173,7 +165,7 @@ export class MgInputRadio {
173
165
  * @returns {HTMLElement} HTML Element
174
166
  */
175
167
  render() {
176
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, width: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true },
168
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true },
177
169
  h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList } }, this.options.map((input, index) => (h("li", { class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } },
178
170
  h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: el => this.inputs.push(el) }),
179
171
  h("label", { htmlFor: this.identifier + '_' + index }, input.title)))))));
@@ -511,6 +503,7 @@ export class MgInputRadio {
511
503
  }
512
504
  }
513
505
  }; }
506
+ static get elementRef() { return "element"; }
514
507
  static get watchers() { return [{
515
508
  "propName": "value",
516
509
  "methodName": "handleValue"
@@ -1,16 +1,21 @@
1
1
  import { h } from '@stencil/core';
2
- import { messages } from '../../../../locales';
2
+ import { filterArgs } from '../../../../../../.storybook/utils';
3
+ import messages from '../../../../../locales/en/messages.json';
3
4
  export default {
4
5
  component: 'mg-input-select',
5
6
  title: 'Molecules/Inputs/mg-input-select',
6
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
7
7
  argTypes: {
8
8
  placeholder: {
9
9
  table: {
10
10
  defaultValue: { summary: messages.input.select.placeholder },
11
11
  },
12
12
  },
13
+ mgWidth: {
14
+ options: [undefined, 2, 4, 16, 'full'],
15
+ control: { type: 'select' },
16
+ },
13
17
  },
18
+ parameters: { actions: { handles: ['value-change', 'input-valid'] } },
14
19
  };
15
20
  /**
16
21
  * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
@@ -20,20 +25,7 @@ export default {
20
25
  * @returns {HTMLElement} HTMLElement
21
26
  */
22
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- const Template = (args) => {
24
- const labelOnTop = args.labelOnTop;
25
- delete args.labelOnTop;
26
- const labelHide = args.labelHide;
27
- delete args.labelHide;
28
- const helpText = args.helpText;
29
- delete args.helpText;
30
- const placeholderDisabled = args.placeholderDisabled;
31
- delete args.placeholderDisabled;
32
- const placeholderHide = args.placeholderHide;
33
- delete args.placeholderHide;
34
- // return element
35
- return (h("mg-input-select", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "placeholder-hide": placeholderHide, "placeholder-disabled": placeholderDisabled })));
36
- };
28
+ const Template = (args) => h("mg-input-select", Object.assign({}, filterArgs(args, { placeholder: messages.input.select.placeholder })));
37
29
  export const MgInputSelect = Template.bind({});
38
30
  MgInputSelect.args = {
39
31
  // Global
@@ -49,11 +41,13 @@ MgInputSelect.args = {
49
41
  readonly: false,
50
42
  disabled: false,
51
43
  items: ['blu', 'bli', 'blo', 'bla'],
44
+ mgWidth: undefined,
52
45
  // Tooltip
53
46
  tooltip: 'This is a tooltip',
54
47
  // Help Text
55
48
  helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
56
49
  // Placeholder
50
+ placeholder: undefined,
57
51
  placeholderHide: false,
58
52
  placeholderDisabled: false,
59
53
  };
@@ -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,6 +224,7 @@
222
224
  }
223
225
 
224
226
  .mg-input__box {
227
+ width: 100%;
225
228
  padding-top: 0;
226
229
  padding-bottom: 0;
227
230
  padding-right: 1rem;
@@ -1,17 +1,16 @@
1
1
  /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import { Component, Event, h, Prop, State, Watch, Method } from '@stencil/core';
3
+ import { Component, Element, Event, h, Prop, State, Watch, Method } from '@stencil/core';
4
4
  import { MgInput } from '../MgInput';
5
- import { InputClass } from '../MgInput.conf';
6
5
  import { createID, ClassList, allItemsAreString } from '../../../../utils/components.utils';
7
- import { messages } from '../../../../locales';
6
+ import { initLocales } from '../../../../locales';
8
7
  /**
9
8
  * Check if item is a well configured option
10
9
  *
11
10
  * @param {SelectOption} option select option
12
11
  * @returns {boolean} select option type is valid
13
12
  */
14
- const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
13
+ const isOption = (option) => typeof option === 'object' && typeof option.title === 'string';
15
14
  /**
16
15
  * Group options
17
16
  *
@@ -43,11 +42,8 @@ const groupOptions = (acc, { group, title, value, disabled }) => {
43
42
  };
44
43
  export class MgInputSelect {
45
44
  constructor() {
46
- /************
47
- * Internal *
48
- ************/
49
- // classes
50
- this.classError = InputClass.ERROR;
45
+ // hasError (triggered by blur event)
46
+ this.hasError = false;
51
47
  /**
52
48
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
53
49
  * If not set, it will be created.
@@ -62,11 +58,6 @@ export class MgInputSelect {
62
58
  * Define if label is visible
63
59
  */
64
60
  this.labelHide = false;
65
- /**
66
- * Input placeholder.
67
- * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.
68
- */
69
- this.placeholder = messages.input.select.placeholder;
70
61
  /**
71
62
  * Option to remove placeholder
72
63
  */
@@ -96,6 +87,9 @@ export class MgInputSelect {
96
87
  */
97
88
  this.handleInput = () => {
98
89
  this.checkValidity();
90
+ if (this.hasError) {
91
+ this.checkError();
92
+ }
99
93
  if (this.input.value !== '') {
100
94
  this.value = allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.title === this.input.value).value;
101
95
  }
@@ -107,8 +101,7 @@ export class MgInputSelect {
107
101
  * Handle blur event
108
102
  */
109
103
  this.handleBlur = () => {
110
- this.checkValidity();
111
- this.checkError();
104
+ this.displayError();
112
105
  };
113
106
  /**
114
107
  * Check if input is valid
@@ -130,14 +123,7 @@ export class MgInputSelect {
130
123
  // Set error message
131
124
  this.errorMessage = undefined;
132
125
  if (!this.valid && this.input.validity.valueMissing) {
133
- this.errorMessage = messages.errors.required;
134
- }
135
- // Update class
136
- if (this.valid) {
137
- this.classList.delete(this.classError);
138
- }
139
- else {
140
- this.classList.add(this.classError);
126
+ this.errorMessage = this.messages.errors.required;
141
127
  }
142
128
  };
143
129
  }
@@ -180,6 +166,7 @@ export class MgInputSelect {
180
166
  async displayError() {
181
167
  this.checkValidity();
182
168
  this.checkError();
169
+ this.hasError = this.invalid;
183
170
  }
184
171
  /*************
185
172
  * Lifecycle *
@@ -190,8 +177,14 @@ export class MgInputSelect {
190
177
  * @returns {ReturnType<typeof setTimeout>} timeout
191
178
  */
192
179
  componentWillLoad() {
193
- // Check items format
180
+ // Get locales
181
+ this.messages = initLocales(this.element).messages;
182
+ // Validate
194
183
  this.validateItems(this.items);
184
+ // Set default placeholder
185
+ if (this.placeholder === undefined || this.placeholder === '') {
186
+ this.placeholder = this.messages.input.select.placeholder;
187
+ }
195
188
  // Check validity when component is ready
196
189
  // return a promise to process action only in the FIRST render().
197
190
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
@@ -205,7 +198,7 @@ export class MgInputSelect {
205
198
  * @returns {HTMLElement} HTML Element
206
199
  */
207
200
  render() {
208
- 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 },
201
+ 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 },
209
202
  h("select", { class: "mg-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => (this.input = el) },
210
203
  (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
211
204
  h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)),
@@ -347,7 +340,7 @@ export class MgInputSelect {
347
340
  },
348
341
  "placeholder": {
349
342
  "type": "string",
350
- "mutable": false,
343
+ "mutable": true,
351
344
  "complexType": {
352
345
  "original": "string",
353
346
  "resolved": "string",
@@ -360,8 +353,7 @@ export class MgInputSelect {
360
353
  "text": "Input placeholder.\nIt should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text."
361
354
  },
362
355
  "attribute": "placeholder",
363
- "reflect": false,
364
- "defaultValue": "messages.input.select.placeholder"
356
+ "reflect": false
365
357
  },
366
358
  "placeholderHide": {
367
359
  "type": "boolean",
@@ -453,7 +445,7 @@ export class MgInputSelect {
453
445
  "reflect": false,
454
446
  "defaultValue": "false"
455
447
  },
456
- "width": {
448
+ "mgWidth": {
457
449
  "type": "any",
458
450
  "mutable": false,
459
451
  "complexType": {
@@ -472,7 +464,7 @@ export class MgInputSelect {
472
464
  "tags": [],
473
465
  "text": "Define input width"
474
466
  },
475
- "attribute": "width",
467
+ "attribute": "mg-width",
476
468
  "reflect": false
477
469
  },
478
470
  "tooltip": {
@@ -603,6 +595,7 @@ export class MgInputSelect {
603
595
  }
604
596
  }
605
597
  }; }
598
+ static get elementRef() { return "element"; }
606
599
  static get watchers() { return [{
607
600
  "propName": "value",
608
601
  "methodName": "handleValue"
@@ -1,32 +1,28 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../../.storybook/utils';
2
3
  export default {
3
4
  component: 'mg-input-text',
4
5
  title: 'Molecules/Inputs/mg-input-text',
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
21
  const Template = (args) => {
16
- const labelOnTop = args.labelOnTop;
17
- delete args.labelOnTop;
18
- const labelHide = args.labelHide;
19
- delete args.labelHide;
20
- const patternErrorMessage = args.patternErrorMessage;
21
- delete args.patternErrorMessage;
22
22
  const displayCharacterLeft = args.displayCharacterLeft;
23
23
  delete args.displayCharacterLeft;
24
- const characterLeftTemplate = args.characterLeftTemplate;
25
- delete args.characterLeftTemplate;
26
- const helpText = args.helpText;
27
- delete args.helpText;
28
24
  // return element
29
- return (h("mg-input-text", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "pattern-error-message": patternErrorMessage, "display-character-left": displayCharacterLeft ? 'true' : 'false', "character-left-template": characterLeftTemplate, "help-text": helpText })));
25
+ return h("mg-input-text", Object.assign({}, filterArgs(args), { "display-character-left": displayCharacterLeft ? undefined : 'false' }));
30
26
  };
31
27
  /**
32
28
  * Global use
@@ -49,11 +45,12 @@ MgInputText.args = {
49
45
  readonly: false,
50
46
  pattern: undefined,
51
47
  patternErrorMessage: undefined,
48
+ mgWidth: 'full',
49
+ type: 'text',
52
50
  // Tooltip
53
51
  tooltip: 'This is a tooltip',
54
52
  // Nb Char Left
55
53
  displayCharacterLeft: true,
56
- characterLeftTemplate: '{counter} characters left.',
57
54
  // Help Text
58
55
  helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
59
56
  };
@@ -96,22 +93,18 @@ URL.args = Object.assign(Object.assign({}, Emails.args), { label: 'URL',
96
93
  // Help Text
97
94
  helpText: 'Exemple: https://www.exemple.fr' });
98
95
  /**
99
- * Search
96
+ * Template
97
+ *
98
+ * @param {any} args component arguments
99
+ * @returns {HTMLElement} HTMLElement
100
100
  */
101
- const SearchTemplate = args => {
102
- const labelOnTop = args.labelOnTop;
103
- delete args.labelOnTop;
104
- const labelHide = args.labelHide;
105
- delete args.labelHide;
106
- const patternErrorMessage = args.patternErrorMessage;
107
- delete args.patternErrorMessage;
101
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
+ const SearchTemplate = (args) => {
108
103
  const displayCharacterLeft = args.displayCharacterLeft;
109
104
  delete args.displayCharacterLeft;
110
- const characterLeftTemplate = args.characterLeftTemplate;
111
- delete args.characterLeftTemplate;
112
105
  // return element
113
106
  return (h("form", { role: "search" },
114
- h("mg-input-text", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "pattern-error-message": patternErrorMessage, "display-character-left": displayCharacterLeft, "character-left-template": characterLeftTemplate }),
107
+ h("mg-input-text", Object.assign({}, filterArgs(args), { "display-character-left": displayCharacterLeft ? undefined : 'false' }),
115
108
  h("mg-button", { slot: "append-input", label: "search" },
116
109
  h("mg-icon", { icon: "magnifying-glass" }),
117
110
  " Search"))));
@@ -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]) {
@@ -201,13 +203,14 @@
201
203
  }
202
204
 
203
205
  /**
204
- * Manage display mg-character-left on focus
206
+ * Set mg-character-left with inputs
205
207
  */
206
208
  .mg-input mg-character-left {
207
- display: none;
209
+ opacity: 0.6;
210
+ font-size: 1.1rem;
208
211
  }
209
- .mg-input.is-focused mg-character-left {
210
- display: block;
212
+ .mg-input.mg-input--has-display-character-left .mg-input__input + .mg-input__help-text, .mg-input.mg-input--has-display-character-left .mg-input__input + .mg-input__error {
213
+ margin-top: 0;
211
214
  }
212
215
 
213
216
  /**
@@ -234,16 +237,37 @@
234
237
  /**
235
238
  * Icon in input
236
239
  */
237
- .mg-input.mg-input--has-icon .mg-input__input {
238
- position: relative;
239
- }
240
- .mg-input.mg-input--has-icon .mg-input__input > mg-icon {
240
+ .mg-input.mg-input--has-icon .mg-input__with-character-left > mg-icon {
241
241
  position: absolute;
242
- top: calc(var(--default-size) - var(--mg-icon-regular-size));
242
+ top: 50%;
243
243
  left: var(--mg-inputs-spacer);
244
244
  color: var(--mg-inputs-color);
245
245
  transform: translateY(-50%);
246
246
  }
247
- .mg-input.mg-input--has-icon .mg-input__input .mg-input__box {
247
+ .mg-input.mg-input--has-icon .mg-input__with-character-left .mg-input__box {
248
248
  padding-left: calc(var(--mg-icon-regular-size) + var(--mg-inputs-spacer) * 2);
249
+ }
250
+
251
+ /**
252
+ * Character left
253
+ */
254
+ .mg-input__with-character-left {
255
+ position: relative;
256
+ display: inline-flex;
257
+ width: 100%;
258
+ }
259
+ .mg-input.is-focused .mg-input__with-character-left .mg-input__box {
260
+ padding-right: calc(var(--mg-character-left-message-length) * 1ch + 0.8rem);
261
+ }
262
+ .mg-input__with-character-left mg-character-left {
263
+ position: absolute;
264
+ display: none;
265
+ top: 50%;
266
+ right: 1rem;
267
+ opacity: 0.6;
268
+ transform: translateY(-50%);
269
+ font-size: 1.1rem;
270
+ }
271
+ .mg-input.is-focused .mg-input__with-character-left mg-character-left {
272
+ display: block;
249
273
  }