@mgdis/mg-components 3.3.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist/.storybook/utils.js +24 -0
  2. package/dist/cjs/{index-369388eb.js → index-179621c8.js} +108 -10
  3. package/dist/cjs/{index-bead7dbd.js → index-88560a66.js} +47 -48
  4. package/dist/cjs/loader.cjs.js +3 -17
  5. package/dist/cjs/mg-badge_24.cjs.entry.js +5687 -0
  6. package/dist/cjs/mg-components.cjs.js +3 -7
  7. package/dist/cjs/mg-modal.cjs.entry.js +12 -6
  8. package/dist/collection/collection-manifest.json +3 -1
  9. package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +10 -6
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -3
  12. package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +16 -13
  13. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
  14. package/dist/collection/components/atoms/mg-button/mg-button.css +6 -30
  15. package/dist/collection/components/atoms/mg-button/mg-button.js +53 -22
  16. package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +20 -0
  17. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +10 -47
  18. package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +12 -4
  19. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +99 -10
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.css +4 -0
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  22. package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +21 -0
  23. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +10 -8
  24. package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
  25. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +58 -0
  26. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +26 -0
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +71 -13
  28. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
  29. package/dist/collection/components/molecules/inputs/MgInput.js +5 -15
  30. package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +3 -15
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +22 -15
  32. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -21
  33. package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +3 -12
  34. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +22 -20
  35. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +19 -18
  36. package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +9 -13
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +23 -21
  38. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +43 -19
  39. package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +10 -12
  40. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +22 -20
  41. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -22
  42. package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +3 -14
  43. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +22 -15
  44. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +8 -15
  45. package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +10 -16
  46. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +23 -20
  47. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +24 -31
  48. package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +18 -25
  49. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +54 -30
  50. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +42 -43
  51. package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +11 -14
  52. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +54 -24
  53. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +64 -37
  54. package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +57 -0
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +21 -11
  56. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +25 -10
  57. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +25 -0
  58. package/dist/collection/components/molecules/mg-details/mg-details.css +14 -0
  59. package/dist/collection/components/molecules/mg-details/mg-details.js +141 -0
  60. package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +9 -6
  61. package/dist/collection/components/molecules/mg-form/mg-form.css +5 -1
  62. package/dist/collection/components/molecules/mg-form/mg-form.js +53 -7
  63. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +22 -0
  64. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +37 -0
  65. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +74 -0
  66. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +10 -16
  67. package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
  68. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +43 -0
  69. package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
  70. package/dist/collection/components/molecules/mg-modal/mg-modal.js +10 -4
  71. package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +20 -0
  72. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
  73. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +29 -0
  74. package/dist/collection/components/molecules/mg-panel/mg-panel.css +4 -2
  75. package/dist/collection/components/molecules/mg-panel/mg-panel.js +12 -16
  76. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +22 -16
  77. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  78. package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
  79. package/dist/collection/components/molecules/mg-popover/mg-popover.js +43 -13
  80. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +20 -15
  81. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
  82. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
  83. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +75 -29
  84. package/dist/collection/locales/index.js +33 -4
  85. package/dist/collection/stories/helpers.stories.js +41 -0
  86. package/dist/collection/stories/icons.stories.js +10 -2
  87. package/dist/collection/stories/typography.stories.js +8 -1
  88. package/dist/collection/utils/components.utils.js +10 -0
  89. package/dist/collection/utils/locale.utils.js +7 -4
  90. package/dist/collection/variables.css +10 -5
  91. package/dist/collection/variables.scss +10 -5
  92. package/dist/components/MgInput.js +6 -23
  93. package/dist/components/components.utils.js +11 -1
  94. package/dist/components/index.d.ts +25 -5
  95. package/dist/components/index.js +25 -0
  96. package/dist/components/index2.js +97 -8
  97. package/dist/components/locale.utils.js +7 -5
  98. package/dist/components/mg-badge2.js +16 -4
  99. package/dist/components/mg-button2.js +14 -17
  100. package/dist/components/mg-character-left2.js +4 -27
  101. package/dist/components/mg-details.d.ts +11 -0
  102. package/dist/components/mg-details.js +87 -0
  103. package/dist/components/mg-form.js +40 -8
  104. package/dist/components/mg-icon2.js +122 -17
  105. package/dist/components/mg-illustrated-message.d.ts +11 -0
  106. package/dist/components/mg-illustrated-message.js +68 -0
  107. package/dist/components/mg-input-checkbox.js +11 -27
  108. package/dist/components/mg-input-date.js +21 -25
  109. package/dist/components/mg-input-numeric.js +28 -26
  110. package/dist/components/mg-input-password.js +18 -28
  111. package/dist/components/mg-input-radio.js +10 -22
  112. package/dist/components/mg-input-select2.js +24 -35
  113. package/dist/components/mg-input-text2.js +38 -26
  114. package/dist/components/mg-input-textarea.js +43 -20
  115. package/dist/components/mg-input-toggle.js +27 -18
  116. package/dist/components/mg-message.js +16 -8
  117. package/dist/components/mg-modal.js +11 -5
  118. package/dist/components/mg-pagination.js +16 -22
  119. package/dist/components/mg-panel.js +9 -12
  120. package/dist/components/mg-popover.js +22 -12
  121. package/dist/components/mg-tabs.js +77 -22
  122. package/dist/components/mg-tag.js +20 -5
  123. package/dist/components/mg-tooltip2.js +74 -12
  124. package/dist/components/popper.js +6 -2
  125. package/dist/esm/{index-c346f52d.js → index-7efedd97.js} +107 -8
  126. package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
  127. package/dist/esm/loader.js +3 -17
  128. package/dist/esm/mg-badge_24.entry.js +5660 -0
  129. package/dist/esm/mg-components.js +3 -7
  130. package/dist/esm/mg-modal.entry.js +12 -6
  131. package/dist/index.js +1 -1
  132. package/dist/mg-components/mg-components.css +1 -1
  133. package/dist/mg-components/mg-components.esm.js +1 -1
  134. package/dist/mg-components/p-5f89600c.js +1 -0
  135. package/dist/mg-components/p-a2883dc7.entry.js +1 -0
  136. package/dist/mg-components/p-b14a3443.js +2 -0
  137. package/dist/mg-components/p-cffe0519.entry.js +1 -0
  138. package/dist/mg-components/variables.css +10 -5
  139. package/dist/mg-components/variables.scss +10 -5
  140. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
  141. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
  142. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +6 -0
  143. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +8 -0
  144. package/dist/types/components/atoms/mg-button/mg-button.d.ts +12 -1
  145. package/dist/types/{stories/tags.stories.d.ts → components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts} +2 -1
  146. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
  147. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  148. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  149. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  150. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
  151. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
  152. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +24 -0
  153. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +13 -0
  154. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +27 -2
  155. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
  156. package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
  157. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
  158. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
  159. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
  160. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
  161. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
  162. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
  163. package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
  164. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
  165. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
  166. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
  167. package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
  168. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
  169. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
  170. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
  171. package/dist/types/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.d.ts → doc/mg-input-textarea.stories.d.ts} +8 -0
  172. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +14 -6
  173. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
  174. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
  175. package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +11 -0
  176. package/dist/types/components/molecules/mg-details/mg-details.d.ts +49 -0
  177. package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
  178. package/dist/types/components/molecules/mg-form/mg-form.d.ts +14 -0
  179. package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +6 -0
  180. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +28 -0
  181. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
  182. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
  183. package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
  184. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
  185. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
  186. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
  187. package/dist/types/components/molecules/mg-panel/{mg-panel.stories.d.ts → doc/mg-panel.stories.d.ts} +0 -0
  188. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +5 -0
  189. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +28 -0
  190. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  191. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +15 -2
  192. package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +0 -0
  193. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
  194. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +44 -0
  195. package/dist/types/components.d.ts +240 -147
  196. package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +1 -0
  197. package/dist/types/locales/index.d.ts +109 -46
  198. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  199. package/dist/types/utils/components.utils.d.ts +8 -0
  200. package/dist/types/utils/locale.utils.d.ts +7 -3
  201. package/loader/index.js +1 -1
  202. package/package.json +16 -16
  203. package/readme.md +6 -35
  204. package/dist/cjs/css-shim-629916b0.js +0 -6
  205. package/dist/cjs/mg-badge_21.cjs.entry.js +0 -3358
  206. package/dist/cjs/mg-popover.cjs.entry.js +0 -161
  207. package/dist/cjs/popper-0c3964e7.js +0 -1786
  208. package/dist/cjs/shadow-css-546083ef.js +0 -390
  209. package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +0 -23
  210. package/dist/collection/components/atoms/mg-input-title/mg-input-title.stories.js +0 -21
  211. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.stories.js +0 -26
  212. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +0 -78
  213. package/dist/collection/components/molecules/mg-modal/mg-modal.stories.js +0 -51
  214. package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +0 -24
  215. package/dist/collection/components/molecules/mg-panel/mg-panel.stories.js +0 -39
  216. package/dist/collection/stories/buttons.stories.js +0 -43
  217. package/dist/collection/stories/messages.stories.js +0 -44
  218. package/dist/collection/stories/tags.stories.js +0 -13
  219. package/dist/esm/css-shim-0993aa3b.js +0 -4
  220. package/dist/esm/mg-badge_21.entry.js +0 -3334
  221. package/dist/esm/mg-popover.entry.js +0 -157
  222. package/dist/esm/popper-8874fd6c.js +0 -1784
  223. package/dist/esm/shadow-css-dfa0587f.js +0 -388
  224. package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
  225. package/dist/esm-es5/index-9e877561.js +0 -1
  226. package/dist/esm-es5/index-c346f52d.js +0 -1
  227. package/dist/esm-es5/index.js +0 -0
  228. package/dist/esm-es5/loader.js +0 -1
  229. package/dist/esm-es5/mg-badge_21.entry.js +0 -2
  230. package/dist/esm-es5/mg-components.js +0 -1
  231. package/dist/esm-es5/mg-modal.entry.js +0 -1
  232. package/dist/esm-es5/mg-popover.entry.js +0 -1
  233. package/dist/esm-es5/popper-8874fd6c.js +0 -1
  234. package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
  235. package/dist/mg-components/mg-components.js +0 -132
  236. package/dist/mg-components/p-136c8d6f.system.entry.js +0 -2
  237. package/dist/mg-components/p-3c14153d.js +0 -1
  238. package/dist/mg-components/p-50ea2036.system.js +0 -1
  239. package/dist/mg-components/p-55a22b35.system.js +0 -1
  240. package/dist/mg-components/p-5e796581.js +0 -12
  241. package/dist/mg-components/p-656b5efb.system.js +0 -1
  242. package/dist/mg-components/p-68d6f104.js +0 -1
  243. package/dist/mg-components/p-6d49ed95.js +0 -1
  244. package/dist/mg-components/p-6f173f62.system.entry.js +0 -1
  245. package/dist/mg-components/p-70177194.entry.js +0 -1
  246. package/dist/mg-components/p-8b2d8a2a.system.js +0 -13
  247. package/dist/mg-components/p-8cb61c3f.system.js +0 -1
  248. package/dist/mg-components/p-ace173b1.js +0 -1
  249. package/dist/mg-components/p-b7488a4c.entry.js +0 -1
  250. package/dist/mg-components/p-c1ffb2e1.entry.js +0 -1
  251. package/dist/mg-components/p-c90cc4bf.system.js +0 -1
  252. package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
  253. package/dist/mg-components/p-e4a502b5.system.js +0 -1
  254. package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +0 -16
  255. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  256. package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
  257. package/dist/types/stories/messages.stories.d.ts +0 -13
