@stackoverflow/stacks 2.1.1 → 2.3.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 (31) hide show
  1. package/dist/css/stacks.css +2242 -774
  2. package/dist/css/stacks.min.css +1 -1
  3. package/lib/atomic/__snapshots__/misc.less.test.ts.snap +893 -0
  4. package/lib/atomic/__snapshots__/spacing.less.test.ts.snap +1928 -0
  5. package/lib/atomic/misc.less +30 -0
  6. package/lib/atomic/misc.less.test.ts +12 -0
  7. package/lib/atomic/spacing.less +59 -303
  8. package/lib/atomic/spacing.less.test.ts +12 -0
  9. package/lib/components/badge/badge.a11y.test.ts +59 -18
  10. package/lib/components/badge/badge.less +16 -1
  11. package/lib/components/badge/badge.visual.test.ts +44 -16
  12. package/lib/components/button/button.a11y.test.ts +14 -18
  13. package/lib/components/button/button.less +16 -22
  14. package/lib/components/button/button.test.setup.ts +36 -0
  15. package/lib/components/button/button.visual.test.ts +3 -33
  16. package/lib/components/button-group/button-group.a11y.test.ts +12 -0
  17. package/lib/components/button-group/button-group.less +43 -49
  18. package/lib/components/button-group/button-group.test.setup.ts +77 -0
  19. package/lib/components/button-group/button-group.visual.test.ts +7 -0
  20. package/lib/components/input_textarea/input_textarea.less +3 -1
  21. package/lib/components/post-summary/post-summary.a11y.test.ts +25 -0
  22. package/lib/components/post-summary/post-summary.test.setup.ts +435 -0
  23. package/lib/components/post-summary/post-summary.visual.test.ts +17 -0
  24. package/lib/components/topbar/topbar.less +365 -335
  25. package/lib/components/topbar/topbar.visual.test.ts +28 -0
  26. package/lib/exports/__snapshots__/color.less.test.ts.snap +24 -24
  27. package/lib/exports/color-sets.less +12 -12
  28. package/lib/exports/spacing-mixins.less +67 -0
  29. package/lib/tsconfig.build.json +1 -1
  30. package/lib/tsconfig.json +3 -3
  31. package/package.json +13 -13
@@ -1,3 +1,8 @@
1
+ @import (reference) "../base/internal.less";
2
+ @import (reference) "../exports/color-mixins.less";
3
+ @import (reference) "../exports/constants-helpers.less";
4
+ @import (reference) "../exports/mixins.less";
5
+
1
6
  //
2
7
  // STACK OVERFLOW
3
8
  // UTILITIES
