@mgdis/mg-components 5.19.2 → 5.20.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 (496) hide show
  1. package/dist/cjs/{components.utils-dc9c8a53.js → components.utils-cd908d4e.js} +102 -99
  2. package/dist/cjs/components.utils-cd908d4e.js.map +1 -0
  3. package/dist/cjs/{index-c042e24b.js → index-8532b5e9.js} +320 -137
  4. package/dist/cjs/index-8532b5e9.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/mg-action-more_34.cjs.entry.js +5130 -5057
  7. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  8. package/dist/cjs/mg-components.cjs.js +3 -3
  9. package/dist/cjs/mg-components.cjs.js.map +1 -1
  10. package/dist/cjs/mg-item-more.cjs.entry.js +224 -224
  11. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  12. package/dist/collection/assets/icons/index.js +193 -183
  13. package/dist/collection/assets/icons/index.js.map +1 -0
  14. package/dist/collection/collection-manifest.json +6 -6
  15. package/dist/collection/components/atoms/mg-badge/mg-badge.js +161 -161
  16. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  17. package/dist/collection/components/atoms/mg-button/mg-button.js +362 -347
  18. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  19. package/dist/collection/components/atoms/mg-card/mg-card.js +126 -126
  20. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  21. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +101 -101
  22. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  23. package/dist/collection/components/atoms/mg-divider/mg-divider.js +47 -47
  24. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  25. package/dist/collection/components/atoms/mg-icon/mg-icon.js +231 -231
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  27. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +132 -132
  28. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  29. package/dist/collection/components/atoms/mg-tag/mg-tag.js +158 -158
  30. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  31. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +46 -46
  32. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  33. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +3 -3
  34. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  35. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +398 -398
  36. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  37. package/dist/collection/components/molecules/inputs/MgInput.conf.js +8 -0
  38. package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +1 -1
  39. package/dist/collection/components/molecules/inputs/MgInput.js +84 -84
  40. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +8 -8
  42. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  43. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +266 -266
  44. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  45. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +4 -4
  46. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  47. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +789 -791
  48. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  49. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +4 -4
  50. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -1
  51. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +589 -572
  52. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  53. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +4 -4
  54. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
  55. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +779 -767
  56. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  57. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +537 -520
  58. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +566 -550
  60. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  61. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +701 -689
  62. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  63. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +0 -4
  64. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -1
  65. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +771 -754
  66. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  67. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +706 -689
  68. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  69. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +527 -522
  70. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  71. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +2 -2
  72. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -1
  73. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +263 -263
  74. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  75. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +6 -6
  76. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -1
  77. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +423 -423
  78. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  79. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  80. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +214 -214
  81. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  82. package/dist/collection/components/molecules/mg-details/mg-details.js +155 -150
  83. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  84. package/dist/collection/components/molecules/mg-form/mg-form.js +332 -335
  85. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  86. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +85 -85
  87. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  88. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +189 -189
  89. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  90. package/dist/collection/components/molecules/mg-message/mg-message.js +325 -304
  91. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  92. package/dist/collection/components/molecules/mg-modal/mg-modal.js +317 -317
  93. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  94. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +2 -2
  95. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js.map +1 -1
  96. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +216 -216
  97. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  98. package/dist/collection/components/molecules/mg-panel/mg-panel.js +409 -399
  99. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  100. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +91 -91
  101. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  102. package/dist/collection/components/molecules/mg-popover/mg-popover.js +336 -329
  103. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  104. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +94 -94
  105. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  106. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +4 -4
  107. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js.map +1 -1
  108. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +348 -343
  109. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  110. package/dist/collection/locales/fr/messages.json +4 -4
  111. package/dist/collection/locales/index.spec.js +20 -20
  112. package/dist/collection/locales/index.spec.js.map +1 -1
  113. package/dist/collection/utils/behaviors.utils.js +127 -127
  114. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  115. package/dist/collection/utils/behaviors.utils.spec.js +42 -42
  116. package/dist/collection/utils/behaviors.utils.spec.js.map +1 -1
  117. package/dist/collection/utils/components.utils.js +77 -75
  118. package/dist/collection/utils/components.utils.js.map +1 -1
  119. package/dist/collection/utils/components.utils.spec.js +150 -135
  120. package/dist/collection/utils/components.utils.spec.js.map +1 -1
  121. package/dist/collection/utils/e2e.test.utils.js +21 -21
  122. package/dist/collection/utils/e2e.test.utils.js.map +1 -1
  123. package/dist/collection/utils/locale.utils.js +17 -17
  124. package/dist/collection/utils/locale.utils.js.map +1 -1
  125. package/dist/collection/utils/locale.utils.spec.js +45 -45
  126. package/dist/collection/utils/locale.utils.spec.js.map +1 -1
  127. package/dist/collection/utils/playwright.e2e.test.utils.js +41 -41
  128. package/dist/collection/utils/playwright.e2e.test.utils.js.map +1 -1
  129. package/dist/collection/utils/playwright.fixture.js +24 -0
  130. package/dist/collection/utils/playwright.fixture.js.map +1 -0
  131. package/dist/collection/utils/unit.test.utils.js +50 -50
  132. package/dist/collection/utils/unit.test.utils.js.map +1 -1
  133. package/dist/components/MgInput.js +105 -97
  134. package/dist/components/MgInput.js.map +1 -1
  135. package/dist/components/components.utils.js +78 -76
  136. package/dist/components/components.utils.js.map +1 -1
  137. package/dist/components/index2.js +21 -21
  138. package/dist/components/index2.js.map +1 -1
  139. package/dist/components/mg-action-more.d.ts +2 -2
  140. package/dist/components/mg-action-more.js +173 -173
  141. package/dist/components/mg-action-more.js.map +1 -1
  142. package/dist/components/mg-badge.d.ts +2 -2
  143. package/dist/components/mg-badge2.js +83 -83
  144. package/dist/components/mg-badge2.js.map +1 -1
  145. package/dist/components/mg-button.d.ts +2 -2
  146. package/dist/components/mg-button2.js +182 -167
  147. package/dist/components/mg-button2.js.map +1 -1
  148. package/dist/components/mg-card.d.ts +2 -2
  149. package/dist/components/mg-card2.js +77 -77
  150. package/dist/components/mg-card2.js.map +1 -1
  151. package/dist/components/mg-character-left.d.ts +2 -2
  152. package/dist/components/mg-character-left2.js +50 -50
  153. package/dist/components/mg-character-left2.js.map +1 -1
  154. package/dist/components/mg-details.d.ts +2 -2
  155. package/dist/components/mg-details.js +69 -69
  156. package/dist/components/mg-details.js.map +1 -1
  157. package/dist/components/mg-divider.d.ts +2 -2
  158. package/dist/components/mg-divider.js +30 -30
  159. package/dist/components/mg-divider.js.map +1 -1
  160. package/dist/components/mg-form.d.ts +2 -2
  161. package/dist/components/mg-form.js +171 -179
  162. package/dist/components/mg-form.js.map +1 -1
  163. package/dist/components/mg-icon.d.ts +2 -2
  164. package/dist/components/mg-icon2.js +327 -309
  165. package/dist/components/mg-icon2.js.map +1 -1
  166. package/dist/components/mg-illustrated-message.d.ts +2 -2
  167. package/dist/components/mg-illustrated-message.js +51 -51
  168. package/dist/components/mg-illustrated-message.js.map +1 -1
  169. package/dist/components/mg-input-checkbox-paginated.d.ts +2 -2
  170. package/dist/components/mg-input-checkbox-paginated2.js +170 -170
  171. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  172. package/dist/components/mg-input-checkbox.d.ts +2 -2
  173. package/dist/components/mg-input-checkbox.js +478 -480
  174. package/dist/components/mg-input-checkbox.js.map +1 -1
  175. package/dist/components/mg-input-date.d.ts +2 -2
  176. package/dist/components/mg-input-date.js +266 -260
  177. package/dist/components/mg-input-date.js.map +1 -1
  178. package/dist/components/mg-input-numeric.d.ts +2 -2
  179. package/dist/components/mg-input-numeric.js +354 -348
  180. package/dist/components/mg-input-numeric.js.map +1 -1
  181. package/dist/components/mg-input-password.d.ts +2 -2
  182. package/dist/components/mg-input-password.js +205 -199
  183. package/dist/components/mg-input-password.js.map +1 -1
  184. package/dist/components/mg-input-radio.d.ts +2 -2
  185. package/dist/components/mg-input-radio.js +236 -231
  186. package/dist/components/mg-input-radio.js.map +1 -1
  187. package/dist/components/mg-input-select.d.ts +2 -2
  188. package/dist/components/mg-input-select2.js +316 -310
  189. package/dist/components/mg-input-select2.js.map +1 -1
  190. package/dist/components/mg-input-text.d.ts +2 -2
  191. package/dist/components/mg-input-text2.js +306 -300
  192. package/dist/components/mg-input-text2.js.map +1 -1
  193. package/dist/components/mg-input-textarea.d.ts +2 -2
  194. package/dist/components/mg-input-textarea.js +277 -271
  195. package/dist/components/mg-input-textarea.js.map +1 -1
  196. package/dist/components/mg-input-title.d.ts +2 -2
  197. package/dist/components/mg-input-title2.js +60 -60
  198. package/dist/components/mg-input-title2.js.map +1 -1
  199. package/dist/components/mg-input-toggle.d.ts +2 -2
  200. package/dist/components/mg-input-toggle.js +251 -251
  201. package/dist/components/mg-input-toggle.js.map +1 -1
  202. package/dist/components/mg-item-more.d.ts +2 -2
  203. package/dist/components/mg-item-more.js +285 -285
  204. package/dist/components/mg-item-more.js.map +1 -1
  205. package/dist/components/mg-menu-item.d.ts +2 -2
  206. package/dist/components/mg-menu-item2.js +345 -345
  207. package/dist/components/mg-menu-item2.js.map +1 -1
  208. package/dist/components/mg-menu.conf.js +2 -2
  209. package/dist/components/mg-menu.conf.js.map +1 -1
  210. package/dist/components/mg-menu.d.ts +2 -2
  211. package/dist/components/mg-menu2.js +176 -176
  212. package/dist/components/mg-menu2.js.map +1 -1
  213. package/dist/components/mg-message.d.ts +2 -2
  214. package/dist/components/mg-message.js +198 -193
  215. package/dist/components/mg-message.js.map +1 -1
  216. package/dist/components/mg-modal.d.ts +2 -2
  217. package/dist/components/mg-modal.js +198 -198
  218. package/dist/components/mg-modal.js.map +1 -1
  219. package/dist/components/mg-pagination.d.ts +2 -2
  220. package/dist/components/mg-pagination2.js +133 -133
  221. package/dist/components/mg-pagination2.js.map +1 -1
  222. package/dist/components/mg-panel.d.ts +2 -2
  223. package/dist/components/mg-panel.js +238 -238
  224. package/dist/components/mg-panel.js.map +1 -1
  225. package/dist/components/mg-popover-content.d.ts +2 -2
  226. package/dist/components/mg-popover-content2.js +70 -70
  227. package/dist/components/mg-popover-content2.js.map +1 -1
  228. package/dist/components/mg-popover.d.ts +2 -2
  229. package/dist/components/mg-popover2.js +224 -222
  230. package/dist/components/mg-popover2.js.map +1 -1
  231. package/dist/components/mg-skip-links.d.ts +2 -2
  232. package/dist/components/mg-skip-links.js +57 -57
  233. package/dist/components/mg-skip-links.js.map +1 -1
  234. package/dist/components/mg-tabs.d.ts +2 -2
  235. package/dist/components/mg-tabs.js +243 -243
  236. package/dist/components/mg-tabs.js.map +1 -1
  237. package/dist/components/mg-tag.d.ts +2 -2
  238. package/dist/components/mg-tag.js +97 -97
  239. package/dist/components/mg-tag.js.map +1 -1
  240. package/dist/components/mg-tooltip-content.d.ts +2 -2
  241. package/dist/components/mg-tooltip-content2.js +30 -30
  242. package/dist/components/mg-tooltip-content2.js.map +1 -1
  243. package/dist/components/mg-tooltip.d.ts +2 -2
  244. package/dist/components/mg-tooltip2.js +316 -316
  245. package/dist/components/mg-tooltip2.js.map +1 -1
  246. package/dist/components/popper.js +6 -12
  247. package/dist/components/popper.js.map +1 -1
  248. package/dist/esm/{components.utils-0f76010d.js → components.utils-0d67c31c.js} +102 -100
  249. package/dist/esm/components.utils-0d67c31c.js.map +1 -0
  250. package/dist/esm/{index-ce01e63b.js → index-f34a3a2c.js} +320 -137
  251. package/dist/esm/index-f34a3a2c.js.map +1 -0
  252. package/dist/esm/loader.js +3 -3
  253. package/dist/esm/mg-action-more_34.entry.js +5130 -5057
  254. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  255. package/dist/esm/mg-components.js +4 -4
  256. package/dist/esm/mg-components.js.map +1 -1
  257. package/dist/esm/mg-item-more.entry.js +224 -224
  258. package/dist/esm/mg-item-more.entry.js.map +1 -1
  259. package/dist/mg-components/locales/fr/messages.json +4 -4
  260. package/dist/mg-components/mg-components.css +1 -1
  261. package/dist/mg-components/mg-components.esm.js +1 -1
  262. package/dist/mg-components/mg-components.esm.js.map +1 -1
  263. package/dist/mg-components/p-629454f7.entry.js +2 -0
  264. package/dist/mg-components/p-629454f7.entry.js.map +1 -0
  265. package/dist/mg-components/p-7444ff40.js +3 -0
  266. package/dist/mg-components/p-7444ff40.js.map +1 -0
  267. package/dist/mg-components/p-af42d17b.js +2 -0
  268. package/dist/mg-components/p-af42d17b.js.map +1 -0
  269. package/dist/mg-components/{p-01ebc95a.entry.js → p-e0fb0f3c.entry.js} +2 -2
  270. package/dist/mg-components/p-e0fb0f3c.entry.js.map +1 -0
  271. package/dist/types/assets/icons/index.d.ts +193 -0
  272. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +41 -41
  273. package/dist/types/components/atoms/mg-button/mg-button.d.ts +100 -96
  274. package/dist/types/components/atoms/mg-card/mg-card.d.ts +39 -39
  275. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +37 -37
  276. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +12 -12
  277. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +56 -56
  278. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +34 -34
  279. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +51 -51
  280. package/dist/types/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.d.ts +12 -12
  281. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +3 -3
  282. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +113 -113
  283. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +10 -3
  284. package/dist/types/components/molecules/inputs/MgInput.d.ts +17 -16
  285. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +100 -100
  286. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +26 -26
  287. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +262 -260
  288. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +4 -4
  289. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +150 -149
  290. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +4 -4
  291. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +223 -222
  292. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +142 -141
  293. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +3 -3
  294. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +152 -151
  295. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +6 -6
  296. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +193 -192
  297. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +1 -6
  298. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +195 -194
  299. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +181 -180
  300. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +2 -2
  301. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +141 -141
  302. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +2 -2
  303. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +97 -97
  304. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +6 -6
  305. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +179 -179
  306. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +12 -11
  307. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +72 -72
  308. package/dist/types/components/molecules/mg-details/mg-details.d.ts +45 -45
  309. package/dist/types/components/molecules/mg-form/mg-form.d.ts +103 -104
  310. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +27 -27
  311. package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +5 -5
  312. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +61 -61
  313. package/dist/types/components/molecules/mg-message/mg-message.d.ts +100 -93
  314. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +107 -107
  315. package/dist/types/components/molecules/mg-pagination/mg-pagination.conf.d.ts +2 -2
  316. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +74 -74
  317. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +149 -149
  318. package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +43 -43
  319. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +88 -88
  320. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +2 -2
  321. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +40 -40
  322. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +10 -10
  323. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +118 -118
  324. package/dist/types/components.d.ts +296 -32
  325. package/dist/types/locales/index.d.ts +172 -172
  326. package/dist/types/stencil-public-runtime.d.ts +29 -0
  327. package/dist/types/utils/behaviors.utils.d.ts +65 -65
  328. package/dist/types/utils/components.utils.d.ts +32 -26
  329. package/dist/types/utils/locale.utils.d.ts +2 -2
  330. package/dist/types/utils/playwright.fixture.d.ts +3 -0
  331. package/dist/types/utils/unit.test.utils.d.ts +5 -5
  332. package/package.json +33 -47
  333. package/dist/cjs/components.utils-dc9c8a53.js.map +0 -1
  334. package/dist/cjs/index-c042e24b.js.map +0 -1
  335. package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js +0 -33
  336. package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js.map +0 -1
  337. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +0 -70
  338. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +0 -1
  339. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +0 -91
  340. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +0 -1
  341. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +0 -142
  342. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +0 -1
  343. package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js +0 -36
  344. package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js.map +0 -1
  345. package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js +0 -43
  346. package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js.map +0 -1
  347. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js +0 -15
  348. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js.map +0 -1
  349. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js +0 -42
  350. package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js.map +0 -1
  351. package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js +0 -11
  352. package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js.map +0 -1
  353. package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js +0 -14
  354. package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js.map +0 -1
  355. package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js +0 -55
  356. package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js.map +0 -1
  357. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +0 -84
  358. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +0 -1
  359. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js +0 -12
  360. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js.map +0 -1
  361. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js +0 -23
  362. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js.map +0 -1
  363. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +0 -23
  364. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +0 -1
  365. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +0 -71
  366. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +0 -1
  367. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +0 -138
  368. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +0 -1
  369. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +0 -272
  370. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +0 -1
  371. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +0 -237
  372. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +0 -1
  373. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +0 -640
  374. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +0 -1
  375. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js +0 -123
  376. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js.map +0 -1
  377. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +0 -379
  378. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +0 -1
  379. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js +0 -212
  380. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js.map +0 -1
  381. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +0 -456
  382. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +0 -1
  383. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js +0 -115
  384. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js.map +0 -1
  385. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +0 -289
  386. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +0 -1
  387. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +0 -154
  388. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +0 -1
  389. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +0 -355
  390. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +0 -1
  391. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js +0 -194
  392. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js.map +0 -1
  393. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +0 -399
  394. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +0 -1
  395. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +0 -147
  396. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +0 -1
  397. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +0 -353
  398. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +0 -1
  399. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js +0 -129
  400. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js.map +0 -1
  401. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +0 -318
  402. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +0 -1
  403. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js +0 -108
  404. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js.map +0 -1
  405. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +0 -247
  406. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +0 -1
  407. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js +0 -239
  408. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js.map +0 -1
  409. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js +0 -175
  410. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js.map +0 -1
  411. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js +0 -100
  412. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js.map +0 -1
  413. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js +0 -295
  414. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js.map +0 -1
  415. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js +0 -128
  416. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js.map +0 -1
  417. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js +0 -187
  418. package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js.map +0 -1
  419. package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js +0 -30
  420. package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js.map +0 -1
  421. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +0 -42
  422. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +0 -1
  423. package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js +0 -169
  424. package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js.map +0 -1
  425. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +0 -277
  426. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +0 -1
  427. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js +0 -39
  428. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js.map +0 -1
  429. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js +0 -36
  430. package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js.map +0 -1
  431. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js +0 -85
  432. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js.map +0 -1
  433. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js +0 -106
  434. package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js.map +0 -1
  435. package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js +0 -64
  436. package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js.map +0 -1
  437. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +0 -109
  438. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +0 -1
  439. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +0 -62
  440. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +0 -1
  441. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js +0 -40
  442. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js.map +0 -1
  443. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +0 -26
  444. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +0 -1
  445. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +0 -122
  446. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +0 -1
  447. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js +0 -57
  448. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js.map +0 -1
  449. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js +0 -121
  450. package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js.map +0 -1
  451. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +0 -106
  452. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +0 -1
  453. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +0 -213
  454. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +0 -1
  455. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js +0 -140
  456. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +0 -1
  457. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +0 -142
  458. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +0 -1
  459. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js +0 -55
  460. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js.map +0 -1
  461. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js +0 -55
  462. package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js.map +0 -1
  463. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js +0 -76
  464. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js.map +0 -1
  465. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +0 -332
  466. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +0 -1
  467. package/dist/collection/utils/stencil.e2e.test.utils.js +0 -33
  468. package/dist/collection/utils/stencil.e2e.test.utils.js.map +0 -1
  469. package/dist/esm/components.utils-0f76010d.js.map +0 -1
  470. package/dist/esm/index-ce01e63b.js.map +0 -1
  471. package/dist/mg-components/p-01ebc95a.entry.js.map +0 -1
  472. package/dist/mg-components/p-1aa89acf.js +0 -3
  473. package/dist/mg-components/p-1aa89acf.js.map +0 -1
  474. package/dist/mg-components/p-71a5a848.entry.js +0 -2
  475. package/dist/mg-components/p-71a5a848.entry.js.map +0 -1
  476. package/dist/mg-components/p-c9e2c669.js +0 -2
  477. package/dist/mg-components/p-c9e2c669.js.map +0 -1
  478. package/dist/types/components/atoms/mg-badge/test/mg-badge.e2e.playwright.d.ts +0 -1
  479. package/dist/types/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.d.ts +0 -1
  480. package/dist/types/components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts +0 -1
  481. package/dist/types/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.d.ts +0 -1
  482. package/dist/types/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.d.ts +0 -1
  483. package/dist/types/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.d.ts +0 -1
  484. package/dist/types/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.d.ts +0 -1
  485. package/dist/types/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.d.ts +0 -1
  486. package/dist/types/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.d.ts +0 -2
  487. package/dist/types/components/molecules/mg-details/test/mg-details.e2e.playwright.d.ts +0 -1
  488. package/dist/types/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.d.ts +0 -1
  489. package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.playwright.d.ts +0 -1
  490. package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.template.d.ts +0 -12
  491. package/dist/types/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.d.ts +0 -1
  492. package/dist/types/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.d.ts +0 -1
  493. package/dist/types/components/molecules/mg-panel/test/mg-panel.e2e.playwright.d.ts +0 -1
  494. package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +0 -1
  495. package/dist/types/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.d.ts +0 -1
  496. package/dist/types/utils/stencil.e2e.test.utils.d.ts +0 -14