@@ -1,8 +1,7 @@
1
1
  import { Component, Event, h, Prop, State, Element, Method, Watch } from '@stencil/core';
2
2
  import { MgInput } from '../MgInput';
3
- import { InputClass } from '../MgInput.conf';
4
3
  import { createID, ClassList } from '../../../../utils/components.utils';
5
- import { messages } from '../../../../locales';
4
+ import { initLocales } from '../../../../locales';
6
5
  export class MgInputText {
7
6
  constructor() {
8
7
  /************
@@ -10,8 +9,10 @@ export class MgInputText {
10
9
  ************/
11
10
  // classes
12
11
  this.classFocus = 'is-focused';
13
- this.isInputGroupAppend = 'mg-input--is-input-group-append';
14
- this.classError = InputClass.ERROR;
12
+ this.classIsInputGroupAppend = 'mg-input--is-input-group-append';
13
+ this.classHasIcon = 'mg-input--has-icon';
14
+ // hasError (triggered by blur event)
15
+ this.hasError = false;
15
16
  /**
16
17
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
17
18
  * If not set, it will be created.
@@ -49,7 +50,7 @@ export class MgInputText {
49
50
  /**
50
51
  * Define input width
51
52
  */
52
- this.width = 'full';
53
+ this.mgWidth = 'full';
53
54
  /**
54
55
  * Define if component should display character left
55
56
  */
@@ -65,6 +66,9 @@ export class MgInputText {
65
66
  */
66
67
  this.handleInput = () => {
67
68
  this.checkValidity();
69
+ if (this.hasError) {
70
+ this.checkError();
71
+ }
68
72
  this.value = this.input.value;
69
73
  };
70
74
  /**
@@ -85,9 +89,8 @@ export class MgInputText {
85
89
  // Manage focus
86
90
  this.classList.delete(this.classFocus);
87
91
  this.classList = new ClassList(this.classList.classes);
88
- // Check validity
89
- this.checkValidity();
90
- this.checkError();
92
+ // Display Error
93
+ this.displayError();
91
94
  };
92
95
  /**
93
96
  * Check if input is valid
@@ -118,14 +121,7 @@ export class MgInputText {
118
121
  }
119
122
  // required
120
123
  else if (!this.valid && this.input.validity.valueMissing) {
121
- this.errorMessage = messages.errors.required;
122
- }
123
- // Update class
124
- if (this.valid) {
125
- this.classList.delete(this.classError);
126
- }
127
- else {
128
- this.classList.add(this.classError);
124
+ this.errorMessage = this.messages.errors.required;
129
125
  }
130
126
  };
131
127
  /**
@@ -149,10 +145,10 @@ export class MgInputText {
149
145
  this.validateAppendSlot = () => {
150
146
  const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
151
147
  if (slotAppendInput.length === 1) {
152
- this.classList.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.isInputGroupAppend : 'mg-input--is-append-input-slot-content');
148
+ this.classList.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-input--is-append-input-slot-content');
153
149
  }
154
150
  else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
155
- this.classList.add(this.isInputGroupAppend);
151
+ this.classList.add(this.classIsInputGroupAppend);
156
152
  this.classList.add('mg-input--has-buttons-group-append');
157
153
  }
158
154
  };
@@ -160,6 +156,14 @@ export class MgInputText {
160
156
  handleValue(newValue) {
161
157
  this.valueChange.emit(newValue);
162
158
  }
159
+ validateIcon(newValue) {
160
+ if (newValue !== undefined) {
161
+ this.classList.add(this.classHasIcon);
162
+ }
163
+ else {
164
+ this.classList.delete(this.classHasIcon);
165
+ }
166
+ }
163
167
  /**
164
168
  * Public method to play input focus
165
169
  *
@@ -176,6 +180,7 @@ export class MgInputText {
176
180
  async displayError() {
177
181
  this.checkValidity();
178
182
  this.checkError();
183
+ this.hasError = this.invalid;
179
184
  }
180
185
  /*************
181
186
  * Lifecycle *
@@ -186,9 +191,11 @@ export class MgInputText {
186
191
  * @returns {ReturnType<typeof setTimeout>} timeout
187
192
  */
188
193
  componentWillLoad() {
189
- if (this.icon !== undefined) {
190
- this.classList.add('mg-input--has-icon');
191
- }
194
+ // Get locales
195
+ this.messages = initLocales(this.element).messages;
196
+ this.characterLeftId = `${this.identifier}-character-left`;
197
+ // Validate
198
+ this.validateIcon(this.icon);
192
199
  this.validatePattern();
193
200
  this.validateAppendSlot();
194
201
  // Check validity when component is ready
@@ -204,9 +211,15 @@ export class MgInputText {
204
211
  * @returns {HTMLElement} HTML Element
205
212
  */
206
213
  render() {
207
- 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 },
208
- this.icon !== undefined && h("mg-icon", { icon: this.icon }),
209
- 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) }),
214
+ 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 },
215
+ h("div", { class: "mg-input__with-character-left", style: {
216
+ '--mg-character-left-message-length': (this.displayCharacterLeft
217
+ ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
218
+ : 0).toString(),
219
+ } },
220
+ this.icon !== undefined && h("mg-icon", { icon: this.icon }),
221
+ 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) }),
222
+ this.displayCharacterLeft && this.maxlength && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))),
210
223
  h("slot", { name: "append-input" })));
