@mgdis/mg-components 3.2.0 → 4.0.1

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 (228) hide show
  1. package/dist/cjs/{index-bead7dbd.js → index-88560a66.js} +47 -48
  2. package/dist/cjs/{index-369388eb.js → index-a39c5567.js} +97 -10
  3. package/dist/cjs/loader.cjs.js +3 -17
  4. package/dist/cjs/mg-badge_21.cjs.entry.js +519 -294
  5. package/dist/cjs/mg-components.cjs.js +3 -7
  6. package/dist/cjs/mg-modal.cjs.entry.js +12 -6
  7. package/dist/cjs/mg-popover.cjs.entry.js +15 -10
  8. package/dist/cjs/{popper-0c3964e7.js → popper-71bf3058.js} +6 -2
  9. package/dist/collection/collection-manifest.json +1 -1
  10. package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +1 -1
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
  12. package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -3
  13. package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +2 -2
  14. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
  15. package/dist/collection/components/atoms/mg-button/mg-button.css +20 -32
  16. package/dist/collection/components/atoms/mg-button/mg-button.js +8 -3
  17. package/dist/collection/components/atoms/mg-character-left/{mg-character-left.stories.js → doc/mg-character-left.stories.js} +1 -1
  18. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +10 -47
  19. package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +1 -1
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +97 -10
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.css +4 -0
  22. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  23. package/dist/collection/components/atoms/mg-input-title/{mg-input-title.stories.js → doc/mg-input-title.stories.js} +0 -0
  24. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +1 -1
  25. package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
  26. package/dist/collection/components/atoms/mg-tooltip/{mg-tooltip.stories.js → doc/mg-tooltip.stories.js} +14 -1
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +20 -0
  28. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -2
  29. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
  30. package/dist/collection/components/molecules/inputs/MgInput.js +5 -15
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +0 -0
  32. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +19 -13
  33. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -21
  34. package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +0 -0
  35. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +19 -18
  36. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +19 -18
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +9 -2
  38. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +20 -19
  39. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +43 -19
  40. package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +10 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +19 -18
  42. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -22
  43. package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +0 -0
  44. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +19 -13
  45. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +8 -15
  46. package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +10 -3
  47. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +20 -18
  48. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +24 -31
  49. package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +11 -7
  50. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +51 -28
  51. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +42 -43
  52. package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +10 -4
  53. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +51 -22
  54. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +66 -39
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.js → doc/mg-input-toggle.stories.js} +0 -0
  56. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +18 -9
  57. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +10 -4
  58. package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +0 -0
  59. package/dist/collection/components/molecules/mg-form/mg-form.css +4 -0
  60. package/dist/collection/components/molecules/mg-form/mg-form.js +5 -3
  61. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +1 -1
  62. package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
  63. package/dist/collection/components/molecules/mg-modal/{mg-modal.stories.js → doc/mg-modal.stories.js} +0 -0
  64. package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
  65. package/dist/collection/components/molecules/mg-modal/mg-modal.js +12 -5
  66. package/dist/collection/components/molecules/mg-pagination/{mg-pagination.stories.js → doc/mg-pagination.stories.js} +0 -0
  67. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
  68. package/dist/collection/components/molecules/mg-panel/{mg-panel.stories.js → doc/mg-panel.stories.js} +9 -1
  69. package/dist/collection/components/molecules/mg-panel/mg-panel.css +13 -4
  70. package/dist/collection/components/molecules/mg-panel/mg-panel.js +119 -18
  71. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +10 -0
  72. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  73. package/dist/collection/components/molecules/mg-popover/mg-popover.js +19 -9
  74. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +12 -5
  75. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
  76. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
  77. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +92 -27
  78. package/dist/collection/locales/index.js +33 -4
  79. package/dist/collection/stories/helpers.stories.js +33 -0
  80. package/dist/collection/utils/locale.utils.js +7 -4
  81. package/dist/collection/variables.css +9 -4
  82. package/dist/collection/variables.scss +9 -4
  83. package/dist/components/MgInput.js +6 -23
  84. package/dist/components/index.d.ts +23 -5
  85. package/dist/components/index.js +23 -0
  86. package/dist/components/index2.js +97 -8
  87. package/dist/components/locale.utils.js +7 -5
  88. package/dist/components/mg-badge2.js +16 -4
  89. package/dist/components/mg-button2.js +10 -5
  90. package/dist/components/mg-character-left2.js +4 -27
  91. package/dist/components/mg-form.js +6 -4
  92. package/dist/components/mg-icon2.js +120 -17
  93. package/dist/components/mg-input-checkbox.js +11 -27
  94. package/dist/components/mg-input-date.js +21 -25
  95. package/dist/components/mg-input-numeric.js +28 -26
  96. package/dist/components/mg-input-password.js +18 -28
  97. package/dist/components/mg-input-radio.js +10 -22
  98. package/dist/components/mg-input-select2.js +24 -35
  99. package/dist/components/mg-input-text2.js +38 -26
  100. package/dist/components/mg-input-textarea.js +44 -21
  101. package/dist/components/mg-input-toggle.js +11 -11
  102. package/dist/components/mg-message.js +16 -8
  103. package/dist/components/mg-modal.js +11 -5
  104. package/dist/components/mg-pagination.js +16 -22
  105. package/dist/components/mg-panel.js +51 -17
  106. package/dist/components/mg-popover.js +13 -8
  107. package/dist/components/mg-tabs.js +80 -22
  108. package/dist/components/mg-tag.js +20 -5
  109. package/dist/components/mg-tooltip2.js +1 -1
  110. package/dist/components/popper.js +6 -2
  111. package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
  112. package/dist/esm/{index-c346f52d.js → index-e51ae032.js} +97 -8
  113. package/dist/esm/loader.js +3 -17
  114. package/dist/esm/mg-badge_21.entry.js +516 -291
  115. package/dist/esm/mg-components.js +3 -7
  116. package/dist/esm/mg-modal.entry.js +12 -6
  117. package/dist/esm/mg-popover.entry.js +15 -10
  118. package/dist/esm/{popper-8874fd6c.js → popper-93ecb064.js} +6 -2
  119. package/dist/index.js +1 -1
  120. package/dist/mg-components/mg-components.css +1 -1
  121. package/dist/mg-components/mg-components.esm.js +1 -1
  122. package/dist/mg-components/p-462d648a.entry.js +1 -0
  123. package/dist/mg-components/p-4c66f794.js +1 -0
  124. package/dist/mg-components/p-5126ab10.entry.js +1 -0
  125. package/dist/mg-components/p-766c918b.entry.js +1 -0
  126. package/dist/mg-components/p-780bd52d.js +1 -0
  127. package/dist/mg-components/p-b14a3443.js +2 -0
  128. package/dist/mg-components/variables.css +9 -4
  129. package/dist/mg-components/variables.scss +9 -4
  130. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
  131. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
  132. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +0 -0
  133. package/dist/types/components/atoms/mg-button/mg-button.d.ts +1 -1
  134. package/dist/types/components/atoms/mg-character-left/{mg-character-left.stories.d.ts → doc/mg-character-left.stories.d.ts} +0 -0
  135. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
  136. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  137. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  138. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  139. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
  140. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
  141. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +29 -0
  142. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +8 -0
  143. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -1
  144. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
  145. package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
  146. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
  147. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
  148. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
  149. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
  150. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
  151. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
  152. package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
  153. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
  154. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
  155. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
  156. package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
  157. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
  158. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
  159. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
  160. package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +19 -0
  161. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +15 -7
  162. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
  163. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
  164. package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
  165. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -0
  166. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
  167. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
  168. package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
  169. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
  170. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
  171. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
  172. package/dist/types/components/molecules/{inputs/mg-input-textarea/mg-input-textarea.stories.d.ts → mg-panel/doc/mg-panel.stories.d.ts} +1 -1
  173. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +29 -0
  174. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +25 -0
  175. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  176. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +9 -1
  177. package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +5 -0
  178. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
  179. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +49 -0
  180. package/dist/types/components.d.ts +181 -151
  181. package/dist/types/locales/index.d.ts +109 -46
  182. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  183. package/dist/types/utils/locale.utils.d.ts +7 -3
  184. package/loader/index.js +1 -1
  185. package/package.json +14 -14
  186. package/readme.md +6 -35
  187. package/dist/cjs/css-shim-629916b0.js +0 -6
  188. package/dist/cjs/shadow-css-546083ef.js +0 -390
  189. package/dist/collection/stories/buttons.stories.js +0 -43
  190. package/dist/collection/stories/messages.stories.js +0 -44
  191. package/dist/collection/stories/tags.stories.js +0 -13
  192. package/dist/esm/css-shim-0993aa3b.js +0 -4
  193. package/dist/esm/shadow-css-dfa0587f.js +0 -388
  194. package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
  195. package/dist/esm-es5/index-9e877561.js +0 -1
  196. package/dist/esm-es5/index-c346f52d.js +0 -1
  197. package/dist/esm-es5/index.js +0 -0
  198. package/dist/esm-es5/loader.js +0 -1
  199. package/dist/esm-es5/mg-badge_21.entry.js +0 -2
  200. package/dist/esm-es5/mg-components.js +0 -1
  201. package/dist/esm-es5/mg-modal.entry.js +0 -1
  202. package/dist/esm-es5/mg-popover.entry.js +0 -1
  203. package/dist/esm-es5/popper-8874fd6c.js +0 -1
  204. package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
  205. package/dist/mg-components/mg-components.js +0 -132
  206. package/dist/mg-components/p-3633e9e1.system.entry.js +0 -2
  207. package/dist/mg-components/p-3c14153d.js +0 -1
  208. package/dist/mg-components/p-50ea2036.system.js +0 -1
  209. package/dist/mg-components/p-55a22b35.system.js +0 -1
  210. package/dist/mg-components/p-5e796581.js +0 -12
  211. package/dist/mg-components/p-656b5efb.system.js +0 -1
  212. package/dist/mg-components/p-68d6f104.js +0 -1
  213. package/dist/mg-components/p-6d49ed95.js +0 -1
  214. package/dist/mg-components/p-70177194.entry.js +0 -1
  215. package/dist/mg-components/p-8b2d8a2a.system.js +0 -13
  216. package/dist/mg-components/p-8cb61c3f.system.js +0 -1
  217. package/dist/mg-components/p-ace173b1.js +0 -1
  218. package/dist/mg-components/p-c46fbd54.entry.js +0 -1
  219. package/dist/mg-components/p-c90cc4bf.system.js +0 -1
  220. package/dist/mg-components/p-cd2a4acc.system.entry.js +0 -1
  221. package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
  222. package/dist/mg-components/p-dfe25da3.entry.js +0 -1
  223. package/dist/mg-components/p-e4a502b5.system.js +0 -1
  224. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  225. package/dist/types/components/molecules/mg-panel/mg-panel.stories.d.ts +0 -6
  226. package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
  227. package/dist/types/stories/messages.stories.d.ts +0 -13
  228. package/dist/types/stories/tags.stories.d.ts +0 -5
