@stackoverflow/stacks 2.0.0-rc.3 → 2.0.0-rc.5

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.
@@ -904,6 +904,132 @@ exports[`atomic: color > should output v2 atomic css classes for colors 1`] = `
904
904
  color: var(--yellow-600) !important;
905
905
  }
906
906
 
907
+ .bg-purple-100,
908
+ .h\\\\:bg-purple-100:hover,
909
+ .f\\\\:bg-purple-100:focus,
910
+ .f\\\\:bg-purple-100:focus-within {
911
+ background-color: var(--purple-100) !important;
912
+ }
913
+
914
+ .bc-purple-100,
915
+ .h\\\\:bc-purple-100:hover,
916
+ .f\\\\:bc-purple-100:focus,
917
+ .f\\\\:bc-purple-100:focus-within {
918
+ border-color: var(--purple-100) !important;
919
+ }
920
+
921
+ .fc-purple-100,
922
+ .h\\\\:fc-purple-100:hover,
923
+ .f\\\\:fc-purple-100:focus,
924
+ .f\\\\:fc-purple-100:focus-within {
925
+ color: var(--purple-100) !important;
926
+ }
927
+
928
+ .bg-purple-200,
929
+ .h\\\\:bg-purple-200:hover,
930
+ .f\\\\:bg-purple-200:focus,
931
+ .f\\\\:bg-purple-200:focus-within {
932
+ background-color: var(--purple-200) !important;
933
+ }
934
+
935
+ .bc-purple-200,
936
+ .h\\\\:bc-purple-200:hover,
937
+ .f\\\\:bc-purple-200:focus,
938
+ .f\\\\:bc-purple-200:focus-within {
939
+ border-color: var(--purple-200) !important;
940
+ }
941
+
942
+ .fc-purple-200,
943
+ .h\\\\:fc-purple-200:hover,
944
+ .f\\\\:fc-purple-200:focus,
945
+ .f\\\\:fc-purple-200:focus-within {
946
+ color: var(--purple-200) !important;
947
+ }
948
+
949
+ .bg-purple-300,
950
+ .h\\\\:bg-purple-300:hover,
951
+ .f\\\\:bg-purple-300:focus,
952
+ .f\\\\:bg-purple-300:focus-within {
953
+ background-color: var(--purple-300) !important;
954
+ }
955
+
956
+ .bc-purple-300,
957
+ .h\\\\:bc-purple-300:hover,
958
+ .f\\\\:bc-purple-300:focus,
959
+ .f\\\\:bc-purple-300:focus-within {
960
+ border-color: var(--purple-300) !important;
961
+ }
962
+
963
+ .fc-purple-300,
964
+ .h\\\\:fc-purple-300:hover,
965
+ .f\\\\:fc-purple-300:focus,
966
+ .f\\\\:fc-purple-300:focus-within {
967
+ color: var(--purple-300) !important;
968
+ }
969
+
970
+ .bg-purple-400,
971
+ .h\\\\:bg-purple-400:hover,
972
+ .f\\\\:bg-purple-400:focus,
973
+ .f\\\\:bg-purple-400:focus-within {
974
+ background-color: var(--purple-400) !important;
975
+ }
976
+
977
+ .bc-purple-400,
978
+ .h\\\\:bc-purple-400:hover,
979
+ .f\\\\:bc-purple-400:focus,
980
+ .f\\\\:bc-purple-400:focus-within {
981
+ border-color: var(--purple-400) !important;
982
+ }
983
+
984
+ .fc-purple-400,
985
+ .h\\\\:fc-purple-400:hover,
986
+ .f\\\\:fc-purple-400:focus,
987
+ .f\\\\:fc-purple-400:focus-within {
988
+ color: var(--purple-400) !important;
989
+ }
990
+
991
+ .bg-purple-500,
992
+ .h\\\\:bg-purple-500:hover,
993
+ .f\\\\:bg-purple-500:focus,
994
+ .f\\\\:bg-purple-500:focus-within {
995
+ background-color: var(--purple-500) !important;
996
+ }
997
+
998
+ .bc-purple-500,
999
+ .h\\\\:bc-purple-500:hover,
1000
+ .f\\\\:bc-purple-500:focus,
1001
+ .f\\\\:bc-purple-500:focus-within {
1002
+ border-color: var(--purple-500) !important;
1003
+ }
1004
+
1005
+ .fc-purple-500,
1006
+ .h\\\\:fc-purple-500:hover,
1007
+ .f\\\\:fc-purple-500:focus,
1008
+ .f\\\\:fc-purple-500:focus-within {
1009
+ color: var(--purple-500) !important;
1010
+ }
1011
+
1012
+ .bg-purple-600,
1013
+ .h\\\\:bg-purple-600:hover,
1014
+ .f\\\\:bg-purple-600:focus,
1015
+ .f\\\\:bg-purple-600:focus-within {
1016
+ background-color: var(--purple-600) !important;
1017
+ }
1018
+
1019
+ .bc-purple-600,
1020
+ .h\\\\:bc-purple-600:hover,
1021
+ .f\\\\:bc-purple-600:focus,
1022
+ .f\\\\:bc-purple-600:focus-within {
1023
+ border-color: var(--purple-600) !important;
1024
+ }
1025
+
1026
+ .fc-purple-600,
1027
+ .h\\\\:fc-purple-600:hover,
1028
+ .f\\\\:fc-purple-600:focus,
1029
+ .f\\\\:fc-purple-600:focus-within {
1030
+ color: var(--purple-600) !important;
1031
+ }
1032
+
907
1033
  .bg-gold-100,
908
1034
  .h\\\\:bg-gold-100:hover,
909
1035
  .f\\\\:bg-gold-100:focus,
@@ -1928,6 +2054,54 @@ exports[`atomic: color > should output v2 atomic css classes for colors 1`] = `
1928
2054
  color: var(--yellow-600) !important;
