@mgdis/mg-components 3.3.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) 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 +461 -281
  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 -6
  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.css +6 -30
  15. package/dist/collection/components/atoms/mg-button/mg-button.js +7 -2
  16. package/dist/collection/components/atoms/mg-character-left/{mg-character-left.stories.js → doc/mg-character-left.stories.js} +1 -1
  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} +1 -1
  19. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +86 -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/{mg-input-title.stories.js → doc/mg-input-title.stories.js} +0 -0
  23. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +1 -1
  24. package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
  25. package/dist/collection/components/atoms/mg-tooltip/{mg-tooltip.stories.js → doc/mg-tooltip.stories.js} +14 -1
  26. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +20 -0
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -2
  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} +0 -0
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +19 -13
  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} +0 -0
  34. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +19 -18
  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 -2
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +20 -19
  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 -1
  40. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +19 -18
  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} +0 -0
  43. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +19 -13
  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 -3
  46. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +20 -18
  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} +11 -7
  49. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +51 -28
  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} +10 -4
  52. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +51 -22
  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/{mg-input-toggle.stories.js → doc/mg-input-toggle.stories.js} +0 -0
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +18 -9
  56. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -3
  57. package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +0 -0
  58. package/dist/collection/components/molecules/mg-form/mg-form.css +4 -0
  59. package/dist/collection/components/molecules/mg-form/mg-form.js +5 -3
  60. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +1 -1
  61. package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
  62. package/dist/collection/components/molecules/mg-modal/{mg-modal.stories.js → doc/mg-modal.stories.js} +0 -0
  63. package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
  64. package/dist/collection/components/molecules/mg-modal/mg-modal.js +10 -4
  65. package/dist/collection/components/molecules/mg-pagination/{mg-pagination.stories.js → doc/mg-pagination.stories.js} +0 -0
  66. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
  67. package/dist/collection/components/molecules/mg-panel/{mg-panel.stories.js → doc/mg-panel.stories.js} +0 -0
  68. package/dist/collection/components/molecules/mg-panel/mg-panel.css +5 -1
  69. package/dist/collection/components/molecules/mg-panel/mg-panel.js +10 -9
  70. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +10 -0
  71. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  72. package/dist/collection/components/molecules/mg-popover/mg-popover.js +19 -5
  73. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +11 -5
  74. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
  75. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
  76. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +72 -26
  77. package/dist/collection/locales/index.js +33 -4
  78. package/dist/collection/stories/helpers.stories.js +33 -0
  79. package/dist/collection/utils/locale.utils.js +7 -4
  80. package/dist/collection/variables.css +10 -5
  81. package/dist/collection/variables.scss +10 -5
  82. package/dist/components/MgInput.js +6 -23
  83. package/dist/components/index.d.ts +23 -5
  84. package/dist/components/index.js +23 -0
  85. package/dist/components/index2.js +97 -8
  86. package/dist/components/locale.utils.js +7 -5
  87. package/dist/components/mg-badge2.js +16 -4
  88. package/dist/components/mg-button2.js +8 -3
  89. package/dist/components/mg-character-left2.js +4 -27
  90. package/dist/components/mg-form.js +6 -4
  91. package/dist/components/mg-icon2.js +109 -17
  92. package/dist/components/mg-input-checkbox.js +11 -27
  93. package/dist/components/mg-input-date.js +21 -25
  94. package/dist/components/mg-input-numeric.js +28 -26
  95. package/dist/components/mg-input-password.js +18 -28
  96. package/dist/components/mg-input-radio.js +10 -22
  97. package/dist/components/mg-input-select2.js +24 -35
  98. package/dist/components/mg-input-text2.js +38 -26
  99. package/dist/components/mg-input-textarea.js +43 -20
  100. package/dist/components/mg-input-toggle.js +11 -11
  101. package/dist/components/mg-message.js +16 -8
  102. package/dist/components/mg-modal.js +11 -5
  103. package/dist/components/mg-pagination.js +16 -22
  104. package/dist/components/mg-panel.js +8 -7
  105. package/dist/components/mg-popover.js +13 -4
  106. package/dist/components/mg-tabs.js +75 -21
  107. package/dist/components/mg-tag.js +20 -5
  108. package/dist/components/mg-tooltip2.js +1 -1
  109. package/dist/components/popper.js +6 -2
  110. package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
  111. package/dist/esm/{index-c346f52d.js → index-e51ae032.js} +97 -8
  112. package/dist/esm/loader.js +3 -17
  113. package/dist/esm/mg-badge_21.entry.js +458 -278
  114. package/dist/esm/mg-components.js +3 -7
  115. package/dist/esm/mg-modal.entry.js +12 -6
  116. package/dist/esm/mg-popover.entry.js +15 -6
  117. package/dist/esm/{popper-8874fd6c.js → popper-93ecb064.js} +6 -2
  118. package/dist/index.js +1 -1
  119. package/dist/mg-components/mg-components.css +1 -1
  120. package/dist/mg-components/mg-components.esm.js +1 -1
  121. package/dist/mg-components/p-003a1344.entry.js +1 -0
  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-780bd52d.js +1 -0
  126. package/dist/mg-components/p-b14a3443.js +2 -0
  127. package/dist/mg-components/variables.css +10 -5
  128. package/dist/mg-components/variables.scss +10 -5
  129. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
  130. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
  131. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +0 -0
  132. package/dist/types/components/atoms/mg-button/mg-button.d.ts +1 -1
  133. package/dist/types/components/atoms/mg-character-left/{mg-character-left.stories.d.ts → doc/mg-character-left.stories.d.ts} +0 -0
  134. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
  135. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  136. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  137. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  138. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
  139. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
  140. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +29 -0
  141. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +8 -0
  142. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -1
  143. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
  144. package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
  145. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
  146. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
  147. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
  148. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
  149. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
  150. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
  151. package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
  152. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
  153. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
  154. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
  155. package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
  156. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
  157. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
  158. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
  159. package/dist/types/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.d.ts → doc/mg-input-textarea.stories.d.ts} +8 -0
  160. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +14 -6
  161. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
  162. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
  163. package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
  164. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -0
  165. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
  166. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
  167. package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
  168. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
  169. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
  170. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
  171. package/dist/types/components/molecules/mg-panel/{mg-panel.stories.d.ts → doc/mg-panel.stories.d.ts} +0 -0
  172. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +5 -0
  173. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +25 -0
  174. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  175. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +9 -1
  176. package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +0 -0
  177. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
  178. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +44 -0
  179. package/dist/types/components.d.ts +149 -151
  180. package/dist/types/locales/index.d.ts +109 -46
  181. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  182. package/dist/types/utils/locale.utils.d.ts +7 -3
  183. package/loader/index.js +1 -1
  184. package/package.json +41 -14
  185. package/readme.md +6 -35
  186. package/dist/cjs/css-shim-629916b0.js +0 -6
  187. package/dist/cjs/shadow-css-546083ef.js +0 -390
  188. package/dist/collection/stories/buttons.stories.js +0 -43
  189. package/dist/collection/stories/messages.stories.js +0 -44
  190. package/dist/collection/stories/tags.stories.js +0 -13
  191. package/dist/esm/css-shim-0993aa3b.js +0 -4
  192. package/dist/esm/shadow-css-dfa0587f.js +0 -388
  193. package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
  194. package/dist/esm-es5/index-9e877561.js +0 -1
  195. package/dist/esm-es5/index-c346f52d.js +0 -1
  196. package/dist/esm-es5/index.js +0 -0
  197. package/dist/esm-es5/loader.js +0 -1
  198. package/dist/esm-es5/mg-badge_21.entry.js +0 -2
  199. package/dist/esm-es5/mg-components.js +0 -1
  200. package/dist/esm-es5/mg-modal.entry.js +0 -1
  201. package/dist/esm-es5/mg-popover.entry.js +0 -1
  202. package/dist/esm-es5/popper-8874fd6c.js +0 -1
  203. package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
  204. package/dist/mg-components/mg-components.js +0 -132
  205. package/dist/mg-components/p-136c8d6f.system.entry.js +0 -2
  206. package/dist/mg-components/p-3c14153d.js +0 -1
  207. package/dist/mg-components/p-50ea2036.system.js +0 -1
  208. package/dist/mg-components/p-55a22b35.system.js +0 -1
  209. package/dist/mg-components/p-5e796581.js +0 -12
  210. package/dist/mg-components/p-656b5efb.system.js +0 -1
  211. package/dist/mg-components/p-68d6f104.js +0 -1
  212. package/dist/mg-components/p-6d49ed95.js +0 -1
  213. package/dist/mg-components/p-6f173f62.system.entry.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-b7488a4c.entry.js +0 -1
  219. package/dist/mg-components/p-c1ffb2e1.entry.js +0 -1
  220. package/dist/mg-components/p-c90cc4bf.system.js +0 -1
  221. package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
  222. package/dist/mg-components/p-e4a502b5.system.js +0 -1
  223. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  224. package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
  225. package/dist/types/stories/messages.stories.d.ts +0 -13
  226. package/dist/types/stories/tags.stories.d.ts +0 -5