@@ -1,13 +1,12 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { I as InputClass, M as MgInput } from './MgInput.js';
2
+ import { M as MgInput } from './MgInput.js';
3
3
  import { c as createID, C as ClassList, a as allItemsAreString } from './components.utils.js';
4
- import { m as messages } from './index2.js';
5
- import { d as defineCustomElement$4 } from './mg-character-left2.js';
4
+ import { i as initLocales } from './index2.js';
6
5
  import { d as defineCustomElement$3 } from './mg-icon2.js';
7
6
  import { d as defineCustomElement$2 } from './mg-input-title2.js';
8
7
  import { d as defineCustomElement$1 } from './mg-tooltip2.js';
9
8
 
10
- const mgInputSelectCss = ":host{display:block}.mg-input{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input.is-not-valid{color:hsl(var(--color-danger))}.mg-input.is-not-valid .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input mg-input-title{-ms-flex-negative:var(--mg-inputs-shrink, 1);flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{-ms-flex-direction:column;flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{-ms-flex-negative:1;flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:-ms-inline-flexbox;display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:-ms-inline-flexbox;display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container mg-icon{display:-ms-flexbox;display:flex}.mg-input__input{display:-ms-flexbox;display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input+*{text-align:start;margin-top:0.5rem}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);width:100%;height:var(--default-size);-webkit-box-sizing:border-box;box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size)}.mg-input__box::-webkit-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::-moz-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:-ms-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::-ms-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{-webkit-box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5);box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0;--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius);--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){-ms-flex-pack:justify;justify-content:space-between}.mg-input.mg-input--width-full .mg-input__input-container{-ms-flex:auto;flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{width:100%}.mg-input.mg-input--width-16 .mg-input__box{width:21rem}.mg-input.mg-input--width-4 .mg-input__box{width:7rem}.mg-input.mg-input--width-2 .mg-input__box{width:5rem}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input__box{padding-top:0;padding-bottom:0;padding-right:1rem}";
9
+ const mgInputSelectCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container mg-icon{display:flex}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{width:100%}.mg-input.mg-input--width-16 .mg-input__box{width:21rem}.mg-input.mg-input--width-4 .mg-input__box{width:7rem}.mg-input.mg-input--width-2 .mg-input__box{width:5rem}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input__box{width:100%;padding-top:0;padding-bottom:0;padding-right:1rem}";
11
10
 