@@ -78,6 +83,31 @@
78
83
  background-image: url("data:image/svg+xml;,%3Csvg width='574' height='60' viewBox='0 0 574 60' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect opacity='0.8' x='27.1224' y='20.0458' width='5' height='13' transform='rotate(-139 27.1224 20.0458)' fill='%23F23B14'/%3E%3Crect opacity='0.8' x='118.478' y='7.00201' width='5' height='13' transform='rotate(-38.8114 118.478 7.00201)' fill='%23FBBA23'/%3E%3Crect opacity='0.8' x='504.616' y='25.4479' width='5' height='13' transform='rotate(-60.2734 504.616 25.4479)' fill='%23F23B14'/%3E%3Crect opacity='0.6' x='538.983' y='45.555' width='5' height='13' transform='rotate(16.7826 538.983 45.555)' fill='%232A2F6A'/%3E%3Crect opacity='0.3' x='470.322' y='2.63625' width='5' height='13' transform='rotate(11.295 470.322 2.63625)' fill='%2333AAFF'/%3E%3Crect opacity='0.3' x='190.295' y='4.58138' width='5' height='13' transform='rotate(27.5954 190.295 4.58138)' fill='%23F23B14'/%3E%3Crect opacity='0.8' x='234.303' y='16.3233' width='5' height='13' transform='rotate(-41.8233 234.303 16.3233)' fill='%2365BB5C'/%3E%3Crect opacity='0.6' x='369.702' y='40.9875' width='5' height='13' transform='rotate(-56.419 369.702 40.9875)' fill='%2333AAFF'/%3E%3Crect opacity='0.3' x='402.121' y='31.0848' width='5' height='13' transform='rotate(-17.9234 402.121 31.0848)' fill='%23F23B14'/%3E%3Crect opacity='0.6' x='200.316' y='31.9328' width='5' height='13' transform='rotate(-15.8896 200.316 31.9328)' fill='%232A2F6A'/%3E%3Crect opacity='0.6' x='69.6745' y='23.4725' width='6' height='10' transform='rotate(70.0266 69.6745 23.4725)' fill='%2365BB5C'/%3E%3Crect opacity='0.6' x='291.945' y='7.16931' width='6' height='10' transform='rotate(30.4258 291.945 7.16931)' fill='%23FBBA23'/%3E%3Crect opacity='0.3' x='33.7754' y='38.2208' width='6' height='10' transform='rotate(38.6056 33.7754 38.2208)' fill='%23FBBA23'/%3E%3Crect opacity='0.8' x='109.752' y='31.1743' width='6' height='10' transform='rotate(28.5296 109.752 31.1743)' fill='%2333AAFF'/%3E%3Crect opacity='0.3' x='278.081' y='37.8695' width='6' height='10' transform='rotate(-26.5651 278.081 37.8695)' fill='%23F23B14'/%3E%3Crect opacity='0.8' x='416.294' y='11.5573' width='6' height='10' transform='rotate(-22.8498 416.294 11.5573)' fill='%23FBBA23'/%3E%3Crect opacity='0.3' x='354.667' y='9.32341' width='6' height='10' transform='rotate(17.7506 354.667 9.32341)' fill='%232A2F6A'/%3E%3Crect opacity='0.8' x='532.404' y='16.6372' width='6' height='10' transform='rotate(-75.3432 532.404 16.6372)' fill='%23FBBA23'/%3E%3Crect opacity='0.6' x='460.463' y='39.3557' width='6' height='10' transform='rotate(45.4982 460.463 39.3557)' fill='%2365BB5C'/%3E%3C/svg%3E");
79
84
  }
80
85
 
86
+ // Focus styles
87
+ .focus,
88
+ .f\:focus:focus,
89
+ .f\:focus:focus-within {
90
+ .focus-styles();
91
+ }
92
+
93
+ .focus-inset,
94
+ .f\:focus-inset:focus,
95
+ .f\:focus-inset:focus-within {
96
+ .focus-styles(true);
97
+ }
98
+
99
+ .focus-bordered,
100
+ .f\:focus-bordered:focus,
101
+ .f\:focus-bordered:focus-within {
102
+ .focus-styles(false, true);
103
+ }
104
+
105
+ .focus-inset-bordered,
106
+ .f\:focus-inset-bordered:focus,
107
+ .f\:focus-inset-bordered:focus-within {
108
+ .focus-styles(true, true);
109
+ }
110
+
81
111
  // ============================================================================
82
112
  // $ OBJECT-FIT / OBJECT-POSITION
83
113
  // ----------------------------------------------------------------------------
