@stackoverflow/stacks 2.0.0-rc.0 → 2.0.0-rc.2
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/README.md +5 -0
- package/dist/css/stacks.css +582 -532
- package/dist/css/stacks.min.css +1 -1
- package/dist/js/stacks.js +265 -110
- package/dist/js/stacks.min.js +1 -1
- package/lib/atomic/typography.less +4 -0
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +1 -1
- package/lib/components/activity-indicator/activity-indicator.less +17 -4
- package/lib/components/anchor/anchor.visual.test.ts +1 -5
- package/lib/components/avatar/avatar.visual.test.ts +1 -4
- package/lib/components/badge/badge.a11y.test.ts +2 -2
- package/lib/components/badge/badge.less +15 -23
- package/lib/components/block-link/block-link.less +5 -4
- package/lib/components/button/button.a11y.test.ts +2 -5
- package/lib/components/button/button.less +28 -58
- package/lib/components/button/button.visual.test.ts +2 -5
- package/lib/components/card/card.less +8 -0
- package/lib/components/description/description.a11y.test.ts +1 -0
- package/lib/components/expandable/expandable.a11y.test.ts +27 -0
- package/lib/components/expandable/expandable.visual.test.ts +27 -0
- package/lib/components/input-icon/input-icon.less +1 -1
- package/lib/components/input-message/input-message.less +4 -3
- package/lib/components/label/label.less +3 -13
- package/lib/components/link-preview/link-preview.a11y.test.ts +48 -0
- package/lib/components/link-preview/link-preview.less +13 -4
- package/lib/components/link-preview/link-preview.visual.test.ts +52 -0
- package/lib/components/notice/notice.a11y.test.ts +17 -0
- package/lib/components/notice/notice.less +44 -81
- package/lib/components/notice/notice.visual.test.ts +26 -0
- package/lib/components/pagination/pagination.a11y.test.ts +20 -0
- package/lib/components/pagination/pagination.visual.test.ts +26 -0
- package/lib/components/post-summary/post-summary.less +3 -3
- package/lib/components/sidebar-widget/sidebar-widget.less +2 -2
- package/lib/components/spinner/spinner.a11y.test.ts +15 -0
- package/lib/components/spinner/spinner.visual.test.ts +43 -0
- package/lib/components/toast/toast.a11y.test.ts +30 -0
- package/lib/components/toast/toast.visual.test.ts +10 -6
- package/lib/components/toggle-switch/toggle-switch.less +2 -5
- package/lib/components/uploader/uploader.less +19 -13
- package/lib/exports/color-sets.less +127 -78
- package/lib/exports/theme.less +3 -3
- package/lib/input-utils.less +1 -1
- package/lib/test/axe-apca/README.md +19 -0
- package/lib/test/axe-apca/src/axe-apca.test.ts +77 -1
- package/lib/test/axe-apca/src/axe-apca.ts +16 -8
- package/lib/test/test-utils.ts +7 -3
- package/package.json +12 -12
|
@@ -53,10 +53,6 @@
|
|
|
53
53
|
&&__silver,
|
|
54
54
|
&&__bronze {
|
|
55
55
|
--_ba-fc: var(--black-500);
|
|
56
|
-
|
|
57
|
-
.highcontrast-mode({
|
|
58
|
-
--_ba-fc: var(--black-600);
|
|
59
|
-
});
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
&&__gold {
|
|
@@ -93,11 +89,11 @@
|
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
&&__bounty {
|
|
96
|
-
--_ba-bg: var(--blue-
|
|
92
|
+
--_ba-bg: var(--blue-400);
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
&&__important {
|
|
100
|
-
--_ba-bg: var(--red-
|
|
96
|
+
--_ba-bg: var(--red-400);
|
|
101
97
|
}
|
|
102
98
|
|
|
103
99
|
&&__rep {
|
|
@@ -118,8 +114,8 @@
|
|
|
118
114
|
// Users
|
|
119
115
|
&&__admin {
|
|
120
116
|
--_ba-bc: var(--theme-primary-300);
|
|
121
|
-
--_ba-bg: var(--theme-primary-
|
|
122
|
-
--_ba-fc: var(--theme-primary-
|
|
117
|
+
--_ba-bg: var(--theme-primary-100);
|
|
118
|
+
--_ba-fc: var(--theme-primary-500);
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
&&__moderator {
|
|
@@ -167,7 +163,7 @@
|
|
|
167
163
|
&&__staff {
|
|
168
164
|
// Staff badges are always "Stack Overflow Orange"
|
|
169
165
|
--_ba-bc: var(--orange-400);
|
|
170
|
-
--_ba-bg: var(--orange-
|
|
166
|
+
--_ba-bg: var(--orange-200);
|
|
171
167
|
--_ba-fc: var(--orange-600);
|
|
172
168
|
}
|
|
173
169
|
|
|
@@ -180,35 +176,31 @@
|
|
|
180
176
|
}
|
|
181
177
|
|
|
182
178
|
&&__danger {
|
|
183
|
-
--_ba-bc: var(--red-
|
|
184
|
-
--_ba-bg: var(--red-
|
|
179
|
+
--_ba-bc: var(--red-400);
|
|
180
|
+
--_ba-bg: var(--red-200);
|
|
185
181
|
--_ba-fc: var(--red-600);
|
|
186
182
|
|
|
187
183
|
&.s-badge__filled {
|
|
188
184
|
--_ba-bg: var(--red-400);
|
|
189
|
-
--_ba-fc: var(--
|
|
190
|
-
|
|
191
|
-
.highcontrast-mode({
|
|
192
|
-
--_ba-fc: var(--white);
|
|
193
|
-
});
|
|
185
|
+
--_ba-fc: var(--white);
|
|
194
186
|
}
|
|
195
187
|
}
|
|
196
188
|
&&__info {
|
|
197
|
-
--_ba-bc: var(--blue-
|
|
198
|
-
--_ba-bg: var(--blue-
|
|
189
|
+
--_ba-bc: var(--blue-400);
|
|
190
|
+
--_ba-bg: var(--blue-200);
|
|
199
191
|
--_ba-fc: var(--blue-600);
|
|
200
192
|
}
|
|
201
193
|
|
|
202
194
|
&&__warning {
|
|
203
|
-
--_ba-bc: var(--yellow-
|
|
204
|
-
--_ba-bg: var(--yellow-
|
|
195
|
+
--_ba-bc: var(--yellow-400);
|
|
196
|
+
--_ba-bg: var(--yellow-200);
|
|
205
197
|
--_ba-fc: var(--yellow-600);
|
|
206
198
|
}
|
|
207
199
|
|
|
208
200
|
&&__muted {
|
|
209
|
-
--_ba-bc: var(--black-
|
|
210
|
-
--_ba-bg: var(--black-
|
|
211
|
-
--_ba-fc: var(--black-
|
|
201
|
+
--_ba-bc: var(--black-400);
|
|
202
|
+
--_ba-bg: var(--black-200);
|
|
203
|
+
--_ba-fc: var(--black-500);
|
|
212
204
|
|
|
213
205
|
&.s-badge__filled {
|
|
214
206
|
--_ba-bg: var(--black-500);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
a.s-block-link,
|
|
2
2
|
.s-block-link {
|
|
3
|
-
|
|
3
|
+
--_bl-bs-color: var(--theme-primary);
|
|
4
4
|
--_bl-bg: transparent;
|
|
5
5
|
--_bl-fc: var(--black-500);
|
|
6
6
|
--_bl-fc-hover: var(--black-600);
|
|
@@ -31,10 +31,10 @@ a.s-block-link,
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
&:focus-visible {
|
|
34
|
-
box-shadow:
|
|
34
|
+
box-shadow: inset var(--_li-block-bs-offset-x, 3px) 0 0 var(--_bl-bs-color), 0 0 0 var(--su-static4) var(--focus-ring-muted);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
box-shadow:
|
|
37
|
+
box-shadow: inset var(--_li-block-bs-offset-x, 3px) 0 0 var(--_bl-bs-color);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -48,6 +48,7 @@ a.s-block-link,
|
|
|
48
48
|
&&__danger {
|
|
49
49
|
--_bl-fc: var(--red-400);
|
|
50
50
|
--_bl-fc-hover: var(--red-500);
|
|
51
|
+
--_bl-fc-visited: var(--red-500);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
&:active,
|
|
@@ -59,7 +60,7 @@ a.s-block-link,
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
&:visited {
|
|
62
|
-
color: var(--_bl-fc-
|
|
63
|
+
color: var(--_bl-fc-visited);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
@focus-styles();
|
|
@@ -5,7 +5,7 @@ describe("button", () => {
|
|
|
5
5
|
runComponentTests({
|
|
6
6
|
type: "a11y",
|
|
7
7
|
baseClass: "s-btn",
|
|
8
|
-
variants: ["danger", "muted"
|
|
8
|
+
variants: ["danger", "muted"],
|
|
9
9
|
modifiers: {
|
|
10
10
|
primary: ["filled", "outlined"],
|
|
11
11
|
secondary: [...["xs", "sm", "md"], ...["dropdown", "icon"]],
|
|
@@ -21,9 +21,6 @@ describe("button", () => {
|
|
|
21
21
|
children: {
|
|
22
22
|
default: "Ask question",
|
|
23
23
|
},
|
|
24
|
-
tag: "button"
|
|
25
|
-
excludedTestids: [
|
|
26
|
-
/primary-outlined/, // This combination is not supported
|
|
27
|
-
],
|
|
24
|
+
tag: "button"
|
|
28
25
|
});
|
|
29
26
|
});
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
// Filled
|
|
20
20
|
--_bu-filled-bc: transparent;
|
|
21
21
|
--_bu-filled-bc-active: transparent;
|
|
22
|
-
--_bu-filled-bg-hover: var(--theme-button-filled-hover-background-color);
|
|
23
22
|
--_bu-filled-bc-selected: transparent;
|
|
24
|
-
--_bu-filled-bg: var(--theme-button-
|
|
25
|
-
--_bu-filled-bg-active: var(--theme-button-
|
|
26
|
-
--_bu-filled-bg-
|
|
27
|
-
--_bu-filled-
|
|
28
|
-
--_bu-filled-fc
|
|
29
|
-
--_bu-filled-fc-
|
|
30
|
-
--_bu-filled-fc-
|
|
23
|
+
--_bu-filled-bg: var(--theme-button-primary-background-color);
|
|
24
|
+
--_bu-filled-bg-active: var(--theme-button-primary-active-background-color);
|
|
25
|
+
--_bu-filled-bg-hover: var(--theme-button-primary-hover-background-color);
|
|
26
|
+
--_bu-filled-bg-selected: var(--theme-button-primary-selected-background-color);
|
|
27
|
+
--_bu-filled-fc: var(--theme-button-primary-color);
|
|
28
|
+
--_bu-filled-fc-active: var(--theme-button-primary-hover-color);
|
|
29
|
+
--_bu-filled-fc-hover: var(--theme-button-primary-hover-color);
|
|
30
|
+
--_bu-filled-fc-selected: var(--theme-button-primary-selected-color);
|
|
31
31
|
// Outlined
|
|
32
32
|
--_bu-outlined-bc: var(--theme-button-outlined-border-color);
|
|
33
33
|
--_bu-outlined-bg: var(--theme-button-outlined-background-color);
|
|
@@ -38,20 +38,18 @@
|
|
|
38
38
|
--_bu-badge-o: 0.5;
|
|
39
39
|
--_bu-dropdown-bw: var(--su-static4);
|
|
40
40
|
--_bu-number-fc: var(--white);
|
|
41
|
-
--_bu-number-fc-
|
|
41
|
+
--_bu-number-fc-filled: var(--theme-button-primary-number-color);
|
|
42
|
+
--_bu-number-fc-selected: var(--white);
|
|
42
43
|
|
|
43
44
|
// CONTEXTUAL STYLES
|
|
44
45
|
.highcontrast-mode({
|
|
45
46
|
--_bu-bc: currentColor;
|
|
46
|
-
--_bu-filled-bc: var(--_bu-bc);
|
|
47
47
|
--_bu-outlined-bc: var(--_bu-bc);
|
|
48
48
|
--_bu-bc-selected: var(--_bu-bc);
|
|
49
|
+
--_bu-fc-selected: var(--white);
|
|
50
|
+
--_bu-outlined-fc-selected: var(--white);
|
|
49
51
|
--_bu-badge-o: 0.8;
|
|
50
|
-
|
|
51
|
-
&:not(.s-btn__primary):not(.s-btn__muted):not(.s-btn__danger):not(.is-selected):not(.s-btn__link):not(.s-btn__unset) {
|
|
52
|
-
--_bu-bg-hover: var(--theme-secondary-300);
|
|
53
|
-
--_bu-filled-bg-hover: var(--theme-secondary-400);
|
|
54
|
-
}
|
|
52
|
+
--_bu-number-fc-selected: var(--theme-button-primary-number-color);
|
|
55
53
|
});
|
|
56
54
|
|
|
57
55
|
// STATES
|
|
@@ -115,6 +113,10 @@
|
|
|
115
113
|
|
|
116
114
|
// MODIFIERS
|
|
117
115
|
&&__filled {
|
|
116
|
+
.s-btn--number {
|
|
117
|
+
color: var(--_bu-number-fc-filled);
|
|
118
|
+
}
|
|
119
|
+
|
|
118
120
|
border-color: var(--_bu-filled-bc);
|
|
119
121
|
background-color: var(--_bu-filled-bg);
|
|
120
122
|
color: var(--_bu-filled-fc);
|
|
@@ -254,23 +256,8 @@
|
|
|
254
256
|
--_bu-outlined-bc-selected: var(--red-500);
|
|
255
257
|
--_bu-outlined-bg-selected: var(--_bu-bg-selected);
|
|
256
258
|
--_bu-outlined-fc-selected: var(--_bu-fc-selected);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
--_bu-number-fc: var(--black);
|
|
260
|
-
|
|
261
|
-
.dark-mode({
|
|
262
|
-
--_bu-filled-fc: var(--black);
|
|
263
|
-
--_bu-filled-fc-selected: var(--white);
|
|
264
|
-
--_bu-number-fc: var(--white);
|
|
265
|
-
--_bu-number-fc-selected: var(--black);
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
.highcontrast-dark-mode({
|
|
269
|
-
--_bu-filled-fc: var(--white);
|
|
270
|
-
--_bu-number-fc: var(--black);
|
|
271
|
-
--_bu-number-fc-selected: var(--black);
|
|
272
|
-
});
|
|
273
|
-
}
|
|
259
|
+
--_bu-number-fc: var(--white);
|
|
260
|
+
--_bu-number-fc-filled: var(--black);
|
|
274
261
|
}
|
|
275
262
|
|
|
276
263
|
&&__muted {
|
|
@@ -298,24 +285,26 @@
|
|
|
298
285
|
--_bu-outlined-bc-selected: var(--black-300);
|
|
299
286
|
--_bu-outlined-bg-selected: var(--_bu-bg-selected);
|
|
300
287
|
--_bu-outlined-fc-selected: var(--_bu-fc-selected);
|
|
288
|
+
--_bu-number-fc-selected: var(--white);
|
|
301
289
|
|
|
302
290
|
.highcontrast-mode({
|
|
303
291
|
--_bu-bg-hover: var(--black-225);
|
|
304
|
-
// The filled modifier on the muted button is deprecated and is to be
|
|
305
|
-
// removed in Stacks Classic v2
|
|
292
|
+
// // The filled modifier on the muted button is deprecated and is to be
|
|
293
|
+
// // removed in Stacks Classic v2
|
|
306
294
|
--_bu-filled-bg: var(--black-400);
|
|
307
295
|
--_bu-filled-bg-active: var(--black-500);
|
|
308
296
|
--_bu-filled-bg-hover: var(--black-400);
|
|
309
297
|
--_bu-filled-bg-selected: var(--black-500);
|
|
310
298
|
--_bu-filled-fc: var(--white);
|
|
311
299
|
--_bu-filled-fc-selected: var(--_bu-filled-fc);
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
300
|
+
--_bu-fc-selected: var(--black);
|
|
301
|
+
--_bu-number-fc: var(--white);
|
|
302
|
+
--_bu-number-fc-filled: var(--black);
|
|
303
|
+
--_bu-number-fc-selected: var(--white);
|
|
316
304
|
});
|
|
317
305
|
}
|
|
318
306
|
|
|
307
|
+
// DEPRECATED - THE PRIMARY BUTTON STYLE IS TO BE REMOVED WITH V1 COLORS
|
|
319
308
|
&&__primary {
|
|
320
309
|
--_bu-bg: var(--theme-button-primary-background-color);
|
|
321
310
|
--_bu-bg-active: var(--theme-button-primary-active-background-color);
|
|
@@ -326,30 +315,11 @@
|
|
|
326
315
|
--_bu-fc-hover: var(--theme-button-primary-hover-color);
|
|
327
316
|
--_bu-fc-selected: var(--theme-button-primary-selected-color);
|
|
328
317
|
--_bu-number-fc: var(--theme-button-primary-number-color);
|
|
329
|
-
|
|
330
|
-
.dark-mode({
|
|
331
|
-
--_bu-bg: var(--theme-secondary-400);
|
|
332
|
-
--_bu-bg-active: var(--theme-secondary-400);
|
|
333
|
-
--_bu-bg-hover: var(--theme-secondary-400);
|
|
334
|
-
--_bu-fc: var(--black);
|
|
335
|
-
--_bu-fc-active: var(--_bu-fc);
|
|
336
|
-
--_bu-fc-hover: var(--_bu-fc);
|
|
337
|
-
--_bu-fc-selected: var(--white);
|
|
338
|
-
--_bu-number-fc: var(--white);
|
|
339
|
-
--_bu-number-fc-selected: var(--black);
|
|
340
|
-
});
|
|
318
|
+
--_bu-number-fc-selected: var(--theme-button-primary-number-color);
|
|
341
319
|
|
|
342
320
|
.highcontrast-mode({
|
|
343
321
|
--_bu-bc: transparent;
|
|
344
322
|
});
|
|
345
|
-
|
|
346
|
-
.highcontrast-dark-mode({
|
|
347
|
-
--_bu-bg: var(--theme-secondary-400);
|
|
348
|
-
--_bu-bg-active: var(--theme-secondary-500);
|
|
349
|
-
--_bu-bg-hover: var(--theme-secondary-400);
|
|
350
|
-
--_bu-fc: var(--white);
|
|
351
|
-
--_bu-number-fc: var(--black);
|
|
352
|
-
});
|
|
353
323
|
}
|
|
354
324
|
|
|
355
325
|
// Social
|
|
@@ -19,7 +19,7 @@ describe("button", () => {
|
|
|
19
19
|
runComponentTests({
|
|
20
20
|
type: "visual",
|
|
21
21
|
baseClass: "s-btn",
|
|
22
|
-
variants: ["danger", "muted"
|
|
22
|
+
variants: ["danger", "muted"],
|
|
23
23
|
modifiers: {
|
|
24
24
|
primary: ["filled", "outlined"],
|
|
25
25
|
secondary: [...["xs", "sm", "md"], ...["dropdown", "icon"]],
|
|
@@ -44,9 +44,6 @@ describe("button", () => {
|
|
|
44
44
|
>
|
|
45
45
|
${component}
|
|
46
46
|
</div>
|
|
47
|
-
|
|
48
|
-
excludedTestids: [
|
|
49
|
-
/primary-outlined/, // This combination is not supported
|
|
50
|
-
],
|
|
47
|
+
`
|
|
51
48
|
});
|
|
52
49
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
describe("expandable", () => {
|
|
6
|
+
runComponentTests({
|
|
7
|
+
type: "a11y",
|
|
8
|
+
baseClass: "s-expandable",
|
|
9
|
+
modifiers: {
|
|
10
|
+
global: ["is-expanded"],
|
|
11
|
+
},
|
|
12
|
+
children: {
|
|
13
|
+
default: `
|
|
14
|
+
<div class="s-expandable--content">
|
|
15
|
+
<p class="mb8">Expandable: Lorem ipsum dolor sit amet, ex iudicabit necessitatibus usu, cetero laboramus concludaturque mel no, facilisis posidonium cu cum. Pro ex senserit dissentiunt, imperdiet intellegam at sed, ex pri dicit eruditi convenire. Est harum movet gubergren ei, errem dictas evertitur ea sit, at mei oratio eligendi. Ad vis legere possit, vis ne ipsum democritum appellantur. Nullam ancillae iudicabit his ad.</p>
|
|
16
|
+
</div>
|
|
17
|
+
`,
|
|
18
|
+
},
|
|
19
|
+
template: ({ component, testid }) => html`
|
|
20
|
+
<div class="ws2 p8" data-testid="${testid}">
|
|
21
|
+
<div><p>Before expandable content</p></div>
|
|
22
|
+
${component}
|
|
23
|
+
<div><p>After expandable content</p></div>
|
|
24
|
+
</div>
|
|
25
|
+
`,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
describe("expandable", () => {
|
|
6
|
+
runComponentTests({
|
|
7
|
+
type: "visual",
|
|
8
|
+
baseClass: "s-expandable",
|
|
9
|
+
modifiers: {
|
|
10
|
+
global: ["is-expanded"],
|
|
11
|
+
},
|
|
12
|
+
children: {
|
|
13
|
+
default: `
|
|
14
|
+
<div class="s-expandable--content">
|
|
15
|
+
<p class="mb8">Expandable: Lorem ipsum dolor sit amet, ex iudicabit necessitatibus usu, cetero laboramus concludaturque mel no, facilisis posidonium cu cum. Pro ex senserit dissentiunt, imperdiet intellegam at sed, ex pri dicit eruditi convenire. Est harum movet gubergren ei, errem dictas evertitur ea sit, at mei oratio eligendi. Ad vis legere possit, vis ne ipsum democritum appellantur. Nullam ancillae iudicabit his ad.</p>
|
|
16
|
+
</div>
|
|
17
|
+
`,
|
|
18
|
+
},
|
|
19
|
+
template: ({ component, testid }) => html`
|
|
20
|
+
<div class="ws2 p8" data-testid="${testid}">
|
|
21
|
+
<div><p>Before expandable content</p></div>
|
|
22
|
+
${component}
|
|
23
|
+
<div><p>After expandable content</p></div>
|
|
24
|
+
</div>
|
|
25
|
+
`,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -18,18 +18,19 @@
|
|
|
18
18
|
.has-error & {
|
|
19
19
|
--_im-fc: var(--red-400);
|
|
20
20
|
--_im-a-fc: var(--red-600);
|
|
21
|
-
--_im-a-fc-hover: var(--red-
|
|
21
|
+
--_im-a-fc-hover: var(--red-500);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.has-success & {
|
|
25
25
|
--_im-fc: var(--green-400);
|
|
26
26
|
--_im-a-fc: var(--green-600);
|
|
27
|
-
--_im-a-fc-hover: var(--green-
|
|
27
|
+
--_im-a-fc-hover: var(--green-500);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.has-warning & {
|
|
31
|
-
--_im-fc: var(--yellow-
|
|
31
|
+
--_im-fc: var(--yellow-500);
|
|
32
32
|
--_im-a-fc: var(--yellow-600);
|
|
33
|
+
--_im-a-fc-hover: var(--yellow-500);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
// CHILD ELEMENTS
|
|
@@ -53,28 +53,18 @@
|
|
|
53
53
|
|
|
54
54
|
// TODO: include child component class (without variant) on selector
|
|
55
55
|
&__beta {
|
|
56
|
-
--_la-status-bg: var(--blue-
|
|
56
|
+
--_la-status-bg: var(--blue-200);
|
|
57
57
|
--_la-status-fc: var(--blue-500);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
&__new {
|
|
61
|
-
--_la-status-bg: var(--green-
|
|
61
|
+
--_la-status-bg: var(--green-200);
|
|
62
62
|
--_la-status-fc: var(--green-500);
|
|
63
|
-
|
|
64
|
-
.dark-mode({
|
|
65
|
-
--_la-status-bg: var(--green-200);
|
|
66
|
-
--_la-status-fc: var(--green-600);
|
|
67
|
-
});
|
|
68
63
|
}
|
|
69
64
|
|
|
70
65
|
&__required {
|
|
71
|
-
--_la-status-bg: var(--red-
|
|
66
|
+
--_la-status-bg: var(--red-200);
|
|
72
67
|
--_la-status-fc: var(--red-500);
|
|
73
|
-
|
|
74
|
-
.dark-mode({
|
|
75
|
-
--_la-status-bg: var(--red-200);
|
|
76
|
-
--_la-status-fc: var(--red-600);
|
|
77
|
-
});
|
|
78
68
|
}
|
|
79
69
|
|
|
80
70
|
background-color: var(--_la-status-bg);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
2
|
+
import "../../index";
|
|
3
|
+
|
|
4
|
+
const getChild = (child?: string): string => {
|
|
5
|
+
return `
|
|
6
|
+
<div class="s-link-preview--header">
|
|
7
|
+
<div class="s-link-preview--icon">👋</div>
|
|
8
|
+
<div>
|
|
9
|
+
<a href="#" class="s-link-preview--title">
|
|
10
|
+
Using hooks for a simple fetch request and breaking the rules of hooks, unsure how?
|
|
11
|
+
</a>
|
|
12
|
+
<div class="s-link-preview--details">
|
|
13
|
+
Issue submitted by Ricky Otero on <relative-time datetime="2019-08-12T04:05:22Z" title="Aug 12, 2019, 12:05 AM EDT">Aug 12, 2019</relative-time> • <strong>RESOLVED</strong>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
${
|
|
18
|
+
child
|
|
19
|
+
? child
|
|
20
|
+
: `
|
|
21
|
+
<div class="s-link-preview--body">
|
|
22
|
+
<p>I'm trying to create a simple fetch with hooks from an AWS database. At the moment it errors out and the only reason I can see is because it breaks the rules of hooks but I'm not sure how. It's at the top level of this functional component and it's not called inside an event handler.</p>
|
|
23
|
+
<p>The result of this call (an array of user data), needs to be exported as a function and called in another file.</p>
|
|
24
|
+
<p>If anyone can spot something I have missed and can highlighted how I'm breaking the rules of hooks I'd be grateful!</p>
|
|
25
|
+
<p>Thanks!</p>
|
|
26
|
+
</div>
|
|
27
|
+
`
|
|
28
|
+
}
|
|
29
|
+
<div class="s-link-preview--footer">
|
|
30
|
+
<a href="#" class="s-link-preview--url">https://stackoverflow.atlassian.net/projects/SREREQ/queues/custom/1</a>
|
|
31
|
+
<a href="#" class="s-link-preview--misc">Privacy notice</a>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
};
|
|
35
|
+
describe("link preview", () => {
|
|
36
|
+
runComponentTests({
|
|
37
|
+
type: "a11y",
|
|
38
|
+
baseClass: "s-link-preview",
|
|
39
|
+
children: {
|
|
40
|
+
default: getChild(),
|
|
41
|
+
code: getChild(`
|
|
42
|
+
<div class="s-link-preview--code">
|
|
43
|
+
<pre class="language-js s-code-block" tabindex="0"><code class="language-js s-code-block"><span class="hljs-meta">'use strict'</span>;</code></pre>
|
|
44
|
+
</div>
|
|
45
|
+
`),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
.s-link-preview {
|
|
2
|
+
--_lp-details-fc: var(--black-400);
|
|
2
3
|
--_lp-details-mt: var(--su2);
|
|
4
|
+
--_lp-footer-bg: var(--black-100);
|
|
3
5
|
--_lp-footer-fd: unset;
|
|
6
|
+
--_lp-header-bg: var(--black-100);
|
|
4
7
|
--_lp-misc-pl: var(--su4);
|
|
5
8
|
--_lp-misc-pt: unset;
|
|
6
9
|
|
|
@@ -12,6 +15,12 @@
|
|
|
12
15
|
--_lp-misc-pt: var(--su2);
|
|
13
16
|
});
|
|
14
17
|
|
|
18
|
+
.highcontrast-mode({
|
|
19
|
+
--_lp-details-fc: var(--black-600);
|
|
20
|
+
--_lp-footer-bg: var(--black-050);
|
|
21
|
+
--_lp-header-bg: var(--black-050);
|
|
22
|
+
});
|
|
23
|
+
|
|
15
24
|
// CHILD ELEMENTS
|
|
16
25
|
& &--details,
|
|
17
26
|
& &--footer {
|
|
@@ -25,7 +34,7 @@
|
|
|
25
34
|
color: var(--black-500);
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
color: var(--black-
|
|
37
|
+
color: var(--black-600);
|
|
29
38
|
cursor: pointer;
|
|
30
39
|
text-decoration: none;
|
|
31
40
|
}
|
|
@@ -49,16 +58,16 @@
|
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
& &--details {
|
|
61
|
+
color: var(--_lp-details-fc);
|
|
52
62
|
margin-top: var(--_lp-details-mt);
|
|
53
63
|
|
|
54
|
-
color: var(--black-400);
|
|
55
64
|
font-size: var(--fs-caption);
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
& &--footer {
|
|
68
|
+
background: var(--_lp-footer-bg);
|
|
59
69
|
flex-direction: var(--_lp-footer-fd);
|
|
60
70
|
|
|
61
|
-
background: var(--black-100);
|
|
62
71
|
border-bottom-left-radius: var(--br-sm);
|
|
63
72
|
border-bottom-right-radius: var(--br-sm);
|
|
64
73
|
border-top: var(--su-static1) solid var(--bc-medium);
|
|
@@ -69,7 +78,7 @@
|
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
& &--header {
|
|
72
|
-
background: var(--
|
|
81
|
+
background: var(--_lp-header-bg);
|
|
73
82
|
border-bottom: var(--su-static1) solid var(--bc-medium);
|
|
74
83
|
border-top-left-radius: var(--br-sm);
|
|
75
84
|
border-top-right-radius: var(--br-sm);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
const getChild = (child?: string): string => {
|
|
6
|
+
return `
|
|
7
|
+
<div class="s-link-preview--header">
|
|
8
|
+
<div class="s-link-preview--icon">👋</div>
|
|
9
|
+
<div>
|
|
10
|
+
<a href="#" class="s-link-preview--title">
|
|
11
|
+
Using hooks for a simple fetch request and breaking the rules of hooks, unsure how?
|
|
12
|
+
</a>
|
|
13
|
+
<div class="s-link-preview--details">
|
|
14
|
+
Issue submitted by Ricky Otero on <relative-time datetime="2019-08-12T04:05:22Z" title="Aug 12, 2019, 12:05 AM EDT">Aug 12, 2019</relative-time> • <strong>RESOLVED</strong>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
${
|
|
19
|
+
child
|
|
20
|
+
? child
|
|
21
|
+
: `
|
|
22
|
+
<div class="s-link-preview--body">
|
|
23
|
+
<p>I'm trying to create a simple fetch with hooks from an AWS database. At the moment it errors out and the only reason I can see is because it breaks the rules of hooks but I'm not sure how. It's at the top level of this functional component and it's not called inside an event handler.</p>
|
|
24
|
+
<p>The result of this call (an array of user data), needs to be exported as a function and called in another file.</p>
|
|
25
|
+
<p>If anyone can spot something I have missed and can highlighted how I'm breaking the rules of hooks I'd be grateful!</p>
|
|
26
|
+
<p>Thanks!</p>
|
|
27
|
+
</div>
|
|
28
|
+
`
|
|
29
|
+
}
|
|
30
|
+
<div class="s-link-preview--footer">
|
|
31
|
+
<a href="#" class="s-link-preview--url">https://stackoverflow.atlassian.net/projects/SREREQ/queues/custom/1</a>
|
|
32
|
+
<a href="#" class="s-link-preview--misc">Privacy notice</a>
|
|
33
|
+
</div>
|
|
34
|
+
`;
|
|
35
|
+
};
|
|
36
|
+
describe("link preview", () => {
|
|
37
|
+
runComponentTests({
|
|
38
|
+
type: "visual",
|
|
39
|
+
baseClass: "s-link-preview",
|
|
40
|
+
children: {
|
|
41
|
+
default: getChild(),
|
|
42
|
+
code: getChild(`
|
|
43
|
+
<div class="s-link-preview--code">
|
|
44
|
+
<pre class="language-js s-code-block" tabindex="0"><code class="language-js s-code-block"><span class="hljs-meta">'use strict'</span>;</code></pre>
|
|
45
|
+
</div>
|
|
46
|
+
`),
|
|
47
|
+
},
|
|
48
|
+
template: ({ component, testid }) => html`
|
|
49
|
+
<div class="ws8 p8" data-testid="${testid}">${component}</div>
|
|
50
|
+
`,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
2
|
+
import "../../index";
|
|
3
|
+
|
|
4
|
+
describe("notice", () => {
|
|
5
|
+
runComponentTests({
|
|
6
|
+
type: "a11y",
|
|
7
|
+
baseClass: "s-notice",
|
|
8
|
+
variants: ["info", "success", "warning", "danger"],
|
|
9
|
+
modifiers: {
|
|
10
|
+
primary: ["important"],
|
|
11
|
+
},
|
|
12
|
+
children: {
|
|
13
|
+
default: `Test notice`,
|
|
14
|
+
},
|
|
15
|
+
tag: "aside"
|
|
16
|
+
});
|
|
17
|
+
});
|