@@ -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,7 +57,7 @@ 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
62
  * Define the number of visible text lines for the control
61
63
  */
@@ -64,6 +66,10 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
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]
@@ -1,12 +1,11 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
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 { d as defineCustomElement$5 } from './mg-character-left2.js';
5
4
  import { d as defineCustomElement$4 } from './mg-icon2.js';
6
5
  import { d as defineCustomElement$3 } from './mg-input-title2.js';
7
6
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
8
7
 
9
- const mgInputToggleCss = ":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}.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.mg-input--toggle .mg-input__input-container{-ms-flex:auto;flex:auto;min-width:0}.mg-input__button-toggle{display:-ms-flexbox;display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:-ms-flexbox;display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:-ms-flexbox;display:flex}.mg-input.mg-input--toggle-disabled .mg-input__button-toggle{opacity:0.3}";
8
+ const mgInputToggleCss = ":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))}.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.mg-input--toggle .mg-input__input-container{flex:auto;min-width:0}.mg-input__button-toggle{display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:flex;justify-content:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:flex}.mg-input.mg-input--toggle-disabled .mg-input__button-toggle{opacity:0.3}";
10
9
 
11
10
  /**
12
11
  * type Option validation function
@@ -29,6 +28,8 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
29
28
  this.classReadonly = 'mg-input--toggle-readonly';
30
29
  this.classDisabled = 'mg-input--toggle-disabled';
31
30
  this.classIsActive = 'mg-input--toggle-is-active';
31
+ this.classOnOff = 'mg-input--toggle-on-off';
32
+ this.classIcon = 'mg-input--toggle-icon';
32
33
  /**
33
34
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
34
35
  * If not set, it will be created.
@@ -116,11 +117,15 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
116
117
  }
117
118
  handleIsOnOff(newValue) {
118
119
  if (newValue)
119
- this.classList.add(`mg-input--toggle-on-off`);
120
+ this.classList.add(this.classOnOff);
121
+ else
122
+ this.classList.delete(this.classOnOff);
120
123
  }
121
124
  handleIsIcon(newValue) {
122
125
  if (newValue)
123
- this.classList.add(`mg-input--toggle-icon`);
126
+ this.classList.add(this.classIcon);
127
+ else
128
+ this.classList.delete(this.classIcon);
124
129
  }
125
130
  handleReadonly(newValue) {
126
131
  if (newValue)
@@ -183,7 +188,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
183
188
  * @returns {HTMLElement} HTML Element
184
189
  */
