@haiilo/catalyst 0.5.4 → 0.5.7

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 (297) hide show
  1. package/README.md +1 -1
  2. package/dist/catalyst/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  3. package/dist/catalyst/assets/fonts/DMSans-Bold.woff2 +0 -0
  4. package/dist/catalyst/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  5. package/dist/catalyst/assets/fonts/DMSans-Italic.woff2 +0 -0
  6. package/dist/catalyst/assets/fonts/DMSans-Medium.woff2 +0 -0
  7. package/dist/catalyst/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  8. package/dist/catalyst/assets/fonts/DMSans-Regular.woff2 +0 -0
  9. package/dist/catalyst/assets/fonts/Lato-Black.woff +0 -0
  10. package/dist/catalyst/assets/fonts/Lato-Black.woff2 +0 -0
  11. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff +0 -0
  12. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  13. package/dist/catalyst/assets/fonts/Lato-Bold.woff +0 -0
  14. package/dist/catalyst/assets/fonts/Lato-Bold.woff2 +0 -0
  15. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff +0 -0
  16. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  17. package/dist/catalyst/assets/fonts/Lato-Hairline.woff +0 -0
  18. package/dist/catalyst/assets/fonts/Lato-Hairline.woff2 +0 -0
  19. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff +0 -0
  20. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  21. package/dist/catalyst/assets/fonts/Lato-Heavy.woff +0 -0
  22. package/dist/catalyst/assets/fonts/Lato-Heavy.woff2 +0 -0
  23. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff +0 -0
  24. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  25. package/dist/catalyst/assets/fonts/Lato-Italic.woff +0 -0
  26. package/dist/catalyst/assets/fonts/Lato-Italic.woff2 +0 -0
  27. package/dist/catalyst/assets/fonts/Lato-Light.woff +0 -0
  28. package/dist/catalyst/assets/fonts/Lato-Light.woff2 +0 -0
  29. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff +0 -0
  30. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff2 +0 -0
  31. package/dist/catalyst/assets/fonts/Lato-Medium.woff +0 -0
  32. package/dist/catalyst/assets/fonts/Lato-Medium.woff2 +0 -0
  33. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff +0 -0
  34. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  35. package/dist/catalyst/assets/fonts/Lato-Regular.woff +0 -0
  36. package/dist/catalyst/assets/fonts/Lato-Regular.woff2 +0 -0
  37. package/dist/catalyst/assets/fonts/Lato-Semibold.woff +0 -0
  38. package/dist/catalyst/assets/fonts/Lato-Semibold.woff2 +0 -0
  39. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  40. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  41. package/dist/catalyst/assets/fonts/Lato-Thin.woff +0 -0
  42. package/dist/catalyst/assets/fonts/Lato-Thin.woff2 +0 -0
  43. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff +0 -0
  44. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  45. package/dist/catalyst/catalyst.css +1 -0
  46. package/dist/catalyst/catalyst.esm.js +2 -0
  47. package/dist/catalyst/catalyst.esm.js.map +1 -0
  48. package/dist/catalyst/index.cdn.js +21 -0
  49. package/dist/catalyst/index.esm.js +2 -0
  50. package/dist/catalyst/index.esm.js.map +1 -0
  51. package/dist/catalyst/p-9a3c2375.js +2 -0
  52. package/dist/catalyst/p-9a3c2375.js.map +1 -0
  53. package/dist/catalyst/p-a6b8ebe9.entry.js +10 -0
  54. package/dist/catalyst/p-a6b8ebe9.entry.js.map +1 -0
  55. package/dist/catalyst/p-bfc656ca.js +2 -0
  56. package/dist/catalyst/p-bfc656ca.js.map +1 -0
  57. package/dist/catalyst/p-e82b63e9.js +2 -0
  58. package/dist/catalyst/p-e82b63e9.js.map +1 -0
  59. package/dist/cjs/app-globals-2a30d681.js +256 -0
  60. package/dist/cjs/app-globals-2a30d681.js.map +1 -0
  61. package/dist/cjs/cat-alert_15.cjs.entry.js +4651 -0
  62. package/dist/cjs/cat-alert_15.cjs.entry.js.map +1 -0
  63. package/dist/cjs/cat-icon-registry-b3a95a6b.js +442 -0
  64. package/dist/cjs/cat-icon-registry-b3a95a6b.js.map +1 -0
  65. package/dist/cjs/catalyst.cjs.js +24 -0
  66. package/dist/cjs/catalyst.cjs.js.map +1 -0
  67. package/dist/cjs/index-5d72f0e4.js +1347 -0
  68. package/dist/cjs/index-5d72f0e4.js.map +1 -0
  69. package/dist/cjs/index.cjs.js +12 -0
  70. package/dist/cjs/index.cjs.js.map +1 -0
  71. package/dist/cjs/loader.cjs.js +26 -0
  72. package/dist/cjs/loader.cjs.js.map +1 -0
  73. package/dist/collection/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  74. package/dist/collection/assets/fonts/DMSans-Bold.woff2 +0 -0
  75. package/dist/collection/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  76. package/dist/collection/assets/fonts/DMSans-Italic.woff2 +0 -0
  77. package/dist/collection/assets/fonts/DMSans-Medium.woff2 +0 -0
  78. package/dist/collection/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  79. package/dist/collection/assets/fonts/DMSans-Regular.woff2 +0 -0
  80. package/dist/collection/assets/fonts/Lato-Black.woff +0 -0
  81. package/dist/collection/assets/fonts/Lato-Black.woff2 +0 -0
  82. package/dist/collection/assets/fonts/Lato-BlackItalic.woff +0 -0
  83. package/dist/collection/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  84. package/dist/collection/assets/fonts/Lato-Bold.woff +0 -0
  85. package/dist/collection/assets/fonts/Lato-Bold.woff2 +0 -0
  86. package/dist/collection/assets/fonts/Lato-BoldItalic.woff +0 -0
  87. package/dist/collection/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  88. package/dist/collection/assets/fonts/Lato-Hairline.woff +0 -0
  89. package/dist/collection/assets/fonts/Lato-Hairline.woff2 +0 -0
  90. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff +0 -0
  91. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  92. package/dist/collection/assets/fonts/Lato-Heavy.woff +0 -0
  93. package/dist/collection/assets/fonts/Lato-Heavy.woff2 +0 -0
  94. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff +0 -0
  95. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  96. package/dist/collection/assets/fonts/Lato-Italic.woff +0 -0
  97. package/dist/collection/assets/fonts/Lato-Italic.woff2 +0 -0
  98. package/dist/collection/assets/fonts/Lato-Light.woff +0 -0
  99. package/dist/collection/assets/fonts/Lato-Light.woff2 +0 -0
  100. package/dist/collection/assets/fonts/Lato-LightItalic.woff +0 -0
  101. package/dist/collection/assets/fonts/Lato-LightItalic.woff2 +0 -0
  102. package/dist/collection/assets/fonts/Lato-Medium.woff +0 -0
  103. package/dist/collection/assets/fonts/Lato-Medium.woff2 +0 -0
  104. package/dist/collection/assets/fonts/Lato-MediumItalic.woff +0 -0
  105. package/dist/collection/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  106. package/dist/collection/assets/fonts/Lato-Regular.woff +0 -0
  107. package/dist/collection/assets/fonts/Lato-Regular.woff2 +0 -0
  108. package/dist/collection/assets/fonts/Lato-Semibold.woff +0 -0
  109. package/dist/collection/assets/fonts/Lato-Semibold.woff2 +0 -0
  110. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  111. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  112. package/dist/collection/assets/fonts/Lato-Thin.woff +0 -0
  113. package/dist/collection/assets/fonts/Lato-Thin.woff2 +0 -0
  114. package/dist/collection/assets/fonts/Lato-ThinItalic.woff +0 -0
  115. package/dist/collection/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  116. package/dist/collection/collection-manifest.json +27 -0
  117. package/dist/collection/components/cat-alert/cat-alert.css +61 -0
  118. package/dist/collection/components/cat-alert/cat-alert.js +61 -0
  119. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -0
  120. package/dist/collection/components/cat-badge/cat-badge.css +154 -0
  121. package/dist/collection/components/cat-badge/cat-badge.js +143 -0
  122. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -0
  123. package/dist/collection/components/cat-button/cat-button.css +333 -0
  124. package/dist/collection/components/cat-button/cat-button.js +615 -0
  125. package/dist/collection/components/cat-button/cat-button.js.map +1 -0
  126. package/dist/collection/components/cat-card/cat-card.css +24 -0
  127. package/dist/collection/components/cat-card/cat-card.js +20 -0
  128. package/dist/collection/components/cat-card/cat-card.js.map +1 -0
  129. package/dist/collection/components/cat-checkbox/cat-checkbox.css +105 -0
  130. package/dist/collection/components/cat-checkbox/cat-checkbox.js +314 -0
  131. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -0
  132. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +70 -0
  133. package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -0
  134. package/dist/collection/components/cat-icon/cat-icon-registry.js +55 -0
  135. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -0
  136. package/dist/collection/components/cat-icon/cat-icon.css +50 -0
  137. package/dist/collection/components/cat-icon/cat-icon.js +91 -0
  138. package/dist/collection/components/cat-icon/cat-icon.js.map +1 -0
  139. package/dist/collection/components/cat-input/cat-input.css +131 -0
  140. package/dist/collection/components/cat-input/cat-input.js +606 -0
  141. package/dist/collection/components/cat-input/cat-input.js.map +1 -0
  142. package/dist/collection/components/cat-menu/cat-menu.css +34 -0
  143. package/dist/collection/components/cat-menu/cat-menu.js +184 -0
  144. package/dist/collection/components/cat-menu/cat-menu.js.map +1 -0
  145. package/dist/collection/components/cat-radio/cat-radio.css +84 -0
  146. package/dist/collection/components/cat-radio/cat-radio.js +283 -0
  147. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -0
  148. package/dist/collection/components/cat-scrollable/cat-scrollable.css +69 -0
  149. package/dist/collection/components/cat-scrollable/cat-scrollable.js +311 -0
  150. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -0
  151. package/dist/collection/components/cat-skeleton/cat-skeleton.css +177 -0
  152. package/dist/collection/components/cat-skeleton/cat-skeleton.js +131 -0
  153. package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -0
  154. package/dist/collection/components/cat-spinner/cat-spinner.css +63 -0
  155. package/dist/collection/components/cat-spinner/cat-spinner.js +65 -0
  156. package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -0
  157. package/dist/collection/components/cat-textarea/cat-textarea.css +72 -0
  158. package/dist/collection/components/cat-textarea/cat-textarea.js +393 -0
  159. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -0
  160. package/dist/collection/components/cat-toggle/cat-toggle.css +93 -0
  161. package/dist/collection/components/cat-toggle/cat-toggle.js +283 -0
  162. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -0
  163. package/dist/collection/components/cat-tooltip/cat-tooltip.css +41 -0
  164. package/dist/collection/components/cat-tooltip/cat-tooltip.js +254 -0
  165. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -0
  166. package/dist/collection/index.cdn.js +21 -0
  167. package/dist/collection/index.js +3 -0
  168. package/dist/collection/index.js.map +1 -0
  169. package/dist/collection/init.js +17 -0
  170. package/dist/collection/init.js.map +1 -0
  171. package/dist/collection/utils/breakpoints.js +12 -0
  172. package/dist/collection/utils/breakpoints.js.map +1 -0
  173. package/dist/collection/utils/first-tabbable.js +6 -0
  174. package/dist/collection/utils/first-tabbable.js.map +1 -0
  175. package/dist/collection/utils/is-touch-screen.js +3 -0
  176. package/dist/collection/utils/is-touch-screen.js.map +1 -0
  177. package/dist/collection/utils/media-matcher.js +55 -0
  178. package/dist/collection/utils/media-matcher.js.map +1 -0
  179. package/dist/collection/utils/platform.js +50 -0
  180. package/dist/collection/utils/platform.js.map +1 -0
  181. package/dist/components/cat-alert.d.ts +11 -0
  182. package/dist/components/cat-alert.js +53 -0
  183. package/dist/components/cat-alert.js.map +1 -0
  184. package/dist/components/cat-badge.d.ts +11 -0
  185. package/dist/components/cat-badge.js +68 -0
  186. package/dist/components/cat-badge.js.map +1 -0
  187. package/dist/components/cat-button.d.ts +11 -0
  188. package/dist/components/cat-button.js +8 -0
  189. package/dist/components/cat-button.js.map +1 -0
  190. package/dist/components/cat-button2.js +346 -0
  191. package/dist/components/cat-button2.js.map +1 -0
  192. package/dist/components/cat-card.d.ts +11 -0
  193. package/dist/components/cat-card.js +35 -0
  194. package/dist/components/cat-card.js.map +1 -0
  195. package/dist/components/cat-checkbox.d.ts +11 -0
  196. package/dist/components/cat-checkbox.js +103 -0
  197. package/dist/components/cat-checkbox.js.map +1 -0
  198. package/dist/components/cat-i18n-registry.js +74 -0
  199. package/dist/components/cat-i18n-registry.js.map +1 -0
  200. package/dist/components/cat-icon-registry.js +59 -0
  201. package/dist/components/cat-icon-registry.js.map +1 -0
  202. package/dist/components/cat-icon.d.ts +11 -0
  203. package/dist/components/cat-icon.js +8 -0
  204. package/dist/components/cat-icon.js.map +1 -0
  205. package/dist/components/cat-icon2.js +49 -0
  206. package/dist/components/cat-icon2.js.map +1 -0
  207. package/dist/components/cat-input.d.ts +11 -0
  208. package/dist/components/cat-input.js +172 -0
  209. package/dist/components/cat-input.js.map +1 -0
  210. package/dist/components/cat-menu.d.ts +11 -0
  211. package/dist/components/cat-menu.js +870 -0
  212. package/dist/components/cat-menu.js.map +1 -0
  213. package/dist/components/cat-radio.d.ts +11 -0
  214. package/dist/components/cat-radio.js +93 -0
  215. package/dist/components/cat-radio.js.map +1 -0
  216. package/dist/components/cat-scrollable.d.ts +11 -0
  217. package/dist/components/cat-scrollable.js +1362 -0
  218. package/dist/components/cat-scrollable.js.map +1 -0
  219. package/dist/components/cat-skeleton.d.ts +11 -0
  220. package/dist/components/cat-skeleton.js +78 -0
  221. package/dist/components/cat-skeleton.js.map +1 -0
  222. package/dist/components/cat-spinner.d.ts +11 -0
  223. package/dist/components/cat-spinner.js +8 -0
  224. package/dist/components/cat-spinner.js.map +1 -0
  225. package/dist/components/cat-spinner2.js +41 -0
  226. package/dist/components/cat-spinner2.js.map +1 -0
  227. package/dist/components/cat-textarea.d.ts +11 -0
  228. package/dist/components/cat-textarea.js +119 -0
  229. package/dist/components/cat-textarea.js.map +1 -0
  230. package/dist/components/cat-toggle.d.ts +11 -0
  231. package/dist/components/cat-toggle.js +93 -0
  232. package/dist/components/cat-toggle.js.map +1 -0
  233. package/dist/components/cat-tooltip.d.ts +11 -0
  234. package/dist/components/cat-tooltip.js +154 -0
  235. package/dist/components/cat-tooltip.js.map +1 -0
  236. package/dist/components/first-tabbable.js +1495 -0
  237. package/dist/components/first-tabbable.js.map +1 -0
  238. package/dist/components/index.d.ts +26 -0
  239. package/dist/components/index.js +258 -0
  240. package/dist/components/index.js.map +1 -0
  241. package/dist/components/loglevel.js +315 -0
  242. package/dist/components/loglevel.js.map +1 -0
  243. package/dist/esm/app-globals-77cd8c8e.js +254 -0
  244. package/dist/esm/app-globals-77cd8c8e.js.map +1 -0
  245. package/dist/esm/cat-alert_15.entry.js +4633 -0
  246. package/dist/esm/cat-alert_15.entry.js.map +1 -0
  247. package/dist/esm/cat-icon-registry-a7acd6f7.js +438 -0
  248. package/dist/esm/cat-icon-registry-a7acd6f7.js.map +1 -0
  249. package/dist/esm/catalyst.js +22 -0
  250. package/dist/esm/catalyst.js.map +1 -0
  251. package/dist/esm/index-fd12be19.js +1320 -0
  252. package/dist/esm/index-fd12be19.js.map +1 -0
  253. package/dist/esm/index.js +3 -0
  254. package/dist/esm/index.js.map +1 -0
  255. package/dist/esm/loader.js +22 -0
  256. package/dist/esm/loader.js.map +1 -0
  257. package/dist/esm/polyfills/core-js.js +11 -0
  258. package/dist/esm/polyfills/css-shim.js +1 -0
  259. package/dist/esm/polyfills/dom.js +79 -0
  260. package/dist/esm/polyfills/es5-html-element.js +1 -0
  261. package/dist/esm/polyfills/index.js +34 -0
  262. package/dist/esm/polyfills/system.js +6 -0
  263. package/dist/index.cjs.js +1 -0
  264. package/dist/index.js +1 -0
  265. package/dist/types/components/cat-alert/cat-alert.d.ts +14 -0
  266. package/dist/types/components/cat-badge/cat-badge.d.ts +29 -0
  267. package/dist/types/components/cat-button/cat-button.d.ts +134 -0
  268. package/dist/types/components/cat-card/cat-card.d.ts +7 -0
  269. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +69 -0
  270. package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +18 -0
  271. package/dist/types/components/cat-icon/cat-icon-registry.d.ts +15 -0
  272. package/dist/types/components/cat-icon/cat-icon.d.ts +23 -0
  273. package/dist/types/components/cat-input/cat-input.d.ts +130 -0
  274. package/dist/types/components/cat-menu/cat-menu.d.ts +31 -0
  275. package/dist/types/components/cat-radio/cat-radio.d.ts +63 -0
  276. package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +52 -0
  277. package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +28 -0
  278. package/dist/types/components/cat-spinner/cat-spinner.d.ts +15 -0
  279. package/dist/types/components/cat-textarea/cat-textarea.d.ts +85 -0
  280. package/dist/types/components/cat-toggle/cat-toggle.d.ts +64 -0
  281. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +46 -0
  282. package/dist/types/components.d.ts +1167 -0
  283. package/dist/types/index.d.ts +3 -0
  284. package/dist/types/init.d.ts +1 -0
  285. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  286. package/dist/types/utils/breakpoints.d.ts +7 -0
  287. package/dist/types/utils/first-tabbable.d.ts +4 -0
  288. package/dist/types/utils/is-touch-screen.d.ts +2 -0
  289. package/dist/types/utils/media-matcher.d.ts +13 -0
  290. package/dist/types/utils/platform.d.ts +18 -0
  291. package/loader/cdn.js +3 -0
  292. package/loader/index.cjs.js +3 -0
  293. package/loader/index.d.ts +12 -0
  294. package/loader/index.es2017.js +3 -0
  295. package/loader/index.js +4 -0
  296. package/loader/package.json +10 -0
  297. package/package.json +2 -2
