@mgdis/mg-components 6.17.0 → 6.19.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 (127) hide show
  1. package/dist/cjs/{index-DCZEYvlH.js → index-Bp6wZzau.js} +5 -1
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/mg-action-more_37.cjs.entry.js +438 -212
  4. package/dist/cjs/mg-alert.cjs.entry.js +2 -2
  5. package/dist/cjs/mg-components.cjs.js +2 -2
  6. package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
  7. package/dist/cjs/mg-input-combobox.cjs.entry.js +93 -80
  8. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +35 -26
  9. package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-D7jmj_lh.js} +7 -0
  10. package/dist/cjs/mg-loader.cjs.entry.js +2 -2
  11. package/dist/cjs/mg-progress.cjs.entry.js +2 -2
  12. package/dist/collection/assets/icons/index.js +1 -1
  13. package/dist/collection/collection-manifest.json +1 -0
  14. package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
  15. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +5 -0
  16. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +178 -18
  17. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
  18. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +36 -16
  19. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +98 -78
  20. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +41 -22
  21. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +32 -12
  22. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +30 -12
  23. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +31 -12
  24. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +41 -25
  25. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +31 -12
  26. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +60 -40
  27. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +35 -33
  28. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +36 -11
  29. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
  30. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +5 -1
  31. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
  32. package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
  33. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  34. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
  35. package/dist/collection/components/molecules/mg-form/mg-form.js +13 -4
  36. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  37. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  38. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  39. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  40. package/dist/collection/components/molecules/mg-panel/mg-panel.js +40 -9
  41. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  42. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  43. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  44. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  45. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  46. package/dist/components/mg-action-more.js +1 -1
  47. package/dist/components/mg-alert.js +1 -1
  48. package/dist/components/mg-details.js +1 -1
  49. package/dist/components/mg-fieldset.d.ts +11 -0
  50. package/dist/components/mg-fieldset.js +209 -0
  51. package/dist/components/mg-form.js +4 -3
  52. package/dist/components/mg-icon2.js +1 -1
  53. package/dist/components/mg-illustrated-message.js +2 -2
  54. package/dist/components/mg-input-checkbox-paginated2.js +1 -1
  55. package/dist/components/mg-input-checkbox.js +29 -16
  56. package/dist/components/mg-input-combobox.js +92 -79
  57. package/dist/components/mg-input-date.js +34 -22
  58. package/dist/components/mg-input-numeric.js +25 -12
  59. package/dist/components/mg-input-password.js +23 -12
  60. package/dist/components/mg-input-radio.js +23 -11
  61. package/dist/components/mg-input-rich-text-editor.js +33 -24
  62. package/dist/components/mg-input-select2.js +24 -12
  63. package/dist/components/mg-input-text2.js +51 -39
  64. package/dist/components/mg-input-textarea.js +28 -33
  65. package/dist/components/mg-input-toggle.js +35 -10
  66. package/dist/components/mg-input2.js +119 -19
  67. package/dist/components/mg-item-more2.js +5 -1
  68. package/dist/components/mg-loader2.js +1 -1
  69. package/dist/components/mg-message2.js +2 -2
  70. package/dist/components/mg-modal.js +3 -3
  71. package/dist/components/mg-panel.js +37 -8
  72. package/dist/components/mg-popover-content2.js +2 -2
  73. package/dist/components/mg-popover2.js +2 -2
  74. package/dist/components/mg-progress.js +1 -1
  75. package/dist/components/mg-skip-links.js +1 -1
  76. package/dist/components/mg-tabs2.js +1 -1
  77. package/dist/esm/{index-T6kOJXP1.js → index-BluNKQ3L.js} +5 -1
  78. package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
  79. package/dist/esm/loader.js +3 -3
  80. package/dist/esm/mg-action-more_37.entry.js +439 -213
  81. package/dist/esm/mg-alert.entry.js +3 -3
  82. package/dist/esm/mg-components.js +3 -3
  83. package/dist/esm/mg-fieldset.entry.js +139 -0
  84. package/dist/esm/mg-input-combobox.entry.js +94 -81
  85. package/dist/esm/mg-input-rich-text-editor.entry.js +36 -27
  86. package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-DDnrE1hD.js} +6 -1
  87. package/dist/esm/mg-loader.entry.js +3 -3
  88. package/dist/esm/mg-progress.entry.js +3 -3
  89. package/dist/mg-components/mg-components.css +1 -1
  90. package/dist/mg-components/mg-components.esm.js +1 -1
  91. package/dist/mg-components/p-016bd291.entry.js +1 -0
  92. package/dist/mg-components/{p-397bf67b.entry.js → p-186a6139.entry.js} +1 -1
  93. package/dist/mg-components/p-66a1cb83.entry.js +1 -0
  94. package/dist/mg-components/p-6efd819f.entry.js +1 -0
  95. package/dist/mg-components/{p-c5da335e.entry.js → p-916dfb6d.entry.js} +1 -1
  96. package/dist/mg-components/p-BluNKQ3L.js +2 -0
  97. package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
  98. package/dist/mg-components/p-DDnrE1hD.js +1 -0
  99. package/dist/mg-components/{p-0e6b40d6.entry.js → p-d2c72f09.entry.js} +1 -1
  100. package/dist/mg-components/{p-5dc3a1fb.entry.js → p-d5a276eb.entry.js} +1 -1
  101. package/dist/types/assets/icons/index.d.ts +9 -0
  102. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +6 -0
  103. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
  104. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
  105. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +1 -0
  106. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +8 -7
  107. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
  108. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
  109. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
  110. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
  111. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -3
  112. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
  113. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +5 -7
  114. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -8
  115. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
  116. package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
  117. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  118. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
  119. package/dist/types/components.d.ts +168 -18
  120. package/ide/intellij/web-types.json +289 -22
  121. package/ide/vscode/css-custom-data.json +7 -3
  122. package/ide/vscode/html-custom-data.json +300 -8
  123. package/package.json +18 -18
  124. package/dist/mg-components/p-8a69175b.entry.js +0 -1
  125. package/dist/mg-components/p-CNgv8hc5.js +0 -1
  126. package/dist/mg-components/p-T6kOJXP1.js +0 -2
  127. package/dist/mg-components/p-d84d87ea.entry.js +0 -1
