@stackoverflow/stacks 2.0.0-rc.1 → 2.0.0-rc.11
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 +816 -778
- 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 +31 -39
- 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.a11y.test.ts +112 -0
- package/lib/components/input_textarea/input_textarea.less +1 -1
- package/lib/components/input_textarea/input_textarea.visual.test.ts +98 -0
- 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/modal/modal.less +1 -0
- package/lib/components/navigation/navigation.a11y.test.ts +78 -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 +16 -16
- 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 +29 -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 +60 -44
- package/lib/components/uploader/uploader.less +19 -13
- package/lib/components/user-card/user-card.less +3 -3
- 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 +8 -6
- 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 revisit these skipped test ids
|
|
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
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
// TODO note: all accessibility tests here are skipped currently. Revisit in Stacks v2
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
const template = ({ component, testid, classes = "", icon }: any) => html`
|
|
9
|
+
<div data-testid="${testid}" class="p8 ws4 ${classes}">
|
|
10
|
+
<label for="default-id">Label</label>
|
|
11
|
+
${component}${icon}
|
|
12
|
+
</div>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const customAttributes = [
|
|
16
|
+
{
|
|
17
|
+
placeholder: "Enter your text here",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
readonly: "",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
disabled: "",
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const states = ["has-error", "has-warning", "has-success"];
|
|
28
|
+
const sizes = ["sm", "md", "lg", "xl"];
|
|
29
|
+
const otherModifiers = ["creditcard", "search"];
|
|
30
|
+
|
|
31
|
+
["input", "textarea"].map((type) => {
|
|
32
|
+
const children =
|
|
33
|
+
type === "textarea" ? { default: "Enter your text here" } : undefined;
|
|
34
|
+
|
|
35
|
+
describe(type, () => {
|
|
36
|
+
// Base styles w/ value, modifiers
|
|
37
|
+
runComponentTests({
|
|
38
|
+
type: "a11y",
|
|
39
|
+
baseClass: `s-${type}`,
|
|
40
|
+
modifiers: {
|
|
41
|
+
primary: [...sizes, ...otherModifiers],
|
|
42
|
+
},
|
|
43
|
+
tag: type,
|
|
44
|
+
attributes:
|
|
45
|
+
type === "input"
|
|
46
|
+
? {
|
|
47
|
+
type: "text",
|
|
48
|
+
value: "Text input value",
|
|
49
|
+
id: `default-id`,
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
id: `default-id`,
|
|
53
|
+
},
|
|
54
|
+
children,
|
|
55
|
+
template,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Base styles w/o value; w/ readonly attr; w/ disabled attr
|
|
59
|
+
customAttributes.forEach((attributes) => {
|
|
60
|
+
const attrString = Object.keys(attributes).sort().join("-");
|
|
61
|
+
|
|
62
|
+
runComponentTests({
|
|
63
|
+
type: "a11y",
|
|
64
|
+
baseClass: `s-${type} ${attrString}`,
|
|
65
|
+
tag: type,
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
attributes:
|
|
69
|
+
type === "input"
|
|
70
|
+
? {
|
|
71
|
+
type: "text",
|
|
72
|
+
value: attributes.placeholder
|
|
73
|
+
? null
|
|
74
|
+
: "Text input value",
|
|
75
|
+
id: `default-id`,
|
|
76
|
+
...attributes,
|
|
77
|
+
}
|
|
78
|
+
: {
|
|
79
|
+
id: `default-id`,
|
|
80
|
+
...attributes,
|
|
81
|
+
},
|
|
82
|
+
children,
|
|
83
|
+
template,
|
|
84
|
+
// TODO revisit these skipped test ids
|
|
85
|
+
skippedTestids: [/readonly/],
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// w/ state classes
|
|
90
|
+
states.forEach((state) => {
|
|
91
|
+
runComponentTests({
|
|
92
|
+
type: "a11y",
|
|
93
|
+
baseClass: `s-${type} state-${state}`,
|
|
94
|
+
tag: type,
|
|
95
|
+
attributes:
|
|
96
|
+
type === "input"
|
|
97
|
+
? {
|
|
98
|
+
type: "text",
|
|
99
|
+
value: "Text input value",
|
|
100
|
+
id: `default-id`,
|
|
101
|
+
}
|
|
102
|
+
: {
|
|
103
|
+
id: "default-id",
|
|
104
|
+
},
|
|
105
|
+
children,
|
|
106
|
+
template: ({ component, testid }) =>
|
|
107
|
+
template({ component, testid, classes: state }),
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
// TODO interaction (focus) states?
|
|
111
|
+
});
|
|
112
|
+
});
|