@@ -1,783 +1,800 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { MgInput } from "../MgInput";
3
+ import { Handler } from "../MgInput.conf";
3
4
  import { ClassList, isValidString } from "../../../../utils/components.utils";
4
5
  import { initLocales } from "../../../../locales";
5
6
  const isDatalistOption = (options) => Array.isArray(options) && options.every(option => typeof option === 'string');
6
7
  export class MgInputText {
7
- constructor() {
8
- /************
9
- * Internal *
10
- ************/
11
- // Classes
12
- this.classFocus = 'mg-u-is-focused';
13
- this.classIsInputGroupAppend = 'mg-c-input--is-input-group-append';
14
- this.classHasIcon = 'mg-c-input--has-icon';
15
- // hasDisplayedError (triggered by blur event)
16
- this.hasDisplayedError = false;
17
- /**
18
- * Handle input event
19
- */
20
- this.handleInput = () => {
21
- this.checkValidity();
22
- if (this.hasDisplayedError) {
23
- this.setErrorMessage();
24
- }
25
- this.value = this.input.value;
26
- };
8
+ constructor() {
9
+ /************
10
+ * Internal *
11
+ ************/
12
+ // Classes
13
+ this.classFocus = 'mg-u-is-focused';
14
+ this.classIsInputGroupAppend = 'mg-c-input--is-input-group-append';
15
+ this.classHasIcon = 'mg-c-input--has-icon';
16
+ // hasDisplayedError (triggered by blur event)
17
+ this.hasDisplayedError = false;
18
+ /**
19
+ * Handle input event
20
+ */
21
+ this.handleInput = () => {
22
+ this.checkValidity();
23
+ if (this.hasDisplayedError) {
24
+ this.setErrorMessage();
25
+ }
26
+ this.value = this.input.value;
27
+ };
28
+ /**
29
+ * Handle focus event
30
+ */
31
+ this.handleFocus = () => {
32
+ this.classCollection.add(this.classFocus);
33
+ this.classCollection = new ClassList(this.classCollection.classes);
34
+ };
35
+ /**
36
+ * Handle blur event
37
+ */
38
+ this.handleBlur = () => {
39
+ // Manage focus
40
+ this.classCollection.delete(this.classFocus);
41
+ this.classCollection = new ClassList(this.classCollection.classes);
42
+ // Display Error
43
+ this.handlerInProgress = Handler.BLUR;
44
+ this.displayError().finally(() => {
45
+ // reset guard
46
+ this.handlerInProgress = undefined;
47
+ });
48
+ };
49
+ /**
50
+ * Check if input is valid
51
+ */
52
+ this.checkValidity = () => {
53
+ var _a;
54
+ this.setValidity(this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined ? this.input.checkValidity() : true));
55
+ };
56
+ /**
57
+ * Set input error message
58
+ * @param errorMessage - errorMessage override
59
+ */
60
+ this.setErrorMessage = (errorMessage) => {
61
+ // Set error message
62
+ this.errorMessage = undefined;
63
+ // Does have a custom error message
64
+ if (!this.valid && errorMessage !== undefined) {
65
+ this.errorMessage = errorMessage;
66
+ }
67
+ // Does not match pattern
68
+ else if (!this.valid && this.input.validity.patternMismatch) {
69
+ this.errorMessage = this.patternErrorMessage;
70
+ }
71
+ // required
72
+ else if (!this.valid && this.input.validity.valueMissing) {
73
+ this.errorMessage = this.messages.errors.required;
74
+ }
75
+ };
76
+ /**
77
+ * Validate append slot
78
+ */
79
+ this.validateAppendSlot = () => {
80
+ const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
81
+ if (slotAppendInput.length === 1) {
82
+ this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-c-input--is-append-input-slot-content');
83
+ }
84
+ else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
85
+ this.classCollection.add(this.classIsInputGroupAppend);
86
+ this.classCollection.add('mg-c-input--has-buttons-group-append');
87
+ }
88
+ };
89
+ /**
90
+ * Methode to control datalist display condition
91
+ * @returns true if display condition success
92
+ */
93
+ this.hasDatalist = () => isDatalistOption(this.datalistoptions) && this.datalistoptions.length > 0;
94
+ this.value = undefined;
95
+ this.identifier = undefined;
96
+ this.name = this.identifier;
97
+ this.label = undefined;
98
+ this.type = 'text';
99
+ this.icon = undefined;
100
+ this.labelOnTop = undefined;
101
+ this.labelHide = false;
102
+ this.placeholder = undefined;
103
+ this.datalistoptions = undefined;
104
+ this.maxlength = 400;
105
+ this.required = false;
106
+ this.readonly = false;
107
+ this.disabled = false;
108
+ this.mgWidth = 'full';
109
+ this.pattern = undefined;
110
+ this.patternErrorMessage = undefined;
111
+ this.tooltip = undefined;
112
+ this.displayCharacterLeft = true;
113
+ this.helpText = undefined;
114
+ this.valid = undefined;
115
+ this.invalid = undefined;
116
+ this.classCollection = new ClassList(['mg-c-input--text']);
117
+ this.errorMessage = undefined;
118
+ }
119
+ handleValue(newValue) {
120
+ this.valueChange.emit(newValue);
121
+ }
122
+ validateIcon(newValue) {
123
+ if (newValue !== undefined) {
124
+ this.classCollection.add(this.classHasIcon);
125
+ }
126
+ else {
127
+ this.classCollection.delete(this.classHasIcon);
128
+ }
129
+ }
130
+ validateDatalistoptions(newValue) {
131
+ if (Boolean(newValue) && !isDatalistOption(newValue)) {
132
+ throw new Error('<mg-input-text> prop "datalistoptions" values must be the same type, string.');
133
+ }
134
+ }
135
+ handleValidityChange(newValue, _oldValue, prop) {
136
+ if (this.input !== undefined) {
137
+ this.input[prop] = newValue;
138
+ this.checkValidity();
139
+ if (this.hasDisplayedError) {
140
+ this.setErrorMessage();
141
+ this.hasDisplayedError = false;
142
+ }
143
+ }
144
+ }
145
+ validatePattern(newValue) {
146
+ if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {
147
+ throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
148
+ }
149
+ }
27
150
  /**
28
- * Handle focus event
151
+ * Public method to play input focus
29
152
  */
