@mgdis/mg-components 3.2.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/cjs/{index-bead7dbd.js → index-88560a66.js} +47 -48
  2. package/dist/cjs/{index-369388eb.js → index-a39c5567.js} +97 -10
  3. package/dist/cjs/loader.cjs.js +3 -17
  4. package/dist/cjs/mg-badge_21.cjs.entry.js +519 -294
  5. package/dist/cjs/mg-components.cjs.js +3 -7
  6. package/dist/cjs/mg-modal.cjs.entry.js +12 -6
  7. package/dist/cjs/mg-popover.cjs.entry.js +15 -10
  8. package/dist/cjs/{popper-0c3964e7.js → popper-71bf3058.js} +6 -2
  9. package/dist/collection/collection-manifest.json +1 -1
  10. package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +1 -1
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
  12. package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -3
  13. package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +2 -2
  14. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
  15. package/dist/collection/components/atoms/mg-button/mg-button.css +20 -32
  16. package/dist/collection/components/atoms/mg-button/mg-button.js +8 -3
  17. package/dist/collection/components/atoms/mg-character-left/{mg-character-left.stories.js → doc/mg-character-left.stories.js} +1 -1
  18. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +10 -47
  19. package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +1 -1
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +97 -10
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.css +4 -0
  22. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  23. package/dist/collection/components/atoms/mg-input-title/{mg-input-title.stories.js → doc/mg-input-title.stories.js} +0 -0
  24. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +1 -1
  25. package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
  26. package/dist/collection/components/atoms/mg-tooltip/{mg-tooltip.stories.js → doc/mg-tooltip.stories.js} +14 -1
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +20 -0
  28. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -2
  29. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
  30. package/dist/collection/components/molecules/inputs/MgInput.js +5 -15
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +0 -0
  32. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +19 -13
  33. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -21
  34. package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +0 -0
  35. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +19 -18
  36. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +19 -18
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +9 -2
  38. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +20 -19
  39. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +43 -19
  40. package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +10 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +19 -18
  42. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -22
  43. package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +0 -0
  44. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +19 -13
  45. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +8 -15
  46. package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +10 -3
  47. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +20 -18
  48. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +24 -31
  49. package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +11 -7
  50. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +51 -28
  51. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +42 -43
  52. package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +10 -4
  53. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +51 -22
  54. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +66 -39
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.js → doc/mg-input-toggle.stories.js} +0 -0
  56. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +18 -9
  57. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +10 -4
  58. package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +0 -0
  59. package/dist/collection/components/molecules/mg-form/mg-form.css +4 -0
  60. package/dist/collection/components/molecules/mg-form/mg-form.js +5 -3
  61. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +1 -1
  62. package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
  63. package/dist/collection/components/molecules/mg-modal/{mg-modal.stories.js → doc/mg-modal.stories.js} +0 -0
  64. package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
  65. package/dist/collection/components/molecules/mg-modal/mg-modal.js +12 -5
  66. package/dist/collection/components/molecules/mg-pagination/{mg-pagination.stories.js → doc/mg-pagination.stories.js} +0 -0
  67. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
  68. package/dist/collection/components/molecules/mg-panel/{mg-panel.stories.js → doc/mg-panel.stories.js} +9 -1
  69. package/dist/collection/components/molecules/mg-panel/mg-panel.css +13 -4
  70. package/dist/collection/components/molecules/mg-panel/mg-panel.js +119 -18
  71. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +10 -0
  72. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  73. package/dist/collection/components/molecules/mg-popover/mg-popover.js +19 -9
  74. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +12 -5
  75. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
  76. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
  77. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +92 -27
  78. package/dist/collection/locales/index.js +33 -4
  79. package/dist/collection/stories/helpers.stories.js +33 -0
  80. package/dist/collection/utils/locale.utils.js +7 -4
  81. package/dist/collection/variables.css +9 -4
  82. package/dist/collection/variables.scss +9 -4
  83. package/dist/components/MgInput.js +6 -23
  84. package/dist/components/index.d.ts +23 -5
  85. package/dist/components/index.js +23 -0
  86. package/dist/components/index2.js +97 -8
  87. package/dist/components/locale.utils.js +7 -5
  88. package/dist/components/mg-badge2.js +16 -4
  89. package/dist/components/mg-button2.js +10 -5
  90. package/dist/components/mg-character-left2.js +4 -27
  91. package/dist/components/mg-form.js +6 -4
  92. package/dist/components/mg-icon2.js +120 -17
  93. package/dist/components/mg-input-checkbox.js +11 -27
  94. package/dist/components/mg-input-date.js +21 -25
  95. package/dist/components/mg-input-numeric.js +28 -26
  96. package/dist/components/mg-input-password.js +18 -28
  97. package/dist/components/mg-input-radio.js +10 -22
  98. package/dist/components/mg-input-select2.js +24 -35
  99. package/dist/components/mg-input-text2.js +38 -26
  100. package/dist/components/mg-input-textarea.js +44 -21
  101. package/dist/components/mg-input-toggle.js +11 -11
  102. package/dist/components/mg-message.js +16 -8
  103. package/dist/components/mg-modal.js +11 -5
  104. package/dist/components/mg-pagination.js +16 -22
  105. package/dist/components/mg-panel.js +51 -17
  106. package/dist/components/mg-popover.js +13 -8
  107. package/dist/components/mg-tabs.js +80 -22
  108. package/dist/components/mg-tag.js +20 -5
  109. package/dist/components/mg-tooltip2.js +1 -1
  110. package/dist/components/popper.js +6 -2
  111. package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
  112. package/dist/esm/{index-c346f52d.js → index-e51ae032.js} +97 -8
  113. package/dist/esm/loader.js +3 -17
  114. package/dist/esm/mg-badge_21.entry.js +516 -291
  115. package/dist/esm/mg-components.js +3 -7
  116. package/dist/esm/mg-modal.entry.js +12 -6
  117. package/dist/esm/mg-popover.entry.js +15 -10
  118. package/dist/esm/{popper-8874fd6c.js → popper-93ecb064.js} +6 -2
  119. package/dist/index.js +1 -1
  120. package/dist/mg-components/mg-components.css +1 -1
  121. package/dist/mg-components/mg-components.esm.js +1 -1
  122. package/dist/mg-components/p-462d648a.entry.js +1 -0
  123. package/dist/mg-components/p-4c66f794.js +1 -0
  124. package/dist/mg-components/p-5126ab10.entry.js +1 -0
  125. package/dist/mg-components/p-766c918b.entry.js +1 -0
  126. package/dist/mg-components/p-780bd52d.js +1 -0
  127. package/dist/mg-components/p-b14a3443.js +2 -0
  128. package/dist/mg-components/variables.css +9 -4
  129. package/dist/mg-components/variables.scss +9 -4
  130. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
  131. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
  132. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +0 -0
  133. package/dist/types/components/atoms/mg-button/mg-button.d.ts +1 -1
  134. package/dist/types/components/atoms/mg-character-left/{mg-character-left.stories.d.ts → doc/mg-character-left.stories.d.ts} +0 -0
  135. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
  136. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  137. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  138. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  139. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
  140. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
  141. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +29 -0
  142. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +8 -0
  143. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -1
  144. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
  145. package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
  146. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
  147. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
  148. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
  149. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
  150. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
  151. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
  152. package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
  153. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
  154. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
  155. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
  156. package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
  157. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
  158. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
  159. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
  160. package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +19 -0
  161. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +15 -7
  162. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
  163. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
  164. package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
  165. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -0
  166. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
  167. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
  168. package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
  169. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
  170. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
  171. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
  172. package/dist/types/components/molecules/{inputs/mg-input-textarea/mg-input-textarea.stories.d.ts → mg-panel/doc/mg-panel.stories.d.ts} +1 -1
  173. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +29 -0
  174. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +25 -0
  175. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  176. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +9 -1
  177. package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +5 -0
  178. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
  179. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +49 -0
  180. package/dist/types/components.d.ts +181 -151
  181. package/dist/types/locales/index.d.ts +109 -46
  182. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  183. package/dist/types/utils/locale.utils.d.ts +7 -3
  184. package/loader/index.js +1 -1
  185. package/package.json +14 -14
  186. package/readme.md +6 -35
  187. package/dist/cjs/css-shim-629916b0.js +0 -6
  188. package/dist/cjs/shadow-css-546083ef.js +0 -390
  189. package/dist/collection/stories/buttons.stories.js +0 -43
  190. package/dist/collection/stories/messages.stories.js +0 -44
  191. package/dist/collection/stories/tags.stories.js +0 -13
  192. package/dist/esm/css-shim-0993aa3b.js +0 -4
  193. package/dist/esm/shadow-css-dfa0587f.js +0 -388
  194. package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
  195. package/dist/esm-es5/index-9e877561.js +0 -1
  196. package/dist/esm-es5/index-c346f52d.js +0 -1
  197. package/dist/esm-es5/index.js +0 -0
  198. package/dist/esm-es5/loader.js +0 -1
  199. package/dist/esm-es5/mg-badge_21.entry.js +0 -2
  200. package/dist/esm-es5/mg-components.js +0 -1
  201. package/dist/esm-es5/mg-modal.entry.js +0 -1
  202. package/dist/esm-es5/mg-popover.entry.js +0 -1
  203. package/dist/esm-es5/popper-8874fd6c.js +0 -1
  204. package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
  205. package/dist/mg-components/mg-components.js +0 -132
  206. package/dist/mg-components/p-3633e9e1.system.entry.js +0 -2
  207. package/dist/mg-components/p-3c14153d.js +0 -1
  208. package/dist/mg-components/p-50ea2036.system.js +0 -1
  209. package/dist/mg-components/p-55a22b35.system.js +0 -1
  210. package/dist/mg-components/p-5e796581.js +0 -12
  211. package/dist/mg-components/p-656b5efb.system.js +0 -1
  212. package/dist/mg-components/p-68d6f104.js +0 -1
  213. package/dist/mg-components/p-6d49ed95.js +0 -1
  214. package/dist/mg-components/p-70177194.entry.js +0 -1
  215. package/dist/mg-components/p-8b2d8a2a.system.js +0 -13
  216. package/dist/mg-components/p-8cb61c3f.system.js +0 -1
  217. package/dist/mg-components/p-ace173b1.js +0 -1
  218. package/dist/mg-components/p-c46fbd54.entry.js +0 -1
  219. package/dist/mg-components/p-c90cc4bf.system.js +0 -1
  220. package/dist/mg-components/p-cd2a4acc.system.entry.js +0 -1
  221. package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
  222. package/dist/mg-components/p-dfe25da3.entry.js +0 -1
  223. package/dist/mg-components/p-e4a502b5.system.js +0 -1
  224. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  225. package/dist/types/components/molecules/mg-panel/mg-panel.stories.d.ts +0 -6
  226. package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
  227. package/dist/types/stories/messages.stories.d.ts +0 -13
  228. package/dist/types/stories/tags.stories.d.ts +0 -5
