@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
@@ -1,7 +1,7 @@
1
- import { r as registerInstance, c as createEvent, h, a as getElement } from './index-JHj_9FSs.js';
2
- import { P as Paginate, C as ClassList, f as formatID, a as Cursor, n as nextTick, g as getObjectValueFromKey, t as toString, b as allItemsAreString, i as isObject, c as isValidString, d as Page } from './index-WtiuOkLj.js';
3
- import { c as classReadonly, a as classDisabled, w as widths } from './mg-input.conf-CNgv8hc5.js';
4
- import { i as initLocales } from './index-Bab8_u8S.js';
1
+ import { r as registerInstance, c as createEvent, h, a as getElement } from './index-T6kOJXP1.js';
2
+ import { P as Paginate, C as ClassList, f as formatID, a as Cursor, t as toString, n as nextTick, g as getObjectValueFromKey, b as allItemsAreString, i as isValidString, c as isObject, d as Page } from './index-C7xjtdiw.js';
3
+ import { c as classReadonly, a as classDisabled, w as widths } from './mg-input.conf-D9V2v4n2.js';
4
+ import { i as initLocales } from './index-CNX6lq0x.js';
5
5
  import { K as Keys } from './events.utils-yMGqY8YG.js';
6
6
 
7
7
  const mgInputComboboxCss = ".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__popover-info{padding:var(--mg-b-size-8);margin:0;color:var(--mg-b-color-neutral-90);text-align:center}.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-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--combobox mg-popover{--mg-c-card-overflow:hidden;--mg-c-popover-padding-vertical:0;--mg-c-popover-padding-horizontal:0}.mg-c-input.mg-c-input--combobox .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--combobox .mg-c-input__box{cursor:pointer}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-container{display:flex;min-width:var(--mg-c-input-list-width);max-height:calc(50*var(--mg-b-size-8) - var(--mg-b-size-32));flex-direction:column;gap:var(--mg-b-size-4);overflow-y:scroll}.mg-c-input.mg-c-input--combobox .mg-c-input__load-more{padding:0 var(--mg-b-size-8) var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list{padding:0;margin:0;cursor:pointer;list-style:none}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item{display:flex;padding:var(--mg-b-size-8)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item:hover,.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--focus-visible{background-color:var(--mg-b-color-neutral-20)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected{font-weight:700}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected mg-icon{margin-left:auto}.mg-c-input.mg-c-input--combobox.mg-c-input--width-2 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-24) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-4 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-48) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-16 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + calc(23 * var(--mg-b-size-8)) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full mg-popover{--mg-c-popover-max-width:var(--mg-c-input-list-width, var(--mg-c-popover-max-width))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__input-group-container{display:flex;width:100%}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__box{flex:1}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box-append{position:absolute;top:0;right:0}";
