@mgdis/mg-components 6.20.0 → 6.22.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 (205) hide show
  1. package/dist/cjs/{index-TUElr4Wv.js → index-BxB20_Vw.js} +54 -0
  2. package/dist/cjs/{index-Bp6wZzau.js → index-C2viYwrR.js} +1761 -80
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/mg-action-more_37.cjs.entry.js +761 -371
  5. package/dist/cjs/mg-alert.cjs.entry.js +17 -9
  6. package/dist/cjs/mg-breadcrumb.cjs.entry.js +63 -0
  7. package/dist/cjs/mg-components.cjs.js +3 -3
  8. package/dist/cjs/mg-fieldset.cjs.entry.js +24 -7
  9. package/dist/cjs/mg-input-combobox.cjs.entry.js +49 -19
  10. package/dist/cjs/mg-input-file.cjs.entry.js +384 -0
  11. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +40096 -15821
  12. package/dist/cjs/{mg-input.conf-D7jmj_lh.js → mg-input.conf-BNpeATnq.js} +7 -0
  13. package/dist/cjs/mg-loader.cjs.entry.js +8 -6
  14. package/dist/cjs/mg-progress.cjs.entry.js +19 -9
  15. package/dist/collection/assets/icons/index.js +1 -1
  16. package/dist/collection/collection-manifest.json +5 -3
  17. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +1 -1
  18. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +1 -1
  19. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
  20. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.js +2 -2
  22. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  23. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
  24. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
  26. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -2
  28. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
  29. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +1 -1
  30. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +1 -1
  31. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
  32. package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +877 -0
  33. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  34. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +2 -2
  35. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
  36. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/custom-properties.scss +212 -0
  37. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.js +1 -0
  38. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +300 -94
  39. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.js +29 -0
  40. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +163 -53
  41. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
  43. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
  45. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +3 -36
  46. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.conf.js +0 -4
  47. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +21 -43
  48. package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +65 -38
  49. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
  50. package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
  51. package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.js +1 -0
  52. package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.js +92 -0
  53. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  54. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +12 -3
  55. package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
  56. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  57. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  58. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  59. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  60. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
  61. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  62. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  63. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  64. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  65. package/dist/collection/components/molecules/mg-table/mg-table.js +37 -0
  66. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +0 -4
  67. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +13 -33
  68. package/dist/collection/locales/en/messages.json +14 -0
  69. package/dist/collection/locales/fr/messages.json +14 -0
  70. package/dist/components/events.utils.js +1 -23
  71. package/dist/components/index.d.ts +2 -0
  72. package/dist/components/index.js +1 -1
  73. package/dist/components/index2.js +1 -408
  74. package/dist/components/index3.js +1 -476
  75. package/dist/components/mg-action-more.js +1 -254
  76. package/dist/components/mg-alert.js +1 -224
  77. package/dist/components/mg-badge.js +1 -6
  78. package/dist/components/mg-badge2.js +1 -113
  79. package/dist/components/mg-breadcrumb.d.ts +11 -0
  80. package/dist/components/mg-breadcrumb.js +1 -0
  81. package/dist/components/mg-button.js +1 -6
  82. package/dist/components/mg-button2.js +1 -275
  83. package/dist/components/mg-card.js +1 -6
  84. package/dist/components/mg-card2.js +1 -92
  85. package/dist/components/mg-character-left.js +1 -6
  86. package/dist/components/mg-character-left2.js +1 -75
  87. package/dist/components/mg-details.js +1 -104
  88. package/dist/components/mg-divider.js +1 -6
  89. package/dist/components/mg-divider2.js +1 -49
  90. package/dist/components/mg-fieldset.js +1 -209
  91. package/dist/components/mg-form.js +1 -302
  92. package/dist/components/mg-icon.js +1 -6
  93. package/dist/components/mg-icon2.js +1 -188
  94. package/dist/components/mg-illustrated-message.js +1 -129
  95. package/dist/components/mg-input-checkbox-paginated.js +1 -6
  96. package/dist/components/mg-input-checkbox-paginated2.js +1 -135
  97. package/dist/components/mg-input-checkbox.js +1 -762
  98. package/dist/components/mg-input-combobox.js +1 -940
  99. package/dist/components/mg-input-date.js +1 -463
  100. package/dist/components/mg-input-file.d.ts +11 -0
  101. package/dist/components/mg-input-file.js +1 -0
  102. package/dist/components/mg-input-numeric.js +1 -592
  103. package/dist/components/mg-input-password.js +1 -360
  104. package/dist/components/mg-input-radio.js +1 -392
  105. package/dist/components/mg-input-rich-text-editor.js +1663 -16797
  106. package/dist/components/mg-input-select.js +1 -6
  107. package/dist/components/mg-input-select2.js +1 -481
  108. package/dist/components/mg-input-text.js +1 -6
  109. package/dist/components/mg-input-text2.js +1 -514
  110. package/dist/components/mg-input-textarea.js +1 -412
  111. package/dist/components/mg-input-title.js +1 -6
  112. package/dist/components/mg-input-title2.js +1 -81
  113. package/dist/components/mg-input-toggle.js +1 -371
  114. package/dist/components/mg-input.conf.js +1 -0
  115. package/dist/components/mg-input.js +1 -6
  116. package/dist/components/mg-input2.js +1 -459
  117. package/dist/components/mg-item-more.js +1 -6
  118. package/dist/components/mg-item-more2.js +1 -505
  119. package/dist/components/mg-loader.js +1 -6
  120. package/dist/components/mg-loader2.js +1 -74
  121. package/dist/components/mg-menu-item.js +1 -6
  122. package/dist/components/mg-menu-item2.js +1 -485
  123. package/dist/components/mg-menu.js +1 -6
  124. package/dist/components/mg-message.js +1 -6
  125. package/dist/components/mg-message2.js +1 -146
  126. package/dist/components/mg-modal.js +1 -184
  127. package/dist/components/mg-pagination.js +1 -234
  128. package/dist/components/mg-panel.js +1 -350
  129. package/dist/components/mg-popover-content.js +1 -6
  130. package/dist/components/mg-popover-content2.js +1 -96
  131. package/dist/components/mg-popover.js +1 -6
  132. package/dist/components/mg-popover2.js +1 -312
  133. package/dist/components/mg-progress.js +1 -123
  134. package/dist/components/mg-skip-links.js +1 -78
  135. package/dist/components/mg-table.js +1 -319
  136. package/dist/components/mg-tabs.js +1 -6
  137. package/dist/components/mg-tabs2.js +1 -315
  138. package/dist/components/mg-tag.js +1 -133
  139. package/dist/components/mg-tooltip-content.js +1 -6
  140. package/dist/components/mg-tooltip-content2.js +1 -42
  141. package/dist/components/mg-tooltip.js +1 -6
  142. package/dist/components/mg-tooltip2.js +1 -421
  143. package/dist/components/popper.js +1 -1790
  144. package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1761 -80
  145. package/dist/esm/{index-CNX6lq0x.js → index-DSEloqPn.js} +54 -1
  146. package/dist/esm/loader.js +3 -3
  147. package/dist/esm/mg-action-more_37.entry.js +761 -371
  148. package/dist/esm/mg-alert.entry.js +17 -9
  149. package/dist/esm/mg-breadcrumb.entry.js +61 -0
  150. package/dist/esm/mg-components.js +4 -4
  151. package/dist/esm/mg-fieldset.entry.js +24 -7
  152. package/dist/esm/mg-input-combobox.entry.js +49 -19
  153. package/dist/esm/mg-input-file.entry.js +382 -0
  154. package/dist/esm/mg-input-rich-text-editor.entry.js +40083 -15808
  155. package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
  156. package/dist/esm/mg-loader.entry.js +8 -6
  157. package/dist/esm/mg-progress.entry.js +19 -9
  158. package/dist/mg-components/locales/en/messages.json +14 -0
  159. package/dist/mg-components/locales/fr/messages.json +14 -0
  160. package/dist/mg-components/mg-components.esm.js +1 -1
  161. package/dist/mg-components/p-0482eb9f.entry.js +1 -0
  162. package/dist/mg-components/{p-7132bca1.entry.js → p-2ee92f38.entry.js} +1 -1
  163. package/dist/mg-components/{p-916dfb6d.entry.js → p-3b653226.entry.js} +1 -1
  164. package/dist/mg-components/p-5745fbea.entry.js +1 -0
  165. package/dist/mg-components/p-C9rmNQIL.js +1 -0
  166. package/dist/mg-components/p-DFwaH2hS.js +2 -0
  167. package/dist/mg-components/p-DSEloqPn.js +1 -0
  168. package/dist/mg-components/p-adec7fcc.entry.js +1 -0
  169. package/dist/mg-components/p-c63f97f0.entry.js +1658 -0
  170. package/dist/mg-components/p-c8c8cfc1.entry.js +1 -0
  171. package/dist/mg-components/p-cc793586.entry.js +1 -0
  172. package/dist/mg-components/p-d5e69c95.entry.js +1 -0
  173. package/dist/types/assets/icons/index.d.ts +2 -0
  174. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
  175. package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
  176. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.d.ts +17 -0
  177. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/index.d.ts +27 -19
  178. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.d.ts +3 -0
  179. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +50 -16
  180. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.conf.d.ts +0 -5
  181. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.d.ts +1 -6
  182. package/dist/types/components/molecules/menus/mg-menu/mg-menu.conf.d.ts +2 -10
  183. package/dist/types/components/molecules/menus/mg-menu/mg-menu.d.ts +7 -7
  184. package/dist/types/components/molecules/menus/mg-menu-item/mg-menu-item.d.ts +12 -8
  185. package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.d.ts +18 -0
  186. package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.d.ts +34 -0
  187. package/dist/types/components/molecules/mg-table/mg-table.d.ts +6 -0
  188. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +1 -9
  189. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +4 -4
  190. package/dist/types/components.d.ts +302 -46
  191. package/dist/types/stencil-public-runtime.d.ts +76 -12
  192. package/ide/intellij/web-types.json +483 -51
  193. package/ide/vscode/css-custom-data.json +10 -2
  194. package/ide/vscode/html-custom-data.json +445 -104
  195. package/package.json +24 -23
  196. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
  197. package/dist/mg-components/p-016bd291.entry.js +0 -1
  198. package/dist/mg-components/p-186a6139.entry.js +0 -1
  199. package/dist/mg-components/p-BluNKQ3L.js +0 -2
  200. package/dist/mg-components/p-CNX6lq0x.js +0 -1
  201. package/dist/mg-components/p-DDnrE1hD.js +0 -1
  202. package/dist/mg-components/p-cd061b38.entry.js +0 -1
  203. package/dist/mg-components/p-d2c72f09.entry.js +0 -1
  204. package/dist/mg-components/p-d5a276eb.entry.js +0 -1
  205. package/ide/vscode/custom.css-data.json +0 -425