@@ -1,8 +1,7 @@
1
- import { Component, Event, h, Prop, State, Watch, Method } from '@stencil/core';
1
+ import { Component, Element, Event, h, Prop, State, Watch, Method } from '@stencil/core';
2
2
  import { MgInput } from '../MgInput';
3
3
  import { createID, ClassList } from '../../../../utils/components.utils';
4
- import { messages } from '../../../../locales';
5
- import { InputClass } from '../MgInput.conf';
4
+ import { initLocales } from '../../../../locales';
6
5
  /**
7
6
  * type CheckboxItem validation function
8
7
  *
@@ -15,8 +14,6 @@ export class MgInputCheckbox {
15
14
  /************
16
15
  * Internal *
17
16
  ************/
18
- // classes
19
- this.classError = InputClass.ERROR;
20
17
  // HTML selector
21
18
  this.inputs = [];
22
19
  /**
@@ -101,14 +98,7 @@ export class MgInputCheckbox {
101
98
  // Set error message
102
99
  this.errorMessage = undefined;
103
100
  if (!this.valid && invalidElement.validity.valueMissing) {
104
- this.errorMessage = messages.errors.required;
105
- }
106
- // Update class
107
- if (this.valid) {
108
- this.classList.delete(this.classError);
109
- }
110
- else {
111
- this.classList.add(this.classError);
101
+ this.errorMessage = this.messages.errors.required;
112
102
  }
113
103
  };
114
104
  /**
@@ -132,9 +122,6 @@ export class MgInputCheckbox {
132
122
  throw new Error('<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem.');
133
123
  }
134
124
  }
135
- handleReadOnly() {
136
- this.classList.delete(this.classError);
137
- }
138
125
  /**
139
126
  * Public method to display errors
140
127
  *
@@ -153,7 +140,9 @@ export class MgInputCheckbox {
153
140
  * @returns {ReturnType<typeof setTimeout>} timeout
154
141
  */