@@ -1,10 +1,10 @@
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, 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';
1
+ import { r as registerInstance, c as createEvent, h, a as getElement } from './index-BluNKQ3L.js';
2
+ import { P as Paginate, C as ClassList, t as toString, a as Cursor, n as nextTick, g as getObjectValueFromKey, b as allItemsAreString, i as isValidString, c as isObject, f as formatID, d as Page } from './index-C7xjtdiw.js';
3
+ import { c as classReadonly, a as classDisabled, w as widths } from './mg-input.conf-DDnrE1hD.js';
4
4
  import { i as initLocales } from './index-CNX6lq0x.js';
5
5
  import { K as Keys } from './events.utils-yMGqY8YG.js';
6
6
 
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}";
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__input-group-container{position:relative}.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__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-full .mg-c-input__input-group-container{width:100%;flex-grow:1}.mg-c-input.mg-c-input--width-2.mg-c-input--display-character-left .mg-c-input__input-group-container,.mg-c-input.mg-c-input--width-4.mg-c-input--display-character-left .mg-c-input__input-group-container,.mg-c-input.mg-c-input--width-16.mg-c-input--display-character-left .mg-c-input__input-group-container{width:max-content}.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--text.mg-c-input--display-character-left .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--text.mg-c-input--display-character-left .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--text.mg-c-input--display-character-left .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}";
8
8
 
9
9
  /**
10
10
  * Check if object is an item
@@ -29,7 +29,7 @@ const isFetchmappings = (value) => {
29
29
  const { request, response } = value;
30
30
  if ([request, response].some(property => !isObject(property)))
31
31
  return false;
32
- const isValidRequest = typeof request.filter === 'string';
32
+ const isValidRequest = typeof request.filter === 'string' && (request.filterTransform === undefined || typeof request.filterTransform === 'function');
33
33
  const isValidResponse = typeof response === 'object' &&
34
34
  typeof response.total === 'string' &&
35
35
  typeof response.items === 'string' &&
@@ -50,13 +50,9 @@ const MgInputCombobox = class {
50
50
  this.showMore = createEvent(this, "load-more", 7);
51
51
  this.inputValid = createEvent(this, "input-valid", 7);
52
52
  this.fetchError = createEvent(this, "fetch-error", 7);
53
- /************
54
- * Internal *
55
- ************/
56
- // Classes
57
- this.classFocus = 'mg-u-is-focused';
58
53
  // hasDisplayedError (triggered by blur event)
