@haiilo/catalyst 7.0.0 → 7.1.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 (78) hide show
  1. package/dist/catalyst/catalyst.css +138 -21
  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 +1 -1
  5. package/dist/catalyst/p-44042184.entry.js +10 -0
  6. package/dist/catalyst/p-44042184.entry.js.map +1 -0
  7. package/dist/catalyst/p-85d057f0.js +2 -0
  8. package/dist/catalyst/p-85d057f0.js.map +1 -0
  9. package/dist/catalyst/scss/core/_form.scss +6 -0
  10. package/dist/catalyst/scss/core/_typography.scss +19 -18
  11. package/dist/catalyst/scss/utils/_color.scss +24 -0
  12. package/dist/cjs/cat-alert_26.cjs.entry.js +13 -9
  13. package/dist/cjs/cat-alert_26.cjs.entry.js.map +1 -1
  14. package/dist/cjs/catalyst.cjs.js +1 -1
  15. package/dist/cjs/index.cjs.js +1 -1
  16. package/dist/cjs/loader.cjs.js +1 -1
  17. package/dist/cjs/{of-8545b523.js → of-395b2f57.js} +6 -2
  18. package/dist/cjs/of-395b2f57.js.map +1 -0
  19. package/dist/collection/components/cat-alert/cat-alert.css +29 -0
  20. package/dist/collection/components/cat-alert/cat-alert.js +2 -0
  21. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  22. package/dist/collection/components/cat-badge/cat-badge.css +6 -0
  23. package/dist/collection/components/cat-badge/cat-badge.js +2 -2
  24. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
  25. package/dist/collection/components/cat-button/cat-button.css +17 -0
  26. package/dist/collection/components/cat-button/cat-button.js +2 -2
  27. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  28. package/dist/collection/components/cat-checkbox/cat-checkbox.js +27 -9
  29. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  30. package/dist/collection/components/cat-icon/cat-icon-registry.js +3 -1
  31. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
  32. package/dist/collection/components/cat-input/cat-input.css +107 -0
  33. package/dist/collection/components/cat-select/cat-select.css +107 -0
  34. package/dist/collection/components/cat-select/cat-select.js +4 -4
  35. package/dist/collection/components/cat-textarea/cat-textarea.css +107 -0
  36. package/dist/collection/components/cat-toggle/cat-toggle.js +28 -10
  37. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  38. package/dist/collection/scss/core/_form.scss +6 -0
  39. package/dist/collection/scss/core/_typography.scss +19 -18
  40. package/dist/collection/scss/utils/_color.scss +24 -0
  41. package/dist/components/cat-alert.js +3 -1
  42. package/dist/components/cat-alert.js.map +1 -1
  43. package/dist/components/cat-badge.js +1 -1
  44. package/dist/components/cat-badge.js.map +1 -1
  45. package/dist/components/cat-button2.js +1 -1
  46. package/dist/components/cat-button2.js.map +1 -1
  47. package/dist/components/cat-checkbox2.js +4 -2
  48. package/dist/components/cat-checkbox2.js.map +1 -1
  49. package/dist/components/cat-dropdown2.js.map +1 -1
  50. package/dist/components/cat-icon-registry.js +5 -1
  51. package/dist/components/cat-icon-registry.js.map +1 -1
  52. package/dist/components/cat-input2.js +1 -1
  53. package/dist/components/cat-input2.js.map +1 -1
  54. package/dist/components/cat-select2.js +1 -1
  55. package/dist/components/cat-select2.js.map +1 -1
  56. package/dist/components/cat-textarea.js +1 -1
  57. package/dist/components/cat-textarea.js.map +1 -1
  58. package/dist/components/cat-toggle.js +4 -2
  59. package/dist/components/cat-toggle.js.map +1 -1
  60. package/dist/esm/cat-alert_26.entry.js +13 -9
  61. package/dist/esm/cat-alert_26.entry.js.map +1 -1
  62. package/dist/esm/catalyst.js +1 -1
  63. package/dist/esm/index.js +2 -2
  64. package/dist/esm/loader.js +1 -1
  65. package/dist/esm/{of-a965d8fb.js → of-04d3d9e1.js} +6 -2
  66. package/dist/esm/of-04d3d9e1.js.map +1 -0
  67. package/dist/types/components/cat-badge/cat-badge.d.ts +1 -1
  68. package/dist/types/components/cat-button/cat-button.d.ts +1 -1
  69. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +8 -4
  70. package/dist/types/components/cat-toggle/cat-toggle.d.ts +9 -5
  71. package/dist/types/components.d.ts +36 -20
  72. package/package.json +2 -2
  73. package/dist/catalyst/p-19fad7af.js +0 -2
  74. package/dist/catalyst/p-19fad7af.js.map +0 -1
  75. package/dist/catalyst/p-5dab6694.entry.js +0 -10
  76. package/dist/catalyst/p-5dab6694.entry.js.map +0 -1
  77. package/dist/cjs/of-8545b523.js.map +0 -1
  78. package/dist/esm/of-a965d8fb.js.map +0 -1