211
224
  }
212
225
  static get is() { return "mg-input-text"; }
@@ -447,7 +460,7 @@ export class MgInputText {
447
460
  "reflect": false,
448
461
  "defaultValue": "false"
449
462
  },
450
- "width": {
463
+ "mgWidth": {
451
464
  "type": "any",
452
465
  "mutable": false,
453
466
  "complexType": {
@@ -466,7 +479,7 @@ export class MgInputText {
466
479
  "tags": [],
467
480
  "text": "Define input width"
468
481
  },
469
- "attribute": "width",
482
+ "attribute": "mg-width",
470
483
  "reflect": false,
471
484
  "defaultValue": "'full'"
472
485
  },
@@ -539,23 +552,6 @@ export class MgInputText {
539
552
  "reflect": false,
540
553
  "defaultValue": "true"
541
554
  },
542
- "characterLeftTemplate": {
543
- "type": "string",
544
- "mutable": false,
545
- "complexType": {
546
- "original": "string",
547
- "resolved": "string",
548
- "references": {}
549
- },
550
- "required": false,
551
- "optional": false,
552
- "docs": {
553
- "tags": [],
554
- "text": "Template to use for characters left sentence"
555
- },
556
- "attribute": "character-left-template",
557
- "reflect": false
558
- },
559
555
  "helpText": {
560
556
  "type": "string",
561
557
  "mutable": false,
@@ -687,5 +683,8 @@ export class MgInputText {
687
683
  static get watchers() { return [{
688
684
  "propName": "value",
689
685
  "methodName": "handleValue"
686
+ }, {
687
+ "propName": "icon",
688
+ "methodName": "validateIcon"
690
689
  }]; }
691
690
  }
@@ -1,32 +1,28 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../../.storybook/utils';
2
3
  export default {
3
4
  component: 'mg-input-textarea',
4
5
  title: 'Molecules/Inputs/mg-input-textarea',
6
+ argTypes: {
7
+ mgWidth: {
8
+ options: [2, 4, 16, 'full'],
9
+ control: { type: 'select' },
10
+ },
11
+ },
5
12
  parameters: { actions: { handles: ['value-change', 'input-valid'] } },
6
13
  };
7
14
  /**
8
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
9
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
15
+ * Template
10
16
  *
11
17
  * @param {any} args component arguments
12
18
  * @returns {HTMLElement} HTMLElement
13
19
  */
14
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
21
  const Template = (args) => {
16
- const labelOnTop = args.labelOnTop;
17
- delete args.labelOnTop;
18
- const labelHide = args.labelHide;
19
- delete args.labelHide;
20
- const patternErrorMessage = args.patternErrorMessage;
21
- delete args.patternErrorMessage;
22
22
  const displayCharacterLeft = args.displayCharacterLeft;
23
23
  delete args.displayCharacterLeft;
24
- const characterLeftTemplate = args.characterLeftTemplate;
25
- delete args.characterLeftTemplate;
26
- const helpText = args.helpText;
27
- delete args.helpText;
28
24
  // return element
29
- return (h("mg-input-textarea", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "pattern-error-message": patternErrorMessage, "display-character-left": displayCharacterLeft ? 'true' : 'false', "character-left-template": characterLeftTemplate, "help-text": helpText })));
25
+ return h("mg-input-textarea", Object.assign({}, filterArgs(args), { "display-character-left": displayCharacterLeft ? undefined : 'false' }));
30
26
  };
31
27
  export const MgInputTextarea = Template.bind({});
32
28
  MgInputTextarea.args = {
@@ -47,11 +43,12 @@ MgInputTextarea.args = {
47
43
  pattern: undefined,
48
44
  patternErrorMessage: undefined,
49
45
  rows: 3,
46
+ mgWidth: 'full',
47
+ resizable: 'none',
50
48
  // Tooltip
51
49
  tooltip: 'This is a tooltip',
52
50
  // Nb Char Left
53
51
  displayCharacterLeft: true,
54
- characterLeftTemplate: '{counter} characters left.',
55
52
  // Help Text
56
53
  helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
57
54
  };
@@ -11,16 +11,9 @@
11
11
  min-height: var(--default-size);
12
12
  max-width: 100%;
13
13
  margin-bottom: var(--mg-inputs-margin-bottom, 0);
14
- /* Style when input is not valid */
15
14
  /* Label */
16
15
  /* Label-on-top */
17
16
  }
18
- .mg-input.is-not-valid {
19
- color: hsl(var(--color-danger));
20
- }
21
- .mg-input.is-not-valid .mg-input__box {
22
- border-color: hsl(var(--color-danger));
23
- }
24
17
  .mg-input mg-input-title {
25
18
  flex-shrink: var(--mg-inputs-shrink, 1);
26
19
  width: var(--mg-inputs-title-width, auto);
@@ -71,8 +64,10 @@
71
64
  height: var(--mg-icon-regular-size);
72
65
  margin-left: var(--mg-inputs-spacer);
73
66
  }
74
- .mg-input__input-container mg-icon {
75
- display: flex;
67
+ .mg-input__input-container .mg-input__help-text,
68
+ .mg-input__input-container .mg-input__error {
69
+ text-align: start;
70
+ font-size: 1.2rem;
76
71
  }
77
72
 
78
73
  .mg-input__input {
@@ -82,11 +77,26 @@
82
77
  .mg-input__input mg-tooltip {
83
78
  margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
84
79
  }
85
- .mg-input__input + * {
86
- text-align: start;
80
+ .mg-input__input.mg-input__input--has-error .mg-input__box {
81
+ border-color: hsl(var(--color-danger));
82
+ }
83
+ .mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
87
84
  margin-top: 0.5rem;
88
85
  }
89
86
 
87
+ .mg-input__error {
88
+ display: inline-block;
89
+ margin-top: 0.2rem;
90
+ padding: 0.3rem 0.8rem;
91
+ border-radius: 0.3rem;
92
+ background: hsl(var(--mg-inputs-error-bg-color));
93
+ color: hsl(var(--color-danger));
94
+ }
95
+
96
+ .mg-input__input mg-icon, .mg-input__error mg-icon {
97
+ display: flex;
98
+ }
99
+
90
100
  /**
91
101
  * Style for input "box":
92
102
  * - input[type="text"]
@@ -97,7 +107,6 @@
97
107
  */
98
108
  .mg-input__box {
99
109
  padding: calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);
100
- width: 100%;
101
110
  height: var(--default-size);
102
111
  box-sizing: border-box;
103
112
  border-width: var(--mg-inputs-border-width);
@@ -108,6 +117,7 @@
108
117
  font-family: inherit;
109
118
  color: hsl(var(--color-dark));
110
119
  font-size: var(--font-size);
120
+ text-align: var(--mg-inputs-text-align, left);
111
121
  }
112
122
  .mg-input__box::placeholder {
113
123
  color: var(--mg-inputs-color);
@@ -155,10 +165,6 @@
155
165
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]) {
156
166
  --mg-button-border-radius-top-right: 0;
157
167
  --mg-button-border-radius-bottom-right: 0;
158
- --mg-button-border-radius-top-left: 0;
159
- /* IE FIX */
160
- --mg-button-border-radius-bottom-left: 0;
161
- /* IE FIX */
162
168
  }
163
169
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)) {
164
170
  --mg-button-border-right-width: 0;
@@ -166,10 +172,6 @@
166
172
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type) {
167
173
  --mg-button-border-radius-top-right: var(--mg-inputs-border-radius);
168
174
  --mg-button-border-radius-bottom-right: var(--mg-inputs-border-radius);
169
- --mg-button-border-radius-top-left: 0;
170
- /* IE FIX */
171
- --mg-button-border-radius-bottom-left: 0;
172
- /* IE FIX */
173
175
  }