155
142
  componentWillLoad() {
156
- // Check values format
143
+ // Get locales
144
+ this.messages = initLocales(this.element).messages;
145
+ // Validate
157
146
  this.validateValue(this.value);
158
147
  // Check validity when component is ready
159
148
  // return a promise to process action only in the FIRST render().
@@ -168,7 +157,7 @@ export class MgInputCheckbox {
168
157
  * @returns {HTMLElement} HTML Element
169
158
  */
170
159
  render() {
171
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: undefined, width: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true },
160
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true },
172
161
  h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList } }, this.checkboxItems
173
162
  .filter(item => {
174
163
  return !this.readonly || item.value;
@@ -497,11 +486,9 @@ export class MgInputCheckbox {
497
486
  }
498
487
  }
499
488
  }; }
489
+ static get elementRef() { return "element"; }
500
490
  static get watchers() { return [{
501
491
  "propName": "value",
502
492
  "methodName": "validateValue"
503
- }, {
504
- "propName": "readonly",
505
- "methodName": "handleReadOnly"
506
493
  }]; }
507
494
  }
@@ -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);
@@ -74,6 +67,11 @@
74
67
  .mg-input__input-container mg-icon {
75
68
  display: flex;
76
69
  }
70
+ .mg-input__input-container .mg-input__help-text,
71
+ .mg-input__input-container .mg-input__error {
72
+ text-align: start;
73
+ font-size: 1.2rem;
74
+ }
77
75
 