@@ -0,0 +1,12 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { renderLess } from "../test/less-test-utils";
3
+
4
+ describe("atomic: misc", () => {
5
+ it("should output all atomic css classes", async () => {
6
+ const css = await renderLess(`
7
+ @import "./lib/atomic/misc.less";
8
+ `);
9
+
10
+ expect(css).toMatchSnapshot();
11
+ });
12
+ });
@@ -1,21 +1,10 @@
1
- //
2
- // STACK OVERFLOW
3
- // SPACING
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
- // • SPACING UNIT CSS VARIABLES
10
- // • MARGIN
11
- // • PADDING
12
- // • POSITIONING
13
- //
14
- // ============================================================================
15
- // $ SPACING UNITS CSS VARIABLES
16
- // ----------------------------------------------------------------------------
1
+ @import (reference) "../base/internal.less";
2
+ @import (reference) "../exports/spacing-mixins.less";
3
+
4
+ // SPACING UNITS CSS CUSTOM PROPERTIES
17
5
  body {
18
6
  --su-base: 1;
7
+ --su-static0: 0px;
19
8
  --su-static1: 1px;
20
9
  --su-static2: 2px;
21
10
  --su-static4: 4px;
@@ -30,6 +19,7 @@ body {
30
19
  --su-static96: 96px;
31
20
  --su-static128: 128px;
32
21
 
22
+ --su0: var(--su-static0);
33
23
  // This ensures `--su1` never drops below 1px by setting the clamp MIN value to `--su-static1` (1px).
34
24
  --su1: clamp(var(--su-static1), calc(var(--su-static1) * var(--su-base)), calc(var(--su-static1) * var(--su-base)));
35
25
  --su2: calc(var(--su-static2) * var(--su-base));
@@ -46,297 +36,63 @@ body {
46
36
  --su128: calc(var(--su-static128) * var(--su-base));
47
37
  }
48
38
 
49
- // ============================================================================
50
- // $ MARGIN
51
- // ----------------------------------------------------------------------------
52
- // $$ 0 margin
53
- .m0 { margin: 0 !important; }
54
- .mt0 { margin-top: 0 !important; }
55
- .mr0 { margin-right: 0 !important; }
56
- .mb0 { margin-bottom: 0 !important; }
57
- .ml0 { margin-left: 0 !important; }
58
- .mx0 { margin-left: 0 !important; margin-right: 0 !important; }
59
- .my0 { margin-top: 0 !important; margin-bottom: 0 !important; }
60
-
61
- // $$ auto margin
39
+ // MARGIN
40
+ // Margin
62
41
  .m-auto { margin: auto !important; }
42
+ .generate-spacing('.m', margin, true);
43
+ .generate-spacing('.m', margin, true, percent);
44
+
45
+ // Margin top
63
46
  .mt-auto { margin-top: auto !important; }
47
+ .generate-spacing('.mt', margin-top, true);
48
+ .generate-spacing('.mt', margin-top, true, percent);
49
+
50
+ // Margin right
64
51
  .mr-auto { margin-right: auto !important; }
52
+ .generate-spacing('.mr', margin-right, true);
53
+ .generate-spacing('.mr', margin-right, true, percent);
54
+
55
+ // Margin bottom
65
56
  .mb-auto { margin-bottom: auto !important; }
57
+ .generate-spacing('.mb', margin-bottom, true);
58
+ .generate-spacing('.mb', margin-bottom, true, percent);
59
+
60
+ // Margin left
66
61
  .ml-auto { margin-left: auto !important; }
62
+ .generate-spacing('.ml', margin-left, true);
63
+ .generate-spacing('.ml', margin-left, true, percent);
64
+
65
+ // Margin x-axis, y-axis
67
66
  .mx-auto { margin-left: auto !important; margin-right: auto !important; }
68
67
  .my-auto { margin-top: auto !important; margin-bottom: auto !important; }
69
-
70
- // $$ Margin
71
- #stacks-internals #build-classes(
72
- responsive,
73
- '.m',
74
- { .template(@value) { margin: var(~"--su@{value}") !important; } },
75
- 1 2 4 6 8 12 16 24 32 48 64 96 128
76
- );
77
-
78
- #stacks-internals #responsify('.m0', { margin: 0 !important; });
79
-
80
- // $$ Margin negative
81
- #stacks-internals #build-classes(
82
- responsive,
83
- '.mn',
84
- { .template(@value) { margin: calc(var(~"--su@{value}") * -1) !important; } },
85
- 1 2 4 6 8 12 16 24 32 48 64 96 128
86
- );
87
-
88
- // $$ Top margin
89
- #stacks-internals #build-classes(
90
- responsive,
91
- '.mt',
92
- { .template(@value) { margin-top: var(~"--su@{value}") !important; } },
93
- 1 2 4 6 8 12 16 24 32 48 64 96 128
94
- );
95
-
96
- #stacks-internals #responsify('.mt0', { margin-top: 0 !important; });
97
-
98
- // $$ Top margin negative
99
- #stacks-internals #build-classes(
100
- responsive,
101
- '.mtn',
102
- { .template(@value) { margin-top: calc(var(~"--su@{value}") * -1) !important; } },
103
- 1 2 4 6 8 12 16 24 32 48 64 96 128
104
- );
105
-
106
- // $$ Right margin
107
- #stacks-internals #build-classes(
108
- responsive,
109
- '.mr',
110
- { .template(@value) { margin-right: var(~"--su@{value}") !important; } },
111
- 1 2 4 6 8 12 16 24 32 48 64 96 128
112
- );
113
-
114
- #stacks-internals #responsify('.mr0', { margin-right: 0 !important; });
115
-
116
- // $$ Right margin negative
117
- #stacks-internals #build-classes(
118
- responsive,
119
- '.mrn',
120
- { .template(@value) { margin-right: calc(var(~"--su@{value}") * -1) !important; } },
121
- 1 2 4 6 8 12 16 24 32 48 64 96 128
122
- );
123
-
124
- // $$ Bottom margin
125
- #stacks-internals #build-classes(
126
- responsive,
127
- '.mb',
128
- { .template(@value) { margin-bottom: var(~"--su@{value}") !important; } },
129
- 1 2 4 6 8 12 16 24 32 48 64 96 128
130
- );
131
-
132
- #stacks-internals #responsify('.mb0', { margin-bottom: 0 !important; });
133
-
134
- // $$ Bottom margin negative
135
- #stacks-internals #build-classes(
136
- responsive,
137
- '.mbn',
138
- { .template(@value) { margin-bottom: calc(var(~"--su@{value}") * -1) !important; } },
139
- 1 2 4 6 8 12 16 24 32 48 64 96 128
140
- );
141
-
142
- // $$ Left margin
143
- #stacks-internals #build-classes(
144
- responsive,
145
- '.ml',
146
- { .template(@value) { margin-left: var(~"--su@{value}") !important; } },
147
- 1 2 4 6 8 12 16 24 32 48 64 96 128
148
- );
149
-
150
- #stacks-internals #responsify('.ml0', { margin-left: 0 !important; });
151
-
152
- // $$ Left margin negative
153
- #stacks-internals #build-classes(
154
- responsive,
155
- '.mln',
156
- { .template(@value) { margin-left: calc(var(~"--su@{value}") * -1) !important; } },
157
- 1 2 4 6 8 12 16 24 32 48 64 96 128
158
- );
159
-
160
- #stacks-internals #build-classes(
161
- '.mx', { .template(@value) { margin-left: var(~"--su@{value}") !important; margin-right: var(~"--su@{value}") !important; } },
162
- 1 2 4 6 8 12 16 24 32 48 64 96 128
163
- );
164
-
165
- #stacks-internals #build-classes(
166
- '.mxn', { .template(@value) { margin-left: calc(var(~"--su@{value}") * -1) !important; margin-right: calc(var(~"--su@{value}") * -1) !important; } },
167
- 1 2 4 6 8 12 16 24 32 48 64 96 128
168
- );
169
-
170
- #stacks-internals #build-classes(
171
- '.my', { .template(@value) { margin-top: var(~"--su@{value}") !important; margin-bottom: var(~"--su@{value}") !important; } },
172
- 1 2 4 6 8 12 16 24 32 48 64 96 128
173
- );
174
-
175
- #stacks-internals #build-classes(
176
- '.myn', { .template(@value) { margin-top: calc(var(~"--su@{value}") * -1) !important; margin-bottom: calc(var(~"--su@{value}") * -1) !important; } },
177
- 1 2 4 6 8 12 16 24 32 48 64 96 128
178
- );
179
-
180
- // ============================================================================
181
- // $ PADDING
182
- // ----------------------------------------------------------------------------
183
-
184
- // $$ 0 padding
185
- .p0 { padding: 0 !important; }
186
- .pt0 { padding-top: 0 !important; }
187
- .pr0 { padding-right: 0 !important; }
188
- .pb0 { padding-bottom: 0 !important; }
189
- .pl0 { padding-left: 0 !important; }
190
- .px0 { padding-left: 0 !important; padding-right: 0 !important; }
191
- .py0 { padding-top: 0 !important; padding-bottom: 0 !important; }
192
-
193
- #stacks-internals #build-classes(
194
- responsive,
195
- '.p', { .template(@value) { padding: var(~"--su@{value}") !important; } },
196
- 1 2 4 6 8 12 16 24 32 48 64 96 128
197
- );
198
-
199
- #stacks-internals #responsify('.p0', { padding: 0 !important; });
200
-
201
- // $$ Top Padding
202
- #stacks-internals #build-classes(
203
- responsive,
204
- '.pt', { .template(@value) { padding-top: var(~"--su@{value}") !important; } },
205
- 1 2 4 6 8 12 16 24 32 48 64 96 128
206
- );
207
-
208
- #stacks-internals #responsify('.pt0', { padding-top: 0 !important; });
209
-
210
- // $$ Right Padding
211
- #stacks-internals #build-classes(
212
- responsive,
213
- '.pr', { .template(@value) { padding-right: var(~"--su@{value}") !important; } },
214
- 1 2 4 6 8 12 16 24 32 48 64 96 128
215
- );
216
-
217
- // $$ Bottom Padding
218
- #stacks-internals #build-classes(
219
- responsive,
220
- '.pb', { .template(@value) { padding-bottom: var(~"--su@{value}") !important; } },
221
- 1 2 4 6 8 12 16 24 32 48 64 96 128
222
- );
223
-
224
- #stacks-internals #responsify('.pr0', { padding-right: 0 !important; });
225
-
226
- // $$ Left Padding
227
- #stacks-internals #build-classes(
228
- responsive,
229
- '.pl', { .template(@value) { padding-left: var(~"--su@{value}") !important; } },
230
- 1 2 4 6 8 12 16 24 32 48 64 96 128
231
- );
232
-
233
- #stacks-internals #responsify('.pl0', { padding-left: 0 !important; });
234
-
235
- // $$ X-Axis Padding
236
- #stacks-internals #build-classes(
237
- '.px', { .template(@value) { padding-left: var(~"--su@{value}") !important; padding-right: var(~"--su@{value}") !important; } },
238
- 1 2 4 6 8 12 16 24 32 48 64 96 128
239
- );
240
-
241
- // $$ Y-Axis Padding
242
- #stacks-internals #build-classes(
243
- '.py', { .template(@value) { padding-top: var(~"--su@{value}") !important; padding-bottom: var(~"--su@{value}") !important; } },
244
- 1 2 4 6 8 12 16 24 32 48 64 96 128
245
- );
246
-
247
- // ============================================================================
248
- // $ POSITIONING
249
- // ----------------------------------------------------------------------------
250
-
251
- // $$ Top
252
- #stacks-internals #build-classes(
253
- responsive,
254
- '.t', { .template(@value) { top: var(~"--su@{value}") !important; } },
255
- 1 2 4 6 8 12 16 24 32 48 64 96 128
256
- );
257
-
258
- // $$ Top 0, percent
259
- #stacks-internals #build-classes(
260
- '.t', { .template(@value) { top: @value !important; } },
261
- 0 50% -50% 100% -100%
262
- );
263
-
264
- // $$ Top negative
265
- #stacks-internals #build-classes(
266
- responsive,
267
- '.tn', { .template(@value) { top: calc(var(~"--su@{value}") * -1) !important; } },
268
- 1 2 4 6 8 12 16 24 32 48 64 96 128
269
- );
270
-
271
- // $$ Right
272
- #stacks-internals #build-classes(
273
- responsive,
274
- '.r', { .template(@value) { right: var(~"--su@{value}") !important; } },
275
- 1 2 4 6 8 12 16 24 32 48 64 96 128
276
- );
277
-
278
- // $$ Right 0, percent
279
- #stacks-internals #build-classes(
280
- '.r', { .template(@value) { right: @value !important; } },
281
- 0 50% -50% 100% -100%
282
- );
283
-
284
- // $$ Right negative
285
- #stacks-internals #build-classes(
286
- responsive,
287
- '.rn', { .template(@value) { right: calc(var(~"--su@{value}") * -1) !important; } },
288
- 1 2 4 6 8 12 16 24 32 48 64 96 128
289
- );
290
-
291
- // $$ Bottom
292
- #stacks-internals #build-classes(
293
- responsive,
294
- '.b', { .template(@value) { bottom: var(~"--su@{value}") !important; } },
295
- 1 2 4 6 8 12 16 24 32 48 64 96 128
296
- );
297
-
298
- // $$ Bottom 0, percent
299
- #stacks-internals #build-classes(
300
- '.b', { .template(@value) { bottom: @value !important; } },
301
- 0 50% -50% 100% -100%
302
- );
303
-
304
- // $$ Bottom negative
305
- #stacks-internals #build-classes(
306
- responsive,
307
- '.bn', { .template(@value) { bottom: calc(var(~"--su@{value}") * -1) !important; } },
308
- 1 2 4 6 8 12 16 24 32 48 64 96 128
309
- );
310
-
311
- // $$ Left
312
- #stacks-internals #build-classes(
313
- responsive,
314
- '.l', { .template(@value) { left: var(~"--su@{value}") !important; } },
315
- 1 2 4 6 8 12 16 24 32 48 64 96 128
316
- );
317
-
318
- // $$ Left 0, percent
319
- #stacks-internals #build-classes(
320
- '.l', { .template(@value) { left: @value !important; } },
321
- 0 50% -50% 100% -100%
322
- );
323
-
324
- // $$ Left negative
325
- #stacks-internals #build-classes(
326
- responsive,
327
- '.ln', { .template(@value) { left: calc(var(~"--su@{value}") * -1) !important; } },
328
- 1 2 4 6 8 12 16 24 32 48 64 96 128
329
- );
330
-
331
- // $$ Inset
332
- #stacks-internals #build-classes(
333
- responsive,
334
- '.i', { .template(@value) { inset: var(~"--su@{value}") !important; } },
335
- 1 2 4 6 8 12 16 24 32 48 64 96 128
336
- );
337
-
338
- // $$ Inset 0
339
- #stacks-internals #build-classes(
340
- '.i', { .template(@value) { inset: @value !important; } },
341
- 0
342
- );
68
+ .generate-spacing('.mx'; margin-left, margin-right; true);
69
+ .generate-spacing('.my'; margin-top, margin-bottom; true);
70
+
71
+ // PADDING
72
+ .generate-spacing('.p', padding);
73
+ .generate-spacing('.pt', padding-top);
74
+ .generate-spacing('.pr', padding-right);
75
+ .generate-spacing('.pb', padding-bottom);
76
+ .generate-spacing('.pl', padding-left);
77
+ .generate-spacing('.px'; padding-left, padding-right);
78
+ .generate-spacing('.py'; padding-top, padding-bottom);
79
+
80
+ // POSITIONING
81
+ // Inset
82
+ .generate-spacing('.i', inset);
83
+
84
+ // Top
85
+ .generate-spacing('.t', top, true);
86
+ .generate-spacing('.t', top, true, percent);
87
+
88
+ // Right
89
+ .generate-spacing('.r', right, true);
90
+ .generate-spacing('.r', right, true, percent);
91
+
92
+ // Bottom
93
+ .generate-spacing('.b', bottom, true);
94
+ .generate-spacing('.b', bottom, true, percent);
95
+
96
+ // Left
97
+ .generate-spacing('.l', left, true);
98
+ .generate-spacing('.l', left, true, percent);
@@ -0,0 +1,12 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { renderLess } from "../test/less-test-utils";
3
+
4
+ describe("atomic: misc", () => {
5
+ it("should output all atomic css classes", async () => {
6
+ const css = await renderLess(`
7
+ @import "./lib/atomic/spacing.less";
8
+ `);
9
+
10
+ expect(css).toMatchSnapshot();
11
+ });
12
+ });
@@ -1,28 +1,38 @@
1
1
  import { runA11yTests } from "../../test/a11y-test-utils";