174
176
 
175
177
  .mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]) {
@@ -201,13 +203,14 @@
201
203
  }
202
204
 
203
205
  /**
204
- * Manage display mg-character-left on focus
206
+ * Set mg-character-left with inputs
205
207
  */
206
208
  .mg-input mg-character-left {
207
- display: none;
209
+ opacity: 0.6;
210
+ font-size: 1.1rem;
208
211
  }
209
- .mg-input.is-focused mg-character-left {
210
- display: block;
212
+ .mg-input.mg-input--has-display-character-left .mg-input__input + .mg-input__help-text, .mg-input.mg-input--has-display-character-left .mg-input__input + .mg-input__error {
213
+ margin-top: 0;
211
214
  }
212
215
 
213
216
  /**
@@ -233,7 +236,34 @@
233
236
 
234
237
  /* Component Custom Style */
235
238
  .mg-input .mg-input__box {
239
+ display: block;
236
240
  height: auto;
241
+ resize: none;
242
+ }
243
+ .mg-input .mg-input__box.mg-input__box--resizable {
244
+ resize: both;
245
+ }
246
+ .mg-input .mg-input__box.mg-input__box--resizable-horizontal {
247
+ resize: horizontal;
248
+ }
249
+ .mg-input .mg-input__box.mg-input__box--resizable-vertical {
250
+ resize: vertical;
251
+ }
252
+
253
+ /**
254
+ * Character left
255
+ */
256
+ .mg-input__with-character-left {
257
+ width: 100%;
258
+ }
259
+ .mg-input__with-character-left mg-character-left {
260
+ display: block;
261
+ visibility: hidden;
262
+ margin-top: 0.2rem;
263
+ text-align: end;
264
+ }
265
+ .mg-input.is-focused .mg-input__with-character-left mg-character-left {
266
+ visibility: visible;
237
267
  }
238
268
 
239
269
  /* Firefox selector */
@@ -1,8 +1,7 @@
1
- import { Component, Event, h, Prop, State, Method, Watch } from '@stencil/core';
1
+ import { Component, Element, Event, h, Prop, State, Method, Watch } from '@stencil/core';
2
2
  import { MgInput } from '../MgInput';
3
- import { InputClass } from '../MgInput.conf';
4
3
  import { createID, ClassList } from '../../../../utils/components.utils';
5
- import { messages } from '../../../../locales';
4
+ import { initLocales } from '../../../../locales';
6
5
  export class MgInputTextarea {
7
6
  constructor() {
8
7
  /************
@@ -10,7 +9,9 @@ export class MgInputTextarea {
10
9
  ************/
11
10
  // classes
12
11
  this.classFocus = 'is-focused';
13
- this.classError = InputClass.ERROR;
12
+ this.classHasDisplayCharacterLeft = 'mg-input--has-display-character-left';
13
+ // hasError (triggered by blur event)
14
+ this.hasError = false;
14
15
  /**
15
16
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
16
17
  * If not set, it will be created.
@@ -44,7 +45,7 @@ export class MgInputTextarea {
44
45
  /**
45
46
  * Define input width
46
47
  */
47
- this.width = 'full';
48
+ this.mgWidth = 'full';
48
49
  /**
49
50
  * Define the number of visible text lines for the control
50
51
  */
@@ -53,6 +54,10 @@ export class MgInputTextarea {
53
54
  * Define if component should display character left
54
55
  */
55
56
  this.displayCharacterLeft = true;
57
+ /**
58
+ * Define if input is resizable
59
+ */
60
+ this.resizable = 'none';
56
61
  /**
57
62
  * Component classes
58
63
  */
@@ -61,6 +66,10 @@ export class MgInputTextarea {
61
66
  * Handle input event
62
67
  */
63
68
  this.handleInput = () => {
69
+ if (this.hasError) {
70
+ this.checkValidity();
71
+ this.checkError();
72
+ }
64
73
  this.value = this.input.value;
65
74
  };
66
75
  /**
@@ -77,9 +86,8 @@ export class MgInputTextarea {
77
86
  // Manage focus
78
87
  this.classList.delete(this.classFocus);
79
88
  this.classList = new ClassList(this.classList.classes);
80
- // Check validity
81
- this.checkValidity();
82
- this.checkError();
89
+ // Display Error
90
+ this.displayError();
83
91
  };
84
92
  /**
85
93
  * Get pattern validity
@@ -113,14 +121,7 @@ export class MgInputTextarea {
113
121
  }
114
122
  // required
115
123
  else if (!this.valid && this.input.validity.valueMissing) {
116
- this.errorMessage = messages.errors.required;
117
- }
118
- // Update class
119
- if (this.valid) {
120
- this.classList.delete(this.classError);
121
- }
122
- else {
123
- this.classList.add(this.classError);
124
+ this.errorMessage = this.messages.errors.required;
124
125
  }
125
126
  };
126
127
  /**
@@ -139,6 +140,14 @@ export class MgInputTextarea {
139
140
  this.checkValidity();
140
141
  this.valueChange.emit(newValue);
141
142
  }
143
+ validateDisplayCharacterLeft(newValue) {
144
+ if (newValue) {
145
+ this.classList.add(this.classHasDisplayCharacterLeft);
146
+ }
147
+ else {
148
+ this.classList.delete(this.classHasDisplayCharacterLeft);
149
+ }
150
+ }
142
151
  /**
143
152
  * Public method to display errors
144
153
  *
@@ -147,6 +156,7 @@ export class MgInputTextarea {
147
156
  async displayError() {
148
157
  this.checkValidity();
149
158
  this.checkError();
159
+ this.hasError = this.invalid;
150
160
  }
151
161
  /*************
152
162
  * Lifecycle *
@@ -157,6 +167,11 @@ export class MgInputTextarea {
157
167
  * @returns {ReturnType<typeof setTimeout>} timeout
158
168
  */
159
169
  componentWillLoad() {
170
+ // Get locales
171
+ this.messages = initLocales(this.element).messages;
172
+ this.characterLeftId = `${this.identifier}-character-left`;
173
+ // Validate
174
+ this.validateDisplayCharacterLeft(this.displayCharacterLeft);
160
175
  this.validatePattern();
161
176
  // Check validity when component is ready
162
177
  // return a promise to process action only in the FIRST render().
@@ -171,8 +186,15 @@ export class MgInputTextarea {
171
186
  * @returns {HTMLElement} HTML Element
172
187
  */
173
188
  render() {
174
- 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 },
175
- 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) })));
189
+ 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 },
190
+ h("div", { class: "mg-input__with-character-left" },
191
+ h("textarea", { class: {
192
+ 'mg-input__box': true,
193
+ 'mg-input__box--resizable': this.resizable === 'both',
194
+ 'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',
195
+ 'mg-input__box--resizable-vertical': this.resizable === 'vertical',
196
+ }, 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) }),
197
+ this.displayCharacterLeft && this.maxlength && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength })))));
176
198
  }