1929
2055
  }
1930
2056
 
2057
+ body.theme-system .d\\\\:bg-purple-100 {
2058
+ background-color: var(--purple-100) !important;
2059
+ }
2060
+
2061
+ body.theme-system .d\\\\:fc-purple-100 {
2062
+ color: var(--purple-100) !important;
2063
+ }
2064
+
2065
+ body.theme-system .d\\\\:bg-purple-200 {
2066
+ background-color: var(--purple-200) !important;
2067
+ }
2068
+
2069
+ body.theme-system .d\\\\:fc-purple-200 {
2070
+ color: var(--purple-200) !important;
2071
+ }
2072
+
2073
+ body.theme-system .d\\\\:bg-purple-300 {
2074
+ background-color: var(--purple-300) !important;
2075
+ }
2076
+
2077
+ body.theme-system .d\\\\:fc-purple-300 {
2078
+ color: var(--purple-300) !important;
2079
+ }
2080
+
2081
+ body.theme-system .d\\\\:bg-purple-400 {
2082
+ background-color: var(--purple-400) !important;
2083
+ }
2084
+
2085
+ body.theme-system .d\\\\:fc-purple-400 {
2086
+ color: var(--purple-400) !important;
2087
+ }
2088
+
2089
+ body.theme-system .d\\\\:bg-purple-500 {
2090
+ background-color: var(--purple-500) !important;
2091
+ }
2092
+
2093
+ body.theme-system .d\\\\:fc-purple-500 {
2094
+ color: var(--purple-500) !important;
2095
+ }
2096
+
2097
+ body.theme-system .d\\\\:bg-purple-600 {
2098
+ background-color: var(--purple-600) !important;
2099
+ }
2100
+
2101
+ body.theme-system .d\\\\:fc-purple-600 {
2102
+ color: var(--purple-600) !important;
2103
+ }
2104
+
1931
2105
  body.theme-system .d\\\\:bg-gold-100 {
1932
2106
  background-color: var(--gold-100) !important;
1933
2107
  }
@@ -2613,6 +2787,78 @@ body.theme-system .theme-dark__forced .d\\\\:fc-yellow-600 {
2613
2787
  color: var(--yellow-600) !important;
2614
2788
  }
2615
2789
 
