@mgdis/mg-components 5.25.2 → 5.27.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 (256) hide show
  1. package/dist/cjs/{index-f699ee11.js → index-1d560837.js} +105 -89
  2. package/dist/cjs/index-1d560837.js.map +1 -0
  3. package/dist/cjs/{index-0256ee6d.js → index-7072369e.js} +17 -5
  4. package/dist/cjs/index-7072369e.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/{mg-action-more_34.cjs.entry.js → mg-action-more_35.cjs.entry.js} +693 -774
  7. package/dist/cjs/mg-action-more_35.cjs.entry.js.map +1 -0
  8. package/dist/cjs/mg-components.cjs.js +3 -3
  9. package/dist/cjs/mg-components.cjs.js.map +1 -1
  10. package/dist/cjs/mg-item-more.cjs.entry.js +8 -7
  11. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  12. package/dist/cjs/mg-loader.cjs.entry.js +4 -4
  13. package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
  14. package/dist/collection/assets/icons/index.js +1 -206
  15. package/dist/collection/assets/icons/index.js.map +1 -1
  16. package/dist/collection/collection-manifest.json +4 -3
  17. package/dist/collection/components/atoms/mg-badge/mg-badge.js +2 -2
  18. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  19. package/dist/collection/components/atoms/mg-button/mg-button.js +6 -6
  20. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  21. package/dist/collection/components/atoms/mg-card/mg-card.js +2 -2
  22. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  23. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +2 -2
  24. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  25. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js.map +1 -1
  27. package/dist/collection/components/atoms/mg-icon/mg-icon.js +13 -8
  28. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  29. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +3 -3
  30. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  31. package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
  32. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  33. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +21 -0
  34. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -0
  35. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +509 -0
  36. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -0
  37. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -5
  38. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  39. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +7 -7
  40. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +67 -45
  43. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +31 -13
  45. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +48 -18
  47. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +54 -15
  49. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +40 -8
  51. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +44 -13
  53. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +63 -24
  55. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +47 -15
  57. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  58. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +30 -21
  59. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  60. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +3 -3
  61. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  62. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +4 -0
  63. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -1
  64. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +43 -7
  65. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  66. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  67. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +41 -41
  68. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  69. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  70. package/dist/collection/components/molecules/mg-form/mg-form.js +4 -4
  71. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  72. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +3 -3
  73. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js.map +1 -1
  74. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +12 -11
  75. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  76. package/dist/collection/components/molecules/mg-loader/mg-loader.js +3 -3
  77. package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
  78. package/dist/collection/components/molecules/mg-message/mg-message.js +3 -3
  79. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  80. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  81. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -4
  82. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  83. package/dist/collection/components/molecules/mg-panel/mg-panel.js +4 -4
  84. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  85. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  86. package/dist/collection/components/molecules/mg-popover/mg-popover.js +2 -2
  87. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  88. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  89. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  90. package/dist/collection/locales/en/messages.json +10 -3
  91. package/dist/collection/locales/fr/messages.json +10 -3
  92. package/dist/collection/locales/index.conf.js +2 -0
  93. package/dist/collection/locales/index.conf.js.map +1 -0
  94. package/dist/collection/utils/playwright.fixture.js +1 -1
  95. package/dist/collection/utils/playwright.fixture.js.map +1 -1
  96. package/dist/components/index.es.js +28 -28
  97. package/dist/components/index.es.js.map +1 -1
  98. package/dist/components/index2.js +26 -10
  99. package/dist/components/index2.js.map +1 -1
  100. package/dist/components/mg-action-more.js +16 -16
  101. package/dist/components/mg-action-more.js.map +1 -1
  102. package/dist/components/mg-badge2.js +3 -3
  103. package/dist/components/mg-badge2.js.map +1 -1
  104. package/dist/components/mg-button2.js +5 -5
  105. package/dist/components/mg-button2.js.map +1 -1
  106. package/dist/components/mg-card2.js +4 -4
  107. package/dist/components/mg-card2.js.map +1 -1
  108. package/dist/components/mg-character-left2.js +1 -1
  109. package/dist/components/mg-character-left2.js.map +1 -1
  110. package/dist/components/mg-details.js +3 -3
  111. package/dist/components/mg-divider.js +1 -1
  112. package/dist/components/mg-form.js +4 -4
  113. package/dist/components/mg-form.js.map +1 -1
  114. package/dist/components/mg-icon2.js +6 -418
  115. package/dist/components/mg-icon2.js.map +1 -1
  116. package/dist/components/mg-illustrated-message.js +5 -5
  117. package/dist/components/mg-input-checkbox-paginated2.js +13 -11
  118. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  119. package/dist/components/mg-input-checkbox.js +74 -52
  120. package/dist/components/mg-input-checkbox.js.map +1 -1
  121. package/dist/components/mg-input-date.js +39 -21
  122. package/dist/components/mg-input-date.js.map +1 -1
  123. package/dist/components/mg-input-numeric.js +46 -17
  124. package/dist/components/mg-input-numeric.js.map +1 -1
  125. package/dist/components/mg-input-password.js +59 -15
  126. package/dist/components/mg-input-password.js.map +1 -1
  127. package/dist/components/mg-input-radio.js +44 -13
  128. package/dist/components/mg-input-radio.js.map +1 -1
  129. package/dist/components/mg-input-select2.js +48 -18
  130. package/dist/components/mg-input-select2.js.map +1 -1
  131. package/dist/components/mg-input-text2.js +56 -24
  132. package/dist/components/mg-input-text2.js.map +1 -1
  133. package/dist/components/mg-input-textarea.js +50 -19
  134. package/dist/components/mg-input-textarea.js.map +1 -1
  135. package/dist/components/mg-input-title2.js +3 -3
  136. package/dist/components/mg-input-title2.js.map +1 -1
  137. package/dist/components/mg-input-toggle.js +39 -26
  138. package/dist/components/mg-input-toggle.js.map +1 -1
  139. package/dist/components/mg-input.d.ts +11 -0
  140. package/dist/components/mg-input.js +8 -0
  141. package/dist/components/mg-input.js.map +1 -0
  142. package/dist/components/mg-input2.js +352 -0
  143. package/dist/components/mg-input2.js.map +1 -0
  144. package/dist/components/mg-item-more.js +8 -7
  145. package/dist/components/mg-item-more.js.map +1 -1
  146. package/dist/components/mg-loader.js +3 -3
  147. package/dist/components/mg-loader.js.map +1 -1
  148. package/dist/components/mg-menu-item2.js +25 -8
  149. package/dist/components/mg-menu-item2.js.map +1 -1
  150. package/dist/components/mg-menu2.js +1 -1
  151. package/dist/components/mg-menu2.js.map +1 -1
  152. package/dist/components/mg-message.js +4 -4
  153. package/dist/components/mg-message.js.map +1 -1
  154. package/dist/components/mg-modal.js +9 -9
  155. package/dist/components/mg-modal.js.map +1 -1
  156. package/dist/components/mg-pagination2.js +14 -8
  157. package/dist/components/mg-pagination2.js.map +1 -1
  158. package/dist/components/mg-panel.js +19 -13
  159. package/dist/components/mg-panel.js.map +1 -1
  160. package/dist/components/mg-popover-content2.js +4 -4
  161. package/dist/components/mg-popover2.js +5 -5
  162. package/dist/components/mg-popover2.js.map +1 -1
  163. package/dist/components/mg-skip-links.js +3 -3
  164. package/dist/components/mg-tabs.js +7 -7
  165. package/dist/components/mg-tag.js +4 -4
  166. package/dist/components/mg-tag.js.map +1 -1
  167. package/dist/components/mg-tooltip2.js +6 -6
  168. package/dist/esm/{index-d2fc6ec0.js → index-445fc2a0.js} +99 -83
  169. package/dist/esm/index-445fc2a0.js.map +1 -0
  170. package/dist/esm/{index-4ad17402.js → index-629a42c7.js} +17 -5
  171. package/dist/esm/index-629a42c7.js.map +1 -0
  172. package/dist/esm/loader.js +3 -3
  173. package/dist/esm/{mg-action-more_34.entry.js → mg-action-more_35.entry.js} +693 -775
  174. package/dist/esm/mg-action-more_35.entry.js.map +1 -0
  175. package/dist/esm/mg-components.js +4 -4
  176. package/dist/esm/mg-components.js.map +1 -1
  177. package/dist/esm/mg-item-more.entry.js +8 -7
  178. package/dist/esm/mg-item-more.entry.js.map +1 -1
  179. package/dist/esm/mg-loader.entry.js +4 -4
  180. package/dist/esm/mg-loader.entry.js.map +1 -1
  181. package/dist/mg-components/locales/en/messages.json +10 -3
  182. package/dist/mg-components/locales/fr/messages.json +10 -3
  183. package/dist/mg-components/mg-components.esm.js +1 -1
  184. package/dist/mg-components/mg-components.esm.js.map +1 -1
  185. package/dist/mg-components/p-3ebe6845.js +2 -0
  186. package/dist/mg-components/p-3ebe6845.js.map +1 -0
  187. package/dist/mg-components/{p-568c9ea9.entry.js → p-6735e4b2.entry.js} +2 -2
  188. package/dist/mg-components/p-6735e4b2.entry.js.map +1 -0
  189. package/dist/mg-components/p-9dfaa41f.js +3 -0
  190. package/dist/mg-components/p-9dfaa41f.js.map +1 -0
  191. package/dist/mg-components/p-b3e0f7b3.entry.js +2 -0
  192. package/dist/mg-components/p-b3e0f7b3.entry.js.map +1 -0
  193. package/dist/mg-components/{p-22f575c5.entry.js → p-fe347f48.entry.js} +2 -2
  194. package/dist/mg-components/{p-22f575c5.entry.js.map → p-fe347f48.entry.js.map} +1 -1
  195. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -2
  196. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -5
  197. package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
  198. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -1
  199. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +5 -0
  200. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  201. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +2 -2
  202. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +2 -2
  203. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +35 -0
  204. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +139 -0
  205. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +5 -5
  206. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +3 -5
  207. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +13 -12
  208. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +8 -6
  209. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +12 -9
  210. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -5
  211. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +7 -3
  212. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -4
  213. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +18 -12
  214. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +12 -9
  215. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +12 -12
  216. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +1 -1
  217. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +8 -0
  218. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +10 -5
  219. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +7 -16
  220. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +9 -9
  221. package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -3
  222. package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +3 -12
  223. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +4 -3
  224. package/dist/types/components/molecules/mg-loader/mg-loader.d.ts +2 -2
  225. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -2
  226. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +2 -2
  227. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +3 -3
  228. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
  229. package/dist/types/components.d.ts +205 -94
  230. package/dist/types/locales/index.conf.d.ts +4 -0
  231. package/ide/intellij/web-types.json +6035 -0
  232. package/ide/vscode/html-custom-data.json +6517 -0
  233. package/package.json +33 -30
  234. package/dist/cjs/index-0256ee6d.js.map +0 -1
  235. package/dist/cjs/index-f699ee11.js.map +0 -1
  236. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +0 -1
  237. package/dist/collection/components/molecules/inputs/MgInput.conf.js +0 -14
  238. package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +0 -1
  239. package/dist/collection/components/molecules/inputs/MgInput.js +0 -125
  240. package/dist/collection/components/molecules/inputs/MgInput.js.map +0 -1
  241. package/dist/collection/utils/playwright.e2e.test.utils.js +0 -100
  242. package/dist/collection/utils/playwright.e2e.test.utils.js.map +0 -1
  243. package/dist/components/MgInput.js +0 -155
  244. package/dist/components/MgInput.js.map +0 -1
  245. package/dist/esm/index-4ad17402.js.map +0 -1
  246. package/dist/esm/index-d2fc6ec0.js.map +0 -1
  247. package/dist/esm/mg-action-more_34.entry.js.map +0 -1
  248. package/dist/mg-components/p-29b5a514.js +0 -2
  249. package/dist/mg-components/p-29b5a514.js.map +0 -1
  250. package/dist/mg-components/p-568c9ea9.entry.js.map +0 -1
  251. package/dist/mg-components/p-57614d95.entry.js +0 -2
  252. package/dist/mg-components/p-57614d95.entry.js.map +0 -1
  253. package/dist/mg-components/p-f761ebcd.js +0 -3
  254. package/dist/mg-components/p-f761ebcd.js.map +0 -1
  255. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -46
  256. package/dist/types/components/molecules/inputs/MgInput.d.ts +0 -13