@@ -0,0 +1,615 @@
1
+ import { Component, Event, h, Listen, Method, Prop, State, Watch } from '@stencil/core';
2
+ import log from 'loglevel';
3
+ import { Breakpoints, isBreakpoint } from '../../utils/breakpoints';
4
+ import { MediaMatcher } from '../../utils/media-matcher';
5
+ /**
6
+ * Buttons are used for interface actions. Primary style should be used only
7
+ * once per view for main call-to-action.
8
+ *
9
+ * @part button - The native anchor or button element.
10
+ * @part content - The textual content of the button.
11
+ * @part prefix - The prefix icon.
12
+ * @part suffix - The suffix icon.
13
+ */
14
+ export class CatButton {
15
+ constructor() {
16
+ this._iconOnly = true;
17
+ /**
18
+ * The rendering style of the button.
19
+ */
20
+ this.variant = 'outlined';
21
+ /**
22
+ * The color palette of the button.
23
+ */
24
+ this.color = 'secondary';
25
+ /**
26
+ * Show an active status indicator on the left side of the button.
27
+ */
28
+ this.active = false;
29
+ /**
30
+ * The size of the button.
31
+ */
32
+ this.size = 'm';
33
+ /**
34
+ * Specifies that the button should be disabled. A disabled button is unusable
35
+ * and un-clickable. Corresponds with the native HTML disabled attribute.
36
+ */
37
+ this.disabled = false;
38
+ /**
39
+ * Displays the button in a loading state with a spinner. Just like a disabled
40
+ * button, an inactive button is unusable and un-clickable. However, it
41
+ * retains the current focus state.
42
+ */
43
+ this.loading = false;
44
+ /**
45
+ * Allows the button to submit a form.
46
+ */
47
+ this.submit = false;
48
+ /**
49
+ * Ellipse overflowing button content.
50
+ */
51
+ this.ellipsed = true;
52
+ /**
53
+ * Use round button edges.
54
+ */
55
+ this.round = false;
56
+ /**
57
+ * Hide the actual button content and only display the icon.
58
+ */
59
+ this.iconOnly = false;
60
+ /**
61
+ * Display the icon on the right.
62
+ */
63
+ this.iconRight = false;
64
+ }
65
+ onIconOnlyChanged(value) {
66
+ var _a, _b;
67
+ // teardown
68
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
69
+ (_a = this.mediaQueryList) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', this.mediaQueryListener);
70
+ this.mediaQueryList = undefined;
71
+ this.mediaQueryListener = undefined;
72
+ // setup
73
+ if (isBreakpoint(value)) {
74
+ (_b = this.mediaMatcher) !== null && _b !== void 0 ? _b : (this.mediaMatcher = new MediaMatcher());
75
+ this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);
76
+ this.mediaQueryListener = (event) => (this._iconOnly = event.matches);
77
+ this.mediaQueryList.addEventListener('change', this.mediaQueryListener);
78
+ this._iconOnly = this.mediaQueryList.matches;
79
+ }
80
+ else {
81
+ this._iconOnly = value;
82
+ }
83
+ }
84
+ componentWillLoad() {
85
+ this.onIconOnlyChanged(this.iconOnly);
86
+ }
87
+ componentWillRender() {
88
+ if (this.isIconButton && !this.a11yLabel) {
89
+ log.warn('[A11y] Missing ARIA label on icon button', this);
90
+ }
91
+ }
92
+ haltDisabledEvents(event) {
93
+ if (this.disabled || this.loading) {
94
+ event.preventDefault();
95
+ event.stopImmediatePropagation();
96
+ }
97
+ }
98
+ /**
99
+ * Sets focus on the button. Use this method instead of `button.focus()`.
100
+ *
101
+ * @param options An optional object providing options to control aspects of
102
+ * the focusing process.
103
+ */
104
+ async setFocus(options) {
105
+ this.button.focus(options);
106
+ }
107
+ render() {
108
+ var _a;
109
+ if (this.url) {
110
+ return (h("a", { ref: el => (this.button = el), href: this.disabled ? undefined : this.url, target: this.urlTarget, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
111
+ 'cat-button': true,
112
+ 'cat-button-icon': this.isIconButton,
113
+ 'cat-button-round': this.round,
114
+ 'cat-button-loading': this.loading,
115
+ 'cat-button-disabled': this.disabled,
116
+ 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,
117
+ [`cat-button-${this.variant}`]: Boolean(this.variant),
118
+ [`cat-button-${this.color}`]: Boolean(this.color),
119
+ [`cat-button-${this.size}`]: Boolean(this.size)
120
+ }, onClick: this.onClick.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
121
+ }
122
+ else {
123
+ return (h("button", { ref: el => (this.button = el), type: this.submit ? 'submit' : 'button', name: this.name, value: this.value, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
124
+ 'cat-button': true,
125
+ 'cat-button-active': this.active,
126
+ 'cat-button-icon': this.isIconButton,
127
+ 'cat-button-round': (_a = this.round) !== null && _a !== void 0 ? _a : this.isIconButton,
128
+ 'cat-button-loading': this.loading,
129
+ 'cat-button-disabled': this.disabled,
130
+ 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,
131
+ [`cat-button-${this.variant}`]: Boolean(this.variant),
132
+ [`cat-button-${this.color}`]: Boolean(this.color),
133
+ [`cat-button-${this.size}`]: Boolean(this.size)
134
+ }, onClick: this.onClick.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
135
+ }
136
+ }
137
+ get iconSize() {
138
+ switch (this.size) {
139
+ case 'xs':
140
+ return 's';
141
+ default:
142
+ return 'l';
143
+ }
144
+ }
145
+ get spinnerSize() {
146
+ switch (this.size) {
147
+ case 'xs':
148
+ return 'xs';
149
+ default:
150
+ return 'm';
151
+ }
152
+ }
153
+ get isIconButton() {
154
+ return Boolean(this.icon) && this._iconOnly;
155
+ }
156
+ get hasPrefixIcon() {
157
+ return Boolean(this.icon) && !this._iconOnly && !this.iconRight;
158
+ }
159
+ get hasSuffixIcon() {
160
+ return Boolean(this.icon) && !this._iconOnly && this.iconRight;
161
+ }
162
+ get content() {
163
+ return [
164
+ this.hasPrefixIcon ? (h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-prefix", part: "prefix" })) : null,
165
+ this.isIconButton ? (h("cat-icon", { icon: this.icon, size: this.iconSize })) : (h("span", { class: "cat-button-content", part: "content" },
166
+ h("slot", null))),
167
+ this.hasSuffixIcon ? (h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-suffix", part: "suffix" })) : null,
168
+ this.loading ? h("cat-spinner", { size: this.spinnerSize }) : null
169
+ ];
170
+ }
171
+ onClick(event) {
172
+ this.catClick.emit(event);
173
+ }
174
+ onFocus(event) {
175
+ this.catFocus.emit(event);
176
+ }
177
+ onBlur(event) {
178
+ this.catBlur.emit(event);
179
+ }
180
+ static get is() { return "cat-button"; }
181
+ static get encapsulation() { return "shadow"; }
182
+ static get originalStyleUrls() { return {
183
+ "$": ["cat-button.scss"]
184
+ }; }
185
+ static get styleUrls() { return {
186
+ "$": ["cat-button.css"]
187
+ }; }
188
+ static get properties() { return {
189
+ "variant": {
190
+ "type": "string",
191
+ "mutable": false,
192
+ "complexType": {
193
+ "original": "'filled' | 'outlined' | 'text'",
194
+ "resolved": "\"filled\" | \"outlined\" | \"text\"",
195
+ "references": {}
196
+ },
197
+ "required": false,
198
+ "optional": false,
199
+ "docs": {
200
+ "tags": [],
201
+ "text": "The rendering style of the button."
202
+ },
203
+ "attribute": "variant",
204
+ "reflect": false,
205
+ "defaultValue": "'outlined'"
206
+ },
207
+ "color": {
208
+ "type": "string",
209
+ "mutable": false,
210
+ "complexType": {
211
+ "original": "'primary' | 'secondary' | 'danger' | 'success' | 'warning'",
212
+ "resolved": "\"danger\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"",
213
+ "references": {}
214
+ },
215
+ "required": false,
216
+ "optional": false,
217
+ "docs": {
218
+ "tags": [],
219
+ "text": "The color palette of the button."
220
+ },
221
+ "attribute": "color",
222
+ "reflect": false,
223
+ "defaultValue": "'secondary'"
224
+ },
225
+ "active": {
226
+ "type": "boolean",
227
+ "mutable": false,
228
+ "complexType": {
229
+ "original": "boolean",
230
+ "resolved": "boolean",
231
+ "references": {}
232
+ },
233
+ "required": false,
234
+ "optional": false,
235
+ "docs": {
236
+ "tags": [],
237
+ "text": "Show an active status indicator on the left side of the button."
238
+ },
239
+ "attribute": "active",
240
+ "reflect": false,
241
+ "defaultValue": "false"
242
+ },
243
+ "size": {
244
+ "type": "string",
245
+ "mutable": false,
246
+ "complexType": {
247
+ "original": "'xs' | 's' | 'm' | 'l' | 'xl'",
248
+ "resolved": "\"l\" | \"m\" | \"s\" | \"xl\" | \"xs\"",
249
+ "references": {}
250
+ },
251
+ "required": false,
252
+ "optional": false,
253
+ "docs": {
254
+ "tags": [],
255
+ "text": "The size of the button."
256
+ },
257
+ "attribute": "size",
258
+ "reflect": false,
259
+ "defaultValue": "'m'"
260
+ },
261
+ "name": {
262
+ "type": "string",
263
+ "mutable": false,
264
+ "complexType": {
265
+ "original": "string",
266
+ "resolved": "string | undefined",
267
+ "references": {}
268
+ },
269
+ "required": false,
270
+ "optional": true,
271
+ "docs": {
272
+ "tags": [],
273
+ "text": "The name of the button, which gets paired with the button's value when\nsubmitted as part of a form. Corresponds with the native HTML name\nattribute."
274
+ },
275
+ "attribute": "name",
276
+ "reflect": false
277
+ },
278
+ "value": {
279
+ "type": "string",
280
+ "mutable": false,
281
+ "complexType": {
282
+ "original": "string",
283
+ "resolved": "string | undefined",
284
+ "references": {}
285
+ },
286
+ "required": false,
287
+ "optional": true,
288
+ "docs": {
289
+ "tags": [],
290
+ "text": "The value of the button, which gets paired with the button's name when\nsubmitted as part of a form. Corresponds with the native HTML value\nattribute."
291
+ },
292
+ "attribute": "value",
293
+ "reflect": false
294
+ },
295
+ "disabled": {
296
+ "type": "boolean",
297
+ "mutable": false,
298
+ "complexType": {
299
+ "original": "boolean",
300
+ "resolved": "boolean",
301
+ "references": {}
302
+ },
303
+ "required": false,
304
+ "optional": false,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": "Specifies that the button should be disabled. A disabled button is unusable\nand un-clickable. Corresponds with the native HTML disabled attribute."
308
+ },
309
+ "attribute": "disabled",
310
+ "reflect": false,
311
+ "defaultValue": "false"
312
+ },
313
+ "loading": {
314
+ "type": "boolean",
315
+ "mutable": false,
316
+ "complexType": {
317
+ "original": "boolean",
318
+ "resolved": "boolean",
319
+ "references": {}
320
+ },
321
+ "required": false,
322
+ "optional": false,
323
+ "docs": {
324
+ "tags": [],
325
+ "text": "Displays the button in a loading state with a spinner. Just like a disabled\nbutton, an inactive button is unusable and un-clickable. However, it\nretains the current focus state."
326
+ },
327
+ "attribute": "loading",
328
+ "reflect": false,
329
+ "defaultValue": "false"
330
+ },
331
+ "submit": {
332
+ "type": "boolean",
333
+ "mutable": false,
334
+ "complexType": {
335
+ "original": "boolean",
336
+ "resolved": "boolean",
337
+ "references": {}
338
+ },
339
+ "required": false,
340
+ "optional": false,
341
+ "docs": {
342
+ "tags": [],
343
+ "text": "Allows the button to submit a form."
344
+ },
345
+ "attribute": "submit",
346
+ "reflect": false,
347
+ "defaultValue": "false"
348
+ },
349
+ "ellipsed": {
350
+ "type": "boolean",
351
+ "mutable": false,
352
+ "complexType": {
353
+ "original": "boolean",
354
+ "resolved": "boolean",
355
+ "references": {}
356
+ },
357
+ "required": false,
358
+ "optional": false,
359
+ "docs": {
360
+ "tags": [],
361
+ "text": "Ellipse overflowing button content."
362
+ },
363
+ "attribute": "ellipsed",
364
+ "reflect": false,
365
+ "defaultValue": "true"
366
+ },
367
+ "round": {
368
+ "type": "boolean",
369
+ "mutable": false,
370
+ "complexType": {
371
+ "original": "boolean",
372
+ "resolved": "boolean",
373
+ "references": {}
374
+ },
375
+ "required": false,
376
+ "optional": false,
377
+ "docs": {
378
+ "tags": [],
379
+ "text": "Use round button edges."
380
+ },
381
+ "attribute": "round",
382
+ "reflect": false,
383
+ "defaultValue": "false"
384
+ },
385
+ "url": {
386
+ "type": "string",
387
+ "mutable": false,
388
+ "complexType": {
389
+ "original": "string",
390
+ "resolved": "string | undefined",
391
+ "references": {}
392
+ },
393
+ "required": false,
394
+ "optional": true,
395
+ "docs": {
396
+ "tags": [],
397
+ "text": "A destination to link to, rendered in the href attribute of a link."
398
+ },
399
+ "attribute": "url",
400
+ "reflect": false
401
+ },
402
+ "urlTarget": {
403
+ "type": "string",
404
+ "mutable": false,
405
+ "complexType": {
406
+ "original": "'_blank' | '_self'",
407
+ "resolved": "\"_blank\" | \"_self\" | undefined",
408
+ "references": {}
409
+ },
410
+ "required": false,
411
+ "optional": true,
412
+ "docs": {
413
+ "tags": [],
414
+ "text": "Specifies where to open the linked document."
415
+ },
416
+ "attribute": "url-target",
417
+ "reflect": false
418
+ },
419
+ "icon": {
420
+ "type": "string",
421
+ "mutable": false,
422
+ "complexType": {
423
+ "original": "string",
424
+ "resolved": "string | undefined",
425
+ "references": {}
426
+ },
427
+ "required": false,
428
+ "optional": true,
429
+ "docs": {
430
+ "tags": [],
431
+ "text": "The name of an icon to be displayed in the button."
432
+ },
433
+ "attribute": "icon",
434
+ "reflect": false
435
+ },
436
+ "iconOnly": {
437
+ "type": "any",
438
+ "mutable": false,
439
+ "complexType": {
440
+ "original": "boolean | Breakpoint",
441
+ "resolved": "\"l\" | \"m\" | \"s\" | \"xl\" | \"xs\" | boolean",
442
+ "references": {
443
+ "Breakpoint": {
444
+ "location": "import",
445
+ "path": "../../utils/breakpoints"
446
+ }
447
+ }
448
+ },
449
+ "required": false,
450
+ "optional": false,
451
+ "docs": {
452
+ "tags": [],
453
+ "text": "Hide the actual button content and only display the icon."
454
+ },
455
+ "attribute": "icon-only",
456
+ "reflect": false,
457
+ "defaultValue": "false"
458
+ },
459
+ "iconRight": {
460
+ "type": "boolean",
461
+ "mutable": false,
462
+ "complexType": {
463
+ "original": "boolean",
464
+ "resolved": "boolean",
465
+ "references": {}
466
+ },
467
+ "required": false,
468
+ "optional": false,
469
+ "docs": {
470
+ "tags": [],
471
+ "text": "Display the icon on the right."
472
+ },
473
+ "attribute": "icon-right",
474
+ "reflect": false,
475
+ "defaultValue": "false"
476
+ },
477
+ "buttonId": {
478
+ "type": "string",
479
+ "mutable": false,
480
+ "complexType": {
481
+ "original": "string",
482
+ "resolved": "string | undefined",
483
+ "references": {}
484
+ },
485
+ "required": false,
486
+ "optional": true,
487
+ "docs": {
488
+ "tags": [],
489
+ "text": "Adds a unique identifier for the button. Please note that with this\nparticular component this ID is added inside the web component. If you need\nan ID on the HTML element, use the regular `id` attribute instead."
490
+ },
491
+ "attribute": "button-id",
492
+ "reflect": false
493
+ },
494
+ "a11yLabel": {
495
+ "type": "string",
496
+ "mutable": false,
497
+ "complexType": {
498
+ "original": "string",
499
+ "resolved": "string | undefined",
500
+ "references": {}
501
+ },
502
+ "required": false,
503
+ "optional": true,
504
+ "docs": {
505
+ "tags": [],
506
+ "text": "Adds accessible label for the button that is only shown for screen\nreaders. Typically, this label text replaces the visible text on the\nbutton for users who use assistive technology."
507
+ },
508
+ "attribute": "a11y-label",
509
+ "reflect": false
510
+ }
511
+ }; }
512
+ static get states() { return {
513
+ "_iconOnly": {}
514
+ }; }
515
+ static get events() { return [{
516
+ "method": "catClick",
517
+ "name": "catClick",
518
+ "bubbles": true,
519
+ "cancelable": true,
520
+ "composed": true,
521
+ "docs": {
522
+ "tags": [],
523
+ "text": "Emitted when the button is clicked."
524
+ },
525
+ "complexType": {
526
+ "original": "MouseEvent",
527
+ "resolved": "MouseEvent",
528
+ "references": {
529
+ "MouseEvent": {
530
+ "location": "global"
531
+ }
532
+ }
533
+ }
534
+ }, {
535
+ "method": "catFocus",
536
+ "name": "catFocus",
537
+ "bubbles": true,
538
+ "cancelable": true,
539
+ "composed": true,
540
+ "docs": {
541
+ "tags": [],
542
+ "text": "Emitted when the button received focus."
543
+ },
544
+ "complexType": {
545
+ "original": "FocusEvent",
546
+ "resolved": "FocusEvent",
547
+ "references": {
548
+ "FocusEvent": {
549
+ "location": "global"
550
+ }
551
+ }
552
+ }
553
+ }, {
554
+ "method": "catBlur",
555
+ "name": "catBlur",
556
+ "bubbles": true,
557
+ "cancelable": true,
558
+ "composed": true,
559
+ "docs": {
560
+ "tags": [],
561
+ "text": "Emitted when the button loses focus."
562
+ },
563
+ "complexType": {
564
+ "original": "FocusEvent",
565
+ "resolved": "FocusEvent",
566
+ "references": {
567
+ "FocusEvent": {
568
+ "location": "global"
569
+ }
570
+ }
571
+ }
572
+ }]; }
573
+ static get methods() { return {
574
+ "setFocus": {
575
+ "complexType": {
576
+ "signature": "(options?: FocusOptions | undefined) => Promise<void>",
577
+ "parameters": [{
578
+ "tags": [{
579
+ "name": "param",
580
+ "text": "options An optional object providing options to control aspects of\nthe focusing process."
581
+ }],
582
+ "text": "An optional object providing options to control aspects of\nthe focusing process."
583
+ }],
584
+ "references": {
585
+ "Promise": {
586
+ "location": "global"
587
+ },
588
+ "FocusOptions": {
589
+ "location": "global"
590
+ }
591
+ },
592
+ "return": "Promise<void>"
593
+ },
594
+ "docs": {
595
+ "text": "Sets focus on the button. Use this method instead of `button.focus()`.",
596
+ "tags": [{
597
+ "name": "param",
598
+ "text": "options An optional object providing options to control aspects of\nthe focusing process."
599
+ }]
600
+ }
601
+ }
602
+ }; }
603
+ static get watchers() { return [{
604
+ "propName": "iconOnly",
605
+ "methodName": "onIconOnlyChanged"
606
+ }]; }
607
+ static get listeners() { return [{
608
+ "name": "click",
609
+ "method": "haltDisabledEvents",
610
+ "target": undefined,
611
+ "capture": false,
612
+ "passive": false
613
+ }]; }
614
+ }
615
+ //# sourceMappingURL=cat-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cat-button.js","sourceRoot":"","sources":["../../../src/components/cat-button/cat-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAc,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA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CAAC;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { Breakpoint, Breakpoints, isBreakpoint } from '../../utils/breakpoints';\nimport { MediaMatcher } from '../../utils/media-matcher';\n\n/**\n * Buttons are used for interface actions. Primary style should be used only\n * once per view for main call-to-action.\n *\n * @part button - The native anchor or button element.\n * @part content - The textual content of the button.\n * @part prefix - The prefix icon.\n * @part suffix - The suffix icon.\n */\n@Component({\n tag: 'cat-button',\n styleUrl: 'cat-button.scss',\n shadow: true\n})\nexport class CatButton {\n private button!: HTMLButtonElement | HTMLAnchorElement;\n private mediaMatcher?: MediaMatcher;\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n @State() _iconOnly = true;\n\n /**\n * The rendering style of the button.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'outlined';\n\n /**\n * The color palette of the button.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'secondary';\n\n /**\n * Show an active status indicator on the left side of the button.\n */\n @Prop() active = false;\n\n /**\n * The size of the button.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The name of the button, which gets paired with the button's value when\n * submitted as part of a form. Corresponds with the native HTML name\n * attribute.\n */\n @Prop() name?: string;\n\n /**\n * The value of the button, which gets paired with the button's name when\n * submitted as part of a form. Corresponds with the native HTML value\n * attribute.\n */\n @Prop() value?: string;\n\n /**\n * Specifies that the button should be disabled. A disabled button is unusable\n * and un-clickable. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * Displays the button in a loading state with a spinner. Just like a disabled\n * button, an inactive button is unusable and un-clickable. However, it\n * retains the current focus state.\n */\n @Prop() loading = false;\n\n /**\n * Allows the button to submit a form.\n */\n @Prop() submit = false;\n\n /**\n * Ellipse overflowing button content.\n */\n @Prop() ellipsed = true;\n\n /**\n * Use round button edges.\n */\n @Prop() round = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop() url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop() urlTarget?: '_blank' | '_self';\n\n /**\n * The name of an icon to be displayed in the button.\n */\n @Prop() icon?: string;\n\n /**\n * Hide the actual button content and only display the icon.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * Adds a unique identifier for the button. Please note that with this\n * particular component this ID is added inside the web component. If you need\n * an ID on the HTML element, use the regular `id` attribute instead.\n */\n @Prop() buttonId?: string;\n\n /**\n * Adds accessible label for the button that is only shown for screen\n * readers. Typically, this label text replaces the visible text on the\n * button for users who use assistive technology.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n @Watch('iconOnly')\n onIconOnlyChanged(value: boolean | Breakpoint): void {\n // teardown\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.mediaQueryList?.removeEventListener('change', this.mediaQueryListener!);\n this.mediaQueryList = undefined;\n this.mediaQueryListener = undefined;\n // setup\n if (isBreakpoint(value)) {\n this.mediaMatcher ??= new MediaMatcher();\n this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);\n this.mediaQueryListener = (event: MediaQueryListEvent) => (this._iconOnly = event.matches);\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n this._iconOnly = this.mediaQueryList.matches;\n } else {\n this._iconOnly = value;\n }\n }\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() catClick!: EventEmitter<MouseEvent>;\n\n /**\n * Emitted when the button received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the button loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad(): void {\n this.onIconOnlyChanged(this.iconOnly);\n }\n\n componentWillRender(): void {\n if (this.isIconButton && !this.a11yLabel) {\n log.warn('[A11y] Missing ARIA label on icon button', this);\n }\n }\n\n @Listen('click')\n haltDisabledEvents(event: Event): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n /**\n * Sets focus on the button. Use this method instead of `button.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.button.focus(options);\n }\n\n render() {\n if (this.url) {\n return (\n <a\n ref={el => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? undefined : this.url}\n target={this.urlTarget}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </a>\n );\n } else {\n return (\n <button\n ref={el => (this.button = el as HTMLButtonElement)}\n type={this.submit ? 'submit' : 'button'}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-active': this.active,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round ?? this.isIconButton,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </button>\n );\n }\n }\n\n private get iconSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 's';\n default:\n return 'l';\n }\n }\n\n private get spinnerSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 'xs';\n default:\n return 'm';\n }\n }\n\n private get isIconButton() {\n return Boolean(this.icon) && this._iconOnly;\n }\n\n private get hasPrefixIcon() {\n return Boolean(this.icon) && !this._iconOnly && !this.iconRight;\n }\n\n private get hasSuffixIcon() {\n return Boolean(this.icon) && !this._iconOnly && this.iconRight;\n }\n\n private get content() {\n return [\n this.hasPrefixIcon ? (\n <cat-icon icon={this.icon} size={this.iconSize} class=\"cat-button-prefix\" part=\"prefix\"></cat-icon>\n ) : null,\n this.isIconButton ? (\n <cat-icon icon={this.icon} size={this.iconSize}></cat-icon>\n ) : (\n <span class=\"cat-button-content\" part=\"content\">\n <slot></slot>\n </span>\n ),\n this.hasSuffixIcon ? (\n <cat-icon icon={this.icon} size={this.iconSize} class=\"cat-button-suffix\" part=\"suffix\"></cat-icon>\n ) : null,\n this.loading ? <cat-spinner size={this.spinnerSize}></cat-spinner> : null\n ];\n }\n\n private onClick(event: MouseEvent) {\n this.catClick.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Auto-generated file. Do not edit directly.
3
+ */
4
+ /* stylelint-disable value-keyword-case */
5
+ /* stylelint-enable value-keyword-case */
6
+ :host {
7
+ display: block;
8
+ margin-bottom: 1rem;
9
+ border-radius: 0.5rem;
10
+ background-color: white;
11
+ padding: 1.5rem;
12
+ }
13
+
14
+ :host([hidden]) {
15
+ display: none;
16
+ }
17
+
18
+ ::slotted(nav) {
19
+ margin: -1rem -1.5rem !important;
20
+ }
21
+
22
+ ::slotted(:last-child) {
23
+ margin-bottom: 0;
24
+ }