@haiilo/catalyst 8.1.0 → 8.2.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 (374) hide show
  1. package/dist/catalyst/catalyst.css +4 -9
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.esm.js +2 -2
  5. package/dist/catalyst/{p-85d057f0.js → p-6ae13953.js} +1 -1
  6. package/dist/catalyst/p-6cd4fa1e.js +3 -0
  7. package/dist/catalyst/p-6cd4fa1e.js.map +1 -0
  8. package/dist/catalyst/p-a05fbea3.entry.js +10 -0
  9. package/dist/catalyst/p-a05fbea3.entry.js.map +1 -0
  10. package/dist/catalyst/scss/core/_dialog.scss +1 -1
  11. package/dist/catalyst/scss/core/_form.scss +2 -1
  12. package/dist/catalyst/scss/core/_typography.scss +1 -7
  13. package/dist/cjs/cat-alert_26.cjs.entry.js +3899 -3883
  14. package/dist/cjs/cat-alert_26.cjs.entry.js.map +1 -1
  15. package/dist/cjs/catalyst.cjs.js +3 -3
  16. package/dist/cjs/catalyst.cjs.js.map +1 -1
  17. package/dist/cjs/{index-1e7eef7e.js → index-eb056d5e.js} +51 -13
  18. package/dist/cjs/index-eb056d5e.js.map +1 -0
  19. package/dist/cjs/index.cjs.js +73 -73
  20. package/dist/cjs/index.cjs.js.map +1 -1
  21. package/dist/cjs/loader.cjs.js +2 -2
  22. package/dist/cjs/{of-395b2f57.js → of-2b7161d2.js} +155 -155
  23. package/dist/cjs/of-2b7161d2.js.map +1 -0
  24. package/dist/collection/collection-manifest.json +1 -1
  25. package/dist/collection/components/cat-alert/cat-alert.e2e.js +7 -7
  26. package/dist/collection/components/cat-alert/cat-alert.e2e.js.map +1 -1
  27. package/dist/collection/components/cat-alert/cat-alert.js +98 -98
  28. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  29. package/dist/collection/components/cat-alert/cat-alert.spec.js +7 -7
  30. package/dist/collection/components/cat-alert/cat-alert.spec.js.map +1 -1
  31. package/dist/collection/components/cat-avatar/cat-avatar.e2e.js +6 -6
  32. package/dist/collection/components/cat-avatar/cat-avatar.e2e.js.map +1 -1
  33. package/dist/collection/components/cat-avatar/cat-avatar.js +218 -218
  34. package/dist/collection/components/cat-avatar/cat-avatar.js.map +1 -1
  35. package/dist/collection/components/cat-avatar/cat-avatar.spec.js +7 -7
  36. package/dist/collection/components/cat-avatar/cat-avatar.spec.js.map +1 -1
  37. package/dist/collection/components/cat-badge/cat-badge.e2e.js +6 -6
  38. package/dist/collection/components/cat-badge/cat-badge.e2e.js.map +1 -1
  39. package/dist/collection/components/cat-badge/cat-badge.js +117 -117
  40. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
  41. package/dist/collection/components/cat-badge/cat-badge.spec.js +7 -7
  42. package/dist/collection/components/cat-badge/cat-badge.spec.js.map +1 -1
  43. package/dist/collection/components/cat-button/cat-button.css +2 -1
  44. package/dist/collection/components/cat-button/cat-button.e2e.js +6 -6
  45. package/dist/collection/components/cat-button/cat-button.e2e.js.map +1 -1
  46. package/dist/collection/components/cat-button/cat-button.js +693 -693
  47. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  48. package/dist/collection/components/cat-button/cat-button.spec.js +7 -7
  49. package/dist/collection/components/cat-button/cat-button.spec.js.map +1 -1
  50. package/dist/collection/components/cat-button-group/cat-button-group.e2e.js +6 -6
  51. package/dist/collection/components/cat-button-group/cat-button-group.e2e.js.map +1 -1
  52. package/dist/collection/components/cat-button-group/cat-button-group.js +47 -47
  53. package/dist/collection/components/cat-button-group/cat-button-group.js.map +1 -1
  54. package/dist/collection/components/cat-button-group/cat-button-group.spec.js +7 -7
  55. package/dist/collection/components/cat-button-group/cat-button-group.spec.js.map +1 -1
  56. package/dist/collection/components/cat-card/cat-card.e2e.js +6 -6
  57. package/dist/collection/components/cat-card/cat-card.e2e.js.map +1 -1
  58. package/dist/collection/components/cat-card/cat-card.js +15 -15
  59. package/dist/collection/components/cat-card/cat-card.js.map +1 -1
  60. package/dist/collection/components/cat-card/cat-card.spec.js +7 -7
  61. package/dist/collection/components/cat-card/cat-card.spec.js.map +1 -1
  62. package/dist/collection/components/cat-checkbox/cat-checkbox.css +2 -1
  63. package/dist/collection/components/cat-checkbox/cat-checkbox.e2e.js +6 -6
  64. package/dist/collection/components/cat-checkbox/cat-checkbox.e2e.js.map +1 -1
  65. package/dist/collection/components/cat-checkbox/cat-checkbox.js +441 -441
  66. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  67. package/dist/collection/components/cat-checkbox/cat-checkbox.spec.js +7 -7
  68. package/dist/collection/components/cat-checkbox/cat-checkbox.spec.js.map +1 -1
  69. package/dist/collection/components/cat-datepicker/cat-datepicker.config.js +62 -62
  70. package/dist/collection/components/cat-datepicker/cat-datepicker.config.js.map +1 -1
  71. package/dist/collection/components/cat-datepicker/cat-datepicker.e2e.js +7 -7
  72. package/dist/collection/components/cat-datepicker/cat-datepicker.e2e.js.map +1 -1
  73. package/dist/collection/components/cat-datepicker/cat-datepicker.format.js +20 -20
  74. package/dist/collection/components/cat-datepicker/cat-datepicker.format.js.map +1 -1
  75. package/dist/collection/components/cat-datepicker/cat-datepicker.js +720 -707
  76. package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -1
  77. package/dist/collection/components/cat-datepicker/cat-datepicker.locale.js +39 -39
  78. package/dist/collection/components/cat-datepicker/cat-datepicker.locale.js.map +1 -1
  79. package/dist/collection/components/cat-datepicker/cat-datepicker.spec.js +7 -7
  80. package/dist/collection/components/cat-datepicker/cat-datepicker.spec.js.map +1 -1
  81. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.e2e.js +7 -7
  82. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.e2e.js.map +1 -1
  83. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js +244 -244
  84. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js.map +1 -1
  85. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.spec.js +7 -7
  86. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.spec.js.map +1 -1
  87. package/dist/collection/components/cat-dropdown/cat-dropdown.e2e.js +6 -6
  88. package/dist/collection/components/cat-dropdown/cat-dropdown.e2e.js.map +1 -1
  89. package/dist/collection/components/cat-dropdown/cat-dropdown.js +300 -300
  90. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  91. package/dist/collection/components/cat-dropdown/cat-dropdown.spec.js +7 -7
  92. package/dist/collection/components/cat-dropdown/cat-dropdown.spec.js.map +1 -1
  93. package/dist/collection/components/cat-form-group/cat-form-group.e2e.js +6 -6
  94. package/dist/collection/components/cat-form-group/cat-form-group.e2e.js.map +1 -1
  95. package/dist/collection/components/cat-form-group/cat-form-group.js +107 -107
  96. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
  97. package/dist/collection/components/cat-form-group/cat-form-group.spec.js +7 -7
  98. package/dist/collection/components/cat-form-group/cat-form-group.spec.js.map +1 -1
  99. package/dist/collection/components/cat-form-hint/cat-form-hint.js +9 -9
  100. package/dist/collection/components/cat-form-hint/cat-form-hint.js.map +1 -1
  101. package/dist/collection/components/cat-form-hint/cat-form-hint.spec.js +7 -7
  102. package/dist/collection/components/cat-form-hint/cat-form-hint.spec.js.map +1 -1
  103. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +71 -71
  104. package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -1
  105. package/dist/collection/components/cat-i18n/cat-i18n-registry.spec.js +3 -3
  106. package/dist/collection/components/cat-i18n/cat-i18n-registry.spec.js.map +1 -1
  107. package/dist/collection/components/cat-icon/cat-icon-registry.js +77 -77
  108. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
  109. package/dist/collection/components/cat-icon/cat-icon-registry.spec.js +3 -3
  110. package/dist/collection/components/cat-icon/cat-icon-registry.spec.js.map +1 -1
  111. package/dist/collection/components/cat-icon/cat-icon.e2e.js +7 -7
  112. package/dist/collection/components/cat-icon/cat-icon.e2e.js.map +1 -1
  113. package/dist/collection/components/cat-icon/cat-icon.js +97 -97
  114. package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
  115. package/dist/collection/components/cat-icon/cat-icon.spec.js +7 -7
  116. package/dist/collection/components/cat-icon/cat-icon.spec.js.map +1 -1
  117. package/dist/collection/components/cat-input/cat-input.e2e.js +7 -7
  118. package/dist/collection/components/cat-input/cat-input.e2e.js.map +1 -1
  119. package/dist/collection/components/cat-input/cat-input.js +768 -768
  120. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  121. package/dist/collection/components/cat-input/cat-input.spec.js +7 -7
  122. package/dist/collection/components/cat-input/cat-input.spec.js.map +1 -1
  123. package/dist/collection/components/cat-notification/cat-notification.js +59 -59
  124. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  125. package/dist/collection/components/cat-notification/cat-notification.spec.js +3 -3
  126. package/dist/collection/components/cat-notification/cat-notification.spec.js.map +1 -1
  127. package/dist/collection/components/cat-pagination/cat-pagination.e2e.js +10 -10
  128. package/dist/collection/components/cat-pagination/cat-pagination.e2e.js.map +1 -1
  129. package/dist/collection/components/cat-pagination/cat-pagination.js +274 -274
  130. package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
  131. package/dist/collection/components/cat-pagination/cat-pagination.spec.js +7 -7
  132. package/dist/collection/components/cat-pagination/cat-pagination.spec.js.map +1 -1
  133. package/dist/collection/components/cat-radio/cat-radio.e2e.js +6 -6
  134. package/dist/collection/components/cat-radio/cat-radio.e2e.js.map +1 -1
  135. package/dist/collection/components/cat-radio/cat-radio.js +378 -378
  136. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  137. package/dist/collection/components/cat-radio/cat-radio.spec.js +7 -7
  138. package/dist/collection/components/cat-radio/cat-radio.spec.js.map +1 -1
  139. package/dist/collection/components/cat-radio-group/cat-radio-group.e2e.js +6 -6
  140. package/dist/collection/components/cat-radio-group/cat-radio-group.e2e.js.map +1 -1
  141. package/dist/collection/components/cat-radio-group/cat-radio-group.js +278 -278
  142. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  143. package/dist/collection/components/cat-radio-group/cat-radio-group.spec.js +7 -7
  144. package/dist/collection/components/cat-radio-group/cat-radio-group.spec.js.map +1 -1
  145. package/dist/collection/components/cat-scrollable/cat-scrollable.e2e.js +6 -6
  146. package/dist/collection/components/cat-scrollable/cat-scrollable.e2e.js.map +1 -1
  147. package/dist/collection/components/cat-scrollable/cat-scrollable.js +287 -287
  148. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
  149. package/dist/collection/components/cat-scrollable/cat-scrollable.spec.js +7 -7
  150. package/dist/collection/components/cat-scrollable/cat-scrollable.spec.js.map +1 -1
  151. package/dist/collection/components/cat-select/cat-select.e2e.js +10 -10
  152. package/dist/collection/components/cat-select/cat-select.e2e.js.map +1 -1
  153. package/dist/collection/components/cat-select/cat-select.js +1143 -1143
  154. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  155. package/dist/collection/components/cat-select/cat-select.spec.js +7 -7
  156. package/dist/collection/components/cat-select/cat-select.spec.js.map +1 -1
  157. package/dist/collection/components/cat-select/connectors.js +13 -13
  158. package/dist/collection/components/cat-select/connectors.js.map +1 -1
  159. package/dist/collection/components/cat-select-demo/cat-select-demo.js +1379 -1379
  160. package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
  161. package/dist/collection/components/cat-skeleton/cat-skeleton.e2e.js +6 -6
  162. package/dist/collection/components/cat-skeleton/cat-skeleton.e2e.js.map +1 -1
  163. package/dist/collection/components/cat-skeleton/cat-skeleton.js +120 -120
  164. package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -1
  165. package/dist/collection/components/cat-skeleton/cat-skeleton.spec.js +7 -7
  166. package/dist/collection/components/cat-skeleton/cat-skeleton.spec.js.map +1 -1
  167. package/dist/collection/components/cat-spinner/cat-spinner.e2e.js +6 -6
  168. package/dist/collection/components/cat-spinner/cat-spinner.e2e.js.map +1 -1
  169. package/dist/collection/components/cat-spinner/cat-spinner.js +60 -60
  170. package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -1
  171. package/dist/collection/components/cat-spinner/cat-spinner.spec.js +7 -7
  172. package/dist/collection/components/cat-spinner/cat-spinner.spec.js.map +1 -1
  173. package/dist/collection/components/cat-tab/cat-tab.e2e.js +6 -6
  174. package/dist/collection/components/cat-tab/cat-tab.e2e.js.map +1 -1
  175. package/dist/collection/components/cat-tab/cat-tab.js +230 -211
  176. package/dist/collection/components/cat-tab/cat-tab.js.map +1 -1
  177. package/dist/collection/components/cat-tab/cat-tab.spec.js +7 -7
  178. package/dist/collection/components/cat-tab/cat-tab.spec.js.map +1 -1
  179. package/dist/collection/components/cat-tabs/cat-tabs.css +3 -0
  180. package/dist/collection/components/cat-tabs/cat-tabs.e2e.js +6 -6
  181. package/dist/collection/components/cat-tabs/cat-tabs.e2e.js.map +1 -1
  182. package/dist/collection/components/cat-tabs/cat-tabs.js +222 -215
  183. package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
  184. package/dist/collection/components/cat-tabs/cat-tabs.spec.js +7 -7
  185. package/dist/collection/components/cat-tabs/cat-tabs.spec.js.map +1 -1
  186. package/dist/collection/components/cat-textarea/cat-textarea.e2e.js +7 -7
  187. package/dist/collection/components/cat-textarea/cat-textarea.e2e.js.map +1 -1
  188. package/dist/collection/components/cat-textarea/cat-textarea.js +586 -586
  189. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  190. package/dist/collection/components/cat-textarea/cat-textarea.spec.js +7 -7
  191. package/dist/collection/components/cat-textarea/cat-textarea.spec.js.map +1 -1
  192. package/dist/collection/components/cat-toggle/cat-toggle.e2e.js +6 -6
  193. package/dist/collection/components/cat-toggle/cat-toggle.e2e.js.map +1 -1
  194. package/dist/collection/components/cat-toggle/cat-toggle.js +421 -421
  195. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  196. package/dist/collection/components/cat-toggle/cat-toggle.spec.js +7 -7
  197. package/dist/collection/components/cat-toggle/cat-toggle.spec.js.map +1 -1
  198. package/dist/collection/components/cat-tooltip/cat-tooltip.css +3 -0
  199. package/dist/collection/components/cat-tooltip/cat-tooltip.e2e.js +6 -6
  200. package/dist/collection/components/cat-tooltip/cat-tooltip.e2e.js.map +1 -1
  201. package/dist/collection/components/cat-tooltip/cat-tooltip.js +297 -296
  202. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  203. package/dist/collection/components/cat-tooltip/cat-tooltip.spec.js +12 -8
  204. package/dist/collection/components/cat-tooltip/cat-tooltip.spec.js.map +1 -1
  205. package/dist/collection/scss/core/_dialog.scss +1 -1
  206. package/dist/collection/scss/core/_form.scss +2 -1
  207. package/dist/collection/scss/core/_typography.scss +1 -7
  208. package/dist/collection/utils/breakpoints.js +6 -6
  209. package/dist/collection/utils/breakpoints.js.map +1 -1
  210. package/dist/collection/utils/coerce.js +3 -3
  211. package/dist/collection/utils/coerce.js.map +1 -1
  212. package/dist/collection/utils/find-closest.js +6 -6
  213. package/dist/collection/utils/find-closest.js.map +1 -1
  214. package/dist/collection/utils/first-tabbable.js +1 -1
  215. package/dist/collection/utils/first-tabbable.js.map +1 -1
  216. package/dist/collection/utils/load-img.js +6 -6
  217. package/dist/collection/utils/load-img.js.map +1 -1
  218. package/dist/collection/utils/media-matcher.js +30 -30
  219. package/dist/collection/utils/media-matcher.js.map +1 -1
  220. package/dist/collection/utils/media-matcher.spec.js +32 -32
  221. package/dist/collection/utils/media-matcher.spec.js.map +1 -1
  222. package/dist/collection/utils/platform.js +34 -34
  223. package/dist/collection/utils/platform.js.map +1 -1
  224. package/dist/collection/utils/setDefault.js +4 -4
  225. package/dist/collection/utils/setDefault.js.map +1 -1
  226. package/dist/components/cat-alert.d.ts +2 -2
  227. package/dist/components/cat-alert.js +56 -56
  228. package/dist/components/cat-alert.js.map +1 -1
  229. package/dist/components/cat-avatar.d.ts +2 -2
  230. package/dist/components/cat-avatar2.js +93 -93
  231. package/dist/components/cat-avatar2.js.map +1 -1
  232. package/dist/components/cat-badge.d.ts +2 -2
  233. package/dist/components/cat-badge.js +32 -32
  234. package/dist/components/cat-badge.js.map +1 -1
  235. package/dist/components/cat-button-group.d.ts +2 -2
  236. package/dist/components/cat-button-group.js +31 -31
  237. package/dist/components/cat-button-group.js.map +1 -1
  238. package/dist/components/cat-button.d.ts +2 -2
  239. package/dist/components/cat-button2.js +277 -277
  240. package/dist/components/cat-button2.js.map +1 -1
  241. package/dist/components/cat-card.d.ts +2 -2
  242. package/dist/components/cat-card.js +20 -20
  243. package/dist/components/cat-card.js.map +1 -1
  244. package/dist/components/cat-checkbox.d.ts +2 -2
  245. package/dist/components/cat-checkbox2.js +108 -108
  246. package/dist/components/cat-checkbox2.js.map +1 -1
  247. package/dist/components/cat-datepicker-inline.d.ts +2 -2
  248. package/dist/components/cat-datepicker-inline.js +89 -89
  249. package/dist/components/cat-datepicker-inline.js.map +1 -1
  250. package/dist/components/cat-datepicker.d.ts +2 -2
  251. package/dist/components/cat-datepicker.js +203 -194
  252. package/dist/components/cat-datepicker.js.map +1 -1
  253. package/dist/components/cat-datepicker.locale.js +121 -121
  254. package/dist/components/cat-datepicker.locale.js.map +1 -1
  255. package/dist/components/cat-dropdown.d.ts +2 -2
  256. package/dist/components/cat-dropdown2.js +177 -177
  257. package/dist/components/cat-dropdown2.js.map +1 -1
  258. package/dist/components/cat-form-group.d.ts +2 -2
  259. package/dist/components/cat-form-group.js +55 -55
  260. package/dist/components/cat-form-group.js.map +1 -1
  261. package/dist/components/cat-form-hint.js +9 -9
  262. package/dist/components/cat-form-hint.js.map +1 -1
  263. package/dist/components/cat-i18n-registry.js +71 -71
  264. package/dist/components/cat-i18n-registry.js.map +1 -1
  265. package/dist/components/cat-icon-registry.js +77 -77
  266. package/dist/components/cat-icon-registry.js.map +1 -1
  267. package/dist/components/cat-icon.d.ts +2 -2
  268. package/dist/components/cat-icon2.js +32 -32
  269. package/dist/components/cat-icon2.js.map +1 -1
  270. package/dist/components/cat-input.d.ts +2 -2
  271. package/dist/components/cat-input2.js +219 -219
  272. package/dist/components/cat-input2.js.map +1 -1
  273. package/dist/components/cat-pagination.d.ts +2 -2
  274. package/dist/components/cat-pagination.js +103 -103
  275. package/dist/components/cat-pagination.js.map +1 -1
  276. package/dist/components/cat-radio-group.d.ts +2 -2
  277. package/dist/components/cat-radio-group.js +113 -113
  278. package/dist/components/cat-radio-group.js.map +1 -1
  279. package/dist/components/cat-radio.d.ts +2 -2
  280. package/dist/components/cat-radio.js +93 -93
  281. package/dist/components/cat-radio.js.map +1 -1
  282. package/dist/components/cat-scrollable.d.ts +2 -2
  283. package/dist/components/cat-scrollable2.js +118 -118
  284. package/dist/components/cat-scrollable2.js.map +1 -1
  285. package/dist/components/cat-select-demo.d.ts +2 -2
  286. package/dist/components/cat-select-demo.js +1438 -1438
  287. package/dist/components/cat-select-demo.js.map +1 -1
  288. package/dist/components/cat-select.d.ts +2 -2
  289. package/dist/components/cat-select2.js +666 -666
  290. package/dist/components/cat-select2.js.map +1 -1
  291. package/dist/components/cat-skeleton.d.ts +2 -2
  292. package/dist/components/cat-skeleton2.js +53 -53
  293. package/dist/components/cat-skeleton2.js.map +1 -1
  294. package/dist/components/cat-spinner.d.ts +2 -2
  295. package/dist/components/cat-spinner2.js +27 -27
  296. package/dist/components/cat-spinner2.js.map +1 -1
  297. package/dist/components/cat-tab.d.ts +2 -2
  298. package/dist/components/cat-tab.js +48 -46
  299. package/dist/components/cat-tab.js.map +1 -1
  300. package/dist/components/cat-tabs.d.ts +2 -2
  301. package/dist/components/cat-tabs.js +120 -113
  302. package/dist/components/cat-tabs.js.map +1 -1
  303. package/dist/components/cat-textarea.d.ts +2 -2
  304. package/dist/components/cat-textarea.js +178 -178
  305. package/dist/components/cat-textarea.js.map +1 -1
  306. package/dist/components/cat-toggle.d.ts +2 -2
  307. package/dist/components/cat-toggle.js +104 -104
  308. package/dist/components/cat-toggle.js.map +1 -1
  309. package/dist/components/cat-tooltip.d.ts +2 -2
  310. package/dist/components/cat-tooltip.js +144 -143
  311. package/dist/components/cat-tooltip.js.map +1 -1
  312. package/dist/components/coerce.js +3 -3
  313. package/dist/components/coerce.js.map +1 -1
  314. package/dist/components/index.js +72 -72
  315. package/dist/components/index.js.map +1 -1
  316. package/dist/esm/cat-alert_26.entry.js +3899 -3883
  317. package/dist/esm/cat-alert_26.entry.js.map +1 -1
  318. package/dist/esm/catalyst.js +4 -4
  319. package/dist/esm/catalyst.js.map +1 -1
  320. package/dist/esm/{index-30a221a3.js → index-acddba36.js} +51 -13
  321. package/dist/esm/index-acddba36.js.map +1 -0
  322. package/dist/esm/index.js +74 -74
  323. package/dist/esm/index.js.map +1 -1
  324. package/dist/esm/loader.js +3 -3
  325. package/dist/esm/{of-04d3d9e1.js → of-4f92b30b.js} +155 -155
  326. package/dist/esm/of-4f92b30b.js.map +1 -0
  327. package/dist/types/components/cat-alert/cat-alert.d.ts +17 -17
  328. package/dist/types/components/cat-avatar/cat-avatar.d.ts +41 -41
  329. package/dist/types/components/cat-badge/cat-badge.d.ts +22 -22
  330. package/dist/types/components/cat-button/cat-button.d.ts +151 -151
  331. package/dist/types/components/cat-button-group/cat-button-group.d.ts +9 -9
  332. package/dist/types/components/cat-card/cat-card.d.ts +1 -1
  333. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +97 -97
  334. package/dist/types/components/cat-datepicker/cat-datepicker.config.d.ts +12 -12
  335. package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +153 -149
  336. package/dist/types/components/cat-datepicker-inline/cat-datepicker-inline.d.ts +45 -45
  337. package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +49 -49
  338. package/dist/types/components/cat-form-group/cat-form-group.d.ts +23 -23
  339. package/dist/types/components/cat-form-hint/cat-form-hint.d.ts +6 -6
  340. package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +17 -17
  341. package/dist/types/components/cat-icon/cat-icon-registry.d.ts +12 -12
  342. package/dist/types/components/cat-icon/cat-icon.d.ts +18 -18
  343. package/dist/types/components/cat-input/cat-input.d.ts +167 -167
  344. package/dist/types/components/cat-notification/cat-notification.d.ts +31 -31
  345. package/dist/types/components/cat-pagination/cat-pagination.d.ts +52 -52
  346. package/dist/types/components/cat-radio/cat-radio.d.ts +83 -83
  347. package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +49 -49
  348. package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +49 -49
  349. package/dist/types/components/cat-select/cat-select.d.ts +221 -221
  350. package/dist/types/components/cat-select/connectors.d.ts +5 -5
  351. package/dist/types/components/cat-select-demo/cat-select-demo.d.ts +11 -11
  352. package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +23 -23
  353. package/dist/types/components/cat-spinner/cat-spinner.d.ts +10 -10
  354. package/dist/types/components/cat-tab/cat-tab.d.ts +48 -42
  355. package/dist/types/components/cat-tabs/cat-tabs.d.ts +40 -39
  356. package/dist/types/components/cat-textarea/cat-textarea.d.ts +131 -131
  357. package/dist/types/components/cat-toggle/cat-toggle.d.ts +93 -93
  358. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +64 -64
  359. package/dist/types/components.d.ts +10 -2
  360. package/dist/types/stencil-public-runtime.d.ts +8 -0
  361. package/dist/types/utils/breakpoints.d.ts +1 -1
  362. package/dist/types/utils/media-matcher.d.ts +10 -10
  363. package/dist/types/utils/platform.d.ts +16 -16
  364. package/dist/types/utils/setDefault.d.ts +2 -2
  365. package/package.json +18 -18
  366. package/dist/catalyst/p-1bd44896.js +0 -3
  367. package/dist/catalyst/p-1bd44896.js.map +0 -1
  368. package/dist/catalyst/p-dc953306.entry.js +0 -10
  369. package/dist/catalyst/p-dc953306.entry.js.map +0 -1
  370. package/dist/cjs/index-1e7eef7e.js.map +0 -1
  371. package/dist/cjs/of-395b2f57.js.map +0 -1
  372. package/dist/esm/index-30a221a3.js.map +0 -1
  373. package/dist/esm/of-04d3d9e1.js.map +0 -1
  374. /package/dist/catalyst/{p-85d057f0.js.map → p-6ae13953.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"cat-dropdown.js","sourceRoot":"","sources":["../../../src/components/cat-dropdown/cat-dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAa,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAoB,QAAQ,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAEvD,IAAI,YAAY,GAAG,CAAC,CAAC;AAOrB,MAAM,OAAO,WAAW;;IAEL,OAAE,GAAG,YAAY,EAAE,CAAC;IAM7B,WAAM,GAAmB,KAAK,CAAC;qBAKR,cAAc;uBAKvB,KAAK;oBAKR,KAAK;;EAaxB,YAAY,CAAC,KAA8B;IACzC,iEAAiE;IACjE,sEAAsE;IACtE,0DAA0D;IAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;MACjB,IAAI,CAAC,WAAW,EAAE,CAAC;MACnB,IAAI,CAAC,MAAM,EAAE,CAAC;KACf;IAED,6DAA6D;IAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;IAClC,IACE,CAAC,IAAI,CAAC,WAAW;MACjB,oDAAoD;MACpD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;MAC3B,yDAAyD;MACxD,KAAK,CAAC,MAAkB,EAAE,IAAI,KAAK,SAAS;MAC7C,uEAAuE;MACvE,CAAC,IAAI,C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,CAAC,CAAC;EAChE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA5NuB,kBAAM,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import { autoUpdate, computePosition, flip, offset, Placement, size } from '@floating-ui/dom';\nimport { timeTransitionS } from '@haiilo/catalyst-tokens';\nimport { Component, Event, EventEmitter, h, Host, Listen, Method, Prop } from '@stencil/core';\nimport * as focusTrap from 'focus-trap';\nimport { FocusableElement, tabbable } from 'tabbable';\nimport firstTabbable from '../../utils/first-tabbable';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-dropdown',\n styleUrl: 'cat-dropdown.scss',\n shadow: true\n})\nexport class CatDropdown {\n private static readonly OFFSET = 4;\n private readonly id = nextUniqueId++;\n private triggerSlot!: HTMLSlotElement;\n private trigger?: FocusableElement;\n private content!: HTMLElement;\n private trap?: focusTrap.FocusTrap;\n private keyListener?: (event: KeyboardEvent) => void;\n private isOpen: boolean | null = false;\n\n /**\n * The placement of the dropdown.\n */\n @Prop() placement: Placement = 'bottom-start';\n\n /**\n * Do not close the dropdown on outside clicks.\n */\n @Prop() noAutoClose = false;\n\n /**\n * Allow overflow when dropdown is open.\n */\n @Prop() overflow = false;\n\n /**\n * Emitted when the dropdown is opened.\n */\n @Event() catOpen!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the dropdown is closed.\n */\n @Event() catClose!: EventEmitter<FocusEvent>;\n\n @Listen('catClick')\n clickHandler(event: CustomEvent<MouseEvent>) {\n // we need to delay the initialization of the trigger until first\n // interaction because the element might still be hidden (and thus not\n // tabbable) if contained in another Stencil web component\n if (!this.trigger) {\n this.initTrigger();\n this.toggle();\n }\n\n // hide dropdown on button clicks inside the dropdown content\n const path = event.composedPath();\n if (\n !this.noAutoClose &&\n // check if click was inside of the dropdown content\n path.includes(this.content) &&\n // check if click was not on a trigger for a sub-dropdown\n (event.target as Element)?.slot !== 'trigger' &&\n // check if click was not an element marked with data-dropdown-no-close\n !path.slice(0, path.indexOf(this.content)).find(el => this.hasAttribute(el, 'data-dropdown-no-close'))\n ) {\n this.close();\n }\n }\n\n /**\n * Toggles the dropdown.\n */\n async toggle(): Promise<void> {\n this.isOpen ? this.close() : this.open();\n }\n\n /**\n * Opens the dropdown.\n */\n async open(): Promise<void> {\n if (this.isOpen === null || this.isOpen) {\n return; // busy or open\n }\n\n this.isOpen = null;\n this.content.style.display = 'block';\n // give CSS transition time to apply\n setTimeout(() => {\n this.isOpen = true;\n this.content.classList.add('show');\n this.trigger?.setAttribute('aria-expanded', 'true');\n this.catOpen.emit();\n this.trap = this.trap\n ? this.trap.updateContainerElements(this.content)\n : focusTrap.createFocusTrap(this.content, {\n tabbableOptions: {\n getShadowRoot: true\n },\n allowOutsideClick: true,\n clickOutsideDeactivates: event =>\n !this.noAutoClose &&\n // check if click was outside of the dropdown content\n !event.composedPath().includes(this.content) &&\n // check if click was not on an element marked with data-dropdown-no-close\n !event.composedPath().find(el => this.hasAttribute(el, 'data-dropdown-no-close')),\n onPostDeactivate: () => this.close()\n });\n this.trap.activate();\n });\n }\n\n /**\n * Closes the dropdown.\n */\n @Method()\n async close(): Promise<void> {\n if (!this.isOpen) {\n return; // busy or closed\n }\n\n this.isOpen = null;\n this.content.classList.remove('show');\n // give CSS transition time to apply\n setTimeout(() => {\n this.isOpen = false;\n this.content.classList.remove('show');\n this.content.style.display = '';\n this.trigger?.setAttribute('aria-expanded', 'false');\n this.trap?.deactivate();\n this.catClose.emit();\n }, timeTransitionS);\n }\n\n componentDidLoad(): void {\n this.keyListener = event => {\n if (this.isOpen && ['ArrowDown', 'ArrowUp'].includes(event.key)) {\n const targetElements = tabbable(this.content, { includeContainer: false, getShadowRoot: true });\n const activeElement = firstTabbable(document.activeElement);\n const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;\n const activeOff = event.key === 'ArrowDown' ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].focus();\n event.preventDefault();\n }\n };\n document.addEventListener('keydown', this.keyListener);\n }\n\n disconnectedCallback(): void {\n if (this.keyListener) {\n document.removeEventListener('keydown', this.keyListener);\n }\n }\n\n render() {\n return (\n <Host>\n <slot name=\"trigger\" ref={el => (this.triggerSlot = el as HTMLSlotElement)}></slot>\n <div\n id={this.contentId}\n class={{ content: true, 'overflow-auto': !this.overflow }}\n ref={el => (this.content = el as HTMLElement)}\n >\n <slot name=\"content\"></slot>\n </div>\n </Host>\n );\n }\n\n private get contentId() {\n return `cat-dropdown-${this.id}`;\n }\n\n private initTrigger() {\n this.trigger = this.findTrigger();\n this.trigger.setAttribute('aria-haspopup', 'true');\n this.trigger.setAttribute('aria-expanded', 'false');\n this.trigger.setAttribute('aria-controls', this.contentId);\n this.trigger.addEventListener('click', () => this.toggle());\n autoUpdate(this.trigger, this.content, () => this.update());\n }\n\n private findTrigger() {\n let trigger: FocusableElement | undefined;\n const elems = this.triggerSlot?.assignedElements?.() || [];\n while (!trigger && elems.length) {\n const elem = elems.shift();\n trigger = elem?.hasAttribute('data-trigger')\n ? (elem as HTMLElement)\n : elem?.querySelector('[data-trigger]') ?? undefined;\n }\n if (!trigger) {\n trigger = firstTabbable(this.triggerSlot);\n }\n if (!trigger) {\n throw new Error('Cannot find tabbable element. Use [data-trigger] to set the trigger.');\n }\n return trigger;\n }\n\n private update() {\n if (this.trigger) {\n computePosition(this.trigger, this.content, {\n strategy: 'fixed',\n placement: this.placement,\n middleware: [\n offset(CatDropdown.OFFSET),\n flip(),\n size({\n padding: CatDropdown.OFFSET,\n apply({ availableWidth, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n maxWidth: `${availableWidth}px`,\n maxHeight: `${availableHeight}px`\n });\n }\n })\n ]\n }).then(({ x, y, placement }) => {\n this.content.dataset.placement = placement;\n Object.assign(this.content.style, {\n left: `${x}px`,\n top: `${y}px`\n });\n });\n }\n }\n\n private hasAttribute(elem: EventTarget, attr: string) {\n return elem instanceof HTMLElement && elem.hasAttribute(attr);\n }\n}\n"]}