@@ -26,6 +26,10 @@
26
26
  .cat-bg-primary {
27
27
  background-color: rgb(var(--cat-primary-bg, 0, 129, 148)) !important;
28
28
  color: rgb(var(--cat-primary-fill, 255, 255, 255)) !important;
29
+ --cat-primary-text: cat-token("color.theme.primary.fill", $wrap: false);
30
+ --cat-primary-text-hover: cat-token("color.theme.primary.fill-hover", $wrap: false);
31
+ --cat-primary-text-active: cat-token("color.theme.primary.fill-active", $wrap: false);
32
+ --cat-link-decoration: underline;
29
33
  }
30
34
 
31
35
  .cat-bg-primary-hover {
@@ -34,6 +38,10 @@
34
38
  .cat-bg-primary-hover:hover {
35
39
  background-color: rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;
36
40
  color: rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important;
41
+ --cat-primary-text: cat-token("color.theme.primary.fill", $wrap: false);
42
+ --cat-primary-text-hover: cat-token("color.theme.primary.fill-hover", $wrap: false);
43
+ --cat-primary-text-active: cat-token("color.theme.primary.fill-active", $wrap: false);
44
+ --cat-link-decoration: underline;
37
45
  }
38
46
 
39
47
  .cat-text-primary,
@@ -57,6 +65,10 @@
57
65
  .cat-bg-primaryInverted {
58
66
  background-color: #93b4f2 !important;
59
67
  color: black !important;
68
+ --cat-primary-text: cat-token("color.theme.primaryInverted.fill", $wrap: false);
69
+ --cat-primary-text-hover: cat-token("color.theme.primaryInverted.fill-hover", $wrap: false);
70
+ --cat-primary-text-active: cat-token("color.theme.primaryInverted.fill-active", $wrap: false);
71
+ --cat-link-decoration: underline;
60
72
  }
61
73
 
62
74
  .cat-bg-primaryInverted-hover {
@@ -65,6 +77,10 @@
65
77
  .cat-bg-primaryInverted-hover:hover {
66
78
  background-color: #93b4f2 !important;
67
79
  color: black !important;
80
+ --cat-primary-text: cat-token("color.theme.primaryInverted.fill", $wrap: false);
81
+ --cat-primary-text-hover: cat-token("color.theme.primaryInverted.fill-hover", $wrap: false);
82
+ --cat-primary-text-active: cat-token("color.theme.primaryInverted.fill-active", $wrap: false);
83
+ --cat-link-decoration: underline;
68
84
  }
69
85
 
70
86
  .cat-text-primaryInverted,
@@ -88,6 +104,10 @@
88
104
  .cat-bg-secondary {
89
105
  background-color: rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;
90
106
  color: rgb(var(--cat-secondary-fill, 255, 255, 255)) !important;
107
+ --cat-primary-text: cat-token("color.theme.secondary.fill", $wrap: false);
108
+ --cat-primary-text-hover: cat-token("color.theme.secondary.fill-hover", $wrap: false);
109
+ --cat-primary-text-active: cat-token("color.theme.secondary.fill-active", $wrap: false);
110
+ --cat-link-decoration: underline;
91
111
  }
92
112
 
93
113
  .cat-bg-secondary-hover {
@@ -96,6 +116,10 @@
96
116
  .cat-bg-secondary-hover:hover {
97
117
  background-color: rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;
98
118
  color: rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important;
119
+ --cat-primary-text: cat-token("color.theme.secondary.fill", $wrap: false);
120
+ --cat-primary-text-hover: cat-token("color.theme.secondary.fill-hover", $wrap: false);
121
+ --cat-primary-text-active: cat-token("color.theme.secondary.fill-active", $wrap: false);
122
+ --cat-link-decoration: underline;
99
123
  }
100
124
 
101
125
  .cat-text-secondary,
@@ -119,6 +143,10 @@
119
143
  .cat-bg-secondaryInverted {
120
144
  background-color: #697687 !important;
121
145
  color: black !important;
146
+ --cat-primary-text: cat-token("color.theme.secondaryInverted.fill", $wrap: false);
147
+ --cat-primary-text-hover: cat-token("color.theme.secondaryInverted.fill-hover", $wrap: false);
148
+ --cat-primary-text-active: cat-token("color.theme.secondaryInverted.fill-active", $wrap: false);
149
+ --cat-link-decoration: underline;
122
150
  }
123
151
 
124
152
  .cat-bg-secondaryInverted-hover {
@@ -127,6 +155,10 @@
127
155
  .cat-bg-secondaryInverted-hover:hover {
128
156
  background-color: #697687 !important;
129
157
  color: black !important;
158
+ --cat-primary-text: cat-token("color.theme.secondaryInverted.fill", $wrap: false);
159
+ --cat-primary-text-hover: cat-token("color.theme.secondaryInverted.fill-hover", $wrap: false);
160
+ --cat-primary-text-active: cat-token("color.theme.secondaryInverted.fill-active", $wrap: false);
161
+ --cat-link-decoration: underline;
130
162
  }
131
163
 
132
164
  .cat-text-secondaryInverted,
@@ -147,9 +179,52 @@
147
179
  color: white !important;
148
180
  }
149
181
 
182
+ .cat-bg-info {
183
+ background-color: rgb(var(--cat-success-bg, 0, 115, 230)) !important;
184
+ color: rgb(var(--cat-success-fill, 255, 255, 255)) !important;
185
+ --cat-primary-text: cat-token("color.theme.info.fill", $wrap: false);
186
+ --cat-primary-text-hover: cat-token("color.theme.info.fill-hover", $wrap: false);
187
+ --cat-primary-text-active: cat-token("color.theme.info.fill-active", $wrap: false);
188
+ --cat-link-decoration: underline;
189
+ }
190
+
191
+ .cat-bg-info-hover {
192
+ transition: background-color 125ms, color 125ms;
193
+ }
194
+ .cat-bg-info-hover:hover {
195
+ background-color: rgb(var(--cat-success-bg-hover, 0, 107, 227)) !important;
196
+ color: rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important;
197
+ --cat-primary-text: cat-token("color.theme.info.fill", $wrap: false);
198
+ --cat-primary-text-hover: cat-token("color.theme.info.fill-hover", $wrap: false);
199
+ --cat-primary-text-active: cat-token("color.theme.info.fill-active", $wrap: false);
200
+ --cat-link-decoration: underline;
201
+ }
202
+
203
+ .cat-text-info,
204
+ .cat-link-info {
205
+ color: rgb(var(--cat-success-text, 0, 115, 230)) !important;
206
+ }
207
+
208
+ .cat-link-info,
209
+ .cat-text-info-hover {
210
+ transition: color 125ms;
211
+ }
212
+ .cat-link-info:hover,
213
+ .cat-text-info-hover:hover {
214
+ color: rgb(var(--cat-success-text-hover, 0, 107, 227)) !important;
215
+ }
216
+ .cat-link-info:active,
217
+ .cat-text-info-hover:active {
218
+ color: rgb(var(--cat-success-text-active, 0, 96, 223)) !important;
219
+ }
220
+
150
221
  .cat-bg-success {
151
222
  background-color: rgb(var(--cat-success-bg, 0, 132, 88)) !important;
152
223
  color: rgb(var(--cat-success-fill, 255, 255, 255)) !important;
224
+ --cat-primary-text: cat-token("color.theme.success.fill", $wrap: false);
225
+ --cat-primary-text-hover: cat-token("color.theme.success.fill-hover", $wrap: false);
226
+ --cat-primary-text-active: cat-token("color.theme.success.fill-active", $wrap: false);
227
+ --cat-link-decoration: underline;
153
228
  }
154
229
 
155
230
  .cat-bg-success-hover {
@@ -158,6 +233,10 @@
158
233
  .cat-bg-success-hover:hover {
159
234
  background-color: rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;
160
235
  color: rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important;
236
+ --cat-primary-text: cat-token("color.theme.success.fill", $wrap: false);
237
+ --cat-primary-text-hover: cat-token("color.theme.success.fill-hover", $wrap: false);
238
+ --cat-primary-text-active: cat-token("color.theme.success.fill-active", $wrap: false);
239
+ --cat-link-decoration: underline;
161
240
  }
162
241
 
163
242
  .cat-text-success,
@@ -181,6 +260,10 @@
181
260
  .cat-bg-warning {
182
261
  background-color: rgb(var(--cat-warning-bg, 255, 206, 128)) !important;
183
262
  color: rgb(var(--cat-warning-fill, 0, 0, 0)) !important;
263
+ --cat-primary-text: cat-token("color.theme.warning.fill", $wrap: false);
264
+ --cat-primary-text-hover: cat-token("color.theme.warning.fill-hover", $wrap: false);
265
+ --cat-primary-text-active: cat-token("color.theme.warning.fill-active", $wrap: false);
266
+ --cat-link-decoration: underline;
184
267
  }
185
268
 
186
269
  .cat-bg-warning-hover {
@@ -189,6 +272,10 @@
189
272
  .cat-bg-warning-hover:hover {
190
273
  background-color: rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;
191
274
  color: rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important;
275
+ --cat-primary-text: cat-token("color.theme.warning.fill", $wrap: false);
276
+ --cat-primary-text-hover: cat-token("color.theme.warning.fill-hover", $wrap: false);
277
+ --cat-primary-text-active: cat-token("color.theme.warning.fill-active", $wrap: false);
278
+ --cat-link-decoration: underline;
192
279
  }
193
280
 
194
281
  .cat-text-warning,
@@ -212,6 +299,10 @@
212
299
  .cat-bg-danger {
213
300
  background-color: rgb(var(--cat-danger-bg, 217, 52, 13)) !important;
214
301
  color: rgb(var(--cat-danger-fill, 255, 255, 255)) !important;
302
+ --cat-primary-text: cat-token("color.theme.danger.fill", $wrap: false);
303
+ --cat-primary-text-hover: cat-token("color.theme.danger.fill-hover", $wrap: false);
304
+ --cat-primary-text-active: cat-token("color.theme.danger.fill-active", $wrap: false);
305
+ --cat-link-decoration: underline;
215
306
  }
216
307
 
217
308
  .cat-bg-danger-hover {
@@ -220,6 +311,10 @@
220
311
  .cat-bg-danger-hover:hover {
221
312
  background-color: rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;
222
313
  color: rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important;
314
+ --cat-primary-text: cat-token("color.theme.danger.fill", $wrap: false);
315
+ --cat-primary-text-hover: cat-token("color.theme.danger.fill-hover", $wrap: false);
316
+ --cat-primary-text-active: cat-token("color.theme.danger.fill-active", $wrap: false);
317
+ --cat-link-decoration: underline;
223
318
  }
224
319
 
225
320
  .cat-text-danger,
@@ -244,10 +339,22 @@
244
339
  color: rgb(var(--cat-primary-text, 0, 129, 148)) !important;
245
340
  }
246
341
 
342
+ .cat-text-active {
343
+ color: rgb(var(--cat-primary-text, 0, 129, 148)) !important;
344
+ }
345
+
247
346
  .cat-muted {
248
347
  color: rgb(var(--cat-font-color-muted, 81, 92, 108)) !important;
249
348
  }
250
349
 
350
+ .cat-text-muted {
351
+ color: rgb(var(--cat-font-color-muted, 81, 92, 108)) !important;
352
+ }
353
+
354
+ .cat-bg-muted {
355
+ background-color: #f2f4f7 !important;
356
+ }
357
+
251
358
  .cat-text-reset {
252
359
  color: inherit !important;
253
360
  }
@@ -770,12 +770,12 @@ export class CatSelect {
770
770
  "references": {
771
771
  "CatSelectTaggingValue": {
772
772
  "location": "local",
773
- "path": "/Users/fynn/Workspace/catalyst/core/src/components/cat-select/cat-select.tsx",
773
+ "path": "/home/runner/work/catalyst/catalyst/core/src/components/cat-select/cat-select.tsx",
774
774
  "id": "src/components/cat-select/cat-select.tsx::CatSelectTaggingValue"
775
775
  },
776
776
  "CatSelectMultipleTaggingValue": {
777
777
  "location": "local",
778
- "path": "/Users/fynn/Workspace/catalyst/core/src/components/cat-select/cat-select.tsx",
778
+ "path": "/home/runner/work/catalyst/catalyst/core/src/components/cat-select/cat-select.tsx",
779
779
  "id": "src/components/cat-select/cat-select.tsx::CatSelectMultipleTaggingValue"
780
780
  }
781
781
  }
@@ -1168,7 +1168,7 @@ export class CatSelect {
1168
1168
  },
1169
1169
  "CatSelectConnector": {
1170
1170
  "location": "local",
1171
- "path": "/Users/fynn/Workspace/catalyst/core/src/components/cat-select/cat-select.tsx",
1171
+ "path": "/home/runner/work/catalyst/catalyst/core/src/components/cat-select/cat-select.tsx",
1172
1172
  "id": "src/components/cat-select/cat-select.tsx::CatSelectConnector"
1173
1173
  },
1174
1174
  "Observable": {
@@ -1178,7 +1178,7 @@ export class CatSelect {
1178
1178
  },
1179
1179
  "Item": {
1180
1180
  "location": "local",
1181
- "path": "/Users/fynn/Workspace/catalyst/core/src/components/cat-select/cat-select.tsx",
1181
+ "path": "/home/runner/work/catalyst/catalyst/core/src/components/cat-select/cat-select.tsx",
1182
1182
  "id": "src/components/cat-select/cat-select.tsx::Item"
1183
1183
  }
1184
1184
  },
@@ -26,6 +26,10 @@
26
26
  .cat-bg-primary {
27
27
  background-color: rgb(var(--cat-primary-bg, 0, 129, 148)) !important;
28
28
  color: rgb(var(--cat-primary-fill, 255, 255, 255)) !important;
29
+ --cat-primary-text: cat-token("color.theme.primary.fill", $wrap: false);
30
+ --cat-primary-text-hover: cat-token("color.theme.primary.fill-hover", $wrap: false);
31
+ --cat-primary-text-active: cat-token("color.theme.primary.fill-active", $wrap: false);
32
+ --cat-link-decoration: underline;
29
33
  }
30
34
 
31
35
  .cat-bg-primary-hover {
@@ -34,6 +38,10 @@
34
38
  .cat-bg-primary-hover:hover {
35
39
  background-color: rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;
36
40
  color: rgb(var(--cat-primary-fill-hover, 255, 255, 255)) !important;
41
+ --cat-primary-text: cat-token("color.theme.primary.fill", $wrap: false);
42
+ --cat-primary-text-hover: cat-token("color.theme.primary.fill-hover", $wrap: false);
43
+ --cat-primary-text-active: cat-token("color.theme.primary.fill-active", $wrap: false);
44
+ --cat-link-decoration: underline;
37
45
  }
38
46
 
39
47
  .cat-text-primary,
@@ -57,6 +65,10 @@
57
65
  .cat-bg-primaryInverted {
58
66
  background-color: #93b4f2 !important;
59
67
  color: black !important;
68
+ --cat-primary-text: cat-token("color.theme.primaryInverted.fill", $wrap: false);
69
+ --cat-primary-text-hover: cat-token("color.theme.primaryInverted.fill-hover", $wrap: false);
70
+ --cat-primary-text-active: cat-token("color.theme.primaryInverted.fill-active", $wrap: false);
71
+ --cat-link-decoration: underline;
60
72
  }
61
73
 
62
74
  .cat-bg-primaryInverted-hover {
@@ -65,6 +77,10 @@
65
77
  .cat-bg-primaryInverted-hover:hover {
66
78
  background-color: #93b4f2 !important;
67
79
  color: black !important;
80
+ --cat-primary-text: cat-token("color.theme.primaryInverted.fill", $wrap: false);
81
+ --cat-primary-text-hover: cat-token("color.theme.primaryInverted.fill-hover", $wrap: false);
82
+ --cat-primary-text-active: cat-token("color.theme.primaryInverted.fill-active", $wrap: false);
83
+ --cat-link-decoration: underline;
68
84
  }
69
85
 
70
86
  .cat-text-primaryInverted,
@@ -88,6 +104,10 @@
88
104
  .cat-bg-secondary {
89
105
  background-color: rgb(var(--cat-secondary-bg, 105, 118, 135)) !important;
90
106
  color: rgb(var(--cat-secondary-fill, 255, 255, 255)) !important;
107
+ --cat-primary-text: cat-token("color.theme.secondary.fill", $wrap: false);
108
+ --cat-primary-text-hover: cat-token("color.theme.secondary.fill-hover", $wrap: false);
109
+ --cat-primary-text-active: cat-token("color.theme.secondary.fill-active", $wrap: false);
110
+ --cat-link-decoration: underline;
91
111
  }
92
112
 
93
113
  .cat-bg-secondary-hover {
@@ -96,6 +116,10 @@
96
116
  .cat-bg-secondary-hover:hover {
97
117
  background-color: rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;
98
118
  color: rgb(var(--cat-secondary-fill-hover, 255, 255, 255)) !important;
119
+ --cat-primary-text: cat-token("color.theme.secondary.fill", $wrap: false);
120
+ --cat-primary-text-hover: cat-token("color.theme.secondary.fill-hover", $wrap: false);
121
+ --cat-primary-text-active: cat-token("color.theme.secondary.fill-active", $wrap: false);
122
+ --cat-link-decoration: underline;
99
123
  }
100
124
 
101
125
  .cat-text-secondary,
@@ -119,6 +143,10 @@
119
143
  .cat-bg-secondaryInverted {
120
144
  background-color: #697687 !important;
121
145
  color: black !important;
146
+ --cat-primary-text: cat-token("color.theme.secondaryInverted.fill", $wrap: false);
147
+ --cat-primary-text-hover: cat-token("color.theme.secondaryInverted.fill-hover", $wrap: false);
148
+ --cat-primary-text-active: cat-token("color.theme.secondaryInverted.fill-active", $wrap: false);
149
+ --cat-link-decoration: underline;
122
150
  }
123
151
 
124
152
  .cat-bg-secondaryInverted-hover {
@@ -127,6 +155,10 @@
127
155
  .cat-bg-secondaryInverted-hover:hover {
128
156
  background-color: #697687 !important;
129
157
  color: black !important;
158
+ --cat-primary-text: cat-token("color.theme.secondaryInverted.fill", $wrap: false);
159
+ --cat-primary-text-hover: cat-token("color.theme.secondaryInverted.fill-hover", $wrap: false);
160
+ --cat-primary-text-active: cat-token("color.theme.secondaryInverted.fill-active", $wrap: false);
161
+ --cat-link-decoration: underline;
130
162
  }
131
163
 
132
164
  .cat-text-secondaryInverted,
@@ -147,9 +179,52 @@
147
179
  color: white !important;
148
180
  }
149
181
 
182
+ .cat-bg-info {
183
+ background-color: rgb(var(--cat-success-bg, 0, 115, 230)) !important;
184
+ color: rgb(var(--cat-success-fill, 255, 255, 255)) !important;
185
+ --cat-primary-text: cat-token("color.theme.info.fill", $wrap: false);
186
+ --cat-primary-text-hover: cat-token("color.theme.info.fill-hover", $wrap: false);
187
+ --cat-primary-text-active: cat-token("color.theme.info.fill-active", $wrap: false);
188
+ --cat-link-decoration: underline;
189
+ }
190
+
191
+ .cat-bg-info-hover {
192
+ transition: background-color 125ms, color 125ms;
193
+ }
194
+ .cat-bg-info-hover:hover {
195
+ background-color: rgb(var(--cat-success-bg-hover, 0, 107, 227)) !important;
196
+ color: rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important;
197
+ --cat-primary-text: cat-token("color.theme.info.fill", $wrap: false);
198
+ --cat-primary-text-hover: cat-token("color.theme.info.fill-hover", $wrap: false);
199
+ --cat-primary-text-active: cat-token("color.theme.info.fill-active", $wrap: false);
200
+ --cat-link-decoration: underline;
201
+ }
202
+
203
+ .cat-text-info,
204
+ .cat-link-info {
205
+ color: rgb(var(--cat-success-text, 0, 115, 230)) !important;
206
+ }
207
+
208
+ .cat-link-info,
209
+ .cat-text-info-hover {
210
+ transition: color 125ms;
211
+ }
212
+ .cat-link-info:hover,
213
+ .cat-text-info-hover:hover {
214
+ color: rgb(var(--cat-success-text-hover, 0, 107, 227)) !important;
215
+ }
216
+ .cat-link-info:active,
217
+ .cat-text-info-hover:active {
218
+ color: rgb(var(--cat-success-text-active, 0, 96, 223)) !important;
219
+ }
220
+
150
221
  .cat-bg-success {
151
222
  background-color: rgb(var(--cat-success-bg, 0, 132, 88)) !important;
152
223
  color: rgb(var(--cat-success-fill, 255, 255, 255)) !important;
224
+ --cat-primary-text: cat-token("color.theme.success.fill", $wrap: false);
225
+ --cat-primary-text-hover: cat-token("color.theme.success.fill-hover", $wrap: false);
226
+ --cat-primary-text-active: cat-token("color.theme.success.fill-active", $wrap: false);
227
+ --cat-link-decoration: underline;
153
228
  }
154
229
 
155
230
  .cat-bg-success-hover {
@@ -158,6 +233,10 @@
158
233
  .cat-bg-success-hover:hover {
159
234
  background-color: rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;
160
235
  color: rgb(var(--cat-success-fill-hover, 255, 255, 255)) !important;
236
+ --cat-primary-text: cat-token("color.theme.success.fill", $wrap: false);
237
+ --cat-primary-text-hover: cat-token("color.theme.success.fill-hover", $wrap: false);
238
+ --cat-primary-text-active: cat-token("color.theme.success.fill-active", $wrap: false);
239
+ --cat-link-decoration: underline;
161
240
  }
162
241
 
163
242
  .cat-text-success,
@@ -181,6 +260,10 @@
181
260
  .cat-bg-warning {
182
261
  background-color: rgb(var(--cat-warning-bg, 255, 206, 128)) !important;
183
262
  color: rgb(var(--cat-warning-fill, 0, 0, 0)) !important;
263
+ --cat-primary-text: cat-token("color.theme.warning.fill", $wrap: false);
264
+ --cat-primary-text-hover: cat-token("color.theme.warning.fill-hover", $wrap: false);
265
+ --cat-primary-text-active: cat-token("color.theme.warning.fill-active", $wrap: false);
266
+ --cat-link-decoration: underline;
184
267
  }
185
268
 
186
269
  .cat-bg-warning-hover {
@@ -189,6 +272,10 @@
189
272
  .cat-bg-warning-hover:hover {
190
273
  background-color: rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;
191
274
  color: rgb(var(--cat-warning-fill-hover, 0, 0, 0)) !important;
275
+ --cat-primary-text: cat-token("color.theme.warning.fill", $wrap: false);
276
+ --cat-primary-text-hover: cat-token("color.theme.warning.fill-hover", $wrap: false);
277
+ --cat-primary-text-active: cat-token("color.theme.warning.fill-active", $wrap: false);
278
+ --cat-link-decoration: underline;
192
279
  }
193
280
 
194
281
  .cat-text-warning,
@@ -212,6 +299,10 @@
212
299
  .cat-bg-danger {
213
300
  background-color: rgb(var(--cat-danger-bg, 217, 52, 13)) !important;
214
301
  color: rgb(var(--cat-danger-fill, 255, 255, 255)) !important;
302
+ --cat-primary-text: cat-token("color.theme.danger.fill", $wrap: false);
303
+ --cat-primary-text-hover: cat-token("color.theme.danger.fill-hover", $wrap: false);
304
+ --cat-primary-text-active: cat-token("color.theme.danger.fill-active", $wrap: false);
305
+ --cat-link-decoration: underline;
215
306
  }
216
307
 
217
308
  .cat-bg-danger-hover {
@@ -220,6 +311,10 @@
220
311
  .cat-bg-danger-hover:hover {
221
312
  background-color: rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;
222
313
  color: rgb(var(--cat-danger-fill-hover, 255, 255, 255)) !important;
314
+ --cat-primary-text: cat-token("color.theme.danger.fill", $wrap: false);
315
+ --cat-primary-text-hover: cat-token("color.theme.danger.fill-hover", $wrap: false);
316
+ --cat-primary-text-active: cat-token("color.theme.danger.fill-active", $wrap: false);
317
+ --cat-link-decoration: underline;
223
318
  }
224
319
 
225
320
  .cat-text-danger,
@@ -244,10 +339,22 @@
244
339
  color: rgb(var(--cat-primary-text, 0, 129, 148)) !important;
245
340
  }
246
341
 
342
+ .cat-text-active {
343
+ color: rgb(var(--cat-primary-text, 0, 129, 148)) !important;
344
+ }
345
+
247
346
  .cat-muted {
248
347
  color: rgb(var(--cat-font-color-muted, 81, 92, 108)) !important;
249
348
  }
250
349
 
350
+ .cat-text-muted {
351
+ color: rgb(var(--cat-font-color-muted, 81, 92, 108)) !important;
352
+ }
353
+
354
+ .cat-bg-muted {
355
+ background-color: #f2f4f7 !important;
356
+ }
357
+
251
358
  .cat-text-reset {
252
359
  color: inherit !important;
253
360
  }
@@ -24,6 +24,7 @@ export class CatToggle {
24
24
  this.name = undefined;
25
25
  this.required = false;
26
26
  this.value = undefined;
27
+ this.noValue = undefined;
27
28
  this.resolvedValue = null;
28
29
  this.hint = undefined;
29
30
  this.labelLeft = false;
@@ -77,7 +78,7 @@ export class CatToggle {
77
78
  this.catBlur.emit(event);
78
79
  }
79
80
  updateResolved() {
80
- this.resolvedValue = this.value == null ? this.checked : this.checked ? this.value : null;
81
+ this.resolvedValue = this.checked ? this.value ?? true : this.noValue ?? false;
81
82
  }
82
83
  static get is() { return "cat-toggle"; }
83
84
  static get encapsulation() { return "shadow"; }
@@ -218,35 +219,52 @@ export class CatToggle {
218
219
  "defaultValue": "false"
219
220
  },
220
221
  "value": {
221
- "type": "string",
222
+ "type": "any",
222
223
  "mutable": false,
223
224
  "complexType": {
224
- "original": "string",
225
- "resolved": "string | undefined",
225
+ "original": "any",
226
+ "resolved": "any",
226
227
  "references": {}
227
228
  },
228
229
  "required": false,
229
230
  "optional": true,
230
231
  "docs": {
231
232
  "tags": [],
232
- "text": "The value of the toggle."
233
+ "text": "The value of the checked toggle."
233
234
  },
234
235
  "attribute": "value",
235
236
  "reflect": false
236
237
  },
238
+ "noValue": {
239
+ "type": "any",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "any",
243
+ "resolved": "any",
244
+ "references": {}
245
+ },
246
+ "required": false,
247
+ "optional": true,
248
+ "docs": {
249
+ "tags": [],
250
+ "text": "The value of the unchecked toggle."
251
+ },
252
+ "attribute": "no-value",
253
+ "reflect": false
254
+ },
237
255
  "resolvedValue": {
238
256
  "type": "any",
239
257
  "mutable": true,
240
258
  "complexType": {
241
- "original": "string | boolean | null",
242
- "resolved": "boolean | null | string",
259
+ "original": "any",
260
+ "resolved": "any",
243
261
  "references": {}
244
262
  },
245
263
  "required": false,
246
264
  "optional": false,
247
265
  "docs": {
248
266
  "tags": [],
249
- "text": "The resolved value of the toggle, based on the checked state and value."
267
+ "text": "The resolved value of the toggle, based on the checked state, value and noValue."
250
268
  },
251
269
  "attribute": "resolved-value",
252
270
  "reflect": false,
@@ -322,8 +340,8 @@ export class CatToggle {
322
340
  "text": "Emitted when the checked status of the toggle is changed."
323
341
  },
324
342
  "complexType": {
325
- "original": "boolean | string | null",
326
- "resolved": "boolean | null | string",
343
+ "original": "any",
344
+ "resolved": "any",
327
345
  "references": {}
328
346
  }
329
347
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"cat-toggle.js","sourceRoot":"","sources":["../../../src/components/cat-toggle/cat-toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;GAQG;AAMH,MAAM,OAAO,SAAS;;IACH,QAAG,GAAG,cAAc,YAAY,EAAE,EAAE,CAAC;2BAS3B,KAAK;0BAEN,KAAK;mBAKI,KAAK;oBAKrB,KAAK;;iBAUR,EAAE;uBAKI,KAAK;;oBAUR,KAAK;;yBAU0C,IAAI;;qBAUlD,KAAK;;;EAjEzB,IAAY,EAAE;IACZ,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC;EACrC,CAAC;EAqFD,iBAAiB;IACf,IAAI,CAAC,cAAc,EAAE,CAAC;EACxB,CAAC;EAED,mBAAmB;IACjB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1E,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACxE,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;MACxC,GAAG,CAAC,IAAI,CAAC,qCAAqC,EAAE,IAAI,CAAC,CAAC;KACvD;EACH,CAAC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CAAC;EAC5F,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Toggles are graphical interface switches that give user control over a\n * feature or option that can be turned on or off.\n *\n * @slot hint - Optional hint element to be displayed with the toggle.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part toggle - The toggle element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-toggle',\n styleUrls: ['cat-toggle.scss'],\n shadow: true\n})\nexport class CatToggle {\n private readonly _id = `cat-toggle-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n /**\n * Checked state of the toggle.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Disabled state of the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label of the toggle that is visible.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input.\n */\n @Prop() name?: string;\n\n /**\n * Required state of the toggle.\n */\n @Prop() required = false;\n\n /**\n * The value of the toggle.\n */\n @Prop() value?: string;\n\n /**\n * The resolved value of the toggle, based on the checked state and value.\n */\n @Prop({ mutable: true }) resolvedValue: string | boolean | null = null;\n\n /**\n * Optional hint text(s) to be displayed with the toggle.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the toggle.\n */\n @Prop() labelLeft = false;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the checked status of the toggle is changed.\n */\n @Event() catChange!: EventEmitter<boolean | string | null>;\n\n /**\n * Emitted when the toggle received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad() {\n this.updateResolved();\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on toggle', this);\n }\n }\n\n /**\n * Programmatically move focus to the toggle. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Programmatically remove focus from the toggle. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n class=\"form-check-input\"\n role=\"switch\"\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n aria-describedby={this.hasHint ? this.id + '-hint' : undefined}\n />\n <span class=\"toggle\" part=\"toggle\"></span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hasHint && (\n <div class={{ 'hint-wrapper': true, 'label-left': this.labelLeft }}>\n <div class=\"toggle-placeholder\"></div>\n <CatFormHint id={this.id} hint={this.hint} slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>} />\n </div>\n )}\n </Host>\n );\n }\n\n private get hasHint() {\n return !!this.hint || !!this.hasSlottedHint;\n }\n\n private onInput() {\n this.checked = this.input.checked;\n this.updateResolved();\n this.catChange.emit(this.resolvedValue);\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 private updateResolved() {\n this.resolvedValue = this.value == null ? this.checked : this.checked ? this.value : null;\n }\n}\n"]}
1
+ {"version":3,"file":"cat-toggle.js","sourceRoot":"","sources":["../../../src/components/cat-toggle/cat-toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;GAQG;AAMH,MAAM,OAAO,SAAS;;IACH,QAAG,GAAG,cAAc,YAAY,EAAE,EAAE,CAAC;2BAS3B,KAAK;0BAEN,KAAK;mBAKI,KAAK;oBAKrB,KAAK;;iBAUR,EAAE;uBAKI,KAAK;;oBAUR,KAAK;;;yBAkBsB,IAAI;;qBAU9B,KAA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AAI,CAAC,cAAc,EAAE,CAAC;IACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;EAC1C,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;EAEO,cAAc;IACpB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC;EACjF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Toggles are graphical interface switches that give user control over a\n * feature or option that can be turned on or off.\n *\n * @slot hint - Optional hint element to be displayed with the toggle.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part toggle - The toggle element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-toggle',\n styleUrls: ['cat-toggle.scss'],\n shadow: true\n})\nexport class CatToggle {\n private readonly _id = `cat-toggle-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n /**\n * Checked state of the toggle.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Disabled state of the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label of the toggle that is visible.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input.\n */\n @Prop() name?: string;\n\n /**\n * Required state of the toggle.\n */\n @Prop() required = false;\n\n /**\n * The value of the checked toggle.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Prop() value?: any;\n\n /**\n * The value of the unchecked toggle.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Prop() noValue?: any;\n\n /**\n * The resolved value of the toggle, based on the checked state, value and noValue.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Prop({ mutable: true }) resolvedValue: any = null;\n\n /**\n * Optional hint text(s) to be displayed with the toggle.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the toggle.\n */\n @Prop() labelLeft = false;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the checked status of the toggle is changed.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Event() catChange!: EventEmitter<any>;\n\n /**\n * Emitted when the toggle received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad() {\n this.updateResolved();\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on toggle', this);\n }\n }\n\n /**\n * Programmatically move focus to the toggle. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Programmatically remove focus from the toggle. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n class=\"form-check-input\"\n role=\"switch\"\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n aria-describedby={this.hasHint ? this.id + '-hint' : undefined}\n />\n <span class=\"toggle\" part=\"toggle\"></span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hasHint && (\n <div class={{ 'hint-wrapper': true, 'label-left': this.labelLeft }}>\n <div class=\"toggle-placeholder\"></div>\n <CatFormHint id={this.id} hint={this.hint} slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>} />\n </div>\n )}\n </Host>\n );\n }\n\n private get hasHint() {\n return !!this.hint || !!this.hasSlottedHint;\n }\n\n private onInput() {\n this.checked = this.input.checked;\n this.updateResolved();\n this.catChange.emit(this.resolvedValue);\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 private updateResolved() {\n this.resolvedValue = this.checked ? this.value ?? true : this.noValue ?? false;\n }\n}\n"]}
@@ -12,3 +12,9 @@
12
12
  margin-bottom: 0.5rem;
13
13
  }
14
14
  }
15
+
16
+ .cat-label {
17
+ @include cat-body('m');
18
+ display: block;
19
+ margin-bottom: 0.5rem;
20
+ }