2790
+ body.theme-dark .d\\\\:bg-purple-100,
2791
+ .theme-dark__forced .d\\\\:bg-purple-100,
2792
+ body.theme-system .theme-dark__forced .d\\\\:bg-purple-100 {
2793
+ background-color: var(--purple-100) !important;
2794
+ }
2795
+
2796
+ body.theme-dark .d\\\\:fc-purple-100,
2797
+ .theme-dark__forced .d\\\\:fc-purple-100,
2798
+ body.theme-system .theme-dark__forced .d\\\\:fc-purple-100 {
2799
+ color: var(--purple-100) !important;
2800
+ }
2801
+
2802
+ body.theme-dark .d\\\\:bg-purple-200,
2803
+ .theme-dark__forced .d\\\\:bg-purple-200,
2804
+ body.theme-system .theme-dark__forced .d\\\\:bg-purple-200 {
2805
+ background-color: var(--purple-200) !important;
2806
+ }
2807
+
2808
+ body.theme-dark .d\\\\:fc-purple-200,
2809
+ .theme-dark__forced .d\\\\:fc-purple-200,
2810
+ body.theme-system .theme-dark__forced .d\\\\:fc-purple-200 {
2811
+ color: var(--purple-200) !important;
2812
+ }
2813
+
2814
+ body.theme-dark .d\\\\:bg-purple-300,
2815
+ .theme-dark__forced .d\\\\:bg-purple-300,
2816
+ body.theme-system .theme-dark__forced .d\\\\:bg-purple-300 {
2817
+ background-color: var(--purple-300) !important;
2818
+ }
2819
+
2820
+ body.theme-dark .d\\\\:fc-purple-300,
2821
+ .theme-dark__forced .d\\\\:fc-purple-300,
2822
+ body.theme-system .theme-dark__forced .d\\\\:fc-purple-300 {
2823
+ color: var(--purple-300) !important;
2824
+ }
2825
+
2826
+ body.theme-dark .d\\\\:bg-purple-400,
2827
+ .theme-dark__forced .d\\\\:bg-purple-400,
2828
+ body.theme-system .theme-dark__forced .d\\\\:bg-purple-400 {
2829
+ background-color: var(--purple-400) !important;
2830
+ }
2831
+
2832
+ body.theme-dark .d\\\\:fc-purple-400,
2833
+ .theme-dark__forced .d\\\\:fc-purple-400,
2834
+ body.theme-system .theme-dark__forced .d\\\\:fc-purple-400 {
2835
+ color: var(--purple-400) !important;
2836
+ }
2837
+
2838
+ body.theme-dark .d\\\\:bg-purple-500,
2839
+ .theme-dark__forced .d\\\\:bg-purple-500,
2840
+ body.theme-system .theme-dark__forced .d\\\\:bg-purple-500 {
2841
+ background-color: var(--purple-500) !important;
2842
+ }
2843
+
2844
+ body.theme-dark .d\\\\:fc-purple-500,
2845
+ .theme-dark__forced .d\\\\:fc-purple-500,
2846
+ body.theme-system .theme-dark__forced .d\\\\:fc-purple-500 {
2847
+ color: var(--purple-500) !important;
2848
+ }
2849
+
2850
+ body.theme-dark .d\\\\:bg-purple-600,
2851
+ .theme-dark__forced .d\\\\:bg-purple-600,
2852
+ body.theme-system .theme-dark__forced .d\\\\:bg-purple-600 {
2853
+ background-color: var(--purple-600) !important;
2854
+ }
2855
+
2856
+ body.theme-dark .d\\\\:fc-purple-600,
2857
+ .theme-dark__forced .d\\\\:fc-purple-600,
2858
+ body.theme-system .theme-dark__forced .d\\\\:fc-purple-600 {
2859
+ color: var(--purple-600) !important;
2860
+ }
2861
+
2616
2862
  body.theme-dark .d\\\\:bg-gold-100,
2617
2863
  .theme-dark__forced .d\\\\:bg-gold-100,
2618
2864
  body.theme-system .theme-dark__forced .d\\\\:bg-gold-100 {
@@ -44,6 +44,6 @@ describe("anchors", () => {
44
44
  <div data-testid="${testid}" class="s-card ws3 fc-green-500">
45
45
  ${testid}: ${component}
46
46
  </div>
47
- `
47
+ `,
48
48
  });
49
49
  });
@@ -46,6 +46,6 @@ describe("avatar", () => {
46
46
  >
47
47
  ${component}
48
48
  </div>
49
- `
49
+ `,
50
50
  });
51
51
  });
@@ -21,6 +21,6 @@ describe("button", () => {
21
21
  children: {
22
22
  default: "Ask question",
23
23
  },
24
- tag: "button"
24
+ tag: "button",
25
25
  });
26
26
  });
@@ -44,6 +44,6 @@ describe("button", () => {
44
44
  >
45
45
  ${component}
46
46
  </div>
47
- `
47
+ `,
48
48
  });