1
+ {"version":3,"file":"cat-dropdown.js","sourceRoot":"","sources":["../../../src/components/cat-dropdown/cat-dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAa,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAoB,QAAQ,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAEvD,IAAI,YAAY,GAAG,CAAC,CAAC;AAOrB,MAAM,OAAO,WAAW;;QAEL,OAAE,GAAG,YAAY,EAAE,CAAC;QAM7B,WAAM,GAAmB,KAAK,CAAC;yBAKR,cAAc;2BAKvB,KAAK;wBAKR,KAAK;;IAaxB,YAAY,CAAC,KAA8B;QACzC,iEAAiE;QACjE,sEAAsE;QACtE,0DAA0D;QAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,MAAM,EAAE,CAAC;SACf;QAED,6DAA6D;QAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;QAClC,IACE,CAAC,IAAI,CAAC,WAAW;YACjB,oDAAoD;YACpD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;YAC3B,yDAAyD;YACxD,KAAK,CAAC,MAAkB,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CAAC;IAEO,YAAY,CAAC,IAAiB,EAAE,IAAY;QAClD,OAAO,IAAI,YAAY,WAAW,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA5NuB,kBAAM,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import { autoUpdate, computePosition, flip, offset, Placement, size } from '@floating-ui/dom';\nimport { timeTransitionS } from '@haiilo/catalyst-tokens';\nimport { Component, Event, EventEmitter, h, Host, Listen, Method, Prop } from '@stencil/core';\nimport * as focusTrap from 'focus-trap';\nimport { FocusableElement, tabbable } from 'tabbable';\nimport firstTabbable from '../../utils/first-tabbable';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-dropdown',\n styleUrl: 'cat-dropdown.scss',\n shadow: true\n})\nexport class CatDropdown {\n private static readonly OFFSET = 4;\n private readonly id = nextUniqueId++;\n private triggerSlot!: HTMLSlotElement;\n private trigger?: FocusableElement;\n private content!: HTMLElement;\n private trap?: focusTrap.FocusTrap;\n private keyListener?: (event: KeyboardEvent) => void;\n private isOpen: boolean | null = false;\n\n /**\n * The placement of the dropdown.\n */\n @Prop() placement: Placement = 'bottom-start';\n\n /**\n * Do not close the dropdown on outside clicks.\n */\n @Prop() noAutoClose = false;\n\n /**\n * Allow overflow when dropdown is open.\n */\n @Prop() overflow = false;\n\n /**\n * Emitted when the dropdown is opened.\n */\n @Event() catOpen!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the dropdown is closed.\n */\n @Event() catClose!: EventEmitter<FocusEvent>;\n\n @Listen('catClick')\n clickHandler(event: CustomEvent<MouseEvent>) {\n // we need to delay the initialization of the trigger until first\n // interaction because the element might still be hidden (and thus not\n // tabbable) if contained in another Stencil web component\n if (!this.trigger) {\n this.initTrigger();\n this.toggle();\n }\n\n // hide dropdown on button clicks inside the dropdown content\n const path = event.composedPath();\n if (\n !this.noAutoClose &&\n // check if click was inside of the dropdown content\n path.includes(this.content) &&\n // check if click was not on a trigger for a sub-dropdown\n (event.target as Element)?.slot !== 'trigger' &&\n // check if click was not an element marked with data-dropdown-no-close\n !path.slice(0, path.indexOf(this.content)).find(el => this.hasAttribute(el, 'data-dropdown-no-close'))\n ) {\n this.close();\n }\n }\n\n /**\n * Toggles the dropdown.\n */\n async toggle(): Promise<void> {\n this.isOpen ? this.close() : this.open();\n }\n\n /**\n * Opens the dropdown.\n */\n async open(): Promise<void> {\n if (this.isOpen === null || this.isOpen) {\n return; // busy or open\n }\n\n this.isOpen = null;\n this.content.style.display = 'block';\n // give CSS transition time to apply\n setTimeout(() => {\n this.isOpen = true;\n this.content.classList.add('show');\n this.trigger?.setAttribute('aria-expanded', 'true');\n this.catOpen.emit();\n this.trap = this.trap\n ? this.trap.updateContainerElements(this.content)\n : focusTrap.createFocusTrap(this.content, {\n tabbableOptions: {\n getShadowRoot: true\n },\n allowOutsideClick: true,\n clickOutsideDeactivates: event =>\n !this.noAutoClose &&\n // check if click was outside of the dropdown content\n !event.composedPath().includes(this.content) &&\n // check if click was not on an element marked with data-dropdown-no-close\n !event.composedPath().find(el => this.hasAttribute(el, 'data-dropdown-no-close')),\n onPostDeactivate: () => this.close()\n });\n this.trap.activate();\n });\n }\n\n /**\n * Closes the dropdown.\n */\n @Method()\n async close(): Promise<void> {\n if (!this.isOpen) {\n return; // busy or closed\n }\n\n this.isOpen = null;\n this.content.classList.remove('show');\n // give CSS transition time to apply\n setTimeout(() => {\n this.isOpen = false;\n this.content.classList.remove('show');\n this.content.style.display = '';\n this.trigger?.setAttribute('aria-expanded', 'false');\n this.trap?.deactivate();\n this.catClose.emit();\n }, timeTransitionS);\n }\n\n componentDidLoad(): void {\n this.keyListener = event => {\n if (this.isOpen && ['ArrowDown', 'ArrowUp'].includes(event.key)) {\n const targetElements = tabbable(this.content, { includeContainer: false, getShadowRoot: true });\n const activeElement = firstTabbable(document.activeElement);\n const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;\n const activeOff = event.key === 'ArrowDown' ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].focus();\n event.preventDefault();\n }\n };\n document.addEventListener('keydown', this.keyListener);\n }\n\n disconnectedCallback(): void {\n if (this.keyListener) {\n document.removeEventListener('keydown', this.keyListener);\n }\n }\n\n render() {\n return (\n <Host>\n <slot name=\"trigger\" ref={el => (this.triggerSlot = el as HTMLSlotElement)}></slot>\n <div\n id={this.contentId}\n class={{ content: true, 'overflow-auto': !this.overflow }}\n ref={el => (this.content = el as HTMLElement)}\n >\n <slot name=\"content\"></slot>\n </div>\n </Host>\n );\n }\n\n private get contentId() {\n return `cat-dropdown-${this.id}`;\n }\n\n private initTrigger() {\n this.trigger = this.findTrigger();\n this.trigger.setAttribute('aria-haspopup', 'true');\n this.trigger.setAttribute('aria-expanded', 'false');\n this.trigger.setAttribute('aria-controls', this.contentId);\n this.trigger.addEventListener('click', () => this.toggle());\n autoUpdate(this.trigger, this.content, () => this.update());\n }\n\n private findTrigger() {\n let trigger: FocusableElement | undefined;\n const elems = this.triggerSlot?.assignedElements?.() || [];\n while (!trigger && elems.length) {\n const elem = elems.shift();\n trigger = elem?.hasAttribute('data-trigger')\n ? (elem as HTMLElement)\n : elem?.querySelector('[data-trigger]') ?? undefined;\n }\n if (!trigger) {\n trigger = firstTabbable(this.triggerSlot);\n }\n if (!trigger) {\n throw new Error('Cannot find tabbable element. Use [data-trigger] to set the trigger.');\n }\n return trigger;\n }\n\n private update() {\n if (this.trigger) {\n computePosition(this.trigger, this.content, {\n strategy: 'fixed',\n placement: this.placement,\n middleware: [\n offset(CatDropdown.OFFSET),\n flip(),\n size({\n padding: CatDropdown.OFFSET,\n apply({ availableWidth, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n maxWidth: `${availableWidth}px`,\n maxHeight: `${availableHeight}px`\n });\n }\n })\n ]\n }).then(({ x, y, placement }) => {\n this.content.dataset.placement = placement;\n Object.assign(this.content.style, {\n left: `${x}px`,\n top: `${y}px`\n });\n });\n }\n }\n\n private hasAttribute(elem: EventTarget, attr: string) {\n return elem instanceof HTMLElement && elem.hasAttribute(attr);\n }\n}\n"]}
@@ -1,15 +1,15 @@
1
1
  import { newSpecPage } from "@stencil/core/testing";
