@mgdis/mg-components 5.29.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/{readme.md → README.md} +1 -1
  2. package/dist/cjs/{index-e1a25816.js → index-0fe2670c.js} +31 -29
  3. package/dist/cjs/index-0fe2670c.js.map +1 -0
  4. package/dist/cjs/{index-8a3adbd1.js → index-e4a8bf81.js} +26 -73
  5. package/dist/cjs/index-e4a8bf81.js.map +1 -0
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/mg-action-more_36.cjs.entry.js +732 -839
  8. package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
  9. package/dist/cjs/mg-alert.cjs.entry.js +161 -0
  10. package/dist/cjs/mg-alert.cjs.entry.js.map +1 -0
  11. package/dist/cjs/mg-components.cjs.js +3 -3
  12. package/dist/cjs/mg-components.cjs.js.map +1 -1
  13. package/dist/cjs/mg-loader.cjs.entry.js +6 -6
  14. package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
  15. package/dist/collection/assets/icons/index.js +1 -1
  16. package/dist/collection/assets/icons/index.js.map +1 -1
  17. package/dist/collection/collection-manifest.json +6 -5
  18. package/dist/collection/components/atoms/{mg-character-left → internals/mg-character-left}/mg-character-left.js +18 -5
  19. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js.map +1 -0
  20. package/dist/collection/components/atoms/{mg-input-title → internals/mg-input-title}/mg-input-title.js +8 -5
  21. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js.map +1 -0
  22. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js.map +1 -1
  23. package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -6
  24. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  25. package/dist/collection/components/atoms/mg-button/mg-button.conf.js.map +1 -1
  26. package/dist/collection/components/atoms/mg-button/mg-button.js +4 -22
  27. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  28. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -113
  29. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  30. package/dist/collection/components/atoms/mg-divider/mg-divider.js +9 -9
  31. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -1
  33. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js.map +1 -1
  34. package/dist/collection/components/atoms/mg-icon/mg-icon.js +11 -11
  35. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  36. package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js.map +1 -1
  37. package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
  38. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  39. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
  40. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +6 -7
  41. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  42. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +44 -23
  43. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +0 -9
  45. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +27 -60
  47. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +16 -48
  49. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +5 -23
  51. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +127 -30
  53. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +1 -8
  55. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +20 -21
  57. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  58. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +1 -8
  59. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
  60. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +45 -30
  61. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  62. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +8 -8
  63. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  64. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +11 -11
  65. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  66. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js.map +1 -1
  67. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +12 -12
  68. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  69. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -1
  70. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +71 -35
  71. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  72. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +21 -21
  73. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  74. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +7 -7
  75. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  76. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.conf.js.map +1 -0
  77. package/dist/collection/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.js +29 -25
  78. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -0
  79. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +6 -7
  80. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -1
  81. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +21 -16
  82. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  83. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +7 -16
  84. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -1
  85. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +27 -18
  86. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  87. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  88. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +31 -16
  89. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  90. package/dist/collection/components/molecules/mg-alert/mg-alert.conf.js +9 -0
  91. package/dist/collection/components/molecules/mg-alert/mg-alert.conf.js.map +1 -0
  92. package/dist/collection/components/molecules/mg-alert/mg-alert.js +270 -0
  93. package/dist/collection/components/molecules/mg-alert/mg-alert.js.map +1 -0
  94. package/dist/collection/components/molecules/mg-details/mg-details.js +3 -3
  95. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  96. package/dist/collection/components/molecules/mg-form/mg-form.js +14 -5
  97. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  98. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.js +6 -0
  99. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.js.map +1 -0
  100. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +16 -10
  101. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  102. package/dist/collection/components/molecules/mg-loader/mg-loader.js +3 -3
  103. package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
  104. package/dist/collection/components/molecules/mg-message/mg-message.conf.js +5 -1
  105. package/dist/collection/components/molecules/mg-message/mg-message.conf.js.map +1 -1
  106. package/dist/collection/components/molecules/mg-message/mg-message.js +46 -230
  107. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  108. package/dist/collection/components/molecules/mg-modal/mg-modal.js +44 -121
  109. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  110. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +4 -5
  111. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js.map +1 -1
  112. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +16 -7
  113. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  114. package/dist/collection/components/molecules/mg-panel/mg-panel.js +18 -9
  115. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  116. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
  117. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  118. package/dist/collection/components/molecules/mg-popover/mg-popover.js +13 -7
  119. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  120. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  121. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -8
  122. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js.map +1 -1
  123. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +33 -13
  124. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  125. package/dist/collection/locales/en/messages.json +1 -1
  126. package/dist/collection/locales/fr/messages.json +1 -1
  127. package/dist/collection/types/index.js +2 -0
  128. package/dist/collection/types/index.js.map +1 -0
  129. package/dist/collection/utils/behaviors.utils.js +8 -9
  130. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  131. package/dist/collection/utils/playwright.fixture.js +3 -3
  132. package/dist/collection/utils/playwright.fixture.js.map +1 -1
  133. package/dist/components/index.es.js +20 -20
  134. package/dist/components/index.es.js.map +1 -1
  135. package/dist/components/index2.js +6 -6
  136. package/dist/components/mg-action-more.js +36 -20
  137. package/dist/components/mg-action-more.js.map +1 -1
  138. package/dist/components/mg-alert.d.ts +11 -0
  139. package/dist/components/mg-alert.js +212 -0
  140. package/dist/components/mg-alert.js.map +1 -0
  141. package/dist/components/mg-badge2.js +9 -9
  142. package/dist/components/mg-badge2.js.map +1 -1
  143. package/dist/components/mg-button2.js +8 -10
  144. package/dist/components/mg-button2.js.map +1 -1
  145. package/dist/components/mg-card2.js +3 -68
  146. package/dist/components/mg-card2.js.map +1 -1
  147. package/dist/components/mg-character-left2.js +12 -3
  148. package/dist/components/mg-character-left2.js.map +1 -1
  149. package/dist/components/mg-details.js +5 -5
  150. package/dist/components/mg-details.js.map +1 -1
  151. package/dist/components/mg-divider.js +1 -40
  152. package/dist/components/mg-divider.js.map +1 -1
  153. package/dist/components/mg-divider2.js +44 -0
  154. package/dist/components/mg-divider2.js.map +1 -0
  155. package/dist/components/mg-form.js +15 -7
  156. package/dist/components/mg-form.js.map +1 -1
  157. package/dist/components/mg-icon2.js +12 -12
  158. package/dist/components/mg-icon2.js.map +1 -1
  159. package/dist/components/mg-illustrated-message.js +8 -8
  160. package/dist/components/mg-illustrated-message.js.map +1 -1
  161. package/dist/components/mg-input-checkbox-paginated.js +1 -1
  162. package/dist/components/mg-input-checkbox-paginated2.js +15 -44
  163. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  164. package/dist/components/mg-input-checkbox.js +83 -34
  165. package/dist/components/mg-input-checkbox.js.map +1 -1
  166. package/dist/components/mg-input-date.js +30 -39
  167. package/dist/components/mg-input-date.js.map +1 -1
  168. package/dist/components/mg-input-numeric.js +47 -39
  169. package/dist/components/mg-input-numeric.js.map +1 -1
  170. package/dist/components/mg-input-password.js +12 -12
  171. package/dist/components/mg-input-password.js.map +1 -1
  172. package/dist/components/mg-input-radio.js +16 -16
  173. package/dist/components/mg-input-radio.js.map +1 -1
  174. package/dist/components/mg-input-select2.js +18 -18
  175. package/dist/components/mg-input-select2.js.map +1 -1
  176. package/dist/components/mg-input-text2.js +61 -32
  177. package/dist/components/mg-input-text2.js.map +1 -1
  178. package/dist/components/mg-input-textarea.js +25 -25
  179. package/dist/components/mg-input-textarea.js.map +1 -1
  180. package/dist/components/mg-input-title2.js +7 -4
  181. package/dist/components/mg-input-title2.js.map +1 -1
  182. package/dist/components/mg-input-toggle.js +11 -11
  183. package/dist/components/mg-input-toggle.js.map +1 -1
  184. package/dist/components/mg-input2.js +30 -59
  185. package/dist/components/mg-input2.js.map +1 -1
  186. package/dist/components/mg-item-more2.js +40 -36
  187. package/dist/components/mg-item-more2.js.map +1 -1
  188. package/dist/components/mg-loader.js +5 -5
  189. package/dist/components/mg-loader.js.map +1 -1
  190. package/dist/components/mg-menu-item2.js +39 -41
  191. package/dist/components/mg-menu-item2.js.map +1 -1
  192. package/dist/components/mg-message.js +1 -224
  193. package/dist/components/mg-message.js.map +1 -1
  194. package/dist/components/mg-message2.js +135 -0
  195. package/dist/components/mg-message2.js.map +1 -0
  196. package/dist/components/mg-modal.js +42 -112
  197. package/dist/components/mg-modal.js.map +1 -1
  198. package/dist/components/mg-pagination2.js +21 -14
  199. package/dist/components/mg-pagination2.js.map +1 -1
  200. package/dist/components/mg-panel.js +20 -12
  201. package/dist/components/mg-panel.js.map +1 -1
  202. package/dist/components/mg-popover-content2.js +6 -6
  203. package/dist/components/mg-popover-content2.js.map +1 -1
  204. package/dist/components/mg-popover2.js +16 -10
  205. package/dist/components/mg-popover2.js.map +1 -1
  206. package/dist/components/mg-skip-links.js +4 -4
  207. package/dist/components/mg-skip-links.js.map +1 -1
  208. package/dist/components/mg-tabs.js +43 -25
  209. package/dist/components/mg-tabs.js.map +1 -1
  210. package/dist/components/mg-tag.js +6 -6
  211. package/dist/components/mg-tag.js.map +1 -1
  212. package/dist/components/mg-tooltip-content2.js +2 -2
  213. package/dist/components/mg-tooltip-content2.js.map +1 -1
  214. package/dist/components/mg-tooltip2.js +56 -36
  215. package/dist/components/mg-tooltip2.js.map +1 -1
  216. package/dist/esm/{index-eed80cc2.js → index-d8f69946.js} +26 -26
  217. package/dist/esm/index-d8f69946.js.map +1 -0
  218. package/dist/esm/{index-0df3b137.js → index-e26aede5.js} +26 -74
  219. package/dist/esm/index-e26aede5.js.map +1 -0
  220. package/dist/esm/loader.js +3 -3
  221. package/dist/esm/mg-action-more_36.entry.js +732 -839
  222. package/dist/esm/mg-action-more_36.entry.js.map +1 -1
  223. package/dist/esm/mg-alert.entry.js +157 -0
  224. package/dist/esm/mg-alert.entry.js.map +1 -0
  225. package/dist/esm/mg-components.js +4 -4
  226. package/dist/esm/mg-components.js.map +1 -1
  227. package/dist/esm/mg-loader.entry.js +6 -6
  228. package/dist/esm/mg-loader.entry.js.map +1 -1
  229. package/dist/mg-components/locales/en/messages.json +1 -1
  230. package/dist/mg-components/locales/fr/messages.json +1 -1
  231. package/dist/mg-components/mg-components.css +1 -1
  232. package/dist/mg-components/mg-components.esm.js +1 -1
  233. package/dist/mg-components/mg-components.esm.js.map +1 -1
  234. package/dist/mg-components/p-1fbb6ee7.js +3 -0
  235. package/dist/mg-components/p-1fbb6ee7.js.map +1 -0
  236. package/dist/mg-components/p-5c77f5dd.entry.js +2 -0
  237. package/dist/mg-components/p-5c77f5dd.entry.js.map +1 -0
  238. package/dist/mg-components/p-9beb09e5.entry.js +2 -0
  239. package/dist/mg-components/p-9beb09e5.entry.js.map +1 -0
  240. package/dist/mg-components/p-c9934e81.js +2 -0
  241. package/dist/mg-components/p-c9934e81.js.map +1 -0
  242. package/dist/mg-components/p-d7dde2ac.entry.js +2 -0
  243. package/dist/mg-components/p-d7dde2ac.entry.js.map +1 -0
  244. package/dist/types/assets/icons/index.d.ts +12 -1
  245. package/dist/types/components/atoms/{mg-character-left → internals/mg-character-left}/mg-character-left.d.ts +4 -0
  246. package/dist/types/components/atoms/{mg-input-title → internals/mg-input-title}/mg-input-title.d.ts +1 -1
  247. package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +2 -1
  248. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -1
  249. package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -4
  250. package/dist/types/components/atoms/mg-card/mg-card.d.ts +0 -33
  251. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
  252. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +5 -4
  253. package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +2 -1
  254. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +2 -6
  255. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +8 -3
  256. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +2 -6
  257. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +4 -13
  258. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +6 -13
  259. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +4 -18
  260. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +30 -3
  261. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +2 -7
  262. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +3 -7
  263. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +6 -1
  264. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -3
  265. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +5 -0
  266. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +10 -4
  267. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +3 -3
  268. package/dist/types/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.conf.d.ts +2 -2
  269. package/dist/types/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.d.ts +3 -0
  270. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +9 -7
  271. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +2 -3
  272. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -17
  273. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +5 -4
  274. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +7 -1
  275. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -2
  276. package/dist/types/components/molecules/mg-alert/mg-alert.conf.d.ts +17 -0
  277. package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +89 -0
  278. package/dist/types/components/molecules/mg-details/mg-details.d.ts +4 -0
  279. package/dist/types/components/molecules/mg-form/mg-form.d.ts +5 -0
  280. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.d.ts +10 -0
  281. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +7 -1
  282. package/dist/types/components/molecules/mg-message/mg-message.conf.d.ts +11 -2
  283. package/dist/types/components/molecules/mg-message/mg-message.d.ts +11 -62
  284. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +14 -39
  285. package/dist/types/components/molecules/mg-pagination/mg-pagination.conf.d.ts +4 -4
  286. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +1 -0
  287. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +5 -0
  288. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
  289. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -11
  290. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +10 -0
  291. package/dist/types/components.d.ts +157 -166
  292. package/dist/types/locales/index.d.ts +1 -1
  293. package/dist/types/stencil-public-runtime.d.ts +4 -0
  294. package/dist/types/types/index.d.ts +27 -0
  295. package/dist/types/utils/behaviors.utils.d.ts +5 -5
  296. package/ide/intellij/web-types.json +791 -671
  297. package/ide/vscode/css-custom-data.json +389 -0
  298. package/ide/vscode/html-custom-data.json +293 -551
  299. package/package.json +32 -29
  300. package/dist/cjs/index-8a3adbd1.js.map +0 -1
  301. package/dist/cjs/index-e1a25816.js.map +0 -1
  302. package/dist/collection/components/atoms/mg-card/mg-card.conf.js +0 -9
  303. package/dist/collection/components/atoms/mg-card/mg-card.conf.js.map +0 -1
  304. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +0 -1
  305. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +0 -1
  306. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js.map +0 -1
  307. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +0 -1
  308. package/dist/collection/fonts/OpenSans-Bold.ttf +0 -0
  309. package/dist/collection/fonts/OpenSans-Regular.ttf +0 -0
  310. package/dist/collection/fonts/OpenSans-SemiBold.ttf +0 -0
  311. package/dist/collection/styles/fonts.css +0 -1
  312. package/dist/collection/styles/global.css +0 -1
  313. package/dist/collection/styles/main.css +0 -1
  314. package/dist/collection/styles/mg-components-utils.css +0 -1
  315. package/dist/collection/styles/variables.css +0 -1
  316. package/dist/collection/variables.css +0 -1
  317. package/dist/esm/index-0df3b137.js.map +0 -1
  318. package/dist/esm/index-eed80cc2.js.map +0 -1
  319. package/dist/mg-components/fonts/OpenSans-Bold.ttf +0 -0
  320. package/dist/mg-components/fonts/OpenSans-Regular.ttf +0 -0
  321. package/dist/mg-components/fonts/OpenSans-SemiBold.ttf +0 -0
  322. package/dist/mg-components/p-88f6c2f9.entry.js +0 -2
  323. package/dist/mg-components/p-88f6c2f9.entry.js.map +0 -1
  324. package/dist/mg-components/p-e5db08c5.entry.js +0 -2
  325. package/dist/mg-components/p-e5db08c5.entry.js.map +0 -1
  326. package/dist/mg-components/p-efce3d8c.js +0 -2
  327. package/dist/mg-components/p-efce3d8c.js.map +0 -1
  328. package/dist/mg-components/p-f95b4418.js +0 -3
  329. package/dist/mg-components/p-f95b4418.js.map +0 -1
  330. package/dist/mg-components/styles/fonts.css +0 -1
  331. package/dist/mg-components/styles/global.css +0 -1
  332. package/dist/mg-components/styles/main.css +0 -1
  333. package/dist/mg-components/styles/mg-components-utils.css +0 -1
  334. package/dist/mg-components/styles/variables.css +0 -1
  335. package/dist/mg-components/variables.css +0 -1
  336. package/dist/types/components/atoms/mg-card/mg-card.conf.d.ts +0 -16
  337. /package/dist/collection/components/molecules/{mg-item-more → internals/mg-item-more}/mg-item-more.conf.js +0 -0
