@stackoverflow/stacks 2.2.0 → 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.
- package/dist/css/stacks.css +2187 -758
- package/dist/css/stacks.min.css +1 -1
- package/lib/atomic/__snapshots__/spacing.less.test.ts.snap +1928 -0
- package/lib/atomic/spacing.less +59 -303
- package/lib/atomic/spacing.less.test.ts +12 -0
- package/lib/components/button/button.a11y.test.ts +14 -18
- package/lib/components/button/button.less +16 -22
- package/lib/components/button/button.test.setup.ts +36 -0
- package/lib/components/button/button.visual.test.ts +3 -33
- package/lib/components/button-group/button-group.a11y.test.ts +12 -0
- package/lib/components/button-group/button-group.less +43 -49
- package/lib/components/button-group/button-group.test.setup.ts +77 -0
- package/lib/components/button-group/button-group.visual.test.ts +7 -0
- package/lib/components/input_textarea/input_textarea.less +3 -1
- package/lib/components/post-summary/post-summary.a11y.test.ts +25 -0
- package/lib/components/post-summary/post-summary.test.setup.ts +435 -0
- package/lib/components/post-summary/post-summary.visual.test.ts +17 -0
- package/lib/components/topbar/topbar.less +365 -335
- package/lib/components/topbar/topbar.visual.test.ts +28 -0
- package/lib/exports/spacing-mixins.less +67 -0
- package/lib/tsconfig.build.json +1 -1
- package/lib/tsconfig.json +3 -3
- package/package.json +12 -12
package/lib/atomic/spacing.less
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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,25 +1,21 @@
|
|
|
1
|
+
import testArgs from "./button.test.setup";
|
|
1
2
|
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
3
|
import "../../index";
|
|
3
4
|
|
|
4
5
|
describe("button", () => {
|
|
5
6
|
runA11yTests({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
children: {
|
|
21
|
-
default: "Ask question",
|
|
22
|
-
},
|
|
23
|
-
tag: "button",
|
|
7
|
+
...testArgs,
|
|
8
|
+
excludedTestids: [
|
|
9
|
+
/^s-btn-(?=.*unset).*badge$/, // s-btn with badge and unset variant not supported
|
|
10
|
+
],
|
|
11
|
+
skippedTestids: [
|
|
12
|
+
// TODO resolve btn badge contrast issues
|
|
13
|
+
// matches tests with a badge in light and dark modes
|
|
14
|
+
/s-btn-(light|dark).*?badge/,
|
|
15
|
+
// matches tests with a badge in highcontrast-light modes, excluding filled, danger, github, facebook, sm, or xs
|
|
16
|
+
/s-btn-highcontrast-light-(?!.*(filled|danger|github|facebook|sm|xs)).*?badge/,
|
|
17
|
+
// matches tests with a badge in highcontrast-light modes, are muted and/or outlined, and are sm or xs
|
|
18
|
+
/s-btn-highcontrast-light-(?:muted-outlined-|muted-|outlined-)?(?:sm|xs).*?badge/,
|
|
19
|
+
],
|
|
24
20
|
});
|
|
25
21
|
});
|
|
@@ -144,6 +144,10 @@
|
|
|
144
144
|
// Resets
|
|
145
145
|
&&__link,
|
|
146
146
|
&&__unset {
|
|
147
|
+
--_bu-baw: 0;
|
|
148
|
+
--_bu-br: 0;
|
|
149
|
+
--_bu-p: 0;
|
|
150
|
+
|
|
147
151
|
&:focus,
|
|
148
152
|
&:focus-visible {
|
|
149
153
|
outline-style: auto;
|
|
@@ -151,10 +155,6 @@
|
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
&&__link {
|
|
154
|
-
--_bu-baw: 0;
|
|
155
|
-
--_bu-br: 0;
|
|
156
|
-
--_bu-p: 0;
|
|
157
|
-
|
|
158
158
|
&,
|
|
159
159
|
&:hover,
|
|
160
160
|
&:active,
|
|
@@ -180,11 +180,8 @@
|
|
|
180
180
|
&:hover,
|
|
181
181
|
&:active,
|
|
182
182
|
&:focus {
|
|
183
|
-
--_bu-baw: 0;
|
|
184
183
|
--_bu-bg: none;
|
|
185
|
-
--_bu-br: 0;
|
|
186
184
|
--_bu-fc: unset;
|
|
187
|
-
--_bu-p: 0;
|
|
188
185
|
|
|
189
186
|
cursor: default;
|
|
190
187
|
font: unset;
|
|
@@ -204,12 +201,12 @@
|
|
|
204
201
|
content: "";
|
|
205
202
|
pointer-events: none;
|
|
206
203
|
position: absolute;
|
|
207
|
-
right: var(--_bu-p);
|
|
204
|
+
right: var(--_bu-px, var(--_bu-p));
|
|
208
205
|
top: calc(50% - var(--su-static2));
|
|
209
206
|
z-index: var(--zi-active);
|
|
210
207
|
}
|
|
211
208
|
|
|
212
|
-
padding-right: calc(var(--_bu-p) * 2.5);
|
|
209
|
+
padding-right: calc(var(--_bu-px, var(--_bu-p)) * 2.5);
|
|
213
210
|
}
|
|
214
211
|
|
|
215
212
|
&&__icon {
|
|
@@ -408,24 +405,21 @@
|
|
|
408
405
|
// INTERACTION
|
|
409
406
|
&:not(&__link):not(&__unset):focus-visible,
|
|
410
407
|
&--radio:focus-visible + & {
|
|
411
|
-
border-color: var(--theme-secondary-400) !important;
|
|
412
408
|
.focus-styles(true, true);
|
|
413
409
|
}
|
|
414
410
|
|
|
415
|
-
&:not(&__link):not(&__unset):not(&__facebook):not(&__github):not(&__google):not(.is-selected)
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
411
|
+
&:not(&--radio:checked + label):not(&__link):not(&__unset):not(&__facebook):not(&__github):not(&__google):not(.is-selected) {
|
|
412
|
+
&:focus-visible {
|
|
413
|
+
&.s-btn__filled {
|
|
414
|
+
&:not(:hover) .s-btn--number {
|
|
415
|
+
color: var(--_bu-number-fc-focus, var(--_bu-number-fc-filled));
|
|
416
|
+
}
|
|
422
417
|
|
|
423
|
-
|
|
424
|
-
|
|
418
|
+
background-color: var(--_bu-bg-focus, var(--_bu-filled-bg));
|
|
419
|
+
color: var(--_bu-fc-focus, var(--_bu-filled-fc));
|
|
420
|
+
}
|
|
425
421
|
}
|
|
426
|
-
}
|
|
427
422
|
|
|
428
|
-
&:not(&__link):not(&__unset):not(&__facebook):not(&__github):not(&__google):not(.is-selected) {
|
|
429
423
|
&:hover {
|
|
430
424
|
&.s-btn__filled {
|
|
431
425
|
background-color: var(--_bu-filled-bg-hover);
|
|
@@ -472,7 +466,7 @@
|
|
|
472
466
|
box-shadow: none;
|
|
473
467
|
color: var(--_bu-fc);
|
|
474
468
|
font-size: var(--_bu-fs);
|
|
475
|
-
padding: var(--_bu-p);
|
|
469
|
+
padding: var(--_bu-py, var(--_bu-p)) var(--_bu-px, var(--_bu-p));
|
|
476
470
|
|
|
477
471
|
cursor: pointer;
|
|
478
472
|
display: inline-block;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TestVariationArgs } from "../../test/test-utils";
|
|
2
|
+
import "../../index";
|
|
3
|
+
|
|
4
|
+
const getChild = (child?: string): string => {
|
|
5
|
+
switch (child) {
|
|
6
|
+
case "badge":
|
|
7
|
+
return `Ask question
|
|
8
|
+
<span class="s-btn--badge">
|
|
9
|
+
<span class="s-btn--number">198</span>
|
|
10
|
+
</span>`;
|
|
11
|
+
default:
|
|
12
|
+
return "Ask question";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// TODO test disabled states, interaction pseudo-classes
|
|
17
|
+
const testArgs: TestVariationArgs = {
|
|
18
|
+
baseClass: "s-btn",
|
|
19
|
+
variants: ["danger", "muted"],
|
|
20
|
+
modifiers: {
|
|
21
|
+
primary: ["filled", "outlined"],
|
|
22
|
+
secondary: [...["xs", "sm", "md"], ...["dropdown", "icon"]],
|
|
23
|
+
global: ["is-loading"],
|
|
24
|
+
standalone: [...["link", "unset"], ...["facebook", "github", "google"]],
|
|
25
|
+
},
|
|
26
|
+
attributes: {
|
|
27
|
+
type: "button",
|
|
28
|
+
},
|
|
29
|
+
children: {
|
|
30
|
+
default: getChild(),
|
|
31
|
+
badge: getChild("badge"),
|
|
32
|
+
},
|
|
33
|
+
tag: "button",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default testArgs;
|
|
@@ -1,41 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import testArgs from "./button.test.setup";
|
|
2
2
|
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
3
|
import "../../index";
|
|
4
|
-
|
|
5
|
-
const getChild = (child?: string): string => {
|
|
6
|
-
switch (child) {
|
|
7
|
-
case "badge":
|
|
8
|
-
return `Ask question
|
|
9
|
-
<span class="s-btn--badge">
|
|
10
|
-
<span class="s-btn--number">198</span>
|
|
11
|
-
</span>`;
|
|
12
|
-
default:
|
|
13
|
-
return "Ask question";
|
|
14
|
-
}
|
|
15
|
-
};
|
|
4
|
+
import { html } from "@open-wc/testing";
|
|
16
5
|
|
|
17
6
|
describe("button", () => {
|
|
18
|
-
// TODO test disabled states, interaction pseudo-classes
|
|
19
7
|
runVisualTests({
|
|
20
|
-
|
|
21
|
-
variants: ["danger", "muted"],
|
|
22
|
-
modifiers: {
|
|
23
|
-
primary: ["filled", "outlined"],
|
|
24
|
-
secondary: [...["xs", "sm", "md"], ...["dropdown", "icon"]],
|
|
25
|
-
global: ["is-loading"],
|
|
26
|
-
standalone: [
|
|
27
|
-
...["link", "unset"],
|
|
28
|
-
...["facebook", "github", "google"],
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
attributes: {
|
|
32
|
-
type: "button",
|
|
33
|
-
},
|
|
34
|
-
children: {
|
|
35
|
-
default: getChild(),
|
|
36
|
-
badge: getChild("badge"),
|
|
37
|
-
},
|
|
38
|
-
tag: "button",
|
|
8
|
+
...testArgs,
|
|
39
9
|
template: ({ component, testid }) => html`
|
|
40
10
|
<div
|
|
41
11
|
class="bg-black-225 d-inline-flex ai-center jc-center hs1 ws2 p8"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { testArgs } from "./button-group.test.setup";
|
|
2
|
+
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
describe("button group", () => {
|
|
6
|
+
runA11yTests({
|
|
7
|
+
...testArgs,
|
|
8
|
+
// TODO remove skipped tests once btn badge contrast issues are resolved
|
|
9
|
+
// see also https://github.com/StackExchange/Stacks/pull/1663
|
|
10
|
+
skippedTestids: [/s-btn-group-(light|dark|highcontrast-light)-badge/],
|
|
11
|
+
});
|
|
12
|
+
});
|