30
- this.handleFocus = () => {
31
- this.classCollection.add(this.classFocus);
32
- this.classCollection = new ClassList(this.classCollection.classes);
33
- };
153
+ async setFocus() {
154
+ this.input.focus();
155
+ }
34
156
  /**
35
- * Handle blur event
157
+ * Display input error if it exists.
36
158
  */
37
- this.handleBlur = () => {
38
- // Manage focus
39
- this.classCollection.delete(this.classFocus);
40
- this.classCollection = new ClassList(this.classCollection.classes);
41
- // Display Error
42
- this.displayError();
43
- };
159
+ async displayError() {
160
+ this.checkValidity();
161
+ this.setErrorMessage();
162
+ this.hasDisplayedError = this.invalid;
163
+ }
44
164
  /**
45
- * Check if input is valid
165
+ * Set an error and display a custom error message.
166
+ * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
167
+ * It must be paired with an error message to display for the given context.
168
+ * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
169
+ * @param valid - value indicating the validity
170
+ * @param errorMessage - the error message to display
46
171
  */
47
- this.checkValidity = () => {
48
- var _a;
49
- this.setValidity(this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined ? this.input.checkValidity() : true));
50
- };
172
+ async setError(valid, errorMessage) {
173
+ if (typeof valid !== 'boolean') {
174
+ throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
175
+ }
176
+ else if (!isValidString(errorMessage)) {
177
+ throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
178
+ }
179
+ else {
180
+ this.setValidity(valid);
181
+ this.setErrorMessage(valid ? undefined : errorMessage);
182
+ this.hasDisplayedError = this.invalid;
183
+ }
184
+ }
51
185
  /**
52
- * Set input error message
53
- * @param errorMessage - errorMessage override
186
+ * Method to set validity values
187
+ * @param newValue - valid new value
54
188
  */