78
76
  .mg-input__input {
79
77
  display: flex;
@@ -82,11 +80,22 @@
82
80
  .mg-input__input mg-tooltip {
83
81
  margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
84
82
  }
85
- .mg-input__input + * {
86
- text-align: start;
83
+ .mg-input__input.mg-input__input--has-error .mg-input__box {
84
+ border-color: hsl(var(--color-danger));
85
+ }
86
+ .mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
87
87
  margin-top: 0.5rem;
88
88
  }
89
89
 
90
+ .mg-input__error {
91
+ display: inline-block;
92
+ margin-top: 0.2rem;
93
+ padding: 0.3rem 0.8rem;
94
+ border-radius: 0.3rem;
95
+ background: hsl(var(--mg-inputs-error-bg-color));
96
+ color: hsl(var(--color-danger));
97
+ }
98
+
90
99
  /**
91
100
  * Style for input "box":
92
101
  * - input[type="text"]
@@ -97,7 +106,6 @@
97
106
  */
98
107
  .mg-input__box {
99
108
  padding: calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);
100
- width: 100%;
101
109
  height: var(--default-size);
102
110
  box-sizing: border-box;
103
111
  border-width: var(--mg-inputs-border-width);
@@ -108,6 +116,7 @@
108
116
  font-family: inherit;
109
117
  color: hsl(var(--color-dark));
110
118
  font-size: var(--font-size);
119
+ text-align: var(--mg-inputs-text-align, left);
111
120
  }
112
121
  .mg-input__box::placeholder {
113
122
  color: var(--mg-inputs-color);
@@ -155,10 +164,6 @@
155
164
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]) {
156
165
  --mg-button-border-radius-top-right: 0;
157
166
  --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
167
  }
163
168
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)) {
164
169
  --mg-button-border-right-width: 0;
@@ -166,10 +171,6 @@
166
171
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type) {
167
172
  --mg-button-border-radius-top-right: var(--mg-inputs-border-radius);
168
173
  --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
174
  }
174
175
 