177
199
  static get is() { return "mg-input-textarea"; }
178
200
  static get encapsulation() { return "shadow"; }
@@ -377,7 +399,7 @@ export class MgInputTextarea {
377
399
  "reflect": false,
378
400
  "defaultValue": "false"
379
401
  },
380
- "width": {
402
+ "mgWidth": {
381
403
  "type": "any",
382
404
  "mutable": false,
383
405
  "complexType": {
@@ -396,7 +418,7 @@ export class MgInputTextarea {
396
418
  "tags": [],
397
419
  "text": "Define input width"
398
420
  },
399
- "attribute": "width",
421
+ "attribute": "mg-width",
400
422
  "reflect": false,
401
423
  "defaultValue": "'full'"
402
424
  },
@@ -487,23 +509,6 @@ export class MgInputTextarea {
487
509
  "reflect": false,
488
510
  "defaultValue": "true"
489
511
  },
490
- "characterLeftTemplate": {
491
- "type": "string",
492
- "mutable": false,
493
- "complexType": {
494
- "original": "string",
495
- "resolved": "string",
496
- "references": {}
497
- },
498
- "required": false,
499
- "optional": false,
500
- "docs": {
501
- "tags": [],
502
- "text": "Template to use for characters left sentence"
503
- },
504
- "attribute": "character-left-template",
505
- "reflect": false
506
- },
507
512
  "helpText": {
508
513
  "type": "string",
509
514
  "mutable": false,
@@ -554,6 +559,24 @@ export class MgInputTextarea {
554
559
  },
555
560
  "attribute": "invalid",
556
561
  "reflect": false
562
+ },
563
+ "resizable": {
564
+ "type": "string",
565
+ "mutable": false,
566
+ "complexType": {
567
+ "original": "'none' | 'both' | 'horizontal' | 'vertical'",
568
+ "resolved": "\"both\" | \"horizontal\" | \"none\" | \"vertical\"",
569
+ "references": {}
570
+ },
571
+ "required": false,
572
+ "optional": false,
573
+ "docs": {
574
+ "tags": [],
575
+ "text": "Define if input is resizable"
576
+ },
577
+ "attribute": "resizable",
578
+ "reflect": false,
579
+ "defaultValue": "'none'"
557
580
  }
558
581
  }; }