49
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,80 @@
1
+ import { html } from "@open-wc/testing";
2
+ import { runComponentTests } from "../../test/test-utils";
3
+ import "../../index";
4
+
5
+ const items = [
6
+ {
7
+ label: "Group 1",
8
+ title: true,
9
+ },
10
+ {
11
+ label: "Product",
12
+ selected: true,
13
+ },
14
+ {
15
+ label: "Email",
16
+ },
17
+ {
18
+ label: "Group 2",
19
+ title: true,
20
+ },
21
+ {
22
+ label: "Content",
23
+ },
24
+ {
25
+ label: "Brand",
26
+ },
27
+ {
28
+ label: "Marketing",
29
+ },
30
+ {
31
+ label: "More selected",
32
+ dropdown: true,
33
+ selected: true,
34
+ },
35
+ {
36
+ label: "More",
37
+ dropdown: true,
38
+ },
39
+ ];
40
+
41
+ const getChildren = (includeTitles = false): string =>
42
+ items
43
+ .map((item) => {
44
+ if (item.title) {
45
+ return includeTitles
46
+ ? `<li class="s-navigation--title">${item.label}</li>`
47
+ : "";
48
+ }
49
+ const classes = `s-navigation--item${
50
+ item.selected ? " is-selected" : ""
51
+ }${item.dropdown ? " s-navigation--item__dropdown" : ""}`;
52
+ return `<li><a href="#" class="${classes}">${item.label}</a></li>`;
53
+ })
54
+ .join("");
55
+
56
+ describe("navigation", () => {
57
+ runComponentTests({
58
+ type: "a11y",
59
+ baseClass: "s-navigation",
60
+ variants: ["vertical", "muted"],
61
+ modifiers: {
62
+ primary: ["scroll", "sm"],
63
+ },
64
+ tag: "ul",
65
+ children: {
66
+ default: getChildren(true),
67
+ },
68
+ template: ({ component, testid }) => html`
69
+ <nav
70
+ class="d-inline-block p8 wmx3"
71
+ aria-label="example-navigation"
72
+ data-testid="${testid}"
73
+ >
74
+ ${component}
75
+ </nav>
76
+ `,
77
+ // TODO new colors should resolve the `.is-selected` failures
78
+ skippedTestids: [/s-navigation/],
79
+ });
80
+ });
@@ -0,0 +1,101 @@
1
+ import { html } from "@open-wc/testing";
2
+ import { defaultOptions, runComponentTests } from "../../test/test-utils";
3
+ import "../../index";
4
+
5
+ const items = [
6
+ {
7
+ label: "Group 1",
8
+ title: true,
9
+ },
10
+ {
11
+ label: "Product",
12
+ selected: true,
13
+ },
14
+ {
15
+ label: "Email",
16
+ },
17
+ {
18
+ label: "Group 2",
19
+ title: true,
20
+ },
21
+ {
22
+ label: "Content",
23
+ },
24
+ {
25
+ label: "Brand",
26
+ },
27
+ {
28
+ label: "Marketing",
29
+ },
30
+ {
31
+ label: "More selected",
32
+ dropdown: true,
33
+ selected: true,
34
+ },
35
+ {
36
+ label: "More",
37
+ dropdown: true,
38
+ },
39
+ ];
40
+
41
+ const getChildren = (includeTitles = false): string =>
42
+ items
43
+ .map((item) => {
44
+ if (item.title) {
45
+ return includeTitles
46
+ ? `<li class="s-navigation--title">${item.label}</li>`
47
+ : "";
48
+ }
49
+ const classes = `s-navigation--item${
50
+ item.selected ? " is-selected" : ""
51
+ }${item.dropdown ? " s-navigation--item__dropdown" : ""}`;
52
+ return `<li><a href="#" class="${classes}">${item.label}</a></li>`;
53
+ })
54
+ .join("");
55
+
56
+ describe("navigation", () => {
57
+ runComponentTests({
58
+ type: "visual",
59
+ baseClass: "s-navigation",
60
+ variants: ["muted"],
61
+ modifiers: {
62
+ primary: ["scroll", "sm"],
63
+ },
64
+ tag: "ul",
65
+ children: {
66
+ default: getChildren(),
67
+ },
68
+ template: ({ component, testid }) => html`
69
+ <nav
70
+ class="d-inline-block p8 wmx3"
71
+ aria-label="example-navigation"
72
+ data-testid="${testid}"
73
+ >
74
+ ${component}
75
+ </nav>
76
+ `,
77
+ });
78
+
79
+ runComponentTests({
80
+ type: "visual",
81
+ baseClass: "s-navigation",
82
+ variants: ["vertical"],
83
+ tag: "ul",
84
+ children: {
85
+ default: getChildren(true),
86
+ },
87
+ template: ({ component, testid }) => html`
88
+ <nav
89
+ class="d-inline-block p8 ws2"
90
+ aria-label="example-navigation"
91
+ data-testid="${testid}"
92
+ >
93
+ ${component}
94
+ </nav>
95
+ `,
96
+ options: {
97
+ ...defaultOptions,
98
+ includeNullVariant: false,
99
+ },
100
+ });
101
+ });
@@ -12,6 +12,6 @@ describe("notice", () => {
12
12
  children: {
13
13
  default: `Test notice`,
14
14
  },
15
- tag: "aside"
15
+ tag: "aside",
16
16
  });
17
17
  });
@@ -15,6 +15,6 @@ describe("pagination", () => {
15
15
  <a class="s-pagination--item" href="#">100</a>
16
16
  <a class="s-pagination--item" href="#">Next</a>
17
17
  `,
18
- }
18
+ },
19
19
  });
20
20
  });
@@ -25,6 +25,6 @@ describe("toast > notice", () => {
25
25
  >
26
26
  ${component}
27
27
  </div>
28
- `
28
+ `,
29
29
  });
30
30
  });