185
190
  render() {
186
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, width: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
191
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
187
192
  }
188
193
  get element() { return this; }
189
194
  static get watchers() { return {
@@ -218,18 +223,13 @@ function defineCustomElement$1() {
218
223
  if (typeof customElements === "undefined") {
219
224
  return;
220
225
  }
221
- const components = ["mg-input-toggle", "mg-character-left", "mg-icon", "mg-input-title", "mg-tooltip"];
226
+ const components = ["mg-input-toggle", "mg-icon", "mg-input-title", "mg-tooltip"];
222
227
  components.forEach(tagName => { switch (tagName) {
223
228
  case "mg-input-toggle":
224
229
  if (!customElements.get(tagName)) {
225
230
  customElements.define(tagName, MgInputToggle$1);
226
231
  }
227
232
  break;
228
- case "mg-character-left":
229
- if (!customElements.get(tagName)) {
230
- defineCustomElement$5();
231
- }
232
- break;
233
233
  case "mg-icon":
234
234
  if (!customElements.get(tagName)) {
235
235
  defineCustomElement$4();
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { c as createID, C as ClassList } from './components.utils.js';
3
- import { m as messages } from './index2.js';
3
+ import { i as initLocales } from './index2.js';
4
4
  import { d as defineCustomElement$3 } from './mg-button2.js';
5
5
  import { d as defineCustomElement$2 } from './mg-icon2.js';
6
6
 
@@ -9,7 +9,7 @@ import { d as defineCustomElement$2 } from './mg-icon2.js';
9
9
  */
10
10
  const variants = ['info', 'warning', 'success', 'danger'];
11
11
 
12
- const mgMessageCss = ".mg-message{display:inline-block;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;min-height:var(--default-size);overflow:hidden;background-color:white;border-radius:var(--mg-message-border-radius);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}.mg-message::before{content:\"\";position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info::before{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning::before{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success::before{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger::before{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{padding-right:3.4rem}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-line-pack:stretch;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{-ms-flex-positive:1;flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message,mg-message{max-width:100%}";
12
+ const mgMessageCss = ".mg-message{display:inline-block;position:relative;box-sizing:border-box;min-height:var(--default-size);overflow:hidden;background-color:white;border-radius:var(--mg-message-border-radius);box-shadow:var(--box-shadow)}.mg-message::before{content:\"\";position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info::before{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning::before{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success::before{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger::before{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{padding-right:3.4rem}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message,mg-message{max-width:100%}";
13
13
 
14
14
  const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
15
  constructor() {
@@ -21,6 +21,9 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
21
21
  /************
22
22
  * Internal *
23
23
  ************/
24
+ // classes
25
+ this.classHide = 'mg-message--hide';
26
+ // IDs
24
27
  this.closeButtonId = '';
25
28
  // Stored timer setted when hide action is run from setTimeOut
26
29
  this.storedTimer = null;
@@ -94,10 +97,12 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
94
97
  if (!variants.includes(newValue)) {
95
98
  throw new Error(`<mg-message> prop "variant" must be one of : ${variants.join(', ')}`);
96
99
  }
97
- if (oldValue !== undefined) {
98
- this.classList.delete(`mg-message--${oldValue}`);
100
+ else {
101
+ if (oldValue !== undefined) {
102
+ this.classList.delete(`mg-message--${oldValue}`);
103
+ }
104
+ this.classList.add(`mg-message--${newValue}`);
99
105
  }
100
- this.classList.add(`mg-message--${this.variant}`);
101
106
  }
102
107
  validateCloseButton(newValue) {
103
108
  if (newValue && this.hasActions) {
@@ -108,11 +113,11 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
108
113
  validateHide(newValue) {
109
114
  if (newValue) {
110
115
  this.componentHide.emit();
111
- this.classList.add('mg-message--hide');
116
+ this.classList.add(this.classHide);
112
117
  }
113
118
  else {
114
119
  this.componentShow.emit();
115
- this.classList.delete('mg-message--hide');
120
+ this.classList.delete(this.classHide);
116
121
  }
117
122
  this.hideWithDelay();
118
123
  }
@@ -123,6 +128,9 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
123
128
  * Check if component props are well configured on init
124
129
  */
125
130
  componentWillLoad() {
131
+ // Get locales
132
+ this.messages = initLocales(this.element).messages;
133
+ // Validate
126
134
  this.validateVariant(this.variant);
127
135
  // Check if close button is an can be activated
128
136
  this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
@@ -140,7 +148,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
140
148
  * @returns {HTMLElement} HTML Element
141
149
  */
142
150
  render() {
143
- return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" }))))));
151
+ return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" }))))));
144
152
  }
145
153
  get element() { return this; }
146
154
  static get watchers() { return {
@@ -1,10 +1,10 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { c as createID, C as ClassList } from './components.utils.js';
3
- import { m as messages } from './index2.js';
3
+ import { i as initLocales } from './index2.js';
4
4
  import { d as defineCustomElement$3 } from './mg-button2.js';
5
5
  import { d as defineCustomElement$2 } from './mg-icon2.js';
6
6
 
7
- const mgModalCss = ".mg-modal{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 70%)}.mg-modal__dialog{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:none;flex:none;-ms-flex-item-align:center;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-width:100%;max-height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:hsl(var(--color-light));-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__content{overflow-y:auto}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal .mg-modal__content ::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
7
+ const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal .mg-modal__content{overflow-y:auto}.mg-modal .mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
8
8
 
9
9
  const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
10
  constructor() {
@@ -16,6 +16,9 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
16
16
  /************
17
17
  * Internal *
18
18
  ************/
19
+ // Classes
20
+ this.classHide = 'mg-modal--hide';
21
+ // IDs
19
22
  this.closeButtonId = '';
20
23
  this.titleId = '';
21
24
  /**
@@ -58,11 +61,11 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
58
61
  validateHide(newValue) {
59
62
  if (newValue) {
60
63
  this.componentHide.emit();
61
- this.classList.add('mg-modal--hide');
64
+ this.classList.add(this.classHide);
62
65
  }
63
66
  else {
64
67
  this.componentShow.emit();
65
- this.classList.delete('mg-modal--hide');
68
+ this.classList.delete(this.classHide);
66
69
  }
67
70
  }
68
71
  /**
@@ -86,6 +89,9 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
86
89
  * @returns {void}
87
90
  */
88
91
  componentWillLoad() {
92
+ // Get locales
93
+ this.messages = initLocales(this.element).messages;
94
+ // Validate
89
95
  this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
90
96
  this.hasContent = this.element.querySelector('[slot="content"]') !== null;
91
97
  if (this.closeButton) {
@@ -100,7 +106,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
100
106
  * @returns {HTMLElement} HTML Element
101
107
  */
102
108
  render() {
103
- return (h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("article", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" }))))));
109
+ return (h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("article", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" }))))));
104
110
  }
105
111
  get element() { return this; }
106
112
  static get watchers() { return {