59
54
  this.hasDisplayedError = false;
55
+ this.customErrorMessage = { lock: false };
60
56
  /**
61
57
  * Input name
62
58
  * If not set the value equals the identifier
@@ -111,7 +107,7 @@ const MgInputCombobox = class {
111
107
  * @param event - option element click event
112
108
  */
113
109
  this.handleOptionClick = (event) => {
114
- this.setValue(this.options.items.find(option => formatID(option.value) === event.target.id));
110
+ this.setValue(this.options.items.find(option => toString(option.value) === event.target.dataset.value));
115
111
  this.popoverDisplay = false;
116
112
  };
117
113
  /**
@@ -191,7 +187,7 @@ const MgInputCombobox = class {
191
187
  // override keys actions
192
188
  switch (event.key) {
193
189
  case Keys.TAB:
194
- case Keys.ENTER:
190
+ case Keys.ENTER: {
195
191
  guard = event.key === Keys.ENTER;
196
192
  const option = (_a = this.option) !== null && _a !== void 0 ? _a : this.options.items.find(this.isCurrentOption);
197
193
  // Sets the value to the content of the focused option in the listbox.
@@ -201,12 +197,13 @@ const MgInputCombobox = class {
201
197
  // Closes the popover.
202
198
  this.popoverDisplay = false;
203
199
  break;
200
+ }
204
201
  case Keys.DOWN:
205
202
  case Keys.ARROWDOWN:
206
203
  case Keys.UP:
207
- case Keys.ARROWUP:
204
+ case Keys.ARROWUP: {
208
205
  guard = true;
209
- if (this.isLoading || !(this.page.total > 0)) {
206
+ if (this.isLoading || this.page.total === 0) {
210
207
  this.popoverDisplay = true;
211
208
  break;
212
209
  }
@@ -237,12 +234,13 @@ const MgInputCombobox = class {
237
234
  // open popover
238
235
  this.popoverDisplay = true;
239
236
  break;
237
+ }
240
238
  case Keys.LEFT:
241
239
  case Keys.ARROWLEFT:
242
240
  case Keys.HOME:
243
241
  case Keys.RIGHT:
244
242
  case Keys.ARROWRIGHT:
245
- case Keys.END:
243
+ case Keys.END: {
246
244
  // skip process if visual focus is not in popover
247
245
  if (!isItem(this.option))
248
246
  break;
@@ -262,8 +260,9 @@ const MgInputCombobox = class {
262
260
  this.input.setSelectionRange(index, index);
263
261
  }
264
262
  break;
263
+ }
265
264
  case Keys.ESC:
266
- case Keys.ESCAPE:
265
+ case Keys.ESCAPE: {
267
266
  guard = true;
268
267
  if (this.popoverDisplay) {
269
268
  // If the popover is displayed, closes it.
@@ -277,10 +276,12 @@ const MgInputCombobox = class {
277
276
  this.option = null;
278
277
  }
279
278
  break;
280
- default:
279
+ }
280
+ default: {
281
281
  // Remove visual focus from popover options
282
282
  this.option = null;
283
283
  break;
284
+ }
284
285
  }
285
286
  if (guard) {
286
287
  event.stopPropagation();
@@ -326,40 +327,41 @@ const MgInputCombobox = class {
326
327
  };
327
328
  /**
328
329
  * Set input error message
329
- * @param errorMessage - errorMessage override
330
+ * @param fromSetErrorContext - context come from `setError` method
330
331
  */
331
- this.setErrorMessage = (errorMessage) => {
332
+ this.setErrorMessage = (fromSetErrorContext = false) => {
332
333
  // Set error message
333
334
  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;
335
+ if (!this.valid) {
336
+ // Does have a new custom error message OR does have a custom error message locked
337
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
338
+ this.errorMessage = this.customErrorMessage.message;
339
+ }
340
+ // required
341
+ else if (this.input.validity.valueMissing) {
342
+ this.errorMessage = this.messages.errors.required;
343
+ }
341
344
  }
342
345
  };
