@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
@@ -16,14 +16,17 @@ const formats = ['none', 'number', 'currency', 'percent', 'unit'];
16
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.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 .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
17
17
 
18
18
  const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric extends HTMLElement {
19
- constructor() {
19
+ constructor(registerHost) {
20
20
  super();
21
- this.__registerHost();
21
+ if (registerHost !== false) {
22
+ this.__registerHost();
23
+ }
22
24
  this.__attachShadow();
23
25
  this.valueChange = createEvent(this, "value-change", 7);
24
26
  this.inputValid = createEvent(this, "input-valid", 7);
25
27
  // hasDisplayedError (triggered by blur event)
26
28
  this.hasDisplayedError = false;
29
+ this.customErrorMessage = { lock: false };
27
30
  /**
28
31
  * Input name
29
32
  * If not set the value equals the identifier
@@ -129,23 +132,26 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
129
132
  this.formatErrorValue = (value) => localeNumber(value, this.locale, !Number.isInteger(value) && this.type === 'decimal' ? this.decimalLength : 0);
130
133
  /**
131
134
  * Set input error message
132
- * @param errorMessage - errorMessage override
135
+ * @param fromSetErrorContext - context come from `setError` method
133
136
  */
134
- this.setErrorMessage = (errorMessage) => {
137
+ this.setErrorMessage = (fromSetErrorContext = false) => {
135
138
  // Set error message
136
139
  this.errorMessage = undefined;
137
140
  if (!this.valid) {
138
141
  const inputError = this.getInputError();
139
- if (errorMessage !== undefined) {
140
- this.errorMessage = errorMessage;
142
+ // Does have a new custom error message OR does have a custom error message locked
143
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
144
+ this.errorMessage = this.customErrorMessage.message;
141
145
  }
146
+ // required
142
147
  else if (inputError === 'required') {
143
148
  this.errorMessage = this.messages.errors[inputError];
144
149
  }
150
+ // min/max
145
151
  else {
146
152
  const formattedMin = this.formatErrorValue(this.min);
147
153
  const formattedMax = this.formatErrorValue(this.max);
148
- this.errorMessage = this.messages.input.numeric.helpText[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
154
+ this.errorMessage = this.messages.input.numeric.error[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
149
155
  }
150
156
  }
151
157
  };
@@ -224,23 +230,8 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
224
230
  if (this.min === undefined && this.max === undefined && text === undefined) {
225
231
  return undefined;
226
232
  }
227
- // Generate range message based on available constraints
228
- let rangeMessage;
229
- if (this.min !== undefined && this.max !== undefined) {
230
- rangeMessage = this.messages.input.numeric.helpText.minMax.replace('{min}', this.formatErrorValue(this.min)).replace('{max}', this.formatErrorValue(this.max));
231
- }
232
- else if (this.min !== undefined) {
233
- rangeMessage = this.messages.input.numeric.helpText.min.replace('{min}', this.formatErrorValue(this.min));
234
- }
235
- else if (this.max !== undefined) {
236
- rangeMessage = this.messages.input.numeric.helpText.max.replace('{max}', this.formatErrorValue(this.max));
237
- }
238
- // Combine custom helpText with range message if both exist
239
- if (text !== undefined && rangeMessage !== undefined) {
240
- return `${text}<br>${rangeMessage}`;
241
- }
242
233
  // Return either custom helpText or range message
243
- return text || rangeMessage;
234
+ return text;
244
235
  };
245
236
  /**
246
237
  * Renders the readonly content of the input component.
@@ -358,17 +349,22 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
358
349
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
359
350
  * @param valid - value indicating the validity
360
351
  * @param errorMessage - the error message to display
352
+ * @param errorMessageLock - lock the error message and validity state
361
353
  */
362
- async setError(valid, errorMessage) {
354
+ async setError(valid, errorMessage, errorMessageLock = false) {
363
355
  if (typeof valid !== 'boolean') {
364
356
  throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
365
357
  }
366
- else if (!isValidString(errorMessage)) {
358
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
367
359
  throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
368
360
  }
369
361
  else {
362
+ this.customErrorMessage = {
363
+ lock: valid ? false : errorMessageLock,
364
+ message: valid ? undefined : errorMessage,
365
+ };
370
366
  this.setValidity(valid);
371
- this.setErrorMessage(valid ? undefined : errorMessage);
367
+ this.setErrorMessage(true);
372
368
  this.hasDisplayedError = this.invalid;
373
369
  }
374
370
  }
@@ -386,6 +382,8 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
386
382
  // - Keep everything in sync both inside and outside the component
387
383
  return new Promise(resolve => {
388
384
  requestAnimationFrame(() => {
385
+ // unlock validity check by reseting customErrorMessage
386
+ this.customErrorMessage = { lock: false };
389
387
  this.checkValidity();
390
388
  this.errorMessage = undefined;
391
389
  this.hasDisplayedError = false;
@@ -399,11 +397,13 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
399
397
  * @param newValue - valid new value
400
398
  */
401
399
  setValidity(newValue) {
402
- const oldValidValue = this.valid;
403
- this.valid = newValue;
400
+ const oldValue = this.valid;
401
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
402
+ this.valid = newValue;
403
+ }
404
404
  this.invalid = !this.valid;
405
405
  // We need to send valid event even if it is the same value
406
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
406
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
407
407
  this.inputValid.emit(this.valid);
408
408
  }
409
409
  /**
@@ -475,7 +475,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
475
475
  * @returns HTML Element
476
476
  */
477
477
  render() {
478
- return (h("mg-input", { key: 'ca551b49b1b4dc98fd4e943e51de8a32bc78882b', 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 && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly
478
+ return (h("mg-input", { key: 'c47f7c310587fc3bb4e7d5ffd07854a2297958df', 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 && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly
479
479
  ? this.readonlyValue && this.renderReadonly()
480
480
  : [
481
481
  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, autocomplete: "off", "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
@@ -11,14 +11,17 @@ import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
11
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.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.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
 
13
13
  const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword 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);
20
22
  // hasDisplayedError (triggered by blur event)
21
23
  this.hasDisplayedError = false;
24
+ this.customErrorMessage = { lock: false };
22
25
  /**
23
26
  * Input name
24
27
  * If not set the value equals the identifier
@@ -94,14 +97,15 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
94
97
  };
95
98
  /**
96
99
  * Set input error message
97
- * @param errorMessage - errorMessage override
100
+ * @param fromSetErrorContext - context come from `setError` method
98
101
  */
99
- this.setErrorMessage = (errorMessage) => {
102
+ this.setErrorMessage = (fromSetErrorContext = false) => {
100
103
  // Set error message
101
104
  this.errorMessage = undefined;
102
105
  if (!this.valid) {
103
- if (errorMessage !== undefined) {
104
- this.errorMessage = errorMessage;
106
+ // Does have a new custom error message OR does have a custom error message locked
107
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
108
+ this.errorMessage = this.customErrorMessage.message;
105
109
  }
106
110
  // required
107
111
  else if (this.input.validity.valueMissing) {
@@ -177,17 +181,22 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
177
181
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
178
182
  * @param valid - value indicating the validity
179
183
  * @param errorMessage - the error message to display
184
+ * @param errorMessageLock - lock the error message and validity state
180
185
  */
181
- async setError(valid, errorMessage) {
186
+ async setError(valid, errorMessage, errorMessageLock = false) {
182
187
  if (typeof valid !== 'boolean') {
183
188
  throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
184
189
  }
185
- else if (!isValidString(errorMessage)) {
190
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
186
191
  throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
187
192
  }
188
193
  else {
194
+ this.customErrorMessage = {
195
+ lock: valid ? false : errorMessageLock,
196
+ message: valid ? undefined : errorMessage,
197
+ };
189
198
  this.setValidity(valid);
190
- this.setErrorMessage(valid ? undefined : errorMessage);
199
+ this.setErrorMessage(true);
191
200
  this.hasDisplayedError = this.invalid;
192
201
  }
193
202
  }
@@ -205,6 +214,8 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
205
214
  // - Keep everything in sync both inside and outside the component
206
215
  return new Promise(resolve => {
207
216
  requestAnimationFrame(() => {
217
+ // unlock validity check by reseting customErrorMessage
218
+ this.customErrorMessage = { lock: false };
208
219
  this.checkValidity();
209
220
  this.errorMessage = undefined;
210
221
  this.hasDisplayedError = false;
@@ -218,11 +229,13 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
218
229
  * @param newValue - valid new value
219
230
  */
220
231
  setValidity(newValue) {
221
- const oldValidValue = this.valid;
222
- this.valid = newValue;
232
+ const oldValue = this.valid;
233
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
234
+ this.valid = newValue;
235
+ }
223
236
  this.invalid = !this.valid;
224
237
  // We need to send valid event even if it is the same value
225
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
238
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
226
239
  this.inputValid.emit(this.valid);
227
240
  }
228
241
  /*************
@@ -250,7 +263,7 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
250
263
  * @returns HTML Element
251
264
  */
252
265
  render() {
253
- return (h("mg-input", { key: '4bdaa6d26811f66fa43b580ac6e85c61b308ee92', 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 && 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) => {
266
+ return (h("mg-input", { key: '845c075a44c50043776b7577642254d772629eef', 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 && 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) => {
254
267
  if (el !== null)
255
268
  this.input = el;
256
269
  } }), 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' }))))));
@@ -16,9 +16,11 @@ const mgInputRadioCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-
16
16
  */
17
17
  const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
18
18
  const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio extends HTMLElement {
19
- constructor() {
19
+ constructor(registerHost) {
20
20
  super();
21
- this.__registerHost();
21
+ if (registerHost !== false) {
22
+ this.__registerHost();
23
+ }
22
24
  this.__attachShadow();
23
25
  this.valueChange = createEvent(this, "value-change", 7);
24
26
  this.inputValid = createEvent(this, "input-valid", 7);
@@ -31,6 +33,7 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
31
33
  this.classVerticalList = 'mg-c-input--vertical-list';
32
34
  // hasDisplayedError (triggered by blur event)
33
35
  this.hasDisplayedError = false;
36
+ this.customErrorMessage = { lock: false };
34
37
  /**
35
38
  * Input name
36
39
  * If not set the value equals the identifier
@@ -94,16 +97,18 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
94
97
  };
95
98
  /**
96
99
  * Set input error message
97
- * @param errorMessage - errorMessage override
100
+ * @param fromSetErrorContext - context come from `setError` method
98
101
  */
99
- this.setErrorMessage = (errorMessage) => {
102
+ this.setErrorMessage = (fromSetErrorContext = false) => {
100
103
  const invalidElement = this.getInvalidElement();
101
104
  // Set error message
102
105
  this.errorMessage = undefined;
103
106
  if (!this.valid) {
104
- if (errorMessage !== undefined) {
105
- this.errorMessage = errorMessage;
107
+ // Does have a new custom error message OR does have a custom error message locked
108
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
109
+ this.errorMessage = this.customErrorMessage.message;
106
110
  }
111
+ // required
107
112
  else if (invalidElement.validity.valueMissing) {
108
113
  this.errorMessage = this.messages.errors.required;
109
114
  }
@@ -208,17 +213,22 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
208
213
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
209
214
  * @param valid - value indicating the validity
210
215
  * @param errorMessage - the error message to display
216
+ * @param errorMessageLock - lock the error message and validity state
211
217
  */
212
- async setError(valid, errorMessage) {
218
+ async setError(valid, errorMessage, errorMessageLock = false) {
213
219
  if (typeof valid !== 'boolean') {
214
220
  throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');
215
221
  }
216
- else if (!isValidString(errorMessage)) {
222
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
217
223
  throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');
218
224
  }
219
225
  else {
226
+ this.customErrorMessage = {
227
+ lock: valid ? false : errorMessageLock,
228
+ message: valid ? undefined : errorMessage,
229
+ };
220
230
  this.setValidity(valid);
221
- this.setErrorMessage(valid ? undefined : errorMessage);
231
+ this.setErrorMessage(true);
222
232
  this.hasDisplayedError = this.invalid;
223
233
  }
224
234
  }
@@ -236,6 +246,8 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
236
246
  // - Keep everything in sync both inside and outside the component
237
247
  return new Promise(resolve => {
238
248
  requestAnimationFrame(() => {
249
+ // unlock validity check by reseting customErrorMessage
250
+ this.customErrorMessage = { lock: false };
239
251
  this.checkValidity();
240
252
  this.errorMessage = undefined;
241
253
  this.hasDisplayedError = false;
@@ -249,11 +261,13 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
249
261
  * @param newValue - valid new value
250
262
  */
251
263
  setValidity(newValue) {
252
- const oldValidValue = this.valid;
253
- this.valid = newValue;
264
+ const oldValue = this.valid;
265
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
266
+ this.valid = newValue;
267
+ }
254
268
  this.invalid = !this.valid;
255
269
  // We need to send valid event even if it is the same value
256
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
270
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
257
271
  this.inputValid.emit(this.valid);
258
272
  }
259
273
  /*************
@@ -284,7 +298,7 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
284
298
  * @returns HTML Element
285
299
  */
286
300
  render() {
287
- return (h("mg-input", { key: '048aa732e7f8593701c9397e571b97584bc5e37b', 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 && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
301
+ return (h("mg-input", { key: '9290ab8e5048dd6806985ab55d13bd8b0dd93bd1', 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 && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
288
302
  if (el !== null)
289
303
  this.inputs[index] = el;
290
304
  } }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
@@ -16382,17 +16382,20 @@ const quillSnowCss = "/*!\n * Quill Editor v2.0.3\n * https://quilljs.com\n * Co
16382
16382
 
16383
16383
  const editorScss = quillSnowCss + "";
16384
16384
 
16385
- const mgInputRichTextEditorCss = ".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__wrapper{display:flex;width:100%;flex-direction:column;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)}.mg-c-input__wrapper:focus-within{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus);outline:Highlight auto .1rem;outline:-webkit-focus-ring-color auto .1rem}.mg-c-input--has-error .mg-c-input__wrapper{border-color:var(--mg-b-color-danger)}.mg-c-input--disabled .mg-c-input__wrapper{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input--rich-text-editor .mg-c-input__readonly-value p{margin:0}.mg-c-input--rich-text-editor .mg-c-input__readonly-value p:not(:first-child){margin-top:1em}.mg-c-input--rich-text-editor .ql-toolbar{display:flex;flex-wrap:wrap;padding:var(--mg-b-size-8);border:0;border-radius:var(--mg-c-input-border-radius) var(--mg-c-input-border-radius) 0 0;background:var(--mg-b-color-neutral-0);border-block-end-width:var(--mg-c-input-border-width);border-block-end-color:var(--mg-c-input-color-border);border-block-end-style:solid}.mg-c-input--rich-text-editor .ql-toolbar .ql-formats{display:inline-flex;margin:inherit;gap:.2rem}.mg-c-input--rich-text-editor .ql-toolbar .ql-formats:not(:last-child)::after{width:.1rem;height:var(--mg-b-size-16);background:var(--mg-c-input-color-border);content:\"\";margin-block:var(--mg-b-size-8);margin-inline:var(--mg-b-size-8)}.mg-c-input--rich-text-editor .ql-toolbar button{display:flex;min-width:var(--mg-b-size-32);height:var(--mg-b-size-32);align-items:center;justify-content:center;padding:var(--mg-b-size-4);border:.1rem solid rgba(0,0,0,0);border-radius:var(--mg-b-size-radius);color:var(--mg-b-color-dark);float:inherit;transition-duration:.2s;transition-property:background-color,border-color;transition-timing-function:ease-in-out}.mg-c-input--rich-text-editor .ql-toolbar button .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button:hover .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button:focus .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active .ql-fill{fill:currentcolor}.mg-c-input--rich-text-editor .ql-toolbar button:hover .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button:focus .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke{stroke:currentcolor}.mg-c-input--rich-text-editor .ql-toolbar button svg{width:var(--mg-b-size-20);height:var(--mg-b-size-20)}.mg-c-input--rich-text-editor .ql-toolbar button:focus{color:var(--mg-b-color-dark)}.mg-c-input--rich-text-editor .ql-toolbar button:focus-visible,.mg-c-input--rich-text-editor .ql-toolbar button:hover,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active{border-color:var(--mg-b-color-neutral-70);background:var(--mg-b-color-neutral-20);color:var(--mg-b-color-dark)}.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke{stroke-width:.12rem}.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke.ql-thin{stroke-width:.1rem}.mg-c-input--rich-text-editor .ql-toolbar button.ql-bold .ql-stroke{stroke-width:.2rem}.mg-c-input--rich-text-editor .ql-container{border:0;border-radius:0 0 var(--mg-c-input-border-radius) var(--mg-c-input-border-radius);margin:0 .1rem .1rem;background:var(--mg-b-color-neutral-0)}.mg-c-input--rich-text-editor .ql-editor{min-height:calc(calc(var(--mg-b-font-size) * var(--mg-b-line-height) * var(--mg-c-input-rich-text-editor-rows, 3)) + calc((var(--mg-b-size-min-height) - var(--mg-b-font-size) * var(--mg-b-line-height)) / 2));padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);color:var(--mg-b-color-dark);font-size:var(--mg-b-font-size)}.mg-c-input--rich-text-editor .ql-editor.ql-blank::before{right:var(--mg-b-size-8);left:var(--mg-b-size-8)}.mg-c-input--rich-text-editor .ql-editor p:not(:first-child){margin-top:1em}.mg-c-input--rich-text-editor.mg-c-input--disabled .ql-toolbar{pointer-events:none}.mg-c-input--rich-text-editor.mg-c-input--has-error .ql-toolbar{border-color:var(--mg-b-color-danger)}";
16385
+ const mgInputRichTextEditorCss = ".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__wrapper{display:flex;width:100%;flex-direction:column;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)}.mg-c-input__wrapper:focus-within{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus);outline:Highlight auto .1rem;outline:-webkit-focus-ring-color auto .1rem}.mg-c-input--has-error .mg-c-input__wrapper{border-color:var(--mg-b-color-danger)}.mg-c-input--disabled .mg-c-input__wrapper{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input--rich-text-editor .mg-c-input__readonly-value p{margin:0}.mg-c-input--rich-text-editor .mg-c-input__readonly-value p:not(:first-child){margin-top:1em}.mg-c-input--rich-text-editor .ql-toolbar{display:flex;flex-wrap:wrap;padding:var(--mg-b-size-8);border:0;border-radius:var(--mg-c-input-border-radius) var(--mg-c-input-border-radius) 0 0;background:var(--mg-b-color-neutral-0);border-block-end-width:var(--mg-c-input-border-width);border-block-end-color:var(--mg-c-input-color-border);border-block-end-style:solid}.mg-c-input--rich-text-editor .ql-toolbar .ql-formats{display:inline-flex;margin:inherit;gap:.2rem}.mg-c-input--rich-text-editor .ql-toolbar .ql-formats:not(:last-child)::after{width:.1rem;height:var(--mg-b-size-16);background:var(--mg-c-input-color-border);content:\"\";margin-block:var(--mg-b-size-8);margin-inline:var(--mg-b-size-8)}.mg-c-input--rich-text-editor .ql-toolbar button .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button:hover .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button:focus .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active .ql-fill{fill:currentcolor}.mg-c-input--rich-text-editor .ql-toolbar button:hover .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button:focus .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke{stroke:currentcolor}.mg-c-input--rich-text-editor .ql-toolbar button{display:flex;min-width:var(--mg-b-size-32);height:var(--mg-b-size-32);align-items:center;justify-content:center;padding:var(--mg-b-size-4);border:.1rem solid rgba(0,0,0,0);border-radius:var(--mg-b-size-radius);color:var(--mg-b-color-dark);float:inherit;transition-duration:.2s;transition-property:background-color,border-color;transition-timing-function:ease-in-out}.mg-c-input--rich-text-editor .ql-toolbar button svg{width:var(--mg-b-size-20);height:var(--mg-b-size-20)}.mg-c-input--rich-text-editor .ql-toolbar button:focus{color:var(--mg-b-color-dark)}.mg-c-input--rich-text-editor .ql-toolbar button:focus-visible,.mg-c-input--rich-text-editor .ql-toolbar button:hover,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active{border-color:var(--mg-b-color-neutral-70);background:var(--mg-b-color-neutral-20);color:var(--mg-b-color-dark)}.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke{stroke-width:.12rem}.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke.ql-thin{stroke-width:.1rem}.mg-c-input--rich-text-editor .ql-toolbar button.ql-bold .ql-stroke{stroke-width:.2rem}.mg-c-input--rich-text-editor .ql-container{border:0;border-radius:0 0 var(--mg-c-input-border-radius) var(--mg-c-input-border-radius);margin:0 .1rem .1rem;background:var(--mg-b-color-neutral-0)}.mg-c-input--rich-text-editor .ql-editor{min-height:calc(calc(var(--mg-b-font-size) * var(--mg-b-line-height) * var(--mg-c-input-rich-text-editor-rows, 3)) + calc((var(--mg-b-size-min-height) - var(--mg-b-font-size) * var(--mg-b-line-height)) / 2));padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);color:var(--mg-b-color-dark);font-size:var(--mg-b-font-size)}.mg-c-input--rich-text-editor .ql-editor.ql-blank::before{right:var(--mg-b-size-8);left:var(--mg-b-size-8)}.mg-c-input--rich-text-editor .ql-editor p:not(:first-child){margin-top:1em}.mg-c-input--rich-text-editor.mg-c-input--disabled .ql-toolbar{pointer-events:none}.mg-c-input--rich-text-editor.mg-c-input--has-error .ql-toolbar{border-color:var(--mg-b-color-danger)}";
16386
16386
 
16387
16387
  const MgInputRichTextEditor$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRichTextEditor extends HTMLElement$1 {
16388
- constructor() {
16388
+ constructor(registerHost) {
16389
16389
  super();
16390
- this.__registerHost();
16390
+ if (registerHost !== false) {
16391
+ this.__registerHost();
16392
+ }
16391
16393
  this.__attachShadow();
16392
16394
  this.inputValid = createEvent(this, "input-valid", 7);
16393
16395
  this.valueChange = createEvent(this, "value-change", 7);
16394
16396
  // hasDisplayedError (triggered by blur event)
16395
16397
  this.hasDisplayedError = false;
16398
+ this.customErrorMessage = { lock: false };
16396
16399
  // Classes
16397
16400
  this.classFocus = 'mg-u-is-focused';
16398
16401
  /**
@@ -16458,20 +16461,23 @@ const MgInputRichTextEditor$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRi
16458
16461
  };
16459
16462
  /**
16460
16463
  * Set input error message
16461
- * @param errorMessage - errorMessage override
16464
+ * @param fromSetErrorContext - context come from `setError` method
16462
16465
  */
16463
- this.setErrorMessage = (errorMessage) => {
16466
+ this.setErrorMessage = (fromSetErrorContext = false) => {
16467
+ // Set error message
16464
16468
  this.errorMessage = undefined;
16465
- if (this.valid)
16466
- return;
16467
- else if (isValidString(errorMessage)) {
16468
- this.errorMessage = errorMessage;
16469
- }
16470
- else if (this.required && this.isEmpty()) {
16471
- this.errorMessage = this.messages.errors.required;
16472
- }
16473
- else if (!this.getPatternValidity()) {
16474
- this.errorMessage = this.patternErrorMessage;
16469
+ // Does have a new custom error message
16470
+ if (!this.valid) {
16471
+ // Does have a new custom error message OR does have a custom error message locked
16472
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
16473
+ this.errorMessage = this.customErrorMessage.message;
16474
+ }
16475
+ else if (this.required && this.isEmpty()) {
16476
+ this.errorMessage = this.messages.errors.required;
16477
+ }
16478
+ else if (!this.getPatternValidity()) {
16479
+ this.errorMessage = this.patternErrorMessage;
16480
+ }
16475
16481
  }
16476
16482
  };
16477
16483
  /**
@@ -16599,17 +16605,22 @@ const MgInputRichTextEditor$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRi
16599
16605
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
16600
16606
  * @param valid - value indicating the validity
16601
16607
  * @param errorMessage - the error message to display
16608
+ * @param errorMessageLock - lock the error message and validity state
16602
16609
  */
16603
- async setError(valid, errorMessage) {
16610
+ async setError(valid, errorMessage, errorMessageLock = false) {
16604
16611
  if (typeof valid !== 'boolean') {
16605
16612
  throw new Error('<mg-input-rich-text-editor> method "setError()" param "valid" must be a boolean.');
16606
16613
  }
16607
- else if (!isValidString(errorMessage)) {
16614
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
16608
16615
  throw new Error('<mg-input-rich-text-editor> method "setError()" param "errorMessage" must be a string.');
16609
16616
  }
16610
16617
  else {
16618
+ this.customErrorMessage = {
16619
+ lock: valid ? false : errorMessageLock,
16620
+ message: valid ? undefined : errorMessage,
16621
+ };
16611
16622
  this.setValidity(valid);
16612
- this.setErrorMessage(valid ? undefined : errorMessage);
16623
+ this.setErrorMessage(true);
16613
16624
  this.hasDisplayedError = this.invalid;
16614
16625
  }
16615
16626
  }
@@ -16628,6 +16639,8 @@ const MgInputRichTextEditor$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRi
16628
16639
  // - Keep everything in sync both inside and outside the component
16629
16640
  return new Promise(resolve => {
16630
16641
  requestAnimationFrame(() => {
16642
+ // unlock validity check by reseting customErrorMessage
16643
+ this.customErrorMessage = { lock: false };
16631
16644
  this.checkValidity();
16632
16645
  this.errorMessage = undefined;
16633
16646
  this.hasDisplayedError = false;
@@ -16641,10 +16654,12 @@ const MgInputRichTextEditor$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRi
16641
16654
  * @param newValue - valid new value
16642
16655
  */
16643
16656
  setValidity(newValue) {
16644
- const oldValidValue = this.valid;
16645
- this.valid = newValue;
16657
+ const oldValue = this.valid;
16658
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
16659
+ this.valid = newValue;
16660
+ }
16646
16661
  this.invalid = !this.valid;
16647
- if (this.valid !== oldValidValue) {
16662
+ if (this.valid !== oldValue) {
16648
16663
  this.inputValid.emit(this.valid);
16649
16664
  }
16650
16665
  }
@@ -16693,7 +16708,7 @@ const MgInputRichTextEditor$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRi
16693
16708
  * @returns HTML mg-input Element
16694
16709
  */
16695
16710
  render() {
16696
- return (h("mg-input", { key: 'b7f7fe282aa00b695418fe7f055955045bbd932d', identifier: this.identifier, class: this.classCollection.join(), label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.hasDisplayedError ? this.errorMessage : undefined }, this.readonly ? (h("div", { class: "mg-c-input__readonly-value", innerHTML: this.value })) : (h("div", { ref: el => {
16711
+ return (h("mg-input", { key: '2f8f244cb60996c9cbe891b04168b5aea420d3a0', identifier: this.identifier, class: this.classCollection.join(), label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.hasDisplayedError ? this.errorMessage : undefined }, this.readonly ? (h("div", { class: "mg-c-input__readonly-value", innerHTML: this.value })) : (h("div", { ref: el => {
16697
16712
  this.wrapperElement = el;
16698
16713
  }, id: this.identifier, class: "mg-c-input__wrapper" }, h("div", null)))));
16699
16714
  }