2
- // import { Icons } from "@stackoverflow/stacks-icons";
2
+ import { IconEyeSm } from "@stackoverflow/stacks-icons/icons";
3
3
  import "../../index";
4
4
 
5
5
  const variants = {
6
6
  blings: ["gold", "silver", "bronze"],
7
7
  numbers: ["answered", "bounty", "important", "rep", "rep-down", "votes"],
8
- states: {
9
- filled: ["danger", "muted"],
10
- other: ["info", "warning"],
11
- },
8
+ filled: ["danger", "muted"],
9
+ states: ["danger", "muted", "info", "new", "warning"],
12
10
  users: ["admin", "moderator", "staff"],
13
11
  };
14
12
 
15
13
  describe("badge", () => {
16
- // Award badges (Default/badge counts)
14
+ // Base badge
15
+ runA11yTests({
16
+ baseClass: "s-badge",
17
+ children: {
18
+ default: `base badge`,
19
+ },
20
+ tag: "span",
21
+ });
22
+
23
+ // Award badges
17
24
  variants.blings.map((bling) => {
18
25
  runA11yTests({
19
26
  baseClass: "s-badge",
20
27
  variants: [bling],
21
28
  children: {
22
29
  default: `<span class="s-award-bling s-award-bling__${bling}">
23
- Altruist
30
+ with bling
24
31
  </span>`,
25
32
  },
33
+ options: {
34
+ includeNullVariant: false,
35
+ },
26
36
  tag: "span",
27
37
  });
28
38
  });
@@ -34,22 +44,49 @@ describe("badge", () => {
34
44
  children: {
35
45
  default: "123",
36
46
  },
47
+ options: {
48
+ includeNullVariant: false,
49
+ },
50
+ tag: "span",
51
+ });
52
+
53
+ // State badges
54
+ runA11yTests({
55
+ baseClass: "s-badge",
56
+ variants: variants.states,
57
+ children: {
58
+ default: `badge`,
59
+ },
60
+ tag: "span",
61
+ skippedTestids: ["s-badge-dark-new"],
62
+ });
63
+
64
+ // State badges w/ filled modifier
65
+ runA11yTests({
66
+ baseClass: "s-badge",
67
+ variants: variants.filled,
68
+ modifiers: {
69
+ primary: ["filled"],
70
+ },
71
+ children: {
72
+ default: `filled badge`,
73
+ },
37
74
  options: {
38
75
  includeNullModifier: false,
39
76
  },
40
77
  tag: "span",
41
78
  });
42
79
 
43
- // Icon badges
80
+ // State badges w/ filled modifier and icon
44
81
  runA11yTests({
45
82
  baseClass: "s-badge",
46
- variants: [...variants.states.filled, ...variants.states.other],
83
+ variants: variants.filled,
47
84
  modifiers: {
48
- primary: ["icon"],
85
+ primary: ["filled"],
86
+ secondary: ["icon"],
49
87
  },
50
88
  children: {
51
- default: "with icon",
52
- // icon: Icons.IconEyeSm, // TODO fix the icon imports
89
+ default: `${IconEyeSm} icon badge`,
53
90
  },
54
91
  options: {
55
92
  includeNullModifier: false,
@@ -57,20 +94,18 @@ describe("badge", () => {
57
94
  tag: "span",
58
95
  });
59
96
 
60
- // Filled badges
97
+ // State badges w/ icon
61
98
  runA11yTests({
62
99
  baseClass: "s-badge",
63
- variants: variants.states.filled,
100
+ variants: variants.states.filter((state) => state !== "new"),
64
101
  modifiers: {
65
102
  primary: ["icon"],
66
103
  },
67
104
  children: {
68
- default: "filled",
69
- // icon: Icons.IconEyeOffSm, // TODO fix the icon imports
105
+ default: `${IconEyeSm} icon badge`,
70
106
  },
71
107
  options: {
72
108
  includeNullModifier: false,
73
- includeNullVariant: false,
74
109
  },
75
110
  tag: "span",
76
111
  });
@@ -83,7 +118,10 @@ describe("badge", () => {
83
118
  primary: ["xs", "sm"],
84
119
  },
85
120
  children: {
86
- default: "user",
121
+ default: "user badge",
122
+ },
123
+ options: {
124
+ includeNullVariant: false,
87
125
  },
88
126
  tag: "span",
89
127
  });
@@ -97,6 +135,9 @@ describe("badge", () => {
97
135
  children: {
98
136
  default: "size badge",
99
137
  },
138
+ options: {
139
+ includeNullModifier: false,
140
+ },
100
141
  tag: "span",
101
142
  });
102
143
  });
@@ -4,10 +4,12 @@
4
4
  --_ba-bg: var(--black-150);
5
5
  --_ba-fc: var(--black-500);
6
6
  --_ba-fs: var(--fs-caption);
7
+ --_ba-fw: normal;
7
8
  --_ba-g: 0.3em;
8
9
  --_ba-lh: 2;
9
10
  --_ba-px: var(--su6);
10
11
  --_ba-py: 0;
12
+ --_ba-tt: unset;
11
13
  --_ba-wmn: 0;
12
14
 
13
15
  // CONTEXTUAL STYLES
@@ -26,6 +28,10 @@
26
28
  &__staff {
27
29
  --_ba-bc: currentColor;
28
30
  }
31
+
32
+ &__new {
33
+ --_ba-fc: var(--purple-600);
34
+ }
29
35
  });
