@mgdis/mg-components 5.26.0 → 5.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/cjs/{index-c585c382.js → index-1d560837.js} +97 -81
  2. package/dist/cjs/index-1d560837.js.map +1 -0
  3. package/dist/cjs/{index-0a2783ee.js → index-7072369e.js} +17 -5
  4. package/dist/cjs/index-7072369e.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/{mg-action-more_34.cjs.entry.js → mg-action-more_35.cjs.entry.js} +613 -694
  7. package/dist/cjs/mg-action-more_35.cjs.entry.js.map +1 -0
  8. package/dist/cjs/mg-components.cjs.js +3 -3
  9. package/dist/cjs/mg-components.cjs.js.map +1 -1
  10. package/dist/cjs/mg-item-more.cjs.entry.js +7 -6
  11. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  12. package/dist/cjs/mg-loader.cjs.entry.js +3 -3
  13. package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
  14. package/dist/collection/assets/icons/index.js +1 -206
  15. package/dist/collection/assets/icons/index.js.map +1 -1
  16. package/dist/collection/collection-manifest.json +4 -3
  17. package/dist/collection/components/atoms/mg-badge/mg-badge.js +2 -2
  18. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  19. package/dist/collection/components/atoms/mg-button/mg-button.js +6 -6
  20. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  21. package/dist/collection/components/atoms/mg-card/mg-card.js +2 -2
  22. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  23. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +2 -2
  24. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
  25. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  26. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js.map +1 -1
  27. package/dist/collection/components/atoms/mg-icon/mg-icon.js +13 -8
  28. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  29. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +3 -3
  30. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  31. package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
  32. package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
  33. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +21 -0
  34. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -0
  35. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +509 -0
  36. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -0
  37. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -5
  38. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  39. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +7 -7
  40. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +67 -45
  43. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +31 -13
  45. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +48 -18
  47. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +54 -15
  49. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +40 -8
  51. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +44 -13
  53. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +63 -24
  55. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  56. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +47 -15
  57. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  58. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +30 -21
  59. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  60. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +3 -3
  61. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  62. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +4 -0
  63. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -1
  64. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +43 -7
  65. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  66. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  67. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +41 -41
  68. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  69. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  70. package/dist/collection/components/molecules/mg-form/mg-form.js +4 -4
  71. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  72. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +3 -3
  73. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js.map +1 -1
  74. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +12 -11
  75. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  76. package/dist/collection/components/molecules/mg-loader/mg-loader.js +3 -3
  77. package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
  78. package/dist/collection/components/molecules/mg-message/mg-message.js +3 -3
  79. package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
  80. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  81. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -4
  82. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  83. package/dist/collection/components/molecules/mg-panel/mg-panel.js +4 -4
  84. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  85. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  86. package/dist/collection/components/molecules/mg-popover/mg-popover.js +2 -2
  87. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  88. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  89. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
  90. package/dist/collection/locales/en/messages.json +10 -3
  91. package/dist/collection/locales/fr/messages.json +10 -3
  92. package/dist/collection/locales/index.conf.js +2 -0
  93. package/dist/collection/locales/index.conf.js.map +1 -0
  94. package/dist/collection/utils/playwright.fixture.js +1 -1
  95. package/dist/collection/utils/playwright.fixture.js.map +1 -1
  96. package/dist/components/index.es.js +12 -12
  97. package/dist/components/index.es.js.map +1 -1
  98. package/dist/components/index2.js +24 -8
  99. package/dist/components/index2.js.map +1 -1
  100. package/dist/components/mg-action-more.js +15 -15
  101. package/dist/components/mg-action-more.js.map +1 -1
  102. package/dist/components/mg-badge2.js +1 -1
  103. package/dist/components/mg-badge2.js.map +1 -1
  104. package/dist/components/mg-button2.js +1 -1
  105. package/dist/components/mg-button2.js.map +1 -1
  106. package/dist/components/mg-card2.js +2 -2
  107. package/dist/components/mg-card2.js.map +1 -1
  108. package/dist/components/mg-character-left2.js +1 -1
  109. package/dist/components/mg-character-left2.js.map +1 -1
  110. package/dist/components/mg-details.js +1 -1
  111. package/dist/components/mg-divider.js +1 -1
  112. package/dist/components/mg-form.js +1 -1
  113. package/dist/components/mg-form.js.map +1 -1
  114. package/dist/components/mg-icon2.js +4 -416
  115. package/dist/components/mg-icon2.js.map +1 -1
  116. package/dist/components/mg-illustrated-message.js +3 -3
  117. package/dist/components/mg-input-checkbox-paginated2.js +13 -11
  118. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  119. package/dist/components/mg-input-checkbox.js +71 -49
  120. package/dist/components/mg-input-checkbox.js.map +1 -1
  121. package/dist/components/mg-input-date.js +29 -11
  122. package/dist/components/mg-input-date.js.map +1 -1
  123. package/dist/components/mg-input-numeric.js +41 -12
  124. package/dist/components/mg-input-numeric.js.map +1 -1
  125. package/dist/components/mg-input-password.js +56 -12
  126. package/dist/components/mg-input-password.js.map +1 -1
  127. package/dist/components/mg-input-radio.js +41 -10
  128. package/dist/components/mg-input-radio.js.map +1 -1
  129. package/dist/components/mg-input-select2.js +42 -12
  130. package/dist/components/mg-input-select2.js.map +1 -1
  131. package/dist/components/mg-input-text2.js +50 -18
  132. package/dist/components/mg-input-text2.js.map +1 -1
  133. package/dist/components/mg-input-textarea.js +44 -13
  134. package/dist/components/mg-input-textarea.js.map +1 -1
  135. package/dist/components/mg-input-title2.js +1 -1
  136. package/dist/components/mg-input-title2.js.map +1 -1
  137. package/dist/components/mg-input-toggle.js +35 -22
  138. package/dist/components/mg-input-toggle.js.map +1 -1
  139. package/dist/components/mg-input.d.ts +11 -0
  140. package/dist/components/mg-input.js +8 -0
  141. package/dist/components/mg-input.js.map +1 -0
  142. package/dist/components/mg-input2.js +352 -0
  143. package/dist/components/mg-input2.js.map +1 -0
  144. package/dist/components/mg-item-more.js +7 -6
  145. package/dist/components/mg-item-more.js.map +1 -1
  146. package/dist/components/mg-loader.js +1 -1
  147. package/dist/components/mg-loader.js.map +1 -1
  148. package/dist/components/mg-menu-item2.js +21 -4
  149. package/dist/components/mg-menu-item2.js.map +1 -1
  150. package/dist/components/mg-menu2.js +1 -1
  151. package/dist/components/mg-menu2.js.map +1 -1
  152. package/dist/components/mg-message.js +1 -1
  153. package/dist/components/mg-message.js.map +1 -1
  154. package/dist/components/mg-modal.js +3 -3
  155. package/dist/components/mg-modal.js.map +1 -1
  156. package/dist/components/mg-pagination2.js +12 -6
  157. package/dist/components/mg-pagination2.js.map +1 -1
  158. package/dist/components/mg-panel.js +15 -9
  159. package/dist/components/mg-panel.js.map +1 -1
  160. package/dist/components/mg-popover-content2.js +1 -1
  161. package/dist/components/mg-popover2.js +2 -2
  162. package/dist/components/mg-popover2.js.map +1 -1
  163. package/dist/components/mg-skip-links.js +1 -1
  164. package/dist/components/mg-tabs.js +1 -1
  165. package/dist/components/mg-tag.js +1 -1
  166. package/dist/components/mg-tag.js.map +1 -1
  167. package/dist/esm/{index-bb17de92.js → index-445fc2a0.js} +97 -81
  168. package/dist/esm/index-445fc2a0.js.map +1 -0
  169. package/dist/esm/{index-ad78ece7.js → index-629a42c7.js} +17 -5
  170. package/dist/esm/index-629a42c7.js.map +1 -0
  171. package/dist/esm/loader.js +3 -3
  172. package/dist/esm/{mg-action-more_34.entry.js → mg-action-more_35.entry.js} +613 -695
  173. package/dist/esm/mg-action-more_35.entry.js.map +1 -0
  174. package/dist/esm/mg-components.js +4 -4
  175. package/dist/esm/mg-components.js.map +1 -1
  176. package/dist/esm/mg-item-more.entry.js +7 -6
  177. package/dist/esm/mg-item-more.entry.js.map +1 -1
  178. package/dist/esm/mg-loader.entry.js +3 -3
  179. package/dist/esm/mg-loader.entry.js.map +1 -1
  180. package/dist/mg-components/locales/en/messages.json +10 -3
  181. package/dist/mg-components/locales/fr/messages.json +10 -3
  182. package/dist/mg-components/mg-components.esm.js +1 -1
  183. package/dist/mg-components/mg-components.esm.js.map +1 -1
  184. package/dist/mg-components/p-3ebe6845.js +2 -0
  185. package/dist/mg-components/p-3ebe6845.js.map +1 -0
  186. package/dist/mg-components/{p-2db8355d.entry.js → p-6735e4b2.entry.js} +2 -2
  187. package/dist/mg-components/p-6735e4b2.entry.js.map +1 -0
  188. package/dist/mg-components/p-9dfaa41f.js +3 -0
  189. package/dist/mg-components/p-9dfaa41f.js.map +1 -0
  190. package/dist/mg-components/p-b3e0f7b3.entry.js +2 -0
  191. package/dist/mg-components/p-b3e0f7b3.entry.js.map +1 -0
  192. package/dist/mg-components/{p-d80b844d.entry.js → p-fe347f48.entry.js} +2 -2
  193. package/dist/mg-components/{p-d80b844d.entry.js.map → p-fe347f48.entry.js.map} +1 -1
  194. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -1
  195. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -5
  196. package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
  197. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -1
  198. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +5 -0
  199. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  200. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +2 -2
  201. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +2 -2
  202. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +35 -0
  203. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +139 -0
  204. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +5 -5
  205. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +3 -5
  206. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +13 -12
  207. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +8 -6
  208. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +12 -9
  209. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -5
  210. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +7 -3
  211. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -4
  212. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +18 -12
  213. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +12 -9
  214. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +12 -12
  215. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +1 -1
  216. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +8 -0
  217. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +10 -5
  218. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +7 -16
  219. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +9 -9
  220. package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -3
  221. package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +3 -12
  222. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +4 -3
  223. package/dist/types/components/molecules/mg-loader/mg-loader.d.ts +2 -2
  224. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -2
  225. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +2 -2
  226. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +3 -3
  227. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
  228. package/dist/types/components.d.ts +203 -92
  229. package/dist/types/locales/index.conf.d.ts +4 -0
  230. package/ide/intellij/web-types.json +243 -18
  231. package/ide/vscode/html-custom-data.json +2766 -1332
  232. package/package.json +23 -27
  233. package/dist/cjs/index-0a2783ee.js.map +0 -1
  234. package/dist/cjs/index-c585c382.js.map +0 -1
  235. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +0 -1
  236. package/dist/collection/components/molecules/inputs/MgInput.conf.js +0 -14
  237. package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +0 -1
  238. package/dist/collection/components/molecules/inputs/MgInput.js +0 -125
  239. package/dist/collection/components/molecules/inputs/MgInput.js.map +0 -1
  240. package/dist/collection/utils/playwright.e2e.test.utils.js +0 -100
  241. package/dist/collection/utils/playwright.e2e.test.utils.js.map +0 -1
  242. package/dist/components/MgInput.js +0 -155
  243. package/dist/components/MgInput.js.map +0 -1
  244. package/dist/esm/index-ad78ece7.js.map +0 -1
  245. package/dist/esm/index-bb17de92.js.map +0 -1
  246. package/dist/esm/mg-action-more_34.entry.js.map +0 -1
  247. package/dist/mg-components/p-2db8355d.entry.js.map +0 -1
  248. package/dist/mg-components/p-95653110.entry.js +0 -2
  249. package/dist/mg-components/p-95653110.entry.js.map +0 -1
  250. package/dist/mg-components/p-bc62d75e.js +0 -3
  251. package/dist/mg-components/p-bc62d75e.js.map +0 -1
  252. package/dist/mg-components/p-d41aa78b.js +0 -2
  253. package/dist/mg-components/p-d41aa78b.js.map +0 -1
  254. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -46
  255. package/dist/types/components/molecules/inputs/MgInput.d.ts +0 -13