12
11
  /**
13
12
  * Check if item is a well configured option
@@ -15,7 +14,7 @@ const mgInputSelectCss = ":host{display:block}.mg-input{display:-ms-flexbox;disp
15
14
  * @param {SelectOption} option select option
16
15
  * @returns {boolean} select option type is valid
17
16
  */
18
- const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
17
+ const isOption = (option) => typeof option === 'object' && typeof option.title === 'string';
19
18
  /**
20
19
  * Group options
21
20
  *
@@ -52,11 +51,8 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
52
51
  this.__attachShadow();
53
52
  this.valueChange = createEvent(this, "value-change", 7);
54
53
  this.inputValid = createEvent(this, "input-valid", 7);
55
- /************
56
- * Internal *
57
- ************/
58
- // classes
59
- this.classError = InputClass.ERROR;
54
+ // hasError (triggered by blur event)
55
+ this.hasError = false;
60
56
  /**
61
57
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
62
58
  * If not set, it will be created.
@@ -71,11 +67,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
71
67
  * Define if label is visible
72
68
  */
73
69
  this.labelHide = false;
74
- /**
75
- * Input placeholder.
76
- * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.
77
- */
78
- this.placeholder = messages.input.select.placeholder;
79
70
  /**
80
71
  * Option to remove placeholder
81
72
  */