2
2
  import { CatDropdown } from "./cat-dropdown";
3
3
  describe('cat-dropdown', () => {
4
- it('renders', async () => {
5
- const page = await newSpecPage({
6
- components: [CatDropdown],
7
- html: `<cat-dropdown>
4
+ it('renders', async () => {
5
+ const page = await newSpecPage({
6
+ components: [CatDropdown],
7
+ html: `<cat-dropdown>
8
8
  <button slot="trigger"></button>
9
9
  <nav slot="content"></nav>
10
10
  </cat-dropdown>`
11
- });
12
- expect(page.root).toEqualHtml(`
11
+ });
12
+ expect(page.root).toEqualHtml(`
13
13
  <cat-dropdown>
14
14
  <mock:shadow-root>
15
15
  <slot name="trigger"></slot>
@@ -21,6 +21,6 @@ describe('cat-dropdown', () => {
21
21
  <nav slot="content"></nav>
22
22
  </cat-dropdown>
23
23
  `);
24
- });
24
+ });
25
25
  });
26
26
  //# sourceMappingURL=cat-dropdown.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-dropdown.spec.js","sourceRoot":"","sources":["../../../src/components/cat-dropdown/cat-dropdown.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;EAC5B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,WAAW,CAAC;MACzB,IAAI,EAAE;;;sBAGU;KACjB,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;KAW7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { CatDropdown } from './cat-dropdown';\n\ndescribe('cat-dropdown', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [CatDropdown],\n html: `<cat-dropdown>\n <button slot=\"trigger\"></button>\n <nav slot=\"content\"></nav>\n </cat-dropdown>`\n });\n expect(page.root).toEqualHtml(`\n <cat-dropdown>\n <mock:shadow-root>\n <slot name=\"trigger\"></slot>\n <div class=\"content overflow-auto\" id=\"cat-dropdown-0\">\n <slot name=\"content\"></slot>\n </div>\n </mock:shadow-root>\n <button slot=\"trigger\"></button>\n <nav slot=\"content\"></nav>\n </cat-dropdown>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"cat-dropdown.spec.js","sourceRoot":"","sources":["../../../src/components/cat-dropdown/cat-dropdown.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,IAAI,EAAE;;;sBAGU;SACjB,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;KAW7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { CatDropdown } from './cat-dropdown';\n\ndescribe('cat-dropdown', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [CatDropdown],\n html: `<cat-dropdown>\n <button slot=\"trigger\"></button>\n <nav slot=\"content\"></nav>\n </cat-dropdown>`\n });\n expect(page.root).toEqualHtml(`\n <cat-dropdown>\n <mock:shadow-root>\n <slot name=\"trigger\"></slot>\n <div class=\"content overflow-auto\" id=\"cat-dropdown-0\">\n <slot name=\"content\"></slot>\n </div>\n </mock:shadow-root>\n <button slot=\"trigger\"></button>\n <nav slot=\"content\"></nav>\n </cat-dropdown>\n `);\n });\n});\n"]}