@@ -57,6 +57,7 @@ const MgInputCombobox = class {
57
57
  this.classFocus = 'mg-u-is-focused';
58
58
  // hasDisplayedError (triggered by blur event)
59
59
  this.hasDisplayedError = false;
60
+ this.customErrorMessage = { lock: false };
60
61
  /**
61
62
  * Input name
62
63
  * If not set the value equals the identifier
@@ -191,7 +192,7 @@ const MgInputCombobox = class {
191
192
  // override keys actions
192
193
  switch (event.key) {
193
194
  case Keys.TAB:
194
- case Keys.ENTER:
195
+ case Keys.ENTER: {
195
196
  guard = event.key === Keys.ENTER;
196
197
  const option = (_a = this.option) !== null && _a !== void 0 ? _a : this.options.items.find(this.isCurrentOption);
197
198
  // Sets the value to the content of the focused option in the listbox.
@@ -201,12 +202,13 @@ const MgInputCombobox = class {
201
202
  // Closes the popover.
202
203
  this.popoverDisplay = false;
203
204
  break;
205
+ }
204
206
  case Keys.DOWN:
205
207
  case Keys.ARROWDOWN:
206
208
  case Keys.UP:
207
- case Keys.ARROWUP:
209
+ case Keys.ARROWUP: {
208
210
  guard = true;
209
- if (this.isLoading || !(this.page.total > 0)) {
211
+ if (this.isLoading || this.page.total === 0) {
210
212
  this.popoverDisplay = true;
211
213
  break;
212
214
  }
@@ -237,12 +239,13 @@ const MgInputCombobox = class {
237
239
  // open popover
238
240
  this.popoverDisplay = true;
239
241
  break;
242
+ }
240
243
  case Keys.LEFT:
241
244
  case Keys.ARROWLEFT:
242
245
  case Keys.HOME:
243
246
  case Keys.RIGHT:
244
247
  case Keys.ARROWRIGHT:
245
- case Keys.END:
248
+ case Keys.END: {
246
249
  // skip process if visual focus is not in popover
247
250
  if (!isItem(this.option))
248
251
  break;
@@ -262,8 +265,9 @@ const MgInputCombobox = class {
262
265
  this.input.setSelectionRange(index, index);
263
266
  }
264
267
  break;
268
+ }
265
269
  case Keys.ESC:
266
- case Keys.ESCAPE:
270
+ case Keys.ESCAPE: {
267
271
  guard = true;
268
272
  if (this.popoverDisplay) {
269
273
  // If the popover is displayed, closes it.
@@ -277,10 +281,12 @@ const MgInputCombobox = class {
277
281
  this.option = null;
278
282
  }
279
283
  break;
280
- default:
284
+ }
285
+ default: {
281
286
  // Remove visual focus from popover options
282
287
  this.option = null;
283
288
  break;
289
+ }
284
290
  }
285
291
  if (guard) {
286
292
  event.stopPropagation();
@@ -326,18 +332,20 @@ const MgInputCombobox = class {
326
332
  };
327
333
  /**
328
334
  * Set input error message
329
- * @param errorMessage - errorMessage override
335
+ * @param fromSetErrorContext - context come from `setError` method
330
336
  */
331
- this.setErrorMessage = (errorMessage) => {
337
+ this.setErrorMessage = (fromSetErrorContext = false) => {
332
338
  // Set error message
333
339
  this.errorMessage = undefined;
334
- // Does have a custom error message
335
- if (!this.valid && errorMessage !== undefined) {
336
- this.errorMessage = errorMessage;
337
- }
338
- // required
339
- else if (!this.valid && this.input.validity.valueMissing) {
340
- this.errorMessage = this.messages.errors.required;
340
+ if (!this.valid) {
341
+ // Does have a new custom error message OR does have a custom error message locked
342
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
343
+ this.errorMessage = this.customErrorMessage.message;
344
+ }
345
+ // required
346
+ else if (this.input.validity.valueMissing) {
347
+ this.errorMessage = this.messages.errors.required;
348
+ }
341
349
  }
342
350
  };
343
351
  /**
@@ -351,15 +359,14 @@ const MgInputCombobox = class {
351
359
  * @returns promisified action
352
360
  */
353
361
  this.loadingWrapper = (action) => {
362
+ var _a;
354
363
  let promise;
355
364
  let index;
356
365
  // cache initial loading action if not defined
357
- if (!Boolean(this.loadingAction)) {
358
- this.loadingAction = action.name;
359
- }
366
+ (_a = this.loadingAction) !== null && _a !== void 0 ? _a : (this.loadingAction = action.name);
360
367
  // update index
361
368
  if (Boolean(this.option) && this.loadingAction !== 'load-more') {
362
- index = this.page.items.findIndex(option => option.value.toString() === this.option.value.toString());
369
+ index = this.page.items.findIndex(option => toString(option.value) === toString(this.option.value));
363
370
  }
364
371
  else if (this.loadingAction === 'load-more') {
365
372
  index = this.page.items.length - this.page.baseIndex;
@@ -412,14 +419,14 @@ const MgInputCombobox = class {
412
419
  */
413
420
  this.goToNextPage = () => {
414
421
  this.showMore.emit();
415
- if (Boolean(this.fetchurl)) {
422
+ if (this.fetchurl !== undefined) {
416
423
  return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {
417
- if (!Boolean(nextPage))
418
- return;
419
- // merge items from current page and next page
420
- const items = [...this.page.items, ...nextPage.items];
421
- // create new options pagination withe merged items
422
- this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });
424
+ if (nextPage !== undefined) {
425
+ // merge items from current page and next page
426
+ const items = [...this.page.items, ...nextPage.items];
427
+ // create new options pagination withe merged items
428
+ this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });
429
+ }
423
430
  });
424
431
  }
425
432
  else {
@@ -436,12 +443,12 @@ const MgInputCombobox = class {
436
443
  * @returns promise
437
444
  */
438
445
  this.updatePage = async () => {
439
- if (Boolean(this.fetchurl)) {
446
+ if (this.fetchurl !== undefined) {
440
447
  return this.getOptions().then(page => {
441
- if (!Boolean(page))
442
- return;
443
- // reset current options pagination from API response
444
- this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });
448
+ if (page !== undefined) {
449
+ // reset current options pagination from API response
450
+ this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });
451
+ }
445
452
  });
446
453
  }
447
454
  else {
@@ -487,11 +494,11 @@ const MgInputCombobox = class {
487
494
  this.valueChange.emit(newValue);
488
495
  }
489
496
  watchItems(newValue) {
490
- if (Boolean(this.fetchurl) && !Boolean(newValue)) {
497
+ if (this.fetchurl !== undefined && newValue === undefined) {
491
498
  // skip newValue check
492
499
  return;
493
500
  }
494
- else if (Boolean(this.fetchurl) && Boolean(newValue)) {
501
+ else if (this.fetchurl !== undefined && newValue !== undefined) {
495
502
  throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${toString(newValue)}.`);
496
503
  }
497
504
  // Empty options
@@ -511,7 +518,7 @@ const MgInputCombobox = class {
511
518
  }
512
519
  }
513
520
  watchIdentifier(newValue) {
514
- if (Boolean(newValue)) {
521
+ if (isValidString(newValue)) {
515
522
  this.popoverId = `${newValue}-popover`;
516
523
  this.element.dataset.mgPopoverGuard = this.popoverId;
517
524
  }
@@ -551,7 +558,7 @@ const MgInputCombobox = class {
551
558
  this.classCollection = new ClassList(this.classCollection.classes);
552
559
  }
553
560
  watchFetchUrl(newValue) {
554
- if (Boolean(newValue)) {
561
+ if (newValue !== undefined) {
555
562
  this.loadingWrapper({ name: 'load-data' });
556
563
  }
557
564
  }
@@ -559,20 +566,17 @@ const MgInputCombobox = class {
559
566
  if (this.fetchurl && newValue && !isObject(newValue)) {
560
567
  throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${toString(newValue)}.`);
561
568
  }
562
- else {
563
- new Request(this.fetchurl, newValue);
564
- }
565
569
  }
566
570
  watchFetchMappings(newValue) {
567
- if (Boolean(this.fetchurl) && !Boolean(newValue)) {
571
+ if (this.fetchurl !== undefined && !isObject(newValue)) {
568
572
  throw new Error(`<mg-input-combobox> prop "fetchmappings" is required with "fetchurl" prop.`);
569
573
  }
570
- else if (Boolean(newValue) && !isFetchmappings(newValue)) {
574
+ else if (newValue !== undefined && !isFetchmappings(newValue)) {
571
575
  throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${toString(newValue)}.`);
572
576
  }
573
577
  }
574
578
  watchOptions(newValue) {
575
- this.page = newValue.getPage(0, Boolean(this.filter) ? this.optionsFilter : undefined);
579
+ this.page = newValue.getPage(0, this.filter.length > 0 ? this.optionsFilter : undefined);
576
580
  }
577
581
  watchFilter(newValue) {
578
582
  this.loadingWrapper({ name: 'load-data' });
@@ -629,17 +633,22 @@ const MgInputCombobox = class {
629
633
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
630
634
  * @param valid - value indicating the validity
631
635
  * @param errorMessage - the error message to display
636
+ * @param errorMessageLock - lock the error message and validity state
632
637
  */
633
- async setError(valid, errorMessage) {
638
+ async setError(valid, errorMessage, errorMessageLock = false) {
634
639
  if (typeof valid !== 'boolean') {
635
640
  throw new Error('<mg-input-combobox> method "setError()" param "valid" must be a boolean.');
636
641
  }
637
- else if (!isValidString(errorMessage)) {
642
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
638
643
  throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');
639
644
  }
640
645
  else {
646
+ this.customErrorMessage = {
647
+ lock: valid ? false : errorMessageLock,
648
+ message: valid ? undefined : errorMessage,
649
+ };
641
650
  this.setValidity(valid);
642
- this.setErrorMessage(valid ? undefined : errorMessage);
651
+ this.setErrorMessage(true);
643
652
  this.hasDisplayedError = this.invalid;
644
653
  }
645
654
  }
@@ -659,6 +668,8 @@ const MgInputCombobox = class {
659
668
  // - Keep everything in sync both inside and outside the component
660
669
  return new Promise(resolve => {
661
670
  requestAnimationFrame(() => {
671
+ // unlock validity check by reseting customErrorMessage
672
+ this.customErrorMessage = { lock: false };
662
673
  this.checkValidity();
663
674
  this.errorMessage = undefined;
664
675
  this.hasDisplayedError = false;
@@ -687,11 +698,13 @@ const MgInputCombobox = class {
687
698
  * @param newValue - valid new value
688
699
  */
689
700
  setValidity(newValue) {
690
- const oldValidValue = this.valid;
691
- this.valid = newValue;
701
+ const oldValue = this.valid;
702
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
703
+ this.valid = newValue;
704
+ }
692
705
  this.invalid = !this.valid;
693
706
  // We need to send valid event even if it is the same value
694
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
707
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
695
708
  this.inputValid.emit(this.valid);
696
709
  }
697
710
  /*************
@@ -707,7 +720,7 @@ const MgInputCombobox = class {
707
720
  // Validate
708
721
  this.watchIdentifier(this.identifier);
709
722
  this.watchItems(this.items);
710
- if (Boolean(this.fetchurl)) {
723
+ if (this.fetchurl !== undefined) {
711
724
  this.watchFetchOptions(this.fetchoptions);
712
725
  this.watchFetchMappings(this.fetchmappings);
713
726
  this.loadingWrapper({ name: 'load-data' });
@@ -734,14 +747,17 @@ const MgInputCombobox = class {
734
747
  const readonlyValue = this.getValueTitle();
735
748
  const withResetButton = this.value && !this.disabled;
736
749
  let popoverContent;
737
- if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0)
750
+ if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0) {
738
751
  popoverContent = 'list';
739
- else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && Boolean(this.filter))
752
+ }
753
+ else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && this.filter.length > 0) {
740
754
  popoverContent = 'notfound';
741
- else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0)
755
+ }
756
+ else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0) {
742
757
  popoverContent = 'notavailable';
758
+ }
743
759
  let activeDescendant;
744
- if (Boolean((_d = this.option) === null || _d === void 0 ? void 0 : _d.value)) {
760
+ if (((_d = this.option) === null || _d === void 0 ? void 0 : _d.value) !== undefined) {
745
761
  activeDescendant = this.option.value;
746
762
  }
747
763
  else if (typeof this.value === 'string') {
@@ -750,8 +766,8 @@ const MgInputCombobox = class {
750
766
  else {
751
767
  activeDescendant = (_e = this.value) === null || _e === void 0 ? void 0 : _e.value;
752
768
  }
753
- return (h("mg-input", { key: '79e5263cd3b1c0fa0b3f386a547f2bdd48a33b28', label: this.label, identifier: this.identifier, class: this.classCollection.classes.join(' '), ariaDescribedbyIDs: popoverContent && popoverContent !== 'list' ? popoverContent : undefined, 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 ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("mg-popover", { identifier: this.popoverId, placement: "bottom-start", display: this.popoverDisplay, "arrow-hide": true, style: {
754
- '--mg-c-input-list-width': Boolean((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) ? `${this.input.offsetWidth}px` : undefined,
769
+ return (h("mg-input", { key: 'bebf380dbdea1a9f9e0257a9425dcb6cd94a7a52', label: this.label, identifier: this.identifier, class: this.classCollection.classes.join(' '), ariaDescribedbyIDs: popoverContent && popoverContent !== 'list' ? popoverContent : undefined, 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 ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("mg-popover", { identifier: this.popoverId, placement: "bottom-start", display: this.popoverDisplay, "arrow-hide": true, style: {
770
+ '--mg-c-input-list-width': ((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) > 0 ? `${this.input.offsetWidth}px` : undefined,
755
771
  }, "data-fallback-placement": "bottom-end", "onDisplay-change": this.handlePopoverDisplay }, h("div", { class: "mg-c-input__input-group-container" }, h("mg-icon", { icon: "magnifying-glass" }), h("input", { type: "text", role: "combobox", class: "mg-c-input__box mg-c-input__box--width", value: this.filter, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, autocomplete: "off", "aria-autocomplete": "list", "aria-expanded": this.popoverDisplay.toString(), "aria-controls": listId, "aria-invalid": (this.invalid === true).toString(), "aria-activedescendant": formatID(activeDescendant), onInput: this.handleFilterInput, onBlur: this.handleFilterBlur, onFocus: this.handleFilterFocus, onKeyDown: this.handleFilterKeydown, ref: (el) => {
756
772
  if (el !== null)
757
773
  this.input = el;
@@ -1,7 +1,7 @@
1
- import { r as registerInstance, c as createEvent, h, a as getElement } from './index-JHj_9FSs.js';
2
- import { c as isValidString, C as ClassList, t as toString } from './index-WtiuOkLj.js';
3
- import { c as classReadonly, a as classDisabled } from './mg-input.conf-CNgv8hc5.js';
4
- import { i as initLocales } from './index-Bab8_u8S.js';
1
+ import { r as registerInstance, c as createEvent, h, a as getElement } from './index-T6kOJXP1.js';
2
+ import { i as isValidString, C as ClassList, t as toString } from './index-C7xjtdiw.js';
3
+ import { c as classReadonly, a as classDisabled } from './mg-input.conf-D9V2v4n2.js';
4
+ import { i as initLocales } from './index-CNX6lq0x.js';
5
5
 
6
6
  /** Detect free variable `global` from Node.js. */
7
7
  var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
@@ -16378,7 +16378,7 @@ const quillSnowCss = "/*!\n * Quill Editor v2.0.3\n * https://quilljs.com\n * Co
16378
16378
 
16379
16379
  const editorScss = quillSnowCss + "";
16380
16380
 
16381
- 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)}";
16381
+ 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)}";
16382
16382
 
16383
16383
  const MgInputRichTextEditor = class {
16384
16384
  constructor(hostRef) {
@@ -16387,6 +16387,7 @@ const MgInputRichTextEditor = class {
16387
16387
  this.valueChange = createEvent(this, "value-change", 7);
16388
16388
  // hasDisplayedError (triggered by blur event)
16389
16389
  this.hasDisplayedError = false;
16390
+ this.customErrorMessage = { lock: false };
16390
16391
  // Classes
16391
16392
  this.classFocus = 'mg-u-is-focused';
16392
16393
  /**
@@ -16452,20 +16453,23 @@ const MgInputRichTextEditor = class {
16452
16453
  };
16453
16454
  /**
16454
16455
  * Set input error message
16455
- * @param errorMessage - errorMessage override
16456
+ * @param fromSetErrorContext - context come from `setError` method
16456
16457
  */
16457
- this.setErrorMessage = (errorMessage) => {
16458
+ this.setErrorMessage = (fromSetErrorContext = false) => {
16459
+ // Set error message
16458
16460
  this.errorMessage = undefined;
16459
- if (this.valid)
16460
- return;
16461
- else if (isValidString(errorMessage)) {
16462
- this.errorMessage = errorMessage;
16463
- }
16464
- else if (this.required && this.isEmpty()) {
16465
- this.errorMessage = this.messages.errors.required;
16466
- }
16467
- else if (!this.getPatternValidity()) {
16468
- this.errorMessage = this.patternErrorMessage;
16461
+ // Does have a new custom error message
16462
+ if (!this.valid) {
16463
+ // Does have a new custom error message OR does have a custom error message locked
16464
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
16465
+ this.errorMessage = this.customErrorMessage.message;
16466
+ }
16467
+ else if (this.required && this.isEmpty()) {
16468
+ this.errorMessage = this.messages.errors.required;
16469
+ }
16470
+ else if (!this.getPatternValidity()) {
16471
+ this.errorMessage = this.patternErrorMessage;
16472
+ }
16469
16473
  }
16470
16474
  };
16471
16475
  /**
@@ -16593,17 +16597,22 @@ const MgInputRichTextEditor = class {
16593
16597
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
16594
16598
  * @param valid - value indicating the validity
16595
16599
  * @param errorMessage - the error message to display
16600
+ * @param errorMessageLock - lock the error message and validity state
16596
16601
  */
16597
- async setError(valid, errorMessage) {
16602
+ async setError(valid, errorMessage, errorMessageLock = false) {
16598
16603
  if (typeof valid !== 'boolean') {
16599
16604
  throw new Error('<mg-input-rich-text-editor> method "setError()" param "valid" must be a boolean.');
16600
16605
  }
16601
- else if (!isValidString(errorMessage)) {
16606
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
16602
16607
  throw new Error('<mg-input-rich-text-editor> method "setError()" param "errorMessage" must be a string.');
16603
16608
  }
16604
16609
  else {
16610
+ this.customErrorMessage = {
16611
+ lock: valid ? false : errorMessageLock,
16612
+ message: valid ? undefined : errorMessage,
16613
+ };
16605
16614
  this.setValidity(valid);
16606
- this.setErrorMessage(valid ? undefined : errorMessage);
16615
+ this.setErrorMessage(true);
16607
16616
  this.hasDisplayedError = this.invalid;
16608
16617
  }
16609
16618
  }
@@ -16622,6 +16631,8 @@ const MgInputRichTextEditor = class {
16622
16631
  // - Keep everything in sync both inside and outside the component
16623
16632
  return new Promise(resolve => {
16624
16633
  requestAnimationFrame(() => {
16634
+ // unlock validity check by reseting customErrorMessage
16635
+ this.customErrorMessage = { lock: false };
16625
16636
  this.checkValidity();
16626
16637
  this.errorMessage = undefined;
16627
16638
  this.hasDisplayedError = false;
@@ -16635,10 +16646,12 @@ const MgInputRichTextEditor = class {
16635
16646
  * @param newValue - valid new value
16636
16647
  */
16637
16648
  setValidity(newValue) {
16638
- const oldValidValue = this.valid;
16639
- this.valid = newValue;
16649
+ const oldValue = this.valid;
16650
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
16651
+ this.valid = newValue;
16652
+ }
16640
16653
  this.invalid = !this.valid;
16641
- if (this.valid !== oldValidValue) {
16654
+ if (this.valid !== oldValue) {
16642
16655
  this.inputValid.emit(this.valid);
16643
16656
  }
16644
16657
  }
@@ -16687,7 +16700,7 @@ const MgInputRichTextEditor = class {
16687
16700
  * @returns HTML mg-input Element
16688
16701
  */
16689
16702
  render() {
16690
- 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 => {
16703
+ 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 => {
16691
16704
  this.wrapperElement = el;
16692
16705
  }, id: this.identifier, class: "mg-c-input__wrapper" }, h("div", null)))));
16693
16706
  }
@@ -6,9 +6,13 @@ const widths = [2, 4, 16, 'full'];
6
6
  * Possible tootltip postions
7
7
  */
8
8
  const tooltipPositions = ['input', 'label'];
9
+ /**
10
+ * Possible label headings
11
+ */
12
+ const labelHeadings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
9
13
  const classFieldset = 'mg-c-input--fieldset';
10
14
  const classDisabled = 'mg-c-input--disabled';
11
15
  const classReadonly = 'mg-c-input--readonly';
12
16
  const classVerticalList = 'mg-c-input--vertical-list';
13
17
 
14
- export { classDisabled as a, classFieldset as b, classReadonly as c, classVerticalList as d, tooltipPositions as t, widths as w };
18
+ export { classDisabled as a, classFieldset as b, classReadonly as c, classVerticalList as d, labelHeadings as l, tooltipPositions as t, widths as w };
@@ -1,6 +1,6 @@
1
- import { r as registerInstance, h, a as getElement } from './index-JHj_9FSs.js';
2
- import { i as initLocales } from './index-Bab8_u8S.js';
3
- import { c as isValidString, t as toString } from './index-WtiuOkLj.js';
1
+ import { r as registerInstance, h, a as getElement } from './index-T6kOJXP1.js';
2
+ import { i as initLocales } from './index-CNX6lq0x.js';
3
+ import { i as isValidString, t as toString } from './index-C7xjtdiw.js';
4
4
 
5
5
  const mgLoaderCss = ".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}}:host{display:block}.mg-c-loader{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--mg-b-size-4);text-align:center}";
6
6
 
@@ -33,7 +33,7 @@ const MgLoader = class {
33
33
  * @returns HTML Element
34
34
  */
35
35
  render() {
36
- return (h("div", { key: 'b74028455b7003824fa5618b1751d05a91ab7071', class: "mg-c-loader", "aria-live": "polite" }, h("mg-icon", { key: '204acdb8f881b348148020214c05269878852c4f', icon: "loader", spin: true }), h("span", { key: '40f1792354df01ec9af61ab128575ea166f34cb5', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgress)));
36
+ return (h("div", { key: '739b4cbacd8a8da056dbb1445c40fac2cf26766a', class: "mg-c-loader", "aria-live": "polite" }, h("mg-icon", { key: '95d3cbf26fcd6dbf0dad4853bf55aa66385f1aba', icon: "loader", spin: true }), h("span", { key: 'f6322cd3054d8976bd2ec24f86a2d6bb60ca7ae1', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgress)));
37
37
  }
38
38
  get element() { return getElement(this); }
39
39
  static get watchers() { return {
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, h, H as Host } from './index-JHj_9FSs.js';
2
- import { c as isValidString, t as toString, e as isValidNumber } from './index-WtiuOkLj.js';
1
+ import { r as registerInstance, h, H as Host } from './index-T6kOJXP1.js';
2
+ import { i as isValidString, t as toString, e as isValidNumber } from './index-C7xjtdiw.js';
3
3
 
4
4
  /**
5
5
  * List of all possibles roles
@@ -73,7 +73,7 @@ const MgProgress = class {
73
73
  * @returns HTML Element
74
74
  */
75
75
  render() {
76
- return (h(Host, { key: '62c66dbd93249bfde3eb8ff449b49884edfe49c3', role: this.ariaRole, "aria-label": this.label, "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max }, h("div", { key: 'b349c9d7358086ca4668705a1935fd8bbdb86afa', class: "mg-c-progress" }, h("div", { key: '57cc19d07c0f006f8ecf3a1f86ec12e37ffd8d6b', class: { 'mg-c-progress__bar': true, 'mg-c-progress__bar--active': this.value > this.min } }, h("div", { key: 'b4c49d94d9cfe2e1a6d8013aa4a39cde51b36d04', class: "mg-c-progress__fill", style: {
76
+ return (h(Host, { key: '8e6c727e9416fa777fd94b32d618a9137e8e08f7', role: this.ariaRole, "aria-label": this.label, "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max }, h("div", { key: 'ac42ee9c5dda55d70aad7391895e4a013aaa27f9', class: "mg-c-progress" }, h("div", { key: '34c77bc6c133bc59b9daa68d7d6c8534f13f7d37', class: { 'mg-c-progress__bar': true, 'mg-c-progress__bar--active': this.value > this.min } }, h("div", { key: '7ea03a3f0c54ca0c81616c7c070d178a510dd7e1', class: "mg-c-progress__fill", style: {
77
77
  width: `${Math.round(((this.value - this.min) / (this.max - this.min)) * 100)}%`,
78
78
  } })))));
79
79
  }
@@ -45,17 +45,17 @@
45
45
  "yyyy": "yyyy"
46
46
  },
47
47
  "helpText": {
48
- "expectedFormat": "Expected format: {pattern} (ex: {date})",
48
+ "expectedFormat": "Expected format: {pattern} (ex: {date})"
49
+ },
50
+ "error": {
51
+ "badInput": "The date is inexistent or incorrect, the expected format is {pattern} (ex: {date})",
49
52
  "min": "The date must be after or equal to {min}",
50
53
  "max": "The date must be before or equal to {max}",
51
54
  "minMax": "The date must be between {min} and {max}"
52
- },
53
- "error": {
54
- "badInput": "The date is inexistent or incorrect, the expected format is {pattern} (ex: {date})"
55
55
  }
56
56
  },
57
57
  "numeric": {
58
- "helpText": {
58
+ "error": {
59
59
  "min": "The value must be greater than or equal to {min}",
60
60
  "max": "The value must be less than or equal to {max}",
61
61
  "minMax": "The value must be between {min} and {max}"
@@ -45,17 +45,17 @@
45
45
  "yyyy": "aaaa"
46
46
  },
47
47
  "helpText": {
48
- "expectedFormat": "Format attendu&nbsp;: {pattern} (ex&nbsp;: {date})",
48
+ "expectedFormat": "Format attendu&nbsp;: {pattern} (ex&nbsp;: {date})"
49
+ },
50
+ "error": {
51
+ "badInput": "La date est inexistante ou incorrecte, le format attendu est {pattern} (ex&nbsp;: {date})",
49
52
  "min": "La date doit être postérieure ou égale au {min}",
50
53
  "max": "La date doit être antérieure ou égale au {max}",
51
54
  "minMax": "La date doit être comprise entre le {min} et le {max}"
52
- },
53
- "error": {
54
- "badInput": "La date est inexistante ou incorrecte, le format attendu est {pattern} (ex&nbsp;: {date})"
55
55
  }
56
56
  },
57
57
  "numeric": {
58
- "helpText": {
58
+ "error": {
59
59
  "min": "La valeur doit être supérieure ou égale à {min}",
60
60
  "max": "La valeur doit être inférieure ou égale à {max}",
61
61
  "minMax": "La valeur doit être comprise entre {min} et {max}"