@@ -1,14 +1,20 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  import { h } from "@stencil/core";
2
- import { ClassList, isValidString } from "@mgdis/stencil-helpers";
3
- import { Handler, widths, classReadonly, classDisabled } from "../mg-input/mg-input.conf";
3
+ import { allItemsAreString, ClassList, isValidString, toString } from "@mgdis/stencil-helpers";
4
+ import { widths, classReadonly, classDisabled } from "../mg-input/mg-input.conf";
4
5
  import { initLocales } from "../../../../locales";
6
+ /**
7
+ * Check if object is an option
8
+ * @param option - object to validate
9
+ * @returns true id object is an option
10
+ */
11
+ const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
5
12
  /**
6
13
  * Check if datalist options are well structured.
7
- *
8
14
  * @param options - Datalist options to check.
9
15
  * @returns True if datalist is well structured.
10
16
  */
11
- const isDatalistOption = (options) => Array.isArray(options) && options.every(option => typeof option === 'string');
17
+ const isDatalistOptions = (options) => allItemsAreString(options) || (Array.isArray(options) && options.every(isOption));
12
18
  /**
13
19
  * @slot append-input - Content to display next to the input
14
20
  */
@@ -50,7 +56,7 @@ export class MgInputText {
50
56
  this.classCollection.delete(this.classFocus);
51
57
  this.classCollection = new ClassList(this.classCollection.classes);
52
58
  // Display Error
53
- this.handlerInProgress = Handler.BLUR;
59
+ this.handlerInProgress = 'blur';
54
60
  this.displayError().finally(() => {
55
61
  // reset guard
56
62
  this.handlerInProgress = undefined;
@@ -88,7 +94,13 @@ export class MgInputText {
88
94
  this.validateAppendSlot = () => {
89
95
  const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
90
96
  if (slotAppendInput.length === 1) {
91
- this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : this.classIsAppendInputSlotContent);
97
+ if (slotAppendInput[0].nodeName === 'MG-BUTTON') {
98
+ this.classCollection.add(this.classIsInputGroupAppend);
99
+ }
100
+ else {
101
+ this.classCollection.add(this.classIsAppendInputSlotContent);
102
+ this.slotContent = slotAppendInput[0].textContent;
103
+ }
92
104
  }
93
105
  else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
94
106
  this.classCollection.add(this.classIsInputGroupAppend);
@@ -99,7 +111,14 @@ export class MgInputText {
99
111
  * Method to control datalist display condition
100
112
  * @returns true if display condition success
101
113
  */
102
- this.hasDatalist = () => isDatalistOption(this.datalistoptions) && this.datalistoptions.length > 0;
114
+ this.hasDatalist = () => isDatalistOptions(this.datalistoptions) && this.datalistoptions.length > 0;
115
+ /**
116
+ * Renders the readonly content of the input component.
117
+ * @returns The readonly content element.
118
+ */
119
+ this.renderReadonly = () => {
120
+ return this.slotContent !== undefined ? (h("span", { class: "mg-c-input__readonly-value" }, h("b", null, this.value), this.slotContent)) : (h("b", { class: "mg-c-input__readonly-value" }, this.value));
121
+ };
103
122
  this.value = undefined;
104
123
  this.identifier = undefined;
105
124
  this.name = this.identifier;
@@ -119,7 +138,7 @@ export class MgInputText {
119
138
  this.patternErrorMessage = undefined;
120
139
  this.tooltip = undefined;
121
140
  this.tooltipPosition = 'input';
122
- this.displayCharacterLeft = true;
141
+ this.characterLeftHide = false;
123
142
  this.helpText = undefined;
124
143
  this.valid = undefined;
125
144
  this.invalid = undefined;
@@ -127,7 +146,13 @@ export class MgInputText {
127
146
  this.errorMessage = undefined;
128
147
  }
129
148
  handleValue(newValue) {
130
- this.valueChange.emit(newValue);
149
+ var _a, _b;
150
+ if ((_a = this.datalistoptions) === null || _a === void 0 ? void 0 : _a.every(isOption)) {
151
+ this.valueChange.emit(((_b = this.datalistoptions.find(option => option.title === newValue)) === null || _b === void 0 ? void 0 : _b.value) || newValue);
152
+ }
153
+ else {
154
+ this.valueChange.emit(newValue);
155
+ }
131
156
  }
132
157
  validateIcon(newValue) {
133
158
  if (newValue !== undefined) {
@@ -138,8 +163,8 @@ export class MgInputText {
138
163
  }
139
164
  }
140
165
  validateDatalistoptions(newValue) {
141
- if (Boolean(newValue) && !isDatalistOption(newValue)) {
142
- throw new Error('<mg-input-text> prop "datalistoptions" values must be the same type, string.');
166
+ if (Boolean(newValue) && !isDatalistOptions(newValue)) {
167
+ throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${toString(newValue)}.`);
143
168
  }
144
169
  }
145
170
  watchReadonly(newValue) {
@@ -170,12 +195,12 @@ export class MgInputText {
170
195
  this.classCollection.delete(`mg-c-input--width-${width}`);
171
196
  });
172
197
  // apply new width
173
- if (newValue)
198
+ if (newValue !== undefined)
174
199
  this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
175
200
  }
176
201
  validatePattern(newValue) {
177
202
  if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {
178
- throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
203
+ throw new Error(`<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${toString(this.pattern)}'" and "patternErrorMessage='${toString(this.patternErrorMessage)}'".`);
179
204
  }
180
205
  }
181
206
  /**
@@ -202,10 +227,10 @@ export class MgInputText {
202
227
  */
203
228
  async setError(valid, errorMessage) {
204
229
  if (typeof valid !== 'boolean') {
205
- throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
230
+ throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean.');
206
231
  }
207
232
  else if (!isValidString(errorMessage)) {
208
- throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
233
+ throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string.');
209
234
  }
210
235
  else {
211
236
  this.setValidity(valid);
@@ -222,7 +247,7 @@ export class MgInputText {
222
247
  this.valid = newValue;
223
248
  this.invalid = !this.valid;
224
249
  // We need to send valid event even if it is the same value
225
- if (this.handlerInProgress === undefined || (this.handlerInProgress === Handler.BLUR && this.valid !== oldValidValue))
250
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
226
251
  this.inputValid.emit(this.valid);
227
252
  }
228
253
  /*************
@@ -258,14 +283,19 @@ export class MgInputText {
258
283
  * @returns HTML Element
259
284
  */
260
285
  render() {
261
- return (h("mg-input", { key: 'ee9b290a3c97af6c264b37958c3a6123d516f391', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: this.value, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, h("div", { key: 'e348db67a88f9941c549cb190aaca88c93aac54c', class: "mg-c-input__with-character-left", style: {
262
- '--mg-character-left-message-length': (this.displayCharacterLeft
263
- ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
264
- : 0).toString(),
265
- } }, this.icon !== undefined && h("mg-icon", { key: 'dfe0ce7e271c40d4da20f00b35ad4fe104e08c91', icon: this.icon }), h("input", { key: '451af2cff19f47d9b9d3de824546324b6bfaf235', type: this.type, class: "mg-c-input__box mg-c-input__box--width", 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) => {
266
- if (el !== null)
267
- this.input = el;
268
- } }), this.hasDatalist() && (h("datalist", { key: '387530d84dd29575c5e8985ad40211e490bb04e4', id: this.datalistId }, this.datalistoptions.map(option => (h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (h("mg-character-left", { key: 'e0278d4295d5c923f21f617bbf37ee09bd907b54', identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), h("slot", { key: '3d896e5ad21380c04c58fe925b8186e9f0a9207b', name: "append-input" })));
286
+ return (h("mg-input", { key: '717239fc622bd6d122897031a2144bd3441947d5', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
287
+ ? this.value && this.renderReadonly()
288
+ : [
289
+ h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
290
+ '--mg-c-character-left-message-length': (!this.characterLeftHide
291
+ ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
292
+ : 0).toString(),
293
+ } }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { type: this.type, class: "mg-c-input__box mg-c-input__box--width", 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) => {
294
+ if (el !== null)
295
+ this.input = el;
296
+ } }), this.hasDatalist() && (h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (h("option", { value: isOption(option) ? option.title : option, key: option }))))), !this.characterLeftHide && this.maxlength > 0 && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))),
297
+ h("slot", { key: "slot", name: "append-input" }),
298
+ ]));
269
299
  }
270
300
  static get is() { return "mg-input-text"; }
271
301
  static get encapsulation() { return "shadow"; }
@@ -282,11 +312,11 @@ export class MgInputText {
282
312
  static get properties() {
283
313
  return {
284
314
  "value": {
285
- "type": "string",
315
+ "type": "any",
286
316
  "mutable": true,
287
317
  "complexType": {
288
- "original": "string",
289
- "resolved": "string",
318
+ "original": "any",
319
+ "resolved": "any",
290
320
  "references": {}
291
321
  },
292
322
  "required": false,
@@ -379,7 +409,7 @@ export class MgInputText {
379
409
  "mutable": false,
380
410
  "complexType": {
381
411
  "original": "IconType",
382
- "resolved": "\"filter\" | \"copy\" | \"link\" | \"picture\" | \"table\" | \"circle\" | \"download\" | \"history\" | \"location\" | \"key\" | \"loader\" | \"address-card\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building-outline\" | \"calculator\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-outline\" | \"comment-sms\" | \"conversation\" | \"conversation-outline\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-slash\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-download\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-up\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"laptop\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"list\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-slash\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"question-circle\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"tag\" | \"tags\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"",
412
+ "resolved": "\"filter\" | \"link\" | \"picture\" | \"table\" | \"circle\" | \"download\" | \"copy\" | \"history\" | \"location\" | \"key\" | \"loader\" | \"address-card\" | \"address-card-outline\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building-outline\" | \"calculator\" | \"calculator-outline\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-outline\" | \"comment-sms\" | \"conversation\" | \"conversation-outline\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-outline\" | \"eye-slash\" | \"eye-slash-outline\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-download\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-euro\" | \"hand-euro-outline\" | \"hand-up\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"laptop\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"list\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-outline\" | \"paper-plane-slash\" | \"paper-plane-slash-outline\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"tag\" | \"tag-outline\" | \"tags\" | \"tags-outline\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"universal-access-outline\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"",
383
413
  "references": {
384
414
  "IconType": {
385
415
  "location": "import",
@@ -453,9 +483,15 @@ export class MgInputText {
453
483
  "type": "unknown",
454
484
  "mutable": false,
455
485
  "complexType": {
456
- "original": "string[]",
457
- "resolved": "string[]",
458
- "references": {}
486
+ "original": "string[] | OptionType[]",
487
+ "resolved": "Option[] | string[]",
488
+ "references": {
489
+ "OptionType": {
490
+ "location": "import",
491
+ "path": "./mg-input-text.conf",
492
+ "id": "src/components/molecules/inputs/mg-input-text/mg-input-text.conf.ts::OptionType"
493
+ }
494
+ }
459
495
  },
460
496
  "required": false,
461
497
  "optional": false,
@@ -635,7 +671,7 @@ export class MgInputText {
635
671
  "reflect": false,
636
672
  "defaultValue": "'input'"
637
673
  },
638
- "displayCharacterLeft": {
674
+ "characterLeftHide": {
639
675
  "type": "boolean",
640
676
  "mutable": false,
641
677
  "complexType": {
@@ -649,9 +685,9 @@ export class MgInputText {
649
685
  "tags": [],
650
686
  "text": "Define if component should display character left"
651
687
  },
652
- "attribute": "display-character-left",
688
+ "attribute": "character-left-hide",
653
689
  "reflect": false,
654
- "defaultValue": "true"
690
+ "defaultValue": "false"
655
691
  },
656
692
  "helpText": {
657
693
  "type": "string",
@@ -725,7 +761,7 @@ export class MgInputText {
725
761
  },
726
762
  "complexType": {
727
763
  "original": "HTMLMgInputTextElement['value']",
728
- "resolved": "string",
764
+ "resolved": "any",
729
765
  "references": {
730
766
  "HTMLMgInputTextElement": {
731
767
  "location": "global",
@@ -1 +1 @@
1
- {"version":3,"file":"mg-input-text.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-text/mg-input-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAgB,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAoC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC5H,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,OAAkB,EAAuB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC;AAEpJ;;GAEG;AAMH,MAAM,OAAO,WAAW;;QACtB;;sBAEc;QAEd,UAAU;QACO,eAAU,GAAG,iBAAiB,CAAC;QAC/B,4BAAuB,GAAG,mC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, h, Prop, EventEmitter, State, Element, Method, Watch } from '@stencil/core';\nimport { ClassList, isValidString } from '@mgdis/stencil-helpers';\nimport { TextType } from './mg-input-text.conf';\nimport { type TooltipPosition, type Width, Handler, widths, classReadonly, classDisabled } from '../mg-input/mg-input.conf';\nimport { initLocales } from '../../../../locales';\nimport { IconType } from '../../../../components';\n\n/**\n * Check if datalist options are well structured.\n *\n * @param options - Datalist options to check.\n * @returns True if datalist is well structured.\n */\nconst isDatalistOption = (options: unknown[]): options is string[] => Array.isArray(options) && options.every(option => typeof option === 'string');\n\n/**\n * @slot append-input - Content to display next to the input\n */\n@Component({\n tag: 'mg-input-text',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-text.css',\n shadow: true,\n})\nexport class MgInputText {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classFocus = 'mg-u-is-focused';\n private readonly classIsInputGroupAppend = 'mg-c-input--is-input-group-append';\n private readonly classHasIcon = 'mg-c-input--has-icon';\n private readonly classHasButtonsGroupAppend = 'mg-c-input--has-buttons-group-append';\n private readonly classIsAppendInputSlotContent = 'mg-c-input--is-append-input-slot-content';\n\n // IDs\n private characterLeftId;\n private datalistId;\n\n // HTML selector\n private input: HTMLInputElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n private handlerInProgress: Handler;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputTextElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: string;\n @Watch('value')\n handleValue(newValue: string): void {\n this.valueChange.emit(newValue);\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Input type\n */\n @Prop() type: TextType = 'text';\n\n /**\n * Input icon\n */\n @Prop() icon?: IconType;\n @Watch('icon')\n validateIcon(newValue: string): void {\n if (newValue !== undefined) {\n this.classCollection.add(this.classHasIcon);\n } else {\n this.classCollection.delete(this.classHasIcon);\n }\n }\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop?: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop() placeholder?: string;\n\n /**\n * Define datalist options\n */\n @Prop() datalistoptions: string[];\n @Watch('datalistoptions')\n validateDatalistoptions(newValue: MgInputText['datalistoptions']) {\n if (Boolean(newValue) && !isDatalistOption(newValue)) {\n throw new Error('<mg-input-text> prop \"datalistoptions\" values must be the same type, string.');\n }\n }\n\n /**\n * Input max length\n */\n @Prop() maxlength = 400;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n @Watch('readonly')\n watchReadonly(newValue: MgInputText['readonly']): void {\n if (newValue) this.classCollection.add(classReadonly);\n else this.classCollection.delete(classReadonly);\n }\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n @Watch('disabled')\n watchDisabled(newValue: MgInputText['disabled']): void {\n if (newValue) this.classCollection.add(classDisabled);\n else this.classCollection.delete(classDisabled);\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n @Watch('mgWidth')\n watchMgWidth(newValue: MgInputText['mgWidth']): void {\n // reset width class\n widths.forEach(width => {\n this.classCollection.delete(`mg-c-input--width-${width}`);\n });\n\n // apply new width\n if (newValue) this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);\n }\n\n /**\n * Define input pattern to validate\n * Please refer to the Pattern section in the input documentation for detailed information on using regular expressions in components.\n */\n @Prop() pattern?: string;\n\n /**\n * Define input pattern error message\n */\n @Prop() patternErrorMessage?: string;\n @Watch('pattern')\n @Watch('patternErrorMessage')\n validatePattern(newValue: string): void {\n if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {\n throw new Error('<mg-input-text> props \"pattern\" and \"patternErrorMessage\" must be non-empty string and paired.');\n }\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip?: string;\n\n /**\n * Define tooltip position\n */\n @Prop() tooltipPosition: TooltipPosition = 'input';\n\n /**\n * Define if component should display character left\n */\n @Prop() displayCharacterLeft = true;\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText?: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--text']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<HTMLMgInputTextElement['value']>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<HTMLMgInputTextElement['valid']>;\n\n /**\n * Public method to play input focus\n */\n @Method()\n async setFocus(): Promise<void> {\n this.input.focus();\n }\n\n /**\n * Display input error if it exists.\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given context.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputText['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-text> method \"setError()\" param \"valid\" must be a boolean');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-text> method \"setError()\" param \"errorMessage\" must be a string');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputText['valid']) {\n const oldValidValue = this.valid;\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n if (this.handlerInProgress === undefined || (this.handlerInProgress === Handler.BLUR && this.valid !== oldValidValue)) this.inputValid.emit(this.valid);\n }\n\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n }\n this.value = this.input.value;\n };\n\n /**\n * Handle focus event\n */\n private handleFocus = (): void => {\n this.classCollection.add(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n // Manage focus\n this.classCollection.delete(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n // Display Error\n this.handlerInProgress = Handler.BLUR;\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n });\n };\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || this.input.checkValidity());\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n // Does have a custom error message\n if (!this.valid && errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n }\n // Does not match pattern\n else if (!this.valid && this.input.validity.patternMismatch) {\n this.errorMessage = this.patternErrorMessage;\n }\n // required\n else if (!this.valid && this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n };\n\n /**\n * Validate append slot\n */\n private validateAppendSlot = (): void => {\n const slotAppendInput: HTMLSlotElement[] = Array.from(this.element.querySelectorAll('[slot=\"append-input\"]'));\n\n if (slotAppendInput.length === 1) {\n this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : this.classIsAppendInputSlotContent);\n } else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {\n this.classCollection.add(this.classIsInputGroupAppend);\n this.classCollection.add(this.classHasButtonsGroupAppend);\n }\n };\n\n /**\n * Method to control datalist display condition\n * @returns true if display condition success\n */\n private hasDatalist = (): boolean => isDatalistOption(this.datalistoptions) && this.datalistoptions.length > 0;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n this.characterLeftId = `${this.identifier}-character-left`;\n this.datalistId = `${this.identifier}-datalist`;\n // Validate\n this.validateIcon(this.icon);\n this.validateDatalistoptions(this.datalistoptions);\n this.validatePattern(this.pattern);\n this.validatePattern(this.patternErrorMessage);\n this.validateAppendSlot();\n this.watchMgWidth(this.mgWidth);\n this.watchReadonly(this.readonly);\n this.watchDisabled(this.disabled);\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <mg-input\n label={this.label}\n identifier={this.identifier}\n class={this.classCollection.join()}\n ariaDescribedbyIDs={[this.characterLeftId]}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n readonlyValue={this.value}\n tooltip={this.tooltip}\n tooltipPosition={this.tooltipPosition}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n >\n <div\n class=\"mg-c-input__with-character-left\"\n style={{\n '--mg-character-left-message-length': (this.displayCharacterLeft\n ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1\n : 0\n ).toString(),\n }}\n >\n {this.icon !== undefined && <mg-icon icon={this.icon}></mg-icon>}\n <input\n type={this.type}\n class=\"mg-c-input__box mg-c-input__box--width\"\n value={this.value}\n id={this.identifier}\n list={this.hasDatalist() ? this.datalistId : undefined}\n autocomplete={this.hasDatalist() ? 'off' : undefined}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n maxlength={this.maxlength}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={(this.invalid === true).toString()}\n pattern={this.pattern}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n ref={(el: HTMLInputElement) => {\n if (el !== null) this.input = el;\n }}\n />\n {this.hasDatalist() && (\n <datalist id={this.datalistId}>\n {this.datalistoptions.map(option => (\n <option value={option} key={option}></option>\n ))}\n </datalist>\n )}\n {this.displayCharacterLeft && this.maxlength > 0 && (\n <mg-character-left identifier={this.characterLeftId} characters={this.value} maxlength={this.maxlength}></mg-character-left>\n )}\n </div>\n <slot name=\"append-input\"></slot>\n </mg-input>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-input-text.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-text/mg-input-text.tsx"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAgB,KAAK,EAAE,O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AG,EAAE,MAAM,GAAW,CAChF,CAAC,CACO,CACZ;oBACA,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAChD,yBAAmB,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,GAAsB,CAC7H,CACG;gBACN,YAAM,GAAG,EAAC,MAAM,EAAC,IAAI,EAAC,cAAc,GAAQ;aAC7C,CACI,CACZ,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { Component, Event, h, Prop, EventEmitter, State, Element, Method, Watch } from '@stencil/core';\nimport { allItemsAreString, ClassList, isValidString, toString } from '@mgdis/stencil-helpers';\nimport { OptionType, TextType } from './mg-input-text.conf';\nimport { type TooltipPosition, type Width, type EventType, widths, classReadonly, classDisabled } from '../mg-input/mg-input.conf';\nimport { initLocales } from '../../../../locales';\nimport { IconType } from '../../../../components';\n\n/**\n * Check if object is an option\n * @param option - object to validate\n * @returns true id object is an option\n */\n\nconst isOption = (option: unknown): option is OptionType =>\n typeof option === 'object' && typeof (option as OptionType).title === 'string' && (option as OptionType).value !== undefined;\n\n/**\n * Check if datalist options are well structured.\n * @param options - Datalist options to check.\n * @returns True if datalist is well structured.\n */\nconst isDatalistOptions = (options: unknown[]): options is string[] => allItemsAreString(options) || (Array.isArray(options) && options.every(isOption));\n\n/**\n * @slot append-input - Content to display next to the input\n */\n@Component({\n tag: 'mg-input-text',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-text.css',\n shadow: true,\n})\nexport class MgInputText {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classFocus = 'mg-u-is-focused';\n private readonly classIsInputGroupAppend = 'mg-c-input--is-input-group-append';\n private readonly classHasIcon = 'mg-c-input--has-icon';\n private readonly classHasButtonsGroupAppend = 'mg-c-input--has-buttons-group-append';\n private readonly classIsAppendInputSlotContent = 'mg-c-input--is-append-input-slot-content';\n\n // IDs\n private characterLeftId: string;\n private datalistId: string;\n private slotContent: string;\n\n // HTML selector\n private input: HTMLInputElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n private handlerInProgress: EventType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputTextElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: any;\n @Watch('value')\n handleValue(newValue: string): void {\n if (this.datalistoptions?.every(isOption)) {\n this.valueChange.emit(this.datalistoptions.find(option => option.title === newValue)?.value || newValue);\n } else {\n this.valueChange.emit(newValue);\n }\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Input type\n */\n @Prop() type: TextType = 'text';\n\n /**\n * Input icon\n */\n @Prop() icon?: IconType;\n @Watch('icon')\n validateIcon(newValue: string): void {\n if (newValue !== undefined) {\n this.classCollection.add(this.classHasIcon);\n } else {\n this.classCollection.delete(this.classHasIcon);\n }\n }\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop?: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop() placeholder?: string;\n\n /**\n * Define datalist options\n */\n @Prop() datalistoptions: string[] | OptionType[];\n @Watch('datalistoptions')\n validateDatalistoptions(newValue: MgInputText['datalistoptions']) {\n if (Boolean(newValue) && !isDatalistOptions(newValue)) {\n throw new Error(`<mg-input-text> prop \"datalistoptions\" values must be the same type, string or OptionType. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Input max length\n */\n @Prop() maxlength = 400;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n @Watch('readonly')\n watchReadonly(newValue: MgInputText['readonly']): void {\n if (newValue) this.classCollection.add(classReadonly);\n else this.classCollection.delete(classReadonly);\n }\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n @Watch('disabled')\n watchDisabled(newValue: MgInputText['disabled']): void {\n if (newValue) this.classCollection.add(classDisabled);\n else this.classCollection.delete(classDisabled);\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n @Watch('mgWidth')\n watchMgWidth(newValue: MgInputText['mgWidth']): void {\n // reset width class\n widths.forEach(width => {\n this.classCollection.delete(`mg-c-input--width-${width}`);\n });\n\n // apply new width\n if (newValue !== undefined) this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);\n }\n\n /**\n * Define input pattern to validate\n * Please refer to the Pattern section in the input documentation for detailed information on using regular expressions in components.\n */\n @Prop() pattern?: string;\n\n /**\n * Define input pattern error message\n */\n @Prop() patternErrorMessage?: string;\n @Watch('pattern')\n @Watch('patternErrorMessage')\n validatePattern(newValue: string): void {\n if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {\n throw new Error(\n `<mg-input-text> props \"pattern\" and \"patternErrorMessage\" must be non-empty string and paired. Passed value: \"pattern='${toString(this.pattern)}'\" and \"patternErrorMessage='${toString(this.patternErrorMessage)}'\".`,\n );\n }\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip?: string;\n\n /**\n * Define tooltip position\n */\n @Prop() tooltipPosition: TooltipPosition = 'input';\n\n /**\n * Define if component should display character left\n */\n @Prop() characterLeftHide = false;\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText?: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--text']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<HTMLMgInputTextElement['value']>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<HTMLMgInputTextElement['valid']>;\n\n /**\n * Public method to play input focus\n */\n @Method()\n async setFocus(): Promise<void> {\n this.input.focus();\n }\n\n /**\n * Display input error if it exists.\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given context.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputText['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-text> method \"setError()\" param \"valid\" must be a boolean.');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-text> method \"setError()\" param \"errorMessage\" must be a string.');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputText['valid']) {\n const oldValidValue = this.valid;\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue)) this.inputValid.emit(this.valid);\n }\n\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n }\n this.value = this.input.value;\n };\n\n /**\n * Handle focus event\n */\n private handleFocus = (): void => {\n this.classCollection.add(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n // Manage focus\n this.classCollection.delete(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n // Display Error\n this.handlerInProgress = 'blur';\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n });\n };\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || this.input.checkValidity());\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n // Does have a custom error message\n if (!this.valid && errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n }\n // Does not match pattern\n else if (!this.valid && this.input.validity.patternMismatch) {\n this.errorMessage = this.patternErrorMessage;\n }\n // required\n else if (!this.valid && this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n };\n\n /**\n * Validate append slot\n */\n private validateAppendSlot = (): void => {\n const slotAppendInput: HTMLSlotElement[] = Array.from(this.element.querySelectorAll('[slot=\"append-input\"]'));\n\n if (slotAppendInput.length === 1) {\n if (slotAppendInput[0].nodeName === 'MG-BUTTON') {\n this.classCollection.add(this.classIsInputGroupAppend);\n } else {\n this.classCollection.add(this.classIsAppendInputSlotContent);\n this.slotContent = slotAppendInput[0].textContent;\n }\n } else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {\n this.classCollection.add(this.classIsInputGroupAppend);\n this.classCollection.add(this.classHasButtonsGroupAppend);\n }\n };\n\n /**\n * Method to control datalist display condition\n * @returns true if display condition success\n */\n private hasDatalist = (): boolean => isDatalistOptions(this.datalistoptions) && this.datalistoptions.length > 0;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n this.characterLeftId = `${this.identifier}-character-left`;\n this.datalistId = `${this.identifier}-datalist`;\n // Validate\n this.validateIcon(this.icon);\n this.validateDatalistoptions(this.datalistoptions);\n this.validatePattern(this.pattern);\n this.validatePattern(this.patternErrorMessage);\n this.validateAppendSlot();\n this.watchMgWidth(this.mgWidth);\n this.watchReadonly(this.readonly);\n this.watchDisabled(this.disabled);\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Renders the readonly content of the input component.\n * @returns The readonly content element.\n */\n private renderReadonly = (): HTMLElement => {\n return this.slotContent !== undefined ? (\n <span class=\"mg-c-input__readonly-value\">\n <b>{this.value}</b>\n {this.slotContent}\n </span>\n ) : (\n <b class=\"mg-c-input__readonly-value\">{this.value}</b>\n );\n };\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <mg-input\n label={this.label}\n identifier={this.identifier}\n class={this.classCollection.join()}\n ariaDescribedbyIDs={[this.characterLeftId]}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n tooltip={this.tooltip}\n tooltipPosition={this.readonly && this.value === undefined ? 'label' : this.tooltipPosition}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n >\n {this.readonly\n ? this.value && this.renderReadonly()\n : [\n <div\n key=\"input\"\n class=\"mg-c-input__with-character-left\"\n style={{\n '--mg-c-character-left-message-length': (!this.characterLeftHide\n ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1\n : 0\n ).toString(),\n }}\n >\n {this.icon !== undefined && <mg-icon icon={this.icon}></mg-icon>}\n <input\n type={this.type}\n class=\"mg-c-input__box mg-c-input__box--width\"\n value={this.value}\n id={this.identifier}\n list={this.hasDatalist() ? this.datalistId : undefined}\n autocomplete={this.hasDatalist() ? 'off' : undefined}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n maxlength={this.maxlength}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={(this.invalid === true).toString()}\n pattern={this.pattern}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n ref={(el: HTMLInputElement) => {\n if (el !== null) this.input = el;\n }}\n />\n {this.hasDatalist() && (\n <datalist id={this.datalistId}>\n {this.datalistoptions.map(option => (\n <option value={isOption(option) ? option.title : option} key={option}></option>\n ))}\n </datalist>\n )}\n {!this.characterLeftHide && this.maxlength > 0 && (\n <mg-character-left identifier={this.characterLeftId} characters={this.value} maxlength={this.maxlength}></mg-character-left>\n )}\n </div>,\n <slot key=\"slot\" name=\"append-input\"></slot>,\n ]}\n </mg-input>\n );\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
- import { ClassList, isValidString } from "@mgdis/stencil-helpers";
3
- import { Handler, widths, classReadonly, classDisabled } from "../mg-input/mg-input.conf";
2
+ import { ClassList, isValidString, toString } from "@mgdis/stencil-helpers";
3
+ import { widths, classReadonly, classDisabled } from "../mg-input/mg-input.conf";
4
4
  import { initLocales } from "../../../../locales";
5
5
  export class MgInputTextarea {
6
6
  constructor() {
@@ -9,7 +9,7 @@ export class MgInputTextarea {
9
9
  ************/
10
10
  // Classes
11
11
  this.classFocus = 'mg-u-is-focused';
12
- this.classHasDisplayCharacterLeft = 'mg-c-input--has-display-character-left';
12
+ this.classDisplayCharacterLeft = 'mg-c-input--display-character-left';
13
13
  // hasDisplayedError (triggered by blur event)
14
14
  this.hasDisplayedError = false;
15
15
  /**
@@ -37,7 +37,7 @@ export class MgInputTextarea {
37
37
  this.classCollection.delete(this.classFocus);
38
38
  this.classCollection = new ClassList(this.classCollection.classes);
39
39
  // Display Error
40
- this.handlerInProgress = Handler.BLUR;
40
+ this.handlerInProgress = 'blur';
41
41
  this.displayError().finally(() => {
42
42
  // reset guard
43
43
  this.handlerInProgress = undefined;
@@ -93,7 +93,7 @@ export class MgInputTextarea {
93
93
  this.rows = 3;
94
94
  this.tooltip = undefined;
95
95
  this.tooltipPosition = 'input';
96
- this.displayCharacterLeft = true;
96
+ this.characterLeftHide = false;
97
97
  this.helpText = undefined;
98
98
  this.valid = undefined;
99
99
  this.invalid = undefined;
@@ -133,20 +133,20 @@ export class MgInputTextarea {
133
133
  this.classCollection.delete(`mg-c-input--width-${width}`);
134
134
  });
135
135
  // apply new width
136
- if (newValue)
136
+ if (newValue !== undefined)
137
137
  this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
138
138
  }
139
139
  validatePattern(newValue) {
140
140
  if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {
141
- throw new Error('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
141
+ throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${toString(this.pattern)}'" and "patternErrorMessage='${toString(this.patternErrorMessage)}'".`);
142
142
  }
143
143
  }
144
- validateDisplayCharacterLeft(newValue) {
144
+ validatecharacterLeftHide(newValue) {
145
145
  if (newValue) {
146
- this.classCollection.add(this.classHasDisplayCharacterLeft);
146
+ this.classCollection.delete(this.classDisplayCharacterLeft);
147
147
  }
148
148
  else {
149
- this.classCollection.delete(this.classHasDisplayCharacterLeft);
149
+ this.classCollection.add(this.classDisplayCharacterLeft);
150
150
  }
151
151
  }
152
152
  /**
@@ -167,10 +167,10 @@ export class MgInputTextarea {
167
167
  */
168
168
  async setError(valid, errorMessage) {
169
169
  if (typeof valid !== 'boolean') {
170
- throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean');
170
+ throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean.');
171
171
  }
172
172
  else if (!isValidString(errorMessage)) {
173
- throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string');
173
+ throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string.');
174
174
  }
175
175
  else {
176
176
  this.setValidity(valid);
@@ -187,7 +187,7 @@ export class MgInputTextarea {
187
187
  this.valid = newValue;
188
188
  this.invalid = !this.valid;
189
189
  // We need to send valid event even if it is the same value
190
- if (this.handlerInProgress === undefined || (this.handlerInProgress === Handler.BLUR && this.valid !== oldValidValue))
190
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
191
191
  this.inputValid.emit(this.valid);
192
192
  }
193
193
  /*************
@@ -202,7 +202,7 @@ export class MgInputTextarea {
202
202
  this.messages = initLocales(this.element).messages;
203
203
  this.characterLeftId = `${this.identifier}-character-left`;
204
204
  // Validate
205
- this.validateDisplayCharacterLeft(this.displayCharacterLeft);
205
+ this.validatecharacterLeftHide(this.characterLeftHide);
206
206
  this.validatePattern(this.pattern);
207
207
  this.validatePattern(this.patternErrorMessage);
208
208
  this.watchMgWidth(this.mgWidth);
@@ -220,7 +220,7 @@ export class MgInputTextarea {
220
220
  * @returns HTML Element
221
221
  */
222
222
  render() {
223
- return (h("mg-input", { key: 'c4386e9b6efe517276d3cd55d213819ff90d7e20', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: this.value, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, h("div", { key: '2d30db0ea21becffcdce57e46734e76877dc4858', class: "mg-c-input__with-character-left" }, h("textarea", { key: 'bc95d0db89014cafbb4e45893974e1ad09a41bf9', class: {
223
+ return (h("mg-input", { key: '434d00b8d1b5f066b416f777572bfae84797e79d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
224
224
  'mg-c-input__box': true,
225
225
  'mg-c-input__box--width': true,
226
226
  'mg-c-input__box--resizable': this.resizable === 'both',
@@ -229,7 +229,7 @@ export class MgInputTextarea {
229
229
  }, value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, rows: this.rows, maxlength: this.maxlength, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
230
230
  if (el !== null)
231
231
  this.input = el;
232
- } }), this.displayCharacterLeft && this.maxlength > 0 && (h("mg-character-left", { key: '522f8440ff28f9767c7273f56936cc994dfa17da', identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength })))));
232
+ } }), !this.characterLeftHide && this.maxlength > 0 && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))))));
233
233
  }
234
234
  static get is() { return "mg-input-textarea"; }
235
235
  static get encapsulation() { return "shadow"; }
@@ -555,7 +555,7 @@ export class MgInputTextarea {
555
555
  "reflect": false,
556
556
  "defaultValue": "'input'"
557
557
  },
558
- "displayCharacterLeft": {
558
+ "characterLeftHide": {
559
559
  "type": "boolean",
560
560
  "mutable": false,
561
561
  "complexType": {
@@ -569,9 +569,9 @@ export class MgInputTextarea {
569
569
  "tags": [],
570
570
  "text": "Define if component should display character left"
571
571
  },
572
- "attribute": "display-character-left",
572
+ "attribute": "character-left-hide",
573
573
  "reflect": false,
574
- "defaultValue": "true"
574
+ "defaultValue": "false"
575
575
  },
576
576
  "helpText": {
577
577
  "type": "string",
@@ -779,8 +779,8 @@ export class MgInputTextarea {
779
779
  "propName": "patternErrorMessage",
780
780
  "methodName": "validatePattern"
781
781
  }, {
782
- "propName": "displayCharacterLeft",
783
- "methodName": "validateDisplayCharacterLeft"
782
+ "propName": "characterLeftHide",
783
+ "methodName": "validatecharacterLeftHide"
784
784
  }];
785
785
  }
786
786
  }