@@ -1,10 +1,10 @@
1
1
  import { newE2EPage } from "@stencil/core/testing";
2
2
  describe('cat-form-group', () => {
3
- it('renders', async () => {
4
- const page = await newE2EPage();
5
- await page.setContent('<cat-form-group></cat-form-group>');
6
- const element = await page.find('cat-form-group');
7
- expect(element).toHaveClass('hydrated');
8
- });
3
+ it('renders', async () => {
4
+ const page = await newE2EPage();
5
+ await page.setContent('<cat-form-group></cat-form-group>');
6
+ const element = await page.find('cat-form-group');
7
+ expect(element).toHaveClass('hydrated');
8
+ });
9
9
  });
10
10
  //# sourceMappingURL=cat-form-group.e2e.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-form-group.e2e.js","sourceRoot":"","sources":["../../../src/components/cat-form-group/cat-form-group.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;EAC9B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,UAAU,EAAE,CAAC;IAChC,MAAM,IAAI,CAAC,UAAU,CAAC,mCAAmC,CAAC,CAAC;IAE3D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAClD,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;EAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newE2EPage } from '@stencil/core/testing';\n\ndescribe('cat-form-group', () => {\n it('renders', async () => {\n const page = await newE2EPage();\n await page.setContent('<cat-form-group></cat-form-group>');\n\n const element = await page.find('cat-form-group');\n expect(element).toHaveClass('hydrated');\n });\n});\n"]}