55
- this.setErrorMessage = (errorMessage) => {
56
- // Set error message
57
- this.errorMessage = undefined;
58
- // Does have a custom error message
59
- if (!this.valid && errorMessage !== undefined) {
60
- this.errorMessage = errorMessage;
61
- }
62
- // Does not match pattern
63
- else if (!this.valid && this.input.validity.patternMismatch) {
64
- this.errorMessage = this.patternErrorMessage;
65
- }
66
- // required
67
- else if (!this.valid && this.input.validity.valueMissing) {
68
- this.errorMessage = this.messages.errors.required;
69
- }
70
- };
189
+ setValidity(newValue) {
190
+ const oldValidValue = this.valid;
191
+ this.valid = newValue;
192
+ this.invalid = !this.valid;
193
+ // We need to send valid event even if it is the same value
194
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === Handler.BLUR && this.valid !== oldValidValue))
195
+ this.inputValid.emit(this.valid);
196
+ }
197
+ /*************
198
+ * Lifecycle *
199
+ *************/
71
200
  /**
72
- * Validate append slot
201
+ * Check if component props are well configured on init
202
+ * @returns timeout
73
203
  */
74
- this.validateAppendSlot = () => {
75
- const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
76
- if (slotAppendInput.length === 1) {
77
- this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-c-input--is-append-input-slot-content');
78
- }
79
- else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
80
- this.classCollection.add(this.classIsInputGroupAppend);
81
- this.classCollection.add('mg-c-input--has-buttons-group-append');
82
- }
83
- };
204
+ componentWillLoad() {
205
+ // Get locales
206
+ this.messages = initLocales(this.element).messages;
207
+ this.characterLeftId = `${this.identifier}-character-left`;
208
+ this.datalistId = `${this.identifier}-datalist`;
209
+ // Validate
210
+ this.validateIcon(this.icon);
211
+ this.validateDatalistoptions(this.datalistoptions);
212
+ this.validatePattern(this.pattern);
213
+ this.validatePattern(this.patternErrorMessage);
214
+ this.validateAppendSlot();
215
+ // Check validity when component is ready
216
+ // return a promise to process action only in the FIRST render().
217
+ // https://stenciljs.com/docs/component-lifecycle#componentwillload
218
+ return setTimeout(() => {
219
+ this.checkValidity();
220
+ }, 0);
221
+ }
84
222
  /**
85
- * Methode to control datalist display condition
86
- * @returns true if display condition success
223
+ * Render
224
+ * @returns HTML Element
87
225
  */
88
- this.hasDatalist = () => isDatalistOption(this.datalistoptions) && this.datalistoptions.length > 0;
89
- this.value = undefined;
90
- this.identifier = undefined;
91
- this.name = this.identifier;
92
- this.label = undefined;
93
- this.type = 'text';
94
- this.icon = undefined;
95
- this.labelOnTop = undefined;
96
- this.labelHide = false;
97
- this.placeholder = undefined;
98
- this.datalistoptions = undefined;
99
- this.maxlength = 400;
100
- this.required = false;
101
- this.readonly = false;
102
- this.disabled = false;
103
- this.mgWidth = 'full';
104
- this.pattern = undefined;
105
- this.patternErrorMessage = undefined;
106
- this.tooltip = undefined;
107
- this.displayCharacterLeft = true;
108
- this.helpText = undefined;
109
- this.valid = undefined;
110
- this.invalid = undefined;
111
- this.classCollection = new ClassList(['mg-c-input--text']);
112
- this.errorMessage = undefined;
113
- }
114
- handleValue(newValue) {
115
- this.valueChange.emit(newValue);
116
- }
117
- validateIcon(newValue) {
118
- if (newValue !== undefined) {
119
- this.classCollection.add(this.classHasIcon);
120
- }
121
- else {
122
- this.classCollection.delete(this.classHasIcon);
123
- }
124
- }
125
- validateDatalistoptions(newValue) {
126
- if (Boolean(newValue) && !isDatalistOption(newValue)) {
127
- throw new Error('<mg-input-text> prop "datalistoptions" values must be the same type, string.');
226
+ render() {
227
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, 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-c-input__with-character-left", style: {
228
+ '--mg-character-left-message-length': (this.displayCharacterLeft
229
+ ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
230
+ : 0).toString(),
231
+ } }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { type: this.type, class: "mg-c-input__box", value: this.value, id: this.identifier, list: this.hasDatalist() ? this.datalistId : undefined, autocomplete: this.hasDatalist() ? 'off' : undefined, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
232
+ if (el !== null)
233
+ this.input = el;
234
+ } }), this.hasDatalist() && (h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), h("slot", { name: "append-input" })));
128
235
  }