343
346
  /**
344
- * Get filtered options from `filter` input value
345
- * @returns filtered options
347
+ * Get first page with filter applied
348
+ * @returns first page with filter applied
346
349
  */
347
- this.optionsFilter = (option) => (this.filter === '' ? true : option.title.toLocaleLowerCase().includes(this.filter.toLocaleLowerCase()));
350
+ this.getFirstPage = () => this.options.getPage(0, option => this.filter === '' || option.title.toLocaleLowerCase().includes(this.filter.toLocaleLowerCase()));
348
351
  /**
349
352
  * Loading wrapper with a given action
350
353
  * @param action - wrapped loading action
351
354
  * @returns promisified action
352
355
  */
353
356
  this.loadingWrapper = (action) => {
357
+ var _a;
354
358
  let promise;
355
359
  let index;
356
360
  // cache initial loading action if not defined
357
- if (!Boolean(this.loadingAction)) {
358
- this.loadingAction = action.name;
359
- }
361
+ (_a = this.loadingAction) !== null && _a !== void 0 ? _a : (this.loadingAction = action.name);
360
362
  // update index
361
363
  if (Boolean(this.option) && this.loadingAction !== 'load-more') {
362
- index = this.page.items.findIndex(option => option.value.toString() === this.option.value.toString());
364
+ index = this.page.items.findIndex(option => toString(option.value) === toString(this.option.value));
363
365
  }
364
366
  else if (this.loadingAction === 'load-more') {
365
367
  index = this.page.items.length - this.page.baseIndex;
@@ -389,7 +391,7 @@ const MgInputCombobox = class {
389
391
  return promise()
390
392
  .then(() => {
391
393
  // parse full items list from options
392
- const options = this.options.items.filter(this.optionsFilter);
394
+ const options = this.filter === '' ? this.options.items : this.options.items.filter(option => option.title.includes(this.filter));
393
395
  // update visual focus
394
396
  if (action.name !== 'load-data') {
395
397
  index = this.page.getIndexFromCursor(action.cursor, this.loadingAction === 'load-more' && index >= 0 ? options[index] : this.option);
@@ -412,14 +414,14 @@ const MgInputCombobox = class {
412
414
  */
413
415
  this.goToNextPage = () => {
414
416
  this.showMore.emit();
415
- if (Boolean(this.fetchurl)) {
417
+ if (this.fetchurl !== undefined) {
416
418
  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 });
419
+ if (nextPage !== undefined) {
420
+ // merge items from current page and next page
421
+ const items = [...this.page.items, ...nextPage.items];
422
+ // create new options pagination withe merged items
423
+ this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });
424
+ }
423
425
  });
424
426
  }
425
427
  else {
@@ -436,16 +438,16 @@ const MgInputCombobox = class {
436
438
  * @returns promise
437
439
  */
438
440
  this.updatePage = async () => {
439
- if (Boolean(this.fetchurl)) {
441
+ if (this.fetchurl !== undefined) {
440
442
  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 });
443
+ if (page !== undefined) {
444
+ // reset current options pagination from API response
445
+ this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });
446
+ }
445
447
  });
446
448
  }
447
449
  else {
448
- this.page = this.options.getPage(0, this.optionsFilter);
450
+ this.page = this.getFirstPage();
449
451
  }
450
452
  };
451
453
  /**
@@ -454,8 +456,9 @@ const MgInputCombobox = class {
454
456
  * @returns new page from url
455
457
  */