@@ -105,6 +96,9 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
105
96
  */
106
97
  this.handleInput = () => {
107
98
  this.checkValidity();
99
+ if (this.hasError) {
100
+ this.checkError();
101
+ }
108
102
  if (this.input.value !== '') {
109
103
  this.value = allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.title === this.input.value).value;
110
104
  }
@@ -116,8 +110,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
116
110
  * Handle blur event
117
111
  */
118
112
  this.handleBlur = () => {
119
- this.checkValidity();
120
- this.checkError();
113
+ this.displayError();
121
114
  };
122
115
  /**
123
116
  * Check if input is valid
@@ -139,14 +132,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
139
132
  // Set error message
140
133
  this.errorMessage = undefined;
141
134
  if (!this.valid && this.input.validity.valueMissing) {
142
- this.errorMessage = messages.errors.required;
143
- }
144
- // Update class
145
- if (this.valid) {
146
- this.classList.delete(this.classError);
147
- }
148
- else {
149
- this.classList.add(this.classError);
135
+ this.errorMessage = this.messages.errors.required;
150
136
  }
151
137
  };
152
138
  }
@@ -189,6 +175,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
189
175
  async displayError() {
190
176
  this.checkValidity();
191
177
  this.checkError();
178
+ this.hasError = this.invalid;
192
179
  }
193
180
  /*************
194
181
  * Lifecycle *
@@ -199,8 +186,14 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
199
186
  * @returns {ReturnType<typeof setTimeout>} timeout
200
187
  */
201
188
  componentWillLoad() {
202
- // Check items format
189
+ // Get locales
190
+ this.messages = initLocales(this.element).messages;
191
+ // Validate
203
192
  this.validateItems(this.items);
193
+ // Set default placeholder
194
+ if (this.placeholder === undefined || this.placeholder === '') {
195
+ this.placeholder = this.messages.input.select.placeholder;
196
+ }
204
197
  // Check validity when component is ready
205
198
  // return a promise to process action only in the FIRST render().
206
199
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
@@ -214,9 +207,10 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
214
207
  * @returns {HTMLElement} HTML Element
215
208
  */
216
209
  render() {
217
- 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 }, 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) }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
210
+ 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 }, 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) }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
218
211
  h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
219
212
  }