559
582
  static get states() { return {
@@ -612,8 +635,12 @@ export class MgInputTextarea {
612
635
  }
613
636
  }
614
637
  }; }
638
+ static get elementRef() { return "element"; }
615
639
  static get watchers() { return [{
616
640
  "propName": "value",
617
641
  "methodName": "handleValue"
642
+ }, {
643
+ "propName": "displayCharacterLeft",
644
+ "methodName": "validateDisplayCharacterLeft"
618
645
  }]; }
619
646
  }
@@ -0,0 +1,57 @@
1
+ import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../../.storybook/utils';
3
+ export default {
4
+ component: 'mg-input-toggle',
5
+ title: 'Molecules/Inputs/mg-input-toggle',
6
+ parameters: { actions: { handles: ['value-change', 'input-valid'] } },
7
+ };
8
+ const args = {
9
+ // Global
10
+ value: null,
11
+ items: [
12
+ { title: 'non', value: false },
13
+ { title: 'oui', value: true },
14
+ ],
15
+ identifier: 'identifier',
16
+ name: 'input-name',
17
+ // Label
18
+ label: 'Option',
19
+ labelOnTop: false,
20
+ labelHide: false,
21
+ // toggle
22
+ isIcon: false,
23
+ isOnOff: false,
24
+ // Input
25
+ disabled: false,
26
+ readonly: false,
27
+ // Tooltip
28
+ tooltip: 'This is a tooltip',
29
+ // Help Text
30
+ helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
31
+ };
32
+ /**
33
+ * Template
34
+ *
35
+ * @param {any} args component arguments
36
+ * @returns {HTMLElement} HTMLElement
37
+ */
38
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
+ const Template = (args) => (h("mg-input-toggle", Object.assign({}, filterArgs(args)),
40
+ h("span", { slot: "item-1" }, "Non"),
41
+ h("span", { slot: "item-2" }, "Oui")));
42
+ export const MgInputToggle = Template.bind({});
43
+ MgInputToggle.args = Object.assign({}, args);
44
+ /**
45
+ * Template
46
+ *
47
+ * @param {any} args component arguments
48
+ * @returns {HTMLElement} HTMLElement
49
+ */
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ const TemplateIcon = (args) => (h("mg-input-toggle", Object.assign({}, filterArgs(args)),
52
+ h("span", { slot: "item-1" },
53
+ h("mg-icon", { icon: "cross" })),
54
+ h("span", { slot: "item-2" },
55
+ h("mg-icon", { icon: "check" }))));
56
+ export const MgInputToggleWithIcon = TemplateIcon.bind({});
57
+ MgInputToggleWithIcon.args = Object.assign(Object.assign({}, args), { isIcon: true, isOnOff: true });