175
176
  .mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]) {
@@ -1,17 +1,13 @@
1
- import { Component, Event, h, Prop, State, Watch, Method } from '@stencil/core';
1
+ import { Component, Element, Event, h, Prop, State, Watch, Method } from '@stencil/core';
2
2
  import { MgInput } from '../MgInput';
3
3
  import { InputError } from './mg-input-date.conf';
4
4
  import { createID, ClassList } from '../../../../utils/components.utils';
5
5
  import { localeDate, dateRegExp } from '../../../../utils/locale.utils';
6
- import { messages } from '../../../../locales';
7
- import { InputClass } from '../MgInput.conf';
6
+ import { initLocales } from '../../../../locales';
8
7
  export class MgInputDate {
9
8
  constructor() {
10
- /************
11
- * Internal *
12
- ************/
13
- // classes
14
- this.classError = InputClass.ERROR;
9
+ // hasError (triggered by blur event)
10
+ this.hasError = false;
15
11
  /**
16
12
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
17
13
  * If not set, it will be created.
@@ -47,14 +43,16 @@ export class MgInputDate {
47
43
  */
48
44
  this.handleInput = () => {
49
45
  this.checkValidity();
46
+ if (this.hasError) {
47
+ this.checkError();
48
+ }
50
49
  this.value = this.input.value;
51
50
  };
52
51
  /**
53
52
  * Handle blur event
54
53
  */
55
54
  this.handleBlur = () => {
56
- this.checkValidity();
57
- this.checkError();
55
+ this.displayError();
58
56
  };
59
57
  /**
60
58
  * Check if input is valid
@@ -105,16 +103,16 @@ export class MgInputDate {
105
103
  const inputError = this.getInputError();
106
104
  // required
107
105
  if (inputError === InputError.REQUIRED) {
108
- this.errorMessage = messages.errors[inputError];
106
+ this.errorMessage = this.messages.errors[inputError];
109
107
  }
110
108
  // min, max & minMax
111
109
  else if ([InputError.MIN, InputError.MAX, InputError.MINMAX].includes(inputError)) {
112
- this.errorMessage = messages.errors.date[inputError].replace('{min}', localeDate(this.min)).replace('{max}', localeDate(this.max));
110
+ this.errorMessage = this.messages.errors.date[inputError].replace('{min}', localeDate(this.min, this.locale)).replace('{max}', localeDate(this.max, this.locale));
113
111
  }
114
112
  // wrong date format
115
113
  // element.validity.badInput is default error message
116
114
  else {
117
- this.errorMessage = messages.errors.date.badInput.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? localeDate(this.min) : localeDate('1900-01-01'));
115
+ this.errorMessage = this.messages.errors.date.badInput.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? localeDate(this.min, this.locale) : localeDate('1900-01-01', this.locale));
118
116
  }
119
117
  };
120
118
  /**
@@ -127,10 +125,6 @@ export class MgInputDate {
127
125
  this.errorMessage = undefined;
128
126
  if (!this.valid) {
129
127
  this.setErrorMessage();
130
- this.classList.add(this.classError);
131
- }
132
- else {
133
- this.classList.delete(this.classError);
134
128
  }
135
129
  };
136
130
  }
@@ -156,6 +150,7 @@ export class MgInputDate {
156
150
  async displayError() {
157
151
  this.checkValidity();
158
152
  this.checkError();
153
+ this.hasError = this.invalid;
159
154
  }
160
155
  /**
161
156
  * Date format validation
@@ -177,6 +172,11 @@ export class MgInputDate {
177
172
  * @returns {ReturnType<typeof setTimeout>} timeout
178
173
  */
179
174
  componentWillLoad() {
175
+ // Get locales
176
+ const locales = initLocales(this.element);
177
+ this.locale = locales.locale;
178
+ this.messages = locales.messages;
179
+ // Validate
180
180
  this.validateValue(this.value);
181
181
  this.validateMin(this.min);
182
182
  this.validateMax(this.max);
@@ -193,7 +193,7 @@ export class MgInputDate {
193
193
  * @returns {HTMLElement} HTML Element
194
194
  */
195
195
  render() {
196
- 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: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value), tooltip: this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
196
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
197
197
  h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, pattern: "[0-9]{4}-[0-9]{2}-[0-9]{2}", ref: el => (this.input = el) })));
198
198
  }
199
199
  static get is() { return "mg-input-date"; }
@@ -523,6 +523,7 @@ export class MgInputDate {
523
523
  }
524
524
  }
525
525
  }; }