213
+ get element() { return this; }
220
214
  static get watchers() { return {
221
215
  "value": ["handleValue"],
222
216
  "items": ["validateItems"]
@@ -230,13 +224,13 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
230
224
  "label": [1],
231
225
  "labelOnTop": [4, "label-on-top"],
232
226
  "labelHide": [4, "label-hide"],
233
- "placeholder": [1],
227
+ "placeholder": [1025],
234
228
  "placeholderHide": [4, "placeholder-hide"],
235
229
  "placeholderDisabled": [4, "placeholder-disabled"],
236
230
  "required": [4],
237
231
  "readonly": [4],
238
232
  "disabled": [4],
239
- "width": [8],
233
+ "mgWidth": [8, "mg-width"],
240
234
  "tooltip": [1],
241
235
  "helpText": [1, "help-text"],
242
236
  "valid": [1028],
@@ -252,18 +246,13 @@ function defineCustomElement() {
252
246
  if (typeof customElements === "undefined") {
253
247
  return;
254
248
  }
255
- const components = ["mg-input-select", "mg-character-left", "mg-icon", "mg-input-title", "mg-tooltip"];
249
+ const components = ["mg-input-select", "mg-icon", "mg-input-title", "mg-tooltip"];
256
250
  components.forEach(tagName => { switch (tagName) {
257
251
  case "mg-input-select":
258
252
  if (!customElements.get(tagName)) {
259
253
  customElements.define(tagName, MgInputSelect);
260
254
  }
261
255
  break;
262
- case "mg-character-left":
263
- if (!customElements.get(tagName)) {
264
- defineCustomElement$4();
265
- }
266
- break;
267
256
  case "mg-icon":
268
257
  if (!customElements.get(tagName)) {
269
258
  defineCustomElement$3();
@@ -1,13 +1,13 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { I as InputClass, M as MgInput } from './MgInput.js';
2
+ import { M as MgInput } from './MgInput.js';
3
3
  import { c as createID, C as ClassList } from './components.utils.js';
4
- import { m as messages } from './index2.js';
4
+ import { i as initLocales } from './index2.js';
5
5
  import { d as defineCustomElement$4 } from './mg-character-left2.js';
6
6
  import { d as defineCustomElement$3 } from './mg-icon2.js';
7
7
  import { d as defineCustomElement$2 } from './mg-input-title2.js';
8
8
  import { d as defineCustomElement$1 } from './mg-tooltip2.js';
9
9
 
10
- const mgInputTextCss = ":host{display:block}.mg-input{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input.is-not-valid{color:hsl(var(--color-danger))}.mg-input.is-not-valid .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input mg-input-title{-ms-flex-negative:var(--mg-inputs-shrink, 1);flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{-ms-flex-direction:column;flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{-ms-flex-negative:1;flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:-ms-inline-flexbox;display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:-ms-inline-flexbox;display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container mg-icon{display:-ms-flexbox;display:flex}.mg-input__input{display:-ms-flexbox;display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input+*{text-align:start;margin-top:0.5rem}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);width:100%;height:var(--default-size);-webkit-box-sizing:border-box;box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size)}.mg-input__box::-webkit-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::-moz-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:-ms-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::-ms-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{-webkit-box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5);box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0;--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius);--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){-ms-flex-pack:justify;justify-content:space-between}.mg-input.mg-input--width-full .mg-input__input-container{-ms-flex:auto;flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{width:100%}.mg-input.mg-input--width-16 .mg-input__box{width:21rem}.mg-input.mg-input--width-4 .mg-input__box{width:7rem}.mg-input.mg-input--width-2 .mg-input__box{width:5rem}.mg-input mg-character-left{display:none}.mg-input.is-focused mg-character-left{display:block}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input--has-icon .mg-input__input{position:relative}.mg-input.mg-input--has-icon .mg-input__input>mg-icon{position:absolute;top:calc(var(--default-size) - var(--mg-icon-regular-size));left:var(--mg-inputs-spacer);color:var(--mg-inputs-color);-webkit-transform:translateY(-50%);transform:translateY(-50%)}.mg-input.mg-input--has-icon .mg-input__input .mg-input__box{padding-left:calc(var(--mg-icon-regular-size) + var(--mg-inputs-spacer) * 2)}";
10
+ const mgInputTextCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container mg-icon{display:flex}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{width:100%}.mg-input.mg-input--width-16 .mg-input__box{width:21rem}.mg-input.mg-input--width-4 .mg-input__box{width:7rem}.mg-input.mg-input--width-2 .mg-input__box{width:5rem}.mg-input mg-character-left{opacity:0.6;font-size:1.1rem}.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{margin-top:0}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input--has-icon .mg-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-inputs-spacer);color:var(--mg-inputs-color);transform:translateY(-50%)}.mg-input.mg-input--has-icon .mg-input__with-character-left .mg-input__box{padding-left:calc(var(--mg-icon-regular-size) + var(--mg-inputs-spacer) * 2)}.mg-input__with-character-left{position:relative;display:inline-flex;width:100%}.mg-input.is-focused .mg-input__with-character-left .mg-input__box{padding-right:calc(var(--mg-character-left-message-length) * 1ch + 0.8rem)}.mg-input__with-character-left mg-character-left{position:absolute;display:none;top:50%;right:1rem;opacity:0.6;transform:translateY(-50%);font-size:1.1rem}.mg-input.is-focused .mg-input__with-character-left mg-character-left{display:block}";
11
11
 
12
12
  const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
13
13
  constructor() {
@@ -21,8 +21,10 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
21
21
  ************/
22
22
  // classes
23
23
  this.classFocus = 'is-focused';
24
- this.isInputGroupAppend = 'mg-input--is-input-group-append';
25
- this.classError = InputClass.ERROR;
24
+ this.classIsInputGroupAppend = 'mg-input--is-input-group-append';
25
+ this.classHasIcon = 'mg-input--has-icon';
26
+ // hasError (triggered by blur event)
27
+ this.hasError = false;
26
28
  /**
27
29
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
28
30
  * If not set, it will be created.
@@ -60,7 +62,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
60
62
  /**
61
63
  * Define input width
62
64
  */
63
- this.width = 'full';
65
+ this.mgWidth = 'full';
64
66
  /**
65
67
  * Define if component should display character left
66
68
  */
@@ -76,6 +78,9 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
76
78
  */
77
79
  this.handleInput = () => {
78
80
  this.checkValidity();
81
+ if (this.hasError) {
82
+ this.checkError();
83
+ }
79
84
  this.value = this.input.value;
80
85
  };
81
86
  /**
@@ -96,9 +101,8 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
96
101
  // Manage focus
97
102
  this.classList.delete(this.classFocus);
98
103
  this.classList = new ClassList(this.classList.classes);
99
- // Check validity
100
- this.checkValidity();
101
- this.checkError();
104
+ // Display Error
105
+ this.displayError();
102
106
  };
103
107
  /**
104
108
  * Check if input is valid
@@ -129,14 +133,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
129
133
  }
130
134
  // required
131
135
  else if (!this.valid && this.input.validity.valueMissing) {
132
- this.errorMessage = messages.errors.required;
133
- }
134
- // Update class
135
- if (this.valid) {
136
- this.classList.delete(this.classError);
137
- }
138
- else {
139
- this.classList.add(this.classError);
136
+ this.errorMessage = this.messages.errors.required;
140
137
  }
141
138
  };
142
139
  /**
@@ -160,10 +157,10 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
160
157
  this.validateAppendSlot = () => {
161
158
  const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
162
159
  if (slotAppendInput.length === 1) {
163
- this.classList.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.isInputGroupAppend : 'mg-input--is-append-input-slot-content');
160
+ this.classList.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-input--is-append-input-slot-content');
164
161
  }
165
162
  else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
166
- this.classList.add(this.isInputGroupAppend);
163
+ this.classList.add(this.classIsInputGroupAppend);
167
164
  this.classList.add('mg-input--has-buttons-group-append');
168
165
  }
169
166
  };
@@ -171,6 +168,14 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
171
168
  handleValue(newValue) {
172
169
  this.valueChange.emit(newValue);
173
170
  }
171
+ validateIcon(newValue) {
172
+ if (newValue !== undefined) {
173
+ this.classList.add(this.classHasIcon);
174
+ }
175
+ else {
176
+ this.classList.delete(this.classHasIcon);
177
+ }
178
+ }
174
179
  /**
175
180
  * Public method to play input focus
176
181
  *
@@ -187,6 +192,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
187
192
  async displayError() {
188
193
  this.checkValidity();
189
194
  this.checkError();
195
+ this.hasError = this.invalid;
190
196
  }
191
197
  /*************
192
198
  * Lifecycle *
@@ -197,9 +203,11 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
197
203
  * @returns {ReturnType<typeof setTimeout>} timeout
198
204
  */
199
205
  componentWillLoad() {
200
- if (this.icon !== undefined) {
201
- this.classList.add('mg-input--has-icon');
202
- }
206
+ // Get locales
207
+ this.messages = initLocales(this.element).messages;
208
+ this.characterLeftId = `${this.identifier}-character-left`;
209
+ // Validate
210
+ this.validateIcon(this.icon);
203
211
  this.validatePattern();
204
212
  this.validateAppendSlot();
205
213
  // Check validity when component is ready
@@ -215,11 +223,16 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
215
223
  * @returns {HTMLElement} HTML Element
216
224
  */
217
225
  render() {
218
- 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: undefined, tooltip: this.tooltip, displayCharacterLeft: this.displayCharacterLeft, characterLeftTemplate: this.characterLeftTemplate, maxlength: this.maxlength, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { type: this.type, class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }), h("slot", { name: "append-input" })));
226
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [this.characterLeftId], 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: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left", style: {
227
+ '--mg-character-left-message-length': (this.displayCharacterLeft
228
+ ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
229
+ : 0).toString(),
230
+ } }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { type: this.type, class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }), this.displayCharacterLeft && this.maxlength && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), h("slot", { name: "append-input" })));
219
231
  }
