@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
@@ -28,13 +28,13 @@ describe('mg-button', () => {
28
28
  test('Should replace classes on variant changes', async () => {
29
29
  const page = await getPage({ variant: 'primary', label: 'label' });
30
30
  const element = page.doc.querySelector('mg-button');
31
- let classPrimary = element.shadowRoot.querySelector('.mg-button--primary');
31
+ let classPrimary = element.shadowRoot.querySelector('.mg-c-button--primary');
32
32
  expect(classPrimary).not.toBeNull();
33
33
  // Change variant
34
34
  element.variant = 'danger';
35
35
  await page.waitForChanges();
36
- classPrimary = element.shadowRoot.querySelector('.mg-button--primary');
37
- const classDanger = element.shadowRoot.querySelector('.mg-button--danger');
36
+ classPrimary = element.shadowRoot.querySelector('.mg-c-button--primary');
37
+ const classDanger = element.shadowRoot.querySelector('.mg-c-button--danger');
38
38
  expect(classPrimary).toBeNull();
39
39
  expect(classDanger).not.toBeNull();
40
40
  });
@@ -1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I,CAAC,cAAc,EAAE,CAAC;MAE5B,IAAI,KAAK,CAAC,QAAQ,EAAE;QAClB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;OAC5E;WAAM;QACL,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;OACxE;IACH,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,2CAA2C,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE;MAC7F,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;MAClC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;MAEnD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;MAEhD,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;MAC3E,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;MAE5B,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgButton } from '../mg-button';\nimport { variants, buttonTypes } from '../mg-button.conf';\n\nconst getPage = (args, content = 'Text button') =>\n newSpecPage({\n components: [MgButton],\n template: () => <mg-button {...args}>{content}</mg-button>,\n });\n\ndescribe('mg-button', () => {\n test('Should render a button with an id', async () => {\n const { root } = await getPage({ identifier: 'identifier', label: 'label' });\n expect(root).toMatchSnapshot();\n });\n\n describe.each(variants)('Should render an %s button', variant => {\n test.each([false, true])('isIcon %s', async isIcon => {\n const { root } = await getPage({ variant, isIcon, label: 'label' });\n expect(root).toMatchSnapshot();\n });\n });\n\n test.each(buttonTypes)('Should render a button, case type %s', async type => {\n const { root } = await getPage({ label: 'label', type });\n expect(root).toMatchSnapshot();\n });\n\n test.each([true, false, undefined])('Should render a button, case full-width %s', async fullWidth => {\n const { root } = await getPage({ label: 'label', fullWidth });\n expect(root).toMatchSnapshot();\n });\n\n test('Should replace classes on variant changes', async () => {\n const page = await getPage({ variant: 'primary', label: 'label' });\n const element = page.doc.querySelector('mg-button');\n let classPrimary = element.shadowRoot.querySelector('.mg-button--primary');\n\n expect(classPrimary).not.toBeNull();\n\n // Change variant\n element.variant = 'danger';\n await page.waitForChanges();\n\n classPrimary = element.shadowRoot.querySelector('.mg-button--primary');\n const classDanger = element.shadowRoot.querySelector('.mg-button--danger');\n\n expect(classPrimary).toBeNull();\n expect(classDanger).not.toBeNull();\n });\n\n test.each(['', 'blu'])('Should throw error', async variant => {\n expect.assertions(1);\n try {\n await getPage({ variant });\n } catch (err) {\n expect(err.message).toContain('<mg-button> prop \"variant\" must be one of: ');\n }\n });\n\n test.each(['', ' ', undefined])('should throw error when using prop \"isIcon\" without a good prop \"label\"', async label => {\n expect.assertions(1);\n try {\n await getPage({ isIcon: true, label });\n } catch (err) {\n expect(err.message).toContain('<mg-button> prop \"label\" is mandatory when prop \"isIcon\" is set to true.');\n }\n });\n\n test('should throw error when using prop \"isIcon\" without a good prop \"fullWidth\"', async () => {\n expect.assertions(1);\n try {\n await getPage({ isIcon: true, label: 'batman', fullWidth: true });\n } catch (err) {\n expect(err.message).toContain('<mg-button> prop \"fullWidth\" cannot be used with prop \"isIcon\"');\n }\n });\n\n describe('prevent double click', () => {\n test('should NOT disable button after click', async () => {\n const page = await getPage({ identifier: 'identifier' });\n const button = page.doc.querySelector('mg-button');\n const spy = jest.spyOn(page.rootInstance.disabledChange, 'emit');\n\n expect(page.root).toMatchSnapshot();\n\n button.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(spy).not.toHaveBeenCalled();\n expect(page.root).toMatchSnapshot();\n\n button.disabled = true;\n await page.waitForChanges();\n expect(spy).toHaveBeenCalledWith(true);\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('should disable button after click', async () => {\n const page = await getPage({ disableOnClick: true });\n const button = page.doc.querySelector('mg-button');\n const spy = jest.spyOn(page.rootInstance.disabledChange, 'emit');\n\n expect(page.root).toMatchSnapshot();\n\n button.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(spy).toHaveBeenCalledWith(true);\n expect(page.root).toMatchSnapshot();\n\n button.disabled = false;\n await page.waitForChanges();\n\n expect(spy).toHaveBeenCalledWith(false);\n expect(page.root).toMatchSnapshot();\n });\n\n test('should not trigger disableOnClick when disabled', async () => {\n const page = await getPage({\n disabled: true,\n disableOnCLick: true,\n });\n const button = page.doc.querySelector('mg-button');\n const spy = jest.spyOn(page.rootInstance.disabledChange, 'emit');\n\n expect(page.root).toMatchSnapshot();\n\n button.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(spy).not.toHaveBeenCalled();\n expect(page.root).toMatchSnapshot();\n });\n\n test('should not have fn when disabled', async () => {\n const page = await getPage({\n disabled: true,\n onClick: () => false,\n });\n\n expect(page.root).toMatchSnapshot();\n });\n });\n\n describe.each([{ identifier: 'identifier' }, { identifier: 'identifier', disabled: true }])('keyboard', props => {\n test.each([' ', 'Enter', 'NumpadEnter'])('Should trigger click event on keydown', async key => {\n const page = await getPage(props);\n const button = page.doc.querySelector('mg-button');\n\n const spy = jest.spyOn(button, 'dispatchEvent');\n\n button.dispatchEvent(new KeyboardEvent(key === ' ' ? 'keyup' : 'keydown', { bubbles: true, key }));\n await page.waitForChanges();\n\n if (props.disabled) {\n expect(spy).not.lastCalledWith(expect.objectContaining({ type: 'click' }));\n } else {\n expect(spy).lastCalledWith(expect.objectContaining({ type: 'click' }));\n }\n });\n test.each(['ArrowRight', 'Tab', ' '])('Should NOT trigger click event on keydown', async key => {\n const page = await getPage(props);\n const button = page.doc.querySelector('mg-button');\n\n const spy = jest.spyOn(button, 'dispatchEvent');\n\n button.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key }));\n await page.waitForChanges();\n\n expect(spy).not.lastCalledWith(expect.objectContaining({ type: 'click' }));\n });\n });\n});\n"]}
1
+ {"version":3,"file":"mg-button.spec.js","sourceRoot":"","sources":["../../../../../src/components/atoms/mg-button/test/mg-button.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,EAAE,EAAE,CAChD,WAAW,CAAC;EACV,UAAU,EAAE,CAAC,QAAQ,CAAC;EACtB,QAAQ,EAAE,GAAG,EAAE,CAAC,iCAAe,IAAI,GAAG,OAAO,CAAa;CAC3D,CAAC,CAAC;AAEL,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;EACzB,IAAI,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7E,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;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GAAG,EAAE,CAAC,CAAC,CAAC;MAC3E,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;MAE5B,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgButton } from '../mg-button';\nimport { variants, buttonTypes } from '../mg-button.conf';\n\nconst getPage = (args, content = 'Text button') =>\n newSpecPage({\n components: [MgButton],\n template: () => <mg-button {...args}>{content}</mg-button>,\n });\n\ndescribe('mg-button', () => {\n test('Should render a button with an id', async () => {\n const { root } = await getPage({ identifier: 'identifier', label: 'label' });\n expect(root).toMatchSnapshot();\n });\n\n describe.each(variants)('Should render an %s button', variant => {\n test.each([false, true])('isIcon %s', async isIcon => {\n const { root } = await getPage({ variant, isIcon, label: 'label' });\n expect(root).toMatchSnapshot();\n });\n });\n\n test.each(buttonTypes)('Should render a button, case type %s', async type => {\n const { root } = await getPage({ label: 'label', type });\n expect(root).toMatchSnapshot();\n });\n\n test.each([true, false, undefined])('Should render a button, case full-width %s', async fullWidth => {\n const { root } = await getPage({ label: 'label', fullWidth });\n expect(root).toMatchSnapshot();\n });\n\n test('Should replace classes on variant changes', async () => {\n const page = await getPage({ variant: 'primary', label: 'label' });\n const element = page.doc.querySelector('mg-button');\n let classPrimary = element.shadowRoot.querySelector('.mg-c-button--primary');\n\n expect(classPrimary).not.toBeNull();\n\n // Change variant\n element.variant = 'danger';\n await page.waitForChanges();\n\n classPrimary = element.shadowRoot.querySelector('.mg-c-button--primary');\n const classDanger = element.shadowRoot.querySelector('.mg-c-button--danger');\n\n expect(classPrimary).toBeNull();\n expect(classDanger).not.toBeNull();\n });\n\n test.each(['', 'blu'])('Should throw error', async variant => {\n expect.assertions(1);\n try {\n await getPage({ variant });\n } catch (err) {\n expect(err.message).toContain('<mg-button> prop \"variant\" must be one of: ');\n }\n });\n\n test.each(['', ' ', undefined])('should throw error when using prop \"isIcon\" without a good prop \"label\"', async label => {\n expect.assertions(1);\n try {\n await getPage({ isIcon: true, label });\n } catch (err) {\n expect(err.message).toContain('<mg-button> prop \"label\" is mandatory when prop \"isIcon\" is set to true.');\n }\n });\n\n test('should throw error when using prop \"isIcon\" without a good prop \"fullWidth\"', async () => {\n expect.assertions(1);\n try {\n await getPage({ isIcon: true, label: 'batman', fullWidth: true });\n } catch (err) {\n expect(err.message).toContain('<mg-button> prop \"fullWidth\" cannot be used with prop \"isIcon\"');\n }\n });\n\n describe('prevent double click', () => {\n test('should NOT disable button after click', async () => {\n const page = await getPage({ identifier: 'identifier' });\n const button = page.doc.querySelector('mg-button');\n const spy = jest.spyOn(page.rootInstance.disabledChange, 'emit');\n\n expect(page.root).toMatchSnapshot();\n\n button.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(spy).not.toHaveBeenCalled();\n expect(page.root).toMatchSnapshot();\n\n button.disabled = true;\n await page.waitForChanges();\n expect(spy).toHaveBeenCalledWith(true);\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('should disable button after click', async () => {\n const page = await getPage({ disableOnClick: true });\n const button = page.doc.querySelector('mg-button');\n const spy = jest.spyOn(page.rootInstance.disabledChange, 'emit');\n\n expect(page.root).toMatchSnapshot();\n\n button.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(spy).toHaveBeenCalledWith(true);\n expect(page.root).toMatchSnapshot();\n\n button.disabled = false;\n await page.waitForChanges();\n\n expect(spy).toHaveBeenCalledWith(false);\n expect(page.root).toMatchSnapshot();\n });\n\n test('should not trigger disableOnClick when disabled', async () => {\n const page = await getPage({\n disabled: true,\n disableOnCLick: true,\n });\n const button = page.doc.querySelector('mg-button');\n const spy = jest.spyOn(page.rootInstance.disabledChange, 'emit');\n\n expect(page.root).toMatchSnapshot();\n\n button.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(spy).not.toHaveBeenCalled();\n expect(page.root).toMatchSnapshot();\n });\n\n test('should not have fn when disabled', async () => {\n const page = await getPage({\n disabled: true,\n onClick: () => false,\n });\n\n expect(page.root).toMatchSnapshot();\n });\n });\n\n describe.each([{ identifier: 'identifier' }, { identifier: 'identifier', disabled: true }])('keyboard', props => {\n test.each([' ', 'Enter', 'NumpadEnter'])('Should trigger click event on keydown', async key => {\n const page = await getPage(props);\n const button = page.doc.querySelector('mg-button');\n\n const spy = jest.spyOn(button, 'dispatchEvent');\n\n button.dispatchEvent(new KeyboardEvent(key === ' ' ? 'keyup' : 'keydown', { bubbles: true, key }));\n await page.waitForChanges();\n\n if (props.disabled) {\n expect(spy).not.lastCalledWith(expect.objectContaining({ type: 'click' }));\n } else {\n expect(spy).lastCalledWith(expect.objectContaining({ type: 'click' }));\n }\n });\n test.each(['ArrowRight', 'Tab', ' '])('Should NOT trigger click event on keydown', async key => {\n const page = await getPage(props);\n const button = page.doc.querySelector('mg-button');\n\n const spy = jest.spyOn(button, 'dispatchEvent');\n\n button.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key }));\n await page.waitForChanges();\n\n expect(spy).not.lastCalledWith(expect.objectContaining({ type: 'click' }));\n });\n });\n});\n"]}
@@ -7,7 +7,7 @@ export class MgCard {
7
7
  * Private *
8
8
  *************/
9
9
  this.name = 'mg-card';
10
- this.baseClass = this.name;
10
+ this.classBase = 'mg-c-card';
11
11
  /**
12
12
  * Methode to set default varianStyle props
13
13
  * needeed has stencil doesn't know that props is mutated when updated in prop watcher
@@ -18,17 +18,17 @@ export class MgCard {
18
18
  };
19
19
  this.variant = undefined;
20
20
  this.variantStyle = undefined;
21
- this.classCollection = new ClassList([this.baseClass]);
21
+ this.classCollection = new ClassList([this.classBase]);
22
22
  }
23
23
  validateVariant(newValue, oldValue) {
24
24
  if (newValue && !variants.includes(newValue))
25
25
  throw new Error(`<${this.name}> prop "variant" must match VariantType type.`);
26
26
  if (Boolean(newValue)) {
27
27
  this.setDefaultVariantStyle();
28
- this.classCollection.add(`${this.baseClass}--${newValue}`);
28
+ this.classCollection.add(`${this.classBase}--${newValue}`);
29
29
  }
30
30
  if (Boolean(oldValue))
31
- this.classCollection.delete(`${this.baseClass}--${oldValue}`);
31
+ this.classCollection.delete(`${this.classBase}--${oldValue}`);
32
32
  }
33
33
  validateVariantStyle(newValue, oldValue) {
34
34
  if (newValue && !variantStyles.includes(newValue))
@@ -36,9 +36,9 @@ export class MgCard {
36
36
  else if (Boolean(newValue) && !variants.includes(this.variant))
37
37
  throw new Error(`<${this.name}> prop "variantStyle" must be paired with ${JSON.stringify(variants)} "variant" prop.`);
38
38
  if (Boolean(newValue))
39
- this.classCollection.add(`${this.baseClass}--${newValue}`);
39
+ this.classCollection.add(`${this.classBase}--${newValue}`);
40
40
  if (Boolean(oldValue))
41
- this.classCollection.delete(`${this.baseClass}--${oldValue}`);
41
+ this.classCollection.delete(`${this.classBase}--${oldValue}`);
42
42
  }
43
43
  /*************
44
44
  * Lifecycle *
@@ -56,18 +56,18 @@ export class MgCard {
56
56
  */
57
57
  render() {
58
58
  var _a;
59
- return (h("div", { class: this.classCollection.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && h("span", { class: "mg-card__bar" }), h("slot", null)));
59
+ return (h("div", { class: this.classCollection.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && h("span", { class: "mg-c-card__bar" }), h("slot", null)));
60
60
  }
61
61
  static get is() { return "mg-card"; }
62
62
  static get encapsulation() { return "shadow"; }
63
63
  static get originalStyleUrls() {
64
64
  return {
65
- "$": ["mg-card.scss"]
65
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-card.css"]
66
66
  };
67
67
  }
68
68
  static get styleUrls() {
69
69
  return {
70
- "$": ["mg-card.css"]
70
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-card.css"]
71
71
  };
72
72
  }
73
73
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"mg-card.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-card/mg-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAyB,aAAa,EAAoB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAOlG,MAAM,OAAO,MAAM;;IACjB;;mBAEe;IAEE,SAAI,GAAG,SAAS,CAAC;IACjB,cAAS,GAAG,IAAI,CAAC,IAAI,CAAC;IAsCvC;;;OAGG;IACK,2BAAsB,GAAG,GAAS,EAAE;MAC1C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;QAAE,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;IACtE,CAAC,CAAC;;;2BARoC,IAAI,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;;EAzBrE,eAAe,CAAC,QAA2B,EAAE,QAA4B;IACvE,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;MAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,+CAA+C,CAAC,CAAC;IAC5H,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;MACrB,IAAI,CAAC,sBAAsB,EAAE,CAAC;MAC9B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC;KAC5D;IACD,IAAI,OAAO,CAAC,QAAQ,CAAC;MAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,KAAK,QAAQ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{ Component, h, Prop, State, Watch } from '@stencil/core';\nimport { ClassList } from '../../../utils/components.utils';\nimport { type VariantStyleType, variantStyles, type VariantType, variants } from './mg-card.conf';\n\n@Component({\n tag: 'mg-card',\n styleUrl: 'mg-card.scss',\n shadow: true,\n})\nexport class MgCard {\n /*************\n * Private *\n *************/\n\n private readonly name = 'mg-card';\n private readonly baseClass = this.name;\n\n /*************\n * Decorators *\n *************/\n\n /**\n * Define variant prop\n */\n @Prop() variant: undefined | VariantType;\n @Watch('variant')\n validateVariant(newValue: MgCard['variant'], oldValue?: MgCard['variant']) {\n if (newValue && !variants.includes(newValue)) throw new Error(`<${this.name}> prop \"variant\" must match VariantType type.`);\n if (Boolean(newValue)) {\n this.setDefaultVariantStyle();\n this.classCollection.add(`${this.baseClass}--${newValue}`);\n }\n if (Boolean(oldValue)) this.classCollection.delete(`${this.baseClass}--${oldValue}`);\n }\n\n /**\n * Define variantStyle prop\n */\n @Prop({ mutable: true }) variantStyle: undefined | VariantStyleType;\n @Watch('variantStyle')\n validateVariantStyle(newValue: MgCard['variantStyle'], oldValue?: MgCard['variantStyle']) {\n if (newValue && !variantStyles.includes(newValue)) throw new Error(`<${this.name}> prop \"variantStyle\" must match VariantStyleType type.`);\n else if (Boolean(newValue) && !variants.includes(this.variant))\n throw new Error(`<${this.name}> prop \"variantStyle\" must be paired with ${JSON.stringify(variants)} \"variant\" prop.`);\n if (Boolean(newValue)) this.classCollection.add(`${this.baseClass}--${newValue}`);\n if (Boolean(oldValue)) this.classCollection.delete(`${this.baseClass}--${oldValue}`);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList([this.baseClass]);\n\n /**\n * Methode to set default varianStyle props\n * needeed has stencil doesn't know that props is mutated when updated in prop watcher\n */\n private setDefaultVariantStyle = (): void => {\n if (this.variantStyle === undefined) this.variantStyle = 'bar-left';\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateVariantStyle(this.variantStyle);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <div class={this.classCollection.join()}>\n {this.variantStyle?.startsWith('bar-') && <span class=\"mg-card__bar\"></span>}\n <slot></slot>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-card.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-card/mg-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAyB,aAAa,EAAoB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAOlG,MAAM,OAAO,MAAM;;IACjB;;mBAEe;IAEE,SAAI,GAAG,SAAS,CAAC;IACjB,cAAS,GAAG,WAAW,CAAC;IAsCzC;;;OAGG;IACK,2BAAsB,GAAG,GAAS,EAAE;MAC1C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;QAAE,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;IACtE,CAAC,CAAC;;;2BARoC,IAAI,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;;EAzBrE,eAAe,CAAC,QAA2B,EAAE,QAA4B;IACvE,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;MAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,+CAA+C,CAAC,CAAC;IAC5H,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;MACrB,IAAI,CAAC,sBAAsB,EAAE,CAAC;MAC9B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC;KAC5D;IACD,IAAI,OAAO,CAAC,QAAQ,CAAC;MAAE,IAAI,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\nimport { ClassList } from '../../../utils/components.utils';\nimport { type VariantStyleType, variantStyles, type VariantType, variants } from './mg-card.conf';\n\n@Component({\n tag: 'mg-card',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-card.css',\n shadow: true,\n})\nexport class MgCard {\n /*************\n * Private *\n *************/\n\n private readonly name = 'mg-card';\n private readonly classBase = 'mg-c-card';\n\n /*************\n * Decorators *\n *************/\n\n /**\n * Define variant prop\n */\n @Prop() variant: undefined | VariantType;\n @Watch('variant')\n validateVariant(newValue: MgCard['variant'], oldValue?: MgCard['variant']) {\n if (newValue && !variants.includes(newValue)) throw new Error(`<${this.name}> prop \"variant\" must match VariantType type.`);\n if (Boolean(newValue)) {\n this.setDefaultVariantStyle();\n this.classCollection.add(`${this.classBase}--${newValue}`);\n }\n if (Boolean(oldValue)) this.classCollection.delete(`${this.classBase}--${oldValue}`);\n }\n\n /**\n * Define variantStyle prop\n */\n @Prop({ mutable: true }) variantStyle: undefined | VariantStyleType;\n @Watch('variantStyle')\n validateVariantStyle(newValue: MgCard['variantStyle'], oldValue?: MgCard['variantStyle']) {\n if (newValue && !variantStyles.includes(newValue)) throw new Error(`<${this.name}> prop \"variantStyle\" must match VariantStyleType type.`);\n else if (Boolean(newValue) && !variants.includes(this.variant))\n throw new Error(`<${this.name}> prop \"variantStyle\" must be paired with ${JSON.stringify(variants)} \"variant\" prop.`);\n if (Boolean(newValue)) this.classCollection.add(`${this.classBase}--${newValue}`);\n if (Boolean(oldValue)) this.classCollection.delete(`${this.classBase}--${oldValue}`);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList([this.classBase]);\n\n /**\n * Methode to set default varianStyle props\n * needeed has stencil doesn't know that props is mutated when updated in prop watcher\n */\n private setDefaultVariantStyle = (): void => {\n if (this.variantStyle === undefined) this.variantStyle = 'bar-left';\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateVariantStyle(this.variantStyle);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <div class={this.classCollection.join()}>\n {this.variantStyle?.startsWith('bar-') && <span class=\"mg-c-card__bar\"></span>}\n <slot></slot>\n </div>\n );\n }\n}\n"]}
@@ -26,18 +26,18 @@ export class MgCharacterLeft {
26
26
  * @returns HTML Element
27
27
  */
28
28
  render() {
29
- return (h("span", { id: this.identifier, "aria-live": "polite" }, h("span", { "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { class: "sr-only" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
29
+ return (h("span", { id: this.identifier, "aria-live": "polite" }, h("span", { "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { class: "mg-u-visually-hidden" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
30
30
  }
31
31
  static get is() { return "mg-character-left"; }
32
32
  static get encapsulation() { return "scoped"; }
33
33
  static get originalStyleUrls() {
34
34
  return {
35
- "$": ["mg-character-left.scss"]
35
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-character-left.css"]
36
36
  };
37
37
  }
38
38
  static get styleUrls() {
39
39
  return {
40
- "$": ["mg-character-left.css"]
40
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-character-left.css"]
41
41
  };
42
42
  }
43
43
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"mg-character-left.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-character-left/mg-character-left.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,MAAM,OAAO,eAAe;;;sBAyBL,EAAE;;;EAOvB,iBAAiB,CAAC,QAAgB;IAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;MAChC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;EACH,CAAC;EAED;;iBAEe;EAEf;;KAEG;EACH,iBAAiB;IACf,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;EACrD,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,YAAM,EAAE,EAAE,IAAI,CAAC,UAAU,eAAY,QAAQ;MAC3C,2BAAkB,MAAM;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM;;QAAG,IAAI,CAAC,SAAS,CACpD;MACP,YAAM,KAAK,EAAC,SAAS,IAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAQ,CAChH,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, Watch } from '@stencil/core';\nimport { initLocales } from '../../../locales';\n\n@Component({\n tag: 'mg-character-left',\n styleUrl: 'mg-character-left.scss',\n scoped: true,\n})\nexport class MgCharacterLeft {\n /************\n * Internal *\n ************/\n\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgCharacterLeftElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string;\n\n /**\n * Sets the characters to count\n */\n @Prop() characters = '';\n\n /**\n * Add maximum length\n */\n @Prop() maxlength!: number;\n @Watch('maxlength')\n validateMaxlength(newValue: number): void {\n if (typeof newValue !== 'number') {\n throw new Error('<mg-character-left> prop \"maxlength\" is required.');\n }\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateMaxlength(this.maxlength);\n this.messages = initLocales(this.element).messages;\n }\n\n /**\n * Render component\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <span id={this.identifier} aria-live=\"polite\">\n <span aria-hidden=\"true\">\n {this.maxlength - this.characters.length}/{this.maxlength}\n </span>\n <span class=\"sr-only\">{this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length)}</span>\n </span>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-character-left.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-character-left/mg-character-left.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,MAAM,OAAO,eAAe;;;sBAyBL,EAAE;;;EAOvB,iBAAiB,CAAC,QAAgB;IAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;MAChC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;EACH,CAAC;EAED;;iBAEe;EAEf;;KAEG;EACH,iBAAiB;IACf,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;EACrD,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,YAAM,EAAE,EAAE,IAAI,CAAC,UAAU,eAAY,QAAQ;MAC3C,2BAAkB,MAAM;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM;;QAAG,IAAI,CAAC,SAAS,CACpD;MACP,YAAM,KAAK,EAAC,sBAAsB,IAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAQ,CAC7H,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, Watch } from '@stencil/core';\nimport { initLocales } from '../../../locales';\n\n@Component({\n tag: 'mg-character-left',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-character-left.css',\n scoped: true,\n})\nexport class MgCharacterLeft {\n /************\n * Internal *\n ************/\n\n private messages;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgCharacterLeftElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string;\n\n /**\n * Sets the characters to count\n */\n @Prop() characters = '';\n\n /**\n * Add maximum length\n */\n @Prop() maxlength!: number;\n @Watch('maxlength')\n validateMaxlength(newValue: number): void {\n if (typeof newValue !== 'number') {\n throw new Error('<mg-character-left> prop \"maxlength\" is required.');\n }\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateMaxlength(this.maxlength);\n this.messages = initLocales(this.element).messages;\n }\n\n /**\n * Render component\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <span id={this.identifier} aria-live=\"polite\">\n <span aria-hidden=\"true\">\n {this.maxlength - this.characters.length}/{this.maxlength}\n </span>\n <span class=\"mg-u-visually-hidden\">{this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length)}</span>\n </span>\n );\n }\n}\n"]}
@@ -9,20 +9,20 @@ export class MgDivider {
9
9
  */
10
10
  render() {
11
11
  return (h("div", { class: {
12
- 'mg-divider': true,
13
- 'mg-divider--full': this.size === 'full',
12
+ 'mg-c-divider': true,
13
+ 'mg-c-divider--full': this.size === 'full',
14
14
  } }));
15
15
  }
16
16
  static get is() { return "mg-divider"; }
17
17
  static get encapsulation() { return "shadow"; }
18
18
  static get originalStyleUrls() {
19
19
  return {
20
- "$": ["mg-divider.scss"]
20
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-divider.css"]
21
21
  };
22
22
  }
23
23
  static get styleUrls() {
24
24
  return {
25
- "$": ["mg-divider.css"]
25
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-divider.css"]
26
26
  };
27
27
  }
28
28
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"mg-divider.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-divider/mg-divider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAOnD,MAAM,OAAO,SAAS;;gBAQe,SAAS;;EAE5C;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,WACE,KAAK,EAAE;QACL,YAAY,EAAE,IAAI;QAClB,kBAAkB,EAAE,IAAI,CAAC,IAAI,KAAK,MAAM;OACzC,GACI,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from '@stencil/core';\n\n@Component({\n tag: 'mg-divider',\n styleUrl: 'mg-divider.scss',\n shadow: true,\n})\nexport class MgDivider {\n /**************\n * Decorators *\n **************/\n\n /**\n * Define component size\n */\n @Prop() size: 'regular' | 'full' = 'regular';\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <div\n class={{\n 'mg-divider': true,\n 'mg-divider--full': this.size === 'full',\n }}\n ></div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-divider.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-divider/mg-divider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAOnD,MAAM,OAAO,SAAS;;gBAQe,SAAS;;EAE5C;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,WACE,KAAK,EAAE;QACL,cAAc,EAAE,IAAI;QACpB,oBAAoB,EAAE,IAAI,CAAC,IAAI,KAAK,MAAM;OAC3C,GACI,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from '@stencil/core';\n\n@Component({\n tag: 'mg-divider',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-divider.css',\n shadow: true,\n})\nexport class MgDivider {\n /**************\n * Decorators *\n **************/\n\n /**\n * Define component size\n */\n @Prop() size: 'regular' | 'full' = 'regular';\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <div\n class={{\n 'mg-c-divider': true,\n 'mg-c-divider--full': this.size === 'full',\n }}\n ></div>\n );\n }\n}\n"]}
@@ -29,15 +29,15 @@ export class MgIcon {
29
29
  this.variant = undefined;
30
30
  this.variantStyle = undefined;
31
31
  this.spin = false;
32
- this.classCollection = new ClassList(['mg-icon']);
32
+ this.classCollection = new ClassList(['mg-c-icon']);
33
33
  }
34
34
  validateIcon(newValue, oldValue) {
35
35
  if (!iconList.includes(newValue))
36
36
  throw new Error(`<mg-icon> prop "icon" must be one of: ${iconList.join(', ')}`);
37
37
  else {
38
38
  if (oldValue !== undefined)
39
- this.classCollection.delete(`mg-icon--${oldValue}`);
40
- this.classCollection.add(`mg-icon--${newValue}`);
39
+ this.classCollection.delete(`mg-c-icon--${oldValue}`);
40
+ this.classCollection.add(`mg-c-icon--${newValue}`);
41
41
  this.renderIcon(newValue);
42
42
  }
43
43
  }
@@ -46,8 +46,8 @@ export class MgIcon {
46
46
  throw new Error(`<mg-icon> prop "size" must be one of: ${sizes.join(', ')}`);
47
47
  else {
48
48
  if (oldValue !== undefined)
49
- this.classCollection.delete(`mg-icon--size-${oldValue}`);
50
- this.classCollection.add(`mg-icon--size-${newValue}`);
49
+ this.classCollection.delete(`mg-c-icon--size-${oldValue}`);
50
+ this.classCollection.add(`mg-c-icon--size-${newValue}`);
51
51
  }
52
52
  }
53
53
  validateVariant(newValue, oldValue) {
@@ -57,8 +57,8 @@ export class MgIcon {
57
57
  else {
58
58
  this.setDefaultVariantStyle();
59
59
  if (oldValue !== undefined)
60
- this.classCollection.delete(`mg-icon--variant-${oldValue}`);
61
- this.classCollection.add(`mg-icon--variant-${newValue}`);
60
+ this.classCollection.delete(`mg-c-icon--variant-${oldValue}`);
61
+ this.classCollection.add(`mg-c-icon--variant-${newValue}`);
62
62
  }
63
63
  }
64
64
  }
@@ -68,19 +68,17 @@ export class MgIcon {
68
68
  throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles.join(', ')}`);
69
69
  else {
70
70
  if (oldValue !== undefined)
71
- this.classCollection.delete(`mg-icon--variant-style-${oldValue}`);
72
- this.classCollection.add(`mg-icon--variant-style-${newValue}`);
71
+ this.classCollection.delete(`mg-c-icon--variant-style-${oldValue}`);
72
+ this.classCollection.add(`mg-c-icon--variant-style-${newValue}`);
73
73
  }
74
74
  }
75
75
  }
76
76
  handleSpin(newValue) {
77
77
  if (newValue) {
78
- this.classCollection.add('mg-icon--spin');
79
- this.classCollection.add('mg-a11y-animation');
78
+ this.classCollection.add('mg-c-icon--spin');
80
79
  }
81
80
  else {
82
- this.classCollection.delete('mg-icon--spin');
83
- this.classCollection.delete('mg-a11y-animation');
81
+ this.classCollection.delete('mg-c-icon--spin');
84
82
  }
85
83
  }
86
84
  /**
@@ -105,12 +103,12 @@ export class MgIcon {
105
103
  static get encapsulation() { return "shadow"; }
106
104
  static get originalStyleUrls() {
107
105
  return {
108
- "$": ["mg-icon.scss"]
106
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-icon.css"]
109
107
  };
110
108
  }
111
109
  static get styleUrls() {
112
110
  return {
113
- "$": ["mg-icon.css"]
111
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-icon.css"]
114
112
  };
115
113
  }
116
114
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"mg-icon.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-icon/mg-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAuD,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAO9C,MAAM,OAAO,MAAM;;IA0FjB;;;OAGG;IACK,2BAAsB,GAAG,GAAS,EAAE;MAC1C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;QAAE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACxE,CAAC,CAAC;IAEF;;;OAGG;IACK,eAAU,GAAG,IAAI,CAAC,EAAE;MAC1B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;MAChD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;MACxD,wBAAwB;MACxB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;MAC7C,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;MAC5C,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,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nC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,cAAc;IACd,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EAC7B,CAAC;EAED;;KAEG;EACH,mBAAmB;IACjB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;EAC9D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Watch, State, Element } from '@stencil/core';\nimport { sizes, variants, IconVariantType, IconSizeType, IconVariantStyleType, variantStyles } from './mg-icon.conf';\nimport { ClassList } from '../../../utils/components.utils';\nimport iconList from '@mgdis/img/dist/icons/index.json';\nimport { icons } from '../../../assets/icons';\n\n@Component({\n tag: 'mg-icon',\n styleUrl: 'mg-icon.scss',\n shadow: true,\n})\nexport class MgIcon {\n private svg: SVGSVGElement;\n\n /**\n * Icon HTML Element\n */\n @Element() element: HTMLMgIconElement;\n\n /**\n * Icon to display.\n */\n @Prop() icon!: string;\n @Watch('icon')\n validateIcon(newValue: MgIcon['icon'], oldValue?: MgIcon['icon']): void {\n if (!iconList.includes(newValue)) throw new Error(`<mg-icon> prop \"icon\" must be one of: ${iconList.join(', ')}`);\n else {\n if (oldValue !== undefined) this.classCollection.delete(`mg-icon--${oldValue}`);\n this.classCollection.add(`mg-icon--${newValue}`);\n this.renderIcon(newValue);\n }\n }\n\n /**\n * Define icon size\n */\n @Prop() size: IconSizeType = 'regular';\n @Watch('size')\n validateSize(newValue: MgIcon['size'], oldValue?: MgIcon['size']): void {\n if (!sizes.includes(newValue)) throw new Error(`<mg-icon> prop \"size\" must be one of: ${sizes.join(', ')}`);\n else {\n if (oldValue !== undefined) this.classCollection.delete(`mg-icon--size-${oldValue}`);\n this.classCollection.add(`mg-icon--size-${newValue}`);\n }\n }\n\n /**\n * Define icon variant color\n */\n @Prop() variant: IconVariantType;\n @Watch('variant')\n validateVariant(newValue: MgIcon['variant'], oldValue?: MgIcon['variant']): void {\n if (Boolean(newValue)) {\n if (!variants.includes(newValue)) throw new Error(`<mg-icon> prop \"variant\" must be one of: ${variants.join(', ')}`);\n else {\n this.setDefaultVariantStyle();\n if (oldValue !== undefined) this.classCollection.delete(`mg-icon--variant-${oldValue}`);\n this.classCollection.add(`mg-icon--variant-${newValue}`);\n }\n }\n }\n\n /**\n * Define icon color variant style\n * Add a color to the icon based on variant color with given style\n * 'full': Used to set a circular background with variant soft color and icon variant color\n * 'background': Used to set a circular background with variant soft color\n * 'icon': Used to set a color only to the icon\n */\n @Prop({ mutable: true }) variantStyle: IconVariantStyleType;\n @Watch('variantStyle')\n validateVariantStyle(newValue: MgIcon['variantStyle'], oldValue?: MgIcon['variantStyle']): void {\n if (Boolean(newValue)) {\n if (!variantStyles.includes(newValue)) throw new Error(`<mg-icon> prop \"variantStyle\" must be one of: ${variantStyles.join(', ')}`);\n else {\n if (oldValue !== undefined) this.classCollection.delete(`mg-icon--variant-style-${oldValue}`);\n this.classCollection.add(`mg-icon--variant-style-${newValue}`);\n }\n }\n }\n\n /**\n * Make the icon spin\n */\n @Prop() spin = false;\n @Watch('spin')\n handleSpin(newValue: MgIcon['spin']): void {\n if (newValue) {\n this.classCollection.add('mg-icon--spin');\n this.classCollection.add('mg-a11y-animation');\n } else {\n this.classCollection.delete('mg-icon--spin');\n this.classCollection.delete('mg-a11y-animation');\n }\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-icon']);\n\n /**\n * Method to set default varianStyle props\n * needeed has stencil doesn't know that props is mutated when updated in prop watcher\n */\n private setDefaultVariantStyle = (): void => {\n if (this.variantStyle === undefined) this.variantStyle = 'background';\n };\n\n /**\n * Render icon in shadowroot\n * @param icon - icon to render\n */\n private renderIcon = icon => {\n this.element.shadowRoot.innerHTML = icons[icon];\n this.svg = this.element.shadowRoot.querySelector('svg');\n // update svg attributes\n this.svg.setAttribute('aria-hidden', 'true');\n this.svg.setAttribute('focusable', 'false');\n this.svg.setAttribute('class', this.classCollection.join());\n };\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateIcon(this.icon);\n this.validateSize(this.size);\n this.validateVariant(this.variant);\n this.validateVariantStyle(this.variantStyle);\n this.handleSpin(this.spin);\n // render icon\n this.renderIcon(this.icon);\n }\n\n /**\n * update html when component trigger changes\n */\n componentWillUpdate() {\n this.svg.setAttribute('class', this.classCollection.join());\n }\n}\n"]}
1
+ {"version":3,"file":"mg-icon.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-icon/mg-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAuD,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAO9C,MAAM,OAAO,MAAM;;IAwFjB;;;OAGG;IACK,2BAAsB,GAAG,GAAS,EAAE;MAC1C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;QAAE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACxE,CAAC,CAAC;IAEF;;;OAGG;IACK,eAAU,GAAG,IAAI,CAAC,EAAE;MAC1B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;MA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,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,cAAc;IACd,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EAC7B,CAAC;EAED;;KAEG;EACH,mBAAmB;IACjB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;EAC9D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Watch, State, Element } from '@stencil/core';\nimport { sizes, variants, IconVariantType, IconSizeType, IconVariantStyleType, variantStyles } from './mg-icon.conf';\nimport { ClassList } from '../../../utils/components.utils';\nimport iconList from '@mgdis/img/dist/icons/index.json';\nimport { icons } from '../../../assets/icons';\n\n@Component({\n tag: 'mg-icon',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-icon.css',\n shadow: true,\n})\nexport class MgIcon {\n private svg: SVGSVGElement;\n\n /**\n * Icon HTML Element\n */\n @Element() element: HTMLMgIconElement;\n\n /**\n * Icon to display.\n */\n @Prop() icon!: string;\n @Watch('icon')\n validateIcon(newValue: MgIcon['icon'], oldValue?: MgIcon['icon']): void {\n if (!iconList.includes(newValue)) throw new Error(`<mg-icon> prop \"icon\" must be one of: ${iconList.join(', ')}`);\n else {\n if (oldValue !== undefined) this.classCollection.delete(`mg-c-icon--${oldValue}`);\n this.classCollection.add(`mg-c-icon--${newValue}`);\n this.renderIcon(newValue);\n }\n }\n\n /**\n * Define icon size\n */\n @Prop() size: IconSizeType = 'regular';\n @Watch('size')\n validateSize(newValue: MgIcon['size'], oldValue?: MgIcon['size']): void {\n if (!sizes.includes(newValue)) throw new Error(`<mg-icon> prop \"size\" must be one of: ${sizes.join(', ')}`);\n else {\n if (oldValue !== undefined) this.classCollection.delete(`mg-c-icon--size-${oldValue}`);\n this.classCollection.add(`mg-c-icon--size-${newValue}`);\n }\n }\n\n /**\n * Define icon variant color\n */\n @Prop() variant: IconVariantType;\n @Watch('variant')\n validateVariant(newValue: MgIcon['variant'], oldValue?: MgIcon['variant']): void {\n if (Boolean(newValue)) {\n if (!variants.includes(newValue)) throw new Error(`<mg-icon> prop \"variant\" must be one of: ${variants.join(', ')}`);\n else {\n this.setDefaultVariantStyle();\n if (oldValue !== undefined) this.classCollection.delete(`mg-c-icon--variant-${oldValue}`);\n this.classCollection.add(`mg-c-icon--variant-${newValue}`);\n }\n }\n }\n\n /**\n * Define icon color variant style\n * Add a color to the icon based on variant color with given style\n * 'full': Used to set a circular background with variant soft color and icon variant color\n * 'background': Used to set a circular background with variant soft color\n * 'icon': Used to set a color only to the icon\n */\n @Prop({ mutable: true }) variantStyle: IconVariantStyleType;\n @Watch('variantStyle')\n validateVariantStyle(newValue: MgIcon['variantStyle'], oldValue?: MgIcon['variantStyle']): void {\n if (Boolean(newValue)) {\n if (!variantStyles.includes(newValue)) throw new Error(`<mg-icon> prop \"variantStyle\" must be one of: ${variantStyles.join(', ')}`);\n else {\n if (oldValue !== undefined) this.classCollection.delete(`mg-c-icon--variant-style-${oldValue}`);\n this.classCollection.add(`mg-c-icon--variant-style-${newValue}`);\n }\n }\n }\n\n /**\n * Make the icon spin\n */\n @Prop() spin = false;\n @Watch('spin')\n handleSpin(newValue: MgIcon['spin']): void {\n if (newValue) {\n this.classCollection.add('mg-c-icon--spin');\n } else {\n this.classCollection.delete('mg-c-icon--spin');\n }\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-icon']);\n\n /**\n * Method to set default varianStyle props\n * needeed has stencil doesn't know that props is mutated when updated in prop watcher\n */\n private setDefaultVariantStyle = (): void => {\n if (this.variantStyle === undefined) this.variantStyle = 'background';\n };\n\n /**\n * Render icon in shadowroot\n * @param icon - icon to render\n */\n private renderIcon = icon => {\n this.element.shadowRoot.innerHTML = icons[icon];\n this.svg = this.element.shadowRoot.querySelector('svg');\n // update svg attributes\n this.svg.setAttribute('aria-hidden', 'true');\n this.svg.setAttribute('focusable', 'false');\n this.svg.setAttribute('class', this.classCollection.join());\n };\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateIcon(this.icon);\n this.validateSize(this.size);\n this.validateVariant(this.variant);\n this.validateVariantStyle(this.variantStyle);\n this.handleSpin(this.spin);\n // render icon\n this.renderIcon(this.icon);\n }\n\n /**\n * update html when component trigger changes\n */\n componentWillUpdate() {\n this.svg.setAttribute('class', this.classCollection.join());\n }\n}\n"]}
@@ -30,13 +30,13 @@ describe('mg-icon', () => {
30
30
  expect(root).toMatchSnapshot();
31
31
  });
32
32
  test.each([
33
- { initialProps: { icon: 'chevron-up' }, initialClass: ['.mg-icon--chevron-up'], nextProps: { icon: 'chevron-down' }, nextClass: ['.mg-icon--chevron-down'] },
34
- { initialProps: { icon: 'chevron-up' }, initialClass: ['.mg-icon--size-regular'], nextProps: { size: 'large' }, nextClass: ['.mg-icon--size-large'] },
33
+ { initialProps: { icon: 'chevron-up' }, initialClass: ['.mg-c-icon--chevron-up'], nextProps: { icon: 'chevron-down' }, nextClass: ['.mg-c-icon--chevron-down'] },
34
+ { initialProps: { icon: 'chevron-up' }, initialClass: ['.mg-c-icon--size-regular'], nextProps: { size: 'large' }, nextClass: ['.mg-c-icon--size-large'] },
35
35
  {
36
36
  initialProps: { icon: 'chevron-up', variant: 'success', variantStyle: 'icon' },
37
- initialClass: ['.mg-icon--variant-success', '.mg-icon--variant-style-icon'],
37
+ initialClass: ['.mg-c-icon--variant-success', '.mg-c-icon--variant-style-icon'],
38
38
  nextProps: { variant: 'danger', variantStyle: 'background' },
39
- nextClass: ['.mg-icon--variant-danger', '.mg-icon--variant-style-background'],
39
+ nextClass: ['.mg-c-icon--variant-danger', '.mg-c-icon--variant-style-background'],
40
40
  },
41
41
  ])('Should replace classes on icon changes', async ({ initialProps, initialClass, nextProps, nextClass }) => {
42
42
  const page = await getPage(initialProps);
@@ -1 +1 @@
1
- {"version":3,"file":"mg-icon.spec.js","sourceRoot":"","sources":["../../../../../src/components/atoms/mg-icon/test/mg-icon.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AAExD,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,CACrB,WAAW,CAAC;EACV,UAAU,EAAE,CAAC,MAAM,CAAC;EACpB,QAAQ,EAAE,GAAG,EAAE,CAAC,+BAAa,IAAI,EAAY;CAC9C,CAAC,CAAC;AAEL,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;EACvB,SAAS,CAAC,GAAG,EAAE;IACb,IAAI,CAAC,aAAa,EAAE,CAAC;EACvB,CAAC,CAAC,CAAC;EAEH,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,uBAAuB,EAAE,IAAI,CAAC,EAAE;IACtD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;MAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM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K,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,4CAA4C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;IACnJ,MAAM,iBAAiB,GAAG;MACxB,KAAK,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE;MACpD,KAAK,EAAE,iDAAiD,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KACnF,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,SAAS,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAAC,mDAAmD,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;MACvJ,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;MACrB,IAAI;QACF,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;OACtB;MAAC,OAAO,GAAG,EAAE;QACZ,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;OACpC;IACH,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgIcon } from '../mg-icon';\nimport { sizes, variantStyles, variants } from '../mg-icon.conf';\nimport iconList from '@mgdis/img/dist/icons/index.json';\n\nconst getPage = args =>\n newSpecPage({\n components: [MgIcon],\n template: () => <mg-icon {...args}></mg-icon>,\n });\n\ndescribe('mg-icon', () => {\n afterEach(() => {\n jest.clearAllMocks();\n });\n\n describe.each(iconList)('Should render %s icon', icon => {\n test.each(sizes)('in %s size', async size => {\n const { root } = await getPage({ icon, size });\n expect(root).toMatchSnapshot();\n });\n\n test.each(variants)('using %s variant', async variant => {\n const { root } = await getPage({ icon, variant });\n expect(root).toMatchSnapshot();\n });\n\n test.each(variants.flatMap(variant => variantStyles.map(variantStyle => ({ variant, variantStyle }))))('using %s variant', async ({ variant, variantStyle }) => {\n const { root } = await getPage({ icon, variant, variantStyle });\n expect(root).toMatchSnapshot();\n });\n });\n\n test('Should render a spin icon', async () => {\n const { root } = await getPage({ icon: 'check-circle', spin: true });\n expect(root).toMatchSnapshot();\n });\n\n test.each([\n { initialProps: { icon: 'chevron-up' }, initialClass: ['.mg-icon--chevron-up'], nextProps: { icon: 'chevron-down' }, nextClass: ['.mg-icon--chevron-down'] },\n { initialProps: { icon: 'chevron-up' }, initialClass: ['.mg-icon--size-regular'], nextProps: { size: 'large' }, nextClass: ['.mg-icon--size-large'] },\n {\n initialProps: { icon: 'chevron-up', variant: 'success', variantStyle: 'icon' },\n initialClass: ['.mg-icon--variant-success', '.mg-icon--variant-style-icon'],\n nextProps: { variant: 'danger', variantStyle: 'background' },\n nextClass: ['.mg-icon--variant-danger', '.mg-icon--variant-style-background'],\n },\n ])('Should replace classes on icon changes', async ({ initialProps, initialClass, nextProps, nextClass }) => {\n const page = await getPage(initialProps);\n const element = page.doc.querySelector('mg-icon');\n\n // validate inital state\n initialClass.forEach(className => {\n expect(element.shadowRoot.querySelector(className)).not.toBeNull();\n });\n\n nextClass.forEach(className => {\n expect(element.shadowRoot.querySelector(className)).toBeNull();\n });\n\n // update props\n Object.keys(nextProps).forEach(key => {\n element[key] = nextProps[key];\n });\n\n await page.waitForChanges();\n\n // validate next state\n initialClass.forEach(className => {\n expect(element.shadowRoot.querySelector(className)).toBeNull();\n });\n\n nextClass.forEach(className => {\n expect(element.shadowRoot.querySelector(className)).not.toBeNull();\n });\n expect(page.root).toMatchSnapshot();\n });\n\n describe('errors', () => {\n const iconError = ['', 'blu', undefined].map(icon => ({ props: { icon }, error: `<mg-icon> prop \"icon\" must be one of: ${iconList.join(', ')}` }));\n const sizeError = ['', 'blu'].map(size => ({ props: { icon: 'check-circle', size }, error: `<mg-icon> prop \"size\" must be one of: ${sizes.join(', ')}` }));\n const variantError = { props: { icon: 'check-circle', variant: 'blu' }, error: `<mg-icon> prop \"variant\" must be one of: ${variants.join(', ')}` };\n const variantStyleError = {\n props: { icon: 'check-circle', variantStyle: 'blu' },\n error: `<mg-icon> prop \"variantStyle\" must be one of: ${variantStyles.join(', ')}`,\n };\n\n test.each([...iconError, ...sizeError, variantError, variantStyleError])('Should throw error with invalid icon property: %s', async ({ props, error }) => {\n expect.assertions(1);\n try {\n await getPage(props);\n } catch (err) {\n expect(err.message).toMatch(error);\n }\n });\n });\n});\n"]}
1
+ {"version":3,"file":"mg-icon.spec.js","sourceRoot":"","sources":["../../../../../src/components/atoms/mg-icon/test/mg-icon.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AAExD,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,CACrB,WAAW,CAAC;EACV,UAAU,EAAE,CAAC,MAAM,CAAC;EACpB,QAAQ,EAAE,GAAG,EAAE,CAAC,+BAAa,IAAI,EAAY;CAC9C,CAAC,CAAC;AAEL,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;EACvB,SAAS,CAAC,GAAG,EAAE;IACb,IAAI,CAAC,aAAa,EAAE,CAAC;EACvB,CAAC,CAAC,CAAC;EAEH,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,uBAAuB,EAAE,IAAI,CAAC,EAAE;IACtD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;MAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,OAA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,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,4CAA4C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;IACnJ,MAAM,iBAAiB,GAAG;MACxB,KAAK,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE;MACpD,KAAK,EAAE,iDAAiD,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KACnF,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,SAAS,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAAC,mDAAmD,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;MACvJ,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;MACrB,IAAI;QACF,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;OACtB;MAAC,OAAO,GAAG,EAAE;QACZ,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;OACpC;IACH,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgIcon } from '../mg-icon';\nimport { sizes, variantStyles, variants } from '../mg-icon.conf';\nimport iconList from '@mgdis/img/dist/icons/index.json';\n\nconst getPage = args =>\n newSpecPage({\n components: [MgIcon],\n template: () => <mg-icon {...args}></mg-icon>,\n });\n\ndescribe('mg-icon', () => {\n afterEach(() => {\n jest.clearAllMocks();\n });\n\n describe.each(iconList)('Should render %s icon', icon => {\n test.each(sizes)('in %s size', async size => {\n const { root } = await getPage({ icon, size });\n expect(root).toMatchSnapshot();\n });\n\n test.each(variants)('using %s variant', async variant => {\n const { root } = await getPage({ icon, variant });\n expect(root).toMatchSnapshot();\n });\n\n test.each(variants.flatMap(variant => variantStyles.map(variantStyle => ({ variant, variantStyle }))))('using %s variant', async ({ variant, variantStyle }) => {\n const { root } = await getPage({ icon, variant, variantStyle });\n expect(root).toMatchSnapshot();\n });\n });\n\n test('Should render a spin icon', async () => {\n const { root } = await getPage({ icon: 'check-circle', spin: true });\n expect(root).toMatchSnapshot();\n });\n\n test.each([\n { initialProps: { icon: 'chevron-up' }, initialClass: ['.mg-c-icon--chevron-up'], nextProps: { icon: 'chevron-down' }, nextClass: ['.mg-c-icon--chevron-down'] },\n { initialProps: { icon: 'chevron-up' }, initialClass: ['.mg-c-icon--size-regular'], nextProps: { size: 'large' }, nextClass: ['.mg-c-icon--size-large'] },\n {\n initialProps: { icon: 'chevron-up', variant: 'success', variantStyle: 'icon' },\n initialClass: ['.mg-c-icon--variant-success', '.mg-c-icon--variant-style-icon'],\n nextProps: { variant: 'danger', variantStyle: 'background' },\n nextClass: ['.mg-c-icon--variant-danger', '.mg-c-icon--variant-style-background'],\n },\n ])('Should replace classes on icon changes', async ({ initialProps, initialClass, nextProps, nextClass }) => {\n const page = await getPage(initialProps);\n const element = page.doc.querySelector('mg-icon');\n\n // validate inital state\n initialClass.forEach(className => {\n expect(element.shadowRoot.querySelector(className)).not.toBeNull();\n });\n\n nextClass.forEach(className => {\n expect(element.shadowRoot.querySelector(className)).toBeNull();\n });\n\n // update props\n Object.keys(nextProps).forEach(key => {\n element[key] = nextProps[key];\n });\n\n await page.waitForChanges();\n\n // validate next state\n initialClass.forEach(className => {\n expect(element.shadowRoot.querySelector(className)).toBeNull();\n });\n\n nextClass.forEach(className => {\n expect(element.shadowRoot.querySelector(className)).not.toBeNull();\n });\n expect(page.root).toMatchSnapshot();\n });\n\n describe('errors', () => {\n const iconError = ['', 'blu', undefined].map(icon => ({ props: { icon }, error: `<mg-icon> prop \"icon\" must be one of: ${iconList.join(', ')}` }));\n const sizeError = ['', 'blu'].map(size => ({ props: { icon: 'check-circle', size }, error: `<mg-icon> prop \"size\" must be one of: ${sizes.join(', ')}` }));\n const variantError = { props: { icon: 'check-circle', variant: 'blu' }, error: `<mg-icon> prop \"variant\" must be one of: ${variants.join(', ')}` };\n const variantStyleError = {\n props: { icon: 'check-circle', variantStyle: 'blu' },\n error: `<mg-icon> prop \"variantStyle\" must be one of: ${variantStyles.join(', ')}`,\n };\n\n test.each([...iconError, ...sizeError, variantError, variantStyleError])('Should throw error with invalid icon property: %s', async ({ props, error }) => {\n expect.assertions(1);\n try {\n await getPage(props);\n } catch (err) {\n expect(err.message).toMatch(error);\n }\n });\n });\n});\n"]}
@@ -1,4 +1,5 @@
1
1
  import { h } from "@stencil/core";
2
+ import { isValidString } from "../../../utils/components.utils";
2
3
  export class MgInputTitle {
3
4
  constructor() {
4
5
  this.identifier = undefined;
@@ -7,7 +8,7 @@ export class MgInputTitle {
7
8
  this.tagName = 'label';
8
9
  }
9
10
  validateIdentifier(newValue) {
10
- if (typeof newValue !== 'string' || newValue.trim() === '') {
11
+ if (!isValidString(newValue)) {
11
12
  throw new Error('<mg-input-title> prop "identifier" is required.');
12
13
  }
13
14
  }
@@ -31,18 +32,18 @@ export class MgInputTitle {
31
32
  render() {
32
33
  const TagName = this.tagName;
33
34
  // \u00A0 represent a &nbsp;
34
- return (h(TagName, { class: "mg-input-title", htmlFor: this.isLegend ? undefined : this.identifier }, h("slot", null), this.required && (h("span", { class: "mg-input-title__required" }, "\u00A0", h("span", { class: "is-asterisk" }, "*")))));
35
+ return (h(TagName, { class: "mg-c-input-title", htmlFor: this.isLegend ? undefined : this.identifier }, h("slot", null), this.required && (h("span", { class: "mg-c-input-title__required" }, "\u00A0", h("span", { class: "mg-u-is-asterisk" }, "*")))));
35
36
  }
36
37
  static get is() { return "mg-input-title"; }
37
38
  static get encapsulation() { return "scoped"; }
38
39
  static get originalStyleUrls() {
39
40
  return {
40
- "$": ["mg-input-title.scss"]
41
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-input-title.css"]
41
42
  };
42
43
  }
43
44
  static get styleUrls() {
44
45
  return {
45
- "$": ["mg-input-title.css"]
46
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-input-title.css"]
46
47
  };
47
48
  }
48
49
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"mg-input-title.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-input-title/mg-input-title.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAOjE,MAAM,OAAO,YAAY;;;;oBAoBJ,KAAK;mBASL,OAAO;;EAvB1B,kBAAkB,CAAC,QAAgB;IACjC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;MAC1D,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;KACpE;EACH,CAAC;EAYD,gBAAgB,CAAC,QAAkC;IACjD,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;EAC/C,CAAC;EAOD;;iBAEe;EAEf;;KAEG;EACH,iBAAiB;IACf,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;EACvC,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7B,4BAA4B;IAC5B,OAAO,CACL,EAAC,OAAO,IAAC,KAAK,EAAC,gBAAgB,EAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU;MAClF,eAAa;MACZ,IAAI,CAAC,QAAQ,IAAI,CAChB,YAAM,KAAK,EAAC,0BAA0B;;QAC9B,YAAM,KAAK,EAAC,aAAa,QAAS,CACnC,CACR,CACO,CACX,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\n\n@Component({\n tag: 'mg-input-title',\n styleUrl: 'mg-input-title.scss',\n scoped: true,\n})\nexport class MgInputTitle {\n /**\n * Label input id\n */\n @Prop() identifier!: string;\n @Watch('identifier')\n validateIdentifier(newValue: string): void {\n if (typeof newValue !== 'string' || newValue.trim() === '') {\n throw new Error('<mg-input-title> prop \"identifier\" is required.');\n }\n }\n\n /**\n * If input is required an asterisk is added at the end of the label\n */\n @Prop() required: boolean;\n\n /**\n * Switch from label to fieldset sementic\n */\n @Prop() isLegend = false;\n @Watch('isLegend')\n validateIsLegend(newValue: MgInputTitle['isLegend']) {\n this.tagName = newValue ? 'legend' : 'label';\n }\n\n /**\n * Component parent tagname\n */\n @State() tagName = 'label';\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Init tag name\n */\n componentWillLoad(): void {\n this.validateIdentifier(this.identifier);\n this.validateIsLegend(this.isLegend);\n }\n\n /**\n * Render\n * @returns HTML element\n */\n render(): HTMLElement {\n const TagName = this.tagName;\n // \\u00A0 represent a &nbsp;\n return (\n <TagName class=\"mg-input-title\" htmlFor={this.isLegend ? undefined : this.identifier}>\n <slot></slot>\n {this.required && (\n <span class=\"mg-input-title__required\">\n &nbsp;<span class=\"is-asterisk\">*</span>\n </span>\n )}\n </TagName>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-input-title.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-input-title/mg-input-title.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAOhE,MAAM,OAAO,YAAY;;;;oBAoBJ,KAAK;mBASL,OAAO;;EAvB1B,kBAAkB,CAAC,QAAoC;IACrD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;MAC5B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;KACpE;EACH,CAAC;EAYD,gBAAgB,CAAC,QAAkC;IACjD,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;EAC/C,CAAC;EAOD;;iBAEe;EAEf;;KAEG;EACH,iBAAiB;IACf,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;EACvC,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7B,4BAA4B;IAC5B,OAAO,CACL,EAAC,OAAO,IAAC,KAAK,EAAC,kBAAkB,EAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU;MACpF,eAAa;MACZ,IAAI,CAAC,QAAQ,IAAI,CAChB,YAAM,KAAK,EAAC,4BAA4B;;QAChC,YAAM,KAAK,EAAC,kBAAkB,QAAS,CACxC,CACR,CACO,CACX,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\nimport { isValidString } from '../../../utils/components.utils';\n\n@Component({\n tag: 'mg-input-title',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-input-title.css',\n scoped: true,\n})\nexport class MgInputTitle {\n /**\n * Label input id\n */\n @Prop() identifier!: string;\n @Watch('identifier')\n validateIdentifier(newValue: MgInputTitle['identifier']): void {\n if (!isValidString(newValue)) {\n throw new Error('<mg-input-title> prop \"identifier\" is required.');\n }\n }\n\n /**\n * If input is required an asterisk is added at the end of the label\n */\n @Prop() required: boolean;\n\n /**\n * Switch from label to fieldset sementic\n */\n @Prop() isLegend = false;\n @Watch('isLegend')\n validateIsLegend(newValue: MgInputTitle['isLegend']) {\n this.tagName = newValue ? 'legend' : 'label';\n }\n\n /**\n * Component parent tagname\n */\n @State() tagName = 'label';\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Init tag name\n */\n componentWillLoad(): void {\n this.validateIdentifier(this.identifier);\n this.validateIsLegend(this.isLegend);\n }\n\n /**\n * Render\n * @returns HTML element\n */\n render(): HTMLElement {\n const TagName = this.tagName;\n // \\u00A0 represent a &nbsp;\n return (\n <TagName class=\"mg-c-input-title\" htmlFor={this.isLegend ? undefined : this.identifier}>\n <slot></slot>\n {this.required && (\n <span class=\"mg-c-input-title__required\">\n &nbsp;<span class=\"mg-u-is-asterisk\">*</span>\n </span>\n )}\n </TagName>\n );\n }\n}\n"]}
@@ -1,18 +1,18 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { variants } from "./mg-tag.conf";
3
- import { ClassList } from "../../../utils/components.utils";
3
+ import { ClassList, isValidString } from "../../../utils/components.utils";
4
4
  export class MgTag {
5
5
  constructor() {
6
6
  /************
7
7
  * Internal *
8
8
  ************/
9
9
  // Classes
10
- this.classOutline = 'mg-tag--outline';
11
- this.classSoft = 'mg-tag--soft';
10
+ this.classOutline = 'mg-c-tag--outline';
11
+ this.classSoft = 'mg-c-tag--soft';
12
12
  this.variant = variants[0];
13
13
  this.outline = undefined;
14
14
  this.soft = undefined;
15
- this.classCollection = new ClassList(['mg-tag']);
15
+ this.classCollection = new ClassList(['mg-c-tag']);
16
16
  }
17
17
  validateVariant(newValue, oldValue) {
18
18
  if (!variants.includes(newValue)) {
@@ -20,9 +20,9 @@ export class MgTag {
20
20
  }
21
21
  else {
22
22
  if (oldValue !== undefined) {
23
- this.classCollection.delete(`mg-tag--${oldValue}`);
23
+ this.classCollection.delete(`mg-c-tag--${oldValue}`);
24
24
  }
25
- this.classCollection.add(`mg-tag--${newValue}`);
25
+ this.classCollection.add(`mg-c-tag--${newValue}`);
26
26
  }
27
27
  }
28
28
  validateOutline(newValue) {
@@ -49,7 +49,7 @@ export class MgTag {
49
49
  * @param textContent - html element textContent property
50
50
  */
51
51
  validateTextContent(textContent) {
52
- if (typeof textContent !== 'string' || textContent.trim() === '')
52
+ if (!isValidString(textContent))
53
53
  throw new Error('<mg-tag> slot must contain a text content.');
54
54
  }
55
55
  /*************
@@ -75,12 +75,12 @@ export class MgTag {
75
75
  static get encapsulation() { return "shadow"; }
76
76
  static get originalStyleUrls() {
77
77
  return {
78
- "$": ["mg-tag.scss"]
78
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-tag.css"]
79
79
  };
80
80
  }
81
81
  static get styleUrls() {
82
82
  return {
83
- "$": ["mg-tag.css"]
83
+ "$": ["../../../../node_modules/@mgdis/styles/dist/components/mg-tag.css"]
84
84
  };
85
85
  }
86
86
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"mg-tag.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-tag/mg-tag.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAkB,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAM5D,MAAM,OAAO,KAAK;;IAChB;;kBAEc;IAEd,UAAU;IACO,iBAAY,GAAG,iBAAiB,CAAC;IACjC,cAAS,GAAG,cAAc,CAAC;mBAcV,QAAQ,CAAC,CAAC,CAAC;;;2BAwCP,IAAI,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;;EAtC/D,eAAe,CAAC,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AC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;EACrD,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,YAAM,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE;MACtC,eAAa,CACR,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch, Element } from '@stencil/core';\nimport { TagVariantType, variants } from './mg-tag.conf';\nimport { ClassList } from '../../../utils/components.utils';\n@Component({\n tag: 'mg-tag',\n styleUrl: 'mg-tag.scss',\n shadow: true,\n})\nexport class MgTag {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classOutline = 'mg-tag--outline';\n private readonly classSoft = 'mg-tag--soft';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTagElement;\n\n /**\n * Define tag variant\n */\n @Prop() variant: TagVariantType = variants[0]; // primary\n @Watch('variant')\n validateVariant(newValue: MgTag['variant'], oldValue?: MgTag['variant']): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-tag> prop \"variant\" must be one of: ${variants.join(', ')}.`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-tag--${oldValue}`);\n }\n this.classCollection.add(`mg-tag--${newValue}`);\n }\n }\n\n /**\n * Define if tag is using outline style\n */\n @Prop() outline: boolean;\n @Watch('outline')\n validateOutline(newValue: MgTag['outline']): void {\n if (newValue) this.classCollection.add(this.classOutline);\n else this.classCollection.delete(this.classOutline);\n }\n\n /**\n * Define if tag is using soft style\n */\n @Prop() soft: boolean;\n @Watch('soft')\n validateSoft(newValue: MgTag['soft']): void {\n // usage validation\n if (newValue && this.outline) throw new Error('<mg-tag> prop \"soft\" can NOT be used with prop \"outline\".');\n\n // apply class\n if (newValue) this.classCollection.add(this.classSoft);\n else this.classCollection.delete(this.classSoft);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-tag']);\n\n /*************\n * Methods *\n *************/\n\n /**\n * Validate the given textContent\n * @param textContent - html element textContent property\n */\n private validateTextContent(textContent: string): void {\n if (typeof textContent !== 'string' || textContent.trim() === '') throw new Error('<mg-tag> slot must contain a text content.');\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateOutline(this.outline);\n this.validateSoft(this.soft);\n this.validateTextContent(this.element.textContent);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <span class={this.classCollection.join()}>\n <slot></slot>\n </span>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-tag.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-tag/mg-tag.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAkB,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAM3E,MAAM,OAAO,KAAK;;IAChB;;kBAEc;IAEd,UAAU;IACO,iBAAY,GAAG,mBAAmB,CAAC;IACnC,cAAS,GAAG,gBAAgB,CAAC;mBAcZ,QAAQ,CAAC,CAAC,CAAC;;;2BAwCP,IAAI,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;;EAtCjE,eAAe,CAAC,QAA0B,EAAE,QAA2B;IACrE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ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C7B,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;EACrD,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,YAAM,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE;MACtC,eAAa,CACR,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch, Element } from '@stencil/core';\nimport { TagVariantType, variants } from './mg-tag.conf';\nimport { ClassList, isValidString } from '../../../utils/components.utils';\n@Component({\n tag: 'mg-tag',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-tag.css',\n shadow: true,\n})\nexport class MgTag {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classOutline = 'mg-c-tag--outline';\n private readonly classSoft = 'mg-c-tag--soft';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTagElement;\n\n /**\n * Define tag variant\n */\n @Prop() variant: TagVariantType = variants[0]; // primary\n @Watch('variant')\n validateVariant(newValue: MgTag['variant'], oldValue?: MgTag['variant']): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-tag> prop \"variant\" must be one of: ${variants.join(', ')}.`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-tag--${oldValue}`);\n }\n this.classCollection.add(`mg-c-tag--${newValue}`);\n }\n }\n\n /**\n * Define if tag is using outline style\n */\n @Prop() outline: boolean;\n @Watch('outline')\n validateOutline(newValue: MgTag['outline']): void {\n if (newValue) this.classCollection.add(this.classOutline);\n else this.classCollection.delete(this.classOutline);\n }\n\n /**\n * Define if tag is using soft style\n */\n @Prop() soft: boolean;\n @Watch('soft')\n validateSoft(newValue: MgTag['soft']): void {\n // usage validation\n if (newValue && this.outline) throw new Error('<mg-tag> prop \"soft\" can NOT be used with prop \"outline\".');\n\n // apply class\n if (newValue) this.classCollection.add(this.classSoft);\n else this.classCollection.delete(this.classSoft);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-tag']);\n\n /*************\n * Methods *\n *************/\n\n /**\n * Validate the given textContent\n * @param textContent - html element textContent property\n */\n private validateTextContent(textContent: string): void {\n if (!isValidString(textContent)) throw new Error('<mg-tag> slot must contain a text content.');\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateOutline(this.outline);\n this.validateSoft(this.soft);\n this.validateTextContent(this.element.textContent);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <span class={this.classCollection.join()}>\n <slot></slot>\n </span>\n );\n }\n}\n"]}