1
+ {"version":3,"file":"cat-form-group.e2e.js","sourceRoot":"","sources":["../../../src/components/cat-form-group/cat-form-group.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,CAAC,UAAU,CAAC,mCAAmC,CAAC,CAAC;QAE3D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAClD,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newE2EPage } from '@stencil/core/testing';\n\ndescribe('cat-form-group', () => {\n it('renders', async () => {\n const page = await newE2EPage();\n await page.setContent('<cat-form-group></cat-form-group>');\n\n const element = await page.find('cat-form-group');\n expect(element).toHaveClass('hydrated');\n });\n});\n"]}
@@ -1,111 +1,111 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  export class CatFormGroup {
3
- constructor() {
4
- this.formElements = [];
5
- this.requiredMarker = 'auto';
6
- this.horizontal = false;
7
- this.labelSize = undefined;
8
- }
9
- onRequiredMarkerChanged(newRequiredMarker) {
10
- const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;
11
- this.formElements.forEach(element => !element.requiredMarker?.endsWith('!') && (element.requiredMarker = updateMarker));
12
- }
13
- onHorizontalChanged(newHorizontal) {
14
- this.formElements.forEach(element => {
15
- element.horizontal = newHorizontal;
16
- });
17
- }
18
- render() {
19
- return (h(Host, { style: { '--label-size': this.labelSize } }, h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
20
- }
21
- onSlotChange() {
22
- this.formElements = Array.from(this.hostElement.querySelectorAll('cat-input, cat-textarea, cat-select, cat-datepicker'));
23
- this.onRequiredMarkerChanged(this.requiredMarker);
24
- this.onHorizontalChanged(this.horizontal);
25
- }
26
- calculate(elements) {
27
- const optionalFields = elements.filter(value => !value.required).length;
28
- const requiredFields = elements.length - optionalFields;
29
- return requiredFields >= optionalFields ? 'optional' : 'required';
30
- }
31
- static get is() { return "cat-form-group"; }
32
- static get encapsulation() { return "shadow"; }
33
- static get originalStyleUrls() {
34
- return {
35
- "$": ["cat-form-group.scss"]
36
- };
37
- }
38
- static get styleUrls() {
39
- return {
40
- "$": ["cat-form-group.css"]
41
- };
42
- }
43
- static get properties() {
44
- return {
45
- "requiredMarker": {
46
- "type": "string",
47
- "mutable": false,
48
- "complexType": {
49
- "original": "'none' | 'required' | 'optional' | 'auto'",
50
- "resolved": "\"auto\" | \"none\" | \"optional\" | \"required\"",
51
- "references": {}
52
- },
53
- "required": false,
54
- "optional": false,
55
- "docs": {
56
- "tags": [],
57
- "text": "Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />\nBy default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />\n- If there are more required, the optional will be marked.<br />\n- If there are less required, it will mark the required.<br /><br />\nIf a form field had \"!\", the requiredMarked of the field would not change."
58
- },
59
- "attribute": "required-marker",
60
- "reflect": false,
61
- "defaultValue": "'auto'"
62
- },
63
- "horizontal": {
64
- "type": "boolean",
65
- "mutable": false,
66
- "complexType": {
67
- "original": "boolean",
68
- "resolved": "boolean",
69
- "references": {}
70
- },
71
- "required": false,
72
- "optional": false,
73
- "docs": {
74
- "tags": [],
75
- "text": "Whether the label is on top or left."
76
- },
77
- "attribute": "horizontal",
78
- "reflect": false,
79
- "defaultValue": "false"
80
- },
81
- "labelSize": {
82
- "type": "string",
83
- "mutable": false,
84
- "complexType": {
85
- "original": "string",
86
- "resolved": "string | undefined",
87
- "references": {}
88
- },
89
- "required": false,
90
- "optional": true,
91
- "docs": {
92
- "tags": [],
93
- "text": "The space allocated to the input label"
94
- },
95
- "attribute": "label-size",
96
- "reflect": false
97
- }
98
- };
99
- }
100
- static get elementRef() { return "hostElement"; }
101
- static get watchers() {
102
- return [{
103
- "propName": "requiredMarker",
104
- "methodName": "onRequiredMarkerChanged"
105
- }, {
106
- "propName": "horizontal",
107
- "methodName": "onHorizontalChanged"
108
- }];
109
- }
3
+ constructor() {
4
+ this.formElements = [];
5
+ this.requiredMarker = 'auto';
6
+ this.horizontal = false;
7
+ this.labelSize = undefined;
8
+ }
9
+ onRequiredMarkerChanged(newRequiredMarker) {
10
+ const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;
11
+ this.formElements.forEach(element => !element.requiredMarker?.endsWith('!') && (element.requiredMarker = updateMarker));
12
+ }
13
+ onHorizontalChanged(newHorizontal) {
14
+ this.formElements.forEach(element => {
15
+ element.horizontal = newHorizontal;
16
+ });
17
+ }
18
+ render() {
19
+ return (h(Host, { style: { '--label-size': this.labelSize } }, h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
20
+ }
21
+ onSlotChange() {
22
+ this.formElements = Array.from(this.hostElement.querySelectorAll('cat-input, cat-textarea, cat-select, cat-datepicker'));
23
+ this.onRequiredMarkerChanged(this.requiredMarker);
24
+ this.onHorizontalChanged(this.horizontal);
25
+ }
26
+ calculate(elements) {
27
+ const optionalFields = elements.filter(value => !value.required).length;
28
+ const requiredFields = elements.length - optionalFields;
29
+ return requiredFields >= optionalFields ? 'optional' : 'required';
30
+ }
31
+ static get is() { return "cat-form-group"; }
32
+ static get encapsulation() { return "shadow"; }
33
+ static get originalStyleUrls() {
34
+ return {
35
+ "$": ["cat-form-group.scss"]
36
+ };
37
+ }
38
+ static get styleUrls() {
39
+ return {
40
+ "$": ["cat-form-group.css"]
41
+ };
42
+ }
43
+ static get properties() {
44
+ return {
45
+ "requiredMarker": {
46
+ "type": "string",
47
+ "mutable": false,
48
+ "complexType": {
49
+ "original": "'none' | 'required' | 'optional' | 'auto'",
50
+ "resolved": "\"auto\" | \"none\" | \"optional\" | \"required\"",
51
+ "references": {}
52
+ },
53
+ "required": false,
54
+ "optional": false,
55
+ "docs": {
56
+ "tags": [],
57
+ "text": "Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />\nBy default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />\n- If there are more required, the optional will be marked.<br />\n- If there are less required, it will mark the required.<br /><br />\nIf a form field had \"!\", the requiredMarked of the field would not change."
58
+ },
59
+ "attribute": "required-marker",
60
+ "reflect": false,
61
+ "defaultValue": "'auto'"
62
+ },
63
+ "horizontal": {
64
+ "type": "boolean",
65
+ "mutable": false,
66
+ "complexType": {
67
+ "original": "boolean",
68
+ "resolved": "boolean",
69
+ "references": {}
70
+ },
71
+ "required": false,
72
+ "optional": false,
73
+ "docs": {
74
+ "tags": [],
75
+ "text": "Whether the label is on top or left."
76
+ },
77
+ "attribute": "horizontal",
78
+ "reflect": false,
79
+ "defaultValue": "false"
80
+ },
81
+ "labelSize": {
82
+ "type": "string",
83
+ "mutable": false,
84
+ "complexType": {
85
+ "original": "string",
86
+ "resolved": "string | undefined",
87
+ "references": {}
88
+ },
89
+ "required": false,
90
+ "optional": true,
91
+ "docs": {
92
+ "tags": [],
93
+ "text": "The space allocated to the input label"
94
+ },
95
+ "attribute": "label-size",
96
+ "reflect": false
97
+ }
98
+ };
99
+ }
100
+ static get elementRef() { return "hostElement"; }
101
+ static get watchers() {
102
+ return [{
103
+ "propName": "requiredMarker",
104
+ "methodName": "onRequiredMarkerChanged"
105
+ }, {
106
+ "propName": "horizontal",
107
+ "methodName": "onHorizontalChanged"
108
+ }];
109
+ }
110
110
  }
111
111
  //# sourceMappingURL=cat-form-group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-form-group.js","sourceRoot":"","sources":["../../../src/components/cat-form-group/cat-form-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAazE,MAAM,OAAO,YAAY;;IACf,iBAAY,GAA8B,EAAE,CAAC;0BAWe,MAAM;sBAKrD,KAAK;;;EAQ1B,uBAAuB,CAAC,iBAA4D;IAClF,MAAM,YAAY,GAAG,iBAAiB,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAC1G,IAAI,CAAC,YAAY,CAAC,OAAO,CACvB,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG,YAAY,CAAC,CAC7F,CAAC;EACJ,CAAC;EAGD,mBAAmB,CAAC,aAAsB;IACxC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;MAClC,OAAO,CAAC,UAAU,GAAG,aAAa,CAAC;IACrC,CAAC,CAAC,CAAC;EACL,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,SAAS,EAAE;MAC7C,YAAM,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAS,CACpD,CACR,CAAC;EACJ,CAAC;EAEO,YAAY;IAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAC5B,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,qDAAqD,CAAC,CAC5D,CAAC;IAC/B,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAClD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;EAC5C,CAAC;EAEO,SAAS,CAAC,QAAmC;IACnD,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IACxE,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAC;IACxD,OAAO,cAAc,IAAI,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;EACpE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\n\ntype HTMLCatFormFieldElement =\n | HTMLCatInputElement\n | HTMLCatTextareaElement\n | HTMLCatSelectElement\n | HTMLCatDatepickerElement;\n\n@Component({\n tag: 'cat-form-group',\n styleUrl: 'cat-form-group.scss',\n shadow: true\n})\nexport class CatFormGroup {\n private formElements: HTMLCatFormFieldElement[] = [];\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />\n * By default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />\n * - If there are more required, the optional will be marked.<br />\n * - If there are less required, it will mark the required.<br /><br />\n * If a form field had \"!\", the requiredMarked of the field would not change.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'auto' = 'auto';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * The space allocated to the input label\n */\n @Prop() labelSize?: string;\n\n @Watch('requiredMarker')\n onRequiredMarkerChanged(newRequiredMarker: 'none' | 'required' | 'optional' | 'auto') {\n const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;\n this.formElements.forEach(\n element => !element.requiredMarker?.endsWith('!') && (element.requiredMarker = updateMarker)\n );\n }\n\n @Watch('horizontal')\n onHorizontalChanged(newHorizontal: boolean) {\n this.formElements.forEach(element => {\n element.horizontal = newHorizontal;\n });\n }\n\n render() {\n return (\n <Host style={{ '--label-size': this.labelSize }}>\n <slot onSlotchange={this.onSlotChange.bind(this)}></slot>\n </Host>\n );\n }\n\n private onSlotChange(): void {\n this.formElements = Array.from(\n this.hostElement.querySelectorAll('cat-input, cat-textarea, cat-select, cat-datepicker')\n ) as HTMLCatFormFieldElement[];\n this.onRequiredMarkerChanged(this.requiredMarker);\n this.onHorizontalChanged(this.horizontal);\n }\n\n private calculate(elements: HTMLCatFormFieldElement[]): 'optional' | 'required' {\n const optionalFields = elements.filter(value => !value.required).length;\n const requiredFields = elements.length - optionalFields;\n return requiredFields >= optionalFields ? 'optional' : 'required';\n }\n}\n"]}
1
+ {"version":3,"file":"cat-form-group.js","sourceRoot":"","sources":["../../../src/components/cat-form-group/cat-form-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAazE,MAAM,OAAO,YAAY;;QACf,iBAAY,GAA8B,EAAE,CAAC;8BAWe,MAAM;0BAKrD,KAAK;;;IAQ1B,uBAAuB,CAAC,iBAA4D;QAClF,MAAM,YAAY,GAAG,iBAAiB,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAC1G,IAAI,CAAC,YAAY,CAAC,OAAO,CACvB,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG,YAAY,CAAC,CAC7F,CAAC;IACJ,CAAC;IAGD,mBAAmB,CAAC,aAAsB;QACxC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAClC,OAAO,CAAC,UAAU,GAAG,aAAa,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,SAAS,EAAE;YAC7C,YAAM,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAS,CACpD,CACR,CAAC;IACJ,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAC5B,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,qDAAqD,CAAC,CAC5D,CAAC;QAC/B,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAClD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAEO,SAAS,CAAC,QAAmC;QACnD,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;QACxE,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAC;QACxD,OAAO,cAAc,IAAI,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IACpE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\n\ntype HTMLCatFormFieldElement =\n | HTMLCatInputElement\n | HTMLCatTextareaElement\n | HTMLCatSelectElement\n | HTMLCatDatepickerElement;\n\n@Component({\n tag: 'cat-form-group',\n styleUrl: 'cat-form-group.scss',\n shadow: true\n})\nexport class CatFormGroup {\n private formElements: HTMLCatFormFieldElement[] = [];\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />\n * By default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />\n * - If there are more required, the optional will be marked.<br />\n * - If there are less required, it will mark the required.<br /><br />\n * If a form field had \"!\", the requiredMarked of the field would not change.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'auto' = 'auto';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * The space allocated to the input label\n */\n @Prop() labelSize?: string;\n\n @Watch('requiredMarker')\n onRequiredMarkerChanged(newRequiredMarker: 'none' | 'required' | 'optional' | 'auto') {\n const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;\n this.formElements.forEach(\n element => !element.requiredMarker?.endsWith('!') && (element.requiredMarker = updateMarker)\n );\n }\n\n @Watch('horizontal')\n onHorizontalChanged(newHorizontal: boolean) {\n this.formElements.forEach(element => {\n element.horizontal = newHorizontal;\n });\n }\n\n render() {\n return (\n <Host style={{ '--label-size': this.labelSize }}>\n <slot onSlotchange={this.onSlotChange.bind(this)}></slot>\n </Host>\n );\n }\n\n private onSlotChange(): void {\n this.formElements = Array.from(\n this.hostElement.querySelectorAll('cat-input, cat-textarea, cat-select, cat-datepicker')\n ) as HTMLCatFormFieldElement[];\n this.onRequiredMarkerChanged(this.requiredMarker);\n this.onHorizontalChanged(this.horizontal);\n }\n\n private calculate(elements: HTMLCatFormFieldElement[]): 'optional' | 'required' {\n const optionalFields = elements.filter(value => !value.required).length;\n const requiredFields = elements.length - optionalFields;\n return requiredFields >= optionalFields ? 'optional' : 'required';\n }\n}\n"]}
@@ -1,18 +1,18 @@
1
1
  import { newSpecPage } from "@stencil/core/testing";
2
2
  import { CatFormGroup } from "./cat-form-group";
3
3
  describe('cat-form-group', () => {
4
- it('renders', async () => {
5
- const page = await newSpecPage({
6
- components: [CatFormGroup],
7
- html: `<cat-form-group></cat-form-group>`
8
- });
9
- expect(page.root).toEqualHtml(`
4
+ it('renders', async () => {
5
+ const page = await newSpecPage({
6
+ components: [CatFormGroup],
7
+ html: `<cat-form-group></cat-form-group>`
8
+ });
9
+ expect(page.root).toEqualHtml(`
10
10
  <cat-form-group>
11
11
  <mock:shadow-root>
12
12
  <slot></slot>
13
13
  </mock:shadow-root>
14
14
  </cat-form-group>
15
15
  `);
16
- });
16
+ });
17
17
  });
18
18
  //# sourceMappingURL=cat-form-group.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-form-group.spec.js","sourceRoot":"","sources":["../../../src/components/cat-form-group/cat-form-group.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;EAC9B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,YAAY,CAAC;MAC1B,IAAI,EAAE,mCAAmC;KAC1C,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;KAM7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { CatFormGroup } from './cat-form-group';\n\ndescribe('cat-form-group', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [CatFormGroup],\n html: `<cat-form-group></cat-form-group>`\n });\n expect(page.root).toEqualHtml(`\n <cat-form-group>\n <mock:shadow-root>\n <slot></slot>\n </mock:shadow-root>\n </cat-form-group>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"cat-form-group.spec.js","sourceRoot":"","sources":["../../../src/components/cat-form-group/cat-form-group.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,YAAY,CAAC;YAC1B,IAAI,EAAE,mCAAmC;SAC1C,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;KAM7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { CatFormGroup } from './cat-form-group';\n\ndescribe('cat-form-group', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [CatFormGroup],\n html: `<cat-form-group></cat-form-group>`\n });\n expect(page.root).toEqualHtml(`\n <cat-form-group>\n <mock:shadow-root>\n <slot></slot>\n </mock:shadow-root>\n </cat-form-group>\n `);\n });\n});\n"]}
@@ -7,14 +7,14 @@ import { catI18nRegistry as i18n } from "../cat-i18n/cat-i18n-registry";
7
7
  * @return a JSX.Element
8
8
  */
9
9
  export const CatFormHint = props => {
10
- const { id, hint, slottedHint, errorMap } = props;
11
- const errors = Object.entries(errorMap || {});
12
- return (h("div", { "aria-live": "polite", id: id + '-hint', class: "hint-section" }, errors.length
13
- ? errors.map(([key, params]) => (h("p", { class: (props.class ?? '') + ' input-hint cat-text-danger' }, i18n.t(`error.${key}`, params))))
14
- : [
15
- hint &&
16
- (Array.isArray(hint) ? (hint.map(item => h("p", { class: (props.class ?? '') + ' input-hint' }, item))) : (h("p", { class: (props.class ?? '') + ' input-hint' }, hint))),
17
- slottedHint
18
- ]));
10
+ const { id, hint, slottedHint, errorMap } = props;
11
+ const errors = Object.entries(errorMap || {});
12
+ return (h("div", { "aria-live": "polite", id: id + '-hint', class: "hint-section" }, errors.length
13
+ ? errors.map(([key, params]) => (h("p", { class: (props.class ?? '') + ' input-hint cat-text-danger' }, i18n.t(`error.${key}`, params))))
14
+ : [
15
+ hint &&
16
+ (Array.isArray(hint) ? (hint.map(item => h("p", { class: (props.class ?? '') + ' input-hint' }, item))) : (h("p", { class: (props.class ?? '') + ' input-hint' }, hint))),
17
+ slottedHint
18
+ ]));
19
19
  };
20
20
  //# sourceMappingURL=cat-form-hint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-form-hint.js","sourceRoot":"","sources":["../../../src/components/cat-form-hint/cat-form-hint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAuB,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAmBxE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAA0C,KAAK,CAAC,EAAE;EACxE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;EAClD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;EAC9C,OAAO,CACL,wBAAe,QAAQ,EAAC,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAC,cAAc,IAC3D,MAAM,CAAC,MAAM;IACZ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAC5B,SAAG,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,6BAA6B,IAAG,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,MAAM,CAAC,CAAK,CACpG,CAAC;IACJ,CAAC,CAAC;MACE,IAAI;QACF,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACrB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,SAAG,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,aAAa,IAAG,IAAI,CAAK,CAAC,CAC5E,CAAC,CAAC,CAAC,CACF,SAAG,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,aAAa,IAAG,IAAI,CAAK,CAC1D,CAAC;MACJ,WAAW;KACZ,CACD,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { h, FunctionalComponent } from '@stencil/core';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ErrorMap = { [key: string]: any };\n\n/**\n * Properties of CatFormHint.\n *\n * @property hint - Optional hint text(s) of the form field.\n * @property slottedHint - Optional hint element of the form field.\n */\ninterface CatFormHintProps {\n id: string;\n hint?: string | string[];\n slottedHint?: HTMLSlotElement;\n class?: string;\n errorMap?: ErrorMap;\n}\n\n/**\n * CatFormHint is a functional component that represents the hint area of form elements.\n *\n * @param props - {@link CatFormHintProps}\n * @return a JSX.Element\n */\nexport const CatFormHint: FunctionalComponent<CatFormHintProps> = props => {\n const { id, hint, slottedHint, errorMap } = props;\n const errors = Object.entries(errorMap || {});\n return (\n <div aria-live=\"polite\" id={id + '-hint'} class=\"hint-section\">\n {errors.length\n ? errors.map(([key, params]) => (\n <p class={(props.class ?? '') + ' input-hint cat-text-danger'}>{i18n.t(`error.${key}`, params)}</p>\n ))\n : [\n hint &&\n (Array.isArray(hint) ? (\n hint.map(item => <p class={(props.class ?? '') + ' input-hint'}>{item}</p>)\n ) : (\n <p class={(props.class ?? '') + ' input-hint'}>{hint}</p>\n )),\n slottedHint\n ]}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"cat-form-hint.js","sourceRoot":"","sources":["../../../src/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encil/core';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ErrorMap = { [key: string]: any };\n\n/**\n * Properties of CatFormHint.\n *\n * @property hint - Optional hint text(s) of the form field.\n * @property slottedHint - Optional hint element of the form field.\n */\ninterface CatFormHintProps {\n id: string;\n hint?: string | string[];\n slottedHint?: HTMLSlotElement;\n class?: string;\n errorMap?: ErrorMap;\n}\n\n/**\n * CatFormHint is a functional component that represents the hint area of form elements.\n *\n * @param props - {@link CatFormHintProps}\n * @return a JSX.Element\n */\nexport const CatFormHint: FunctionalComponent<CatFormHintProps> = props => {\n const { id, hint, slottedHint, errorMap } = props;\n const errors = Object.entries(errorMap || {});\n return (\n <div aria-live=\"polite\" id={id + '-hint'} class=\"hint-section\">\n {errors.length\n ? errors.map(([key, params]) => (\n <p class={(props.class ?? '') + ' input-hint cat-text-danger'}>{i18n.t(`error.${key}`, params)}</p>\n ))\n : [\n hint &&\n (Array.isArray(hint) ? (\n hint.map(item => <p class={(props.class ?? '') + ' input-hint'}>{item}</p>)\n ) : (\n <p class={(props.class ?? '') + ' input-hint'}>{hint}</p>\n )),\n slottedHint\n ]}\n </div>\n );\n};\n"]}
@@ -2,14 +2,14 @@ import { h } from "@stencil/core";
2
2
  import { newSpecPage } from "@stencil/core/testing";
3
3
  import { CatFormHint } from "./cat-form-hint";
4
4
  describe('CatFormHint', () => {
5
- it('renders', async () => {
6
- const page = await newSpecPage({
7
- components: [],
8
- template: () => h(CatFormHint, { id: "host-id" })
9
- });
10
- expect(page.root).toEqualHtml(`
5
+ it('renders', async () => {
6
+ const page = await newSpecPage({
7
+ components: [],
8
+ template: () => h(CatFormHint, { id: "host-id" })
9
+ });
10
+ expect(page.root).toEqualHtml(`
11
11
  <div class="hint-section" id="host-id-hint" aria-live="polite"></div>
12
12
  `);
13
- });
13
+ });
14
14
  });
15
15
  //# sourceMappingURL=cat-form-hint.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-form-hint.spec.js","sourceRoot":"","sources":["../../../src/components/cat-form-hint/cat-form-hint.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;EAC3B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,EAAE;MACd,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAC,WAAW,IAAC,EAAE,EAAC,SAAS,GAAe;KACzD,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;KAE7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { CatFormHint } from './cat-form-hint';\n\ndescribe('CatFormHint', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [],\n template: () => <CatFormHint id=\"host-id\"></CatFormHint>\n });\n expect(page.root).toEqualHtml(`\n <div class=\"hint-section\" id=\"host-id-hint\" aria-live=\"polite\"></div>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"cat-form-hint.spec.js","sourceRoot":"","sources":["../../../src/components/cat-form-hint/cat-form-hint.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAC,WAAW,IAAC,EAAE,EAAC,SAAS,GAAe;SACzD,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;KAE7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { CatFormHint } from './cat-form-hint';\n\ndescribe('CatFormHint', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [],\n template: () => <CatFormHint id=\"host-id\"></CatFormHint>\n });\n expect(page.root).toEqualHtml(`\n <div class=\"hint-section\" id=\"host-id-hint\" aria-live=\"polite\"></div>\n `);\n });\n});\n"]}