@mgdis/mg-components 6.16.0 → 6.18.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 (160) hide show
  1. package/dist/cjs/{index-T3-qWqFE.js → index-DCZEYvlH.js} +51 -28
  2. package/dist/cjs/{index-YM1EJx9X.js → index-TUElr4Wv.js} +10 -10
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/mg-action-more_37.cjs.entry.js +443 -228
  5. package/dist/cjs/mg-alert.cjs.entry.js +3 -3
  6. package/dist/cjs/mg-components.cjs.js +3 -3
  7. package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
  8. package/dist/cjs/mg-input-combobox.cjs.entry.js +73 -57
  9. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +36 -23
  10. package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-HYIzRsy7.js} +5 -0
  11. package/dist/cjs/mg-loader.cjs.entry.js +3 -3
  12. package/dist/cjs/mg-progress.cjs.entry.js +2 -2
  13. package/dist/collection/collection-manifest.json +2 -1
  14. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +5 -5
  15. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +7 -7
  16. package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -6
  17. package/dist/collection/components/atoms/mg-button/mg-button.js +13 -13
  18. package/dist/collection/components/atoms/mg-card/mg-card.js +2 -2
  19. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -1
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.js +32 -26
  22. package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
  23. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
  24. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -6
  25. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +4 -0
  26. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +193 -33
  27. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +7 -9
  28. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +65 -46
  29. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +106 -86
  30. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +67 -65
  31. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +71 -66
  32. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +56 -38
  33. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +53 -35
  34. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +66 -47
  35. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +58 -40
  36. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +77 -59
  37. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +63 -45
  38. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +54 -30
  39. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +2 -4
  40. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +9 -6
  41. package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +7 -7
  42. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -5
  43. package/dist/collection/components/molecules/mg-alert/mg-alert.js +5 -5
  44. package/dist/collection/components/molecules/mg-details/mg-details.js +7 -7
  45. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
  46. package/dist/collection/components/molecules/mg-form/mg-form.js +26 -17
  47. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +3 -3
  48. package/dist/collection/components/molecules/mg-loader/mg-loader.js +4 -4
  49. package/dist/collection/components/molecules/mg-message/mg-message.js +4 -4
  50. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
  51. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +7 -8
  52. package/dist/collection/components/molecules/mg-panel/mg-panel.js +53 -22
  53. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
  54. package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -7
  55. package/dist/collection/components/molecules/mg-progress/mg-progress.js +7 -7
  56. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -2
  57. package/dist/collection/components/molecules/mg-table/mg-table.js +2 -3
  58. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +7 -8
  59. package/dist/collection/locales/en/messages.json +5 -5
  60. package/dist/collection/locales/fr/messages.json +5 -5
  61. package/dist/components/index3.js +10 -10
  62. package/dist/components/mg-action-more.js +5 -3
  63. package/dist/components/mg-alert.js +5 -3
  64. package/dist/components/mg-badge2.js +4 -2
  65. package/dist/components/mg-button2.js +4 -2
  66. package/dist/components/mg-card2.js +4 -2
  67. package/dist/components/mg-character-left2.js +4 -2
  68. package/dist/components/mg-details.js +5 -3
  69. package/dist/components/mg-divider2.js +4 -2
  70. package/dist/components/mg-fieldset.d.ts +11 -0
  71. package/dist/components/mg-fieldset.js +209 -0
  72. package/dist/components/mg-form.js +8 -5
  73. package/dist/components/mg-icon2.js +29 -21
  74. package/dist/components/mg-illustrated-message.js +5 -3
  75. package/dist/components/mg-input-checkbox-paginated2.js +6 -6
  76. package/dist/components/mg-input-checkbox.js +32 -17
  77. package/dist/components/mg-input-combobox.js +75 -57
  78. package/dist/components/mg-input-date.js +39 -42
  79. package/dist/components/mg-input-numeric.js +30 -30
  80. package/dist/components/mg-input-password.js +26 -13
  81. package/dist/components/mg-input-radio.js +27 -13
  82. package/dist/components/mg-input-rich-text-editor.js +37 -22
  83. package/dist/components/mg-input-select2.js +28 -14
  84. package/dist/components/mg-input-text2.js +40 -26
  85. package/dist/components/mg-input-textarea.js +27 -14
  86. package/dist/components/mg-input-title2.js +4 -2
  87. package/dist/components/mg-input-toggle.js +39 -12
  88. package/dist/components/mg-input2.js +121 -20
  89. package/dist/components/mg-item-more2.js +13 -5
  90. package/dist/components/mg-loader2.js +5 -3
  91. package/dist/components/mg-menu-item2.js +4 -2
  92. package/dist/components/mg-message2.js +6 -4
  93. package/dist/components/mg-modal.js +6 -4
  94. package/dist/components/mg-pagination.js +4 -2
  95. package/dist/components/mg-panel.js +40 -9
  96. package/dist/components/mg-popover-content2.js +5 -3
  97. package/dist/components/mg-popover2.js +5 -3
  98. package/dist/components/mg-progress.js +5 -3
  99. package/dist/components/mg-skip-links.js +5 -3
  100. package/dist/components/mg-table.js +4 -2
  101. package/dist/components/mg-tabs2.js +5 -3
  102. package/dist/components/mg-tag.js +4 -2
  103. package/dist/components/mg-tooltip-content2.js +4 -2
  104. package/dist/components/mg-tooltip2.js +4 -2
  105. package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
  106. package/dist/esm/{index-Bab8_u8S.js → index-CNX6lq0x.js} +10 -10
  107. package/dist/esm/{index-JHj_9FSs.js → index-T6kOJXP1.js} +51 -28
  108. package/dist/esm/loader.js +3 -3
  109. package/dist/esm/mg-action-more_37.entry.js +444 -229
  110. package/dist/esm/mg-alert.entry.js +4 -4
  111. package/dist/esm/mg-components.js +4 -4
  112. package/dist/esm/mg-fieldset.entry.js +139 -0
  113. package/dist/esm/mg-input-combobox.entry.js +74 -58
  114. package/dist/esm/mg-input-rich-text-editor.entry.js +37 -24
  115. package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-D9V2v4n2.js} +5 -1
  116. package/dist/esm/mg-loader.entry.js +4 -4
  117. package/dist/esm/mg-progress.entry.js +3 -3
  118. package/dist/mg-components/locales/en/messages.json +5 -5
  119. package/dist/mg-components/locales/fr/messages.json +5 -5
  120. package/dist/mg-components/mg-components.esm.js +1 -1
  121. package/dist/mg-components/p-2bab89c2.entry.js +1 -0
  122. package/dist/mg-components/{p-658f828c.entry.js → p-5abc77cd.entry.js} +1 -1
  123. package/dist/mg-components/p-7d2e43b2.entry.js +1 -0
  124. package/dist/mg-components/{p-c85b5d10.entry.js → p-92e5e5a6.entry.js} +1 -1
  125. package/dist/mg-components/{p-42a90251.entry.js → p-952288bd.entry.js} +1 -1
  126. package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
  127. package/dist/mg-components/p-CNX6lq0x.js +1 -0
  128. package/dist/mg-components/p-D9V2v4n2.js +1 -0
  129. package/dist/mg-components/p-T6kOJXP1.js +2 -0
  130. package/dist/mg-components/p-f2cddd52.entry.js +1 -0
  131. package/dist/mg-components/{p-82455ac7.entry.js → p-f6afaeb8.entry.js} +1 -1
  132. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +1 -1
  133. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +0 -5
  134. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +5 -0
  135. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
  136. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
  137. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +4 -2
  138. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
  139. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
  140. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
  141. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
  142. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -2
  143. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
  144. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -2
  145. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -2
  146. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
  147. package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
  148. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  149. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
  150. package/dist/types/components.d.ts +168 -18
  151. package/dist/types/stencil-public-runtime.d.ts +39 -2
  152. package/dist/types/types/index.d.ts +1 -1
  153. package/ide/intellij/web-types.json +289 -181
  154. package/ide/vscode/html-custom-data.json +259 -18
  155. package/package.json +23 -23
  156. package/dist/mg-components/p-54156253.entry.js +0 -1
  157. package/dist/mg-components/p-Bab8_u8S.js +0 -1
  158. package/dist/mg-components/p-CNgv8hc5.js +0 -1
  159. package/dist/mg-components/p-JHj_9FSs.js +0 -2
  160. package/dist/mg-components/p-abbd151c.entry.js +0 -1