@@ -0,0 +1,509 @@
1
+ import { h, Host } from "@stencil/core";
2
+ import { isValidString } from "@mgdis/stencil-helpers";
3
+ import { tooltipPositions, classFieldset, classReadonly, classDisabled, classVerticalList } from "./mg-input.conf";
4
+ export class MgInput {
5
+ constructor() {
6
+ this.slotLabel = 'label';
7
+ this.slotError = 'error';
8
+ this.slotHelpText = 'help-text';
9
+ // style
10
+ this.classInput = 'mg-c-input';
11
+ this.classHasError = 'mg-c-input--has-error';
12
+ this.classLabelOnTop = 'mg-c-input--label-on-top';
13
+ /**
14
+ * Get readonly values
15
+ * @returns formated readonly value
16
+ */
17
+ this.getReadonlyValues = () => {
18
+ var _a;
19
+ if (Array.isArray(this.readonlyValue) && !this.isVerticalList) {
20
+ return this.readonlyValue.join(', ');
21
+ }
22
+ else if (Array.isArray(this.readonlyValue) && this.readonlyValue.length > 1) {
23
+ return this.readonlyValue;
24
+ }
25
+ else if (Array.isArray(this.readonlyValue) && this.readonlyValue.length === 1) {
26
+ return this.readonlyValue[0];
27
+ }
28
+ else {
29
+ return ((_a = this.readonlyValue) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.readonlyValue : '';
30
+ }
31
+ };
32
+ /**
33
+ * Get tooltip node
34
+ * @returns mg-tooltip
35
+ */
36
+ this.renderTooltip = () => (h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, h("mg-icon", { icon: "info-circle" })));
37
+ this.identifier = undefined;
38
+ this.label = undefined;
39
+ this.labelOnTop = undefined;
40
+ this.labelHide = false;
41
+ this.tooltip = undefined;
42
+ this.tooltipPosition = 'input';
43
+ this.required = false;
44
+ this.readonlyValue = undefined;
45
+ this.errorMessage = undefined;
46
+ this.helpText = undefined;
47
+ this.ariaDescribedbyIDs = undefined;
48
+ this.isFieldset = false;
49
+ this.isReadonly = false;
50
+ this.isDisabled = false;
51
+ this.isVerticalList = false;
52
+ }
53
+ watchIdentifier(newValue) {
54
+ if (!isValidString(newValue)) {
55
+ throw new Error('<mg-input> prop "identifier" is required.');
56
+ }
57
+ else {
58
+ this.helpTextId = `${this.identifier}-help-text`;
59
+ this.helpTextErrorId = `${this.identifier}-error`;
60
+ }
61
+ }
62
+ watchLabelOnTop(newValue) {
63
+ if (newValue) {
64
+ this.element.classList.add(this.classLabelOnTop);
65
+ }
66
+ else {
67
+ this.element.classList.remove(this.classLabelOnTop);
68
+ }
69
+ }
70
+ watchLabelConfig() {
71
+ if (this.labelHide && this.labelOnTop) {
72
+ throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
73
+ }
74
+ }
75
+ watchTooltipPosition(newValue) {
76
+ if (!tooltipPositions.includes(newValue)) {
77
+ throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}`);
78
+ }
79
+ }
80
+ watchErrorMessage(newValue) {
81
+ var _a;
82
+ if (newValue) {
83
+ this.element.classList.add(this.classHasError);
84
+ this.renderErrorMessage();
85
+ }
86
+ else {
87
+ this.element.classList.remove(this.classHasError);
88
+ (_a = this.errorMessageSlotElement) === null || _a === void 0 ? void 0 : _a.remove();
89
+ this.errorMessageSlotElement = undefined;
90
+ }
91
+ }
92
+ watchHelpText(newValue) {
93
+ var _a;
94
+ if (newValue) {
95
+ this.renderHelpText();
96
+ }
97
+ else {
98
+ (_a = this.helptextMessageSlotElement) === null || _a === void 0 ? void 0 : _a.remove();
99
+ this.helptextMessageSlotElement = undefined;
100
+ }
101
+ }
102
+ watchAriaDescribedbyIDs() {
103
+ // a11y IDs
104
+ const ariaDescribedbyIDs = new Set(this.ariaDescribedbyIDs);
105
+ // Help text
106
+ if (this.helpText) {
107
+ this.renderHelpText();
108
+ if (!ariaDescribedbyIDs.has(this.helpTextId))
109
+ ariaDescribedbyIDs.add(this.helpTextId);
110
+ }
111
+ // Error Message
112
+ if (this.errorMessage) {
113
+ this.renderErrorMessage();
114
+ if (!ariaDescribedbyIDs.has(this.helpTextErrorId))
115
+ ariaDescribedbyIDs.add(this.helpTextErrorId);
116
+ }
117
+ this.element.querySelectorAll('input,select,textarea,[role="switch"]').forEach(element => {
118
+ element.setAttribute('aria-describedby', Array.from(ariaDescribedbyIDs).join(' '));
119
+ });
120
+ }
121
+ /**
122
+ * Component classes
123
+ */
124
+ // eslint-disable-next-line @stencil-community/no-unused-watch
125
+ watchClass() {
126
+ if (!this.element.classList.contains(this.classInput)) {
127
+ this.element.classList.add(this.classInput);
128
+ }
129
+ this.isFieldset = this.element.classList.contains(classFieldset);
130
+ this.isReadonly = this.element.classList.contains(classReadonly);
131
+ this.isDisabled = this.element.classList.contains(classDisabled);
132
+ this.isVerticalList = this.element.classList.contains(classVerticalList);
133
+ }
134
+ /**
135
+ * Trigger label update
136
+ */
137
+ // eslint-disable-next-line @stencil-community/no-unused-watch
138
+ watchLabel() {
139
+ if (!isValidString(this.label)) {
140
+ throw new Error('<mg-input> prop "label" is required.');
141
+ }
142
+ else {
143
+ this.watchAriaDescribedbyIDs();
144
+ this.renderLabel();
145
+ }
146
+ }
147
+ /************
148
+ * Methods *
149
+ ************/
150
+ /**
151
+ * Render input label
152
+ */
153
+ renderLabel() {
154
+ let labelSlotElement = this.element.querySelector(`[slot=${this.slotLabel}]`);
155
+ // first remove previous labelslot if exist
156
+ labelSlotElement === null || labelSlotElement === void 0 ? void 0 : labelSlotElement.remove();
157
+ // create title element
158
+ labelSlotElement = document.createElement('mg-input-title');
159
+ [
160
+ ['slot', this.slotLabel],
161
+ ['identifier', this.identifier],
162
+ ['readonly', this.isReadonly.toString()],
163
+ ['required', ((this.required && !this.isDisabled) || false).toString()],
164
+ ['is-legend', this.isFieldset.toString()],
165
+ ].forEach(([attr, val]) => {
166
+ labelSlotElement.setAttribute(attr, val);
167
+ });
168
+ // create label element
169
+ const label = document.createElement('span');
170
+ label.classList.add('mg-c-input-title__text');
171
+ label.textContent = this.label;
172
+ labelSlotElement.appendChild(label);
173
+ this.element.appendChild(labelSlotElement);
174
+ }
175
+ /**
176
+ * Render error message
177
+ */
178
+ renderErrorMessage() {
179
+ this.errorMessageSlotElement = this.element.querySelector(`[slot=${this.slotError}]`);
180
+ if (!this.errorMessageSlotElement) {
181
+ this.errorMessageSlotElement = document.createElement('div');
182
+ this.errorMessageSlotElement.setAttribute('slot', this.slotError);
183
+ this.element.appendChild(this.errorMessageSlotElement);
184
+ }
185
+ this.errorMessageSlotElement.setAttribute('id', this.helpTextErrorId);
186
+ this.errorMessageSlotElement.innerHTML = this.errorMessage;
187
+ }
188
+ /**
189
+ * Render help text message
190
+ */
191
+ renderHelpText() {
192
+ this.helptextMessageSlotElement = this.element.querySelector(`[slot=${this.slotHelpText}]`);
193
+ if (!this.helptextMessageSlotElement) {
194
+ this.helptextMessageSlotElement = document.createElement('div');
195
+ this.helptextMessageSlotElement.setAttribute('slot', this.slotHelpText);
196
+ this.element.appendChild(this.helptextMessageSlotElement);
197
+ }
198
+ this.helptextMessageSlotElement.setAttribute('id', this.helpTextId);
199
+ this.helptextMessageSlotElement.innerHTML = this.helpText;
200
+ }
201
+ /*************
202
+ * Lifecycle *
203
+ *************/
204
+ /**
205
+ * Check if component props are well configured on init
206
+ */
207
+ componentWillLoad() {
208
+ this.watchIdentifier(this.identifier);
209
+ this.watchLabel();
210
+ this.watchLabelOnTop(this.labelOnTop);
211
+ this.watchLabelConfig();
212
+ this.watchTooltipPosition(this.tooltipPosition);
213
+ this.watchHelpText(this.helpText);
214
+ this.watchErrorMessage(this.errorMessage);
215
+ this.watchClass();
216
+ }
217
+ /**
218
+ * Validate slots
219
+ */
220
+ componentDidLoad() {
221
+ this.watchAriaDescribedbyIDs();
222
+ if (!this.isReadonly && !this.isFieldset && !this.element.querySelector(`#${this.identifier}`)) {
223
+ throw new Error(`<mg-input> "identifier" prop has no target for id: ${this.identifier}. Add an id to the targeted input.`);
224
+ }
225
+ }
226
+ /**
227
+ * Render
228
+ * @returns HTML Element
229
+ */
230
+ render() {
231
+ const readonlyValue = this.getReadonlyValues();
232
+ const isGroup = this.isFieldset && !this.isReadonly;
233
+ return (h(Host, { key: 'de3590a7b4e4f3b8b9e63af5b9b5562dd5da69fc', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, h("div", { key: 'b530d05b3456a7a68a36c931591958742a44c8c9', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, h("slot", { key: '0fddf2c64ecc28626be04c920663efee9d67cf0a', name: this.slotLabel }), this.tooltip && !this.isReadonly && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), h("div", { key: 'afa1657e3ecb323076c59063901e7dda505e0096', class: "mg-c-input__input-container" }, this.isReadonly
234
+ ? [
235
+ Array.isArray(readonlyValue) ? (h("ul", { key: "readonly-value-list" }, readonlyValue.map(value => (h("li", { key: value }, h("strong", null, value)))))) : (h("strong", { key: "readonly-value" }, readonlyValue)),
236
+ h("slot", { key: "default-slot" }),
237
+ ]
238
+ : [
239
+ h("div", { class: "mg-c-input__input", key: "tooltip" }, h("slot", null), this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()),
240
+ this.helpText && (h("div", { class: "mg-c-input__help-text", key: "help-text" }, h("slot", { name: this.slotHelpText }))),
241
+ !this.isDisabled && this.errorMessage && (h("div", { class: "mg-c-input__error", "aria-live": "assertive", key: "error-message" }, h("slot", { name: this.slotError }))),
242
+ ])));
243
+ }
244
+ static get is() { return "mg-input"; }
245
+ static get encapsulation() { return "shadow"; }
246
+ static get originalStyleUrls() {
247
+ return {
248
+ "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-input.css"]
249
+ };
250
+ }
251
+ static get styleUrls() {
252
+ return {
253
+ "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-input.css"]
254
+ };
255
+ }
256
+ static get properties() {
257
+ return {
258
+ "identifier": {
259
+ "type": "string",
260
+ "mutable": false,
261
+ "complexType": {
262
+ "original": "string",
263
+ "resolved": "string",
264
+ "references": {}
265
+ },
266
+ "required": true,
267
+ "optional": false,
268
+ "docs": {
269
+ "tags": [],
270
+ "text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)"
271
+ },
272
+ "attribute": "identifier",
273
+ "reflect": false
274
+ },
275
+ "label": {
276
+ "type": "string",
277
+ "mutable": false,
278
+ "complexType": {
279
+ "original": "string",
280
+ "resolved": "string",
281
+ "references": {}
282
+ },
283
+ "required": true,
284
+ "optional": false,
285
+ "docs": {
286
+ "tags": [],
287
+ "text": "Define input label"
288
+ },
289
+ "attribute": "label",
290
+ "reflect": false
291
+ },
292
+ "labelOnTop": {
293
+ "type": "boolean",
294
+ "mutable": false,
295
+ "complexType": {
296
+ "original": "boolean",
297
+ "resolved": "boolean",
298
+ "references": {}
299
+ },
300
+ "required": false,
301
+ "optional": true,
302
+ "docs": {
303
+ "tags": [],
304
+ "text": "Define if label is displayed on top"
305
+ },
306
+ "attribute": "label-on-top",
307
+ "reflect": false
308
+ },
309
+ "labelHide": {
310
+ "type": "boolean",
311
+ "mutable": false,
312
+ "complexType": {
313
+ "original": "boolean",
314
+ "resolved": "boolean",
315
+ "references": {}
316
+ },
317
+ "required": false,
318
+ "optional": false,
319
+ "docs": {
320
+ "tags": [],
321
+ "text": "Define if label is visible"
322
+ },
323
+ "attribute": "label-hide",
324
+ "reflect": false,
325
+ "defaultValue": "false"
326
+ },
327
+ "tooltip": {
328
+ "type": "string",
329
+ "mutable": false,
330
+ "complexType": {
331
+ "original": "string",
332
+ "resolved": "string",
333
+ "references": {}
334
+ },
335
+ "required": false,
336
+ "optional": true,
337
+ "docs": {
338
+ "tags": [],
339
+ "text": "Add a tooltip message next to the input"
340
+ },
341
+ "attribute": "tooltip",
342
+ "reflect": false
343
+ },
344
+ "tooltipPosition": {
345
+ "type": "string",
346
+ "mutable": false,
347
+ "complexType": {
348
+ "original": "TooltipPosition",
349
+ "resolved": "\"input\" | \"label\"",
350
+ "references": {
351
+ "TooltipPosition": {
352
+ "location": "import",
353
+ "path": "./mg-input.conf",
354
+ "id": "src/components/molecules/inputs/mg-input/mg-input.conf.ts::TooltipPosition"
355
+ }
356
+ }
357
+ },
358
+ "required": false,
359
+ "optional": false,
360
+ "docs": {
361
+ "tags": [],
362
+ "text": "Define tooltip position"
363
+ },
364
+ "attribute": "tooltip-position",
365
+ "reflect": false,
366
+ "defaultValue": "'input'"
367
+ },
368
+ "required": {
369
+ "type": "boolean",
370
+ "mutable": false,
371
+ "complexType": {
372
+ "original": "boolean",
373
+ "resolved": "boolean",
374
+ "references": {}
375
+ },
376
+ "required": false,
377
+ "optional": false,
378
+ "docs": {
379
+ "tags": [],
380
+ "text": "Define if input is required"
381
+ },
382
+ "attribute": "required",
383
+ "reflect": false,
384
+ "defaultValue": "false"
385
+ },
386
+ "readonlyValue": {
387
+ "type": "string",
388
+ "mutable": false,
389
+ "complexType": {
390
+ "original": "string | string[]",
391
+ "resolved": "string | string[]",
392
+ "references": {}
393
+ },
394
+ "required": false,
395
+ "optional": false,
396
+ "docs": {
397
+ "tags": [],
398
+ "text": "Defines value to display in readonly mode"
399
+ },
400
+ "attribute": "readonly-value",
401
+ "reflect": false
402
+ },
403
+ "errorMessage": {
404
+ "type": "string",
405
+ "mutable": false,
406
+ "complexType": {
407
+ "original": "string",
408
+ "resolved": "string",
409
+ "references": {}
410
+ },
411
+ "required": false,
412
+ "optional": true,
413
+ "docs": {
414
+ "tags": [],
415
+ "text": "Define error message to display"
416
+ },
417
+ "attribute": "error-message",
418
+ "reflect": false
419
+ },
420
+ "helpText": {
421
+ "type": "string",
422
+ "mutable": false,
423
+ "complexType": {
424
+ "original": "string",
425
+ "resolved": "string",
426
+ "references": {}
427
+ },
428
+ "required": false,
429
+ "optional": true,
430
+ "docs": {
431
+ "tags": [],
432
+ "text": "Define help text to display"
433
+ },
434
+ "attribute": "help-text",
435
+ "reflect": false
436
+ },
437
+ "ariaDescribedbyIDs": {
438
+ "type": "unknown",
439
+ "mutable": false,
440
+ "complexType": {
441
+ "original": "string[]",
442
+ "resolved": "string[]",
443
+ "references": {}
444
+ },
445
+ "required": false,
446
+ "optional": false,
447
+ "docs": {
448
+ "tags": [],
449
+ "text": "Define aria-describedby ids to link with"
450
+ }
451
+ }
452
+ };
453
+ }
454
+ static get states() {
455
+ return {
456
+ "isFieldset": {},
457
+ "isReadonly": {},
458
+ "isDisabled": {},
459
+ "isVerticalList": {}
460
+ };
461
+ }
462
+ static get elementRef() { return "element"; }
463
+ static get watchers() {
464
+ return [{
465
+ "propName": "identifier",
466
+ "methodName": "watchIdentifier"
467
+ }, {
468
+ "propName": "labelOnTop",
469
+ "methodName": "watchLabelOnTop"
470
+ }, {
471
+ "propName": "labelHide",
472
+ "methodName": "watchLabelConfig"
473
+ }, {
474
+ "propName": "labelOnTop",
475
+ "methodName": "watchLabelConfig"
476
+ }, {
477
+ "propName": "tooltipPosition",
478
+ "methodName": "watchTooltipPosition"
479
+ }, {
480
+ "propName": "errorMessage",
481
+ "methodName": "watchErrorMessage"
482
+ }, {
483
+ "propName": "helpText",
484
+ "methodName": "watchHelpText"
485
+ }, {
486
+ "propName": "identifier",
487
+ "methodName": "watchAriaDescribedbyIDs"
488
+ }, {
489
+ "propName": "errorMessage",
490
+ "methodName": "watchAriaDescribedbyIDs"
491
+ }, {
492
+ "propName": "helpText",
493
+ "methodName": "watchAriaDescribedbyIDs"
494
+ }, {
495
+ "propName": "ariaDescribedbyIDs",
496
+ "methodName": "watchAriaDescribedbyIDs"
497
+ }, {
498
+ "propName": "class",
499
+ "methodName": "watchClass"
500
+ }, {
501
+ "propName": "class",
502
+ "methodName": "watchLabel"
503
+ }, {
504
+ "propName": "label",
505
+ "methodName": "watchLabel"
506
+ }];
507
+ }
508
+ }
509
+ //# sourceMappingURL=mg-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-input.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input/mg-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAwB,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAOzI,MAAM,OAAO,OAAO;;QAQD,cAAS,GAAG,OAAO,CAAC;QACpB,cAAS,GAAG,OAAO,CAAC;QACpB,iBAAY,GAAG,WAAW,CAAC;QAM5C,QAAQ;QACS,eAAU,GAAG,YAAY,CAAC;QAC1B,kBAAa,GAAG,uBAAuB,CAAC;QACxC,oBAAe,GAAG,0BAA0B,CAAC;QA2P9D;;;WAGG;QACK,sBA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KAAK;wBACZ,kBAAS,KAAK,CAAU,CACrB,CACN,CAAC,CACC,CACN,CAAC,CAAC,CAAC,CACF,cAAQ,GAAG,EAAC,gBAAgB,IAAE,aAAa,CAAU,CACtD;oBACD,YAAM,GAAG,EAAC,cAAc,GAAQ;iBACjC;gBACH,CAAC,CAAC;oBACE,WAAK,KAAK,EAAC,mBAAmB,EAAC,GAAG,EAAC,SAAS;wBAC1C,eAAa;wBACZ,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,eAAe,KAAK,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAC7G;oBACN,IAAI,CAAC,QAAQ,IAAI,CACf,WAAK,KAAK,EAAC,uBAAuB,EAAC,GAAG,EAAC,WAAW;wBAChD,YAAM,IAAI,EAAE,IAAI,CAAC,YAAY,GAAS,CAClC,CACP;oBACD,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,IAAI,CACvC,WAAK,KAAK,EAAC,mBAAmB,eAAW,WAAW,EAAC,GAAG,EAAC,eAAe;wBACtE,YAAM,IAAI,EAAE,IAAI,CAAC,SAAS,GAAS,CAC/B,CACP;iBACF,CACD,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Element, Watch, Host, State } from '@stencil/core';\nimport { isValidString } from '@mgdis/stencil-helpers';\nimport { tooltipPositions, type TooltipPosition, classFieldset, classReadonly, classDisabled, classVerticalList } from './mg-input.conf';\n\n@Component({\n tag: 'mg-input',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input.css',\n shadow: true,\n})\nexport class MgInput {\n /************\n * Internal *\n ************/\n\n // HTML selectors\n private helpTextId: string;\n private helpTextErrorId: string;\n private readonly slotLabel = 'label';\n private readonly slotError = 'error';\n private readonly slotHelpText = 'help-text';\n\n // slots elements\n private errorMessageSlotElement: HTMLElement;\n private helptextMessageSlotElement: HTMLElement;\n\n // style\n private readonly classInput = 'mg-c-input';\n private readonly classHasError = 'mg-c-input--has-error';\n private readonly classLabelOnTop = 'mg-c-input--label-on-top';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n @Watch('identifier')\n watchIdentifier(newValue: MgInput['identifier']): void {\n if (!isValidString(newValue)) {\n throw new Error('<mg-input> prop \"identifier\" is required.');\n } else {\n this.helpTextId = `${this.identifier}-help-text`;\n this.helpTextErrorId = `${this.identifier}-error`;\n }\n }\n\n /**\n * Define input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop?: boolean;\n @Watch('labelOnTop')\n watchLabelOnTop(newValue: MgInput['labelOnTop']): void {\n if (newValue) {\n this.element.classList.add(this.classLabelOnTop);\n } else {\n this.element.classList.remove(this.classLabelOnTop);\n }\n }\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide: boolean = false;\n @Watch('labelHide')\n @Watch('labelOnTop')\n watchLabelConfig(): void {\n if (this.labelHide && this.labelOnTop) {\n throw new Error('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\".');\n }\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip?: string;\n\n /**\n * Define tooltip position\n */\n @Prop() tooltipPosition: TooltipPosition = 'input';\n @Watch('tooltipPosition')\n watchTooltipPosition(newValue: MgInput['tooltipPosition']) {\n if (!tooltipPositions.includes(newValue)) {\n throw new Error(`<mg-input> prop \"tooltipPosition\" must be one of: ${tooltipPositions.join(', ')}`);\n }\n }\n\n /**\n * Define if input is required\n */\n @Prop() required: boolean = false;\n\n /**\n * Defines value to display in readonly mode\n */\n @Prop() readonlyValue: string | string[];\n\n /**\n * Define error message to display\n */\n @Prop() errorMessage?: string;\n @Watch('errorMessage')\n watchErrorMessage(newValue: MgInput['errorMessage']): void {\n if (newValue) {\n this.element.classList.add(this.classHasError);\n this.renderErrorMessage();\n } else {\n this.element.classList.remove(this.classHasError);\n this.errorMessageSlotElement?.remove();\n this.errorMessageSlotElement = undefined;\n }\n }\n\n /**\n * Define help text to display\n */\n @Prop() helpText?: string;\n @Watch('helpText')\n watchHelpText(newValue: MgInput['helpText']): void {\n if (newValue) {\n this.renderHelpText();\n } else {\n this.helptextMessageSlotElement?.remove();\n this.helptextMessageSlotElement = undefined;\n }\n }\n\n /**\n * Define aria-describedby ids to link with\n */\n @Prop() ariaDescribedbyIDs: string[];\n @Watch('identifier')\n @Watch('errorMessage')\n @Watch('helpText')\n @Watch('ariaDescribedbyIDs')\n watchAriaDescribedbyIDs(): void {\n // a11y IDs\n const ariaDescribedbyIDs = new Set(this.ariaDescribedbyIDs);\n // Help text\n if (this.helpText) {\n this.renderHelpText();\n if (!ariaDescribedbyIDs.has(this.helpTextId)) ariaDescribedbyIDs.add(this.helpTextId);\n }\n\n // Error Message\n if (this.errorMessage) {\n this.renderErrorMessage();\n if (!ariaDescribedbyIDs.has(this.helpTextErrorId)) ariaDescribedbyIDs.add(this.helpTextErrorId);\n }\n\n this.element.querySelectorAll('input,select,textarea,[role=\"switch\"]').forEach(element => {\n element.setAttribute('aria-describedby', Array.from(ariaDescribedbyIDs).join(' '));\n });\n }\n\n /**\n * Component classes\n */\n // eslint-disable-next-line @stencil-community/no-unused-watch\n @Watch('class')\n watchClass(): void {\n if (!this.element.classList.contains(this.classInput)) {\n this.element.classList.add(this.classInput);\n }\n this.isFieldset = this.element.classList.contains(classFieldset);\n this.isReadonly = this.element.classList.contains(classReadonly);\n this.isDisabled = this.element.classList.contains(classDisabled);\n this.isVerticalList = this.element.classList.contains(classVerticalList);\n }\n\n /**\n * Trigger label update\n */\n // eslint-disable-next-line @stencil-community/no-unused-watch\n @Watch('class')\n @Watch('label')\n watchLabel(): void {\n if (!isValidString(this.label)) {\n throw new Error('<mg-input> prop \"label\" is required.');\n } else {\n this.watchAriaDescribedbyIDs();\n this.renderLabel();\n }\n }\n\n /**\n * Element is fieldset\n */\n @State() isFieldset: boolean = false;\n\n /**\n * Element is readonly\n */\n @State() isReadonly: boolean = false;\n\n /**\n * Element is disabled\n */\n @State() isDisabled: boolean = false;\n\n /**\n * Element is disabled\n */\n @State() isVerticalList: boolean = false;\n\n /************\n * Methods *\n ************/\n\n /**\n * Render input label\n */\n private renderLabel(): void {\n let labelSlotElement: HTMLMgInputTitleElement = this.element.querySelector(`[slot=${this.slotLabel}]`);\n\n // first remove previous labelslot if exist\n labelSlotElement?.remove();\n\n // create title element\n labelSlotElement = document.createElement('mg-input-title');\n [\n ['slot', this.slotLabel],\n ['identifier', this.identifier],\n ['readonly', this.isReadonly.toString()],\n ['required', ((this.required && !this.isDisabled) || false).toString()],\n ['is-legend', this.isFieldset.toString()],\n ].forEach(([attr, val]) => {\n labelSlotElement.setAttribute(attr, val);\n });\n\n // create label element\n const label = document.createElement('span');\n label.classList.add('mg-c-input-title__text');\n label.textContent = this.label;\n\n labelSlotElement.appendChild(label);\n this.element.appendChild(labelSlotElement);\n }\n\n /**\n * Render error message\n */\n private renderErrorMessage(): void {\n this.errorMessageSlotElement = this.element.querySelector(`[slot=${this.slotError}]`);\n if (!this.errorMessageSlotElement) {\n this.errorMessageSlotElement = document.createElement('div');\n this.errorMessageSlotElement.setAttribute('slot', this.slotError);\n this.element.appendChild(this.errorMessageSlotElement);\n }\n this.errorMessageSlotElement.setAttribute('id', this.helpTextErrorId);\n this.errorMessageSlotElement.innerHTML = this.errorMessage;\n }\n\n /**\n * Render help text message\n */\n private renderHelpText(): void {\n this.helptextMessageSlotElement = this.element.querySelector(`[slot=${this.slotHelpText}]`);\n if (!this.helptextMessageSlotElement) {\n this.helptextMessageSlotElement = document.createElement('div');\n this.helptextMessageSlotElement.setAttribute('slot', this.slotHelpText);\n this.element.appendChild(this.helptextMessageSlotElement);\n }\n this.helptextMessageSlotElement.setAttribute('id', this.helpTextId);\n this.helptextMessageSlotElement.innerHTML = this.helpText;\n }\n\n /**\n * Get readonly values\n * @returns formated readonly value\n */\n private getReadonlyValues = (): string | string[] => {\n if (Array.isArray(this.readonlyValue) && !this.isVerticalList) {\n return this.readonlyValue.join(', ');\n } else if (Array.isArray(this.readonlyValue) && this.readonlyValue.length > 1) {\n return this.readonlyValue;\n } else if (Array.isArray(this.readonlyValue) && this.readonlyValue.length === 1) {\n return this.readonlyValue[0];\n } else {\n return this.readonlyValue?.length > 0 ? this.readonlyValue : '';\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n this.watchIdentifier(this.identifier);\n this.watchLabel();\n this.watchLabelOnTop(this.labelOnTop);\n this.watchLabelConfig();\n this.watchTooltipPosition(this.tooltipPosition);\n this.watchHelpText(this.helpText);\n this.watchErrorMessage(this.errorMessage);\n this.watchClass();\n }\n\n /**\n * Validate slots\n */\n componentDidLoad(): void {\n this.watchAriaDescribedbyIDs();\n if (!this.isReadonly && !this.isFieldset && !this.element.querySelector(`#${this.identifier}`)) {\n throw new Error(`<mg-input> \"identifier\" prop has no target for id: ${this.identifier}. Add an id to the targeted input.`);\n }\n }\n\n /**\n * Get tooltip node\n * @returns mg-tooltip\n */\n private renderTooltip = (): HTMLMgTooltipElement => (\n <mg-tooltip identifier={`${this.identifier}-tooltip`} message={this.tooltip}>\n <mg-icon icon=\"info-circle\"></mg-icon>\n </mg-tooltip>\n );\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const readonlyValue = this.getReadonlyValues();\n const isGroup = this.isFieldset && !this.isReadonly;\n return (\n <Host class={this.element.classList.toString()} role={isGroup ? 'group' : undefined} aria-labelledby={isGroup ? `${this.identifier}-title` : undefined}>\n <div class={{ 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide }}>\n <slot name={this.slotLabel}></slot>\n {this.tooltip && !this.isReadonly && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()}\n </div>\n <div class=\"mg-c-input__input-container\">\n {this.isReadonly\n ? [\n Array.isArray(readonlyValue) ? (\n <ul key=\"readonly-value-list\">\n {readonlyValue.map(value => (\n <li key={value}>\n <strong>{value}</strong>\n </li>\n ))}\n </ul>\n ) : (\n <strong key=\"readonly-value\">{readonlyValue}</strong>\n ),\n <slot key=\"default-slot\"></slot>,\n ]\n : [\n <div class=\"mg-c-input__input\" key=\"tooltip\">\n <slot></slot>\n {this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()}\n </div>,\n this.helpText && (\n <div class=\"mg-c-input__help-text\" key=\"help-text\">\n <slot name={this.slotHelpText}></slot>\n </div>\n ),\n !this.isDisabled && this.errorMessage && (\n <div class=\"mg-c-input__error\" aria-live=\"assertive\" key=\"error-message\">\n <slot name={this.slotError}></slot>\n </div>\n ),\n ]}\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -6,11 +6,7 @@ import { h } from "@stencil/core";
6
6
  */