526
+ static get elementRef() { return "element"; }
526
527
  static get watchers() { return [{
527
528
  "propName": "value",
528
529
  "methodName": "validateValue"
@@ -1,5 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
- import { types } from './mg-input-numeric.conf';
2
+ import { types } from '../mg-input-numeric.conf';
3
3
  export default {
4
4
  component: 'mg-input-numeric',
5
5
  title: 'Molecules/Inputs/mg-input-numeric',
@@ -8,6 +8,10 @@ export default {
8
8
  options: types,
9
9
  control: { type: 'select' },
10
10
  },
11
+ mgWidth: {
12
+ options: [undefined, 2, 4, 16, 'full'],
13
+ control: { type: 'select' },
14
+ },
11
15
  },
12
16
  parameters: { actions: { handles: ['value-change', 'input-valid'] } },
13
17
  };
@@ -26,8 +30,10 @@ const Template = (args) => {
26
30
  delete args.labelHide;
27
31
  const helpText = args.helpText;
28
32
  delete args.helpText;
33
+ const mgWidth = args.mgWidth;
34
+ delete args.mgWidth;
29
35
  // return element
30
- return h("mg-input-numeric", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText }));
36
+ return h("mg-input-numeric", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "mg-width": mgWidth }));
31
37
  };
32
38
  /**
33
39
  * Global use
@@ -50,6 +56,7 @@ MgInputNumeric.args = {
50
56
  readonly: false,
51
57
  max: undefined,
52
58
  min: undefined,
59
+ mgWidth: undefined,
53
60
  // Tooltip
54
61
  tooltip: 'This is a tooltip',
55
62
  // Help Text
@@ -11,16 +11,9 @@
11
11
  min-height: var(--default-size);
12
12
  max-width: 100%;
13
13
  margin-bottom: var(--mg-inputs-margin-bottom, 0);
14
- /* Style when input is not valid */
15
14
  /* Label */
16
15
  /* Label-on-top */
17
16
  }
18
- .mg-input.is-not-valid {
19
- color: hsl(var(--color-danger));
20
- }
21
- .mg-input.is-not-valid .mg-input__box {
22
- border-color: hsl(var(--color-danger));
23
- }
24
17
  .mg-input mg-input-title {
25
18
  flex-shrink: var(--mg-inputs-shrink, 1);
26
19
  width: var(--mg-inputs-title-width, auto);
@@ -74,6 +67,11 @@
74
67
  .mg-input__input-container mg-icon {
75
68
  display: flex;
76
69
  }
70
+ .mg-input__input-container .mg-input__help-text,
71
+ .mg-input__input-container .mg-input__error {
72
+ text-align: start;
73
+ font-size: 1.2rem;
74
+ }
77
75
 
78
76
  .mg-input__input {
79
77
  display: flex;
@@ -82,11 +80,22 @@
82
80
  .mg-input__input mg-tooltip {
83
81
  margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
84
82
  }
85
- .mg-input__input + * {
86
- text-align: start;
83
+ .mg-input__input.mg-input__input--has-error .mg-input__box {
84
+ border-color: hsl(var(--color-danger));
85
+ }
86
+ .mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
87
87
  margin-top: 0.5rem;
88
88
  }
89
89
 
90
+ .mg-input__error {
91
+ display: inline-block;
92
+ margin-top: 0.2rem;
93
+ padding: 0.3rem 0.8rem;
94
+ border-radius: 0.3rem;
95
+ background: hsl(var(--mg-inputs-error-bg-color));
96
+ color: hsl(var(--color-danger));
97
+ }
98
+
90
99
  /**
91
100
  * Style for input "box":
92
101
  * - input[type="text"]
@@ -97,7 +106,6 @@
97
106
  */
98
107
  .mg-input__box {
99
108
  padding: calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);
100
- width: 100%;
101
109
  height: var(--default-size);
102
110
  box-sizing: border-box;
103
111
  border-width: var(--mg-inputs-border-width);
@@ -108,6 +116,7 @@
108
116
  font-family: inherit;
109
117
  color: hsl(var(--color-dark));
110
118
  font-size: var(--font-size);
119
+ text-align: var(--mg-inputs-text-align, left);
111
120
  }
112
121
  .mg-input__box::placeholder {
113
122
  color: var(--mg-inputs-color);
@@ -155,10 +164,6 @@
155
164
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]) {
156
165
  --mg-button-border-radius-top-right: 0;
157
166
  --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
167
  }
163
168
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)) {
164
169
  --mg-button-border-right-width: 0;
@@ -166,10 +171,6 @@
166
171
  .mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type) {
167
172
  --mg-button-border-radius-top-right: var(--mg-inputs-border-radius);
168
173
  --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
174
  }