456
458
  this.getOptions = async (url = this.fetchurl) => {
457
- // add text filter
458
- const updateUrl = (typeof url === 'string' ? url : url.toString()).replaceAll(this.fetchmappings.request.filter, encodeURIComponent(this.filter));
459
+ // add text filter to url
460
+ const filter = typeof this.fetchmappings.request.filterTransform === 'function' ? this.fetchmappings.request.filterTransform(this.filter) : this.filter;
461
+ const updateUrl = (typeof url === 'string' ? url : url.toString()).replaceAll(this.fetchmappings.request.filter, encodeURIComponent(filter));
459
462
  try {
460
463
  const response = await fetch(updateUrl, this.fetchoptions);
461
464
  if (!response.ok) {
@@ -463,10 +466,13 @@ const MgInputCombobox = class {
463
466
  return;
464
467
  }
465
468
  const json = await response.json();
466
- const items = getObjectValueFromKey(json, this.fetchmappings.response.items).map((item) => ({
467
- title: getObjectValueFromKey(item, this.fetchmappings.response.itemTitle),
468
- value: this.fetchmappings.response.itemValue !== undefined ? getObjectValueFromKey(item, this.fetchmappings.response.itemValue) : item,
469
- }));
469
+ const items = getObjectValueFromKey(json, this.fetchmappings.response.items).map((item) => {
470
+ var _a;
471
+ return ({
472
+ title: getObjectValueFromKey(item, this.fetchmappings.response.itemTitle),
473
+ value: (_a = getObjectValueFromKey(item, this.fetchmappings.response.itemValue)) !== null && _a !== void 0 ? _a : item,
474
+ });
475
+ });
470
476
  const total = Number(getObjectValueFromKey(json, this.fetchmappings.response.total, 0));
471
477
  let next = getObjectValueFromKey(json, this.fetchmappings.response.next);
472
478
  if (URL.canParse(updateUrl) && Boolean(next) && !URL.canParse(next)) {
@@ -487,11 +493,11 @@ const MgInputCombobox = class {
487
493
  this.valueChange.emit(newValue);
488
494
  }
489
495
  watchItems(newValue) {
490
- if (Boolean(this.fetchurl) && !Boolean(newValue)) {
496
+ if (this.fetchurl !== undefined && newValue === undefined) {
491
497
  // skip newValue check
492
498
  return;
493
499
  }
494
- else if (Boolean(this.fetchurl) && Boolean(newValue)) {
500
+ else if (this.fetchurl !== undefined && newValue !== undefined) {
495
501
  throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${toString(newValue)}.`);
496
502
  }
497
503
  // Empty options
@@ -511,7 +517,7 @@ const MgInputCombobox = class {
511
517
  }
512
518
  }
513
519
  watchIdentifier(newValue) {
514
- if (Boolean(newValue)) {
520
+ if (isValidString(newValue)) {
515
521
  this.popoverId = `${newValue}-popover`;
516
522
  this.element.dataset.mgPopoverGuard = this.popoverId;
517
523
  }
@@ -551,7 +557,7 @@ const MgInputCombobox = class {
551
557
  this.classCollection = new ClassList(this.classCollection.classes);
552
558
  }
553
559
  watchFetchUrl(newValue) {
554
- if (Boolean(newValue)) {
560
+ if (newValue !== undefined) {
555
561
  this.loadingWrapper({ name: 'load-data' });
556
562
  }
557
563
  }
@@ -559,20 +565,17 @@ const MgInputCombobox = class {
559
565
  if (this.fetchurl && newValue && !isObject(newValue)) {
560
566
  throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${toString(newValue)}.`);
561
567
  }
562
- else {
563
- new Request(this.fetchurl, newValue);
564
- }
565
568
  }
566
569
  watchFetchMappings(newValue) {
567
- if (Boolean(this.fetchurl) && !Boolean(newValue)) {
570
+ if (this.fetchurl !== undefined && !isObject(newValue)) {
568
571
  throw new Error(`<mg-input-combobox> prop "fetchmappings" is required with "fetchurl" prop.`);
569
572
  }
570
- else if (Boolean(newValue) && !isFetchmappings(newValue)) {
573
+ else if (newValue !== undefined && !isFetchmappings(newValue)) {
571
574
  throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${toString(newValue)}.`);
572
575
  }
573
576
  }
574
- watchOptions(newValue) {
575
- this.page = newValue.getPage(0, Boolean(this.filter) ? this.optionsFilter : undefined);
577
+ watchOptions() {
578
+ this.page = this.getFirstPage();
576
579
  }
577
580
  watchFilter(newValue) {
578
581
  this.loadingWrapper({ name: 'load-data' });
@@ -580,7 +583,6 @@ const MgInputCombobox = class {
580
583
  }
581
584
  watchPopoverDisplay(newValue) {
582
585
  if (newValue) {
583
- this.classCollection.add(this.classFocus);
584
586
  this.input.focus();
585
587
  }
586
588
  else {
@@ -588,7 +590,6 @@ const MgInputCombobox = class {
588
590
  this.option = null;
589
591
  // reset filter with value
590
592
  this.filter = this.getValueTitle();
591
- this.classCollection.delete(this.classFocus);
592
593
  this.handlerInProgress = 'blur';
593
594
  this.displayError().finally(() => {
594
595
  // reset guard
@@ -629,17 +630,22 @@ const MgInputCombobox = class {
629
630
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
630
631
  * @param valid - value indicating the validity
631
632
  * @param errorMessage - the error message to display
633
+ * @param errorMessageLock - lock the error message and validity state
632
634
  */
633
- async setError(valid, errorMessage) {
635
+ async setError(valid, errorMessage, errorMessageLock = false) {
634
636
  if (typeof valid !== 'boolean') {
635
637
  throw new Error('<mg-input-combobox> method "setError()" param "valid" must be a boolean.');
636
638
  }
637
- else if (!isValidString(errorMessage)) {
639
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
638
640
  throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');
639
641
  }
640
642
  else {
643
+ this.customErrorMessage = {
644
+ lock: valid ? false : errorMessageLock,
645
+ message: valid ? undefined : errorMessage,
646
+ };
641
647
  this.setValidity(valid);
642
- this.setErrorMessage(valid ? undefined : errorMessage);
648
+ this.setErrorMessage(true);
643
649
  this.hasDisplayedError = this.invalid;
644
650
  }
645
651
  }
@@ -659,6 +665,8 @@ const MgInputCombobox = class {
659
665
  // - Keep everything in sync both inside and outside the component
660
666
  return new Promise(resolve => {
661
667
  requestAnimationFrame(() => {
668
+ // unlock validity check by reseting customErrorMessage
669
+ this.customErrorMessage = { lock: false };
662
670
  this.checkValidity();
663
671
  this.errorMessage = undefined;
664
672
  this.hasDisplayedError = false;
@@ -687,11 +695,13 @@ const MgInputCombobox = class {
687
695
  * @param newValue - valid new value
688
696
  */
689
697
  setValidity(newValue) {
690
- const oldValidValue = this.valid;
691
- this.valid = newValue;
698
+ const oldValue = this.valid;
699
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
700
+ this.valid = newValue;
701
+ }
692
702
  this.invalid = !this.valid;
693
703
  // We need to send valid event even if it is the same value
694
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
704
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
695
705
  this.inputValid.emit(this.valid);
696
706
  }
697
707
  /*************
@@ -707,13 +717,13 @@ const MgInputCombobox = class {
707
717
  // Validate
708
718
  this.watchIdentifier(this.identifier);
709
719
  this.watchItems(this.items);
710
- if (Boolean(this.fetchurl)) {
720
+ if (this.fetchurl !== undefined) {
711
721
  this.watchFetchOptions(this.fetchoptions);
712
722
  this.watchFetchMappings(this.fetchmappings);
713
723
  this.loadingWrapper({ name: 'load-data' });
714
724
  }
715
725
  this.watchValue(this.value);
716
- this.watchOptions(this.options);
726
+ this.watchOptions();
717
727
  this.watchMgWidth(this.mgWidth);
718
728
  this.watchReadonly(this.readonly);
719
729
  this.watchDisabled(this.disabled);
@@ -734,14 +744,17 @@ const MgInputCombobox = class {
734
744
  const readonlyValue = this.getValueTitle();
735
745
  const withResetButton = this.value && !this.disabled;
736
746
  let popoverContent;
737
- if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0)
747
+ if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0) {
738
748
  popoverContent = 'list';
739
- else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && Boolean(this.filter))
749
+ }
750
+ else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && this.filter.length > 0) {
740
751
  popoverContent = 'notfound';
741
- else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0)
752
+ }
753
+ else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0) {
742
754
  popoverContent = 'notavailable';
755
+ }
743
756
  let activeDescendant;
744
- if (Boolean((_d = this.option) === null || _d === void 0 ? void 0 : _d.value)) {
757
+ if (((_d = this.option) === null || _d === void 0 ? void 0 : _d.value) !== undefined) {
745
758
  activeDescendant = this.option.value;
746
759
  }
747
760
  else if (typeof this.value === 'string') {
@@ -750,8 +763,8 @@ const MgInputCombobox = class {
750
763
  else {
751
764
  activeDescendant = (_e = this.value) === null || _e === void 0 ? void 0 : _e.value;
752
765
  }
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,
766
+ return (h("mg-input", { key: 'fd5a59f1e0bf31342a3bf935a60a2877e5df1772', 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: {
767
+ '--mg-c-input-list-width': ((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) > 0 ? `${this.input.offsetWidth}px` : undefined,
755
768
  }, "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
769
  if (el !== null)
757
770
  this.input = el;
@@ -765,7 +778,7 @@ const MgInputCombobox = class {
765
778
  'mg-c-input__input-list-item': true,
766
779
  'mg-c-input__input-list-item--focus-visible': JSON.stringify((_a = this.option) === null || _a === void 0 ? void 0 : _a.value) === JSON.stringify(option.value),
767
780
  'mg-c-input__input-list-item--selected': this.isCurrentOption(option),
768
- }, key: option.title, id: formatID(option.value), "aria-selected": this.isCurrentOption(option).toString(), onClick: this.handleOptionClick }, option.title, this.isCurrentOption(option) && h("mg-icon", { icon: "check" })));
781
+ }, key: option.title, id: formatID(option.value), "aria-selected": this.isCurrentOption(option).toString(), "data-value": toString(option.value), onClick: this.handleOptionClick }, option.title, this.isCurrentOption(option) && h("mg-icon", { icon: "check" })));
769
782
  })),
770
783
  this.isLoading && h("mg-loader", { key: "loader", message: this.messages.input.combobox.search, class: { 'mg-u-visually-hidden': Boolean(this.page.next) } }),
771
784
  this.page.next && (h("mg-button", { key: "load-more", variant: "flat", class: "mg-c-input__load-more", tabIndex: -1, disabled: this.isLoading, "full-width": true, "disable-on-click": true, onClick: this.handleLoadMoreButton, "aria-controls": listId, ref: (el) => {
@@ -1,6 +1,6 @@
1
- import { r as registerInstance, c as createEvent, h, a as getElement } from './index-T6kOJXP1.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';
1
+ import { r as registerInstance, c as createEvent, h, a as getElement } from './index-BluNKQ3L.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-DDnrE1hD.js';
4
4
  import { i as initLocales } from './index-CNX6lq0x.js';
5
5
 
6
6
  /** Detect free variable `global` from Node.js. */
@@ -16387,8 +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
- // Classes
16391
- this.classFocus = 'mg-u-is-focused';
16390
+ this.customErrorMessage = { lock: false };
16392
16391
  /**
16393
16392
  * Define the value of the editor
16394
16393
  * Can be either HTML string or plain text
@@ -16452,27 +16451,29 @@ const MgInputRichTextEditor = class {
16452
16451
  };
16453
16452
  /**
16454
16453
  * Set input error message
16455
- * @param errorMessage - errorMessage override
16454
+ * @param fromSetErrorContext - context come from `setError` method
16456
16455
  */
16457
- this.setErrorMessage = (errorMessage) => {
16456
+ this.setErrorMessage = (fromSetErrorContext = false) => {
16457
+ // Set error message
16458
16458
  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;
16459
+ // Does have a new custom error message
16460
+ if (!this.valid) {
16461
+ // Does have a new custom error message OR does have a custom error message locked
16462
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
16463
+ this.errorMessage = this.customErrorMessage.message;
16464
+ }
16465
+ else if (this.required && this.isEmpty()) {
16466
+ this.errorMessage = this.messages.errors.required;
16467
+ }
16468
+ else if (!this.getPatternValidity()) {
16469
+ this.errorMessage = this.patternErrorMessage;
16470
+ }
16469
16471
  }
16470
16472
  };
16471
16473
  /**
16472
16474
  * Handle focus event
16473
16475
  */
16474
16476
  this.handleFocus = () => {
16475
- this.classCollection.add(this.classFocus);
16476
16477
  this.classCollection = new ClassList(this.classCollection.classes);
16477
16478
  };
16478
16479
  /**
@@ -16481,7 +16482,6 @@ const MgInputRichTextEditor = class {
16481
16482
  */
16482
16483
  this.handleBlur = () => {
16483
16484
  // Manage focus
16484
- this.classCollection.delete(this.classFocus);
16485
16485
  this.classCollection = new ClassList(this.classCollection.classes);
16486
16486
  if (!this.readonly) {
16487
16487
  this.checkValidity();
@@ -16549,7 +16549,7 @@ const MgInputRichTextEditor = class {
16549
16549
  * Get editor content as HTML
16550
16550
  * @returns HTML content of the editor
16551
16551
  */
16552
- async getHTML() {
16552
+ getHTML() {
16553
16553
  return new Promise(resolve => {
16554
16554
  requestAnimationFrame(() => {
16555
16555
  resolve(this.editor.getSemanticHTML());
@@ -16593,17 +16593,22 @@ const MgInputRichTextEditor = class {
16593
16593
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
16594
16594
  * @param valid - value indicating the validity
16595
16595
  * @param errorMessage - the error message to display
16596
+ * @param errorMessageLock - lock the error message and validity state
16596
16597
  */
16597
- async setError(valid, errorMessage) {
16598
+ async setError(valid, errorMessage, errorMessageLock = false) {
16598
16599
  if (typeof valid !== 'boolean') {
16599
16600
  throw new Error('<mg-input-rich-text-editor> method "setError()" param "valid" must be a boolean.');
16600
16601
  }
16601
- else if (!isValidString(errorMessage)) {
16602
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
16602
16603
  throw new Error('<mg-input-rich-text-editor> method "setError()" param "errorMessage" must be a string.');
16603
16604
  }
16604
16605
  else {
16606
+ this.customErrorMessage = {
16607
+ lock: valid ? false : errorMessageLock,
16608
+ message: valid ? undefined : errorMessage,
16609
+ };
16605
16610
  this.setValidity(valid);
16606
- this.setErrorMessage(valid ? undefined : errorMessage);
16611
+ this.setErrorMessage(true);
16607
16612
  this.hasDisplayedError = this.invalid;
16608
16613
  }
16609
16614
  }
@@ -16622,6 +16627,8 @@ const MgInputRichTextEditor = class {
16622
16627
  // - Keep everything in sync both inside and outside the component
16623
16628
  return new Promise(resolve => {
16624
16629
  requestAnimationFrame(() => {
16630
+ // unlock validity check by reseting customErrorMessage
16631
+ this.customErrorMessage = { lock: false };
16625
16632
  this.checkValidity();
16626
16633
  this.errorMessage = undefined;
16627
16634
  this.hasDisplayedError = false;
@@ -16635,10 +16642,12 @@ const MgInputRichTextEditor = class {
16635
16642
  * @param newValue - valid new value
16636
16643
  */
16637
16644
  setValidity(newValue) {
16638
- const oldValidValue = this.valid;
16639
- this.valid = newValue;
16645
+ const oldValue = this.valid;
16646
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
16647
+ this.valid = newValue;
16648
+ }
16640
16649
  this.invalid = !this.valid;
16641
- if (this.valid !== oldValidValue) {
16650
+ if (this.valid !== oldValue) {
16642
16651
  this.inputValid.emit(this.valid);
16643
16652
  }
16644
16653
  }
@@ -16687,7 +16696,7 @@ const MgInputRichTextEditor = class {
16687
16696
  * @returns HTML mg-input Element
16688
16697
  */
16689
16698
  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 => {
16699
+ return (h("mg-input", { key: '5e807e1059704a6624a1fda63ab56a6f9a51230f', 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
16700
  this.wrapperElement = el;
16692
16701
  }, id: this.identifier, class: "mg-c-input__wrapper" }, h("div", null)))));
16693
16702
  }
@@ -6,9 +6,14 @@ 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';
17
+ const classDisplayCharacterLeft = 'mg-c-input--display-character-left';
13
18
 
14
- export { classDisabled as a, classFieldset as b, classReadonly as c, classVerticalList as d, tooltipPositions as t, widths as w };
19
+ export { classDisabled as a, classFieldset as b, classReadonly as c, classVerticalList as d, classDisplayCharacterLeft as e, labelHeadings as l, tooltipPositions as t, widths as w };