@@ -7,7 +7,7 @@ import { d as defineCustomElement$3 } from './mg-input-title2.js';
7
7
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
8
8
  import { d as defineCustomElement$1 } from './mg-tooltip-content2.js';
9
9
 
10
- const mgInputSelectCss = ".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.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*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);overflow-wrap:anywhere}.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}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
10
+ const mgInputSelectCss = ".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.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*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);overflow-wrap:anywhere}.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}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__box{max-width:100%;padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
11
11
 
12
12
  /**
13
13
  * Check if item is a well configured option
@@ -52,14 +52,17 @@ const groupOptions = (acc, { group, title, value, disabled }) => {
52
52
  return acc;
53
53
  };
54
54
  const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect extends HTMLElement {
55
- constructor() {
55
+ constructor(registerHost) {
56
56
  super();
57
- this.__registerHost();
57
+ if (registerHost !== false) {
58
+ this.__registerHost();
59
+ }
58
60
  this.__attachShadow();
59
61
  this.valueChange = createEvent(this, "value-change", 7);
60
62
  this.inputValid = createEvent(this, "input-valid", 7);
61
63
  // hasDisplayedError (triggered by blur event)
62
64
  this.hasDisplayedError = false;
65
+ this.customErrorMessage = { lock: false };
63
66
  /**
64
67
  * Input name
65
68
  * If not set the value equals the identifier
@@ -168,15 +171,17 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
168
171
  };
169
172
  /**
170
173
  * Set input error message
171
- * @param errorMessage - errorMessage override
174
+ * @param fromSetErrorContext - context come from `setError` method
172
175
  */
