@mgdis/mg-components 6.2.0 → 6.4.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 (238) hide show
  1. package/dist/cjs/{index-52d5f3d4.js → index-911898e4.js} +410 -266
  2. package/dist/cjs/index-911898e4.js.map +1 -0
  3. package/dist/cjs/{index-cc11af95.js → index-a3269bfc.js} +3 -3
  4. package/dist/cjs/{index-cc11af95.js.map → index-a3269bfc.js.map} +1 -1
  5. package/dist/cjs/{index.es-ac7c22e3.js → index.es-325100d7.js} +47 -47
  6. package/dist/cjs/index.es-325100d7.js.map +1 -0
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/mg-action-more_36.cjs.entry.js +1414 -983
  9. package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
  10. package/dist/cjs/mg-alert.cjs.entry.js +17 -12
  11. package/dist/cjs/mg-alert.cjs.entry.js.map +1 -1
  12. package/dist/cjs/mg-components.cjs.js +3 -3
  13. package/dist/cjs/mg-components.cjs.js.map +1 -1
  14. package/dist/cjs/mg-loader.cjs.entry.js +6 -8
  15. package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
  16. package/dist/cjs/mg-progress.cjs.entry.js +27 -12
  17. package/dist/cjs/mg-progress.cjs.entry.js.map +1 -1
  18. package/dist/collection/collection-manifest.json +2 -2
  19. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +10 -3
  20. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js.map +1 -1
  21. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +15 -4
  22. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js.map +1 -1
  23. package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -4
  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 +4 -0
  26. package/dist/collection/components/atoms/mg-button/mg-button.conf.js.map +1 -1
  27. package/dist/collection/components/atoms/mg-button/mg-button.js +112 -12
  28. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  29. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
  30. package/dist/collection/components/atoms/mg-divider/mg-divider.js +9 -1
  31. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  33. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  34. package/dist/collection/components/atoms/mg-tag/mg-tag.js +14 -4
  35. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  36. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +3 -4
  37. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  38. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +28 -6
  39. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  40. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +50 -13
  41. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +29 -11
  43. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +106 -33
  45. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +99 -36
  47. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +130 -35
  49. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +87 -25
  51. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +86 -26
  53. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +92 -30
  55. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +109 -32
  57. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  58. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +109 -29
  59. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  60. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +67 -21
  61. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  62. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +16 -70
  63. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -1
  64. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +101 -89
  65. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  66. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +194 -157
  67. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  68. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +19 -8
  69. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  70. package/dist/collection/components/molecules/mg-alert/mg-alert.js +31 -6
  71. package/dist/collection/components/molecules/mg-alert/mg-alert.js.map +1 -1
  72. package/dist/collection/components/molecules/mg-details/mg-details.js +17 -5
  73. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  74. package/dist/collection/components/molecules/mg-form/mg-form.js +48 -16
  75. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  76. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +13 -3
  77. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  78. package/dist/collection/components/molecules/mg-loader/mg-loader.js +5 -5
  79. package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
  80. package/dist/collection/components/molecules/mg-message/mg-message.js +22 -6
  81. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  82. package/dist/collection/components/molecules/mg-modal/mg-modal.js +54 -11
  83. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  84. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +28 -9
  85. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  86. package/dist/collection/components/molecules/mg-panel/mg-panel.js +48 -13
  87. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  88. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +10 -2
  89. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  90. package/dist/collection/components/molecules/mg-popover/mg-popover.js +61 -7
  91. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  92. package/dist/collection/components/molecules/mg-progress/mg-progress.js +26 -1
  93. package/dist/collection/components/molecules/mg-progress/mg-progress.js.map +1 -1
  94. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +3 -2
  95. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  96. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +28 -8
  97. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  98. package/dist/collection/utils/behaviors.utils.js +44 -107
  99. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  100. package/dist/components/index.es.js +42 -42
  101. package/dist/components/index.es.js.map +1 -1
  102. package/dist/components/index2.js +2 -2
  103. package/dist/components/mg-action-more.js +15 -12
  104. package/dist/components/mg-action-more.js.map +1 -1
  105. package/dist/components/mg-alert.js +15 -10
  106. package/dist/components/mg-alert.js.map +1 -1
  107. package/dist/components/mg-badge2.js +13 -10
  108. package/dist/components/mg-badge2.js.map +1 -1
  109. package/dist/components/mg-button2.js +77 -16
  110. package/dist/components/mg-button2.js.map +1 -1
  111. package/dist/components/mg-card2.js +1 -1
  112. package/dist/components/mg-character-left2.js +8 -7
  113. package/dist/components/mg-character-left2.js.map +1 -1
  114. package/dist/components/mg-details.js +11 -7
  115. package/dist/components/mg-details.js.map +1 -1
  116. package/dist/components/mg-divider2.js +7 -1
  117. package/dist/components/mg-divider2.js.map +1 -1
  118. package/dist/components/mg-form.js +35 -21
  119. package/dist/components/mg-form.js.map +1 -1
  120. package/dist/components/mg-icon2.js +17 -11
  121. package/dist/components/mg-icon2.js.map +1 -1
  122. package/dist/components/mg-illustrated-message.js +10 -4
  123. package/dist/components/mg-illustrated-message.js.map +1 -1
  124. package/dist/components/mg-input-checkbox-paginated2.js +14 -10
  125. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  126. package/dist/components/mg-input-checkbox.js +73 -40
  127. package/dist/components/mg-input-checkbox.js.map +1 -1
  128. package/dist/components/mg-input-date.js +77 -46
  129. package/dist/components/mg-input-date.js.map +1 -1
  130. package/dist/components/mg-input-numeric.js +90 -45
  131. package/dist/components/mg-input-numeric.js.map +1 -1
  132. package/dist/components/mg-input-password.js +56 -28
  133. package/dist/components/mg-input-password.js.map +1 -1
  134. package/dist/components/mg-input-radio.js +59 -31
  135. package/dist/components/mg-input-radio.js.map +1 -1
  136. package/dist/components/mg-input-select2.js +60 -36
  137. package/dist/components/mg-input-select2.js.map +1 -1
  138. package/dist/components/mg-input-text2.js +71 -40
  139. package/dist/components/mg-input-text2.js.map +1 -1
  140. package/dist/components/mg-input-textarea.js +72 -36
  141. package/dist/components/mg-input-textarea.js.map +1 -1
  142. package/dist/components/mg-input-title2.js +11 -8
  143. package/dist/components/mg-input-title2.js.map +1 -1
  144. package/dist/components/mg-input-toggle.js +43 -25
  145. package/dist/components/mg-input-toggle.js.map +1 -1
  146. package/dist/components/mg-input2.js +37 -20
  147. package/dist/components/mg-input2.js.map +1 -1
  148. package/dist/components/mg-item-more2.js +146 -270
  149. package/dist/components/mg-item-more2.js.map +1 -1
  150. package/dist/components/mg-loader.js +4 -6
  151. package/dist/components/mg-loader.js.map +1 -1
  152. package/dist/components/mg-menu-item2.js +193 -149
  153. package/dist/components/mg-menu-item2.js.map +1 -1
  154. package/dist/components/mg-message2.js +21 -9
  155. package/dist/components/mg-message2.js.map +1 -1
  156. package/dist/components/mg-modal.js +36 -17
  157. package/dist/components/mg-modal.js.map +1 -1
  158. package/dist/components/mg-pagination2.js +21 -14
  159. package/dist/components/mg-pagination2.js.map +1 -1
  160. package/dist/components/mg-panel.js +37 -20
  161. package/dist/components/mg-panel.js.map +1 -1
  162. package/dist/components/mg-popover-content2.js +9 -3
  163. package/dist/components/mg-popover-content2.js.map +1 -1
  164. package/dist/components/mg-popover2.js +38 -10
  165. package/dist/components/mg-popover2.js.map +1 -1
  166. package/dist/components/mg-progress.js +26 -11
  167. package/dist/components/mg-progress.js.map +1 -1
  168. package/dist/components/mg-skip-links.js +2 -3
  169. package/dist/components/mg-skip-links.js.map +1 -1
  170. package/dist/components/mg-tabs.js +27 -17
  171. package/dist/components/mg-tabs.js.map +1 -1
  172. package/dist/components/mg-tag.js +12 -8
  173. package/dist/components/mg-tag.js.map +1 -1
  174. package/dist/components/mg-tooltip-content2.js +1 -2
  175. package/dist/components/mg-tooltip-content2.js.map +1 -1
  176. package/dist/components/mg-tooltip2.js +24 -12
  177. package/dist/components/mg-tooltip2.js.map +1 -1
  178. package/dist/esm/{index-81752ffe.js → index-1f32332a.js} +410 -266
  179. package/dist/esm/index-1f32332a.js.map +1 -0
  180. package/dist/esm/{index-f3d3fb70.js → index-9bd10f5d.js} +3 -3
  181. package/dist/esm/{index-f3d3fb70.js.map → index-9bd10f5d.js.map} +1 -1
  182. package/dist/esm/{index.es-940821a9.js → index.es-a2587b72.js} +43 -43
  183. package/dist/esm/index.es-a2587b72.js.map +1 -0
  184. package/dist/esm/loader.js +3 -3
  185. package/dist/esm/mg-action-more_36.entry.js +1414 -983
  186. package/dist/esm/mg-action-more_36.entry.js.map +1 -1
  187. package/dist/esm/mg-alert.entry.js +17 -12
  188. package/dist/esm/mg-alert.entry.js.map +1 -1
  189. package/dist/esm/mg-components.js +4 -4
  190. package/dist/esm/mg-components.js.map +1 -1
  191. package/dist/esm/mg-loader.entry.js +6 -8
  192. package/dist/esm/mg-loader.entry.js.map +1 -1
  193. package/dist/esm/mg-progress.entry.js +27 -12
  194. package/dist/esm/mg-progress.entry.js.map +1 -1
  195. package/dist/mg-components/mg-components.esm.js +1 -1
  196. package/dist/mg-components/mg-components.esm.js.map +1 -1
  197. package/dist/mg-components/p-0ead5317.entry.js +2 -0
  198. package/dist/mg-components/{p-31e6c1a7.entry.js.map → p-0ead5317.entry.js.map} +1 -1
  199. package/dist/mg-components/p-35898742.js +3 -0
  200. package/dist/mg-components/p-35898742.js.map +1 -0
  201. package/dist/mg-components/p-3b052ac0.entry.js +2 -0
  202. package/dist/mg-components/p-3b052ac0.entry.js.map +1 -0
  203. package/dist/mg-components/p-6810a565.entry.js +2 -0
  204. package/dist/mg-components/p-6810a565.entry.js.map +1 -0
  205. package/dist/mg-components/{p-ee51ec5e.js → p-b986c107.js} +2 -2
  206. package/dist/mg-components/p-b986c107.js.map +1 -0
  207. package/dist/mg-components/{p-a49e2b74.js → p-dc436f3c.js} +2 -2
  208. package/dist/mg-components/p-f48d964f.entry.js +2 -0
  209. package/dist/mg-components/p-f48d964f.entry.js.map +1 -0
  210. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +9 -1
  211. package/dist/types/components/atoms/mg-button/mg-button.d.ts +11 -1
  212. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +6 -0
  213. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.d.ts +1 -15
  214. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +14 -30
  215. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +46 -37
  216. package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +4 -0
  217. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +4 -0
  218. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +4 -0
  219. package/dist/types/components.d.ts +33 -15
  220. package/dist/types/utils/behaviors.utils.d.ts +15 -44
  221. package/ide/intellij/web-types.json +39 -11
  222. package/ide/vscode/html-custom-data.json +28 -6
  223. package/package.json +27 -37
  224. package/dist/cjs/index-52d5f3d4.js.map +0 -1
  225. package/dist/cjs/index.es-ac7c22e3.js.map +0 -1
  226. package/dist/esm/index-81752ffe.js.map +0 -1
  227. package/dist/esm/index.es-940821a9.js.map +0 -1
  228. package/dist/mg-components/p-2298352f.js +0 -3
  229. package/dist/mg-components/p-2298352f.js.map +0 -1
  230. package/dist/mg-components/p-31e6c1a7.entry.js +0 -2
  231. package/dist/mg-components/p-67c9be27.entry.js +0 -2
  232. package/dist/mg-components/p-67c9be27.entry.js.map +0 -1
  233. package/dist/mg-components/p-95895169.entry.js +0 -2
  234. package/dist/mg-components/p-95895169.entry.js.map +0 -1
  235. package/dist/mg-components/p-abddacc2.entry.js +0 -2
  236. package/dist/mg-components/p-abddacc2.entry.js.map +0 -1
  237. package/dist/mg-components/p-ee51ec5e.js.map +0 -1
  238. /package/dist/mg-components/{p-a49e2b74.js.map → p-dc436f3c.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { p as pt, d as dt, u as ut, $ as $t, X as Xe, Y as Ye, m as me } from './index.es.js';
2
+ import { G as Ge, u as ut, $ as $t, d as dt, f as ft, J as Je, y as ye } from './index.es.js';
3
3
  import { d as defineCustomElement$5, b as classReadonly, e as classDisabled, w as widths } from './mg-input2.js';
4
4
  import { i as initLocales } from './index2.js';
5
5
  import { d as defineCustomElement$6 } from './mg-icon2.js';
@@ -13,7 +13,7 @@ import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
13
13
  const types = ['decimal', 'integer'];
14
14
  const formats = ['none', 'number', 'currency', 'percent', 'unit'];
15
15
 
16
- const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
16
+ const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
17
17
  const MgInputNumericStyle0 = mgInputNumericCss;
18
18
 
19
19
  const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric extends HTMLElement {
@@ -25,6 +25,62 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
25
25
  this.inputValid = createEvent(this, "input-valid", 7);
26
26
  // hasDisplayedError (triggered by blur event)
27
27
  this.hasDisplayedError = false;
28
+ /**
29
+ * Input name
30
+ * If not set the value equals the identifier
31
+ */
32
+ this.name = this.identifier;
33
+ /**
34
+ * Define if label is visible
35
+ */
36
+ this.labelHide = false;
37
+ /**
38
+ * Define if input is required
39
+ */
40
+ this.required = false;
41
+ /**
42
+ * Define if input is readonly
43
+ */
44
+ this.readonly = false;
45
+ /**
46
+ * Define if input is disabled
47
+ */
48
+ this.disabled = false;
49
+ /**
50
+ * Define tooltip position
51
+ */
52
+ this.tooltipPosition = 'input';
53
+ /**
54
+ * Define numeric type
55
+ */
56
+ this.type = 'decimal';
57
+ /**
58
+ * Set local formatting.
59
+ * Numbers are formatted based on the locale.
60
+ */
61
+ this.format = 'number';
62
+ /**
63
+ * Define currency
64
+ */
65
+ this.currency = 'EUR';
66
+ /**
67
+ * Define unit display format ('short', 'long', 'narrow')
68
+ */
69
+ this.unitDisplay = 'short';
70
+ /**
71
+ * Override integer length
72
+ * integer is the number before the decimal point
73
+ */
74
+ this.integerLength = 13;
75
+ /**
76
+ * Override decimal length
77
+ * decimal is the number after the decimal point
78
+ */
79
+ this.decimalLength = 2;
80
+ /**
81
+ * Component classes
82
+ */
83
+ this.classCollection = new Ge(['mg-c-input--numeric']);
28
84
  /**
29
85
  * Handle input event
30
86
  */
@@ -62,6 +118,12 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
62
118
  this.checkValidity = () => {
63
119
  this.setValidity(this.readonly || this.disabled || this.getInputError() === null);
64
120
  };
121
+ /**
122
+ * Format min/max value for error message
123
+ * @param value - value to format
124
+ * @returns formatted value according to locale
125
+ */
126
+ this.formatErrorValue = (value) => ut(value, this.locale, !Number.isInteger(value) && this.type === 'decimal' ? this.decimalLength : 0);
65
127
  /**
66
128
  * Set input error message
67
129
  * @param errorMessage - errorMessage override
@@ -78,8 +140,8 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
78
140
  this.errorMessage = this.messages.errors[inputError];
79
141
  }
80
142
  else {
81
- const formattedMin = this.formatValue(this.min);
82
- const formattedMax = this.formatValue(this.max);
143
+ const formattedMin = this.formatErrorValue(this.min);
144
+ const formattedMax = this.formatErrorValue(this.max);
83
145
  this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
84
146
  }
85
147
  }
@@ -118,13 +180,13 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
118
180
  this.formatValue = (value) => {
119
181
  switch (this.format) {
120
182
  case 'number':
121
- return $t(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
183
+ return ut(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
122
184
  case 'currency':
123
- return ut(value, this.locale, this.currency);
185
+ return ft(value, this.locale, this.currency);
124
186
  case 'percent':
125
187
  return dt(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
126
188
  case 'unit':
127
- return pt(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
189
+ return $t(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
128
190
  case 'none':
129
191
  return value.toString();
130
192
  }
@@ -151,34 +213,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
151
213
  this.renderReadonly = () => {
152
214
  return this.slotContent !== undefined ? (h("span", { class: "mg-c-input__readonly-value" }, h("b", null, this.readonlyValue), this.slotContent)) : (h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue));
153
215
  };
154
- this.value = undefined;
155
- this.identifier = undefined;
156
- this.name = this.identifier;
157
- this.label = undefined;
158
- this.labelOnTop = undefined;
159
- this.labelHide = false;
160
- this.placeholder = undefined;
161
- this.required = false;
162
- this.readonly = false;
163
- this.max = undefined;
164
- this.min = undefined;
165
- this.disabled = false;
166
- this.mgWidth = undefined;
167
- this.tooltip = undefined;
168
- this.tooltipPosition = 'input';
169
- this.helpText = undefined;
170
- this.type = 'decimal';
171
- this.format = 'number';
172
- this.currency = 'EUR';
173
- this.unit = undefined;
174
- this.unitDisplay = 'short';
175
- this.integerLength = 13;
176
- this.decimalLength = 2;
177
- this.valid = undefined;
178
- this.invalid = undefined;
179
- this.classCollection = new Xe(['mg-c-input--numeric']);
180
- this.errorMessage = undefined;
181
- this.hasFocus = undefined;
182
216
  }
183
217
  validateValue(newValue) {
184
218
  // has input value is always render as string we get a stringified value or a '' for nullish value, so we test string type
@@ -231,31 +265,42 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
231
265
  }
232
266
  validateType(newValue) {
233
267
  if (!types.includes(newValue)) {
234
- throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${Ye(newValue)}.`);
268
+ throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${Je(newValue)}.`);
235
269
  }
236
270
  }
237
271
  watchFormat(newValue) {
238
272
  if (!formats.includes(newValue)) {
239
- throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${Ye(newValue)}.`);
273
+ throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${Je(newValue)}.`);
240
274
  }
241
275
  }
242
276
  validateIntegerLength(newValue) {
243
277
  if (newValue < 1) {
244
- throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${Ye(newValue)}.`);
278
+ throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${Je(newValue)}.`);
245
279
  }
246
280
  }
247
281
  validateDecimalLength(newValue) {
248
282
  if (newValue < 1) {
249
- throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${Ye(newValue)}.`);
283
+ throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${Je(newValue)}.`);
250
284
  }
251
285
  }
252
286
  /**
253
287
  * Display input error if it exists.
254
288
  */
255
- async displayError() {
256
- this.checkValidity();
257
- this.setErrorMessage();
258
- this.hasDisplayedError = this.invalid;
289
+ displayError() {
290
+ // Use `Promise` as requested for stencil method
291
+ // Use `requestAnimationFrame` to ensure:
292
+ // - DOM is fully updated before validation
293
+ // - Async operations are completed
294
+ // - No timing issues with Stencil's render cycle
295
+ // - Keep everything in sync both inside and outside the component
296
+ return new Promise(resolve => {
297
+ requestAnimationFrame(() => {
298
+ this.checkValidity();
299
+ this.setErrorMessage();
300
+ this.hasDisplayedError = this.invalid;
301
+ resolve();
302
+ });
303
+ });
259
304
  }
260
305
  /**
261
306
  * Set an error and display a custom error message.
@@ -269,7 +314,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
269
314
  if (typeof valid !== 'boolean') {
270
315
  throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
271
316
  }
272
- else if (!me(errorMessage)) {
317
+ else if (!ye(errorMessage)) {
273
318
  throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
274
319
  }
275
320
  else {
@@ -375,7 +420,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
375
420
  * @returns HTML Element
376
421
  */
377
422
  render() {
378
- return (h("mg-input", { key: '6d34c2b7e9762cdefc5de3814ff4afd95fa4a6a6', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], 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
423
+ return (h("mg-input", { key: 'b3f1b0e8a78d2f61146f052db1636d98e89271d1', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], 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
379
424
  ? this.readonlyValue && this.renderReadonly()
380
425
  : [
381
426
  h("input", { key: "input", type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
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AI,EAAE,IAAI,CAAC,IAAI,EACf,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,KAAK,EAAE,IAAI,CAAC,WAAW,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,kBACT,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,QAAQ,EAAE,EAChD,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,GAAG,EAAE,CAAC,EAAoB;wBACxB,IAAI,EAAE,KAAK,IAAI;4BAAE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;qBAClC,GACD;gBACF,YAAM,GAAG,EAAC,MAAM,EAAC,IAAI,EAAC,cAAc,GAAQ;aAC7C,CACI,EACX;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["MgInputNumeric","localeNumber","localeCurrency","localePercent","localeUnit","ClassList","toString","isValidString"],"sources":["src/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.ts","../styles/dist/components/mg-input-numeric.css?tag=mg-input-numeric&encapsulation=shadow","src/components/molecules/inputs/mg-input-numeric/mg-input-numeric.tsx"],"sourcesContent":["import type { InputError } from '../../../../types';\n\n/**\n * List of all possibles types\n */\nexport const types = ['decimal', 'integer'] as const;\n\nexport type NumericType = (typeof types)[number];\n\nexport const formats = ['none', 'number', 'currency', 'percent', 'unit'] as const;\n\nexport type Format = (typeof formats)[number];\n\nexport type InputNumericError = InputError & ('min' | 'max' | 'minMax' | 'required');\n",".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left: 0;--mg-c-button-border-radius-bottom-left: 0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right: 0;--mg-c-button-border-radius-bottom-right: 0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width: 0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right: var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right: var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}/*# sourceMappingURL=mg-input-numeric.css.map */\n","import { Component, Element, Event, h, Prop, EventEmitter, State, Watch, Method } from '@stencil/core';\nimport { ClassList, isValidString, localeCurrency, localeNumber, localePercent, localeUnit, toString } from '@mgdis/stencil-helpers';\nimport { types, type InputNumericError, type NumericType, type Format, formats } from './mg-input-numeric.conf';\nimport { type TooltipPosition, type Width, type EventType, classReadonly, classDisabled, widths } from '../mg-input/mg-input.conf';\nimport { initLocales } from '../../../../locales/';\n\n/**\n * @slot append-input - Content to display next to the input\n */\n@Component({\n tag: 'mg-input-numeric',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-numeric.css',\n shadow: true,\n})\nexport class MgInputNumeric {\n /************\n * Internal *\n ************/\n\n // Manage different values\n private storedValue: string;\n private numericValue: number;\n private readonlyValue: string;\n private slotContent: string;\n\n // HTML selector\n private input: HTMLInputElement;\n\n // Locales\n private locale: string;\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n private handlerInProgress: EventType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputNumericElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: string;\n @Watch('value')\n validateValue(newValue: MgInputNumeric['value']): void {\n // has input value is always render as string we get a stringified value or a '' for nullish value, so we test string type\n if (typeof newValue === 'string') {\n // Split number and decimal\n const [integer, decimal = ''] = newValue.replace('-', '').split(/[.,]/);\n // Regex\n const regex = this.type === 'integer' ? /^-?\\d+$/ : /^-?\\d+(?:[.,]\\d*)?$/;\n // Filter input\n if (this.isValidValue(newValue, regex, integer, decimal)) {\n this.storedValue = newValue;\n } else {\n newValue = this.handleInvalidValue();\n }\n // Set value and input value\n this.updateValues(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 * 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 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: MgInputNumeric['readonly']): void {\n if (newValue) this.classCollection.add(classReadonly);\n else this.classCollection.delete(classReadonly);\n }\n\n /**\n * Maximum value\n */\n @Prop() max?: number;\n\n /**\n * Minimum value\n */\n @Prop() min?: number;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n @Watch('min')\n @Watch('max')\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: MgInputNumeric['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;\n @Watch('mgWidth')\n watchMgWidth(newValue: MgInputNumeric['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 * 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 * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText?: string;\n\n /**\n * Define numeric type\n */\n @Prop() type: NumericType = 'decimal';\n @Watch('type')\n validateType(newValue: MgInputNumeric['type']): void {\n if (!types.includes(newValue)) {\n throw new Error(`<mg-input-numeric> prop \"type\" must be one of: ${types.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Set local formatting.\n * Numbers are formatted based on the locale.\n */\n @Prop() format: Format = 'number';\n @Watch('format')\n watchFormat(newValue: MgInputNumeric['format']): void {\n if (!formats.includes(newValue)) {\n throw new Error(`<mg-input-numeric> prop \"format\" must be one of: ${formats.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define currency\n */\n @Prop() currency = 'EUR';\n\n /**\n * Define unit symbol (km, L, etc.)\n */\n @Prop() unit?: Intl.NumberFormatOptions['unit'];\n\n /**\n * Define unit display format ('short', 'long', 'narrow')\n */\n @Prop() unitDisplay: Intl.NumberFormatOptions['unitDisplay'] = 'short';\n\n /**\n * Override integer length\n * integer is the number before the decimal point\n */\n @Prop() integerLength = 13;\n @Watch('integerLength')\n validateIntegerLength(newValue: MgInputNumeric['integerLength']): void {\n if (newValue < 1) {\n throw new Error(`<mg-input-numeric> prop \"integer-length\" must be a positive number. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Override decimal length\n * decimal is the number after the decimal point\n */\n @Prop() decimalLength = 2;\n @Watch('decimalLength')\n validateDecimalLength(newValue: MgInputNumeric['decimalLength']): void {\n if (newValue < 1) {\n throw new Error(`<mg-input-numeric> prop \"decimal-length\" must be a positive number, consider using prop \"type\" to \"integer\" instead. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define input pattern to validate\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input pattern error message\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--numeric']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Define if input has focus\n */\n @State() hasFocus: boolean;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<number>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<HTMLMgInputNumericElement['valid']>;\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: MgInputNumeric['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-numeric> method \"setError()\" param \"valid\" must be a boolean.');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-numeric> 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 * Reset value, validity and error state\n */\n @Method()\n async reset(): Promise<void> {\n if (!this.readonly) {\n this.value = '';\n this.checkValidity();\n this.errorMessage = undefined;\n this.hasDisplayedError = false;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputNumeric['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 * Checks if the given value is valid according to the defined rules.\n * @param value - The input value to validate.\n * @param regex - The regular expression for validation.\n * @param integer - The integer part of the value.\n * @param decimal - The decimal part of the value.\n * @returns Returns true if the value is valid, otherwise false.\n */\n private isValidValue(value: string, regex: RegExp, integer: string, decimal: string): boolean {\n return (\n ['', '-'].includes(value) || (regex.exec(value) !== null && integer.length <= this.integerLength && decimal.length <= (this.type === 'integer' ? 0 : this.decimalLength))\n );\n }\n\n /**\n * Handles invalid input values and returns a corrected value.\n * @returns The corrected value.\n */\n private handleInvalidValue(): string | null {\n return this.storedValue ?? null;\n }\n\n /**\n * Updates the component values based on the validated input value.\n * @param newValue - The validated input value.\n */\n private updateValues(newValue: string | null): void {\n this.value = newValue;\n if (this.input !== undefined) this.input.value = this.value;\n\n this.numericValue = !['', null].includes(this.value) ? parseFloat(this.value.replace(',', '.')) : null;\n this.valueChange.emit(this.numericValue);\n\n this.readonlyValue = this.numericValue !== null ? this.formatValue(this.numericValue) : '';\n }\n\n /**\n * Displayed value in input\n * Change on focus/blur\n * @returns display value\n */\n private displayValue(): MgInputNumeric['value'] | MgInputNumeric['readonlyValue'] {\n return this.hasFocus ? this.value : this.readonlyValue;\n }\n\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n // Check validity\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.hasFocus = true;\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n if (this.value === '-') this.value = '';\n // Display Error\n this.handlerInProgress = 'blur';\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n this.hasFocus = false;\n });\n };\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || this.getInputError() === null);\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 if (!this.valid) {\n const inputError = this.getInputError();\n if (errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n } else if (inputError === 'required') {\n this.errorMessage = this.messages.errors[inputError];\n } else {\n const formattedMin = this.formatValue(this.min);\n const formattedMax = this.formatValue(this.max);\n this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);\n }\n }\n };\n\n /**\n * Get input error code\n * @returns error code\n */\n private getInputError = (): null | InputNumericError => {\n let inputError: InputNumericError = null;\n const hasNotEmptyValues = (toControl: number[]) => !toControl.some(value => [null, undefined].includes(value));\n\n // required\n if (!this.input.checkValidity() && this.input.validity.valueMissing) {\n inputError = 'required';\n }\n // Min & Max\n else if (hasNotEmptyValues([this.min, this.numericValue]) && this.numericValue < this.min && this.max === undefined) {\n // Only a min value is set\n inputError = 'min';\n } else if (hasNotEmptyValues([this.max, this.numericValue]) && this.numericValue > this.max && this.min === undefined) {\n // Only a max value is set\n inputError = 'max';\n } else if (hasNotEmptyValues([this.min, this.max, this.numericValue]) && (this.numericValue < this.min || this.numericValue > this.max)) {\n // both min and max values are set\n inputError = 'minMax';\n }\n return inputError;\n };\n\n /**\n * Format value based on type\n * @param value - value to format\n * @returns formated local value\n */\n private formatValue = (value: number): string => {\n switch (this.format) {\n case 'number':\n return localeNumber(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);\n case 'currency':\n return localeCurrency(value, this.locale, this.currency);\n case 'percent':\n return localePercent(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);\n case 'unit':\n return localeUnit(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);\n case 'none':\n return value.toString();\n }\n };\n\n /**\n * Validate append slot\n */\n private validateAppendSlot = (): void => {\n const slotAppendInput: HTMLSlotElement = this.element.querySelector('[slot=\"append-input\"]');\n if (slotAppendInput !== null) {\n if (slotAppendInput.nodeName === 'MG-BUTTON') {\n this.classCollection.add('mg-c-input--is-input-group-append');\n } else {\n this.classCollection.add('mg-c-input--is-append-input-slot-content');\n this.slotContent = slotAppendInput.textContent;\n }\n }\n };\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 const locales = initLocales(this.element);\n this.locale = locales.locale;\n this.messages = locales.messages;\n // Validate component config\n this.watchFormat(this.format);\n this.validateType(this.type);\n this.validateIntegerLength(this.integerLength);\n this.validateDecimalLength(this.decimalLength);\n // validate value\n this.validateValue(this.value);\n this.validateAppendSlot();\n this.watchReadonly(this.readonly);\n this.watchDisabled(this.disabled);\n this.watchMgWidth(this.mgWidth);\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.readonlyValue}</b>\n {this.slotContent}\n </span>\n ) : (\n <b class=\"mg-c-input__readonly-value\">{this.readonlyValue}</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={[]}\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.readonlyValue && this.renderReadonly()\n : [\n <input\n key=\"input\"\n type=\"text\"\n class=\"mg-c-input__box mg-c-input__box--width\"\n value={this.displayValue()}\n id={this.identifier}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={(this.invalid === true).toString()}\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 <slot key=\"slot\" name=\"append-input\"></slot>,\n ]}\n </mg-input>\n );\n }\n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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["MgInputNumeric","ClassList","localeNumber","localeCurrency","localePercent","localeUnit","toString","isValidString"],"sources":["src/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.ts","../styles/dist/components/mg-input-numeric.css?tag=mg-input-numeric&encapsulation=shadow","src/components/molecules/inputs/mg-input-numeric/mg-input-numeric.tsx"],"sourcesContent":["import type { InputError } from '../../../../types';\n\n/**\n * List of all possibles types\n */\nexport const types = ['decimal', 'integer'] as const;\n\nexport type NumericType = (typeof types)[number];\n\nexport const formats = ['none', 'number', 'currency', 'percent', 'unit'] as const;\n\nexport type Format = (typeof formats)[number];\n\nexport type InputNumericError = InputError & ('min' | 'max' | 'minMax' | 'required');\n",".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left: 0;--mg-c-button-border-radius-bottom-left: 0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right: 0;--mg-c-button-border-radius-bottom-right: 0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width: 0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right: var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right: var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}/*# sourceMappingURL=mg-input-numeric.css.map */\n","import { Component, Element, Event, h, Prop, EventEmitter, State, Watch, Method } from '@stencil/core';\nimport { ClassList, isValidString, localeCurrency, localeNumber, localePercent, localeUnit, toString } from '@mgdis/stencil-helpers';\nimport { types, type InputNumericError, type NumericType, type Format, formats } from './mg-input-numeric.conf';\nimport { type TooltipPosition, type Width, type EventType, classReadonly, classDisabled, widths } from '../mg-input/mg-input.conf';\nimport { initLocales } from '../../../../locales/';\n\n/**\n * @slot append-input - Content to display next to the input\n */\n@Component({\n tag: 'mg-input-numeric',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-numeric.css',\n shadow: true,\n})\nexport class MgInputNumeric {\n /************\n * Internal *\n ************/\n\n // Manage different values\n private storedValue: string;\n private numericValue: number;\n private readonlyValue: string;\n private slotContent: string;\n\n // HTML selector\n private input: HTMLInputElement;\n\n // Locales\n private locale: string;\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n private handlerInProgress: EventType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputNumericElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: string;\n @Watch('value')\n validateValue(newValue: MgInputNumeric['value']): void {\n // has input value is always render as string we get a stringified value or a '' for nullish value, so we test string type\n if (typeof newValue === 'string') {\n // Split number and decimal\n const [integer, decimal = ''] = newValue.replace('-', '').split(/[.,]/);\n // Regex\n const regex = this.type === 'integer' ? /^-?\\d+$/ : /^-?\\d+(?:[.,]\\d*)?$/;\n // Filter input\n if (this.isValidValue(newValue, regex, integer, decimal)) {\n this.storedValue = newValue;\n } else {\n newValue = this.handleInvalidValue();\n }\n // Set value and input value\n this.updateValues(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 * 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 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: MgInputNumeric['readonly']): void {\n if (newValue) this.classCollection.add(classReadonly);\n else this.classCollection.delete(classReadonly);\n }\n\n /**\n * Maximum value\n */\n @Prop() max?: number;\n\n /**\n * Minimum value\n */\n @Prop() min?: number;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n @Watch('min')\n @Watch('max')\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: MgInputNumeric['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;\n @Watch('mgWidth')\n watchMgWidth(newValue: MgInputNumeric['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 * 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 * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText?: string;\n\n /**\n * Define numeric type\n */\n @Prop() type: NumericType = 'decimal';\n @Watch('type')\n validateType(newValue: MgInputNumeric['type']): void {\n if (!types.includes(newValue)) {\n throw new Error(`<mg-input-numeric> prop \"type\" must be one of: ${types.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Set local formatting.\n * Numbers are formatted based on the locale.\n */\n @Prop() format: Format = 'number';\n @Watch('format')\n watchFormat(newValue: MgInputNumeric['format']): void {\n if (!formats.includes(newValue)) {\n throw new Error(`<mg-input-numeric> prop \"format\" must be one of: ${formats.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define currency\n */\n @Prop() currency = 'EUR';\n\n /**\n * Define unit symbol (km, L, etc.)\n */\n @Prop() unit?: Intl.NumberFormatOptions['unit'];\n\n /**\n * Define unit display format ('short', 'long', 'narrow')\n */\n @Prop() unitDisplay: Intl.NumberFormatOptions['unitDisplay'] = 'short';\n\n /**\n * Override integer length\n * integer is the number before the decimal point\n */\n @Prop() integerLength = 13;\n @Watch('integerLength')\n validateIntegerLength(newValue: MgInputNumeric['integerLength']): void {\n if (newValue < 1) {\n throw new Error(`<mg-input-numeric> prop \"integer-length\" must be a positive number. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Override decimal length\n * decimal is the number after the decimal point\n */\n @Prop() decimalLength = 2;\n @Watch('decimalLength')\n validateDecimalLength(newValue: MgInputNumeric['decimalLength']): void {\n if (newValue < 1) {\n throw new Error(`<mg-input-numeric> prop \"decimal-length\" must be a positive number, consider using prop \"type\" to \"integer\" instead. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define input pattern to validate\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input pattern error message\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--numeric']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Define if input has focus\n */\n @State() hasFocus: boolean;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<number>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<HTMLMgInputNumericElement['valid']>;\n\n /**\n * Display input error if it exists.\n */\n @Method()\n displayError(): Promise<void> {\n // Use `Promise` as requested for stencil method\n // Use `requestAnimationFrame` to ensure:\n // - DOM is fully updated before validation\n // - Async operations are completed\n // - No timing issues with Stencil's render cycle\n // - Keep everything in sync both inside and outside the component\n return new Promise(resolve => {\n requestAnimationFrame(() => {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n resolve()\n })\n })\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: MgInputNumeric['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-numeric> method \"setError()\" param \"valid\" must be a boolean.');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-numeric> 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 * Reset value, validity and error state\n */\n @Method()\n async reset(): Promise<void> {\n if (!this.readonly) {\n this.value = '';\n this.checkValidity();\n this.errorMessage = undefined;\n this.hasDisplayedError = false;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputNumeric['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 * Checks if the given value is valid according to the defined rules.\n * @param value - The input value to validate.\n * @param regex - The regular expression for validation.\n * @param integer - The integer part of the value.\n * @param decimal - The decimal part of the value.\n * @returns Returns true if the value is valid, otherwise false.\n */\n private isValidValue(value: string, regex: RegExp, integer: string, decimal: string): boolean {\n return (\n ['', '-'].includes(value) || (regex.exec(value) !== null && integer.length <= this.integerLength && decimal.length <= (this.type === 'integer' ? 0 : this.decimalLength))\n );\n }\n\n /**\n * Handles invalid input values and returns a corrected value.\n * @returns The corrected value.\n */\n private handleInvalidValue(): string | null {\n return this.storedValue ?? null;\n }\n\n /**\n * Updates the component values based on the validated input value.\n * @param newValue - The validated input value.\n */\n private updateValues(newValue: string | null): void {\n this.value = newValue;\n if (this.input !== undefined) this.input.value = this.value;\n\n this.numericValue = !['', null].includes(this.value) ? parseFloat(this.value.replace(',', '.')) : null;\n this.valueChange.emit(this.numericValue);\n\n this.readonlyValue = this.numericValue !== null ? this.formatValue(this.numericValue) : '';\n }\n\n /**\n * Displayed value in input\n * Change on focus/blur\n * @returns display value\n */\n private displayValue(): MgInputNumeric['value'] | MgInputNumeric['readonlyValue'] {\n return this.hasFocus ? this.value : this.readonlyValue;\n }\n\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n // Check validity\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.hasFocus = true;\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n if (this.value === '-') this.value = '';\n // Display Error\n this.handlerInProgress = 'blur';\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n this.hasFocus = false;\n });\n };\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || this.getInputError() === null);\n };\n\n /**\n * Format min/max value for error message\n * @param value - value to format\n * @returns formatted value according to locale\n */\n private formatErrorValue = (value: number): string => localeNumber(value, this.locale, !Number.isInteger(value) && this.type === 'decimal' ? this.decimalLength : 0);\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 if (!this.valid) {\n const inputError = this.getInputError();\n if (errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n } else if (inputError === 'required') {\n this.errorMessage = this.messages.errors[inputError];\n } else {\n const formattedMin = this.formatErrorValue(this.min);\n const formattedMax = this.formatErrorValue(this.max);\n this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);\n }\n }\n };\n\n /**\n * Get input error code\n * @returns error code\n */\n private getInputError = (): null | InputNumericError => {\n let inputError: InputNumericError = null;\n const hasNotEmptyValues = (toControl: number[]) => !toControl.some(value => [null, undefined].includes(value));\n\n // required\n if (!this.input.checkValidity() && this.input.validity.valueMissing) {\n inputError = 'required';\n }\n // Min & Max\n else if (hasNotEmptyValues([this.min, this.numericValue]) && this.numericValue < this.min && this.max === undefined) {\n // Only a min value is set\n inputError = 'min';\n } else if (hasNotEmptyValues([this.max, this.numericValue]) && this.numericValue > this.max && this.min === undefined) {\n // Only a max value is set\n inputError = 'max';\n } else if (hasNotEmptyValues([this.min, this.max, this.numericValue]) && (this.numericValue < this.min || this.numericValue > this.max)) {\n // both min and max values are set\n inputError = 'minMax';\n }\n return inputError;\n };\n\n /**\n * Format value based on type\n * @param value - value to format\n * @returns formated local value\n */\n private formatValue = (value: number): string => {\n switch (this.format) {\n case 'number':\n return localeNumber(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);\n case 'currency':\n return localeCurrency(value, this.locale, this.currency);\n case 'percent':\n return localePercent(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);\n case 'unit':\n return localeUnit(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);\n case 'none':\n return value.toString();\n }\n };\n\n /**\n * Validate append slot\n */\n private validateAppendSlot = (): void => {\n const slotAppendInput: HTMLSlotElement = this.element.querySelector('[slot=\"append-input\"]');\n if (slotAppendInput !== null) {\n if (slotAppendInput.nodeName === 'MG-BUTTON') {\n this.classCollection.add('mg-c-input--is-input-group-append');\n } else {\n this.classCollection.add('mg-c-input--is-append-input-slot-content');\n this.slotContent = slotAppendInput.textContent;\n }\n }\n };\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 const locales = initLocales(this.element);\n this.locale = locales.locale;\n this.messages = locales.messages;\n // Validate component config\n this.watchFormat(this.format);\n this.validateType(this.type);\n this.validateIntegerLength(this.integerLength);\n this.validateDecimalLength(this.decimalLength);\n // validate value\n this.validateValue(this.value);\n this.validateAppendSlot();\n this.watchReadonly(this.readonly);\n this.watchDisabled(this.disabled);\n this.watchMgWidth(this.mgWidth);\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.readonlyValue}</b>\n {this.slotContent}\n </span>\n ) : (\n <b class=\"mg-c-input__readonly-value\">{this.readonlyValue}</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={[]}\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.readonlyValue && this.renderReadonly()\n : [\n <input\n key=\"input\"\n type=\"text\"\n class=\"mg-c-input__box mg-c-input__box--width\"\n value={this.displayValue()}\n id={this.identifier}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={(this.invalid === true).toString()}\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 <slot key=\"slot\" name=\"append-input\"></slot>,\n ]}\n </mg-input>\n );\n }\n}\n"],"version":3}
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { X as Xe, m as me } from './index.es.js';
2
+ import { G as Ge, y as ye } from './index.es.js';
3
3
  import { d as defineCustomElement$5, b as classReadonly, e as classDisabled, w as widths } from './mg-input2.js';
4
4
  import { i as initLocales } from './index2.js';
5
5
  import { d as defineCustomElement$7 } from './mg-button2.js';
@@ -8,7 +8,7 @@ import { d as defineCustomElement$4 } from './mg-input-title2.js';
8
8
  import { d as defineCustomElement$3 } from './mg-tooltip2.js';
9
9
  import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
10
10
 
11
- const mgInputPasswordCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--password .mg-c-input__input-icon{color:var(--mg-b-color-dark)}.mg-c-input.mg-c-input--password .mg-c-input__input-group{position:relative;flex-grow:1}.mg-c-input.mg-c-input--password .mg-c-input__append-button{position:absolute;right:0}.mg-c-input.mg-c-input--password .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-8))}.mg-c-input.mg-c-input--password .mg-c-input__box::-ms-reveal{display:none}";
11
+ const mgInputPasswordCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--password .mg-c-input__input-icon{color:var(--mg-b-color-dark)}.mg-c-input.mg-c-input--password .mg-c-input__input-group{position:relative;flex-grow:1}.mg-c-input.mg-c-input--password .mg-c-input__append-button{position:absolute;right:0}.mg-c-input.mg-c-input--password .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-8))}.mg-c-input.mg-c-input--password .mg-c-input__box::-ms-reveal{display:none}";
12
12
  const MgInputPasswordStyle0 = mgInputPasswordCss;
13
13
 
14
14
  const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword extends HTMLElement {
@@ -20,6 +20,43 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
20
20
  this.inputValid = createEvent(this, "input-valid", 7);
21
21
  // hasDisplayedError (triggered by blur event)
22
22
  this.hasDisplayedError = false;
23
+ /**
24
+ * Input name
25
+ * If not set the value equals the identifier
26
+ */
27
+ this.name = this.identifier;
28
+ /**
29
+ * Define if label is visible
30
+ */
31
+ this.labelHide = false;
32
+ /**
33
+ * Define if input is required
34
+ */
35
+ this.required = false;
36
+ /**
37
+ * Define if input is readonly
38
+ */
39
+ this.readonly = false;
40
+ /**
41
+ * Define if input is disabled
42
+ */
43
+ this.disabled = false;
44
+ /**
45
+ * Define input width
46
+ */
47
+ this.mgWidth = 'full';
48
+ /**
49
+ * Define tooltip position
50
+ */
51
+ this.tooltipPosition = 'input';
52
+ /**
53
+ * Component classes
54
+ */
55
+ this.classCollection = new Ge(['mg-c-input--password']);
56
+ /**
57
+ * Indicates if password is displayed or not
58
+ */
59
+ this.displayPassword = false;
23
60
  /**
24
61
  * Handle input event
25
62
  */
@@ -69,26 +106,6 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
69
106
  }
70
107
  }
71
108
  };
72
- this.value = undefined;
73
- this.identifier = undefined;
74
- this.name = this.identifier;
75
- this.label = undefined;
76
- this.labelOnTop = undefined;
77
- this.labelHide = false;
78
- this.placeholder = undefined;
79
- this.maxlength = undefined;
80
- this.required = false;
81
- this.readonly = false;
82
- this.disabled = false;
83
- this.mgWidth = 'full';
84
- this.tooltip = undefined;
85
- this.tooltipPosition = 'input';
86
- this.helpText = undefined;
87
- this.valid = undefined;
88
- this.invalid = undefined;
89
- this.classCollection = new Xe(['mg-c-input--password']);
90
- this.errorMessage = undefined;
91
- this.displayPassword = false;
92
109
  }
93
110
  handleValue(newValue) {
94
111
  this.valueChange.emit(newValue);
@@ -127,10 +144,21 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
127
144
  /**
128
145
  * Display input error if it exists.
129
146
  */
130
- async displayError() {
131
- this.checkValidity();
132
- this.setErrorMessage();
133
- this.hasDisplayedError = this.invalid;
147
+ displayError() {
148
+ // Use `Promise` as requested for stencil method
149
+ // Use `requestAnimationFrame` to ensure:
150
+ // - DOM is fully updated before validation
151
+ // - Async operations are completed
152
+ // - No timing issues with Stencil's render cycle
153
+ // - Keep everything in sync both inside and outside the component
154
+ return new Promise(resolve => {
155
+ requestAnimationFrame(() => {
156
+ this.checkValidity();
157
+ this.setErrorMessage();
158
+ this.hasDisplayedError = this.invalid;
159
+ resolve();
160
+ });
161
+ });
134
162
  }
135
163
  /**
136
164
  * Set an error and display a custom error message.
@@ -144,7 +172,7 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
144
172
  if (typeof valid !== 'boolean') {
145
173
  throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
146
174
  }
147
- else if (!me(errorMessage)) {
175
+ else if (!ye(errorMessage)) {
148
176
  throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
149
177
  }
150
178
  else {
@@ -201,7 +229,7 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
201
229
  * @returns HTML Element
202
230
  */
203
231
  render() {
204
- return (h("mg-input", { key: 'af313cb20a94a9c8dcf2b944c31b7ea36b2d3feb', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], 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 !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
232
+ return (h("mg-input", { key: '3c494aa50f437d261e7d006f395c5b7c3cbead5d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], 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 !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
205
233
  if (el !== null)
206
234
  this.input = el;
207
235
  } }), h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));