@stackoverflow/stacks 2.0.0-rc.1 → 2.0.0-rc.10
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/components/code-block/code-block.fixtures.d.ts +2 -0
- package/dist/css/stacks.css +792 -765
- 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/__snapshots__/color.less.test.ts.snap +246 -0
- package/lib/atomic/typography.less +4 -0
- package/lib/base/body.less +2 -2
- 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.less +10 -6
- package/lib/components/anchor/anchor.visual.test.ts +0 -4
- package/lib/components/avatar/avatar.visual.test.ts +0 -3
- package/lib/components/badge/badge.a11y.test.ts +2 -2
- package/lib/components/badge/badge.less +21 -29
- package/lib/components/banner/banner.less +2 -2
- package/lib/components/block-link/block-link.less +5 -4
- package/lib/components/button/button.a11y.test.ts +1 -4
- package/lib/components/button/button.less +48 -78
- package/lib/components/button/button.visual.test.ts +1 -4
- package/lib/components/card/card.less +8 -0
- package/lib/components/code-block/code-block.a11y.test.ts +30 -0
- package/lib/components/code-block/code-block.fixtures.ts +88 -0
- package/lib/components/code-block/code-block.visual.test.ts +20 -0
- package/lib/components/description/description.a11y.test.ts +1 -0
- package/lib/components/description/description.less +1 -1
- 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/input_textarea/input_textarea.less +1 -1
- package/lib/components/label/label.less +4 -14
- package/lib/components/link/link.less +12 -12
- package/lib/components/link-preview/link-preview.a11y.test.ts +48 -0
- package/lib/components/link-preview/link-preview.less +16 -7
- package/lib/components/link-preview/link-preview.visual.test.ts +52 -0
- package/lib/components/navigation/navigation.a11y.test.ts +80 -0
- package/lib/components/navigation/navigation.visual.test.ts +101 -0
- package/lib/components/notice/notice.a11y.test.ts +17 -0
- package/lib/components/notice/notice.less +45 -82
- package/lib/components/notice/notice.visual.test.ts +26 -0
- package/lib/components/page-title/page-title.a11y.test.ts +29 -0
- package/lib/components/page-title/page-title.less +1 -1
- package/lib/components/page-title/page-title.visual.test.ts +59 -0
- package/lib/components/pagination/pagination.a11y.test.ts +20 -0
- package/lib/components/pagination/pagination.less +2 -2
- package/lib/components/pagination/pagination.visual.test.ts +26 -0
- package/lib/components/post-summary/post-summary.less +15 -15
- package/lib/components/progress-bar/progress-bar.less +2 -2
- package/lib/components/prose/prose.less +2 -2
- package/lib/components/select/select.less +1 -1
- package/lib/components/sidebar-widget/sidebar-widget.less +3 -3
- package/lib/components/spinner/spinner.a11y.test.ts +15 -0
- package/lib/components/spinner/spinner.visual.test.ts +43 -0
- package/lib/components/tag/tag.a11y.test.ts +23 -0
- package/lib/components/tag/tag.less +29 -29
- package/lib/components/tag/tag.visual.test.ts +46 -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/topbar/topbar.less +44 -44
- package/lib/components/uploader/uploader.less +19 -13
- package/lib/components/user-card/user-card.less +1 -1
- package/lib/exports/__snapshots__/color-mixins.less.test.ts.snap +17 -10
- package/lib/exports/__snapshots__/color.less.test.ts.snap +197 -185
- package/lib/exports/color-mixins.less +1 -1
- package/lib/exports/color-sets.less +130 -81
- package/lib/exports/color.less +14 -6
- package/lib/exports/v1/__snapshots__/constants-colors.less.test.ts.snap +3 -3
- package/lib/exports/v1/constants-colors.less +2 -2
- 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 +14 -14
- package/lib/exports/theme.less +0 -85
|
@@ -4,54 +4,52 @@
|
|
|
4
4
|
--_bu-bc: transparent;
|
|
5
5
|
// --_bu-bg: inherit; // [1]
|
|
6
6
|
--_bu-br: var(--br-md);
|
|
7
|
-
--_bu-fc: var(--theme-button-color);
|
|
7
|
+
--_bu-fc: var(--theme-button-color, var(--theme-secondary-400));
|
|
8
8
|
--_bu-focus-ring: 0 0 0 var(--su-static4) var(--focus-ring);
|
|
9
9
|
--_bu-fs: var(--fs-body1);
|
|
10
10
|
--_bu-p: 0.8em;
|
|
11
11
|
// STATE AND INTERACTION CUSTOM PROPERTIES
|
|
12
12
|
--_bu-bc-selected: transparent;
|
|
13
|
-
--_bu-bg-active: var(--theme-button-active-background-color);
|
|
14
|
-
--_bu-bg-hover: var(--theme-button-hover-background-color);
|
|
15
|
-
--_bu-bg-selected: var(--theme-button-selected-background-color);
|
|
16
|
-
--_bu-fc-active: var(--theme-button-hover-color); // Note: hover color used here intentionally
|
|
17
|
-
--_bu-fc-hover: var(--theme-button-hover-color);
|
|
18
|
-
--_bu-fc-selected: var(--theme-button-selected-color);
|
|
13
|
+
--_bu-bg-active: var(--theme-button-active-background-color, var(--theme-secondary-300));
|
|
14
|
+
--_bu-bg-hover: var(--theme-button-hover-background-color, var(--theme-secondary-200));
|
|
15
|
+
--_bu-bg-selected: var(--theme-button-selected-background-color, var(--theme-secondary-300));
|
|
16
|
+
--_bu-fc-active: var(--theme-button-hover-color, var(--theme-secondary-500)); // Note: hover color used here intentionally
|
|
17
|
+
--_bu-fc-hover: var(--theme-button-hover-color, var(--theme-secondary-500));
|
|
18
|
+
--_bu-fc-selected: var(--theme-button-selected-color, var(--theme-secondary-600));
|
|
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, var(--theme-secondary-400));
|
|
24
|
+
--_bu-filled-bg-active: var(--theme-button-primary-active-background-color, var(--theme-secondary-600));
|
|
25
|
+
--_bu-filled-bg-hover: var(--theme-button-primary-hover-background-color, var(--theme-secondary-500));
|
|
26
|
+
--_bu-filled-bg-selected: var(--theme-button-primary-selected-background-color, var(--theme-secondary-500));
|
|
27
|
+
--_bu-filled-fc: var(--theme-button-primary-color, var(--white));
|
|
28
|
+
--_bu-filled-fc-active: var(--theme-button-primary-hover-color, var(--white));
|
|
29
|
+
--_bu-filled-fc-hover: var(--theme-button-primary-hover-color, var(--white));
|
|
30
|
+
--_bu-filled-fc-selected: var(--theme-button-primary-selected-color, var(--white));
|
|
31
31
|
// Outlined
|
|
32
|
-
--_bu-outlined-bc: var(--theme-button-outlined-border-color);
|
|
32
|
+
--_bu-outlined-bc: var(--theme-button-outlined-border-color, var(--theme-secondary-400));
|
|
33
33
|
--_bu-outlined-bg: var(--theme-button-outlined-background-color);
|
|
34
|
-
--_bu-outlined-bc-selected: var(--theme-button-outlined-selected-border-color);
|
|
35
|
-
--_bu-outlined-bg-selected: var(--theme-button-selected-background-color);
|
|
36
|
-
--_bu-outlined-fc-selected: var(--theme-button-selected-color);
|
|
34
|
+
--_bu-outlined-bc-selected: var(--theme-button-outlined-selected-border-color, var(--theme-secondary-400));
|
|
35
|
+
--_bu-outlined-bg-selected: var(--theme-button-selected-background-color, var(--theme-secondary-300));
|
|
36
|
+
--_bu-outlined-fc-selected: var(--theme-button-selected-color, var(--theme-secondary-600));
|
|
37
37
|
// CHILD COMPONENT CUSTOM PROPERTIES
|
|
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, var(--theme-secondary-600));
|
|
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, var(--theme-secondary-600));
|
|
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,58 +285,41 @@
|
|
|
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
|
-
--_bu-bg: var(--theme-button-primary-background-color);
|
|
321
|
-
--_bu-bg-active: var(--theme-button-primary-active-background-color);
|
|
322
|
-
--_bu-bg-hover: var(--theme-button-primary-hover-background-color);
|
|
323
|
-
--_bu-bg-selected: var(--theme-button-primary-selected-background-color);
|
|
324
|
-
--_bu-fc: var(--theme-button-primary-color);
|
|
325
|
-
--_bu-fc-active: var(--theme-button-primary-hover-color);
|
|
326
|
-
--_bu-fc-hover: var(--theme-button-primary-hover-color);
|
|
327
|
-
--_bu-fc-selected: var(--theme-button-primary-selected-color);
|
|
328
|
-
--_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
|
-
});
|
|
309
|
+
--_bu-bg: var(--theme-button-primary-background-color, var(--theme-secondary-400));
|
|
310
|
+
--_bu-bg-active: var(--theme-button-primary-active-background-color, var(--theme-secondary-600));
|
|
311
|
+
--_bu-bg-hover: var(--theme-button-primary-hover-background-color, var(--theme-secondary-500));
|
|
312
|
+
--_bu-bg-selected: var(--theme-button-primary-selected-background-color, var(--theme-secondary-500));
|
|
313
|
+
--_bu-fc: var(--theme-button-primary-color, var(--white));
|
|
314
|
+
--_bu-fc-active: var(--theme-button-primary-hover-color, var(--white));
|
|
315
|
+
--_bu-fc-hover: var(--theme-button-primary-hover-color, var(--white));
|
|
316
|
+
--_bu-fc-selected: var(--theme-button-primary-selected-color, var(--white));
|
|
317
|
+
--_bu-number-fc: var(--theme-button-primary-number-color, var(--theme-secondary-600));
|
|
318
|
+
--_bu-number-fc-selected: var(--theme-button-primary-number-color, var(--theme-secondary-600));
|
|
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"]],
|
|
@@ -45,8 +45,5 @@ describe("button", () => {
|
|
|
45
45
|
${component}
|
|
46
46
|
</div>
|
|
47
47
|
`,
|
|
48
|
-
excludedTestids: [
|
|
49
|
-
/primary-outlined/, // This combination is not supported
|
|
50
|
-
],
|
|
51
48
|
});
|
|
52
49
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defaultOptions, runComponentTests } from "../../test/test-utils";
|
|
2
|
+
import highlightedFixtures from "./code-block.fixtures";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
describe("code block", () => {
|
|
6
|
+
Object.keys(highlightedFixtures).forEach((language) => {
|
|
7
|
+
runComponentTests({
|
|
8
|
+
type: "a11y",
|
|
9
|
+
tag: "pre",
|
|
10
|
+
baseClass: `s-code-block language-${language}`,
|
|
11
|
+
children: {
|
|
12
|
+
default: highlightedFixtures[language],
|
|
13
|
+
},
|
|
14
|
+
options: {
|
|
15
|
+
...defaultOptions,
|
|
16
|
+
includeNullModifier: false,
|
|
17
|
+
},
|
|
18
|
+
// TODO new colors should resolve this issue
|
|
19
|
+
skippedTestids: [
|
|
20
|
+
"s-code-block-language-html-light",
|
|
21
|
+
"s-code-block-language-html-highcontrast-light",
|
|
22
|
+
"s-code-block-language-html-highcontrast-dark",
|
|
23
|
+
"s-code-block-language-html-dark",
|
|
24
|
+
"s-code-block-language-css-dark",
|
|
25
|
+
"s-code-block-language-javascript-dark",
|
|
26
|
+
"s-code-block-language-javascript-highcontrast-light",
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { LanguageFn } from "highlight.js";
|
|
2
|
+
import hljs from "highlight.js/lib/core";
|
|
3
|
+
import hljsJavascript from "highlight.js/lib/languages/javascript";
|
|
4
|
+
import hljsCss from "highlight.js/lib/languages/css";
|
|
5
|
+
import hljsHtml from "highlight.js/lib/languages/xml";
|
|
6
|
+
|
|
7
|
+
const hljsLanguages: Record<string, LanguageFn> = {
|
|
8
|
+
javascript: hljsJavascript,
|
|
9
|
+
css: hljsCss,
|
|
10
|
+
html: hljsHtml,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const javascriptFixture = `
|
|
14
|
+
import React, { Component } from 'react'
|
|
15
|
+
import { IP } from '../constants/IP'
|
|
16
|
+
import { withAuth0 } from '@auth0/auth0-react';
|
|
17
|
+
|
|
18
|
+
class AddATournament extends Component {
|
|
19
|
+
componentDidMount() {
|
|
20
|
+
this.myNewListOfAllTournamentsWithAuth()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default withAuth0(AddATournament);
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const cssFixture = `
|
|
28
|
+
.s-input,
|
|
29
|
+
.s-textarea {
|
|
30
|
+
-webkit-appearance: none;
|
|
31
|
+
width: 100%;
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0.6em 0.7em;
|
|
34
|
+
border: 1px solid var(--bc-darker);
|
|
35
|
+
border-radius: 3px;
|
|
36
|
+
background-color: var(--white);
|
|
37
|
+
color: var(--fc-dark);
|
|
38
|
+
font-size: 13px;
|
|
39
|
+
font-family: inherit;
|
|
40
|
+
line-height: 1.15384615;
|
|
41
|
+
scrollbar-color: var(--scrollbar) transparent;
|
|
42
|
+
}
|
|
43
|
+
@supports (-webkit-overflow-scrolling: touch) {
|
|
44
|
+
.s-input,
|
|
45
|
+
.s-textarea {
|
|
46
|
+
font-size: 16px;
|
|
47
|
+
padding: 0.36em 0.55em;
|
|
48
|
+
}
|
|
49
|
+
.s-input::-webkit-input-placeholder,
|
|
50
|
+
.s-textarea::-webkit-input-placeholder {
|
|
51
|
+
line-height: normal !important;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const htmlFixture = `
|
|
57
|
+
<form class="d-flex gy4 fd-column">
|
|
58
|
+
<label class="flex--item s-label" for="question-title">Question title</label>
|
|
59
|
+
<div class="d-flex ps-relative">
|
|
60
|
+
<input class="flex--item s-input" type="text" id="question-title" placeholder="e.g. Why doesn’t Stack Overflow use a custom web font?"/>
|
|
61
|
+
</div>
|
|
62
|
+
</form>
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
const fixtures: Record<string, string> = {
|
|
66
|
+
javascript: javascriptFixture,
|
|
67
|
+
css: cssFixture,
|
|
68
|
+
html: htmlFixture,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const highlightFixture = (fixture: string, language: string) => {
|
|
72
|
+
const hljsLanguage = hljsLanguages[language];
|
|
73
|
+
hljs.registerLanguage(language, hljsLanguage);
|
|
74
|
+
|
|
75
|
+
const highlightedCode = hljs.highlight(fixture, { language }).value;
|
|
76
|
+
|
|
77
|
+
return `<code>${highlightedCode}</code>`;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const highlightedFixtures = Object.keys(fixtures).reduce(
|
|
81
|
+
(acc, language) => {
|
|
82
|
+
acc[language] = highlightFixture(fixtures[language], language);
|
|
83
|
+
return acc;
|
|
84
|
+
},
|
|
85
|
+
{} as Record<string, string>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
export default highlightedFixtures;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defaultOptions, runComponentTests } from "../../test/test-utils";
|
|
2
|
+
import highlightedFixtures from "./code-block.fixtures";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
describe("code block", () => {
|
|
6
|
+
Object.keys(highlightedFixtures).forEach((language) => {
|
|
7
|
+
runComponentTests({
|
|
8
|
+
type: "visual",
|
|
9
|
+
tag: "pre",
|
|
10
|
+
baseClass: `s-code-block language-${language}`,
|
|
11
|
+
children: {
|
|
12
|
+
default: highlightedFixtures[language],
|
|
13
|
+
},
|
|
14
|
+
options: {
|
|
15
|
+
...defaultOptions,
|
|
16
|
+
includeNullModifier: false,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -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);
|
|
@@ -99,7 +89,7 @@
|
|
|
99
89
|
|
|
100
90
|
font-size: var(--_la-fs);
|
|
101
91
|
|
|
102
|
-
color: var(--fc-
|
|
92
|
+
color: var(--fc-medium);
|
|
103
93
|
font-family: inherit;
|
|
104
94
|
font-weight: 600;
|
|
105
95
|
padding: 0 var(--su2); // Helps the label visually line up with inputs
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// it's tech debt that'll take some doing in consumer's code to pay down.
|
|
3
3
|
a,
|
|
4
4
|
.s-link {
|
|
5
|
-
--_li-fc: var(--theme-link-color);
|
|
6
|
-
--_li-fc-hover: var(--theme-link-color-hover);
|
|
7
|
-
--_li-fc-visited: var(--theme-link-color-visited);
|
|
5
|
+
--_li-fc: var(--theme-link-color, var(--theme-secondary-400));
|
|
6
|
+
--_li-fc-hover: var(--theme-link-color-hover, var(--theme-secondary-500));
|
|
7
|
+
--_li-fc-visited: var(--theme-link-color-visited, var(--theme-secondary-600));
|
|
8
8
|
|
|
9
9
|
// CONTEXTUAL STYLES
|
|
10
10
|
.highcontrast-mode({
|
|
@@ -53,22 +53,22 @@ a,
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
&__visited { // TODO can we get rid of this? It's only in 3 places in Core and seems to me it doesn't even serve a purpose.
|
|
56
|
-
--_li-fc: var(--theme-link-color-visited);
|
|
57
|
-
--_li-fc-hover: var(--theme-link-color-hover);
|
|
58
|
-
--_li-fc-visited: var(--theme-link-color-visited);
|
|
56
|
+
--_li-fc: var(--theme-link-color-visited, var(--theme-secondary-500));
|
|
57
|
+
--_li-fc-hover: var(--theme-link-color-hover, var(--theme-secondary-400));
|
|
58
|
+
--_li-fc-visited: var(--theme-link-color-visited, var(--theme-secondary-500));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// VARIANTS
|
|
62
62
|
&__danger {
|
|
63
63
|
--_li-fc: var(--red-400);
|
|
64
|
-
--_li-fc-hover: var(--red-
|
|
65
|
-
--_li-fc-visited: var(--red-
|
|
64
|
+
--_li-fc-hover: var(--red-500);
|
|
65
|
+
--_li-fc-visited: var(--red-600);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
&__grayscale {
|
|
69
|
-
--_li-fc: var(--black-
|
|
70
|
-
--_li-fc-hover: var(--black-
|
|
71
|
-
--_li-fc-visited: var(--black-
|
|
69
|
+
--_li-fc: var(--black-500);
|
|
70
|
+
--_li-fc-hover: var(--black-400);
|
|
71
|
+
--_li-fc-visited: var(--black-600);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
&__inherit {
|
|
@@ -80,7 +80,7 @@ a,
|
|
|
80
80
|
&__muted {
|
|
81
81
|
--_li-fc: var(--black-400);
|
|
82
82
|
--_li-fc-hover: var(--black-500);
|
|
83
|
-
--_li-fc-visited: var(--black-
|
|
83
|
+
--_li-fc-visited: var(--black-600);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -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
|
+
});
|