@@ -7,13 +7,14 @@
7
7
  "components/molecules/mg-item-more/mg-item-more.js",
8
8
  "components/molecules/mg-popover/mg-popover.js",
9
9
  "components/molecules/menu/mg-menu-item/mg-menu-item.js",
10
- "components/atoms/mg-input-title/mg-input-title.js",
11
10
  "components/atoms/mg-card/mg-card.js",
12
11
  "components/atoms/mg-character-left/mg-character-left.js",
13
12
  "components/atoms/mg-divider/mg-divider.js",
13
+ "components/atoms/mg-input-title/mg-input-title.js",
14
14
  "components/atoms/mg-tag/mg-tag.js",
15
15
  "components/atoms/mg-tooltip/mg-tooltip.js",
16
16
  "components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js",
17
+ "components/molecules/inputs/mg-input/mg-input.js",
17
18
  "components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js",
18
19
  "components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js",
19
20
  "components/molecules/inputs/mg-input-date/mg-input-date.js",
@@ -39,8 +40,8 @@
39
40
  ],
40
41
  "compiler": {
41
42
  "name": "@stencil/core",
42
- "version": "4.12.6",
43
- "typescriptVersion": "5.3.3"
43
+ "version": "4.13.0",
44
+ "typescriptVersion": "5.4.2"
44
45
  },
45
46
  "collections": [],
46
47
  "bundles": []