173
- this.setErrorMessage = (errorMessage) => {
176
+ this.setErrorMessage = (fromSetErrorContext = false) => {
174
177
  // Set error message
175
178
  this.errorMessage = undefined;
176
179
  if (!this.valid) {
177
- if (errorMessage !== undefined) {
178
- this.errorMessage = errorMessage;
180
+ // Does have a new custom error message OR does have a custom error message locked
181
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
182
+ this.errorMessage = this.customErrorMessage.message;
179
183
  }
184
+ // required
180
185
  else if (this.input.validity.valueMissing) {
181
186
  this.errorMessage = this.messages.errors.required;
182
187
  }
@@ -290,17 +295,22 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
290
295
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
291
296
  * @param valid - value indicating the validity
292
297
  * @param errorMessage - the error message to display
298
+ * @param errorMessageLock - lock the error message and validity state
293
299
  */
294
- async setError(valid, errorMessage) {
300
+ async setError(valid, errorMessage, errorMessageLock = false) {
295
301
  if (typeof valid !== 'boolean') {
296
302
  throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean.');
297
303
  }
298
- else if (!isValidString(errorMessage)) {
304
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
299
305
  throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string.');
300
306
  }
301
307
  else {
308
+ this.customErrorMessage = {
309
+ lock: valid ? false : errorMessageLock,
310
+ message: valid ? undefined : errorMessage,
311
+ };
302
312
  this.setValidity(valid);
303
- this.setErrorMessage(valid ? undefined : errorMessage);
313
+ this.setErrorMessage(true);
304
314
  this.hasDisplayedError = this.invalid;
305
315
  }
306
316
  }
@@ -318,6 +328,8 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
318
328
  // - Keep everything in sync both inside and outside the component
319
329
  return new Promise(resolve => {
320
330
  requestAnimationFrame(() => {
331
+ // unlock validity check by reseting customErrorMessage
332
+ this.customErrorMessage = { lock: false };
321
333
  this.checkValidity();
322
334
  this.errorMessage = undefined;
323
335
  this.hasDisplayedError = false;
@@ -331,11 +343,13 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
331
343
  * @param newValue - valid new value
332
344
  */
333
345
  setValidity(newValue) {
334
- const oldValidValue = this.valid;
335
- this.valid = newValue;
346
+ const oldValue = this.valid;
347
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
348
+ this.valid = newValue;
349
+ }
336
350
  this.invalid = !this.valid;
337
351
  // We need to send valid event even if it is the same value
338
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue)) {
352
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue)) {
339
353
  this.inputValid.emit(this.valid);
340
354
  }
341
355
  }
@@ -372,7 +386,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
372
386
  */
373
387
  render() {
374
388
  const readonlyValue = this.getReadonlyValue();
375
- return (h("mg-input", { key: '1394827503d3f2dd71efc6efa389ac707573d2ec', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
389
+ return (h("mg-input", { key: '928c7d4ebccfe38ae86630d2cb8c06f07ca09a8a', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
376
390
  if (el !== null)
377
391
  this.input = el;
378
392
  } }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
@@ -31,9 +31,11 @@ const isOption = (option) => typeof option === 'object' && typeof option.title =
31
31
  */
32
32
  const isDatalistOptions = (options) => allItemsAreString(options) || (Array.isArray(options) && options.every(isOption));
33
33
  const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends HTMLElement {
34
- constructor() {
34
+ constructor(registerHost) {
35
35
  super();
36
- this.__registerHost();
36
+ if (registerHost !== false) {
37
+ this.__registerHost();
38
+ }
37
39
  this.__attachShadow();
38
40
  this.valueChange = createEvent(this, "value-change", 7);
39
41
  this.inputValid = createEvent(this, "input-valid", 7);
@@ -48,6 +50,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
48
50
  this.classIsAppendInputSlotContent = 'mg-c-input--is-append-input-slot-content';
49
51
  // hasDisplayedError (triggered by blur event)
50
52
  this.hasDisplayedError = false;
53
+ this.customErrorMessage = { lock: false };
51
54
  /**
52
55
  * Input name
53
56
  * If not set the value equals the identifier
@@ -146,27 +149,29 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
146
149
  };
147
150
  /**
148
151
  * Set input error message
149
- * @param errorMessage - errorMessage override
152
+ * @param fromSetErrorContext - context come from `setError` method
150
153
  */
151
- this.setErrorMessage = (errorMessage) => {
154
+ this.setErrorMessage = (fromSetErrorContext = false) => {
152
155
  var _a;
153
156
  // Set error message
154
157
  this.errorMessage = undefined;
155
- // Does have a custom error message
156
- if (!this.valid && errorMessage !== undefined) {
157
- this.errorMessage = errorMessage;
158
- }
159
- // Does not match type (email, emails, tel, url, etc.)
160
- else if (!this.valid && this.input.validity.typeMismatch) {
161
- this.errorMessage = this.messages.input.text.errors.typeMismatch[this.type];
162
- }
163
- // Does not match pattern
164
- else if (!this.valid && this.input.validity.patternMismatch) {
165
- this.errorMessage = (_a = this.patternErrorMessage) !== null && _a !== void 0 ? _a : this.messages.input.text.errors.typeMismatch[this.type];
166
- }
167
- // required
168
- else if (!this.valid && this.input.validity.valueMissing) {
169
- this.errorMessage = this.messages.errors.required;
158
+ if (!this.valid) {
159
+ // Does have a new custom error message OR does have a custom error message locked
160
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
161
+ this.errorMessage = this.customErrorMessage.message;
162
+ }
163
+ // Does not match type (email, emails, tel, url, etc.)
164
+ else if (this.input.validity.typeMismatch) {
165
+ this.errorMessage = this.messages.input.text.errors.typeMismatch[this.type];
166
+ }
167
+ // Does not match pattern
168
+ else if (this.input.validity.patternMismatch) {
169
+ this.errorMessage = (_a = this.patternErrorMessage) !== null && _a !== void 0 ? _a : this.messages.input.text.errors.typeMismatch[this.type];
170
+ }
171
+ // required
172
+ else if (this.input.validity.valueMissing) {
173
+ this.errorMessage = this.messages.errors.required;
174
+ }
170
175
  }
171
176
  };
172
177
  /**
@@ -300,17 +305,22 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
300
305
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
301
306
  * @param valid - value indicating the validity
302
307
  * @param errorMessage - the error message to display
308
+ * @param errorMessageLock - lock the error message and validity state
303
309
  */
304
- async setError(valid, errorMessage) {
310
+ async setError(valid, errorMessage, errorMessageLock = false) {
305
311
  if (typeof valid !== 'boolean') {
306
312
  throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean.');
307
313
  }
308
- else if (!isValidString(errorMessage)) {
314
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
309
315
  throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string.');
310
316
  }
311
317
  else {
318
+ this.customErrorMessage = {
319
+ lock: valid ? false : errorMessageLock,
320
+ message: valid ? undefined : errorMessage,
321
+ };
312
322
  this.setValidity(valid);
313
- this.setErrorMessage(valid ? undefined : errorMessage);
323
+ this.setErrorMessage(true);
314
324
  this.hasDisplayedError = this.invalid;
315
325
  }
316
326
  }
@@ -328,6 +338,8 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
328
338
  // - Keep everything in sync both inside and outside the component
329
339
  return new Promise(resolve => {
330
340
  requestAnimationFrame(() => {
341
+ // unlock validity check by reseting customErrorMessage
342
+ this.customErrorMessage = { lock: false };
331
343
  this.checkValidity();
332
344
  this.errorMessage = undefined;
333
345
  this.hasDisplayedError = false;
@@ -341,11 +353,13 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
341
353
  * @param newValue - valid new value
342
354
  */
343
355
  setValidity(newValue) {
344
- const oldValidValue = this.valid;
345
- this.valid = newValue;
356
+ const oldValue = this.valid;
357
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
358
+ this.valid = newValue;
359
+ }
346
360
  this.invalid = !this.valid;
347
361
  // We need to send valid event even if it is the same value
348
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
362
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
349
363
  this.inputValid.emit(this.valid);
350
364
  }
351
365
  /*************
@@ -382,7 +396,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
382
396
  * @returns HTML Element
383
397
  */
384
398
  render() {
385
- return (h("mg-input", { key: '8b9ffd8f5546fe9ffe0e7054e794afa06de4189f', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
399
+ return (h("mg-input", { key: '69e40a90a6e4be8aa1eb3ac1b53acfe899c20453', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
386
400
  ? this.value && this.renderReadonly()
387
401
  : [
388
402
  h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
@@ -11,9 +11,11 @@ import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
11
11
  const mgInputTextareaCss = ".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.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.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-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);overflow-wrap:anywhere}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__error ::slotted(*){margin-top:0}.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}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__input{align-items:start}.mg-c-input__box{display:block;height:auto;resize:none}.mg-c-input__box.mg-c-input__box--resizable{resize:both}.mg-c-input__box.mg-c-input__box--resizable-horizontal{resize:horizontal}.mg-c-input__box.mg-c-input__box--resizable-vertical{resize:vertical}.mg-c-input__readonly-value{white-space:pre-line}.mg-c-input__with-character-left{flex-grow:1}.mg-c-input__with-character-left mg-character-left{display:block;text-align:end;visibility:hidden}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-c-input__box{overflow-x:hidden}}";
12
12
 
13
13
  const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea extends HTMLElement {
14
- constructor() {
14
+ constructor(registerHost) {
15
15
  super();
16
- this.__registerHost();
16
+ if (registerHost !== false) {
17
+ this.__registerHost();
18
+ }
17
19
  this.__attachShadow();
18
20
  this.valueChange = createEvent(this, "value-change", 7);
19
21
  this.inputValid = createEvent(this, "input-valid", 7);
@@ -25,6 +27,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
25
27
  this.classDisplayCharacterLeft = 'mg-c-input--display-character-left';
26
28
  // hasDisplayedError (triggered by blur event)
27
29
  this.hasDisplayedError = false;
30
+ this.customErrorMessage = { lock: false };
28
31
  /**
29
32
  * Input name
30
33
  * If not set the value equals the identifier
@@ -123,15 +126,16 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
123
126
  };
124
127
  /**
125
128
  * Set input error message
126
- * @param errorMessage - errorMessage override
129
+ * @param fromSetErrorContext - context come from `setError` method
127
130
  */
128
- this.setErrorMessage = (errorMessage) => {
131
+ this.setErrorMessage = (fromSetErrorContext = false) => {
129
132
  // Set error message
130
133
  this.errorMessage = undefined;
131
- // Does not match pattern
134
+ // Does have a new custom error message
132
135
  if (!this.valid) {
133
- if (errorMessage !== undefined) {
134
- this.errorMessage = errorMessage;
136
+ // Does have a new custom error message OR does have a custom error message locked
137
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
138
+ this.errorMessage = this.customErrorMessage.message;
135
139
  }
136
140
  else if (!this.getPatternValidity()) {
137
141
  this.errorMessage = this.patternErrorMessage;
@@ -224,17 +228,22 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
224
228
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
225
229
  * @param valid - value indicating the validity
226
230
  * @param errorMessage - the error message to display
231
+ * @param errorMessageLock - lock the error message and validity state
227
232
  */
228
- async setError(valid, errorMessage) {
233
+ async setError(valid, errorMessage, errorMessageLock = false) {
229
234
  if (typeof valid !== 'boolean') {
230
235
  throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean.');
231
236
  }
232
- else if (!isValidString(errorMessage)) {
237
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
233
238
  throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string.');
234
239
  }
235
240
  else {
241
+ this.customErrorMessage = {
242
+ lock: valid ? false : errorMessageLock,
243
+ message: valid ? undefined : errorMessage,
244
+ };
236
245
  this.setValidity(valid);
237
- this.setErrorMessage(valid ? undefined : errorMessage);
246
+ this.setErrorMessage(true);
238
247
  this.hasDisplayedError = this.invalid;
239
248
  }
240
249
  }
@@ -252,6 +261,8 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
252
261
  // - Keep everything in sync both inside and outside the component
253
262
  return new Promise(resolve => {
254
263
  requestAnimationFrame(() => {
264
+ // unlock validity check by reseting customErrorMessage
265
+ this.customErrorMessage = { lock: false };
255
266
  this.checkValidity();
256
267
  this.errorMessage = undefined;
257
268
  this.hasDisplayedError = false;
@@ -265,11 +276,13 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
265
276
  * @param newValue - valid new value
266
277
  */
267
278
  setValidity(newValue) {
268
- const oldValidValue = this.valid;
269
- this.valid = newValue;
279
+ const oldValue = this.valid;
280
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
281
+ this.valid = newValue;
282
+ }
270
283
  this.invalid = !this.valid;
271
284
  // We need to send valid event even if it is the same value
272
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
285
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
273
286
  this.inputValid.emit(this.valid);
274
287
  }
275
288
  /*************
@@ -302,7 +315,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
302
315
  * @returns HTML Element
303
316
  */
304
317
  render() {
305
- return (h("mg-input", { key: 'e87320fe4d3c2c857751ddcc30fab470956b4ed2', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
318
+ return (h("mg-input", { key: '9b58ccb9f0b150f5de8cc9f895f4cdea2bbbeecd', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
306
319
  'mg-c-input__box': true,
307
320
  'mg-c-input__box--width': true,
308
321
  'mg-c-input__box--resizable': this.resizable === 'both',
@@ -4,9 +4,11 @@ import { i as isValidString, a as isValideID, t as toString } from './index2.js'
4
4
  const mgInputTitleCss = ".mg-u-form-legacy.sc-mg-input-title{--mg-c-form-inputs-title-width:calc(100% / 3 - 20px)}.mg-u-is-asterisk.sc-mg-input-title{color:var(--mg-b-color-danger)}legend.mg-c-input-title.sc-mg-input-title{padding-right:0;padding-left:0}.mg-c-input-title__required.sc-mg-input-title{display:var(--mg-c-input-title-display, unset)}";
5
5
 
6
6
  const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class MgInputTitle extends HTMLElement {
7
- constructor() {
7
+ constructor(registerHost) {
8
8
  super();
9
- this.__registerHost();
9
+ if (registerHost !== false) {
10
+ this.__registerHost();
11
+ }
10
12
  /**
11
13
  * Switch from label to fieldset sementic
12
14
  */
@@ -6,7 +6,7 @@ import { d as defineCustomElement$4 } from './mg-input-title2.js';
6
6
  import { d as defineCustomElement$3 } from './mg-tooltip2.js';
7
7
  import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
8
8
 
9
- const mgInputToggleCss = ".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);overflow-wrap:anywhere}.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}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__toggle-item-container{overflow:hidden;box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border:0;border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4))/var(--mg-c-input-toggle-border-radius-ratio));background-color:unset;color:var(--mg-b-color-dark);font-weight:unset;text-overflow:ellipsis;white-space:nowrap}.mg-c-input__toggle-item-container:first-of-type{background-color:color-mix(in srgb, var(--mg-b-color-app), white 80%);color:var(--mg-b-color-app);font-weight:600}.mg-c-input__button-toggle{display:flex;min-width:0;padding:var(--mg-b-size-4);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*(var(--mg-b-size-4) + var(--mg-b-size-4) + var(--mg-c-input-border-width)))/var(--mg-c-input-toggle-border-radius-ratio));background-color:var(--mg-b-color-light);cursor:pointer;font-family:var(--mg-b-font-family);font-size:inherit;line-height:inherit}.mg-c-input__button-toggle:disabled{cursor:default}.mg-c-input.mg-c-input--toggle .mg-c-input__input-container{min-width:0;flex:auto}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{background-color:unset;color:var(--mg-b-color-dark);font-weight:unset}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{background-color:color-mix(in srgb, var(--mg-b-color-app), white 80%);color:var(--mg-b-color-info);font-weight:600}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container{display:flex;width:calc(var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4));height:calc(var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4));align-items:center;justify-content:center;padding:0;visibility:hidden}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:first-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{visibility:hidden}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-on-off .mg-c-input__toggle-item-container:first-of-type{background-color:var(--mg-b-color-neutral-30);color:var(--mg-b-color-dark);font-weight:600}.mg-c-input.mg-c-input--toggle-on-off.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{background-color:unset;color:var(--mg-b-color-dark);font-weight:unset}";
9
+ const mgInputToggleCss = ".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);overflow-wrap:anywhere}.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}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__toggle-item-container{overflow:hidden;box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-width:var(--mg-b-size-border);border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4))/var(--mg-c-input-toggle-border-radius-ratio));color:var(--mg-b-color-neutral-110);font-weight:unset;text-overflow:ellipsis;white-space:nowrap}.mg-c-input__toggle-item-container:first-of-type{border-style:solid;border-color:var(--mg-b-color-neutral-80);background-color:var(--mg-b-color-light);font-weight:600}.mg-c-input__button-toggle{display:flex;overflow:hidden;min-width:0;align-items:center;padding:.1rem;border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-b-color-neutral-80);border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*(var(--mg-b-size-4) + var(--mg-b-size-4) + var(--mg-c-input-border-width)))/var(--mg-c-input-toggle-border-radius-ratio));background-color:var(--mg-b-color-neutral-20);cursor:pointer;font-family:var(--mg-b-font-family);font-size:var(--mg-b-small-font-size);line-height:var(--mg-b-size-12)}.mg-c-input__button-toggle:disabled{cursor:default}.mg-c-input__button-toggle:focus{outline-offset:var(--mg-b-size-4)}.mg-c-input.mg-c-input--toggle:not(.mg-c-input--readonly) .mg-c-input__button-toggle{margin-top:var(--mg-b-size-4)}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__button-toggle{background-color:var(--mg-b-color-neutral-110)}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{border:unset;background-color:unset;color:var(--mg-b-color-light);font-weight:unset}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{border-style:solid;background-color:var(--mg-b-color-neutral-20);font-weight:600}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__button-toggle{width:100%;min-width:calc(var(--mg-b-size-20)*2);max-width:calc(var(--mg-b-size-20)*2)}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container{display:flex;overflow:unset;min-width:var(--mg-b-size-20);max-width:var(--mg-b-size-20);height:var(--mg-b-size-20);align-items:center;justify-content:center;padding:0;visibility:hidden}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:first-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:last-of-type{width:unset}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{min-width:unset;visibility:hidden}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{margin-left:auto;visibility:visible}.mg-c-input.mg-c-input--toggle-on-off.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:first-of-type ::slotted(*){display:none}";
10
10
 
11
11
  /**
12
12
  * type Option validation function
@@ -15,9 +15,11 @@ const mgInputToggleCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font
15
15
  */
16
16
  const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
17
17
  const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle extends HTMLElement {
18
- constructor() {
18
+ constructor(registerHost) {
19
19
  super();
20
- this.__registerHost();
20
+ if (registerHost !== false) {
21
+ this.__registerHost();
22
+ }
21
23
  this.__attachShadow();
22
24
  this.valueChange = createEvent(this, "value-change", 7);
23
25
  this.inputValid = createEvent(this, "input-valid", 7);
@@ -39,7 +41,9 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
39
41
  */
40
42
  this.labelHide = false;
41
43
  /**
42
- * Define if toggle have on/off style
44
+ * Define if toggle have on/off style,
45
+ * the left icon is hidden.
46
+ * Only available in combination with the "isIcon" prop.
43
47
  */
44
48
  this.isOnOff = false;
45
49
  /**
@@ -74,7 +78,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
74
78
  // Set error message
75
79
  this.errorMessage = undefined;
76
80
  // Does have a custom error message
77
- if (!this.valid && errorMessage !== undefined) {
81
+ if (!this.valid && typeof errorMessage === 'string') {
78
82
  this.errorMessage = errorMessage;
79
83
  }
80
84
  };
@@ -89,14 +93,31 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
89
93
  */
90
94
  this.validateSlots = () => {
91
95
  const slots = Array.from(this.element.children);
96
+ // validate slots
92
97
  if (slots.length !== 2) {
93
- throw new Error('<mg-input-toggle> 2 slots are required.');
98
+ if (this.isOnOff && this.isIcon) {
99
+ // ONLY slot="item-2" is required in with isOnOff && isIcon
100
+ if (this.element.querySelector('[slot="item-2"]') === null) {
101
+ throw new Error('<mg-input-toggle> an element with attribute slot="item-2" is required.');
102
+ }
103
+ }
104
+ else {
105
+ throw new Error('<mg-input-toggle> 2 slots are required.');
106
+ }
94
107
  }
95
- else if (!this.isIcon) {
108
+ // update slots
109
+ if (!this.isIcon) {
96
110
  // Due to text-overflow set to ellipsis
97
111
  // we need to ensure that slot element have title to display value on mouse over
98
112
  slots.forEach(slot => slot.setAttribute('title', slot.textContent));
99
113
  }
114
+ else {
115
+ slots.forEach(slot => {
116
+ if (slot.nodeName === 'MG-ICON') {
117
+ slot.size = 'small';
118
+ }
119
+ });
120
+ }
100
121
  };
101
122
  /**
102
123
  * Get checked item
@@ -137,10 +158,16 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
137
158
  }
138
159
  }
139
160
  watchIsOnOff(newValue) {
140
- if (newValue)
161
+ if (newValue) {
141
162
  this.classCollection.add(this.classOnOff);
142
- else
163
+ if (!this.isIcon) {
164
+ this.isOnOff = false;
165
+ console.warn('<mg-input-toggle> prop "isOnOff" must be used with "isIcon". Setting isOnOff to false.');
166
+ }
167
+ }
168
+ else {
143
169
  this.classCollection.delete(this.classOnOff);
170
+ }
144
171
  }
145
172
  watchIsIcon(newValue) {
146
173
  if (newValue)
@@ -188,7 +215,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
188
215
  if (typeof valid !== 'boolean') {
189
216
  throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
190
217
  }
191
- else if (!isValidString(errorMessage)) {
218
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
192
219
  throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
193
220
  }
194
221
  else {
@@ -265,7 +292,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
265
292
  */
266
293
  render() {
267
294
  const checkedItem = this.getCheckedItem(this.checked);
268
- return (h("mg-input", { key: '7611cffaf1c01e30c3fa7a27555f94ab357dd374', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked, ref: el => {
295
+ return (h("mg-input", { key: '4d87ed13bbd3d3a54303c21001247e1251417326', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked, ref: el => {
269
296
  if (el !== null)
270
297
  this.button = el;
271
298
  } }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
@@ -289,7 +316,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
289
316
  "label": [1],
290
317
  "labelOnTop": [4, "label-on-top"],
291
318
  "labelHide": [4, "label-hide"],
292
- "isOnOff": [4, "is-on-off"],
319
+ "isOnOff": [1028, "is-on-off"],
293
320
  "isIcon": [4, "is-icon"],
294
321
  "readonly": [4],
295
322
  "disabled": [4],