@mgdis/mg-components 6.14.0 → 6.15.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 (150) hide show
  1. package/dist/cjs/{index-DzBkSgSK.js → index-BGxkpQwi.js} +7 -1
  2. package/dist/cjs/{index-DUJwxnoi.js → index-CpENFzEo.js} +2 -2
  3. package/dist/cjs/{index-CwjAofQ1.js → index-iUZvsp-F.js} +55 -31
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/mg-action-more_37.cjs.entry.js +431 -208
  6. package/dist/cjs/mg-alert.cjs.entry.js +4 -4
  7. package/dist/cjs/mg-components.cjs.js +3 -3
  8. package/dist/cjs/mg-input-combobox.cjs.entry.js +145 -81
  9. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +1248 -16004
  10. package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-CwjEAih3.js} +7 -0
  11. package/dist/cjs/mg-input.utils-D-ASK4ua.js +49 -0
  12. package/dist/cjs/mg-loader.cjs.entry.js +4 -4
  13. package/dist/cjs/mg-progress.cjs.entry.js +3 -3
  14. package/dist/collection/assets/icons/index.js +1 -1
  15. package/dist/collection/collection-manifest.json +2 -2
  16. package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
  17. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
  18. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +93 -22
  19. package/dist/collection/components/molecules/inputs/mg-input/mg-input.utils.js +21 -0
  20. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -1
  21. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +49 -106
  22. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +123 -48
  23. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +140 -56
  24. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +6 -1
  26. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +63 -10
  28. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +1 -1
  29. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +54 -6
  30. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
  31. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  32. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +142 -9
  33. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
  34. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
  35. package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
  36. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  37. package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
  38. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  39. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  40. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  41. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  42. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
  43. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  44. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  45. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  46. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  47. package/dist/collection/components/molecules/mg-table/mg-table.js +2 -2
  48. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  49. package/dist/collection/locales/en/messages.json +23 -14
  50. package/dist/collection/locales/fr/messages.json +24 -15
  51. package/dist/components/index2.js +3 -3
  52. package/dist/components/index3.js +55 -31
  53. package/dist/components/mg-action-more.js +2 -2
  54. package/dist/components/mg-alert.js +2 -2
  55. package/dist/components/mg-badge2.js +1 -1
  56. package/dist/components/mg-button2.js +1 -1
  57. package/dist/components/mg-card2.js +1 -1
  58. package/dist/components/mg-character-left2.js +1 -1
  59. package/dist/components/mg-details.js +1 -97
  60. package/dist/components/mg-details2.js +99 -0
  61. package/dist/components/mg-divider2.js +1 -1
  62. package/dist/components/mg-form.js +2 -2
  63. package/dist/components/mg-icon2.js +1 -1
  64. package/dist/components/mg-illustrated-message.js +2 -2
  65. package/dist/components/mg-input-checkbox-paginated2.js +43 -124
  66. package/dist/components/mg-input-checkbox.js +136 -62
  67. package/dist/components/mg-input-combobox.js +135 -63
  68. package/dist/components/mg-input-date.js +9 -3
  69. package/dist/components/mg-input-numeric.js +14 -3
  70. package/dist/components/mg-input-password.js +10 -4
  71. package/dist/components/mg-input-radio.js +54 -13
  72. package/dist/components/mg-input-rich-text-editor.js +1266 -16016
  73. package/dist/components/mg-input-select2.js +45 -9
  74. package/dist/components/mg-input-text2.js +10 -4
  75. package/dist/components/mg-input-textarea.js +10 -4
  76. package/dist/components/mg-input-title2.js +1 -1
  77. package/dist/components/mg-input-toggle.js +97 -12
  78. package/dist/components/mg-input.utils.js +24 -0
  79. package/dist/components/mg-input2.js +100 -23
  80. package/dist/components/mg-item-more2.js +2 -2
  81. package/dist/components/mg-loader2.js +2 -2
  82. package/dist/components/mg-menu-item2.js +1 -1
  83. package/dist/components/mg-message2.js +3 -3
  84. package/dist/components/mg-modal.js +3 -3
  85. package/dist/components/mg-pagination.js +233 -1
  86. package/dist/components/mg-panel.js +14 -8
  87. package/dist/components/mg-popover-content2.js +2 -2
  88. package/dist/components/mg-popover2.js +2 -2
  89. package/dist/components/mg-progress.js +2 -2
  90. package/dist/components/mg-skip-links.js +2 -2
  91. package/dist/components/mg-table.js +3 -3
  92. package/dist/components/mg-tabs.js +1 -311
  93. package/dist/components/mg-tabs2.js +313 -0
  94. package/dist/components/mg-tag.js +1 -1
  95. package/dist/components/mg-tooltip-content2.js +1 -1
  96. package/dist/components/mg-tooltip2.js +2 -2
  97. package/dist/esm/{index-Bv7NHR-W.js → index-CKB-AnCZ.js} +55 -31
  98. package/dist/esm/{index-Degtjvph.js → index-DhAOnZJn.js} +7 -1
  99. package/dist/esm/{index-Dr7GYvIz.js → index-WtiuOkLj.js} +2 -2
  100. package/dist/esm/loader.js +3 -3
  101. package/dist/esm/mg-action-more_37.entry.js +426 -203
  102. package/dist/esm/mg-alert.entry.js +4 -4
  103. package/dist/esm/mg-components.js +4 -4
  104. package/dist/esm/mg-input-combobox.entry.js +125 -61
  105. package/dist/esm/mg-input-rich-text-editor.entry.js +1249 -16005
  106. package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-BAUTlb6r.js} +7 -1
  107. package/dist/esm/mg-input.utils-BYI03zSi.js +46 -0
  108. package/dist/esm/mg-loader.entry.js +4 -4
  109. package/dist/esm/mg-progress.entry.js +3 -3
  110. package/dist/mg-components/locales/en/messages.json +23 -14
  111. package/dist/mg-components/locales/fr/messages.json +24 -15
  112. package/dist/mg-components/mg-components.esm.js +1 -1
  113. package/dist/mg-components/p-31856cff.entry.js +1 -0
  114. package/dist/mg-components/{p-056ba467.entry.js → p-420daa1e.entry.js} +1 -1
  115. package/dist/mg-components/{p-d13a6fdc.entry.js → p-47e19783.entry.js} +1 -1
  116. package/dist/mg-components/p-67af6274.entry.js +1 -0
  117. package/dist/mg-components/p-698dfc6c.entry.js +1 -0
  118. package/dist/mg-components/p-BAUTlb6r.js +1 -0
  119. package/dist/mg-components/p-CKB-AnCZ.js +1 -0
  120. package/dist/mg-components/p-DhAOnZJn.js +2 -0
  121. package/dist/mg-components/p-PuX-pdL4.js +1 -0
  122. package/dist/mg-components/p-WtiuOkLj.js +1 -0
  123. package/dist/mg-components/p-a0fa44cf.entry.js +1 -0
  124. package/dist/types/assets/icons/index.d.ts +6 -0
  125. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +13 -0
  126. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +15 -4
  127. package/dist/types/components/molecules/inputs/mg-input/mg-input.utils.d.ts +8 -0
  128. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +17 -40
  129. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +1 -2
  130. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +36 -9
  131. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +17 -3
  132. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +18 -0
  133. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +18 -0
  134. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +40 -4
  135. package/dist/types/components.d.ts +69 -40
  136. package/ide/intellij/web-types.json +148 -22
  137. package/ide/vscode/html-custom-data.json +143 -9
  138. package/package.json +15 -15
  139. package/dist/cjs/events.utils-D5SAtkpQ.js +0 -25
  140. package/dist/components/mg-pagination2.js +0 -229
  141. package/dist/esm/events.utils-yMGqY8YG.js +0 -23
  142. package/dist/mg-components/p-625c463c.entry.js +0 -1
  143. package/dist/mg-components/p-Bv7NHR-W.js +0 -1
  144. package/dist/mg-components/p-CNgv8hc5.js +0 -1
  145. package/dist/mg-components/p-Degtjvph.js +0 -2
  146. package/dist/mg-components/p-Dr7GYvIz.js +0 -1
  147. package/dist/mg-components/p-c522f3c1.entry.js +0 -1
  148. package/dist/mg-components/p-cac23bd7.entry.js +0 -1
  149. package/dist/mg-components/p-e75f5383.entry.js +0 -10
  150. package/dist/mg-components/p-yMGqY8YG.js +0 -1