30
36
 
31
37
  // MODIFIERS
@@ -208,6 +214,14 @@
208
214
  }
209
215
  }
210
216
 
217
+ &&__new {
218
+ --_ba-bc: var(--_ba-bg);
219
+ --_ba-bg: var(--purple-100);
220
+ --_ba-fc: var(--purple-400);
221
+ --_ba-fw: bold;
222
+ --_ba-tt: uppercase;
223
+ }
224
+
211
225
  // CHILD ELEMENTS
212
226
  &--image, // Included with no base class to account for usage in .s-progress__badge
213
227
  & &--image {
@@ -228,14 +242,15 @@
228
242
  color: var(--_ba-fc);
229
243
  font-size: var(--_ba-fs);
230
244
  gap: var(--_ba-g);
245
+ font-weight: var(--_ba-fw);
231
246
  line-height: var(--_ba-lh);
232
247
  min-width: var(--_ba-wmn);
233
248
  padding: var(--_ba-py) var(--_ba-px);
249
+ text-transform: var(--_ba-tt);
234
250
 
235
251
  align-items: center;
236
252
  border-radius: var(--br-sm);
237
253
  display: inline-flex;
238
- font-weight: normal;
239
254
  justify-content: center;
240
255
  text-decoration: none;
241
256
  vertical-align: middle;