@@ -1,762 +1 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { C as ClassList, m as cleanString, i as isValidString, t as toString } from './index2.js';
3
- import { d as defineCustomElement$9, a as MgInputCheckboxList } from './mg-input-checkbox-paginated2.js';
4
- import { d as defineCustomElement$a, b as classFieldset, f as classVerticalList, c as classReadonly, a as classDisabled } from './mg-input2.js';
5
- import { i as initLocales } from './index3.js';
6
- import { d as defineCustomElement$4, S as Status } from './mg-tabs2.js';
7
- import { d as defineCustomElement$f } from './mg-badge2.js';
8
- import { d as defineCustomElement$e } from './mg-button2.js';
9
- import { d as defineCustomElement$d } from './mg-card2.js';
10
- import { d as defineCustomElement$c } from './mg-character-left2.js';
11
- import { d as defineCustomElement$b } from './mg-icon2.js';
12
- import { d as defineCustomElement$8 } from './mg-input-text2.js';
13
- import { d as defineCustomElement$7 } from './mg-input-title2.js';
14
- import { d as defineCustomElement$6 } from './mg-popover2.js';
15
- import { d as defineCustomElement$5 } from './mg-popover-content2.js';
16
- import { d as defineCustomElement$3 } from './mg-tooltip2.js';
17
- import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
18
-
19
- /**
20
- * List of all availables checkbox type
21
- */
22
- const checkboxTypes = ['checkbox', 'multi'];
23
- /**
24
- * mg-input-checkbox-paginated section kind value
25
- */
26
- const SectionKind = {
27
- SELECTED: 'selected',
28
- NOT_SELECTED: 'not-selected',
29
- };
30
-
31
- const mgInputCheckboxCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-c-input.mg-c-input--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-c-input-check-size);height:var(--mg-c-input-check-size);flex-shrink:0;margin:calc((var(--mg-b-font-size)*var(--mg-b-line-height) - var(--mg-c-input-check-size))/2) var(--mg-b-size-8) 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);gap:var(--mg-b-size-12) var(--mg-b-size-24);list-style:none}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group.mg-c-input__input-group--disabled label{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:var(--mg-b-size-8)}.mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;color:var(--mg-b-color-neutral-90);text-align:center}.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--checkbox-multi .mg-c-input__input-group-container{padding:var(--mg-b-size-4) var(--mg-b-size-8);margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container{display:flex;width:unset;flex:unset;flex-wrap:wrap;column-gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container-list{display:flex;flex-flow:row wrap;padding:0;margin:0;gap:var(--mg-b-size-4);list-style:none}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tab{display:block;min-height:calc(var(--mg-b-size-4)*55)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs{min-height:0;flex-shrink:1}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs-action{padding-top:var(--mg-b-size-16);padding-bottom:var(--mg-b-size-12)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs-content{height:calc(24*var(--mg-b-size-8) - 2*var(--mg-b-size-8));overflow-y:auto}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-value{display:inline-flex;min-width:var(--mg-b-size-min-height);min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;justify-content:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-radius:var(--mg-b-size-4);background-color:var(--mg-b-color-neutral-20);font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi b{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--disabled .mg-c-input__input-container b{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--with-values .mg-c-input__input-container{gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content{display:flex;width:calc(var(--mg-b-size-floating-element-max-width) - var(--mg-b-size-16));flex-direction:column;gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content .mg-c-input__tabs-content{min-height:calc(var(--mg-b-size-4)*55)}.mg-c-input.mg-c-input--checkbox-multi:not(.mg-c-input--label-on-top) mg-tooltip:not(.mg-c-input__section-header-tootlip){margin-left:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi mg-popover{--mg-c-card-spacing:var(--mg-b-size-8)}.mg-c-input.mg-c-input--readonly ul{display:flex;min-height:var(--mg-b-font-size);flex-flow:column wrap;padding:0;margin:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) 0 0;list-style:none;row-gap:var(--mg-b-size-8)}";
32
-
33
- /**
34
- * type CheckboxItem validation function
35
- * @param items - Checkbox item
36
- * @returns match item type
37
- */
38
- const isCheckboxItems = (items) => Array.isArray(items) &&
39
- items.every(item => typeof item === 'object' && typeof item.title === 'string' && (item.value === null || typeof item.value === 'boolean') && item.value !== undefined);
40
- const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox extends HTMLElement {
41
- constructor(registerHost) {
42
- super();
43
- if (registerHost !== false) {
44
- this.__registerHost();
45
- }
46
- this.__attachShadow();
47
- this.valueChange = createEvent(this, "value-change", 7);
48
- this.inputValid = createEvent(this, "input-valid", 7);
49
- // hasDisplayedError (triggered by blur event)
50
- this.hasDisplayedError = false;
51
- this.customErrorMessage = { lock: false };
52
- this.mode = 'custom';
53
- // style
54
- this.baseClassName = 'mg-c-input--checkbox';
55
- this.classTypeMulti = 'mg-c-input--checkbox-multi';
56
- this.classWithValues = 'mg-c-input--with-values';
57
- this.classSearchMode = 'mg-c-input--search-mode';
58
- // "multi" setup
59
- this.multiStart = 5;
60
- this.searchStart = 10;
61
- // popover variables
62
- this.hasOpenedPopover = false;
63
- this.checkboxesId = 'checkboxes-list';
64
- /**
65
- * Define input name
66
- * If not set the value equals the identifier
67
- */
68
- this.name = this.identifier;
69
- /**
70
- * Define if label is displayed on top
71
- */
72
- this.labelOnTop = false;
73
- /**
74
- * Define if label is visible
75
- */
76
- this.labelHide = false;
77
- /**
78
- * Define if inputs are display verticaly
79
- */
80
- this.inputVerticalList = false;
81
- /**
82
- * Define if mg-input-checkbox is required
83
- */
84
- this.required = false;
85
- /**
86
- * Define if mg-input-checkbox is readonly
87
- */
88
- this.readonly = false;
89
- /**
90
- * Display selected values list in "multi" type
91
- * This prop is only applied with prop type "multi" or when an "unset" mode render a "multi" type.
92
- */
93
- this.displaySelectedValues = false;
94
- /**
95
- * Define if input is disabled
96
- */
97
- this.disabled = false;
98
- /**
99
- * Define tooltip position
100
- */
101
- this.tooltipPosition = 'input';
102
- /**
103
- * Component classes
104
- */
105
- this.classCollection = new ClassList([this.baseClassName, classFieldset]);
106
- /**
107
- * Formated value to display in list
108
- */
109
- this.checkboxItems = [];
110
- /**
111
- * Search value query
112
- */
113
- this.searchValue = '';
114
- /**
115
- * Search current page
116
- */
117
- this.searchResults = [];
118
- /**
119
- * Select values button text local key
120
- */
121
- this.selectValuesButtonKey = 'editButton';
122
- /**
123
- * Define <mg-tabs> active-tab
124
- */
125
- this.activeTab = 1;
126
- /**
127
- * Handle input event
128
- * @param event - input event
129
- */
130
- this.handleInput = (event) => {
131
- this.updateCheckboxItems('value', Boolean(event.target.checked), item => item._id === event.target.id);
132
- this.updateValues();
133
- this.checkValidity();
134
- this.setErrorMessage();
135
- };
136
- /**
137
- * Keyboard handler
138
- * @param event - to track "tab" key
139
- */
140
- this.handleKeydown = (event) => {
141
- var _a;
142
- // track "Tab" key event when popover display (is "multi" type selected)
143
- if (event.key === 'Tab' && ((_a = this.mgPopover) === null || _a === void 0 ? void 0 : _a.display)) {
144
- // when search input and do a back tab we close the popover
145
- if (Boolean(this.searchInput) && event.shiftKey && this.searchInput.id === event.target.id) {
146
- this.mgPopover.display = false;
147
- return;
148
- }
149
- const enableInputs = Array.from(this.element.shadowRoot.querySelectorAll('input'))
150
- .filter(input => !input.hasAttribute('disabled'))
151
- .map(({ id }) => id);
152
- const originInputIndex = enableInputs.findIndex(id => id === event.target.id);
153
- // close popover when tab trigger focus outside its DOM
154
- if ((originInputIndex + 1 >= enableInputs.length && !event.shiftKey) || (originInputIndex === 0 && event.shiftKey && this.searchInput === undefined))
155
- this.mgPopover.display = false;
156
- }
157
- };
158
- /**
159
- * Handle blur event
160
- */
161
- this.handleBlur = () => {
162
- // Check validity
163
- this.checkValidity();
164
- this.setErrorMessage();
165
- };
166
- /**
167
- * Handle input search value-change event
168
- * @param event - input value-change event
169
- */
170
- this.handleSearchChange = (event) => {
171
- this.searchValue = event.detail;
172
- event.stopPropagation();
173
- };
174
- /**
175
- * Handle <mg-tabs> tab-change event
176
- * @param event - tab change event
177
- */
178
- this.handleActiveTabChange = (event) => {
179
- this.activeTab = event.detail;
180
- this.resetTabsLimit();
181
- };
182
- /**
183
- * popover display-change handler
184
- * @param event - mg-popover display-change custom event
185
- */
186
- this.handleMgPopoverDisplayChange = (event) => {
187
- // 1. update hasOpenedPopover guard with event value
188
- this.hasOpenedPopover = event.detail;
189
- // 2. update selected valued button text
190
- this.setButtonTextKey();
191
- // 3. when popover display change to hide, update reset needeed props and run checkValidity
192
- if (!event.detail) {
193
- // reset search value
194
- this.searchValue = '';
195
- this.resetTabsLimit();
196
- this.checkValidity();
197
- }
198
- // init active tab to selected if some values are checked
199
- this.activeTab = this.checkboxItems.some(items => items.value) ? 2 : 1;
200
- };
201
- /**
202
- * Update values
203
- */
204
- this.updateValues = () => {
205
- this.value = this.checkboxItems.map(o => {
206
- delete o._handleBlur;
207
- delete o._handleInput;
208
- delete o._handleKeydown;
209
- delete o._id;
210
- return o;
211
- });
212
- };
213
- /**
214
- * has invalid input
215
- * @returns true if at least one input is invalid
216
- */
217
- this.hasInvalidInput = () => Array.from(this.element.shadowRoot.querySelectorAll('input[type="checkbox"]')).some((input) => !input.disabled && !input.checkValidity());
218
- /**
219
- * Method to update searchResults
220
- */
221
- this.updateSearchResults = () => {
222
- this.searchResults = this.checkboxItems.filter(item => cleanString(item.title).includes(cleanString(this.searchValue)));
223
- };
224
- /**
225
- * Method to validate if one of inputs value is checked id required
226
- * @returns truthy if condition is valid
227
- */
228
- this.validateRequired = () => !this.required || this.checkboxItems.some(({ value }) => value);
229
- /**
230
- * Check if input is valid
231
- */
232
- this.checkValidity = () => {
233
- this.setValidity(this.readonly || this.disabled || (!this.hasInvalidInput() && this.validateRequired()));
234
- };
235
- /**
236
- * Set button text locale key
237
- */
238
- this.setButtonTextKey = () => {
239
- // prevent key update while popover is openned
240
- if (this.hasOpenedPopover)
241
- return;
242
- let messageKey = 'editButton';
243
- if (this.disabled)
244
- messageKey = 'showButton';
245
- else if (this.getSelectedItems().length < 1)
246
- messageKey = 'selectButton';
247
- this.selectValuesButtonKey = messageKey;
248
- };
249
- /**
250
- * Get select values button message
251
- * @returns message to display
252
- */
253
- this.getSelectValuesButtonMessage = () => {
254
- if (this.selectValuesButtonKey === 'editButton' && isValidString(this.editButtonMessage)) {
255
- return this.editButtonMessage;
256
- }
257
- else if (this.selectValuesButtonKey === 'showButton' && isValidString(this.showButtonMessage)) {
258
- return this.showButtonMessage;
259
- }
260
- else if (this.selectValuesButtonKey === 'selectButton' && isValidString(this.selectButtonMessage)) {
261
- return this.selectButtonMessage;
262
- }
263
- else {
264
- return this.messages.input.checkbox[this.selectValuesButtonKey];
265
- }
266
- };
267
- /**
268
- * Set input error message
269
- * @param fromSetErrorContext - context come from `setError` method
270
- */
271
- this.setErrorMessage = (fromSetErrorContext = false) => {
272
- // Set error message
273
- this.errorMessage = undefined;
274
- if (!this.valid) {
275
- // Does have a new custom error message OR does have a custom error message locked
276
- if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
277
- this.errorMessage = this.customErrorMessage.message;
278
- }
279
- // required
280
- else if (!this.validateRequired()) {
281
- this.errorMessage = this.messages.errors.required;
282
- }
283
- }
284
- };
285
- /**
286
- * Method to get mg-popover identifier
287
- * @returns MgPopover identifier
288
- */
289
- this.getMgPopoverIdentifier = () => `${this.identifier}-input-mg-popover`;
290
- /**
291
- * Manage items to display depending on the search state
292
- * @returns items to display
293
- */
294
- this.getDisplayItems = () => (this.searchValue.length > 0 ? this.searchResults : this.checkboxItems);
295
- /**
296
- * get list of selected checkboxItems
297
- * @returns selected checkboxItems
298
- */
299
- this.getSelectedItems = () => this.checkboxItems.filter(({ value }) => value);
300
- /**
301
- * Reset <mg-input-checkbox-paginated> limit state
302
- */
303
- this.resetTabsLimit = () => {
304
- Array.from(this.element.shadowRoot.querySelectorAll('mg-input-checkbox-paginated')).forEach(component => {
305
- component.resetLimit();
306
- });
307
- };
308
- /**
309
- * Renders the readonly value of the input.
310
- * @returns The rendered readonly value.
311
- */
312
- this.renderReadonly = (readonlyValue) => {
313
- return this.inputVerticalList ? (h("ul", { class: "mg-c-input__readonly-value" }, readonlyValue.map(value => (h("li", { key: value }, h("b", null, value)))))) : (h("b", { class: "mg-c-input__readonly-value" }, readonlyValue.join(', ')));
314
- };
315
- /**
316
- * Renders the MgInputCheckboxList component.
317
- * @returns The rendered MgInputCheckboxList component.
318
- */
319
- this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems, id: this.checkboxesId, disabled: this.disabled, name: this.name, invalid: this.invalid }));
320
- }
321
- validateValue(newValue) {
322
- if (isCheckboxItems(newValue)) {
323
- this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this) })));
324
- this.valueChange.emit(newValue);
325
- }
326
- else {
327
- throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${toString(newValue)}.`);
328
- }
329
- }
330
- validateType(newValue) {
331
- if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
332
- throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${toString(newValue)}.`);
333
- }
334
- else if (newValue === undefined) {
335
- this.mode = 'auto';
336
- this.type = checkboxTypes[0];
337
- }
338
- else if (newValue === 'multi') {
339
- this.classCollection.add(this.classTypeMulti);
340
- this.element.dataset.mgPopoverGuard = this.getMgPopoverIdentifier();
341
- }
342
- else {
343
- this.classCollection.delete(this.classTypeMulti);
344
- }
345
- }
346
- watchInputVerticalList(newValue) {
347
- if (newValue)
348
- this.classCollection.add(classVerticalList);
349
- else
350
- this.classCollection.delete(classVerticalList);
351
- }
352
- watchReadonly(newValue) {
353
- if (newValue)
354
- this.classCollection.add(classReadonly);
355
- else
356
- this.classCollection.delete(classReadonly);
357
- }
358
- watchDisplaySelectedValues(newValue) {
359
- if (newValue)
360
- this.classCollection.add(this.classWithValues);
361
- else
362
- this.classCollection.delete(this.classWithValues);
363
- }
364
- handleValidityChange(newValue, _oldValue, prop) {
365
- // if required or disabled are enabled, we force options state
366
- if (newValue && prop !== 'readonly') {
367
- this.updateCheckboxItems(prop, newValue);
368
- }
369
- // else we rebase options to inital values
370
- else {
371
- this.validateValue(this.value);
372
- }
373
- this.checkValidity();
374
- if (this.hasDisplayedError) {
375
- this.hasDisplayedError = prop !== 'required';
376
- this.setErrorMessage();
377
- }
378
- this.setButtonTextKey();
379
- }
380
- validateDisabled(newValue) {
381
- if (newValue)
382
- this.classCollection.add(classDisabled);
383
- else
384
- this.classCollection.delete(classDisabled);
385
- }
386
- validateCheckboxItems(newValue) {
387
- // For the 'auto' mode we update the type depending on the new value's length.
388
- if (this.mode === 'auto')
389
- this.type = newValue.length > this.multiStart ? 'multi' : 'checkbox';
390
- // If the type is multi and the new value's length is greater than the search gauge, display the search input.
391
- this.displaySearchInput = this.type === 'multi' && newValue.length > this.searchStart;
392
- // refresh search values
393
- if (this.displaySearchInput)
394
- this.updateSearchResults();
395
- this.setButtonTextKey();
396
- }
397
- watchDisplaySearchInput(newValue) {
398
- if (newValue)
399
- this.classCollection.add(this.classSearchMode);
400
- else
401
- this.classCollection.delete(this.classSearchMode);
402
- }
403
- validateSearchValue() {
404
- // refresh search values
405
- this.updateSearchResults();
406
- }
407
- /**
408
- * Set focus on input.
409
- */
410
- async setFocus() {
411
- var _a;
412
- (_a = this.element.shadowRoot.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
413
- }
414
- /**
415
- * Display input error if it exists.
416
- */
417
- displayError() {
418
- // Use `Promise` as requested for stencil method
419
- // Use `requestAnimationFrame` to ensure:
420
- // - DOM is fully updated before validation
421
- // - Async operations are completed
422
- // - No timing issues with Stencil's render cycle
423
- // - Keep everything in sync both inside and outside the component
424
- return new Promise(resolve => {
425
- requestAnimationFrame(() => {
426
- this.checkValidity();
427
- this.setErrorMessage();
428
- this.hasDisplayedError = this.invalid;
429
- resolve();
430
- });
431
- });
432
- }
433
- /**
434
- * Set an error and display a custom error message.
435
- * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
436
- * It must be paired with an error message to display for the given context.
437
- * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
438
- * @param valid - value indicating the validity
439
- * @param errorMessage - the error message to display
440
- * @param errorMessageLock - lock the error message and validity state
441
- */
442
- async setError(valid, errorMessage, errorMessageLock = false) {
443
- if (typeof valid !== 'boolean') {
444
- throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
445
- }
446
- else if (errorMessage !== undefined && !isValidString(errorMessage)) {
447
- throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
448
- }
449
- else {
450
- this.customErrorMessage = {
451
- lock: valid ? false : errorMessageLock,
452
- message: valid ? undefined : errorMessage,
453
- };
454
- this.setValidity(valid);
455
- this.setErrorMessage(true);
456
- this.hasDisplayedError = this.invalid;
457
- }
458
- }
459
- /**
460
- * Reset value, validity and error state
461
- */
462
- async reset() {
463
- if (!this.readonly) {
464
- this.value = this.value.map(item => (Object.assign(Object.assign({}, item), { value: false })));
465
- // Use `Promise` as requested for stencil method
466
- // Use `requestAnimationFrame` to ensure:
467
- // - DOM is fully updated before validation
468
- // - Async operations are completed
469
- // - No timing issues with Stencil's render cycle
470
- // - Keep everything in sync both inside and outside the component
471
- return new Promise(resolve => {
472
- requestAnimationFrame(() => {
473
- // unlock validity check by reseting customErrorMessage
474
- this.customErrorMessage = { lock: false };
475
- this.checkValidity();
476
- this.errorMessage = undefined;
477
- this.hasDisplayedError = false;
478
- resolve();
479
- });
480
- });
481
- }
482
- }
483
- /**
484
- * Method to set validity values
485
- * @param newValue - valid new value
486
- */
487
- setValidity(newValue) {
488
- const oldValue = this.valid;
489
- if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
490
- this.valid = newValue;
491
- }
492
- this.invalid = !this.valid;
493
- // We need to send valid event even if it is the same value
494
- if (this.valid !== oldValue)
495
- this.inputValid.emit(this.valid);
496
- }
497
- /**
498
- * Update ckecboxes item
499
- * @param key - property to update
500
- * @param newValue - value to update with
501
- * @param condition - condtion to applu change on item
502
- */
503
- updateCheckboxItems(key, newValue, condition) {
504
- this.checkboxItems = this.checkboxItems.map(item => {
505
- if ((typeof condition === 'function' && condition(item)) || condition === undefined)
506
- item[key] = newValue;
507
- return item;
508
- });
509
- }
510
- /*************
511
- * Lifecycle *
512
- *************/
513
- /**
514
- * Check if component props are well configured on init
515
- * @returns timeout
516
- */
517
- componentWillLoad() {
518
- // Get locales
519
- this.messages = initLocales(this.element).messages;
520
- // Validate
521
- // `validateType` must be done before `validateValue` because we need to set mode['auto'|'custom'] from type
522
- // and `validateValue` updates `this.checkboxItems` watcher which requires a defined `this.type`.
523
- this.validateType(this.type);
524
- this.validateValue(this.value);
525
- this.validateDisabled(this.disabled);
526
- this.watchReadonly(this.readonly);
527
- this.watchInputVerticalList(this.inputVerticalList);
528
- this.watchDisplaySelectedValues(this.displaySelectedValues);
529
- this.watchDisplaySearchInput(this.displaySearchInput);
530
- // Check validity when component is ready
531
- // return a promise to process action only in the FIRST render().
532
- // https://stenciljs.com/docs/component-lifecycle#componentwillload
533
- return setTimeout(() => {
534
- this.checkValidity();
535
- }, 0);
536
- }
537
- /**
538
- * add listeners and DOM attributed
539
- */
540
- componentDidLoad() {
541
- var _a, _b;
542
- if (!this.readonly) {
543
- this.searchInput = (_a = this.element.shadowRoot.querySelector('mg-input-text')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('input');
544
- (_b = this.searchInput) === null || _b === void 0 ? void 0 : _b.addEventListener('keydown', this.handleKeydown);
545
- }
546
- }
547
- /**
548
- * Render checkboxes by section
549
- * @param checkboxes - checkboxes to render
550
- * @returns render sections of checkboxes
551
- */
552
- renderCheckboxTabs(checkboxes, checkboxPaginatedProps) {
553
- const handleMassAction = (kind) => () => {
554
- const displayItems = this.getDisplayItems();
555
- // update only displayed items
556
- displayItems.forEach(item => {
557
- if (!item.disabled) {
558
- item.value = kind !== SectionKind.SELECTED;
559
- }
560
- });
561
- this.updateValues();
562
- };
563
- const [checkedValues, notCheckedValues] = checkboxes.reduce((acc, curr) => {
564
- acc[curr.value ? 0 : 1].push(curr);
565
- return acc;
566
- }, [[], []]);
567
- const sections = [
568
- Object.assign(Object.assign({}, checkboxPaginatedProps), { checkboxes: notCheckedValues, messages: Object.assign(Object.assign({}, this.messages.input.checkbox.sections.notSelected), { showMore: this.messages.input.showMore }), handleMassAction: handleMassAction(SectionKind.NOT_SELECTED) }),
569
- Object.assign(Object.assign({}, checkboxPaginatedProps), { checkboxes: checkedValues, messages: Object.assign(Object.assign({}, this.messages.input.checkbox.sections.selected), { showMore: this.messages.input.showMore }), handleMassAction: handleMassAction(SectionKind.SELECTED) }),
570
- ];
571
- return (h("mg-tabs", { identifier: `${this.identifier}-tabs`, class: "mg-c-input__tabs", label: this.messages.input.checkbox.sections.label, items: sections.map((section, key) => ({
572
- label: section.messages.title,
573
- badge: { value: section.checkboxes.length, label: this.messages.input.checkbox.sections.badge.label, role: 'information' },
574
- status: key + 1 === this.activeTab ? Status.ACTIVE : Status.VISIBLE,
575
- })), activeTab: this.activeTab, "onActive-tab-change": this.handleActiveTabChange }, sections.map((section, key) => (h("mg-input-checkbox-paginated", Object.assign({ class: "mg-c-input__tab", slot: `tab_content-${key + 1}` }, section, { key: section.messages.title }), section.checkboxes.length > 0 && section.checkboxes.some(checkbox => checkbox.disabled !== true) && (h("mg-tooltip", { slot: "header-action", class: "mg-c-input__tabs-action", message: section.messages.tooltip }, h("mg-button", { variant: "link", onClick: section.handleMassAction }, section.messages.action))))))));
576
- }
577
- /**
578
- * render checkbox multi element
579
- * @returns html element
580
- */
581
- renderCheckboxMulti() {
582
- const selectedValuesNb = this.getSelectedItems().length;
583
- const checkboxes = this.getDisplayItems();
584
- const checkboxPaginatedProps = {
585
- readonly: this.readonly,
586
- disabled: this.disabled,
587
- identifier: this.identifier,
588
- };
589
- return (h("div", { class: "mg-c-input__input-container" }, h("mg-popover", { arrowHide: true, identifier: this.getMgPopoverIdentifier(), display: this.hasOpenedPopover, "onDisplay-change": this.handleMgPopoverDisplayChange, ref: (el) => {
590
- if (el !== null)
591
- this.mgPopover = el;
592
- } }, h("mg-button", { variant: "secondary", "aria-describedby": `${this.identifier}-title` }, h("mg-icon", { icon: "list" }), this.getSelectValuesButtonMessage()), h("div", { slot: "content", class: "mg-c-input__content" }, this.displaySearchInput ? ([
593
- h("mg-input-text", { key: "input-search", identifier: `${this.identifier}-input-search`, icon: "magnifying-glass", type: "search", placeholder: this.messages.input.checkbox.sections.search.label, label: this.messages.input.checkbox.sections.search.label, mgWidth: "full", value: this.searchValue, labelHide: true, characterLeftHide: true, name: "q", "onValue-change": this.handleSearchChange }),
594
- this.searchValue.length > 0 ? (h("mg-input-checkbox-paginated", Object.assign({ class: "mg-c-input__tab" }, checkboxPaginatedProps, { messages: Object.assign(Object.assign({}, this.messages.input.checkbox.sections.search), { showMore: this.messages.input.showMore }), checkboxes: checkboxes, key: "search" }))) : (this.renderCheckboxTabs(checkboxes, checkboxPaginatedProps)),
595
- ]) : (h(MgInputCheckboxList, { checkboxes: checkboxes, id: this.checkboxesId, disabled: this.disabled, name: this.name, invalid: this.invalid })))), this.displaySelectedValues ? (selectedValuesNb > 0 && (h("ul", { role: "list", class: "mg-c-input__input-container-list" }, this.getSelectedItems().map(({ title }) => (h("li", { class: "mg-c-input__input-value", key: title }, title)))))) : (h("b", null, this.messages.input.checkbox[selectedValuesNb > 1 ? 'selectedValues' : 'selectedValue'].replace('{nb}', selectedValuesNb)))));
596
- }
597
- /**
598
- * Render
599
- * @returns HTML Element
600
- */
601
- render() {
602
- let inputContent;
603
- const readonlyValue = this.value.filter(({ value }) => value).map(({ title }) => title);
604
- if (this.readonly) {
605
- inputContent = this.renderReadonly(readonlyValue);
606
- }
607
- else if (this.type === 'checkbox') {
608
- inputContent = this.renderMgInputCheckboxList();
609
- }
610
- else {
611
- inputContent = this.renderCheckboxMulti();
612
- }
613
- return (h("mg-input", { key: '5addea288b5c87fec33a56449d14f861aefd465d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
614
- }
615
- get element() { return this; }
616
- static get watchers() { return {
617
- "value": ["validateValue"],
618
- "type": ["validateType"],
619
- "inputVerticalList": ["watchInputVerticalList"],
620
- "readonly": ["watchReadonly", "handleValidityChange"],
621
- "displaySelectedValues": ["watchDisplaySelectedValues"],
622
- "required": ["handleValidityChange"],
623
- "disabled": ["handleValidityChange", "validateDisabled"],
624
- "checkboxItems": ["validateCheckboxItems"],
625
- "displaySearchInput": ["watchDisplaySearchInput"],
626
- "searchValue": ["validateSearchValue"]
627
- }; }
628
- static get style() { return mgInputCheckboxCss; }
629
- }, [257, "mg-input-checkbox", {
630
- "value": [1040],
631
- "type": [1025],
632
- "identifier": [1],
633
- "name": [1],
634
- "label": [1],
635
- "labelOnTop": [4, "label-on-top"],
636
- "labelHide": [4, "label-hide"],
637
- "inputVerticalList": [4, "input-vertical-list"],
638
- "required": [4],
639
- "readonly": [4],
640
- "displaySelectedValues": [4, "display-selected-values"],
641
- "disabled": [4],
642
- "tooltip": [1],
643
- "tooltipPosition": [1, "tooltip-position"],
644
- "helpText": [1, "help-text"],
645
- "valid": [1028],
646
- "invalid": [1028],
647
- "editButtonMessage": [1, "edit-button-message"],
648
- "showButtonMessage": [1, "show-button-message"],
649
- "selectButtonMessage": [1, "select-button-message"],
650
- "classCollection": [32],
651
- "errorMessage": [32],
652
- "checkboxItems": [32],
653
- "displaySearchInput": [32],
654
- "searchValue": [32],
655
- "searchResults": [32],
656
- "selectValuesButtonKey": [32],
657
- "activeTab": [32],
658
- "setFocus": [64],
659
- "displayError": [64],
660
- "setError": [64],
661
- "reset": [64]
662
- }, undefined, {
663
- "value": ["validateValue"],
664
- "type": ["validateType"],
665
- "inputVerticalList": ["watchInputVerticalList"],
666
- "readonly": ["watchReadonly", "handleValidityChange"],
667
- "displaySelectedValues": ["watchDisplaySelectedValues"],
668
- "required": ["handleValidityChange"],
669
- "disabled": ["handleValidityChange", "validateDisabled"],
670
- "checkboxItems": ["validateCheckboxItems"],
671
- "displaySearchInput": ["watchDisplaySearchInput"],
672
- "searchValue": ["validateSearchValue"]
673
- }]);
674
- function defineCustomElement$1() {
675
- if (typeof customElements === "undefined") {
676
- return;
677
- }
678
- const components = ["mg-input-checkbox", "mg-badge", "mg-button", "mg-card", "mg-character-left", "mg-icon", "mg-input", "mg-input-checkbox-paginated", "mg-input-text", "mg-input-title", "mg-popover", "mg-popover-content", "mg-tabs", "mg-tooltip", "mg-tooltip-content"];
679
- components.forEach(tagName => { switch (tagName) {
680
- case "mg-input-checkbox":
681
- if (!customElements.get(tagName)) {
682
- customElements.define(tagName, MgInputCheckbox$1);
683
- }
684
- break;
685
- case "mg-badge":
686
- if (!customElements.get(tagName)) {
687
- defineCustomElement$f();
688
- }
689
- break;
690
- case "mg-button":
691
- if (!customElements.get(tagName)) {
692
- defineCustomElement$e();
693
- }
694
- break;
695
- case "mg-card":
696
- if (!customElements.get(tagName)) {
697
- defineCustomElement$d();
698
- }
699
- break;
700
- case "mg-character-left":
701
- if (!customElements.get(tagName)) {
702
- defineCustomElement$c();
703
- }
704
- break;
705
- case "mg-icon":
706
- if (!customElements.get(tagName)) {
707
- defineCustomElement$b();
708
- }
709
- break;
710
- case "mg-input":
711
- if (!customElements.get(tagName)) {
712
- defineCustomElement$a();
713
- }
714
- break;
715
- case "mg-input-checkbox-paginated":
716
- if (!customElements.get(tagName)) {
717
- defineCustomElement$9();
718
- }
719
- break;
720
- case "mg-input-text":
721
- if (!customElements.get(tagName)) {
722
- defineCustomElement$8();
723
- }
724
- break;
725
- case "mg-input-title":
726
- if (!customElements.get(tagName)) {
727
- defineCustomElement$7();
728
- }
729
- break;
730
- case "mg-popover":
731
- if (!customElements.get(tagName)) {
732
- defineCustomElement$6();
733
- }
734
- break;
735
- case "mg-popover-content":
736
- if (!customElements.get(tagName)) {
737
- defineCustomElement$5();
738
- }
739
- break;
740
- case "mg-tabs":
741
- if (!customElements.get(tagName)) {
742
- defineCustomElement$4();
743
- }
744
- break;
745
- case "mg-tooltip":
746
- if (!customElements.get(tagName)) {
747
- defineCustomElement$3();
748
- }
749
- break;
750
- case "mg-tooltip-content":
751
- if (!customElements.get(tagName)) {
752
- defineCustomElement$2();
753
- }
754
- break;
755
- } });
756
- }
757
- defineCustomElement$1();
758
-
759
- const MgInputCheckbox = MgInputCheckbox$1;
760
- const defineCustomElement = defineCustomElement$1;
761
-
762
- export { MgInputCheckbox, defineCustomElement };
1
+ import{transformTag as t,proxyCustomElement as i,HTMLElement as e,createEvent as s,h as a}from"@stencil/core/internal/client";import{C as n,m as h,i as c,t as o}from"./index2.js";import{d as l,a as m}from"./mg-input-checkbox-paginated2.js";import{a as r,d as p,c as u,b as g}from"./mg-input.conf.js";import{i as d}from"./index3.js";import{d as b,S as v}from"./mg-tabs2.js";import{d as f}from"./mg-badge2.js";import{d as y}from"./mg-button2.js";import{d as x}from"./mg-card2.js";import{d as k}from"./mg-character-left2.js";import{d as _}from"./mg-icon2.js";import{d as w}from"./mg-input2.js";import{d as z}from"./mg-input-text2.js";import{d as j}from"./mg-input-title2.js";import{d as V}from"./mg-popover2.js";import{d as E}from"./mg-popover-content2.js";import{d as C}from"./mg-tooltip2.js";import{d as I}from"./mg-tooltip-content2.js";const O=["checkbox","multi"],S="selected",T=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.valueChange=s(this,"value-change",7),this.inputValid=s(this,"input-valid",7),this.hasDisplayedError=!1,this.customErrorMessage={lock:!1},this.mode="custom",this.baseClassName="mg-c-input--checkbox",this.classTypeMulti="mg-c-input--checkbox-multi",this.classWithValues="mg-c-input--with-values",this.classSearchMode="mg-c-input--search-mode",this.multiStart=5,this.searchStart=10,this.hasOpenedPopover=!1,this.checkboxesId="checkboxes-list",this.name=this.identifier,this.labelOnTop=!1,this.labelHide=!1,this.inputVerticalList=!1,this.required=!1,this.readonly=!1,this.displaySelectedValues=!1,this.disabled=!1,this.tooltipPosition="input",this.classCollection=new n([this.baseClassName,r]),this.checkboxItems=[],this.searchValue="",this.searchResults=[],this.selectValuesButtonKey="editButton",this.activeTab=1,this.handleInput=t=>{this.updateCheckboxItems("value",!!t.target.checked,(i=>i._id===t.target.id)),this.updateValues(),this.checkValidity(),this.setErrorMessage()},this.handleKeydown=t=>{var i;if("Tab"===t.key&&(null===(i=this.mgPopover)||void 0===i?void 0:i.display)){if(this.searchInput&&t.shiftKey&&this.searchInput.id===t.target.id)return void(this.mgPopover.display=!1);const i=Array.from(this.element.shadowRoot.querySelectorAll("input")).filter((t=>!t.hasAttribute("disabled"))).map((({id:t})=>t)),e=i.findIndex((i=>i===t.target.id));(e+1>=i.length&&!t.shiftKey||0===e&&t.shiftKey&&void 0===this.searchInput)&&(this.mgPopover.display=!1)}},this.handleBlur=()=>{this.checkValidity(),this.setErrorMessage()},this.handleSearchChange=t=>{this.searchValue=t.detail,t.stopPropagation()},this.handleActiveTabChange=t=>{this.activeTab=t.detail,this.resetTabsLimit()},this.handleMgPopoverDisplayChange=t=>{this.hasOpenedPopover=t.detail,this.setButtonTextKey(),t.detail||(this.searchValue="",this.resetTabsLimit(),this.checkValidity()),this.activeTab=this.checkboxItems.some((t=>t.value))?2:1},this.updateValues=()=>{this.value=this.checkboxItems.map((t=>(delete t._handleBlur,delete t._handleInput,delete t._handleKeydown,delete t._id,t)))},this.hasInvalidInput=()=>Array.from(this.element.shadowRoot.querySelectorAll('input[type="checkbox"]')).some((t=>!t.disabled&&!t.checkValidity())),this.updateSearchResults=()=>{this.searchResults=this.checkboxItems.filter((t=>h(t.title).includes(h(this.searchValue))))},this.validateRequired=()=>!this.required||this.checkboxItems.some((({value:t})=>t)),this.checkValidity=()=>{this.setValidity(this.readonly||this.disabled||!this.hasInvalidInput()&&this.validateRequired())},this.setButtonTextKey=()=>{if(this.hasOpenedPopover)return;let t="editButton";this.disabled?t="showButton":this.getSelectedItems().length<1&&(t="selectButton"),this.selectValuesButtonKey=t},this.getSelectValuesButtonMessage=()=>"editButton"===this.selectValuesButtonKey&&c(this.editButtonMessage)?this.editButtonMessage:"showButton"===this.selectValuesButtonKey&&c(this.showButtonMessage)?this.showButtonMessage:"selectButton"===this.selectValuesButtonKey&&c(this.selectButtonMessage)?this.selectButtonMessage:this.messages.input.checkbox[this.selectValuesButtonKey],this.setErrorMessage=(t=!1)=>{this.errorMessage=void 0,this.valid||(t||this.customErrorMessage.lock&&void 0!==this.customErrorMessage.message?this.errorMessage=this.customErrorMessage.message:this.validateRequired()||(this.errorMessage=this.messages.errors.required))},this.getMgPopoverIdentifier=()=>this.identifier+"-input-mg-popover",this.getDisplayItems=()=>this.searchValue.length>0?this.searchResults:this.checkboxItems,this.getSelectedItems=()=>this.checkboxItems.filter((({value:t})=>t)),this.resetTabsLimit=()=>{Array.from(this.element.shadowRoot.querySelectorAll("mg-input-checkbox-paginated")).forEach((t=>{t.resetLimit()}))},this.renderReadonly=t=>this.inputVerticalList?a("ul",{class:"mg-c-input__readonly-value"},t.map((t=>a("li",{key:t},a("b",null,t))))):a("b",{class:"mg-c-input__readonly-value"},t.join(", ")),this.renderMgInputCheckboxList=()=>a(m,{checkboxes:this.checkboxItems,id:this.checkboxesId,disabled:this.disabled,name:this.name,invalid:this.invalid})}validateValue(t){if(!(t=>Array.isArray(t)&&t.every((t=>"object"==typeof t&&"string"==typeof t.title&&(null===t.value||"boolean"==typeof t.value)&&void 0!==t.value)))(t))throw Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${o(t)}.`);this.checkboxItems=t.map(((t,i)=>Object.assign(Object.assign({},t),{_id:`${this.identifier}_${i}`,_handleInput:this.handleInput.bind(this),_handleBlur:this.handleBlur.bind(this),_handleKeydown:this.handleKeydown.bind(this)}))),this.valueChange.emit(t)}validateType(t){if(void 0!==t&&!O.includes(t))throw Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${o(t)}.`);void 0===t?(this.mode="auto",this.type=O[0]):"multi"===t?(this.classCollection.add(this.classTypeMulti),this.element.dataset.mgPopoverGuard=this.getMgPopoverIdentifier()):this.classCollection.delete(this.classTypeMulti)}watchInputVerticalList(t){t?this.classCollection.add(p):this.classCollection.delete(p)}watchReadonly(t){t?this.classCollection.add(u):this.classCollection.delete(u)}watchDisplaySelectedValues(t){t?this.classCollection.add(this.classWithValues):this.classCollection.delete(this.classWithValues)}handleValidityChange(t,i,e){t&&"readonly"!==e?this.updateCheckboxItems(e,t):this.validateValue(this.value),this.checkValidity(),this.hasDisplayedError&&(this.hasDisplayedError="required"!==e,this.setErrorMessage()),this.setButtonTextKey()}validateDisabled(t){t?this.classCollection.add(g):this.classCollection.delete(g)}validateCheckboxItems(t){"auto"===this.mode&&(this.type=t.length>this.multiStart?"multi":"checkbox"),this.displaySearchInput="multi"===this.type&&t.length>this.searchStart,this.displaySearchInput&&this.updateSearchResults(),this.setButtonTextKey()}watchDisplaySearchInput(t){t?this.classCollection.add(this.classSearchMode):this.classCollection.delete(this.classSearchMode)}validateSearchValue(){this.updateSearchResults()}async setFocus(){var t;null===(t=this.element.shadowRoot.querySelector("input"))||void 0===t||t.focus()}displayError(){return new Promise((t=>{requestAnimationFrame((()=>{this.checkValidity(),this.setErrorMessage(),this.hasDisplayedError=this.invalid,t()}))}))}async setError(t,i,e=!1){if("boolean"!=typeof t)throw Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');if(void 0!==i&&!c(i))throw Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');this.customErrorMessage={lock:!t&&e,message:t?void 0:i},this.setValidity(t),this.setErrorMessage(!0),this.hasDisplayedError=this.invalid}async reset(){if(!this.readonly)return this.value=this.value.map((t=>Object.assign(Object.assign({},t),{value:!1}))),new Promise((t=>{requestAnimationFrame((()=>{this.customErrorMessage={lock:!1},this.checkValidity(),this.errorMessage=void 0,this.hasDisplayedError=!1,t()}))}))}setValidity(t){const i=this.valid;this.customErrorMessage.lock&&(void 0===this.customErrorMessage.message||t)||(this.valid=t),this.invalid=!this.valid,this.valid!==i&&this.inputValid.emit(this.valid)}updateCheckboxItems(t,i,e){this.checkboxItems=this.checkboxItems.map((s=>(("function"==typeof e&&e(s)||void 0===e)&&(s[t]=i),s)))}componentWillLoad(){return this.messages=d(this.element).messages,this.validateType(this.type),this.validateValue(this.value),this.validateDisabled(this.disabled),this.watchReadonly(this.readonly),this.watchInputVerticalList(this.inputVerticalList),this.watchDisplaySelectedValues(this.displaySelectedValues),this.watchDisplaySearchInput(this.displaySearchInput),setTimeout((()=>{this.checkValidity()}),0)}componentDidLoad(){var t,i;this.readonly||(this.searchInput=null===(t=this.element.shadowRoot.querySelector("mg-input-text"))||void 0===t?void 0:t.shadowRoot.querySelector("input"),null===(i=this.searchInput)||void 0===i||i.addEventListener("keydown",this.handleKeydown))}renderCheckboxTabs(t,i){const e=t=>()=>{this.getDisplayItems().forEach((i=>{i.disabled||(i.value=t!==S)})),this.updateValues()},[s,n]=t.reduce(((t,i)=>(t[i.value?0:1].push(i),t)),[[],[]]),h=[Object.assign(Object.assign({},i),{checkboxes:n,messages:Object.assign(Object.assign({},this.messages.input.checkbox.sections.notSelected),{showMore:this.messages.input.showMore}),handleMassAction:e("not-selected")}),Object.assign(Object.assign({},i),{checkboxes:s,messages:Object.assign(Object.assign({},this.messages.input.checkbox.sections.selected),{showMore:this.messages.input.showMore}),handleMassAction:e(S)})];return a("mg-tabs",{identifier:this.identifier+"-tabs",class:"mg-c-input__tabs",label:this.messages.input.checkbox.sections.label,items:h.map(((t,i)=>({label:t.messages.title,badge:{value:t.checkboxes.length,label:this.messages.input.checkbox.sections.badge.label,role:"information"},status:i+1===this.activeTab?v.ACTIVE:v.VISIBLE}))),activeTab:this.activeTab,"onActive-tab-change":this.handleActiveTabChange},h.map(((t,i)=>a("mg-input-checkbox-paginated",Object.assign({class:"mg-c-input__tab",slot:"tab_content-"+(i+1)},t,{key:t.messages.title}),t.checkboxes.length>0&&t.checkboxes.some((t=>!0!==t.disabled))&&a("mg-tooltip",{slot:"header-action",class:"mg-c-input__tabs-action",message:t.messages.tooltip},a("mg-button",{variant:"link",onClick:t.handleMassAction},t.messages.action))))))}renderCheckboxMulti(){const t=this.getSelectedItems().length,i=this.getDisplayItems(),e={readonly:this.readonly,disabled:this.disabled,identifier:this.identifier};return a("div",{class:"mg-c-input__input-container"},a("mg-popover",{arrowHide:!0,identifier:this.getMgPopoverIdentifier(),display:this.hasOpenedPopover,"onDisplay-change":this.handleMgPopoverDisplayChange,ref:t=>{null!==t&&(this.mgPopover=t)}},a("mg-button",{variant:"secondary","aria-describedby":this.identifier+"-title"},a("mg-icon",{icon:"list"}),this.getSelectValuesButtonMessage()),a("div",{slot:"content",class:"mg-c-input__content"},this.displaySearchInput?[a("mg-input-text",{key:"input-search",identifier:this.identifier+"-input-search",icon:"magnifying-glass",type:"search",placeholder:this.messages.input.checkbox.sections.search.label,label:this.messages.input.checkbox.sections.search.label,mgWidth:"full",value:this.searchValue,labelHide:!0,characterLeftHide:!0,name:"q","onValue-change":this.handleSearchChange}),this.searchValue.length>0?a("mg-input-checkbox-paginated",Object.assign({class:"mg-c-input__tab"},e,{messages:Object.assign(Object.assign({},this.messages.input.checkbox.sections.search),{showMore:this.messages.input.showMore}),checkboxes:i,key:"search"})):this.renderCheckboxTabs(i,e)]:a(m,{checkboxes:i,id:this.checkboxesId,disabled:this.disabled,name:this.name,invalid:this.invalid}))),this.displaySelectedValues?t>0&&a("ul",{role:"list",class:"mg-c-input__input-container-list"},this.getSelectedItems().map((({title:t})=>a("li",{class:"mg-c-input__input-value",key:t},t)))):a("b",null,this.messages.input.checkbox[t>1?"selectedValues":"selectedValue"].replace("{nb}",t)))}render(){let t;const i=this.value.filter((({value:t})=>t)).map((({title:t})=>t));return t=this.readonly?this.renderReadonly(i):"checkbox"===this.type?this.renderMgInputCheckboxList():this.renderCheckboxMulti(),a("mg-input",{key:"c5797a119a653c27004a171b7b79be7d4504800d",label:this.label,identifier:this.identifier,class:this.classCollection.join(),labelOnTop:this.labelOnTop,labelHide:this.labelHide,required:this.readonly?void 0:this.required,tooltip:this.tooltip,tooltipPosition:this.readonly&&0===i.length?"label":this.tooltipPosition,helpText:this.readonly?void 0:this.helpText,errorMessage:this.readonly?void 0:this.errorMessage},t)}get element(){return this}static get watchers(){return{value:[{validateValue:0}],type:[{validateType:0}],inputVerticalList:[{watchInputVerticalList:0}],readonly:[{watchReadonly:0},{handleValidityChange:0}],displaySelectedValues:[{watchDisplaySelectedValues:0}],required:[{handleValidityChange:0}],disabled:[{handleValidityChange:0},{validateDisabled:0}],checkboxItems:[{validateCheckboxItems:0}],displaySearchInput:[{watchDisplaySearchInput:0}],searchValue:[{validateSearchValue:0}]}}static get style(){return".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-c-input.mg-c-input--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-c-input-check-size);height:var(--mg-c-input-check-size);flex-shrink:0;margin:calc((var(--mg-b-font-size)*var(--mg-b-line-height) - var(--mg-c-input-check-size))/2) var(--mg-b-size-8) 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);gap:var(--mg-b-size-12) var(--mg-b-size-24);list-style:none}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group.mg-c-input__input-group--disabled label{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:var(--mg-b-size-8)}.mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;color:var(--mg-b-color-neutral-90);text-align:center}.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--checkbox-multi .mg-c-input__input-group-container{padding:var(--mg-b-size-4) var(--mg-b-size-8);margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container{display:flex;width:unset;flex:unset;flex-wrap:wrap;column-gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container-list{display:flex;flex-flow:row wrap;padding:0;margin:0;gap:var(--mg-b-size-4);list-style:none}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tab{display:block;min-height:calc(var(--mg-b-size-4)*55)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs{min-height:0;flex-shrink:1}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs-action{padding-top:var(--mg-b-size-16);padding-bottom:var(--mg-b-size-12)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs-content{height:calc(24*var(--mg-b-size-8) - 2*var(--mg-b-size-8));overflow-y:auto}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-value{display:inline-flex;min-width:var(--mg-b-size-min-height);min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;justify-content:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-radius:var(--mg-b-size-4);background-color:var(--mg-b-color-neutral-20);font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi b{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--disabled .mg-c-input__input-container b{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--with-values .mg-c-input__input-container{gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content{display:flex;width:calc(var(--mg-b-size-floating-element-max-width) - var(--mg-b-size-16));flex-direction:column;gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content .mg-c-input__tabs-content{min-height:calc(var(--mg-b-size-4)*55)}.mg-c-input.mg-c-input--checkbox-multi:not(.mg-c-input--label-on-top) mg-tooltip:not(.mg-c-input__section-header-tootlip){margin-left:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi mg-popover{--mg-c-card-spacing:var(--mg-b-size-8)}.mg-c-input.mg-c-input--readonly ul{display:flex;min-height:var(--mg-b-font-size);flex-flow:column wrap;padding:0;margin:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) 0 0;list-style:none;row-gap:var(--mg-b-size-8)}"}},[1,"mg-input-checkbox",{value:[1040],type:[1025],identifier:[1],name:[1],label:[1],labelOnTop:[4,"label-on-top"],labelHide:[4,"label-hide"],inputVerticalList:[4,"input-vertical-list"],required:[4],readonly:[4],displaySelectedValues:[4,"display-selected-values"],disabled:[4],tooltip:[1],tooltipPosition:[1,"tooltip-position"],helpText:[1,"help-text"],valid:[1028],invalid:[1028],editButtonMessage:[1,"edit-button-message"],showButtonMessage:[1,"show-button-message"],selectButtonMessage:[1,"select-button-message"],classCollection:[32],errorMessage:[32],checkboxItems:[32],displaySearchInput:[32],searchValue:[32],searchResults:[32],selectValuesButtonKey:[32],activeTab:[32],setFocus:[64],displayError:[64],setError:[64],reset:[64]},void 0,{value:[{validateValue:0}],type:[{validateType:0}],inputVerticalList:[{watchInputVerticalList:0}],readonly:[{watchReadonly:0},{handleValidityChange:0}],displaySelectedValues:[{watchDisplaySelectedValues:0}],required:[{handleValidityChange:0}],disabled:[{handleValidityChange:0},{validateDisabled:0}],checkboxItems:[{validateCheckboxItems:0}],displaySearchInput:[{watchDisplaySearchInput:0}],searchValue:[{validateSearchValue:0}]}]);function B(){"undefined"!=typeof customElements&&["mg-input-checkbox","mg-badge","mg-button","mg-card","mg-character-left","mg-icon","mg-input","mg-input-checkbox-paginated","mg-input-text","mg-input-title","mg-popover","mg-popover-content","mg-tabs","mg-tooltip","mg-tooltip-content"].forEach((i=>{switch(i){case"mg-input-checkbox":customElements.get(t(i))||customElements.define(t(i),T);break;case"mg-badge":customElements.get(t(i))||f();break;case"mg-button":customElements.get(t(i))||y();break;case"mg-card":customElements.get(t(i))||x();break;case"mg-character-left":customElements.get(t(i))||k();break;case"mg-icon":customElements.get(t(i))||_();break;case"mg-input":customElements.get(t(i))||w();break;case"mg-input-checkbox-paginated":customElements.get(t(i))||l();break;case"mg-input-text":customElements.get(t(i))||z();break;case"mg-input-title":customElements.get(t(i))||j();break;case"mg-popover":customElements.get(t(i))||V();break;case"mg-popover-content":customElements.get(t(i))||E();break;case"mg-tabs":customElements.get(t(i))||b();break;case"mg-tooltip":customElements.get(t(i))||C();break;case"mg-tooltip-content":customElements.get(t(i))||I()}}))}B();const M=T,D=B;export{M as MgInputCheckbox,D as defineCustomElement}