@@ -2,12 +2,14 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
2
2
  import { C as ClassList, d as allItemsAreString, t as toString, i as isValidString } from './index2.js';
3
3
  import { d as defineCustomElement$4, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
4
4
  import { i as initLocales } from './index3.js';
5
+ import { d as defineErrorMessage } from './mg-input.utils.js';
6
+ import { d as defineCustomElement$6 } from './mg-details2.js';
5
7
  import { d as defineCustomElement$5 } from './mg-icon2.js';
6
8
  import { d as defineCustomElement$3 } from './mg-input-title2.js';
7
9
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
8
10
  import { d as defineCustomElement$1 } from './mg-tooltip-content2.js';
9
11
 
10
- const mgInputSelectCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
12
+ const mgInputSelectCss = ".mg-c-input__error-details{margin:0}.mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
11
13
 
12
14
  /**
13
15
  * Check if item is a well configured option
@@ -145,6 +147,16 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
145
147
  * @returns truthy if input.value is an item
146
148
  */
147
149
  this.isInputValue = (item) => { var _a; return item.title === ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value); };
150
+ /**
151
+ * Test if component has items
152
+ * @returns truthy if component has items
153
+ */
154
+ this.hasInputValue = () => { var _a; return ((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) > 0; };
155
+ /**
156
+ * Test if component has no value error message displayed
157
+ * @returns truthy if compent display no value error message
158
+ */
159
+ this.hasNoValueErrorMessageDisplay = () => this.errorMessage === this.messages.errors.noValue;
148
160
  /**
149
161
  * Handle blur event
150
162
  */
@@ -164,7 +176,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
164
176
  * Check if input is valid
165
177
  */
166
178
  this.checkValidity = () => {
167
- this.setValidity(!this.isDisabledValue() && (this.readonly || this.disabled || this.input.checkValidity()));
179
+ this.setValidity(!this.isDisabledValue() && (this.readonly || this.disabled || (this.hasInputValue() && this.input.checkValidity())));
168
180
  };
169
181
  /**
170
182
  * Set input error message
@@ -177,11 +189,22 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
177
189
  if (errorMessage !== undefined) {
178
190
  this.errorMessage = errorMessage;
179
191
  }
192
+ else if (!this.hasInputValue()) {
193
+ this.errorMessage = this.messages.errors.noValue;
194
+ }
180
195
  else if (this.input.validity.valueMissing) {
181
196
  this.errorMessage = this.messages.errors.required;
182
197
  }
183
198
  }
184
199
  };
200
+ /**
201
+ * Reset error message
202
+ */
203
+ this.resetErrorMessage = () => {
204
+ this.checkValidity();
205
+ this.errorMessage = undefined;
206
+ this.hasDisplayedError = false;
207
+ };
185
208
  /**
186
209
  * Render option
187
210
  * @param option - to render
@@ -199,9 +222,11 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
199
222
  this.valueChange.emit(newValue);
200
223
  }
201
224
  validateItems(newValue) {
225
+ let resetMessage = false;
202
226
  // Empty options
203
- if (newValue.length === 0) {
227
+ if ([undefined, null].includes(newValue) || (Array.isArray(newValue) && newValue.length === 0)) {
204
228
  this.options = [];
229
+ this.displayError();
205
230
  }
206
231
  // String array
207
232
  else if (allItemsAreString(newValue)) {
@@ -209,6 +234,8 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
209
234
  this.valueExist = newValue.includes(this.value);
210
235
  }
211
236
  this.options = newValue.map(item => ({ title: item, value: item }));
237
+ // force to reset error when noValueError is displaied
238
+ resetMessage = this.invalid && this.hasNoValueErrorMessageDisplay();
212
239
  }
213
240
  // Object array
214
241
  else if (allItemsAreOptions(newValue)) {
@@ -221,10 +248,15 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
221
248
  else {
222
249
  this.options = newValue;
223
250
  }
251
+ // force to reset error when noValueError is displaied
252
+ resetMessage = this.invalid && this.hasNoValueErrorMessageDisplay();
224
253
  }
225
254
  else {
226
255
  throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${toString(newValue)}.`);
227
256
  }
257
+ if (resetMessage) {
258
+ this.resetErrorMessage();
259
+ }
228
260
  }
229
261
  watchReadonly(newValue) {
230
262
  if (newValue)
@@ -318,9 +350,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
318
350
  // - Keep everything in sync both inside and outside the component
319
351
  return new Promise(resolve => {
320
352
  requestAnimationFrame(() => {
321
- this.checkValidity();
322
- this.errorMessage = undefined;
323
- this.hasDisplayedError = false;
353
+ this.resetErrorMessage();
324
354
  resolve();
325
355
  });
326
356
  });
@@ -372,7 +402,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
372
402
  */
373
403
  render() {
374
404
  const readonlyValue = this.getReadonlyValue();
375
- return (h("mg-input", { key: '2a0599578526b7c110b8f8e01dcb233ed2d523cf', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
405
+ return (h("mg-input", { key: 'b980e7e5bd2e1eac6e0075e61f3a6d8ab993216a', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: defineErrorMessage(this.errorMessage, this.noValueErrorDetail) }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled || !this.hasInputValue(), required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
376
406
  if (el !== null)
377
407
  this.input = el;
378
408
  } }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
@@ -388,7 +418,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
388
418
  "mgWidth": ["watchMgWidth"]
389
419
  }; }
390
420
  static get style() { return mgInputSelectCss; }
391
- }, [1, "mg-input-select", {
421
+ }, [257, "mg-input-select", {
392
422
  "value": [1032],
393
423
  "items": [16],
394
424
  "identifier": [1],
@@ -406,6 +436,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
406
436
  "tooltip": [1],
407
437
  "tooltipPosition": [1, "tooltip-position"],
408
438
  "helpText": [1, "help-text"],
439
+ "noValueErrorDetail": [1, "no-value-error-detail"],
409
440
  "valid": [1028],
410
441
  "invalid": [1028],
411
442
  "classCollection": [32],
@@ -428,13 +459,18 @@ function defineCustomElement() {
428
459
  if (typeof customElements === "undefined") {
429
460
  return;
430
461
  }
431
- const components = ["mg-input-select", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
462
+ const components = ["mg-input-select", "mg-details", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
432
463
  components.forEach(tagName => { switch (tagName) {
433
464
  case "mg-input-select":
434
465
  if (!customElements.get(tagName)) {
435
466
  customElements.define(tagName, MgInputSelect);
436
467
  }
437
468
  break;
469
+ case "mg-details":
470
+ if (!customElements.get(tagName)) {
471
+ defineCustomElement$6();
472
+ }
473
+ break;
438
474
  case "mg-icon":
439
475
  if (!customElements.get(tagName)) {
440
476
  defineCustomElement$5();
@@ -2,7 +2,8 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
2
2
  import { C as ClassList, i as isValidString, d as allItemsAreString, t as toString } from './index2.js';
3
3
  import { d as defineCustomElement$4, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
4
4
  import { i as initLocales } from './index3.js';
5
- import { d as defineCustomElement$6 } from './mg-character-left2.js';
5
+ import { d as defineCustomElement$7 } from './mg-character-left2.js';
6
+ import { d as defineCustomElement$6 } from './mg-details2.js';
6
7
  import { d as defineCustomElement$5 } from './mg-icon2.js';
7
8
  import { d as defineCustomElement$3 } from './mg-input-title2.js';
8
9
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
@@ -382,7 +383,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
382
383
  * @returns HTML Element
383
384
  */
384
385
  render() {
385
- return (h("mg-input", { key: 'e8249550f7077c38f87b768ef68837dec35cd08e', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
386
+ return (h("mg-input", { key: '8b9ffd8f5546fe9ffe0e7054e794afa06de4189f', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
386
387
  ? this.value && this.renderReadonly()
387
388
  : [
388
389
  h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
@@ -409,7 +410,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
409
410
  "helpText": ["watchHelpText"]
410
411
  }; }
411
412
  static get style() { return mgInputTextCss; }
412
- }, [1, "mg-input-text", {
413
+ }, [257, "mg-input-text", {
413
414
  "value": [1544],
414
415
  "identifier": [1],
415
416
  "name": [1],
@@ -456,7 +457,7 @@ function defineCustomElement() {
456
457
  if (typeof customElements === "undefined") {
457
458
  return;
458
459
  }
459
- const components = ["mg-input-text", "mg-character-left", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
460
+ const components = ["mg-input-text", "mg-character-left", "mg-details", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
460
461
  components.forEach(tagName => { switch (tagName) {
461
462
  case "mg-input-text":
462
463
  if (!customElements.get(tagName)) {
@@ -464,6 +465,11 @@ function defineCustomElement() {
464
465
  }
465
466
  break;
466
467
  case "mg-character-left":
468
+ if (!customElements.get(tagName)) {
469
+ defineCustomElement$7();
470
+ }
471
+ break;
472
+ case "mg-details":
467
473
  if (!customElements.get(tagName)) {
468
474
  defineCustomElement$6();
469
475
  }
@@ -2,7 +2,8 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
2
2
  import { C as ClassList, i as isValidString, t as toString } from './index2.js';
3
3
  import { d as defineCustomElement$5, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
4
4
  import { i as initLocales } from './index3.js';
5
- import { d as defineCustomElement$7 } from './mg-character-left2.js';
5
+ import { d as defineCustomElement$8 } from './mg-character-left2.js';
6
+ import { d as defineCustomElement$7 } from './mg-details2.js';
6
7
  import { d as defineCustomElement$6 } from './mg-icon2.js';
7
8
  import { d as defineCustomElement$4 } from './mg-input-title2.js';
8
9
  import { d as defineCustomElement$3 } from './mg-tooltip2.js';
@@ -302,7 +303,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
302
303
  * @returns HTML Element
303
304
  */
304
305
  render() {
305
- return (h("mg-input", { key: 'b52470b9b12c35a62d656609ea345a0545d2429b', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
306
+ return (h("mg-input", { key: 'e87320fe4d3c2c857751ddcc30fab470956b4ed2', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
306
307
  'mg-c-input__box': true,
307
308
  'mg-c-input__box--width': true,
308
309
  'mg-c-input__box--resizable': this.resizable === 'both',
@@ -325,7 +326,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
325
326
  "characterLeftHide": ["validatecharacterLeftHide"]
326
327
  }; }
327
328
  static get style() { return mgInputTextareaCss; }
328
- }, [1, "mg-input-textarea", {
329
+ }, [257, "mg-input-textarea", {
329
330
  "value": [1537],
330
331
  "identifier": [1],
331
332
  "name": [1],
@@ -368,7 +369,7 @@ function defineCustomElement$1() {
368
369
  if (typeof customElements === "undefined") {
369
370
  return;
370
371
  }
371
- const components = ["mg-input-textarea", "mg-character-left", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
372
+ const components = ["mg-input-textarea", "mg-character-left", "mg-details", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
372
373
  components.forEach(tagName => { switch (tagName) {
373
374
  case "mg-input-textarea":
374
375
  if (!customElements.get(tagName)) {
@@ -376,6 +377,11 @@ function defineCustomElement$1() {
376
377
  }
377
378
  break;
378
379
  case "mg-character-left":
380
+ if (!customElements.get(tagName)) {
381
+ defineCustomElement$8();
382
+ }
383
+ break;
384
+ case "mg-details":
379
385
  if (!customElements.get(tagName)) {
380
386
  defineCustomElement$7();
381
387
  }
@@ -51,7 +51,7 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class MgInputTitle extends
51
51
  "isLegend": ["validateIsLegend"]
52
52
  }; }
53
53
  static get style() { return mgInputTitleCss; }
54
- }, [6, "mg-input-title", {
54
+ }, [262, "mg-input-title", {
55
55
  "identifier": [1],
56
56
  "required": [4],
57
57
  "readonly": [4],
@@ -1,12 +1,15 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { C as ClassList, t as toString, d as allItemsAreString, i as isValidString } from './index2.js';
3
3
  import { d as defineCustomElement$5, c as classReadonly, a as classDisabled } from './mg-input2.js';
4
+ import { i as initLocales } from './index3.js';
5
+ import { d as defineErrorMessage } from './mg-input.utils.js';
6
+ import { d as defineCustomElement$7 } from './mg-details2.js';
4
7
  import { d as defineCustomElement$6 } from './mg-icon2.js';
5
8
  import { d as defineCustomElement$4 } from './mg-input-title2.js';
6
9
  import { d as defineCustomElement$3 } from './mg-tooltip2.js';
7
10
  import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
8
11
 
9
- const mgInputToggleCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__toggle-item-container{overflow:hidden;box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border:0;border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4))/var(--mg-c-input-toggle-border-radius-ratio));background-color:unset;color:var(--mg-b-color-dark);font-weight:unset;text-overflow:ellipsis;white-space:nowrap}.mg-c-input__toggle-item-container:first-of-type{background-color:color-mix(in srgb, var(--mg-b-color-app), white 80%);color:var(--mg-b-color-app);font-weight:600}.mg-c-input__button-toggle{display:flex;min-width:0;padding:var(--mg-b-size-4);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*(var(--mg-b-size-4) + var(--mg-b-size-4) + var(--mg-c-input-border-width)))/var(--mg-c-input-toggle-border-radius-ratio));background-color:var(--mg-b-color-light);cursor:pointer;font-family:var(--mg-b-font-family);font-size:inherit;line-height:inherit}.mg-c-input__button-toggle:disabled{cursor:default}.mg-c-input.mg-c-input--toggle .mg-c-input__input-container{min-width:0;flex:auto}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{background-color:unset;color:var(--mg-b-color-dark);font-weight:unset}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{background-color:color-mix(in srgb, var(--mg-b-color-app), white 80%);color:var(--mg-b-color-info);font-weight:600}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container{display:flex;width:calc(var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4));height:calc(var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4));align-items:center;justify-content:center;padding:0;visibility:hidden}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:first-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{visibility:hidden}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-on-off .mg-c-input__toggle-item-container:first-of-type{background-color:var(--mg-b-color-neutral-30);color:var(--mg-b-color-dark);font-weight:600}.mg-c-input.mg-c-input--toggle-on-off.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{background-color:unset;color:var(--mg-b-color-dark);font-weight:unset}";
12
+ const mgInputToggleCss = ".mg-c-input__error-details{margin:0}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__toggle-item-container{overflow:hidden;box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border:0;border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4))/var(--mg-c-input-toggle-border-radius-ratio));background-color:unset;color:var(--mg-b-color-dark);font-weight:unset;text-overflow:ellipsis;white-space:nowrap}.mg-c-input__toggle-item-container:first-of-type{background-color:color-mix(in srgb, var(--mg-b-color-app), white 80%);color:var(--mg-b-color-app);font-weight:600}.mg-c-input__button-toggle{display:flex;min-width:0;padding:var(--mg-b-size-4);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:calc((var(--mg-b-font-size)*var(--mg-b-line-height) + 2*(var(--mg-b-size-4) + var(--mg-b-size-4) + var(--mg-c-input-border-width)))/var(--mg-c-input-toggle-border-radius-ratio));background-color:var(--mg-b-color-light);cursor:pointer;font-family:var(--mg-b-font-family);font-size:inherit;line-height:inherit}.mg-c-input__button-toggle:disabled{cursor:default}.mg-c-input.mg-c-input--toggle .mg-c-input__input-container{min-width:0;flex:auto}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{background-color:unset;color:var(--mg-b-color-dark);font-weight:unset}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{background-color:color-mix(in srgb, var(--mg-b-color-app), white 80%);color:var(--mg-b-color-info);font-weight:600}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container{display:flex;width:calc(var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4));height:calc(var(--mg-b-font-size)*var(--mg-b-line-height) + 2*var(--mg-b-size-4));align-items:center;justify-content:center;padding:0;visibility:hidden}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:first-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{visibility:hidden}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-on-off .mg-c-input__toggle-item-container:first-of-type{background-color:var(--mg-b-color-neutral-30);color:var(--mg-b-color-dark);font-weight:600}.mg-c-input.mg-c-input--toggle-on-off.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{background-color:unset;color:var(--mg-b-color-dark);font-weight:unset}";
10
13
 
11
14
  /**
12
15
  * type Option validation function
@@ -66,6 +69,29 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
66
69
  * Checked internal value
67
70
  */
68
71
  this.checked = false;
72
+ /**
73
+ * Check if input is valid
74
+ */
75
+ this.checkValidity = () => {
76
+ this.setValidity(this.readonly || this.disabled || this.hasInputItems());
77
+ };
78
+ /**
79
+ * Reset error message
80
+ */
81
+ this.resetErrorMessage = () => {
82
+ this.checkValidity();
83
+ this.errorMessage = undefined;
84
+ };
85
+ /**
86
+ * Test if component has items
87
+ * @returns truthy if component has items
88
+ */
89
+ this.hasInputItems = () => { var _a; return ((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) > 0; };
90
+ /**
91
+ * Test if component has no value error message displayed
92
+ * @returns truthy if compent display no value error message
93
+ */
94
+ this.hasNoValueErrorMessageDisplay = () => this.errorMessage === this.messages.errors.noValue;
69
95
  /**
70
96
  * Set input error message
71
97
  * @param errorMessage - errorMessage override
@@ -74,8 +100,13 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
74
100
  // Set error message
75
101
  this.errorMessage = undefined;
76
102
  // Does have a custom error message
77
- if (!this.valid && errorMessage !== undefined) {
78
- this.errorMessage = errorMessage;
103
+ if (!this.valid) {
104
+ if (errorMessage !== undefined) {
105
+ this.errorMessage = errorMessage;
106
+ }
107
+ else if (!this.hasInputItems()) {
108
+ this.errorMessage = this.messages.errors.noValue;
109
+ }
79
110
  }
80
111
  };
81
112
  /**
@@ -90,7 +121,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
90
121
  this.validateSlots = () => {
91
122
  const slots = Array.from(this.element.children);
92
123
  if (slots.length !== 2) {
93
- throw new Error('<mg-input-toggle> 2 slots are required.');
124
+ console.error('<mg-input-toggle> 2 slots are required.');
94
125
  }
95
126
  else if (!this.isIcon) {
96
127
  // Due to text-overflow set to ellipsis
@@ -121,16 +152,28 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
121
152
  this.valueChange.emit(newValue);
122
153
  }
123
154
  validateItems(newValue) {
124
- if (typeof newValue === 'object' && this.items.length !== 2) {
155
+ if ([undefined, null].includes(newValue) || (Array.isArray(newValue) && newValue.length === 0)) {
156
+ this.options = [];
157
+ this.displayError();
158
+ }
159
+ else if (Array.isArray(newValue) && this.items.length !== 2) {
125
160
  throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${toString(newValue)}.`);
126
161
  }
127
162
  // String array
128
163
  else if (allItemsAreString(newValue)) {
129
164
  this.options = newValue.map(item => ({ title: item, value: item }));
165
+ // force to reset error when noValueError is displaied
166
+ if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
167
+ this.resetErrorMessage();
168
+ }
130
169
  }
131
170
  // Object array
132
171
  else if (Array.isArray(newValue) && newValue.every(isOption)) {
133
172
  this.options = newValue;
173
+ // force to reset error when noValueError is displaied
174
+ if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
175
+ this.resetErrorMessage();
176
+ }
134
177
  }
135
178
  else {
136
179
  throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${toString(newValue)}.`);
@@ -192,8 +235,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
192
235
  throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
193
236
  }
194
237
  else {
195
- this.valid = valid;
196
- this.inputValid.emit(valid);
238
+ this.setValidity(valid);
197
239
  this.setErrorMessage(valid ? undefined : errorMessage);
198
240
  }
199
241
  }
@@ -212,12 +254,43 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
212
254
  // - Keep everything in sync both inside and outside the component
213
255
  return new Promise(resolve => {
214
256
  requestAnimationFrame(() => {
215
- this.errorMessage = undefined;
257
+ this.resetErrorMessage();
216
258
  resolve();
217
259
  });
218
260
  });
219
261
  }
220
262
  }
263
+ /**
264
+ * Display input error if it exists.
265
+ */
266
+ displayError() {
267
+ // Use `Promise` as requested for stencil method
268
+ // Use `requestAnimationFrame` to ensure:
269
+ // - DOM is fully updated before validation
270
+ // - Async operations are completed
271
+ // - No timing issues with Stencil's render cycle
272
+ // - Keep everything in sync both inside and outside the component
273
+ return new Promise(resolve => {
274
+ requestAnimationFrame(() => {
275
+ this.checkValidity();
276
+ this.setErrorMessage();
277
+ resolve();
278
+ });
279
+ });
280
+ }
281
+ /**
282
+ * Method to set validity values
283
+ * @param newValue - valid new value
284
+ */
285
+ setValidity(newValue) {
286
+ const oldValidValue = this.valid;
287
+ this.valid = newValue;
288
+ this.invalid = !this.valid;
289
+ // We need to send valid event even if it is the same value
290
+ if (this.valid !== oldValidValue) {
291
+ this.inputValid.emit(this.valid);
292
+ }
293
+ }
221
294
  /**
222
295
  * set checked state
223
296
  */
@@ -236,6 +309,9 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
236
309
  const selectedValue = this.value === this.options[optionTrueValueIndex].value;
237
310
  this.checked = optionTrueValueIndex === 0 ? !selectedValue : selectedValue;
238
311
  }
312
+ else if (Array.isArray(this.options) && this.options.length === 0) {
313
+ return;
314
+ }
239
315
  else {
240
316
  this.checked = this.value === this.options[1].value;
241
317
  }
@@ -247,6 +323,8 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
247
323
  * Check if component props are well configured on init
248
324
  */
249
325
  componentWillLoad() {
326
+ // Get locales
327
+ this.messages = initLocales(this.element).messages;
250
328
  // Check items format
251
329
  this.validateItems(this.items);
252
330
  // Check slots
@@ -265,7 +343,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
265
343
  */
266
344
  render() {
267
345
  const checkedItem = this.getCheckedItem(this.checked);
268
- return (h("mg-input", { key: '3cfa56cd1d8fdaba4e505027db7fae0385bac941', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked, ref: el => {
346
+ return (h("mg-input", { key: 'a17e505f60d3c7e37f18db5d5c94e8d4a03b3949', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: defineErrorMessage(this.errorMessage, this.noValueErrorDetail) }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly || !this.hasInputItems(), onClick: this.toggleChecked, ref: el => {
269
347
  if (el !== null)
270
348
  this.button = el;
271
349
  } }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
@@ -281,7 +359,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
281
359
  "checked": ["handleChecked"]
282
360
  }; }
283
361
  static get style() { return mgInputToggleCss; }
284
- }, [1, "mg-input-toggle", {
362
+ }, [257, "mg-input-toggle", {
285
363
  "value": [1032],
286
364
  "items": [16],
287
365
  "identifier": [1],
@@ -296,10 +374,12 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
296
374
  "tooltip": [1],
297
375
  "tooltipPosition": [1, "tooltip-position"],
298
376
  "helpText": [1, "help-text"],
377
+ "noValueErrorDetail": [1, "no-value-error-detail"],
378
+ "valid": [1028],
379
+ "invalid": [1028],
299
380
  "classCollection": [32],
300
381
  "options": [32],
301
382
  "errorMessage": [32],
302
- "valid": [32],
303
383
  "checked": [32],
304
384
  "setFocus": [64],
305
385
  "setError": [64],
@@ -317,13 +397,18 @@ function defineCustomElement$1() {
317
397
  if (typeof customElements === "undefined") {
318
398
  return;
319
399
  }
320
- const components = ["mg-input-toggle", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
400
+ const components = ["mg-input-toggle", "mg-details", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
321
401
  components.forEach(tagName => { switch (tagName) {
322
402
  case "mg-input-toggle":
323
403
  if (!customElements.get(tagName)) {
324
404
  customElements.define(tagName, MgInputToggle$1);
325
405
  }
326
406
  break;
407
+ case "mg-details":
408
+ if (!customElements.get(tagName)) {
409
+ defineCustomElement$7();
410
+ }
411
+ break;
327
412
  case "mg-icon":
328
413
  if (!customElements.get(tagName)) {
329
414
  defineCustomElement$6();
@@ -0,0 +1,24 @@
1
+ import { i as isValidString } from './index2.js';
2
+
3
+ /**
4
+ * Define error message
5
+ * @param message - message to display
6
+ * @param details - message detail to display
7
+ * @returns formated MgInput["errorMessage"]
8
+ */
9
+ const defineErrorMessage = (message, details) => {
10
+ if (isValidString(message) && isValidString(details)) {
11
+ return {
12
+ summary: message,
13
+ details,
14
+ };
15
+ }
16
+ else if (isValidString(message)) {
17
+ return message;
18
+ }
19
+ else {
20
+ return undefined;
21
+ }
22
+ };
23
+
24
+ export { defineErrorMessage as d };