@@ -55,7 +55,7 @@ export class MgBadge {
55
55
  * @returns HTML Element
56
56
  */
57
57
  render() {
58
- return (h("span", { key: 'f6f1baa91f4a9e55af711f0a84eaca74b97962b3', class: this.classCollection.join() }, h("span", { key: '9c61217b74129839f600617d5e6e6bc7a2863667', class: "mg-c-badge__value" }, this.value), h("span", { key: '2fd7529d5d9a9b32da2c4a80a70a09396ffb9100', class: "mg-u-visually-hidden" }, this.label)));
58
+ return (h("span", { key: '570b40e6abb6c0da8b9b2b8825f862612531fe51', class: this.classCollection.join() }, h("span", { key: 'b2c9bb13d21cf985a02a8cb35d76014e4631a5e4', class: "mg-c-badge__value" }, this.value), h("span", { key: 'e8180432ca14df201d5ab94b13341795191452ce', class: "mg-u-visually-hidden" }, this.label)));
59
59
  }
60
60
  static get is() { return "mg-badge"; }
61
61
  static get encapsulation() { return "shadow"; }
@@ -138,7 +138,7 @@ export class MgBadge {
138
138
  "references": {}
139
139
  },
140
140
  "required": false,
141
- "optional": false,
141
+ "optional": true,
142
142
  "docs": {
143
143
  "tags": [],
144
144
  "text": "Define if button is using outline style"
@@ -1 +1 @@
1
- {"version":3,"file":"mg-badge.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-badge/mg-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAoB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAA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AiB;QACf,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,CACL,6DAAM,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE;YACtC,6DAAM,KAAK,EAAC,mBAAmB,IAAE,IAAI,CAAC,KAAK,CAAQ;YACnD,6DAAM,KAAK,EAAC,sBAAsB,IAAE,IAAI,CAAC,KAAK,CAAQ,CACjD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\nimport { variants, BadgeVariantType } from './mg-badge.conf';\nimport { ClassList, isValidString } from '@mgdis/stencil-helpers';\n@Component({\n tag: 'mg-badge',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-badge.css',\n shadow: true,\n})\nexport class MgBadge {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classOutline = `mg-c-badge--outline`;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Badge value\n */\n @Prop() value!: string | number;\n @Watch('value')\n validateValue(newValue: MgBadge['value']): void {\n if (/^(\\d+\\+*|[?*!a-z])$/i.exec(`${newValue}`) === null) {\n throw new Error('<mg-badge> prop \"value\" must be integer or ponctuation character.');\n }\n }\n\n /**\n * Badge label. Include short description.\n * Required for accessibility\n */\n @Prop() label!: string;\n @Watch('label')\n validateLabel(newValue: MgBadge['label']): void {\n if (!isValidString(newValue)) {\n throw new Error('<mg-badge> prop \"label\" is required.');\n }\n }\n\n /**\n * Define badge variant\n */\n @Prop() variant?: BadgeVariantType = variants[0]; // info\n @Watch('variant')\n validateVariant(newValue: MgBadge['variant'], oldValue?: MgBadge['variant']): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-badge> prop \"variant\" must be one of: ${variants.join(', ')}.`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-badge--${oldValue}`);\n }\n this.classCollection.add(`mg-c-badge--${newValue}`);\n }\n }\n\n /**\n * Define if button is using outline style\n */\n @Prop() outline: boolean;\n @Watch('outline')\n validateOutline(newValue: MgBadge['outline']): void {\n if (newValue) this.classCollection.add(this.classOutline);\n else this.classCollection.delete(this.classOutline);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-badge']);\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateValue(this.value);\n this.validateLabel(this.label);\n this.validateVariant(this.variant);\n this.validateOutline(this.outline);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <span class={this.classCollection.join()}>\n <span class=\"mg-c-badge__value\">{this.value}</span>\n <span class=\"mg-u-visually-hidden\">{this.label}</span>\n </span>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-badge.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-badge/mg-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAoB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMlE,MAAM,OAAO,OAAO;;QAClB;;sBAEc;QAEd,UAAU;QACO,iBAAY,GAAG,qBAAqB,CAAC;;;uBAgCjB,QAAQ,CAAC,CAAC,CAAC;;+BA0BV,IAAI,SAAS,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,CAAC;QACnC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,CACL,6DAAM,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE;YACtC,6DAAM,KAAK,EAAC,mBAAmB,IAAE,IAAI,CAAC,KAAK,CAAQ;YACnD,6DAAM,KAAK,EAAC,sBAAsB,IAAE,IAAI,CAAC,KAAK,CAAQ,CACjD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\nimport { variants, BadgeVariantType } from './mg-badge.conf';\nimport { ClassList, isValidString } from '@mgdis/stencil-helpers';\n@Component({\n tag: 'mg-badge',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-badge.css',\n shadow: true,\n})\nexport class MgBadge {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classOutline = `mg-c-badge--outline`;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Badge value\n */\n @Prop() value!: string | number;\n @Watch('value')\n validateValue(newValue: MgBadge['value']): void {\n if (/^(\\d+\\+*|[?*!a-z])$/i.exec(`${newValue}`) === null) {\n throw new Error('<mg-badge> prop \"value\" must be integer or ponctuation character.');\n }\n }\n\n /**\n * Badge label. Include short description.\n * Required for accessibility\n */\n @Prop() label!: string;\n @Watch('label')\n validateLabel(newValue: MgBadge['label']): void {\n if (!isValidString(newValue)) {\n throw new Error('<mg-badge> prop \"label\" is required.');\n }\n }\n\n /**\n * Define badge variant\n */\n @Prop() variant?: BadgeVariantType = variants[0]; // info\n @Watch('variant')\n validateVariant(newValue: MgBadge['variant'], oldValue?: MgBadge['variant']): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-badge> prop \"variant\" must be one of: ${variants.join(', ')}.`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-badge--${oldValue}`);\n }\n this.classCollection.add(`mg-c-badge--${newValue}`);\n }\n }\n\n /**\n * Define if button is using outline style\n */\n @Prop() outline?: boolean;\n @Watch('outline')\n validateOutline(newValue: MgBadge['outline']): void {\n if (newValue) this.classCollection.add(this.classOutline);\n else this.classCollection.delete(this.classOutline);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-badge']);\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateValue(this.value);\n this.validateLabel(this.label);\n this.validateVariant(this.variant);\n this.validateOutline(this.outline);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <span class={this.classCollection.join()}>\n <span class=\"mg-c-badge__value\">{this.value}</span>\n <span class=\"mg-u-visually-hidden\">{this.label}</span>\n </span>\n );\n }\n}\n"]}
@@ -144,7 +144,7 @@ export class MgButton {
144
144
  */
145
145
  render() {
146
146
  var _a;
147
- return (h(Host, { key: '2a3bfeaf58c2519d31672c75361e6f981dcbe51c', role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { key: '3393c295dbee6c9655a163db475e18cd56e5b2ba', class: this.classCollection.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { key: '1974ebcd1f11bec41b83bea3eab516eee85c4f0d', class: "mg-c-button__content" }, h("slot", { key: '7a00d7b9ad83a0ca157d65874f9bfa1b554a0dc8' })))));
147
+ return (h(Host, { key: 'f00c1fada18aee3205f5747113e1e4004b1ecf75', role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { key: '4010a7cb779fb4a9154b8d83af7aec1b093af129', class: this.classCollection.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { key: '4571c578e953d983f925954d5d6a05dfa5097876', class: "mg-c-button__content" }, h("slot", { key: '6d08cc980db4375577569753562ec088378bfdfb' })))));
148
148
  }
149
149
  static get is() { return "mg-button"; }
150
150
  static get encapsulation() { return "shadow"; }
@@ -193,7 +193,7 @@ export class MgButton {
193
193
  "references": {}
194
194
  },
195
195
  "required": false,
196
- "optional": false,
196
+ "optional": true,
197
197
  "docs": {
198
198
  "tags": [],
199
199
  "text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)"
@@ -210,7 +210,7 @@ export class MgButton {
210
210
  "references": {}
211
211
  },
212
212
  "required": false,
213
- "optional": false,
213
+ "optional": true,
214
214
  "docs": {
215
215
  "tags": [],
216
216
  "text": "aria-label\nIn case button text is not explicit enough"
@@ -233,7 +233,7 @@ export class MgButton {
233
233
  }
234
234
  },
235
235
  "required": false,
236
- "optional": false,
236
+ "optional": true,
237
237
  "docs": {
238
238
  "tags": [],
239
239
  "text": "Define button type"
@@ -268,7 +268,7 @@ export class MgButton {
268
268
  "references": {}
269
269
  },
270
270
  "required": false,
271
- "optional": false,
271
+ "optional": true,
272
272
  "docs": {
273
273
  "tags": [],
274
274
  "text": "Define form id to attach button with.\nIf this attribute is not set, the <button> is associated with its ancestor <form> element."
@@ -285,7 +285,7 @@ export class MgButton {
285
285
  "references": {}
286
286
  },
287
287
  "required": false,
288
- "optional": false,
288
+ "optional": true,
289
289
  "docs": {
290
290
  "tags": [],
291
291
  "text": "Disable button"
@@ -1 +1 @@
1
- {"version":3,"file":"mg-button.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-button/mg-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,C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AAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa;YAE7B,4DAAK,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU;gBACzD,IAAI,CAAC,OAAO,IAAI,eAAS,IAAI,EAAC,QAAQ,EAAC,IAAI,SAAW;gBACvD,4DAAK,KAAK,EAAC,sBAAsB;oBAC/B,8DAAa,CACT,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, State, Watch, Host, EventEmitter, Event } from '@stencil/core';\nimport { variants, VariantType, ButtonType } from './mg-button.conf';\nimport { ClassList, isValidString, nextTick } from '@mgdis/stencil-helpers';\n\n@Component({\n tag: 'mg-button',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-button.css',\n shadow: true,\n})\nexport class MgButton {\n /************\n * Internal *\n ************/\n\n private onClickElementFn = null;\n private readonly classDisabled = 'mg-c-button--disabled';\n private readonly classLoading = 'mg-c-button--loading';\n private readonly classFullWidth = 'mg-c-button--full-width';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgButtonElement;\n\n /**\n * Define button variant\n */\n @Prop() variant: VariantType = variants[0]; // Primary\n @Watch('variant')\n validateVariant(newValue: VariantType, oldValue?: VariantType): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-button> prop \"variant\" must be one of: ${variants.join(', ')}`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-button--${oldValue}`);\n }\n this.classCollection.add(`mg-c-button--${newValue}`);\n }\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier: string;\n\n /**\n * aria-label\n * In case button text is not explicit enough\n */\n @Prop() label: string;\n\n /**\n * Define button type\n */\n @Prop() type: ButtonType;\n\n /**\n * Set button to full-width\n */\n @Prop() fullWidth = false;\n @Watch('fullWidth')\n validateFullWidth(newValue: MgButton['fullWidth']): void {\n if (newValue && this.isIcon) {\n throw new Error('<mg-button> prop \"fullWidth\" cannot be used with prop \"isIcon\".');\n } else if (newValue) {\n this.classCollection.add(this.classFullWidth);\n } else {\n this.classCollection.delete(this.classFullWidth);\n }\n }\n\n /**\n * Define form id to attach button with.\n * If this attribute is not set, the <button> is associated with its ancestor <form> element.\n */\n @Prop() form: string;\n\n /**\n * Disable button\n */\n @Prop({ mutable: true }) disabled: boolean;\n @Watch('disabled')\n disabledHandler(isDisabled: MgButton['disabled']): void {\n // Remove loading when enable\n // Will be set back onclick\n if (!isDisabled && this.disableOnClick) {\n this.loading = false;\n }\n // Manage if onclick\n this.element.onclick = isDisabled ? undefined : this.onClickElementFn;\n\n // apply style\n if (isDisabled) {\n this.classCollection.add(this.classDisabled);\n } else {\n this.classCollection.delete(this.classDisabled);\n }\n\n // emit value update\n this.disabledChange.emit(isDisabled);\n }\n /**\n * Define if button is round.\n * Used for icon button.\n */\n @Prop() isIcon = false;\n\n /**\n * Option to set input disable on click, in order to prevent multi-click.\n * Parent component have to remove the attribute 'disabled' when the process ends.\n */\n @Prop() disableOnClick = false;\n\n /**\n * Define if button is loading, default to false.\n * Trigger when button is clicked or key-up ['enter', 'space], then value change to true.\n * It's required to reset to false when action/promise in parent is done to stop the loading state\n */\n @State() loading = false;\n @Watch('loading')\n loadingHandler(newValue: MgButton['loading']): void {\n // we add loading style if it newvalue is true else we remove it\n if (newValue) {\n this.classCollection.add(this.classLoading);\n } else {\n this.classCollection.delete(this.classLoading);\n }\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-button']);\n\n /**\n * Emmited event when disabled change\n */\n @Event({ eventName: 'disabled-change' }) disabledChange: EventEmitter<HTMLMgButtonElement['disabled']>;\n\n /**\n * Trigger actions onClick event\n * @param event - click event\n */\n private handleClick = (event: MouseEvent): void => {\n if (this.disabled) event.stopPropagation();\n // Used to prevent multi-click.\n else if (this.disableOnClick) {\n this.loading = true;\n this.disabled = true;\n }\n };\n\n /**\n * Handle onKeydown event\n * @param event - keyboard event\n */\n private handleKeydown = (event: KeyboardEvent): void => {\n if (!this.disabled && event.key === ' ') {\n event.preventDefault();\n } else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {\n event.preventDefault();\n this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n }\n };\n\n /**\n * Handle onKeyup event\n * @param event - keyboard event\n */\n private handleKeyup = (event: KeyboardEvent): void => {\n if (!this.disabled && event.key === ' ') {\n event.preventDefault();\n this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n }\n };\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateFullWidth(this.fullWidth);\n if (this.isIcon) {\n this.classCollection.add(`mg-c-button--icon`);\n if (!isValidString(this.label)) {\n throw new Error(`<mg-button> prop \"label\" is mandatory when prop \"isIcon\" is set to true.`);\n }\n }\n // Store the onclick fn\n this.onClickElementFn = this.element.onclick;\n this.disabledHandler(this.disabled);\n }\n\n /**\n * Add listners\n */\n componentDidLoad(): void {\n nextTick(() => {\n const closestForm = this.element.closest('form') || this.element.closest('mg-form')?.shadowRoot.querySelector('form');\n // submit buttons should trigger form submition;\n if (!!closestForm && ['submit', undefined].includes(this.type)) {\n this.element.addEventListener('click', () => {\n closestForm.dispatchEvent(new SubmitEvent('submit', { bubbles: true, cancelable: true }));\n });\n }\n });\n }\n\n /**\n * Render component\n * @returns html element\n */\n render(): HTMLElement {\n return (\n <Host\n role=\"button\"\n tabIndex={0}\n type={this.type}\n form={this.form}\n full-width={this.fullWidth}\n aria-label={this.label}\n aria-disabled={this.disabled?.toString()}\n onClick={this.handleClick}\n onKeyup={this.handleKeyup}\n onKeydown={this.handleKeydown}\n >\n <div class={this.classCollection.join()} id={this.identifier}>\n {this.loading && <mg-icon icon=\"loader\" spin></mg-icon>}\n <div class=\"mg-c-button__content\">\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mg-button.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-button/mg-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,QAAQ,EAA2B,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAO5E,MAAM,OAAO,QAAQ;;QACnB;;sBAEc;QAEN,qBAAgB,GAAG,IAAI,CAAC;QACf,kBAAa,GAAG,uBAAuB,CAAC;QACxC,iBAAY,GAAG,sBAAsB,CAAC;QACtC,mBAAc,GAAG,yBAAyB,CAAC;QA8H5D;;;WAGG;QACK,gBAAW,GAAG,CAAC,KAAiB,EAAQ,EAAE;YAChD,IAAI,IAAI,CAAC,QAAQ;gBAAE,KAAK,CAAC,eAAe,EAAE,CAAC;YAC3C,+BAA+B;iBAC1B,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;gBAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;gBACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACvB,CAAC;QACH,CAAC,CAAC;QAEF;;;WAGG;QACK,kBAAa,GAAG,CAAC,KAAoB,EAAQ,EAAE;YACrD,IAAI,CAAC,IAAI,CAAC,Q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AAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC5F,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,MAAM;;QACJ,OAAO,CACL,EAAC,IAAI,qDACH,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,gBACH,IAAI,CAAC,SAAS,gBACd,IAAI,CAAC,KAAK,mBACP,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,EAAE,EACxC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa;YAE7B,4DAAK,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU;gBACzD,IAAI,CAAC,OAAO,IAAI,eAAS,IAAI,EAAC,QAAQ,EAAC,IAAI,SAAW;gBACvD,4DAAK,KAAK,EAAC,sBAAsB;oBAC/B,8DAAa,CACT,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, State, Watch, Host, EventEmitter, Event } from '@stencil/core';\nimport { variants, VariantType, ButtonType } from './mg-button.conf';\nimport { ClassList, isValidString, nextTick } from '@mgdis/stencil-helpers';\n\n@Component({\n tag: 'mg-button',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-button.css',\n shadow: true,\n})\nexport class MgButton {\n /************\n * Internal *\n ************/\n\n private onClickElementFn = null;\n private readonly classDisabled = 'mg-c-button--disabled';\n private readonly classLoading = 'mg-c-button--loading';\n private readonly classFullWidth = 'mg-c-button--full-width';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgButtonElement;\n\n /**\n * Define button variant\n */\n @Prop() variant: VariantType = variants[0]; // Primary\n @Watch('variant')\n validateVariant(newValue: VariantType, oldValue?: VariantType): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-button> prop \"variant\" must be one of: ${variants.join(', ')}`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-button--${oldValue}`);\n }\n this.classCollection.add(`mg-c-button--${newValue}`);\n }\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier?: string;\n\n /**\n * aria-label\n * In case button text is not explicit enough\n */\n @Prop() label?: string;\n\n /**\n * Define button type\n */\n @Prop() type?: ButtonType;\n\n /**\n * Set button to full-width\n */\n @Prop() fullWidth = false;\n @Watch('fullWidth')\n validateFullWidth(newValue: MgButton['fullWidth']): void {\n if (newValue && this.isIcon) {\n throw new Error('<mg-button> prop \"fullWidth\" cannot be used with prop \"isIcon\".');\n } else if (newValue) {\n this.classCollection.add(this.classFullWidth);\n } else {\n this.classCollection.delete(this.classFullWidth);\n }\n }\n\n /**\n * Define form id to attach button with.\n * If this attribute is not set, the <button> is associated with its ancestor <form> element.\n */\n @Prop() form?: string;\n\n /**\n * Disable button\n */\n @Prop({ mutable: true }) disabled?: boolean;\n @Watch('disabled')\n disabledHandler(isDisabled: MgButton['disabled']): void {\n // Remove loading when enable\n // Will be set back onclick\n if (!isDisabled && this.disableOnClick) {\n this.loading = false;\n }\n // Manage if onclick\n this.element.onclick = isDisabled ? undefined : this.onClickElementFn;\n\n // apply style\n if (isDisabled) {\n this.classCollection.add(this.classDisabled);\n } else {\n this.classCollection.delete(this.classDisabled);\n }\n\n // emit value update\n this.disabledChange.emit(isDisabled);\n }\n /**\n * Define if button is round.\n * Used for icon button.\n */\n @Prop() isIcon = false;\n\n /**\n * Option to set input disable on click, in order to prevent multi-click.\n * Parent component have to remove the attribute 'disabled' when the process ends.\n */\n @Prop() disableOnClick = false;\n\n /**\n * Define if button is loading, default to false.\n * Trigger when button is clicked or key-up ['enter', 'space], then value change to true.\n * It's required to reset to false when action/promise in parent is done to stop the loading state\n */\n @State() loading = false;\n @Watch('loading')\n loadingHandler(newValue: MgButton['loading']): void {\n // we add loading style if it newvalue is true else we remove it\n if (newValue) {\n this.classCollection.add(this.classLoading);\n } else {\n this.classCollection.delete(this.classLoading);\n }\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-button']);\n\n /**\n * Emmited event when disabled change\n */\n @Event({ eventName: 'disabled-change' }) disabledChange: EventEmitter<HTMLMgButtonElement['disabled']>;\n\n /**\n * Trigger actions onClick event\n * @param event - click event\n */\n private handleClick = (event: MouseEvent): void => {\n if (this.disabled) event.stopPropagation();\n // Used to prevent multi-click.\n else if (this.disableOnClick) {\n this.loading = true;\n this.disabled = true;\n }\n };\n\n /**\n * Handle onKeydown event\n * @param event - keyboard event\n */\n private handleKeydown = (event: KeyboardEvent): void => {\n if (!this.disabled && event.key === ' ') {\n event.preventDefault();\n } else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {\n event.preventDefault();\n this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n }\n };\n\n /**\n * Handle onKeyup event\n * @param event - keyboard event\n */\n private handleKeyup = (event: KeyboardEvent): void => {\n if (!this.disabled && event.key === ' ') {\n event.preventDefault();\n this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n }\n };\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateFullWidth(this.fullWidth);\n if (this.isIcon) {\n this.classCollection.add(`mg-c-button--icon`);\n if (!isValidString(this.label)) {\n throw new Error(`<mg-button> prop \"label\" is mandatory when prop \"isIcon\" is set to true.`);\n }\n }\n // Store the onclick fn\n this.onClickElementFn = this.element.onclick;\n this.disabledHandler(this.disabled);\n }\n\n /**\n * Add listners\n */\n componentDidLoad(): void {\n nextTick(() => {\n const closestForm = this.element.closest('form') || this.element.closest('mg-form')?.shadowRoot.querySelector('form');\n // submit buttons should trigger form submition;\n if (!!closestForm && ['submit', undefined].includes(this.type)) {\n this.element.addEventListener('click', () => {\n closestForm.dispatchEvent(new SubmitEvent('submit', { bubbles: true, cancelable: true }));\n });\n }\n });\n }\n\n /**\n * Render component\n * @returns html element\n */\n render(): HTMLElement {\n return (\n <Host\n role=\"button\"\n tabIndex={0}\n type={this.type}\n form={this.form}\n full-width={this.fullWidth}\n aria-label={this.label}\n aria-disabled={this.disabled?.toString()}\n onClick={this.handleClick}\n onKeyup={this.handleKeyup}\n onKeydown={this.handleKeydown}\n >\n <div class={this.classCollection.join()} id={this.identifier}>\n {this.loading && <mg-icon icon=\"loader\" spin></mg-icon>}\n <div class=\"mg-c-button__content\">\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -9,7 +9,7 @@ export class MgCard {
9
9
  this.name = 'mg-card';
10
10
  this.classBase = 'mg-c-card';
11
11
  /**
12
- * Methode to set default varianStyle props
12
+ * Method to set default varianStyle props
13
13
  * needeed has stencil doesn't know that props is mutated when updated in prop watcher
14
14
  */
15
15
  this.setDefaultVariantStyle = () => {
@@ -56,7 +56,7 @@ export class MgCard {
56
56
  */
57
57
  render() {
58
58
  var _a;
59
- return (h("div", { key: '8eb3843ddbe71df4ae6a6f56896c1c68b5d8c17f', 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", { key: '77d242d0d83844071e1ee8b62d1816cd732e13c1' })));
59
+ return (h("div", { key: 'fe38aa48dae7528a45e66c68fef10444f1cf8b54', 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", { key: 'ca9d1a1e15b851381f9f857eac392dea33c0bf89' })));
60
60
  }
61
61
  static get is() { return "mg-card"; }
62
62
  static get encapsulation() { return "shadow"; }
@@ -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,wBAAwB,CAAC;AACnD,OAAO,EAAyB,aAAa,EAAoB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAOlG,MAAM,OAAO,MAAM;;QACjB;;uBAEe;QAEE,SAAI,GAAG,SAAS,CAAC;QACjB,cAAS,GAAG,WAAW,CAAC;QAsCzC;;;WAGG;QACK,2BAAsB,GAAG,GAAS,EAAE;YAC1C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;gBAAE,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;QACtE,CAAC,CAAC;;;+BARoC,IAAI,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;;IAzBrE,eAAe,CAAC,QAA2B,EAAE,QAA4B;QACvE,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,+CAA+C,CAAC,CAAC;QAC5H,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC;QAC7D,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\nimport { ClassList } from '@mgdis/stencil-helpers';\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 (newValue) {\n this.setDefaultVariantStyle();\n this.classCollection.add(`${this.classBase}--${newValue}`);\n }\n if (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 (newValue) this.classCollection.add(`${this.classBase}--${newValue}`);\n if (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"]}
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,wBAAwB,CAAC;AACnD,OAAO,EAAyB,aAAa,EAAoB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAOlG,MAAM,OAAO,MAAM;;QACjB;;uBAEe;QAEE,SAAI,GAAG,SAAS,CAAC;QACjB,cAAS,GAAG,WAAW,CAAC;QAsCzC;;;WAGG;QACK,2BAAsB,GAAG,GAAS,EAAE;YAC1C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;gBAAE,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;QACtE,CAAC,CAAC;;;+BARoC,IAAI,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;;IAzBrE,eAAe,CAAC,QAA2B,EAAE,QAA4B;QACvE,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,+CAA+C,CAAC,CAAC;QAC5H,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC;Q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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\nimport { ClassList } from '@mgdis/stencil-helpers';\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 (newValue) {\n this.setDefaultVariantStyle();\n this.classCollection.add(`${this.classBase}--${newValue}`);\n }\n if (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 (newValue) this.classCollection.add(`${this.classBase}--${newValue}`);\n if (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 * 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 = '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,7 +26,7 @@ export class MgCharacterLeft {
26
26
  * @returns HTML Element
27
27
  */
28
28
  render() {
29
- return (h("span", { key: 'c18bde23c2d962cd943540eb182381de1c6dd791', id: this.identifier, "aria-live": "polite" }, h("span", { key: 'bf678c1d055607bbdc32a34fbf247fdd189f2d99', "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { key: 'd18fc90eae95b1c807f6024a9681269b6552a1cf', class: "mg-u-visually-hidden" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
29
+ return (h("span", { key: 'fafe1f542f085f5f910a7b43cf6fa7e9fe9fd302', id: this.identifier, "aria-live": "polite" }, h("span", { key: '54b74d3a1161c583e47b0ad96845664e3ad9623d', "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { key: '390ad6cd724c66230fb726a307391922ddfe7c2c', 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"; }
@@ -51,7 +51,7 @@ export class MgCharacterLeft {
51
51
  "references": {}
52
52
  },
53
53
  "required": false,
54
- "optional": false,
54
+ "optional": true,
55
55
  "docs": {
56
56
  "tags": [],
57
57
  "text": "Sets an `id` attribute.\nNeeded by the input for accessibility `aria-decribedby`."
@@ -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;;;0BAyBL,EAAE;;;IAOvB,iBAAiB,CAAC,QAAgB;QAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED;;mBAEe;IAEf;;OAEG;IACH,iBAAiB;QACf,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,CACL,6DAAM,EAAE,EAAE,IAAI,CAAC,UAAU,eAAY,QAAQ;YAC3C,4EAAkB,MAAM;gBACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM;;gBAAG,IAAI,CAAC,SAAS,CACpD;YACP,6DAAM,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;IACJ,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"]}
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;;;0BAyBL,EAAE;;;IAOvB,iBAAiB,CAAC,QAAgB;QAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED;;mBAEe;IAEf;;OAEG;IACH,iBAAiB;QACf,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,CACL,6DAAM,EAAE,EAAE,IAAI,CAAC,UAAU,eAAY,QAAQ;YAC3C,4EAAkB,MAAM;gBACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM;;gBAAG,IAAI,CAAC,SAAS,CACpD;YACP,6DAAM,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;IACJ,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"]}
@@ -8,7 +8,7 @@ export class MgDivider {
8
8
  * @returns HTML Element
9
9
  */
10
10
  render() {
11
- return (h("div", { key: 'fd34b566182d17e5cadbb19a923ce07b53cd749d', class: {
11
+ return (h("div", { key: '7250dfa7ca66ea0831292a25ea7e76c29ca36500', class: {
12
12
  'mg-c-divider': true,
13
13
  'mg-c-divider--full': this.size === 'full',
14
14
  } }));
@@ -1 +1 @@
1
- {"version":3,"file":"mg-icon.conf.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-icon/mg-icon.conf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAU,CAAC;AAOrF;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAOjF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAU,CAAC","sourcesContent":["/**\n * List of all possibles sizes\n */\nexport const sizes = ['small', 'regular', 'medium', 'large', 'extra-large'] as const;\n\n/**\n * Icon Size from sizes\n */\nexport type IconSizeType = (typeof sizes)[number];\n\n/**\n * List of all possibles variants\n */\nexport const variants = ['success', 'warning', 'danger', 'info', 'app'] as const;\n\n/**\n * Variant type from variants\n */\nexport type IconVariantType = (typeof variants)[number];\n\n/**\n * List of all possibles variants styles\n */\nexport const variantStyles = ['icon', 'background', 'full'] as const;\n\n/**\n * Variant style type from variant style\n */\nexport type IconVariantStyleType = (typeof variantStyles)[number];\n"]}
1
+ {"version":3,"file":"mg-icon.conf.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-icon/mg-icon.conf.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAU,CAAC;AAOrF;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAOjF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAU,CAAC","sourcesContent":["import { icons } from '../../../assets/icons';\n/**\n * List of all possibles icons\n */\nexport type IconType = keyof typeof icons;\n\n/**\n * List of all possibles sizes\n */\nexport const sizes = ['small', 'regular', 'medium', 'large', 'extra-large'] as const;\n\n/**\n * Icon Size from sizes\n */\nexport type IconSizeType = (typeof sizes)[number];\n\n/**\n * List of all possibles variants\n */\nexport const variants = ['success', 'warning', 'danger', 'info', 'app'] as const;\n\n/**\n * Variant type from variants\n */\nexport type IconVariantType = (typeof variants)[number];\n\n/**\n * List of all possibles variants styles\n */\nexport const variantStyles = ['icon', 'background', 'full'] as const;\n\n/**\n * Variant style type from variant style\n */\nexport type IconVariantStyleType = (typeof variantStyles)[number];\n"]}
@@ -1,6 +1,5 @@
1
1
  import { sizes, variants, variantStyles } from "./mg-icon.conf";
2
2
  import { ClassList } from "@mgdis/stencil-helpers";
3
- import iconList from "@mgdis/img/dist/icons/index.json";
4
3
  import { icons } from "../../../assets/icons";
5
4
  export class MgIcon {
6
5
  constructor() {
@@ -16,7 +15,7 @@ export class MgIcon {
16
15
  * Render icon in shadowroot
17
16
  * @param icon - icon to render
18
17
  */
19
- this.renderIcon = icon => {
18
+ this.renderIcon = (icon) => {
20
19
  this.element.shadowRoot.innerHTML = icons[icon];
21
20
  this.svg = this.element.shadowRoot.querySelector('svg');
22
21
  // update svg attributes
@@ -32,8 +31,8 @@ export class MgIcon {
32
31
  this.classCollection = new ClassList(['mg-c-icon']);
33
32
  }
34
33
  validateIcon(newValue, oldValue) {
35
- if (!iconList.includes(newValue))
36
- throw new Error(`<mg-icon> prop "icon" must be one of: ${iconList.join(', ')}`);
34
+ if (!Object.keys(icons).includes(newValue))
35
+ throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}`);
37
36
  else {
38
37
  if (oldValue !== undefined)
39
38
  this.classCollection.delete(`mg-c-icon--${oldValue}`);
@@ -117,9 +116,15 @@ export class MgIcon {
117
116
  "type": "string",
118
117
  "mutable": false,
119
118
  "complexType": {
120
- "original": "string",
121
- "resolved": "string",
122
- "references": {}
119
+ "original": "IconType",
120
+ "resolved": "\"filter\" | \"copy\" | \"link\" | \"picture\" | \"table\" | \"circle\" | \"download\" | \"history\" | \"location\" | \"key\" | \"loader\" | \"address-card\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building-outline\" | \"calculator\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-outline\" | \"comment-sms\" | \"conversation\" | \"conversation-outline\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-slash\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-download\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-up\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"laptop\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"list\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-slash\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"question-circle\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"tag\" | \"tags\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"",
121
+ "references": {
122
+ "IconType": {
123
+ "location": "import",
124
+ "path": "./mg-icon.conf",
125
+ "id": "src/components/atoms/mg-icon/mg-icon.conf.ts::IconType"
126
+ }
127
+ }
123
128
  },
124
129
  "required": true,
125
130
  "optional": false,
@@ -169,7 +174,7 @@ export class MgIcon {
169
174
  }
170
175
  },
171
176
  "required": false,
172
- "optional": false,
177
+ "optional": true,
173
178
  "docs": {
174
179
  "tags": [],
175
180
  "text": "Define icon variant color"
@@ -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,wBAAwB,CAAC;AACnD,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAO9C,MAAM,OAAO,MAAM;;QAwFjB;;;WAGG;QACK,2B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CAAC,GAAG,CAAC,4BAA4B,QAAQ,EAAE,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;IACH,CAAC;IAOD,UAAU,CAAC,QAAwB;QACjC,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IA4BD;;OAEG;IACH,iBAAiB;QACf,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,cAAc;QACd,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9D,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 '@mgdis/stencil-helpers';\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 (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 (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"]}
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,EAAiB,K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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Watch, State, Element } from '@stencil/core';\nimport { type IconType, sizes, type IconSizeType, variants, type IconVariantType, variantStyles, type IconVariantStyleType } from './mg-icon.conf';\nimport { ClassList } from '@mgdis/stencil-helpers';\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!: IconType;\n @Watch('icon')\n validateIcon(newValue: MgIcon['icon'], oldValue?: MgIcon['icon']): void {\n if (!Object.keys(icons).includes(newValue)) throw new Error(`<mg-icon> prop \"icon\" must be one of: ${Object.keys(icons).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 (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 (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: IconType): void => {\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"]}
@@ -33,7 +33,7 @@ export class MgInputTitle {
33
33
  render() {
34
34
  const TagName = this.readonly ? 'span' : this.tagName;
35
35
  // \u00A0 represent a &nbsp;
36
- return (h(TagName, { key: '0fbbce483f0d178036c4bf8ada139ddba9c16694', class: "mg-c-input-title", htmlFor: this.isLegend ? undefined : this.identifier }, h("slot", { key: '1db71caf002de0874f566d55b4bd0031ddf10650' }), this.required && (h("span", { class: "mg-c-input-title__required" }, "\u00A0", h("span", { class: "mg-u-is-asterisk" }, "*")))));
36
+ return (h(TagName, { key: '2dda0af49de9de4324834cb429ad1798f1ff6f97', class: "mg-c-input-title", htmlFor: !this.isLegend && this.identifier, id: this.isLegend ? `${this.identifier}-title` : undefined }, h("slot", { key: '2a6ebb613b43b7baddc0f2499d10f0d0e7b42ab3' }), this.required && !this.readonly && (h("span", { class: "mg-c-input-title__required" }, "\u00A0", h("span", { class: "mg-u-is-asterisk" }, "*")))));
37
37
  }
38
38
  static get is() { return "mg-input-title"; }
39
39
  static get encapsulation() { return "scoped"; }
@@ -75,7 +75,7 @@ export class MgInputTitle {
75
75
  "references": {}
76
76
  },
77
77
  "required": false,
78
- "optional": false,
78
+ "optional": true,
79
79
  "docs": {
80
80
  "tags": [],
81
81
  "text": "If input is required an asterisk is added at the end of the label"
@@ -92,7 +92,7 @@ export class MgInputTitle {
92
92
  "references": {}
93
93
  },
94
94
  "required": false,
95
- "optional": false,
95
+ "optional": true,
96
96
  "docs": {
97
97
  "tags": [],
98
98
  "text": "If input is required an asterisk is added at the end of the label"
@@ -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;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAOvD,MAAM,OAAO,YAAY;;;;;wBAyBJ,KAAK;uBASL,OAAO;;IA5B1B,kBAAkB,CAAC,QAAoC;QACrD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAiBD,gBAAgB,CAAC,QAAkC;QACjD,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/C,CAAC;IAOD;;mBAEe;IAEf;;OAEG;IACH,iBAAiB;QACf,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACtD,4BAA4B;QAC5B,OAAO,CACL,EAAC,OAAO,qDAAC,KAAK,EAAC,kBAAkB,EAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU;YACpF,8DAAa;YACZ,IAAI,CAAC,QAAQ,IAAI,CAChB,YAAM,KAAK,EAAC,4BAA4B;;gBAChC,YAAM,KAAK,EAAC,kBAAkB,QAAS,CACxC,CACR,CACO,CACX,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\nimport { isValidString } from '@mgdis/stencil-helpers';\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 * If input is required an asterisk is added at the end of the label\n */\n @Prop() readonly: 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.readonly ? 'span' : 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
+ {"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,wBAAwB,CAAC;AAOvD,MAAM,OAAO,YAAY;;;;;wBAyBJ,KAAK;uBASL,OAAO;;IA5B1B,kBAAkB,CAAC,QAAoC;QACrD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAiBD,gBAAgB,CAAC,QAAkC;QACjD,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/C,CAAC;IAOD;;mBAEe;IAEf;;OAEG;IACH,iBAAiB;QACf,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACtD,4BAA4B;QAC5B,OAAO,CACL,EAAC,OAAO,qDAAC,KAAK,EAAC,kBAAkB,EAAC,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,QAAQ,CAAC,CAAC,CAAC,SAAS;YACtI,8DAAa;YACZ,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAClC,YAAM,KAAK,EAAC,4BAA4B;;gBAChC,YAAM,KAAK,EAAC,kBAAkB,QAAS,CACxC,CACR,CACO,CACX,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch } from '@stencil/core';\nimport { isValidString } from '@mgdis/stencil-helpers';\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 * If input is required an asterisk is added at the end of the label\n */\n @Prop() readonly?: 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.readonly ? 'span' : this.tagName;\n // \\u00A0 represent a &nbsp;\n return (\n <TagName class=\"mg-c-input-title\" htmlFor={!this.isLegend && this.identifier} id={this.isLegend ? `${this.identifier}-title` : undefined}>\n <slot></slot>\n {this.required && !this.readonly && (\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"]}
@@ -69,7 +69,7 @@ export class MgTag {
69
69
  * @returns HTML Element
70
70
  */
71
71
  render() {
72
- return (h("span", { key: '15dd499acdc87ca43c277bb7561646fa9c44f4c0', class: this.classCollection.join() }, h("slot", { key: '3237e437f07cede09a85997be8a73e98f26d78b2' })));
72
+ return (h("span", { key: 'c528cdd483287d210928ed3a993b491cdedd5b42', class: this.classCollection.join() }, h("slot", { key: '36403304976bb40067529c5cd0a810dca41055b1' })));
73
73
  }
74
74
  static get is() { return "mg-tag"; }
75
75
  static get encapsulation() { return "shadow"; }
@@ -118,7 +118,7 @@ export class MgTag {
118
118
  "references": {}
119
119
  },
120
120
  "required": false,
121
- "optional": false,
121
+ "optional": true,
122
122
  "docs": {
123
123
  "tags": [],
124
124
  "text": "Define if tag is using outline style"
@@ -135,7 +135,7 @@ export class MgTag {
135
135
  "references": {}
136
136
  },
137
137
  "required": false,
138
- "optional": false,
138
+ "optional": true,
139
139
  "docs": {
140
140
  "tags": [],
141
141
  "text": "Define if tag is using soft style"
@@ -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,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMlE,MAAM,OAAO,KAAK;;QAChB;;sBAEc;QAEd,UAAU;QACO,iBAAY,GAAG,mBAAmB,CAAC;QACnC,cAAS,GAAG,gBAAgB,CAAC;uBAcZ,QAAQ,CAAC,CAAC,CAAC;;;+BAwCP,IAAI,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;;IAtCjE,eAAe,CAAC,QAA0B,EAAE,QAA2B;QACrE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,2CAA2C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrF,CAAC;aAAM,CAAC;YACN,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;YACvD,CAAC;YACD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,QAAQ,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Watch, Element } from '@stencil/core';\nimport { TagVariantType, variants } from './mg-tag.conf';\nimport { ClassList, isValidString } from '@mgdis/stencil-helpers';\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"]}
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,wBAAwB,CAAC;AAMlE,MAAM,OAAO,KAAK;;QAChB;;sBAEc;QAEd,UAAU;QACO,iBAAY,GAAG,mBAAmB,CAAC;QACnC,cAAS,GAAG,gBAAgB,CAAC;uBAcZ,QAAQ,CAAC,CAAC,CAAC;;;+BAwCP,IAAI,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;;IAtCjE,eAAe,CAAC,QAA0B,EAAE,QAA2B;QACrE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,2CAA2C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrF,CAAC;aAAM,CAAC;YACN,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;YACvD,CAAC;YACD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,C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;CACF","sourcesContent":["import { Component, h, Prop, State, Watch, Element } from '@stencil/core';\nimport { TagVariantType, variants } from './mg-tag.conf';\nimport { ClassList, isValidString } from '@mgdis/stencil-helpers';\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"]}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Possible input width
3
+ */
4
+ export const widths = [2, 4, 16, 'full'];
5
+ /**
6
+ * Possible tootltip postions
7
+ */
8
+ export const tooltipPositions = ['input', 'label'];
9
+ /**
10
+ * Available handlers
11
+ */
12
+ export var Handler;
13
+ (function (Handler) {
14
+ Handler["BLUR"] = "blur";
15
+ Handler["FOCUS"] = "focus";
16
+ })(Handler || (Handler = {}));
17
+ export const classFieldset = 'mg-c-input--fieldset';
18
+ export const classDisabled = 'mg-c-input--disabled';
19
+ export const classReadonly = 'mg-c-input--readonly';
20
+ export const classVerticalList = 'mg-c-input--vertical-list';
21
+ //# sourceMappingURL=mg-input.conf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mg-input.conf.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input/mg-input.conf.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,CAAU,CAAC;AAIlD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAmB5D;;GAEG;AACH,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,wBAAa,CAAA;IACb,0BAAe,CAAA;AACjB,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,2BAA2B,CAAC","sourcesContent":["/**\n * Possible input width\n */\nexport const widths = [2, 4, 16, 'full'] as const;\n\nexport type Width = (typeof widths)[number];\n\n/**\n * Possible tootltip postions\n */\nexport const tooltipPositions = ['input', 'label'] as const;\n\nexport type TooltipPosition = (typeof tooltipPositions)[number];\n\n/**\n * Possible Input types\n */\nexport type HTMLMgInputsElement =\n | (HTMLMgInputElement & { required: true; invalid: false; displayError: () => void; labelOnTop: boolean; readonly: boolean })\n | HTMLMgInputCheckboxElement\n | HTMLMgInputDateElement\n | HTMLMgInputNumericElement\n | HTMLMgInputPasswordElement\n | HTMLMgInputRadioElement\n | HTMLMgInputSelectElement\n | HTMLMgInputTextElement\n | HTMLMgInputTextareaElement\n | (HTMLMgInputToggleElement & { required: true; invalid: false; displayError: () => void });\n\n/**\n * Available handlers\n */\nexport enum Handler {\n BLUR = 'blur',\n FOCUS = 'focus',\n}\n\nexport const classFieldset = 'mg-c-input--fieldset';\nexport const classDisabled = 'mg-c-input--disabled';\nexport const classReadonly = 'mg-c-input--readonly';\nexport const classVerticalList = 'mg-c-input--vertical-list';\n"]}