129
- }
130
- handleValidityChange(newValue, _oldValue, prop) {
131
- if (this.input !== undefined) {
132
- this.input[prop] = newValue;
133
- this.checkValidity();
134
- if (this.hasDisplayedError) {
135
- this.setErrorMessage();
136
- this.hasDisplayedError = false;
137
- }
236
+ static get is() { return "mg-input-text"; }
237
+ static get encapsulation() { return "shadow"; }
238
+ static get originalStyleUrls() {
239
+ return {
240
+ "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-input-text.css"]
241
+ };
138
242
  }
139
- }
140
- validatePattern(newValue) {
141
- if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {
142
- throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
243
+ static get styleUrls() {
244
+ return {
245
+ "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-input-text.css"]
246
+ };
143
247
  }
144
- }
145
- /**
146
- * Public method to play input focus
147
- */
148
- async setFocus() {
149
- this.input.focus();
150
- }
151
- /**
152
- * Display input error if it exists.
153
- */
154
- async displayError() {
155
- this.checkValidity();
156
- this.setErrorMessage();
157
- this.hasDisplayedError = this.invalid;
158
- }
159
- /**
160
- * Set an error and display a custom error message.
161
- * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
162
- * It must be paired with an error message to display for the given context.
163
- * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
164
- * @param valid - value indicating the validity
165
- * @param errorMessage - the error message to display
166
- */
167
- async setError(valid, errorMessage) {
168
- if (typeof valid !== 'boolean') {
169
- throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
170
- }
171
- else if (!isValidString(errorMessage)) {
172
- throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
248
+ static get properties() {
249
+ return {
250
+ "value": {
251
+ "type": "string",
252
+ "mutable": true,
253
+ "complexType": {
254
+ "original": "string",
255
+ "resolved": "string",
256
+ "references": {}
257
+ },
258
+ "required": false,
259
+ "optional": false,
260
+ "docs": {
261
+ "tags": [],
262
+ "text": "Component value"
263
+ },
264
+ "attribute": "value",
265
+ "reflect": true
266
+ },
267
+ "identifier": {
268
+ "type": "string",
269
+ "mutable": false,
270
+ "complexType": {
271
+ "original": "string",
272
+ "resolved": "string",
273
+ "references": {}
274
+ },
275
+ "required": true,
276
+ "optional": false,
277
+ "docs": {
278
+ "tags": [],
279
+ "text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)"
280
+ },
281
+ "attribute": "identifier",
282
+ "reflect": false
283
+ },
284
+ "name": {
285
+ "type": "string",
286
+ "mutable": false,
287
+ "complexType": {
288
+ "original": "string",
289
+ "resolved": "string",
290
+ "references": {}
291
+ },
292
+ "required": false,
293
+ "optional": false,
294
+ "docs": {
295
+ "tags": [],
296
+ "text": "Input name\nIf not set the value equals the identifier"
297
+ },
298
+ "attribute": "name",
299
+ "reflect": false,
300
+ "defaultValue": "this.identifier"
301
+ },
302
+ "label": {
303
+ "type": "string",
304
+ "mutable": false,
305
+ "complexType": {
306
+ "original": "string",
307
+ "resolved": "string",
308
+ "references": {}
309
+ },
310
+ "required": true,
311
+ "optional": false,
312
+ "docs": {
313
+ "tags": [],
314
+ "text": "Input label"
315
+ },
316
+ "attribute": "label",
317
+ "reflect": false
318
+ },
319
+ "type": {
320
+ "type": "string",
321
+ "mutable": false,
322
+ "complexType": {
323
+ "original": "TextType",
324
+ "resolved": "\"search\" | \"text\"",
325
+ "references": {
326
+ "TextType": {
327
+ "location": "import",
328
+ "path": "./mg-input-text.conf",
329
+ "id": "src/components/molecules/inputs/mg-input-text/mg-input-text.conf.ts::TextType"
330
+ }
331
+ }
332
+ },
333
+ "required": false,
334
+ "optional": false,
335
+ "docs": {
336
+ "tags": [],
337
+ "text": "Input type"
338
+ },
339
+ "attribute": "type",
340
+ "reflect": false,
341
+ "defaultValue": "'text'"
342
+ },
343
+ "icon": {
344
+ "type": "string",
345
+ "mutable": false,
346
+ "complexType": {
347
+ "original": "string",
348
+ "resolved": "string",
349
+ "references": {}
350
+ },
351
+ "required": false,
352
+ "optional": false,
353
+ "docs": {
354
+ "tags": [],
355
+ "text": "Input icon"
356
+ },
357
+ "attribute": "icon",
358
+ "reflect": false
359
+ },
360
+ "labelOnTop": {
361
+ "type": "boolean",
362
+ "mutable": false,
363
+ "complexType": {
364
+ "original": "boolean",
365
+ "resolved": "boolean",
366
+ "references": {}
367
+ },
368
+ "required": false,
369
+ "optional": false,
370
+ "docs": {
371
+ "tags": [],
372
+ "text": "Define if label is displayed on top"
373
+ },
374
+ "attribute": "label-on-top",
375
+ "reflect": false
376
+ },
377
+ "labelHide": {
378
+ "type": "boolean",
379
+ "mutable": false,
380
+ "complexType": {
381
+ "original": "boolean",
382
+ "resolved": "boolean",
383
+ "references": {}
384
+ },
385
+ "required": false,
386
+ "optional": false,
387
+ "docs": {
388
+ "tags": [],
389
+ "text": "Define if label is visible"
390
+ },
391
+ "attribute": "label-hide",
392
+ "reflect": false,
393
+ "defaultValue": "false"
394
+ },
395
+ "placeholder": {
396
+ "type": "string",
397
+ "mutable": false,
398
+ "complexType": {
399
+ "original": "string",
400
+ "resolved": "string",
401
+ "references": {}
402
+ },
403
+ "required": false,
404
+ "optional": false,
405
+ "docs": {
406
+ "tags": [],
407
+ "text": "Input placeholder.\nIt should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text."
408
+ },
409
+ "attribute": "placeholder",
410
+ "reflect": false
411
+ },
412
+ "datalistoptions": {
413
+ "type": "unknown",
414
+ "mutable": false,
415
+ "complexType": {
416
+ "original": "string[]",
417
+ "resolved": "string[]",
418
+ "references": {}
419
+ },
420
+ "required": false,
421
+ "optional": false,
422
+ "docs": {
423
+ "tags": [],
424
+ "text": "Define datalist options"
425
+ }
426
+ },
427
+ "maxlength": {
428
+ "type": "number",
429
+ "mutable": false,
430
+ "complexType": {
431
+ "original": "number",
432
+ "resolved": "number",
433
+ "references": {}
434
+ },
435
+ "required": false,
436
+ "optional": false,
437
+ "docs": {
438
+ "tags": [],
439
+ "text": "Input max length"
440
+ },
441
+ "attribute": "maxlength",
442
+ "reflect": false,
443
+ "defaultValue": "400"
444
+ },
445
+ "required": {
446
+ "type": "boolean",
447
+ "mutable": false,
448
+ "complexType": {
449
+ "original": "boolean",
450
+ "resolved": "boolean",
451
+ "references": {}
452
+ },
453
+ "required": false,
454
+ "optional": false,
455
+ "docs": {
456
+ "tags": [],
457
+ "text": "Define if input is required"
458
+ },
459
+ "attribute": "required",
460
+ "reflect": false,
461
+ "defaultValue": "false"
462
+ },
463
+ "readonly": {
464
+ "type": "boolean",
465
+ "mutable": false,
466
+ "complexType": {
467
+ "original": "boolean",
468
+ "resolved": "boolean",
469
+ "references": {}
470
+ },
471
+ "required": false,
472
+ "optional": false,
473
+ "docs": {
474
+ "tags": [],
475
+ "text": "Define if input is readonly"
476
+ },
477
+ "attribute": "readonly",
478
+ "reflect": false,
479
+ "defaultValue": "false"
480
+ },
481
+ "disabled": {
482
+ "type": "boolean",
483
+ "mutable": false,
484
+ "complexType": {
485
+ "original": "boolean",
486
+ "resolved": "boolean",
487
+ "references": {}
488
+ },
489
+ "required": false,
490
+ "optional": false,
491
+ "docs": {
492
+ "tags": [],
493
+ "text": "Define if input is disabled"
494
+ },
495
+ "attribute": "disabled",
496
+ "reflect": false,
497
+ "defaultValue": "false"
498
+ },
499
+ "mgWidth": {
500
+ "type": "any",
501
+ "mutable": false,
502
+ "complexType": {
503
+ "original": "Width",
504
+ "resolved": "\"full\" | 16 | 2 | 4",
505
+ "references": {
506
+ "Width": {
507
+ "location": "import",
508
+ "path": "../MgInput.conf",
509
+ "id": "src/components/molecules/inputs/MgInput.conf.ts::Width"
510
+ }
511
+ }
512
+ },
513
+ "required": false,
514
+ "optional": false,
515
+ "docs": {
516
+ "tags": [],
517
+ "text": "Define input width"
518
+ },
519
+ "attribute": "mg-width",
520
+ "reflect": false,
521
+ "defaultValue": "'full'"
522
+ },
523
+ "pattern": {
524
+ "type": "string",
525
+ "mutable": false,
526
+ "complexType": {
527
+ "original": "string",
528
+ "resolved": "string",
529
+ "references": {}
530
+ },
531
+ "required": false,
532
+ "optional": false,
533
+ "docs": {
534
+ "tags": [],
535
+ "text": "Define input pattern to validate"
536
+ },
537
+ "attribute": "pattern",
538
+ "reflect": false
539
+ },
540
+ "patternErrorMessage": {
541
+ "type": "string",
542
+ "mutable": false,
543
+ "complexType": {
544
+ "original": "string",
545
+ "resolved": "string",
546
+ "references": {}
547
+ },
548
+ "required": false,
549
+ "optional": false,
550
+ "docs": {
551
+ "tags": [],
552
+ "text": "Define input pattern error message"
553
+ },
554
+ "attribute": "pattern-error-message",
555
+ "reflect": false
556
+ },
557
+ "tooltip": {
558
+ "type": "string",
559
+ "mutable": false,
560
+ "complexType": {
561
+ "original": "string",
562
+ "resolved": "string",
563
+ "references": {}
564
+ },
565
+ "required": false,
566
+ "optional": false,
567
+ "docs": {
568
+ "tags": [],
569
+ "text": "Add a tooltip message next to the input"
570
+ },
571
+ "attribute": "tooltip",
572
+ "reflect": false
573
+ },
574
+ "displayCharacterLeft": {
575
+ "type": "boolean",
576
+ "mutable": false,
577
+ "complexType": {
578
+ "original": "boolean",
579
+ "resolved": "boolean",
580
+ "references": {}
581
+ },
582
+ "required": false,
583
+ "optional": false,
584
+ "docs": {
585
+ "tags": [],
586
+ "text": "Define if component should display character left"
587
+ },
588
+ "attribute": "display-character-left",
589
+ "reflect": false,
590
+ "defaultValue": "true"
591
+ },
592
+ "helpText": {
593
+ "type": "string",
594
+ "mutable": false,
595
+ "complexType": {
596
+ "original": "string",
597
+ "resolved": "string",
598
+ "references": {}
599
+ },
600
+ "required": false,
601
+ "optional": false,
602
+ "docs": {
603
+ "tags": [],
604
+ "text": "Add a help text under the input, usually expected data format and example"
605
+ },
606
+ "attribute": "help-text",
607
+ "reflect": false
608
+ },
609
+ "valid": {
610
+ "type": "boolean",
611
+ "mutable": true,
612
+ "complexType": {
613
+ "original": "boolean",
614
+ "resolved": "boolean",
615
+ "references": {}
616
+ },
617
+ "required": false,
618
+ "optional": false,
619
+ "docs": {
620
+ "tags": [],
621
+ "text": "Define input valid state"
622
+ },
623
+ "attribute": "valid",
624
+ "reflect": false
625
+ },
626
+ "invalid": {
627
+ "type": "boolean",
628
+ "mutable": true,
629
+ "complexType": {
630
+ "original": "boolean",
631
+ "resolved": "boolean",
632
+ "references": {}
633
+ },
634
+ "required": false,
635
+ "optional": false,
636
+ "docs": {
637
+ "tags": [],
638
+ "text": "Define input invalid state"
639
+ },
640
+ "attribute": "invalid",
641
+ "reflect": false
642
+ }
643
+ };
173
644
  }
174
- else {
175
- this.setValidity(valid);
176
- this.setErrorMessage(valid ? undefined : errorMessage);
177
- this.hasDisplayedError = this.invalid;
645
+ static get states() {
646
+ return {
647
+ "classCollection": {},
648
+ "errorMessage": {}
649
+ };
178
650
  }
179
- }
180
- /**
181
- * Method to set validity values
182
- * @param newValue - valid new value
183
- */
184
- setValidity(newValue) {
185
- this.valid = newValue;
186
- this.invalid = !this.valid;
187
- // We need to send valid event even if it is the same value
188
- this.inputValid.emit(this.valid);
189
- }
190
- /*************
191
- * Lifecycle *
192
- *************/
193
- /**
194
- * Check if component props are well configured on init
195
- * @returns timeout
196
- */
197
- componentWillLoad() {
198
- // Get locales
199
- this.messages = initLocales(this.element).messages;
200
- this.characterLeftId = `${this.identifier}-character-left`;
201
- this.datalistId = `${this.identifier}-datalist`;
202
- // Validate
203
- this.validateIcon(this.icon);
204
- this.validateDatalistoptions(this.datalistoptions);
205
- this.validatePattern(this.pattern);
206
- this.validatePattern(this.patternErrorMessage);
207
- this.validateAppendSlot();
208
- // Check validity when component is ready
209
- // return a promise to process action only in the FIRST render().
210
- // https://stenciljs.com/docs/component-lifecycle#componentwillload
211
- return setTimeout(() => {
212
- this.checkValidity();
213
- }, 0);
214
- }
215
- /**
216
- * Render
217
- * @returns HTML Element
218
- */
219
- render() {
220
- return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, 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-c-input__with-character-left", style: {
221
- '--mg-character-left-message-length': (this.displayCharacterLeft
222
- ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
223
- : 0).toString(),
224
- } }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { type: this.type, class: "mg-c-input__box", value: this.value, id: this.identifier, list: this.hasDatalist() ? this.datalistId : undefined, autocomplete: this.hasDatalist() ? 'off' : undefined, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
225
- if (el !== null)
226
- this.input = el;
227
- } }), this.hasDatalist() && (h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), h("slot", { name: "append-input" })));
228
- }
229
- static get is() { return "mg-input-text"; }
230
- static get encapsulation() { return "shadow"; }
231
- static get originalStyleUrls() {
232
- return {
233
- "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-input-text.css"]
234
- };
235
- }
236
- static get styleUrls() {
237
- return {
238
- "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-input-text.css"]
239
- };
240
- }
241
- static get properties() {
242
- return {
243
- "value": {
244
- "type": "string",
245
- "mutable": true,
246
- "complexType": {
247
- "original": "string",
248
- "resolved": "string",
249
- "references": {}
250
- },
251
- "required": false,
252
- "optional": false,
253
- "docs": {
254
- "tags": [],
255
- "text": "Component value"
256
- },
257
- "attribute": "value",
258
- "reflect": true
259
- },
260
- "identifier": {
261
- "type": "string",
262
- "mutable": false,
263
- "complexType": {
264
- "original": "string",
265
- "resolved": "string",
266
- "references": {}
267
- },
268
- "required": true,
269
- "optional": false,
270
- "docs": {
271
- "tags": [],
272
- "text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)"
273
- },
274
- "attribute": "identifier",
275
- "reflect": false
276
- },
277
- "name": {
278
- "type": "string",
279
- "mutable": false,
280
- "complexType": {
281
- "original": "string",
282
- "resolved": "string",
283
- "references": {}
284
- },
285
- "required": false,
286
- "optional": false,
287
- "docs": {
288
- "tags": [],
289
- "text": "Input name\nIf not set the value equals the identifier"
290
- },
291
- "attribute": "name",
292
- "reflect": false,
293
- "defaultValue": "this.identifier"
294
- },
295
- "label": {
296
- "type": "string",
297
- "mutable": false,
298
- "complexType": {
299
- "original": "string",
300
- "resolved": "string",
301
- "references": {}
302
- },
303
- "required": true,
304
- "optional": false,
305
- "docs": {
306
- "tags": [],
307
- "text": "Input label"
308
- },
309
- "attribute": "label",
310
- "reflect": false
311
- },
312
- "type": {
313
- "type": "string",
314
- "mutable": false,
315
- "complexType": {
316
- "original": "TextType",
317
- "resolved": "\"search\" | \"text\"",
318
- "references": {
319
- "TextType": {
320
- "location": "import",
321
- "path": "./mg-input-text.conf",
322
- "id": "src/components/molecules/inputs/mg-input-text/mg-input-text.conf.ts::TextType"
323
- }
324
- }
325
- },
326
- "required": false,
327
- "optional": false,
328
- "docs": {
329
- "tags": [],
330
- "text": "Input type"
331
- },
332
- "attribute": "type",
333
- "reflect": false,
334
- "defaultValue": "'text'"
335
- },
336
- "icon": {
337
- "type": "string",
338
- "mutable": false,
339
- "complexType": {
340
- "original": "string",
341
- "resolved": "string",
342
- "references": {}
343
- },
344
- "required": false,
345
- "optional": false,
346
- "docs": {
347
- "tags": [],
348
- "text": "Input icon"
349
- },
350
- "attribute": "icon",
351
- "reflect": false
352
- },
353
- "labelOnTop": {
354
- "type": "boolean",
355
- "mutable": false,
356
- "complexType": {
357
- "original": "boolean",
358
- "resolved": "boolean",
359
- "references": {}
360
- },
361
- "required": false,
362
- "optional": false,
363
- "docs": {
364
- "tags": [],
365
- "text": "Define if label is displayed on top"
366
- },
367
- "attribute": "label-on-top",
368
- "reflect": false
369
- },
370
- "labelHide": {
371
- "type": "boolean",
372
- "mutable": false,
373
- "complexType": {
374
- "original": "boolean",
375
- "resolved": "boolean",
376
- "references": {}
377
- },
378
- "required": false,
379
- "optional": false,
380
- "docs": {
381
- "tags": [],
382
- "text": "Define if label is visible"
383
- },
384
- "attribute": "label-hide",
385
- "reflect": false,
386
- "defaultValue": "false"
387
- },
388
- "placeholder": {
389
- "type": "string",
390
- "mutable": false,
391
- "complexType": {
392
- "original": "string",
393
- "resolved": "string",
394
- "references": {}
395
- },
396
- "required": false,
397
- "optional": false,
398
- "docs": {
399
- "tags": [],
400
- "text": "Input placeholder.\nIt should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text."
401
- },
402
- "attribute": "placeholder",
403
- "reflect": false
404
- },
405
- "datalistoptions": {
406
- "type": "unknown",
407
- "mutable": false,
408
- "complexType": {
409
- "original": "string[]",
410
- "resolved": "string[]",
411
- "references": {}
412
- },
413
- "required": false,
414
- "optional": false,
415
- "docs": {
416
- "tags": [],
417
- "text": "Define datalist options"
418
- }
419
- },
420
- "maxlength": {
421
- "type": "number",
422
- "mutable": false,
423
- "complexType": {
424
- "original": "number",
425
- "resolved": "number",
426
- "references": {}
427
- },
428
- "required": false,
429
- "optional": false,
430
- "docs": {
431
- "tags": [],
432
- "text": "Input max length"
433
- },
434
- "attribute": "maxlength",
435
- "reflect": false,
436
- "defaultValue": "400"
437
- },
438
- "required": {
439
- "type": "boolean",
440
- "mutable": false,
441
- "complexType": {
442
- "original": "boolean",
443
- "resolved": "boolean",
444
- "references": {}
445
- },
446
- "required": false,
447
- "optional": false,
448
- "docs": {
449
- "tags": [],
450
- "text": "Define if input is required"
451
- },
452
- "attribute": "required",
453
- "reflect": false,
454
- "defaultValue": "false"
455
- },
456
- "readonly": {
457
- "type": "boolean",
458
- "mutable": false,
459
- "complexType": {
460
- "original": "boolean",
461
- "resolved": "boolean",
462
- "references": {}
463
- },
464
- "required": false,
465
- "optional": false,
466
- "docs": {
467
- "tags": [],
468
- "text": "Define if input is readonly"
469
- },
470
- "attribute": "readonly",
471
- "reflect": false,
472
- "defaultValue": "false"
473
- },
474
- "disabled": {
475
- "type": "boolean",
476
- "mutable": false,
477
- "complexType": {
478
- "original": "boolean",
479
- "resolved": "boolean",
480
- "references": {}
481
- },
482
- "required": false,
483
- "optional": false,
484
- "docs": {
485
- "tags": [],
486
- "text": "Define if input is disabled"
487
- },
488
- "attribute": "disabled",
489
- "reflect": false,
490
- "defaultValue": "false"
491
- },
492
- "mgWidth": {
493
- "type": "any",
494
- "mutable": false,
495
- "complexType": {
496
- "original": "Width",
497
- "resolved": "\"full\" | 16 | 2 | 4",
498
- "references": {
499
- "Width": {
500
- "location": "import",
501
- "path": "../MgInput.conf",
502
- "id": "src/components/molecules/inputs/MgInput.conf.ts::Width"
503
- }
504
- }
505
- },
506
- "required": false,
507
- "optional": false,
508
- "docs": {
509
- "tags": [],
510
- "text": "Define input width"
511
- },
512
- "attribute": "mg-width",
513
- "reflect": false,
514
- "defaultValue": "'full'"
515
- },
516
- "pattern": {
517
- "type": "string",
518
- "mutable": false,
519
- "complexType": {
520
- "original": "string",
521
- "resolved": "string",
522
- "references": {}
523
- },
524
- "required": false,
525
- "optional": false,
526
- "docs": {
527
- "tags": [],
528
- "text": "Define input pattern to validate"
529
- },
530
- "attribute": "pattern",
531
- "reflect": false
532
- },
533
- "patternErrorMessage": {
534
- "type": "string",
535
- "mutable": false,
536
- "complexType": {
537
- "original": "string",
538
- "resolved": "string",
539
- "references": {}
540
- },
541
- "required": false,
542
- "optional": false,
543
- "docs": {
544
- "tags": [],
545
- "text": "Define input pattern error message"
546
- },
547
- "attribute": "pattern-error-message",
548
- "reflect": false
549
- },
550
- "tooltip": {
551
- "type": "string",
552
- "mutable": false,
553
- "complexType": {
554
- "original": "string",
555
- "resolved": "string",
556
- "references": {}
557
- },
558
- "required": false,
559
- "optional": false,
560
- "docs": {
561
- "tags": [],
562
- "text": "Add a tooltip message next to the input"
563
- },
564
- "attribute": "tooltip",
565
- "reflect": false
566
- },
567
- "displayCharacterLeft": {
568
- "type": "boolean",
569
- "mutable": false,
570
- "complexType": {
571
- "original": "boolean",
572
- "resolved": "boolean",
573
- "references": {}
574
- },
575
- "required": false,
576
- "optional": false,
577
- "docs": {
578
- "tags": [],
579
- "text": "Define if component should display character left"
580
- },
581
- "attribute": "display-character-left",
582
- "reflect": false,
583
- "defaultValue": "true"
584
- },
585
- "helpText": {
586
- "type": "string",
587
- "mutable": false,
588
- "complexType": {
589
- "original": "string",
590
- "resolved": "string",
591
- "references": {}
592
- },
593
- "required": false,
594
- "optional": false,
595
- "docs": {
596
- "tags": [],
597
- "text": "Add a help text under the input, usually expected data format and example"
598
- },
599
- "attribute": "help-text",
600
- "reflect": false
601
- },
602
- "valid": {
603
- "type": "boolean",
604
- "mutable": true,
605
- "complexType": {
606
- "original": "boolean",
607
- "resolved": "boolean",
608
- "references": {}
609
- },
610
- "required": false,
611
- "optional": false,
612
- "docs": {
613
- "tags": [],
614
- "text": "Define input valid state"
615
- },
616
- "attribute": "valid",
617
- "reflect": false
618
- },
619
- "invalid": {
620
- "type": "boolean",
621
- "mutable": true,
622
- "complexType": {
623
- "original": "boolean",
624
- "resolved": "boolean",
625
- "references": {}
626
- },
627
- "required": false,
628
- "optional": false,
629
- "docs": {
630
- "tags": [],
631
- "text": "Define input invalid state"
632
- },
633
- "attribute": "invalid",
634
- "reflect": false
635
- }
636
- };
637
- }
638
- static get states() {
639
- return {
640
- "classCollection": {},
641
- "errorMessage": {}
642
- };
643
- }
644
- static get events() {
645
- return [{
646
- "method": "valueChange",
647
- "name": "value-change",
648
- "bubbles": true,
649
- "cancelable": true,
650
- "composed": true,
651
- "docs": {
652
- "tags": [],
653
- "text": "Emited event when value change"
654
- },
655
- "complexType": {
656
- "original": "string",
657
- "resolved": "string",
658
- "references": {}
659
- }
660
- }, {
661
- "method": "inputValid",
662
- "name": "input-valid",
663
- "bubbles": true,
664
- "cancelable": true,
665
- "composed": true,
666
- "docs": {
667
- "tags": [],
668
- "text": "Emited event when checking validity"
669
- },
670
- "complexType": {
671
- "original": "boolean",
672
- "resolved": "boolean",
673
- "references": {}
674
- }
675
- }];
676
- }
677
- static get methods() {
678
- return {
679
- "setFocus": {
680
- "complexType": {
681
- "signature": "() => Promise<void>",
682
- "parameters": [],
683
- "references": {
684
- "Promise": {
685
- "location": "global",
686
- "id": "global::Promise"
687
- }
688
- },
689
- "return": "Promise<void>"
690
- },
691
- "docs": {
692
- "text": "Public method to play input focus",
693
- "tags": []
694
- }
695
- },
696
- "displayError": {
697
- "complexType": {
698
- "signature": "() => Promise<void>",
699
- "parameters": [],
700
- "references": {
701
- "Promise": {
702
- "location": "global",
703
- "id": "global::Promise"
704
- }
705
- },
706
- "return": "Promise<void>"
707
- },
708
- "docs": {
709
- "text": "Display input error if it exists.",
710
- "tags": []
711
- }
712
- },
713
- "setError": {
714
- "complexType": {
715
- "signature": "(valid: MgInputText['valid'], errorMessage: string) => Promise<void>",
716
- "parameters": [{
717
- "tags": [{
718
- "name": "param",
719
- "text": "valid - value indicating the validity"
720
- }],
721
- "text": "- value indicating the validity"
651
+ static get events() {
652
+ return [{
653
+ "method": "valueChange",
654
+ "name": "value-change",
655
+ "bubbles": true,
656
+ "cancelable": true,
657
+ "composed": true,
658
+ "docs": {
659
+ "tags": [],
660
+ "text": "Emited event when value change"
661
+ },
662
+ "complexType": {
663
+ "original": "HTMLMgInputTextElement['value']",
664
+ "resolved": "string",
665
+ "references": {
666
+ "HTMLMgInputTextElement": {
667
+ "location": "global",
668
+ "id": "global::HTMLMgInputTextElement"
669
+ }
670
+ }
671
+ }
722
672
  }, {
723
- "tags": [{
724
- "name": "param",
725
- "text": "errorMessage - the error message to display"
726
- }],
727
- "text": "- the error message to display"
728
- }],
729
- "references": {
730
- "Promise": {
731
- "location": "global",
732
- "id": "global::Promise"
673
+ "method": "inputValid",
674
+ "name": "input-valid",
675
+ "bubbles": true,
676
+ "cancelable": true,
677
+ "composed": true,
678
+ "docs": {
679
+ "tags": [],
680
+ "text": "Emited event when checking validity"
681
+ },
682
+ "complexType": {
683
+ "original": "HTMLMgInputTextElement['valid']",
684
+ "resolved": "boolean",
685
+ "references": {
686
+ "HTMLMgInputTextElement": {
687
+ "location": "global",
688
+ "id": "global::HTMLMgInputTextElement"
689
+ }
690
+ }
691
+ }
692
+ }];
693
+ }
694
+ static get methods() {
695
+ return {
696
+ "setFocus": {
697
+ "complexType": {
698
+ "signature": "() => Promise<void>",
699
+ "parameters": [],
700
+ "references": {
701
+ "Promise": {
702
+ "location": "global",
703
+ "id": "global::Promise"
704
+ }
705
+ },
706
+ "return": "Promise<void>"
707
+ },
708
+ "docs": {
709
+ "text": "Public method to play input focus",
710
+ "tags": []
711
+ }
712
+ },
713
+ "displayError": {
714
+ "complexType": {
715
+ "signature": "() => Promise<void>",
716
+ "parameters": [],
717
+ "references": {
718
+ "Promise": {
719
+ "location": "global",
720
+ "id": "global::Promise"
721
+ }
722
+ },
723
+ "return": "Promise<void>"
724
+ },
725
+ "docs": {
726
+ "text": "Display input error if it exists.",
727
+ "tags": []
728
+ }
733
729
  },
734
- "MgInputText": {
735
- "location": "global",
736
- "id": "global::MgInputText"
730
+ "setError": {
731
+ "complexType": {
732
+ "signature": "(valid: MgInputText['valid'], errorMessage: string) => Promise<void>",
733
+ "parameters": [{
734
+ "tags": [{
735
+ "name": "param",
736
+ "text": "valid - value indicating the validity"
737
+ }],
738
+ "text": "- value indicating the validity"
739
+ }, {
740
+ "tags": [{
741
+ "name": "param",
742
+ "text": "errorMessage - the error message to display"
743
+ }],
744
+ "text": "- the error message to display"
745
+ }],
746
+ "references": {
747
+ "Promise": {
748
+ "location": "global",
749
+ "id": "global::Promise"
750
+ },
751
+ "MgInputText": {
752
+ "location": "global",
753
+ "id": "global::MgInputText"
754
+ }
755
+ },
756
+ "return": "Promise<void>"
757
+ },
758
+ "docs": {
759
+ "text": "Set an error and display a custom error message.\nThis method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\nIt must be paired with an error message to display for the given context.\nWhen used to set validity to `false`, you should use this method again to reset the validity to `true`.",
760
+ "tags": [{
761
+ "name": "param",
762
+ "text": "valid - value indicating the validity"
763
+ }, {
764
+ "name": "param",
765
+ "text": "errorMessage - the error message to display"
766
+ }]
767
+ }
737
768
  }
738
- },
739
- "return": "Promise<void>"
740
- },
741
- "docs": {
742
- "text": "Set an error and display a custom error message.\nThis method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\nIt must be paired with an error message to display for the given context.\nWhen used to set validity to `false`, you should use this method again to reset the validity to `true`.",
743
- "tags": [{
744
- "name": "param",
745
- "text": "valid - value indicating the validity"
769
+ };
770
+ }
771
+ static get elementRef() { return "element"; }
772
+ static get watchers() {
773
+ return [{
774
+ "propName": "value",
775
+ "methodName": "handleValue"
746
776
  }, {
747
- "name": "param",
748
- "text": "errorMessage - the error message to display"
749
- }]
750
- }
751
- }
752
- };
753
- }
754
- static get elementRef() { return "element"; }
755
- static get watchers() {
756
- return [{
757
- "propName": "value",
758
- "methodName": "handleValue"
759
- }, {
760
- "propName": "icon",
761
- "methodName": "validateIcon"
762
- }, {
763
- "propName": "datalistoptions",
764
- "methodName": "validateDatalistoptions"
765
- }, {
766
- "propName": "required",
767
- "methodName": "handleValidityChange"
768
- }, {
769
- "propName": "readonly",
770
- "methodName": "handleValidityChange"
771
- }, {
772
- "propName": "disabled",
773
- "methodName": "handleValidityChange"
774
- }, {
775
- "propName": "pattern",
776
- "methodName": "validatePattern"
777
- }, {
778
- "propName": "patternErrorMessage",
779
- "methodName": "validatePattern"
780
- }];
781
- }
777
+ "propName": "icon",
778
+ "methodName": "validateIcon"
779
+ }, {
780
+ "propName": "datalistoptions",
781
+ "methodName": "validateDatalistoptions"
782
+ }, {
783
+ "propName": "required",
784
+ "methodName": "handleValidityChange"
785
+ }, {
786
+ "propName": "readonly",
787
+ "methodName": "handleValidityChange"
788
+ }, {
789
+ "propName": "disabled",
790
+ "methodName": "handleValidityChange"
791
+ }, {
792
+ "propName": "pattern",
793
+ "methodName": "validatePattern"
794
+ }, {
795
+ "propName": "patternErrorMessage",
796
+ "methodName": "validatePattern"
797
+ }];
798
+ }
782
799
  }
783
800
  //# sourceMappingURL=mg-input-text.js.map