@mgdis/mg-components 5.17.0 → 5.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/dist/cjs/{mg-menu.conf-43aacf30.js → components.utils-dc9c8a53.js} +160 -7
  2. package/dist/cjs/components.utils-dc9c8a53.js.map +1 -0
  3. package/dist/cjs/index-c042e24b.js +18 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/mg-action-more_34.cjs.entry.js +761 -582
  6. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  7. package/dist/cjs/mg-components.cjs.js +1 -1
  8. package/dist/cjs/mg-item-more.cjs.entry.js +5 -5
  9. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -9
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  12. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +5 -5
  13. package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +1 -1
  14. package/dist/collection/components/atoms/mg-button/mg-button.js +12 -12
  15. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  16. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +4 -4
  17. package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -1
  18. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +3 -3
  19. package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -1
  20. package/dist/collection/components/atoms/mg-card/mg-card.js +9 -9
  21. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  22. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +3 -3
  23. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  24. package/dist/collection/components/atoms/mg-divider/mg-divider.js +4 -4
  25. package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.js +13 -15
  27. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  28. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +4 -4
  29. package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +1 -1
  30. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +5 -4
  31. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  32. package/dist/collection/components/atoms/mg-tag/mg-tag.js +9 -9
  33. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  34. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +23 -0
  35. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +1 -0
  36. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +5 -5
  37. package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +1 -1
  38. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
  39. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
  40. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +37 -17
  41. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  42. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +7 -1
  43. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -1
  44. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +9 -1
  45. package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/MgInput.js +12 -11
  47. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +4 -4
  49. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
  51. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  53. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +111 -38
  54. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  55. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +21 -27
  56. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +1 -1
  57. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +62 -6
  58. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +84 -13
  60. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  61. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +55 -0
  62. package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -1
  63. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +115 -44
  64. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  65. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +55 -0
  66. package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -1
  67. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +88 -15
  68. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  69. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +55 -0
  70. package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -1
  71. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +87 -14
  72. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  73. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +1 -1
  74. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +1 -1
  75. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +60 -0
  76. package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -1
  77. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +87 -14
  78. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  79. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +55 -0
  80. package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -1
  81. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +5 -0
  82. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -0
  83. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +151 -34
  84. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  85. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +147 -0
  86. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +1 -0
  87. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +80 -7
  88. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
  89. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +110 -36
  90. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  91. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +69 -6
  92. package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
  93. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -9
  94. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  95. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +2 -2
  96. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -1
  97. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +2 -2
  98. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  99. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +8 -9
  100. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  101. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +6 -6
  102. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  103. package/dist/collection/components/molecules/mg-details/mg-details.js +5 -4
  104. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  105. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +1 -1
  106. package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +1 -1
  107. package/dist/collection/components/molecules/mg-form/mg-form.js +6 -6
  108. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  109. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +4 -4
  110. package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -1
  111. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +7 -7
  112. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
  113. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +5 -4
  114. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  115. package/dist/collection/components/molecules/mg-message/mg-message.js +8 -8
  116. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  117. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +11 -11
  118. package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +1 -1
  119. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
  120. package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
  121. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +7 -7
  122. package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -1
  123. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +3 -3
  124. package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +1 -1
  125. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +1 -1
  126. package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +1 -1
  127. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +3 -3
  128. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  129. package/dist/collection/components/molecules/mg-panel/mg-panel.js +17 -15
  130. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  131. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +3 -3
  132. package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
  133. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +11 -21
  134. package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -1
  135. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -4
  136. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
  137. package/dist/collection/components/molecules/mg-popover/mg-popover.js +36 -16
  138. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  139. package/dist/collection/components/molecules/mg-popover/test/{mg-popover.e2e.js → mg-popover.e2e.playwright.js} +54 -62
  140. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +1 -0
  141. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +12 -0
  142. package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +1 -1
  143. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -6
  144. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
  145. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +34 -34
  146. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  147. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +13 -13
  148. package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +1 -1
  149. package/dist/collection/locales/en/messages.json +3 -3
  150. package/dist/collection/locales/fr/messages.json +3 -3
  151. package/dist/collection/utils/components.utils.js +16 -0
  152. package/dist/collection/utils/components.utils.js.map +1 -1
  153. package/dist/collection/utils/components.utils.spec.js +22 -1
  154. package/dist/collection/utils/components.utils.spec.js.map +1 -1
  155. package/dist/collection/variables.css +1 -275
  156. package/dist/components/MgInput.js +17 -16
  157. package/dist/components/MgInput.js.map +1 -1
  158. package/dist/components/components.utils.js +17 -1
  159. package/dist/components/components.utils.js.map +1 -1
  160. package/dist/components/index2.js +6 -6
  161. package/dist/components/mg-action-more.js +5 -5
  162. package/dist/components/mg-action-more.js.map +1 -1
  163. package/dist/components/mg-badge2.js +8 -8
  164. package/dist/components/mg-badge2.js.map +1 -1
  165. package/dist/components/mg-button2.js +11 -11
  166. package/dist/components/mg-button2.js.map +1 -1
  167. package/dist/components/mg-card2.js +8 -8
  168. package/dist/components/mg-card2.js.map +1 -1
  169. package/dist/components/mg-character-left2.js +1 -1
  170. package/dist/components/mg-character-left2.js.map +1 -1
  171. package/dist/components/mg-details.js +4 -3
  172. package/dist/components/mg-details.js.map +1 -1
  173. package/dist/components/mg-divider.js +3 -3
  174. package/dist/components/mg-divider.js.map +1 -1
  175. package/dist/components/mg-form.js +4 -4
  176. package/dist/components/mg-form.js.map +1 -1
  177. package/dist/components/mg-icon2.js +12 -14
  178. package/dist/components/mg-icon2.js.map +1 -1
  179. package/dist/components/mg-illustrated-message.js +7 -7
  180. package/dist/components/mg-illustrated-message.js.map +1 -1
  181. package/dist/components/mg-input-checkbox-paginated2.js +8 -8
  182. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  183. package/dist/components/mg-input-checkbox.js +70 -34
  184. package/dist/components/mg-input-checkbox.js.map +1 -1
  185. package/dist/components/mg-input-date.js +45 -12
  186. package/dist/components/mg-input-date.js.map +1 -1
  187. package/dist/components/mg-input-numeric.js +76 -43
  188. package/dist/components/mg-input-numeric.js.map +1 -1
  189. package/dist/components/mg-input-password.js +49 -14
  190. package/dist/components/mg-input-password.js.map +1 -1
  191. package/dist/components/mg-input-radio.js +48 -13
  192. package/dist/components/mg-input-radio.js.map +1 -1
  193. package/dist/components/mg-input-select2.js +48 -13
  194. package/dist/components/mg-input-select2.js.map +1 -1
  195. package/dist/components/mg-input-text2.js +83 -33
  196. package/dist/components/mg-input-text2.js.map +1 -1
  197. package/dist/components/mg-input-textarea.js +69 -35
  198. package/dist/components/mg-input-textarea.js.map +1 -1
  199. package/dist/components/mg-input-title2.js +4 -3
  200. package/dist/components/mg-input-title2.js.map +1 -1
  201. package/dist/components/mg-input-toggle.js +9 -9
  202. package/dist/components/mg-input-toggle.js.map +1 -1
  203. package/dist/components/mg-item-more.js +4 -3
  204. package/dist/components/mg-item-more.js.map +1 -1
  205. package/dist/components/mg-menu-item2.js +7 -8
  206. package/dist/components/mg-menu-item2.js.map +1 -1
  207. package/dist/components/mg-menu2.js +1 -1
  208. package/dist/components/mg-menu2.js.map +1 -1
  209. package/dist/components/mg-message.js +7 -7
  210. package/dist/components/mg-message.js.map +1 -1
  211. package/dist/components/mg-modal.js +7 -7
  212. package/dist/components/mg-modal.js.map +1 -1
  213. package/dist/components/mg-pagination2.js +2 -2
  214. package/dist/components/mg-pagination2.js.map +1 -1
  215. package/dist/components/mg-panel.js +16 -15
  216. package/dist/components/mg-panel.js.map +1 -1
  217. package/dist/components/mg-popover-content2.js +4 -4
  218. package/dist/components/mg-popover-content2.js.map +1 -1
  219. package/dist/components/mg-popover2.js +33 -14
  220. package/dist/components/mg-popover2.js.map +1 -1
  221. package/dist/components/mg-skip-links.js +4 -5
  222. package/dist/components/mg-skip-links.js.map +1 -1
  223. package/dist/components/mg-tabs.js +33 -33
  224. package/dist/components/mg-tabs.js.map +1 -1
  225. package/dist/components/mg-tag.js +8 -8
  226. package/dist/components/mg-tag.js.map +1 -1
  227. package/dist/components/mg-tooltip-content2.js +1 -1
  228. package/dist/components/mg-tooltip-content2.js.map +1 -1
  229. package/dist/components/mg-tooltip2.js +34 -15
  230. package/dist/components/mg-tooltip2.js.map +1 -1
  231. package/dist/esm/{mg-menu.conf-012fc9b4.js → components.utils-0f76010d.js} +153 -8
  232. package/dist/esm/components.utils-0f76010d.js.map +1 -0
  233. package/dist/esm/index-ce01e63b.js +18 -1
  234. package/dist/esm/loader.js +1 -1
  235. package/dist/esm/mg-action-more_34.entry.js +697 -518
  236. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  237. package/dist/esm/mg-components.js +1 -1
  238. package/dist/esm/mg-item-more.entry.js +4 -4
  239. package/dist/esm/mg-item-more.entry.js.map +1 -1
  240. package/dist/mg-components/locales/en/messages.json +3 -3
  241. package/dist/mg-components/locales/fr/messages.json +3 -3
  242. package/dist/mg-components/mg-components.css +1 -1
  243. package/dist/mg-components/mg-components.esm.js +1 -1
  244. package/dist/mg-components/mg-components.esm.js.map +1 -1
  245. package/dist/mg-components/p-768fc594.entry.js +2 -0
  246. package/dist/mg-components/p-768fc594.entry.js.map +1 -0
  247. package/dist/mg-components/p-c9e2c669.js +2 -0
  248. package/dist/mg-components/p-c9e2c669.js.map +1 -0
  249. package/dist/mg-components/p-d2d6afec.entry.js +2 -0
  250. package/dist/mg-components/p-d2d6afec.entry.js.map +1 -0
  251. package/dist/mg-components/variables.css +1 -275
  252. package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
  253. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -1
  254. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +4 -3
  255. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +1 -1
  256. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +4 -4
  257. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +22 -1
  258. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +17 -2
  259. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +35 -20
  260. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -1
  261. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +16 -1
  262. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +16 -1
  263. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +12 -0
  264. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +30 -6
  265. package/dist/types/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.d.ts +1 -0
  266. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +17 -5
  267. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -1
  268. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  269. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +3 -3
  270. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +2 -1
  271. package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +1 -0
  272. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +6 -5
  273. package/dist/types/components.d.ts +71 -13
  274. package/dist/types/utils/components.utils.d.ts +12 -0
  275. package/package.json +17 -18
  276. package/readme.md +0 -31
  277. package/dist/cjs/mg-menu.conf-43aacf30.js.map +0 -1
  278. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -116
  279. package/dist/collection/components/atoms/mg-button/mg-button.css +0 -182
  280. package/dist/collection/components/atoms/mg-card/mg-card.css +0 -75
  281. package/dist/collection/components/atoms/mg-character-left/mg-character-left.css +0 -3
  282. package/dist/collection/components/atoms/mg-divider/mg-divider.css +0 -9
  283. package/dist/collection/components/atoms/mg-icon/mg-icon.css +0 -138
  284. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +0 -12
  285. package/dist/collection/components/atoms/mg-tag/mg-tag.css +0 -131
  286. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js +0 -37
  287. package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js.map +0 -1
  288. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.css +0 -43
  289. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +0 -3
  290. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +0 -268
  291. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +0 -211
  292. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +0 -257
  293. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +0 -254
  294. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +0 -179
  295. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +0 -264
  296. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +0 -304
  297. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js +0 -171
  298. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js.map +0 -1
  299. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +0 -303
  300. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +0 -233
  301. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +0 -37
  302. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +0 -377
  303. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +0 -39
  304. package/dist/collection/components/molecules/mg-details/mg-details.css +0 -64
  305. package/dist/collection/components/molecules/mg-form/mg-form.css +0 -19
  306. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +0 -45
  307. package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +0 -30
  308. package/dist/collection/components/molecules/mg-message/mg-message.css +0 -82
  309. package/dist/collection/components/molecules/mg-modal/mg-modal.css +0 -67
  310. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +0 -47
  311. package/dist/collection/components/molecules/mg-panel/mg-panel.css +0 -64
  312. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.css +0 -135
  313. package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -11
  314. package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +0 -1
  315. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +0 -28
  316. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -99
  317. package/dist/collection/styles/a11y.scss +0 -36
  318. package/dist/collection/styles/fonts.scss +0 -21
  319. package/dist/collection/styles/form.scss +0 -3
  320. package/dist/collection/styles/global.scss +0 -80
  321. package/dist/collection/styles/layout.scss +0 -29
  322. package/dist/collection/styles/main.scss +0 -23
  323. package/dist/collection/styles/mg-icon-animation.scss +0 -6
  324. package/dist/collection/styles/navigation-button.scss +0 -77
  325. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +0 -11
  326. package/dist/collection/styles/typography.scss +0 -82
  327. package/dist/collection/styles/utilities.scss +0 -21
  328. package/dist/collection/test/typography.e2e.playwright.js +0 -12
  329. package/dist/collection/test/typography.e2e.playwright.js.map +0 -1
  330. package/dist/esm/mg-menu.conf-012fc9b4.js.map +0 -1
  331. package/dist/mg-components/p-1d7d6fa0.js +0 -2
  332. package/dist/mg-components/p-1d7d6fa0.js.map +0 -1
  333. package/dist/mg-components/p-9257e8f1.entry.js +0 -2
  334. package/dist/mg-components/p-9257e8f1.entry.js.map +0 -1
  335. package/dist/mg-components/p-caafc9cf.entry.js +0 -2
  336. package/dist/mg-components/p-caafc9cf.entry.js.map +0 -1
  337. package/dist/mg-components/styles/a11y.scss +0 -36
  338. package/dist/mg-components/styles/fonts.scss +0 -21
  339. package/dist/mg-components/styles/form.scss +0 -3
  340. package/dist/mg-components/styles/global.scss +0 -80
  341. package/dist/mg-components/styles/layout.scss +0 -29
  342. package/dist/mg-components/styles/main.scss +0 -23
  343. package/dist/mg-components/styles/mg-icon-animation.scss +0 -6
  344. package/dist/mg-components/styles/navigation-button.scss +0 -77
  345. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +0 -11
  346. package/dist/mg-components/styles/typography.scss +0 -82
  347. package/dist/mg-components/styles/utilities.scss +0 -21
  348. /package/dist/types/{test/typography.e2e.playwright.d.ts → components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { widths } from "./MgInput.conf";
3
+ import { isValidString } from "../../../utils/components.utils";
3
4
  /**
4
5
  * Apply in all input child node the aria-describedby attribute
5
6
  * @param children - Represent scoped elements
@@ -21,20 +22,20 @@ const applyAriadescribedBy = (children, ariaDescribedbyIDs, utils) => utils.map(
21
22
  * @param props - MgInput Interface Props
22
23
  */
23
24
  const manageClasses = (props) => {
24
- props.classCollection.add('mg-input');
25
+ props.classCollection.add('mg-c-input');
25
26
  if (props.labelOnTop)
26
- props.classCollection.add('mg-input--label-on-top');
27
+ props.classCollection.add('mg-c-input--label-on-top');
27
28
  else
28
- props.classCollection.delete('mg-input--label-on-top');
29
+ props.classCollection.delete('mg-c-input--label-on-top');
29
30
  if (props.readonly)
30
- props.classCollection.add('mg-input--readonly');
31
+ props.classCollection.add('mg-c-input--readonly');
31
32
  else
32
- props.classCollection.delete('mg-input--readonly');
33
+ props.classCollection.delete('mg-c-input--readonly');
33
34
  widths.forEach(width => {
34
- props.classCollection.delete(`mg-input--width-${width}`);
35
+ props.classCollection.delete(`mg-c-input--width-${width}`);
35
36
  });
36
37
  if (props.mgWidth !== undefined)
37
- props.classCollection.add(`mg-input--width-${props.mgWidth}`);
38
+ props.classCollection.add(`mg-c-input--width-${props.mgWidth}`);
38
39
  };
39
40
  /**
40
41
  * Get tagname
@@ -53,10 +54,10 @@ export const MgInput = (props, children, utils) => {
53
54
  /**
54
55
  * Check required properties
55
56
  */
56
- if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
57
+ if (!isValidString(props.identifier)) {
57
58
  throw new Error('<mg-input> prop "identifier" is required.');
58
59
  }
59
- if (typeof props.label !== 'string' || props.label.trim() === '') {
60
+ if (!isValidString(props.label)) {
60
61
  throw new Error('<mg-input> prop "label" is required.');
61
62
  }
62
63
  if (props.labelOnTop && props.labelHide) {
@@ -111,7 +112,7 @@ export const MgInput = (props, children, utils) => {
111
112
  * Display asterisk only if not disabled and not readonly
112
113
  * @returns mg-input-title
113
114
  */
114
- const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
115
- return (h(TagName, { class: props.classCollection.join() }, props.labelOnTop ? (h("div", { class: "mg-input__title" }, getInputTitle(), !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()), props.readonly ? (h("div", { class: "mg-input__input-container" }, h("strong", null, props.readonlyValue), children.filter(child => child.$name$ === 'append-input'))) : (h("div", { class: "mg-input__input-container" }, h("div", { class: { 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined } }, applyAriadescribedBy(children, ariaDescribedbyIDs, utils), !props.labelOnTop && props.tooltip && getTooltip()), props.helpText && h("div", { id: helpTextId, class: "mg-input__help-text", innerHTML: props.helpText }), props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
115
+ const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'mg-u-visually-hidden' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
116
+ return (h(TagName, { class: props.classCollection.join() }, props.labelOnTop ? (h("div", { class: "mg-c-input__title" }, getInputTitle(), !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()), props.readonly ? (h("div", { class: "mg-c-input__input-container" }, h("strong", null, props.readonlyValue), children.filter(child => Object.values(child).includes('append-input')))) : (h("div", { class: "mg-c-input__input-container" }, h("div", { class: { 'mg-c-input__input': true, 'mg-c-input__input--has-error': props.errorMessage !== undefined } }, applyAriadescribedBy(children, ariaDescribedbyIDs, utils), !props.labelOnTop && props.tooltip && getTooltip()), props.helpText && h("div", { id: helpTextId, class: "mg-c-input__help-text", innerHTML: props.helpText }), props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-c-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
116
117
  };
117
118
  //# sourceMappingURL=MgInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MgInput.js","sourceRoot":"","sources":["../../../../src/components/molecules/inputs/MgInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAA8B,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,MAAM,EAAS,MAAM,gBAAgB,CAAC;AAG/C;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAG,CAAC,QAAiB,EAAE,kBAA+B,EAAE,KAA0B,EAAW,EAAE,CACvH,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE;EAC1B,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAc,CAAC,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,EAAC,2BAA2B;MACpC,WAAK,KAAK,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,4BAA4B,EAAE,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE;QACpG,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,CAAC;QACzD,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,OAAO,IAAI,UAAU,EAAE,CAC/C;MACL,KAAK,CAAC,QAAQ,IAAI,WAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAC,qBAAqB,EAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,GAAQ;MACpG,KAAK,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAC3D,WAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAC,iBAAiB,EAAC,SAAS,EAAE,KAAK,CAAC,YAAY,eAAY,WAAW,GAAO,CAC9G,CACG,CACP,CACO,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FunctionalComponent, h, VNode, FunctionalUtilities } from '@stencil/core';\nimport { widths, Width } from './MgInput.conf';\nimport { ClassList } from '../../../utils/components.utils';\n\n/**\n * Apply in all input child node the aria-describedby attribute\n * @param children - Represent scoped elements\n * @param ariaDescribedbyIDs - List of IDs\n * @param utils - Stencil.js utils\n * @returns Children with aria-describedby attribute\n */\nconst applyAriadescribedBy = (children: VNode[], ariaDescribedbyIDs: Set<string>, utils: FunctionalUtilities): VNode[] =>\n utils.map(children, child => {\n if (['input', 'select', 'textarea'].includes(child.vtag as string)) {\n return {\n ...child,\n vattrs: {\n ...child.vattrs,\n 'aria-describedby': [...ariaDescribedbyIDs].join(' '),\n },\n };\n }\n\n // we recursively apply ariadescribedBy attributes to child input nodes if exists\n if (child.vchildren === null) return { ...child };\n return {\n ...child,\n vchildren: applyAriadescribedBy(child.vchildren, ariaDescribedbyIDs, utils),\n };\n });\n\n/**\n * Add classes based on props\n * @param props - MgInput Interface Props\n */\nconst manageClasses = (props: MgInputProps): void => {\n props.classCollection.add('mg-input');\n\n if (props.labelOnTop) props.classCollection.add('mg-input--label-on-top');\n else props.classCollection.delete('mg-input--label-on-top');\n\n if (props.readonly) props.classCollection.add('mg-input--readonly');\n else props.classCollection.delete('mg-input--readonly');\n\n widths.forEach(width => {\n props.classCollection.delete(`mg-input--width-${width}`);\n });\n if (props.mgWidth !== undefined) props.classCollection.add(`mg-input--width-${props.mgWidth}`);\n};\n\n/**\n * Get tagname\n * @param isFieldset - is fieldset\n * @returns tag name\n */\nconst getTagName = (isFieldset: boolean): string => (isFieldset ? 'fieldset' : 'div');\n\n/**\n * MgInput Interface\n */\ninterface MgInputProps {\n // Global\n identifier: string;\n classCollection: ClassList;\n // Label\n label: string;\n labelOnTop: boolean;\n labelHide: boolean;\n isFieldset: boolean;\n // Input\n value: string;\n readonlyValue: string;\n required: boolean;\n readonly: boolean;\n mgWidth: Width;\n disabled: boolean;\n // Tooltip\n tooltip: string;\n // Help Text\n helpText: string;\n // Error Message\n errorMessage: string;\n // ariaDescribedbyIDs\n ariaDescribedbyIDs: string[];\n}\n\n/**\n * Get input template\n * @param props - MgInput Interface Props\n * @param children - Represent scoped elements\n * @param utils - Stencil.js utils\n * @returns input template\n */\nexport const MgInput: FunctionalComponent<MgInputProps> = (props: MgInputProps, children: VNode[], utils: FunctionalUtilities): VNode[] => {\n /**\n * Check required properties\n */\n if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {\n throw new Error('<mg-input> prop \"identifier\" is required.');\n }\n if (typeof props.label !== 'string' || props.label.trim() === '') {\n throw new Error('<mg-input> prop \"label\" is required.');\n }\n if (props.labelOnTop && props.labelHide) {\n throw new Error('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\".');\n }\n\n /**\n * Set readonly value\n */\n if (props.readonlyValue === undefined) props.readonlyValue = props.value;\n\n /**\n * Component classes\n */\n manageClasses(props);\n\n /**\n * a11y IDs\n */\n const ariaDescribedbyIDs: Set<string> = new Set(props.ariaDescribedbyIDs);\n\n // Help text\n const helpTextId = `${props.identifier}-help-text`;\n if (typeof props.helpText === 'string' && props.helpText !== '') {\n ariaDescribedbyIDs.add(helpTextId);\n }\n\n // Error Message\n const helpTextErrorId = `${props.identifier}-error`;\n if (typeof props.errorMessage === 'string' && props.errorMessage !== '') {\n ariaDescribedbyIDs.add(helpTextErrorId);\n }\n\n /**\n * Return template\n *\n * +--------+--------------+---------+\n * | label | input | tooltip |\n * | +--------------+---------+\n * | | nb Char Left |\n * | +------------------------+\n * | | Help Text |\n * | +------------------------+\n * | | Error |\n * +--------+------------------------+\n *\n * Error message is based on this aria method: https://www.w3.org/WAI/tutorials/forms/notifications/#on-focus-change\n */\n\n const TagName: string = getTagName(props.isFieldset);\n\n /**\n * Get tooltip node\n * @returns mg-tooltip\n */\n const getTooltip = (): VNode[] => (\n <mg-tooltip identifier={`${props.identifier}-tooltip`} message={props.tooltip}>\n <mg-icon icon=\"info-circle\"></mg-icon>\n </mg-tooltip>\n );\n\n /**\n * Get input title (label) node\n * Display asterisk only if not disabled and not readonly\n * @returns mg-input-title\n */\n const getInputTitle = (): VNode[] => (\n <mg-input-title\n identifier={props.identifier}\n class={props.labelHide ? 'sr-only' : undefined}\n required={props.required && !props.disabled && !props.readonly}\n is-legend={props.isFieldset}\n >\n {props.label}\n </mg-input-title>\n );\n\n return (\n <TagName class={props.classCollection.join()}>\n {props.labelOnTop ? (\n <div class=\"mg-input__title\">\n {getInputTitle()}\n {!props.readonly && props.tooltip && getTooltip()}\n </div>\n ) : (\n getInputTitle()\n )}\n {props.readonly ? (\n <div class=\"mg-input__input-container\">\n <strong>{props.readonlyValue}</strong>\n {children.filter(child => child.$name$ === 'append-input')}\n </div>\n ) : (\n <div class=\"mg-input__input-container\">\n <div class={{ 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined }}>\n {applyAriadescribedBy(children, ariaDescribedbyIDs, utils)}\n {!props.labelOnTop && props.tooltip && getTooltip()}\n </div>\n {props.helpText && <div id={helpTextId} class=\"mg-input__help-text\" innerHTML={props.helpText}></div>}\n {props.errorMessage && !props.readonly && !props.disabled && (\n <div id={helpTextErrorId} class=\"mg-input__error\" innerHTML={props.errorMessage} aria-live=\"assertive\"></div>\n )}\n </div>\n )}\n </TagName>\n );\n};\n"]}
1
+ {"version":3,"file":"MgInput.js","sourceRoot":"","sources":["../../../../src/components/molecules/inputs/MgInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAA8B,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,MAAM,EAAS,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAa,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAG,CAAC,QAAiB,EAAE,kBAA+B,EAAE,KAA0B,EAAW,EAAE,CACvH,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE;EAC1B,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAc,CAAC,EAAE;IAClE,uCACK,KAAK,KACR,MAAM,kCACD,KAAK,CAAC,MAAM,KACf,kBAAkB,EAAE,CAAC,GAAG,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAEvD;GACH;EAED,iFAAiF;EACjF,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI;IAAE,yBAAY,KAAK,EAAG;EAClD,uCACK,KAAK,KACR,SAAS,EAAE,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,kBAAkB,EAAE,KAAK,CAAC,IAC3E;AACJ,CAAC,CAAC,CAAC;AAEL;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,KAAmB,EAAQ,EAAE;EAClD,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;EAExC,IAAI,KAAK,CAAC,UAAU;IAAE,KAA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AAW,GAAO,CAChH,CACG,CACP,CACO,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FunctionalComponent, h, VNode, FunctionalUtilities } from '@stencil/core';\nimport { widths, Width } from './MgInput.conf';\nimport { ClassList, isValidString } from '../../../utils/components.utils';\n\n/**\n * Apply in all input child node the aria-describedby attribute\n * @param children - Represent scoped elements\n * @param ariaDescribedbyIDs - List of IDs\n * @param utils - Stencil.js utils\n * @returns Children with aria-describedby attribute\n */\nconst applyAriadescribedBy = (children: VNode[], ariaDescribedbyIDs: Set<string>, utils: FunctionalUtilities): VNode[] =>\n utils.map(children, child => {\n if (['input', 'select', 'textarea'].includes(child.vtag as string)) {\n return {\n ...child,\n vattrs: {\n ...child.vattrs,\n 'aria-describedby': [...ariaDescribedbyIDs].join(' '),\n },\n };\n }\n\n // we recursively apply ariadescribedBy attributes to child input nodes if exists\n if (child.vchildren === null) return { ...child };\n return {\n ...child,\n vchildren: applyAriadescribedBy(child.vchildren, ariaDescribedbyIDs, utils),\n };\n });\n\n/**\n * Add classes based on props\n * @param props - MgInput Interface Props\n */\nconst manageClasses = (props: MgInputProps): void => {\n props.classCollection.add('mg-c-input');\n\n if (props.labelOnTop) props.classCollection.add('mg-c-input--label-on-top');\n else props.classCollection.delete('mg-c-input--label-on-top');\n\n if (props.readonly) props.classCollection.add('mg-c-input--readonly');\n else props.classCollection.delete('mg-c-input--readonly');\n\n widths.forEach(width => {\n props.classCollection.delete(`mg-c-input--width-${width}`);\n });\n if (props.mgWidth !== undefined) props.classCollection.add(`mg-c-input--width-${props.mgWidth}`);\n};\n\n/**\n * Get tagname\n * @param isFieldset - is fieldset\n * @returns tag name\n */\nconst getTagName = (isFieldset: boolean): string => (isFieldset ? 'fieldset' : 'div');\n\n/**\n * MgInput Interface\n */\ninterface MgInputProps {\n // Global\n identifier: string;\n classCollection: ClassList;\n // Label\n label: string;\n labelOnTop: boolean;\n labelHide: boolean;\n isFieldset: boolean;\n // Input\n value: string;\n readonlyValue: string;\n required: boolean;\n readonly: boolean;\n mgWidth: Width;\n disabled: boolean;\n // Tooltip\n tooltip: string;\n // Help Text\n helpText: string;\n // Error Message\n errorMessage: string;\n // ariaDescribedbyIDs\n ariaDescribedbyIDs: string[];\n}\n\n/**\n * Get input template\n * @param props - MgInput Interface Props\n * @param children - Represent scoped elements\n * @param utils - Stencil.js utils\n * @returns input template\n */\nexport const MgInput: FunctionalComponent<MgInputProps> = (props: MgInputProps, children: VNode[], utils: FunctionalUtilities): VNode[] => {\n /**\n * Check required properties\n */\n if (!isValidString(props.identifier)) {\n throw new Error('<mg-input> prop \"identifier\" is required.');\n }\n if (!isValidString(props.label)) {\n throw new Error('<mg-input> prop \"label\" is required.');\n }\n if (props.labelOnTop && props.labelHide) {\n throw new Error('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\".');\n }\n\n /**\n * Set readonly value\n */\n if (props.readonlyValue === undefined) props.readonlyValue = props.value;\n\n /**\n * Component classes\n */\n manageClasses(props);\n\n /**\n * a11y IDs\n */\n const ariaDescribedbyIDs: Set<string> = new Set(props.ariaDescribedbyIDs);\n\n // Help text\n const helpTextId = `${props.identifier}-help-text`;\n if (typeof props.helpText === 'string' && props.helpText !== '') {\n ariaDescribedbyIDs.add(helpTextId);\n }\n\n // Error Message\n const helpTextErrorId = `${props.identifier}-error`;\n if (typeof props.errorMessage === 'string' && props.errorMessage !== '') {\n ariaDescribedbyIDs.add(helpTextErrorId);\n }\n\n /**\n * Return template\n *\n * +--------+--------------+---------+\n * | label | input | tooltip |\n * | +--------------+---------+\n * | | nb Char Left |\n * | +------------------------+\n * | | Help Text |\n * | +------------------------+\n * | | Error |\n * +--------+------------------------+\n *\n * Error message is based on this aria method: https://www.w3.org/WAI/tutorials/forms/notifications/#on-focus-change\n */\n\n const TagName: string = getTagName(props.isFieldset);\n\n /**\n * Get tooltip node\n * @returns mg-tooltip\n */\n const getTooltip = (): VNode[] => (\n <mg-tooltip identifier={`${props.identifier}-tooltip`} message={props.tooltip}>\n <mg-icon icon=\"info-circle\"></mg-icon>\n </mg-tooltip>\n );\n\n /**\n * Get input title (label) node\n * Display asterisk only if not disabled and not readonly\n * @returns mg-input-title\n */\n const getInputTitle = (): VNode[] => (\n <mg-input-title\n identifier={props.identifier}\n class={props.labelHide ? 'mg-u-visually-hidden' : undefined}\n required={props.required && !props.disabled && !props.readonly}\n is-legend={props.isFieldset}\n >\n {props.label}\n </mg-input-title>\n );\n\n return (\n <TagName class={props.classCollection.join()}>\n {props.labelOnTop ? (\n <div class=\"mg-c-input__title\">\n {getInputTitle()}\n {!props.readonly && props.tooltip && getTooltip()}\n </div>\n ) : (\n getInputTitle()\n )}\n {props.readonly ? (\n <div class=\"mg-c-input__input-container\">\n <strong>{props.readonlyValue}</strong>\n {children.filter(child => Object.values(child).includes('append-input'))}\n </div>\n ) : (\n <div class=\"mg-c-input__input-container\">\n <div class={{ 'mg-c-input__input': true, 'mg-c-input__input--has-error': props.errorMessage !== undefined }}>\n {applyAriadescribedBy(children, ariaDescribedbyIDs, utils)}\n {!props.labelOnTop && props.tooltip && getTooltip()}\n </div>\n {props.helpText && <div id={helpTextId} class=\"mg-c-input__help-text\" innerHTML={props.helpText}></div>}\n {props.errorMessage && !props.readonly && !props.disabled && (\n <div id={helpTextErrorId} class=\"mg-c-input__error\" innerHTML={props.errorMessage} aria-live=\"assertive\"></div>\n )}\n </div>\n )}\n </TagName>\n );\n};\n"]}
@@ -7,10 +7,10 @@ import { h } from "@stencil/core";
7
7
  export const MgInputCheckboxList = (props) => (
8
8
  // eslint-disable-next-line jsx-a11y/no-redundant-roles
9
9
  h("ul", { class: {
10
- 'mg-input__input-group-container': true,
11
- 'mg-input__input-group-container--vertical': props.inputVerticalList || (props.type === 'multi' && !props.readonly),
12
- 'mg-input__input-checkbox-multi-inputs': props.type === 'multi' && !props.readonly,
10
+ 'mg-c-input__input-group-container': true,
11
+ 'mg-c-input__input-group-container--vertical': props.inputVerticalList || (props.type === 'multi' && !props.readonly),
12
+ 'mg-c-input__input-checkbox-multi-inputs': props.type === 'multi' && !props.readonly,
13
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
14
14
  .filter(item => !props.readonly || item.value)
15
- .map(input => (h("li", { key: input.id, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': props.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: props.name, value: input.value && input.value.toString(), checked: Boolean(input.value), required: input.required, disabled: props.readonly || props.disabled || input.disabled, indeterminate: input.value === null, onInput: input.handleInput, onBlur: input.handleBlur, onKeyDown: input.handleKeydown }), h("label", { htmlFor: input.id }, input.title))))));
15
+ .map(input => (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: input.value && input.value.toString(), checked: Boolean(input.value), required: input.required, disabled: props.readonly || 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
16
  //# sourceMappingURL=MgInputCheckboxList.js.map
@@ -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;IACL,iCAAiC,EAAE,IAAI;IACvC,2CAA2C,EAAE,KAAK,CAAC,iBAAiB,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC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AAK,CAAC,aAAa,GAC9B;EACF,aAAO,OAAO,EAAE,KAAK,CAAC,EAAE,IAAG,KAAK,CAAC,KAAK,CAAS,CAC5C,CACN,CAAC,CACD,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-input__input-group-container': true,\n 'mg-input__input-group-container--vertical': props.inputVerticalList || (props.type === 'multi' && !props.readonly),\n 'mg-input__input-checkbox-multi-inputs': props.type === 'multi' && !props.readonly,\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\n .filter(item => !props.readonly || item.value)\n .map(input => (\n <li key={input.id} class={{ 'mg-input__input-group': true, 'mg-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 && input.value.toString()}\n checked={Boolean(input.value)}\n required={input.required}\n disabled={props.readonly || 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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,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,EAC5D,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;EACF,aAAO,OAAO,EAAE,KAAK,CAAC,GAAG,IAAG,KAAK,CAAC,KAAK,CAAS,CAC7C,CACN,CAAC,CACD,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' && !props.readonly),\n 'mg-c-input__input-checkbox-multi-inputs': props.type === 'multi' && !props.readonly,\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\n .filter(item => !props.readonly || item.value)\n .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 && input.value.toString()}\n checked={Boolean(input.value)}\n required={input.required}\n disabled={props.readonly || 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"]}
@@ -20,7 +20,7 @@ export class MgInputCheckboxPaginated {
20
20
  this.massAction.emit(this.sectionKind);
21
21
  };
22
22
  /**
23
- * Toogle items button handler
23
+ * Toggle items button handler
24
24
  */
25
25
  this.handleToggleClick = () => {
26
26
  this.expanded = !this.expanded;
@@ -97,7 +97,7 @@ export class MgInputCheckboxPaginated {
97
97
  const [checkboxItemsFromIndex, checkboxItemsToIndex] = this.getFromToIndexes();
98
98
  const itemsContainerId = `items-${this.sectionKind}-container`;
99
99
  const getText = (checkboxes) => h("em", null, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`);
100
- return (h(Host, { hidden: this.checkboxes.length < 1 }, h("div", { class: "mg-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-input__input-checkbox-multi-text" }, getText(this.checkboxes)))) : (h("p", { class: "mg-input__input-checkbox-multi-title" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (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 > 1 ? this.currentPage : 1, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { hidden: !this.expanded, id: itemsContainerId, class: "mg-input__input-checkbox-multi-section-content" }, h(MgInputCheckboxList, { checkboxes: this.getArrayRange(this.checkboxes, checkboxItemsFromIndex, checkboxItemsToIndex), inputVerticalList: true, type: 'multi', displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, readonly: this.readonly, disabled: this.disabled, name: this.name }))));
100
+ return (h(Host, { hidden: this.checkboxes.length < 1 }, h("div", { 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-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 > 1 ? this.currentPage : 1, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__input-checkbox-multi-section-content" }, h(MgInputCheckboxList, { checkboxes: this.getArrayRange(this.checkboxes, checkboxItemsFromIndex, checkboxItemsToIndex), inputVerticalList: true, type: 'multi', displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, readonly: this.readonly, disabled: this.disabled, name: this.name }))));
101
101
  }
102
102
  static get is() { return "mg-input-checkbox-paginated"; }
103
103
  static get encapsulation() { return "scoped"; }
@@ -1 +1 @@
1
- {"version":3,"file":"mg-input-checkbox-paginated.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,KAAK,EAAE,IAAI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E,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,2BACjC,IAAI,CAAC,uBAAuB,EACnD,oBAAoB,EAAE,IAAI,EAC1B,aAAa,EAAE,IAAI,EACnB,UAAU,EAAE,6BAA6B,IAAI,CAAC,WAAW,EAAE,GAC5C,CAClB,CACG;MACN,WAAK,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAC,gDAAgD;QACvG,EAAC,mBAAmB,IAClB,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,sBAAsB,EAAE,oBAAoB,CAAC,EAC7F,iBAAiB,EAAE,IAAI,EACvB,IAAI,EAAE,OAAO,EACb,kBAAkB,EAAE,IAAI,EACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,EAAE,EAAE,SAAS,IAAI,CAAC,WAAW,EAAE,EAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,GACM,CACnB,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Event, EventEmitter, Watch, Host } from '@stencil/core';\nimport { CheckboxItem, IMgInputCheckboxBase, SectionKind, SectionTitleKind } from '../mg-input-checkbox.conf';\nimport { MgInputCheckboxList } from '../MgInputCheckboxList';\n\n/**\n * Internal component use to manage sections instances\n */\n@Component({\n tag: 'mg-input-checkbox-paginated',\n shadow: false,\n scoped: true,\n})\nexport class MgInputCheckboxPaginated implements IMgInputCheckboxBase {\n /*************\n * Constantes *\n *************/\n private readonly offset = 10;\n\n /*************\n * Decorators *\n *************/\n\n /**\n * Define if mg-input-checkbox-list is readonly\n */\n @Prop() readonly: boolean;\n\n /**\n * Define if mg-input-checkbox-list is disabled\n */\n @Prop() disabled: boolean;\n\n /**\n * Define mg-input-checkbox input name\n */\n @Prop() name: string;\n\n /**\n * Define checkboxes to paginate\n */\n @Prop() checkboxes: CheckboxItem[] = [];\n @Watch('checkboxes')\n validateCheckboxes(newValue: MgInputCheckboxPaginated['checkboxes'], oldValue: MgInputCheckboxPaginated['checkboxes']): void {\n // after each array.length update we reset pagination\n // when items fill on page, we set current page to 1\n if (this.getPageCount(newValue) === 1) this.currentPage = 1;\n // when old items page numbers match the current page AND new items page number is lower than current page, we set the new last page\n else if (this.getPageCount(oldValue) === this.currentPage && this.getPageCount(newValue) < this.currentPage) this.currentPage = this.getPageCount(newValue);\n }\n\n /**\n * Define section kind\n */\n @Prop() sectionKind: SectionKind;\n @Watch('sectionKind')\n validateSectionKind(newValue: MgInputCheckboxPaginated['sectionKind']): void {\n if (newValue === SectionKind.SELECTED) this.titleKind = SectionTitleKind.BUTTON;\n else this.titleKind = SectionTitleKind.TEXT;\n }\n\n /**\n * Define component message\n */\n @Prop() messages: Record<string, string>;\n\n /**\n * Emit 'mass-action' event\n * used to informe that select-all/unselect-all button listner is triggered\n */\n @Event({ eventName: 'mass-action' }) massAction: EventEmitter<MgInputCheckboxPaginated['sectionKind']>;\n\n /**\n * Define section title\n */\n @State() titleKind: SectionTitleKind;\n\n /**\n * Current page\n */\n @State() currentPage = 1;\n\n /**\n * Is checked items values expanded\n */\n @State() expanded = true;\n\n /***********\n * Methods *\n ***********/\n\n /**\n * Mass action handler\n */\n private massActionHandler = (): void => {\n this.massAction.emit(this.sectionKind);\n };\n\n /**\n * Toogle items button handler\n */\n private handleToggleClick = (): void => {\n this.expanded = !this.expanded;\n };\n\n /**\n * Method to get a array range\n * @param from - array start index\n * @param to - array end index\n * @returns array's range\n */\n private getArrayRange = <ItemType,>(array: ItemType[], from: number, to: number): ItemType[] => array.slice(from, to);\n\n /**\n * Get from and to index\n * @returns [from,to] index\n */\n private getFromToIndexes(): number[] {\n const isFirstPage = this.currentPage === 1;\n const checkboxItemsFromIndex = isFirstPage ? 0 : (this.currentPage - 1) * this.offset;\n const checkboxItemsToIndex = isFirstPage ? this.offset : this.currentPage * this.offset;\n return [checkboxItemsFromIndex, checkboxItemsToIndex];\n }\n\n /**\n * Method to get page count from items\n * @param items - items to count\n * @returns page count from items\n */\n private getPageCount = (item: unknown[]): number => Math.ceil(item.length / this.offset);\n\n /**\n * Handle mg-pagination current page change event\n * @param event - pagination current page change event\n */\n private handleCurrentPageChange = (event: CustomEvent): void => {\n this.currentPage = Number(event.detail);\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n this.validateSectionKind(this.sectionKind);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const [checkboxItemsFromIndex, checkboxItemsToIndex] = this.getFromToIndexes();\n const itemsContainerId = `items-${this.sectionKind}-container`;\n\n const getText = (checkboxes: CheckboxItem[]): HTMLElement => <em>{`${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`}</em>;\n\n return (\n <Host hidden={this.checkboxes.length < 1}>\n <div class=\"mg-input__input-checkbox-multi-section-header\">\n {this.titleKind === SectionTitleKind.BUTTON ? (\n <mg-button variant=\"flat\" onClick={this.handleToggleClick} aria-controls={itemsContainerId} aria-expanded={this.expanded.toString()}>\n <mg-icon icon={this.expanded ? 'chevron-up' : 'chevron-down'} size=\"small\"></mg-icon>\n <span class=\"mg-input__input-checkbox-multi-text\">{getText(this.checkboxes)}</span>\n </mg-button>\n ) : (\n <p class=\"mg-input__input-checkbox-multi-title\">{getText(this.checkboxes)}</p>\n )}\n {((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (\n <mg-button variant=\"link\" onClick={this.massActionHandler}>\n {this.messages.action}\n </mg-button>\n )}\n {this.expanded && this.getPageCount(this.checkboxes) > 1 && (\n <mg-pagination\n key=\"search-pagination\"\n totalPages={this.getPageCount(this.checkboxes)}\n currentPage={this.currentPage > 1 ? this.currentPage : 1}\n onCurrent-page-change={this.handleCurrentPageChange}\n hideNavigationLabels={true}\n hidePageCount={true}\n identifier={`input-checkbox-pagination-${this.sectionKind}`}\n ></mg-pagination>\n )}\n </div>\n <div hidden={!this.expanded} id={itemsContainerId} class=\"mg-input__input-checkbox-multi-section-content\">\n <MgInputCheckboxList\n checkboxes={this.getArrayRange(this.checkboxes, checkboxItemsFromIndex, checkboxItemsToIndex)}\n inputVerticalList={true}\n type={'multi'}\n displaySearchInput={true}\n messages={this.messages}\n id={`items-${this.sectionKind}`}\n readonly={this.readonly}\n disabled={this.disabled}\n name={this.name}\n ></MgInputCheckboxList>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-input-checkbox-paginated.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAsC,WAAW,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;GAEG;AAMH,MAAM,OAAO,wBAAwB;;IACnC;;mBAEe;IACE,WAAM,GAAG,EAAE,CAAC;IAsE7B;;iBAEa;IAEb;;OAEG;IACK,sBAAiB,GAAG,GAAS,EAAE;MACrC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACzC,CAA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AAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,sBAAsB,EAAE,oBAAoB,CAAC,EAC7F,iBAAiB,EAAE,IAAI,EACvB,IAAI,EAAE,OAAO,EACb,kBAAkB,EAAE,IAAI,EACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,EAAE,EAAE,SAAS,IAAI,CAAC,WAAW,EAAE,EAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,GACM,CACnB,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Event, EventEmitter, Watch, Host } from '@stencil/core';\nimport { CheckboxItem, IMgInputCheckboxBase, SectionKind, SectionTitleKind } from '../mg-input-checkbox.conf';\nimport { MgInputCheckboxList } from '../MgInputCheckboxList';\n\n/**\n * Internal component use to manage sections instances\n */\n@Component({\n tag: 'mg-input-checkbox-paginated',\n shadow: false,\n scoped: true,\n})\nexport class MgInputCheckboxPaginated implements IMgInputCheckboxBase {\n /*************\n * Constantes *\n *************/\n private readonly offset = 10;\n\n /*************\n * Decorators *\n *************/\n\n /**\n * Define if mg-input-checkbox-list is readonly\n */\n @Prop() readonly: boolean;\n\n /**\n * Define if mg-input-checkbox-list is disabled\n */\n @Prop() disabled: boolean;\n\n /**\n * Define mg-input-checkbox input name\n */\n @Prop() name: string;\n\n /**\n * Define checkboxes to paginate\n */\n @Prop() checkboxes: CheckboxItem[] = [];\n @Watch('checkboxes')\n validateCheckboxes(newValue: MgInputCheckboxPaginated['checkboxes'], oldValue: MgInputCheckboxPaginated['checkboxes']): void {\n // after each array.length update we reset pagination\n // when items fill on page, we set current page to 1\n if (this.getPageCount(newValue) === 1) this.currentPage = 1;\n // when old items page numbers match the current page AND new items page number is lower than current page, we set the new last page\n else if (this.getPageCount(oldValue) === this.currentPage && this.getPageCount(newValue) < this.currentPage) this.currentPage = this.getPageCount(newValue);\n }\n\n /**\n * Define section kind\n */\n @Prop() sectionKind: SectionKind;\n @Watch('sectionKind')\n validateSectionKind(newValue: MgInputCheckboxPaginated['sectionKind']): void {\n if (newValue === SectionKind.SELECTED) this.titleKind = SectionTitleKind.BUTTON;\n else this.titleKind = SectionTitleKind.TEXT;\n }\n\n /**\n * Define component message\n */\n @Prop() messages: Record<string, string>;\n\n /**\n * Emit 'mass-action' event\n * used to informe that select-all/unselect-all button listner is triggered\n */\n @Event({ eventName: 'mass-action' }) massAction: EventEmitter<MgInputCheckboxPaginated['sectionKind']>;\n\n /**\n * Define section title\n */\n @State() titleKind: SectionTitleKind;\n\n /**\n * Current page\n */\n @State() currentPage = 1;\n\n /**\n * Is checked items values expanded\n */\n @State() expanded = true;\n\n /***********\n * Methods *\n ***********/\n\n /**\n * Mass action handler\n */\n private massActionHandler = (): void => {\n this.massAction.emit(this.sectionKind);\n };\n\n /**\n * Toggle items button handler\n */\n private handleToggleClick = (): void => {\n this.expanded = !this.expanded;\n };\n\n /**\n * Method to get a array range\n * @param from - array start index\n * @param to - array end index\n * @returns array's range\n */\n private getArrayRange = <ItemType,>(array: ItemType[], from: number, to: number): ItemType[] => array.slice(from, to);\n\n /**\n * Get from and to index\n * @returns [from,to] index\n */\n private getFromToIndexes(): number[] {\n const isFirstPage = this.currentPage === 1;\n const checkboxItemsFromIndex = isFirstPage ? 0 : (this.currentPage - 1) * this.offset;\n const checkboxItemsToIndex = isFirstPage ? this.offset : this.currentPage * this.offset;\n return [checkboxItemsFromIndex, checkboxItemsToIndex];\n }\n\n /**\n * Method to get page count from items\n * @param items - items to count\n * @returns page count from items\n */\n private getPageCount = (item: unknown[]): number => Math.ceil(item.length / this.offset);\n\n /**\n * Handle mg-pagination current page change event\n * @param event - pagination current page change event\n */\n private handleCurrentPageChange = (event: CustomEvent): void => {\n this.currentPage = Number(event.detail);\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n this.validateSectionKind(this.sectionKind);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const [checkboxItemsFromIndex, checkboxItemsToIndex] = this.getFromToIndexes();\n const itemsContainerId = `items-${this.sectionKind}-container`;\n\n const getText = (checkboxes: CheckboxItem[]): HTMLElement => <em>{`${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`}</em>;\n\n return (\n <Host hidden={this.checkboxes.length < 1}>\n <div class=\"mg-c-input__input-checkbox-multi-section-header\">\n {this.titleKind === SectionTitleKind.BUTTON ? (\n <mg-button variant=\"flat\" onClick={this.handleToggleClick} aria-controls={itemsContainerId} aria-expanded={this.expanded.toString()}>\n <mg-icon icon={this.expanded ? 'chevron-up' : 'chevron-down'} size=\"small\"></mg-icon>\n <span class=\"mg-c-input__input-checkbox-multi-text\">{getText(this.checkboxes)}</span>\n </mg-button>\n ) : (\n <p class=\"mg-c-input__input-checkbox-multi-title\">{getText(this.checkboxes)}</p>\n )}\n {((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (\n <mg-button variant=\"link\" onClick={this.massActionHandler}>\n {this.messages.action}\n </mg-button>\n )}\n {this.expanded && this.getPageCount(this.checkboxes) > 1 && (\n <mg-pagination\n key=\"search-pagination\"\n totalPages={this.getPageCount(this.checkboxes)}\n currentPage={this.currentPage > 1 ? this.currentPage : 1}\n onCurrent-page-change={this.handleCurrentPageChange}\n hideNavigationLabels={true}\n hidePageCount={true}\n identifier={`input-checkbox-pagination-${this.sectionKind}`}\n ></mg-pagination>\n )}\n </div>\n <div hidden={!this.expanded} id={itemsContainerId} class=\"mg-c-input__input-checkbox-multi-section-content\">\n <MgInputCheckboxList\n checkboxes={this.getArrayRange(this.checkboxes, checkboxItemsFromIndex, checkboxItemsToIndex)}\n inputVerticalList={true}\n type={'multi'}\n displaySearchInput={true}\n messages={this.messages}\n id={`items-${this.sectionKind}`}\n readonly={this.readonly}\n disabled={this.disabled}\n name={this.name}\n ></MgInputCheckboxList>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mg-input-checkbox.conf.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,OAAO,CAAU,CAAC;AAY5D;;GAEG;AACH,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;EACrB,oCAAqB,CAAA;EACrB,4CAA6B,CAAA;AAC/B,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;EAC1B,qCAAiB,CAAA;EACjB,iCAAa,CAAA;AACf,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B","sourcesContent":["/**\n * interface CheckboxValue\n * use to match returned value\n */\nexport interface CheckboxValue {\n title: string;\n value: boolean | null;\n disabled?: boolean;\n required?: boolean;\n}\n\n/**\n * interface CheckboxItem\n * use to match checkbox attributes\n */\nexport interface CheckboxItem extends CheckboxValue {\n id: string;\n handleInput: (event: InputEvent & { target: HTMLInputElement }) => void;\n handleBlur: () => void;\n handleKeydown: (event: KeyboardEvent & { target: HTMLElement }) => void;\n}\n\n/**\n * List of all availables checkbox type\n */\nexport const checkboxTypes = ['checkbox', 'multi'] as const;\n\n/**\n * ChecboxType from checkbox types\n */\nexport type CheckboxType = (typeof checkboxTypes)[number];\n\n/**\n * Search value type\n */\nexport type SearchValueType = string;\n\n/**\n * mg-input-checkbox-paginated section kind\n */\nexport enum SectionKind {\n SELECTED = 'selected',\n NOT_SELECTED = 'not-selected',\n}\n\n/**\n * mg-input-checkbox-paginated section title kind\n */\nexport enum SectionTitleKind {\n BUTTON = 'button',\n TEXT = 'text',\n}\n\n/**\n * Base mg-input-checkbox interface\n */\nexport interface IMgInputCheckboxBase {\n readonly: boolean;\n disabled: boolean;\n name: string;\n}\n\n/**\n * mg-input-checkbox-list interface\n */\nexport interface MgInputCheckboxListProps extends IMgInputCheckboxBase {\n inputVerticalList: boolean;\n type: CheckboxType;\n displaySearchInput: boolean;\n messages: Record<string, unknown>;\n checkboxes: CheckboxItem[];\n id: string;\n}\n"]}
1
+ {"version":3,"file":"mg-input-checkbox.conf.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,OAAO,CAAU,CAAC;AAY5D;;GAEG;AACH,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;EACrB,oCAAqB,CAAA;EACrB,4CAA6B,CAAA;AAC/B,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;EAC1B,qCAAiB,CAAA;EACjB,iCAAa,CAAA;AACf,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B","sourcesContent":["/**\n * interface CheckboxValue\n * use to match returned value\n */\nexport interface CheckboxValue {\n title: string;\n value: boolean | null;\n disabled?: boolean;\n required?: boolean;\n}\n\n/**\n * interface CheckboxItem\n * use to match checkbox attributes\n */\nexport interface CheckboxItem extends CheckboxValue {\n _id: string;\n _handleInput: (event: InputEvent & { target: HTMLInputElement }) => void;\n _handleBlur: () => void;\n _handleKeydown: (event: KeyboardEvent & { target: HTMLElement }) => void;\n}\n\n/**\n * List of all availables checkbox type\n */\nexport const checkboxTypes = ['checkbox', 'multi'] as const;\n\n/**\n * ChecboxType from checkbox types\n */\nexport type CheckboxType = (typeof checkboxTypes)[number];\n\n/**\n * Search value type\n */\nexport type SearchValueType = string;\n\n/**\n * mg-input-checkbox-paginated section kind\n */\nexport enum SectionKind {\n SELECTED = 'selected',\n NOT_SELECTED = 'not-selected',\n}\n\n/**\n * mg-input-checkbox-paginated section title kind\n */\nexport enum SectionTitleKind {\n BUTTON = 'button',\n TEXT = 'text',\n}\n\n/**\n * Base mg-input-checkbox interface\n */\nexport interface IMgInputCheckboxBase {\n readonly: boolean;\n disabled: boolean;\n name: string;\n}\n\n/**\n * mg-input-checkbox-list interface\n */\nexport interface MgInputCheckboxListProps extends IMgInputCheckboxBase {\n inputVerticalList: boolean;\n type: CheckboxType;\n displaySearchInput: boolean;\n messages: Record<string, unknown>;\n checkboxes: CheckboxItem[];\n id: string;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable jsx-a11y/no-redundant-roles */
2
2
  import { h } from "@stencil/core";
3
3
  import { MgInput } from "../MgInput";
4
- import { ClassList } from "../../../../utils/components.utils";
4
+ import { ClassList, cleanString, isValidString } from "../../../../utils/components.utils";
5
5
  import { initLocales } from "../../../../locales";
6
6
  import { checkboxTypes, SectionKind } from "./mg-input-checkbox.conf";
7
7
  import { MgInputCheckboxList } from "./MgInputCheckboxList";
@@ -16,8 +16,9 @@ export class MgInputCheckbox {
16
16
  constructor() {
17
17
  // hasDisplayedError (triggered by blur event)
18
18
  this.hasDisplayedError = false;
19
+ this.mode = 'custom';
19
20
  // style
20
- this.baseClassName = 'mg-input--checkbox';
21
+ this.baseClassName = 'mg-c-input--checkbox';
21
22
  // "multi" setup
22
23
  this.multiStart = 5;
23
24
  this.searchStart = 10;
@@ -26,7 +27,7 @@ export class MgInputCheckbox {
26
27
  * @param event - input event
27
28
  */
28
29
  this.handleInput = (event) => {
29
- this.updateCheckboxItems('value', Boolean(event.target.checked), item => item.id === event.target.id);
30
+ this.updateCheckboxItems('value', Boolean(event.target.checked), item => item._id === event.target.id);
30
31
  this.updateValues();
31
32
  this.checkValidity();
32
33
  };
@@ -90,7 +91,13 @@ export class MgInputCheckbox {
90
91
  * Update values
91
92
  */
92
93
  this.updateValues = () => {
93
- this.value = this.checkboxItems.map(o => ({ value: o.value, title: o.title, disabled: o.disabled }));
94
+ this.value = this.checkboxItems.map(o => {
95
+ delete o._handleBlur;
96
+ delete o._handleInput;
97
+ delete o._handleKeydown;
98
+ delete o._id;
99
+ return o;
100
+ });
94
101
  };
95
102
  /**
96
103
  * get invalid element
@@ -104,7 +111,7 @@ export class MgInputCheckbox {
104
111
  * Method to update searchResults
105
112
  */
106
113
  this.updateSearchResults = () => {
107
- this.searchResults = this.checkboxItems.filter(item => item.title.toLocaleLowerCase().includes(this.searchValue.trim().toLocaleLowerCase()));
114
+ this.searchResults = this.checkboxItems.filter(item => cleanString(item.title).includes(cleanString(this.searchValue)));
108
115
  };
109
116
  /**
110
117
  * Methode to validate if one of inputs value is checked id required
@@ -115,10 +122,7 @@ export class MgInputCheckbox {
115
122
  * Check if input is valid
116
123
  */
117
124
  this.checkValidity = () => {
118
- this.valid = this.readonly || this.disabled || (this.getInvalidElement() === undefined && this.validateRequired());
119
- this.invalid = !this.valid;
120
- // We need to send valid event even if it is the same value
121
- this.inputValid.emit(this.valid);
125
+ this.setValidity(this.readonly || this.disabled || (this.getInvalidElement() === undefined && this.validateRequired()));
122
126
  };
123
127
  /**
124
128
  * Render button text
@@ -136,12 +140,17 @@ export class MgInputCheckbox {
136
140
  /**
137
141
  * Set input error message
138
142
  * @param displayError - dispay error condition
143
+ * @param errorMessage - errorMessage override
139
144
  */
140
- this.setErrorMessage = (displayError = true) => {
145
+ this.setErrorMessage = (displayError = true, errorMessage) => {
141
146
  // Set error message
142
147
  this.errorMessage = undefined;
143
- if (displayError && !this.valid && !this.validateRequired())
144
- this.errorMessage = this.messages.errors.required;
148
+ if (displayError && !this.valid) {
149
+ if (errorMessage !== undefined)
150
+ this.errorMessage = errorMessage;
151
+ else if (!this.validateRequired())
152
+ this.errorMessage = this.messages.errors.required;
153
+ }
145
154
  };
146
155
  /**
147
156
  * Method to get mg-popover identifier
@@ -154,7 +163,7 @@ export class MgInputCheckbox {
154
163
  */
155
164
  this.getDisplayItems = () => (this.searchValue.length > 0 ? this.searchResults : this.checkboxItems);
156
165
  this.value = undefined;
157
- this.type = checkboxTypes[0];
166
+ this.type = undefined;
158
167
  this.identifier = undefined;
159
168
  this.name = this.identifier;
160
169
  this.label = undefined;
@@ -178,16 +187,7 @@ export class MgInputCheckbox {
178
187
  }
179
188
  validateValue(newValue) {
180
189
  if (isCheckboxItems(newValue)) {
181
- this.checkboxItems = newValue.map((item, index) => ({
182
- id: `${this.identifier}_${index}`,
183
- title: item.title,
184
- value: item.value,
185
- disabled: item.disabled,
186
- required: item.required,
187
- handleInput: this.handleInput.bind(this),
188
- handleBlur: this.handleBlur.bind(this),
189
- handleKeydown: this.handleKeydown.bind(this),
190
- }));
190
+ 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) })));
191
191
  this.valueChange.emit(newValue);
192
192
  }
193
193
  else {
@@ -195,9 +195,13 @@ export class MgInputCheckbox {
195
195
  }
196
196
  }
197
197
  validateType(newValue) {
198
- if (!checkboxTypes.includes(newValue)) {
198
+ if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
199
199
  throw new Error('<mg-input-checkbox> prop "type" must be a CheckboxType.');
200
200
  }
201
+ else if (newValue === undefined) {
202
+ this.mode = 'auto';
203
+ this.type = checkboxTypes[0];
204
+ }
201
205
  else {
202
206
  const className = `${this.baseClassName}-multi`;
203
207
  if (newValue === 'multi') {
@@ -229,9 +233,9 @@ export class MgInputCheckbox {
229
233
  this.classCollection.delete(className);
230
234
  }
231
235
  validateCheckboxItems(newValue) {
232
- if (newValue.length > this.multiStart)
236
+ if (this.mode === 'auto' && newValue.length > this.multiStart)
233
237
  this.type = 'multi';
234
- if (newValue.length > this.searchStart) {
238
+ if (this.mode === 'auto' || (this.type === 'multi' && newValue.length > this.searchStart)) {
235
239
  this.displaySearchInput = this.type === 'multi';
236
240
  // refresh search values
237
241
  this.updateSearchResults();
@@ -242,13 +246,44 @@ export class MgInputCheckbox {
242
246
  this.updateSearchResults();
243
247
  }
244
248
  /**
245
- * Public method to display errors
249
+ * Display input error if it exists.
246
250
  */
247
251
  async displayError() {
248
252
  this.checkValidity();
249
253
  this.setErrorMessage();
250
254
  this.hasDisplayedError = this.invalid;
251
255
  }
256
+ /**
257
+ * Set an error and display a custom error message.
258
+ * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
259
+ * It must be paired with an error message to display for the given context.
260
+ * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
261
+ * @param valid - value indicating the validity
262
+ * @param errorMessage - the error message to display
263
+ */
264
+ async setError(valid, errorMessage) {
265
+ if (typeof valid !== 'boolean') {
266
+ throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean');
267
+ }
268
+ else if (!isValidString(errorMessage)) {
269
+ throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string');
270
+ }
271
+ else {
272
+ this.setValidity(valid);
273
+ this.setErrorMessage(undefined, valid ? undefined : errorMessage);
274
+ this.hasDisplayedError = this.invalid;
275
+ }
276
+ }
277
+ /**
278
+ * Method to set validity values
279
+ * @param newValue - valid new value
280
+ */
281
+ setValidity(newValue) {
282
+ this.valid = newValue;
283
+ this.invalid = !this.valid;
284
+ // We need to send valid event even if it is the same value
285
+ this.inputValid.emit(this.valid);
286
+ }
252
287
  /**
253
288
  * Update ckecboxes item
254
289
  * @param key - property to update
@@ -299,9 +334,9 @@ export class MgInputCheckbox {
299
334
  */
300
335
  renderCheckboxMultiDisplaySelectedValues(selectedValuesNb) {
301
336
  if (this.displaySelectedValues) {
302
- return (selectedValuesNb > 0 && (h("ul", { role: "list", class: "mg-input__input-checkbox-multi-values-container" }, this.checkboxItems
337
+ return (selectedValuesNb > 0 && (h("ul", { role: "list", class: "mg-c-input__input-checkbox-multi-values-container" }, this.checkboxItems
303
338
  .filter(({ value }) => value)
304
- .map(({ title }) => (h("li", { class: "mg-input__input-checkbox-multi-value", key: title }, title))))));
339
+ .map(({ title }) => (h("li", { class: "mg-c-input__input-checkbox-multi-value", key: title }, title))))));
305
340
  }
306
341
  else {
307
342
  return h("strong", null, this.messages.input.checkbox[selectedValuesNb > 1 ? 'selectedValues' : 'selectedValue'].replace('{nb}', selectedValuesNb));
@@ -335,13 +370,13 @@ export class MgInputCheckbox {
335
370
  renderCheckboxMulti() {
336
371
  const selectedValuesNb = this.checkboxItems.filter(({ value }) => value).length;
337
372
  const checkboxes = this.getDisplayItems();
338
- return (h("div", { class: { 'mg-input__input-container': true, 'mg-input__input-checkbox-multi': true, 'mg-input__input-checkbox-multi--with-values': this.displaySelectedValues } }, this.renderCheckboxMultiDisplaySelectedValues(selectedValuesNb), h("mg-popover", { arrowHide: true, identifier: this.getMgPopoverIdentifier(), "onDisplay-change": this.handleMgPopoverDisplayChange, ref: (el) => {
373
+ return (h("div", { class: { 'mg-c-input__input-container': true, 'mg-c-input__input-checkbox-multi': true, 'mg-c-input__input-checkbox-multi--with-values': this.displaySelectedValues } }, this.renderCheckboxMultiDisplaySelectedValues(selectedValuesNb), h("mg-popover", { arrowHide: true, identifier: this.getMgPopoverIdentifier(), "onDisplay-change": this.handleMgPopoverDisplayChange, ref: (el) => {
339
374
  if (Boolean(el))
340
375
  this.mgPopover = el;
341
376
  } }, h("mg-button", { variant: "secondary" }, h("mg-icon", { icon: "list" }), this.renderButtonText(selectedValuesNb)), h("div", { slot: "content" }, this.displaySearchInput && [
342
377
  h("mg-input-text", { key: "input-search", identifier: `${this.identifier}-input-search`, icon: "magnifying-glass", type: "search", placeholder: this.messages.input.checkbox.label, label: this.messages.input.checkbox.label, mgWidth: "full", value: this.searchValue, labelHide: true, displayCharacterLeft: false, name: "q", "onValue-change": this.handleSearchChange, "aria-controls": "search-results items-list" }),
343
- h("p", { key: "search-results", role: "status", class: "sr-only", id: "search-results" }, `${checkboxes.length} ${this.messages.input.checkbox[checkboxes.length > 0 ? 'results' : 'result']}`),
344
- ], this.displaySearchInput ? (h("div", { class: "mg-input__input-checkbox-multi-sections-container" }, this.renderCheckboxBySection(checkboxes))) : (h(MgInputCheckboxList, { checkboxes: checkboxes, inputVerticalList: true, type: this.type, readonly: this.readonly, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name })), this.displaySearchInput && checkboxes.length === 0 && h("p", { class: "mg-input__input-checkbox-multi-no-result" }, this.messages.input.checkbox.noResult)))));
378
+ h("p", { key: "search-results", role: "status", class: "mg-u-visually-hidden", id: "search-results" }, `${checkboxes.length} ${this.messages.input.checkbox[checkboxes.length > 0 ? 'results' : 'result']}`),
379
+ ], this.displaySearchInput ? (h("div", { class: "mg-c-input__input-checkbox-multi-sections-container" }, this.renderCheckboxBySection(checkboxes))) : (h(MgInputCheckboxList, { checkboxes: checkboxes, inputVerticalList: true, type: this.type, readonly: this.readonly, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name })), this.displaySearchInput && checkboxes.length === 0 && h("p", { class: "mg-c-input__input-checkbox-multi-no-result" }, this.messages.input.checkbox.noResult)))));
345
380
  }
346
381
  /**
347
382
  * Render
@@ -354,12 +389,12 @@ export class MgInputCheckbox {
354
389
  static get encapsulation() { return "shadow"; }
355
390
  static get originalStyleUrls() {
356
391
  return {
357
- "$": ["mg-input-checkbox.scss"]
392
+ "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-input-checkbox.css"]
358
393
  };
359
394
  }
360
395
  static get styleUrls() {
361
396
  return {
362
- "$": ["mg-input-checkbox.css"]
397
+ "$": ["../../../../../node_modules/@mgdis/styles/dist/components/mg-input-checkbox.css"]
363
398
  };
364
399
  }
365
400
  static get properties() {
@@ -403,11 +438,10 @@ export class MgInputCheckbox {
403
438
  "optional": false,
404
439
  "docs": {
405
440
  "tags": [],
406
- "text": "Define checkbox type"
441
+ "text": "Define checkbox type\nWhen it's undefined the type is dynamic:\n- With 0-5 items type is 'checkbox'\n- With 5-10 items type is 'multi'\nWhen it set the type is locked to the defined value.\nWhen type is dynamic OR with 'multi' type AND Over 10 items \"search\" feature is enabled"
407
442
  },
408
443
  "attribute": "type",
409
- "reflect": false,
410
- "defaultValue": "checkboxTypes[0]"
444
+ "reflect": false
411
445
  },
412
446
  "identifier": {
413
447
  "type": "string",
@@ -723,9 +757,48 @@ export class MgInputCheckbox {
723
757
  "return": "Promise<void>"
724
758
  },
725
759
  "docs": {
726
- "text": "Public method to display errors",
760
+ "text": "Display input error if it exists.",
727
761
  "tags": []
728
762
  }
763
+ },
764
+ "setError": {
765
+ "complexType": {
766
+ "signature": "(valid: MgInputCheckbox['valid'], errorMessage: string) => Promise<void>",
767
+ "parameters": [{
768
+ "tags": [{
769
+ "name": "param",
770
+ "text": "valid - value indicating the validity"
771
+ }],
772
+ "text": "- value indicating the validity"
773
+ }, {
774
+ "tags": [{
775
+ "name": "param",
776
+ "text": "errorMessage - the error message to display"
777
+ }],
778
+ "text": "- the error message to display"
779
+ }],
780
+ "references": {
781
+ "Promise": {
782
+ "location": "global",
783
+ "id": "global::Promise"
784
+ },
785
+ "MgInputCheckbox": {
786
+ "location": "global",
787
+ "id": "global::MgInputCheckbox"
788
+ }
789
+ },
790
+ "return": "Promise<void>"
791
+ },
792
+ "docs": {
793
+ "text": "Set an error and display a custom error message.\nThis method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\nIt must be paired with an error message to display for the given context.\nWhen used to set validity to `false`, you should use this method again to reset the validity to `true`.",
794
+ "tags": [{
795
+ "name": "param",
796
+ "text": "valid - value indicating the validity"
797
+ }, {
798
+ "name": "param",
799
+ "text": "errorMessage - the error message to display"
800
+ }]
801
+ }
729
802
  }
730
803
  };
731
804
  }