174
175
 
175
176
  .mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]) {
@@ -222,5 +223,5 @@
222
223
  }
223
224
 
224
225
  .mg-input .mg-input__box {
225
- text-align: right;
226
+ text-align: var(--mg-inputs-text-align, right);
226
227
  }
@@ -1,14 +1,13 @@
1
1
  import { Component, Element, Event, h, Prop, State, Watch, Method } from '@stencil/core';
2
2
  import { MgInput } from '../MgInput';
3
- import { InputClass } from '../MgInput.conf';
4
3
  import { types, InputError } from './mg-input-numeric.conf';
5
4
  import { createID, ClassList } from '../../../../utils/components.utils';
6
- import { messages } from '../../../../locales';
5
+ import { initLocales } from '../../../../locales/';
7
6
  import { localeCurrency, localeNumber } from '../../../../utils/locale.utils';
8
7
  export class MgInputNumeric {
9
8
  constructor() {
10
- // Classes
11
- this.classError = InputClass.ERROR;
9
+ // hasError (triggered by blur event)
10
+ this.hasError = false;
12
11
  /**
13
12
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
14
13
  * If not set, it will be created.
@@ -39,6 +38,10 @@ export class MgInputNumeric {
39
38
  * Define numeric type
40
39
  */
41
40
  this.type = types[0];
41
+ /**
42
+ * Define currency
43
+ */
44
+ this.currency = 'USD';
42
45
  /**
43
46
  * Override integer length
44
47
  * integer is the number before the decimal point
@@ -65,6 +68,9 @@ export class MgInputNumeric {
65
68
  this.handleInput = () => {
66
69
  // Check validity
67
70
  this.checkValidity();
71
+ if (this.hasError) {
72
+ this.checkError();
73
+ }
68
74
  this.value = this.input.value;
69
75
  };
70
76
  /**
@@ -81,9 +87,8 @@ export class MgInputNumeric {
81
87
  * @returns {void}
82
88
  */
83
89
  this.handleBlur = () => {
84
- // Check validity
85
- this.checkValidity();
86
- this.checkError();
90
+ // Display Error
91
+ this.displayError();
87
92
  this.hasFocus = false;
88
93
  };
89
94
  /**
@@ -109,10 +114,10 @@ export class MgInputNumeric {
109
114
  this.setErrorMessage = () => {
110
115
  const inputError = this.getInputError();
111
116
  if (inputError === InputError.REQUIRED) {
112
- this.errorMessage = messages.errors[inputError];
117
+ this.errorMessage = this.messages.errors[inputError];
113
118
  }
114
119
  else {
115
- this.errorMessage = messages.errors.numeric[inputError].replace('{min}', `${this.formatValue(this.min)}`).replace('{max}', `${this.formatValue(this.max)}`);
120
+ this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', `${this.formatValue(this.min)}`).replace('{max}', `${this.formatValue(this.max)}`);
116
121
  }
117
122
  };
118
123
  /**
@@ -126,10 +131,6 @@ export class MgInputNumeric {
126
131
  // Update class
127
132
  if (!this.valid) {
128
133
  this.setErrorMessage();
129
- this.classList.add(this.classError);
130
- }
131
- else {
132
- this.classList.delete(this.classError);
133
134
  }
134
135
  };
135
136
  /**
@@ -166,7 +167,7 @@ export class MgInputNumeric {
166
167
  * @param {number} value value to format
167
168
  * @returns {string} formated local value
168
169
  */
169
- this.formatValue = (value) => (this.type === 'currency' ? localeCurrency(value) : localeNumber(value));
170
+ this.formatValue = (value) => (this.type === 'currency' ? localeCurrency(value, this.locale, this.currency) : localeNumber(value, this.locale));
170
171
  /**
171
172
  * Validate append slot
172
173
  *
@@ -202,7 +203,7 @@ export class MgInputNumeric {
202
203
  // emit numeric value
203
204
  this.numericValue = this.value !== '' && this.value !== null ? parseFloat(this.value.replace(',', '.')) : null;
204
205
  this.valueChange.emit(this.numericValue);
205
- // Set readOnlyValue
206
+ // Set readonlyValue
206
207
  this.readonlyValue = this.numericValue !== null ? this.formatValue(this.numericValue) : '';
207
208
  }
208
209
  }
@@ -210,7 +211,6 @@ export class MgInputNumeric {
210
211
  if (!types.includes(newValue)) {
211
212
  throw new Error(`<mg-input-numeric> prop "type" must be one of : ${types.join(', ')}`);
212
213
  }
213
- this.classList.add(`mg-input--numeric--${this.type}`);
214
214
  }
215
215
  validateIntegerLength(newValue) {
216
216
  if (newValue < 1) {
@@ -230,6 +230,7 @@ export class MgInputNumeric {
230
230
  async displayError() {
231
231
  this.checkValidity();
232
232
  this.checkError();
233
+ this.hasError = this.invalid;
233
234
  }
234
235
  /**
235
236
  * Displayed value in input
@@ -249,6 +250,11 @@ export class MgInputNumeric {
249
250
  * @returns {ReturnType<typeof setTimeout>} timeout
250
251
  */
251
252
  componentWillLoad() {
253
+ // Get locales
254
+ const locales = initLocales(this.element);
255
+ this.locale = locales.locale;
256
+ this.messages = locales.messages;
257
+ // Validate
252
258
  this.validateValue(this.value);
253
259
  this.validateType(this.type);
254
260
  this.validateIntegerLength(this.integerLength);
@@ -267,7 +273,7 @@ export class MgInputNumeric {
267
273
  * @returns {HTMLElement} HTML Element
268
274
  */
269
275
  render() {
270
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, width: this.width, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
276
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
271
277
  h("input", { type: "text", class: "mg-input__box", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }),
272
278
  h("slot", { name: "append-input" })));
273
279
  }
@@ -456,7 +462,7 @@ export class MgInputNumeric {
456
462
  "reflect": false,
457
463
  "defaultValue": "false"
458
464
  },
459
- "width": {
465
+ "mgWidth": {
460
466
  "type": "any",
461
467
  "mutable": false,
462
468
  "complexType": {
@@ -475,7 +481,7 @@ export class MgInputNumeric {
475
481
  "tags": [],
476
482
  "text": "Define input width"
477
483
  },
478
- "attribute": "width",
484
+ "attribute": "mg-width",
479
485
  "reflect": false
480
486
  },
481
487
  "tooltip": {
@@ -530,6 +536,24 @@ export class MgInputNumeric {
530
536
  "reflect": false,
531
537
  "defaultValue": "types[0]"
532
538
  },
539
+ "currency": {
540
+ "type": "string",
541
+ "mutable": false,
542
+ "complexType": {
543
+ "original": "string",
544
+ "resolved": "string",
545
+ "references": {}
546
+ },
547
+ "required": false,
548
+ "optional": false,
549
+ "docs": {
550
+ "tags": [],
551
+ "text": "Define currency"
552
+ },
553
+ "attribute": "currency",
554
+ "reflect": false,
555
+ "defaultValue": "'USD'"
556
+ },
533
557
  "max": {
534
558
  "type": "number",
535
559
  "mutable": false,
@@ -2,6 +2,12 @@ import { h } from '@stencil/core';
2
2
  export default {
3
3
  component: 'mg-input-password',
4
4
  title: 'Molecules/Inputs/mg-input-password',
5
+ argTypes: {
6
+ mgWidth: {
7
+ options: [2, 4, 16, 'full'],
8
+ control: { type: 'select' },
9
+ },
10
+ },
5
11
  parameters: { actions: { handles: ['value-change', 'input-valid'] } },
6
12
  };
7
13
  /**
@@ -19,8 +25,10 @@ const Template = (args) => {
19
25
  delete args.labelHide;
20
26
  const helpText = args.helpText;
21
27
  delete args.helpText;
28
+ const mgWidth = args.mgWidth;
29
+ delete args.mgWidth;
22
30
  // return element
23
- return h("mg-input-password", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText }));
31
+ return h("mg-input-password", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "mg-width": mgWidth }));
24
32
  };
25
33
  /**
26
34
  * Global use
@@ -41,6 +49,7 @@ MgInputPassword.args = {
41
49
  required: true,
42
50
  disabled: false,
43
51
  readonly: false,
52
+ mgWidth: 'full',
44
53
  // Tooltip
45
54
  tooltip: 'This is a tooltip',
46
55
  // Help Text