220
232
  get element() { return this; }
221
233
  static get watchers() { return {
222
- "value": ["handleValue"]
234
+ "value": ["handleValue"],
235
+ "icon": ["validateIcon"]
223
236
  }; }
224
237
  static get style() { return mgInputTextCss; }
225
238
  }, [1, "mg-input-text", {
@@ -236,12 +249,11 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
236
249
  "required": [4],
237
250
  "readonly": [4],
238
251
  "disabled": [4],
239
- "width": [8],
252
+ "mgWidth": [8, "mg-width"],
240
253
  "pattern": [1],
241
254
  "patternErrorMessage": [1, "pattern-error-message"],
242
255
  "tooltip": [1],
243
256
  "displayCharacterLeft": [4, "display-character-left"],
244
- "characterLeftTemplate": [1, "character-left-template"],
245
257
  "helpText": [1, "help-text"],
246
258
  "valid": [1028],
247
259
  "invalid": [1028],
@@ -1,13 +1,13 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { I as InputClass, M as MgInput } from './MgInput.js';
2
+ import { M as MgInput } from './MgInput.js';
3
3
  import { c as createID, C as ClassList } from './components.utils.js';
4
- import { m as messages } from './index2.js';
4
+ import { i as initLocales } from './index2.js';
5
5
  import { d as defineCustomElement$5 } from './mg-character-left2.js';
6
6
  import { d as defineCustomElement$4 } from './mg-icon2.js';
7
7
  import { d as defineCustomElement$3 } from './mg-input-title2.js';
8
8
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
9
9
 
10
- const mgInputTextareaCss = ":host{display:block}.mg-input{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input.is-not-valid{color:hsl(var(--color-danger))}.mg-input.is-not-valid .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input mg-input-title{-ms-flex-negative:var(--mg-inputs-shrink, 1);flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{-ms-flex-direction:column;flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{-ms-flex-negative:1;flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:-ms-inline-flexbox;display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:-ms-inline-flexbox;display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container mg-icon{display:-ms-flexbox;display:flex}.mg-input__input{display:-ms-flexbox;display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input+*{text-align:start;margin-top:0.5rem}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);width:100%;height:var(--default-size);-webkit-box-sizing:border-box;box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size)}.mg-input__box::-webkit-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::-moz-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:-ms-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::-ms-input-placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{-webkit-box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5);box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0;--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius);--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){-ms-flex-pack:justify;justify-content:space-between}.mg-input.mg-input--width-full .mg-input__input-container{-ms-flex:auto;flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{width:100%}.mg-input.mg-input--width-16 .mg-input__box{width:21rem}.mg-input.mg-input--width-4 .mg-input__box{width:7rem}.mg-input.mg-input--width-2 .mg-input__box{width:5rem}.mg-input mg-character-left{display:none}.mg-input.is-focused mg-character-left{display:block}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input .mg-input__box{height:auto}@-moz-document url-prefix(){.mg-input__box{overflow-x:hidden}}";
10
+ const mgInputTextareaCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container mg-icon{display:flex}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{width:100%}.mg-input.mg-input--width-16 .mg-input__box{width:21rem}.mg-input.mg-input--width-4 .mg-input__box{width:7rem}.mg-input.mg-input--width-2 .mg-input__box{width:5rem}.mg-input mg-character-left{opacity:0.6;font-size:1.1rem}.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{margin-top:0}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input .mg-input__box{display:block;height:auto;resize:none}.mg-input .mg-input__box.mg-input__box--resizable{resize:both}.mg-input .mg-input__box.mg-input__box--resizable-horizontal{resize:horizontal}.mg-input .mg-input__box.mg-input__box--resizable-vertical{resize:vertical}.mg-input__with-character-left{width:100%}.mg-input__with-character-left mg-character-left{display:block;visibility:hidden;margin-top:0.2rem;text-align:end}.mg-input.is-focused .mg-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-input__box{overflow-x:hidden}}";
11
11
 
12
12
  const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
13
13
  constructor() {
@@ -21,7 +21,9 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
21
21
  ************/
22
22
  // classes
23
23
  this.classFocus = 'is-focused';
24
- this.classError = InputClass.ERROR;
24
+ this.classHasDisplayCharacterLeft = 'mg-input--has-display-character-left';
25
+ // hasError (triggered by blur event)
26
+ this.hasError = false;
25
27
  /**
26
28
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
27
29
  * If not set, it will be created.
@@ -55,15 +57,19 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
55
57
  /**
56
58
  * Define input width
57
59
  */
58
- this.width = 'full';
60
+ this.mgWidth = 'full';
59
61
  /**
60
- * Define input pattern error message
62
+ * Define the number of visible text lines for the control
61
63
  */
62
64
  this.rows = 3;
63
65
  /**
64
66
  * Define if component should display character left
65
67
  */
66
68
  this.displayCharacterLeft = true;
69
+ /**
70
+ * Define if input is resizable
71
+ */
72
+ this.resizable = 'none';
67
73
  /**
68
74
  * Component classes
69
75
  */
@@ -72,6 +78,10 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
72
78
  * Handle input event
73
79
  */
74
80
  this.handleInput = () => {
81
+ if (this.hasError) {
82
+ this.checkValidity();
83
+ this.checkError();
84
+ }
75
85
  this.value = this.input.value;
76
86
  };
77
87
  /**
@@ -88,9 +98,8 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
88
98
  // Manage focus
89
99
  this.classList.delete(this.classFocus);
90
100
  this.classList = new ClassList(this.classList.classes);
91
- // Check validity
92
- this.checkValidity();
93
- this.checkError();
101
+ // Display Error
102
+ this.displayError();
94
103
  };
95
104
  /**
96
105
  * Get pattern validity
@@ -124,14 +133,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
124
133
  }
125
134
  // required
126
135
  else if (!this.valid && this.input.validity.valueMissing) {
127
- this.errorMessage = messages.errors.required;
128
- }
129
- // Update class
130
- if (this.valid) {
131
- this.classList.delete(this.classError);
132
- }
133
- else {
134
- this.classList.add(this.classError);
136
+ this.errorMessage = this.messages.errors.required;
135
137
  }
136
138
  };
137
139
  /**
@@ -150,6 +152,14 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
150
152
  this.checkValidity();
151
153
  this.valueChange.emit(newValue);
152
154
  }
155
+ validateDisplayCharacterLeft(newValue) {
156
+ if (newValue) {
157
+ this.classList.add(this.classHasDisplayCharacterLeft);
158
+ }
159
+ else {
160
+ this.classList.delete(this.classHasDisplayCharacterLeft);
161
+ }
162
+ }
153
163
  /**
154
164
  * Public method to display errors
155
165
  *
@@ -158,6 +168,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
158
168
  async displayError() {
159
169
  this.checkValidity();
160
170
  this.checkError();
171
+ this.hasError = this.invalid;
161
172
  }
162
173
  /*************
163
174
  * Lifecycle *
@@ -168,6 +179,11 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
168
179
  * @returns {ReturnType<typeof setTimeout>} timeout
169
180
  */
170
181
  componentWillLoad() {
182
+ // Get locales
183
+ this.messages = initLocales(this.element).messages;
184
+ this.characterLeftId = `${this.identifier}-character-left`;
185
+ // Validate
186
+ this.validateDisplayCharacterLeft(this.displayCharacterLeft);
171
187
  this.validatePattern();
172
188
  // Check validity when component is ready
173
189
  // return a promise to process action only in the FIRST render().
@@ -182,10 +198,17 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
182
198
  * @returns {HTMLElement} HTML Element
183
199
  */
184
200
  render() {
185
- 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: undefined, tooltip: this.tooltip, displayCharacterLeft: this.displayCharacterLeft, characterLeftTemplate: this.characterLeftTemplate, maxlength: this.maxlength, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("textarea", { class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, rows: this.rows, maxlength: this.maxlength, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) })));
201
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [this.characterLeftId], 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: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left" }, h("textarea", { class: {
202
+ 'mg-input__box': true,
203
+ 'mg-input__box--resizable': this.resizable === 'both',
204
+ 'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',
205
+ 'mg-input__box--resizable-vertical': this.resizable === 'vertical',
206
+ }, value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, rows: this.rows, maxlength: this.maxlength, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }), this.displayCharacterLeft && this.maxlength && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength })))));
186
207
  }
208
+ get element() { return this; }
187
209
  static get watchers() { return {
188
- "value": ["handleValue"]
210
+ "value": ["handleValue"],
211
+ "displayCharacterLeft": ["validateDisplayCharacterLeft"]
189
212
  }; }
190
213
  static get style() { return mgInputTextareaCss; }
191
214
  }, [1, "mg-input-textarea", {
@@ -200,16 +223,16 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
200
223
  "required": [4],
201
224
  "readonly": [4],
202
225
  "disabled": [4],
203
- "width": [8],
226
+ "mgWidth": [8, "mg-width"],
204
227
  "pattern": [1],
205
228
  "patternErrorMessage": [1, "pattern-error-message"],
206
229
  "rows": [2],
207
230
  "tooltip": [1],
208
231
  "displayCharacterLeft": [4, "display-character-left"],
209
- "characterLeftTemplate": [1, "character-left-template"],
210
232
  "helpText": [1, "help-text"],
211
233
  "valid": [1028],
212
234
  "invalid": [1028],
235
+ "resizable": [1],
213
236
  "classList": [32],
214
237
  "errorMessage": [32],
215
238
  "displayError": [64]