7
7
  export const MgInputCheckboxList = (props) => (
8
8
  // eslint-disable-next-line jsx-a11y/no-redundant-roles
9
- h("ul", { class: {
10
- 'mg-c-input__input-group-container': true,
11
- 'mg-c-input__input-group-container--vertical': props.inputVerticalList || props.type === 'multi',
12
- 'mg-c-input__input-checkbox-multi-inputs': props.type === 'multi',
13
- }, role: "list", "aria-describedby": props.displaySearchInput ? 'search-results' : undefined, "aria-label": props.displaySearchInput ? props.messages.searchResults : undefined, "aria-live": props.displaySearchInput ? 'polite' : undefined, id: props.id }, props.checkboxes.map(input => {
9
+ h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-describedby": props.displaySearchInput ? 'search-results' : undefined, "aria-label": props.displaySearchInput ? props.messages.searchResults : undefined, "aria-live": props.displaySearchInput ? 'polite' : undefined, id: props.id }, props.checkboxes.map(input => {
14
10
  var _a, _b;
15
11
  return (h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } }, h("input", { type: "checkbox", id: input._id, name: props.name, value: (_a = input.value) === null || _a === void 0 ? void 0 : _a.toString(), checked: Boolean(input.value), required: input.required, "aria-invalid": ((_b = props.invalid) === null || _b === void 0 ? void 0 : _b.toString()) || 'false', disabled: props.disabled || input.disabled, indeterminate: input.value === null, onInput: input._handleInput, onBlur: input._handleBlur, onKeyDown: input._handleKeydown }), h("label", { htmlFor: input._id }, input.title)));
16
12
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"MgInputCheckboxList.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAS,MAAM,eAAe,CAAC;AAG9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAkD,CAAC,KAA+B,EAAW,EAAE,CAAC;AAC9H,uDAAuD;AACvD,UACE,KAAK,EAAE;QACL,mCAAmC,EAAE,IAAI;QACzC,6CAA6C,EAAE,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;QAChG,yCAAyC,EAAE,KAAK,CAAC,IAAI,KAAK,OAAO;KAClE,EACD,IAAI,EAAC,MAAM,sBACO,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,gBAC7D,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,eACpE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC1D,EAAE,EAAE,KAAK,CAAC,EAAE,IAEX,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;;IAAC,OAAA,CAC7B,UAAI,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,mCAAmC,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,EAAE;QACnI,aACE,IAAI,EAAC,UAAU,EACf,EAAE,EAAE,KAAK,CAAC,GAAG,EACb,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,0CAAE,QAAQ,EAAE,EAC9B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAC7B,QAAQ,EAAE,KAAK,CAAC,QAAQ,kBACV,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,QAAQ,EAAE,KAAI,OAAO,EAClD,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,EAC1C,aAAa,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI,EACnC,OAAO,EAAE,KAAK,CAAC,YAAY,EAC3B,MAAM,EAAE,KAAK,CAAC,WAAW,EACzB,SAAS,EAAE,KAAK,CAAC,cAAc,GAC/B;QACF,aAAO,OAAO,EAAE,KAAK,CAAC,GAAG,IAAG,KAAK,CAAC,KAAK,CAAS,CAC7C,CACN,CAAA;CAAA,CAAC,CACC,CACN,CAAC","sourcesContent":["import { FunctionalComponent, h, VNode } from '@stencil/core';\nimport { MgInputCheckboxListProps } from './mg-input-checkbox.conf';\n\n/**\n * Get checkboxes list template\n * @param props - MgInputCheckboxList Interface Props\n * @returns input template\n */\nexport const MgInputCheckboxList: FunctionalComponent<MgInputCheckboxListProps> = (props: MgInputCheckboxListProps): VNode[] => (\n // eslint-disable-next-line jsx-a11y/no-redundant-roles\n <ul\n class={{\n 'mg-c-input__input-group-container': true,\n 'mg-c-input__input-group-container--vertical': props.inputVerticalList || props.type === 'multi',\n 'mg-c-input__input-checkbox-multi-inputs': props.type === 'multi',\n }}\n role=\"list\"\n aria-describedby={props.displaySearchInput ? 'search-results' : undefined}\n aria-label={props.displaySearchInput ? props.messages.searchResults : undefined}\n aria-live={props.displaySearchInput ? 'polite' : undefined}\n id={props.id}\n >\n {props.checkboxes.map(input => (\n <li key={input._id} class={{ 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled }}>\n <input\n type=\"checkbox\"\n id={input._id}\n name={props.name}\n value={input.value?.toString()}\n checked={Boolean(input.value)}\n required={input.required}\n aria-invalid={props.invalid?.toString() || 'false'}\n disabled={props.disabled || input.disabled}\n indeterminate={input.value === null}\n onInput={input._handleInput}\n onBlur={input._handleBlur}\n onKeyDown={input._handleKeydown}\n />\n <label htmlFor={input._id}>{input.title}</label>\n </li>\n ))}\n </ul>\n);\n"]}
1
+ {"version":3,"file":"MgInputCheckboxList.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAS,MAAM,eAAe,CAAC;AAG9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAkD,CAAC,KAA+B,EAAW,EAAE,CAAC;AAC9H,uDAAuD;AACvD,UACE,KAAK,EAAC,mCAAmC,EACzC,IAAI,EAAC,MAAM,sBACO,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,gBAC7D,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,eACpE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC1D,EAAE,EAAE,KAAK,CAAC,EAAE,IAEX,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;;IAAC,OAAA,CAC7B,UAAI,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,mCAAmC,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,EAAE;QACnI,aACE,IAAI,EAAC,UAAU,EACf,EAAE,EAAE,KAAK,CAAC,GAAG,EACb,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,0CAAE,QAAQ,EAAE,EAC9B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAC7B,QAAQ,EAAE,KAAK,CAAC,QAAQ,kBACV,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,QAAQ,EAAE,KAAI,OAAO,EAClD,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,EAC1C,aAAa,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI,EACnC,OAAO,EAAE,KAAK,CAAC,YAAY,EAC3B,MAAM,EAAE,KAAK,CAAC,WAAW,EACzB,SAAS,EAAE,KAAK,CAAC,cAAc,GAC/B;QACF,aAAO,OAAO,EAAE,KAAK,CAAC,GAAG,IAAG,KAAK,CAAC,KAAK,CAAS,CAC7C,CACN,CAAA;CAAA,CAAC,CACC,CACN,CAAC","sourcesContent":["import { FunctionalComponent, h, VNode } from '@stencil/core';\nimport { MgInputCheckboxListProps } from './mg-input-checkbox.conf';\n\n/**\n * Get checkboxes list template\n * @param props - MgInputCheckboxList Interface Props\n * @returns input template\n */\nexport const MgInputCheckboxList: FunctionalComponent<MgInputCheckboxListProps> = (props: MgInputCheckboxListProps): VNode[] => (\n // eslint-disable-next-line jsx-a11y/no-redundant-roles\n <ul\n class=\"mg-c-input__input-group-container\"\n role=\"list\"\n aria-describedby={props.displaySearchInput ? 'search-results' : undefined}\n aria-label={props.displaySearchInput ? props.messages.searchResults : undefined}\n aria-live={props.displaySearchInput ? 'polite' : undefined}\n id={props.id}\n >\n {props.checkboxes.map(input => (\n <li key={input._id} class={{ 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled }}>\n <input\n type=\"checkbox\"\n id={input._id}\n name={props.name}\n value={input.value?.toString()}\n checked={Boolean(input.value)}\n required={input.required}\n aria-invalid={props.invalid?.toString() || 'false'}\n disabled={props.disabled || input.disabled}\n indeterminate={input.value === null}\n onInput={input._handleInput}\n onBlur={input._handleBlur}\n onKeyDown={input._handleKeydown}\n />\n <label htmlFor={input._id}>{input.title}</label>\n </li>\n ))}\n </ul>\n);\n"]}
@@ -99,10 +99,10 @@ export class MgInputCheckboxPaginated {
99
99
  * @returns HTML Element
100
100
  */
101
101
  render() {
102
- const getText = (checkboxes) => (h("em", { key: '28eedd949445bc6c7a5a750359af7159055657d8', class: "mg-c-input__input-checkbox-multi-section-header-label" }, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`));
102
+ const getText = (checkboxes) => (h("em", { key: 'd1377fde2a3fdf69077a52d9b81e38b7c52881ec', class: "mg-c-input__section-header-title-label" }, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`));
103
103
  const [from, to] = this.getFromToIndexes();
104
104
  const itemsContainerId = `items-${this.sectionKind}-container`;
105
- return (h(Host, { key: 'a7ade87a72bb1cba4d0c20dde425cefc5c7fbff4', hidden: this.checkboxes.length < 1 }, h("div", { key: '38711edade3945e940ba29b44492424c3e5b7063', class: "mg-c-input__input-checkbox-multi-section-header" }, this.titleKind === SectionTitleKind.BUTTON ? (h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: "mg-c-input__input-checkbox-multi-text" }, getText(this.checkboxes)))) : (h("p", { class: "mg-c-input__input-checkbox-multi-title" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (h("mg-tooltip", { class: "mg-c-input__input-checkbox-multi-section-header-tootlip", message: this.messages.tooltip, "data-popper-strategy": "absolute" }, h("mg-button", { variant: "link", onClick: this.massActionHandler }, this.messages.action))), this.expanded && this.getPageCount(this.checkboxes) > 1 && (h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { key: '3a514d5711da9ebb57d21e70609b7f6f2d1e621e', hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__input-checkbox-multi-section-content" }, h(MgInputCheckboxList, { key: '84223d73e67e355ce01a4f70ef75a42a18fd96b4', checkboxes: this.getArrayRange(this.checkboxes, from, to), inputVerticalList: true, type: 'multi', displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, disabled: this.disabled, name: this.name, invalid: this.invalid }))));
105
+ return (h(Host, { key: '782f416233239ad46f653bfb34bc2adf2bf5c7b7', hidden: this.checkboxes.length < 1 }, h("div", { key: 'cbcc808b0aa6701cccf3dd23c78ad7c763dcedd5', class: "mg-c-input__section-header" }, this.titleKind === SectionTitleKind.BUTTON ? (h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: "mg-c-input__section-header-title" }, getText(this.checkboxes)))) : (h("p", { class: "mg-c-input__section-header-title mg-c-input__section-header-title--static" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (h("mg-tooltip", { class: "mg-c-input__section-header-tootlip", message: this.messages.tooltip, "data-popper-strategy": "absolute" }, h("mg-button", { variant: "link", onClick: this.massActionHandler }, this.messages.action))), this.expanded && this.getPageCount(this.checkboxes) > 1 && (h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { key: 'e3a31d6c97ec062b80932a6d22c422e1b42f3866', hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__section-content" }, h(MgInputCheckboxList, { key: '44c4a5908286e4ec4f477d6cddf05752f83e26c1', checkboxes: this.getArrayRange(this.checkboxes, from, to), displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, disabled: this.disabled, name: this.name, invalid: this.invalid }))));
106
106
  }
107
107
  static get is() { return "mg-input-checkbox-paginated"; }
108
108
  static get encapsulation() { return "scoped"; }
@@ -117,7 +117,7 @@ export class MgInputCheckboxPaginated {
117
117
  "references": {}
118
118
  },
119
119
  "required": false,
120
- "optional": false,
120
+ "optional": true,
121
121
  "docs": {
122
122
  "tags": [],
123
123
  "text": "Define if mg-input-checkbox-list is readonly"
@@ -134,7 +134,7 @@ export class MgInputCheckboxPaginated {
134
134
  "references": {}
135
135
  },
136
136
  "required": false,
137
- "optional": false,
137
+ "optional": true,
138
138
  "docs": {
139
139
  "tags": [],
140
140
  "text": "Define if mg-input-checkbox-list is disabled"
@@ -151,7 +151,7 @@ export class MgInputCheckboxPaginated {
151
151
  "references": {}
152
152
  },
153
153
  "required": false,
154
- "optional": false,
154
+ "optional": true,
155
155
  "docs": {
156
156
  "tags": [],
157
157
  "text": "Define mg-input-checkbox input name"
@@ -168,7 +168,7 @@ export class MgInputCheckboxPaginated {
168
168
  "references": {}
169
169
  },
170
170
  "required": false,
171
- "optional": false,
171
+ "optional": true,
172
172
  "docs": {
173
173
  "tags": [],
174
174
  "text": "Define mg-input-checkbox input invalid"
@@ -231,7 +231,7 @@ export class MgInputCheckboxPaginated {
231
231
  }
232
232
  },
233
233
  "required": false,
234
- "optional": false,
234
+ "optional": true,
235
235
  "docs": {
236
236
  "tags": [],
237
237
  "text": "Define section kind"