@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.
Files changed (47) hide show
  1. package/README.md +5 -0
  2. package/dist/css/stacks.css +582 -532
  3. package/dist/css/stacks.min.css +1 -1
  4. package/dist/js/stacks.js +265 -110
  5. package/dist/js/stacks.min.js +1 -1
  6. package/lib/atomic/typography.less +4 -0
  7. package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +1 -1
  8. package/lib/components/activity-indicator/activity-indicator.less +17 -4
  9. package/lib/components/anchor/anchor.visual.test.ts +1 -5
  10. package/lib/components/avatar/avatar.visual.test.ts +1 -4
  11. package/lib/components/badge/badge.a11y.test.ts +2 -2
  12. package/lib/components/badge/badge.less +15 -23
  13. package/lib/components/block-link/block-link.less +5 -4
  14. package/lib/components/button/button.a11y.test.ts +2 -5
  15. package/lib/components/button/button.less +28 -58
  16. package/lib/components/button/button.visual.test.ts +2 -5
  17. package/lib/components/card/card.less +8 -0
  18. package/lib/components/description/description.a11y.test.ts +1 -0
  19. package/lib/components/expandable/expandable.a11y.test.ts +27 -0
  20. package/lib/components/expandable/expandable.visual.test.ts +27 -0
  21. package/lib/components/input-icon/input-icon.less +1 -1
  22. package/lib/components/input-message/input-message.less +4 -3
  23. package/lib/components/label/label.less +3 -13
  24. package/lib/components/link-preview/link-preview.a11y.test.ts +48 -0
  25. package/lib/components/link-preview/link-preview.less +13 -4
  26. package/lib/components/link-preview/link-preview.visual.test.ts +52 -0
  27. package/lib/components/notice/notice.a11y.test.ts +17 -0
  28. package/lib/components/notice/notice.less +44 -81
  29. package/lib/components/notice/notice.visual.test.ts +26 -0
  30. package/lib/components/pagination/pagination.a11y.test.ts +20 -0
  31. package/lib/components/pagination/pagination.visual.test.ts +26 -0
  32. package/lib/components/post-summary/post-summary.less +3 -3
  33. package/lib/components/sidebar-widget/sidebar-widget.less +2 -2
  34. package/lib/components/spinner/spinner.a11y.test.ts +15 -0
  35. package/lib/components/spinner/spinner.visual.test.ts +43 -0
  36. package/lib/components/toast/toast.a11y.test.ts +30 -0
  37. package/lib/components/toast/toast.visual.test.ts +10 -6
  38. package/lib/components/toggle-switch/toggle-switch.less +2 -5
  39. package/lib/components/uploader/uploader.less +19 -13
  40. package/lib/exports/color-sets.less +127 -78
  41. package/lib/exports/theme.less +3 -3
  42. package/lib/input-utils.less +1 -1
  43. package/lib/test/axe-apca/README.md +19 -0
  44. package/lib/test/axe-apca/src/axe-apca.test.ts +77 -1
  45. package/lib/test/axe-apca/src/axe-apca.ts +16 -8
  46. package/lib/test/test-utils.ts +7 -3
  47. package/package.json +12 -12
@@ -1,9 +1,10 @@
1
1
  .construct-notice-component(@baseClass) {
2
- --_no-bc: var(--bc-medium);
2
+ --_no-bc: var(--black-225);
3
3
  --_no-bg: var(--black-150);
4
- --_no-fc: var(--fc-medium);
4
+ --_no-fc: var(--black-500);
5
5
  --_no-btn-bg-focus: var(--black-225);
6
6
  --_no-btn-bg-active: var(--black-250);
7
+ --_no-btn-fc: var(--_no-fc);
7
8
 
8
9
  // MODIFIERS
9
10
  &:not(&__important) {
@@ -26,137 +27,99 @@
26
27
  --_no-fc: var(--white);
27
28
  --_no-btn-bg-focus: var(--black-600);
28
29
  --_no-btn-bg-active: var(--black-600);
29
-
30
- .highcontrast-mode({
31
- --_no-bc: var(--_no-bg);
32
- });
30
+ --_no-btn-fc: var(--_no-fc);
31
+ --_no-code-bg: var(--black-300);
33
32
  }
34
33
 
35
34
  // VARIANTS
36
35
  &__danger {
37
36
  --_no-bc: var(--red-300);
38
- --_no-bg: var(--red-200);
39
- --_no-btn-bg-active: var(--red-300);
40
- --_no-btn-bg-focus: var(--red-300);
41
-
42
- &:not(.@{baseClass}__important) {
43
- .highcontrast-mode({
44
- --_no-bg: var(--red-300);
45
- });
46
- }
37
+ --_no-bg: var(--red-100);
38
+ --_no-btn-bg-active: var(--red-200);
39
+ --_no-btn-bg-focus: var(--red-200);
40
+ --_no-btn-fc: var(--red-500);
41
+ --_no-code-bg: var(--red-300);
47
42
 
48
43
  &.@{baseClass}__important {
49
44
  --_no-bc: var(--_no-bg);
50
45
  --_no-bg: var(--red-400);
51
46
  --_no-btn-bg-active: var(--red-500);
52
47
  --_no-btn-bg-focus: var(--red-500);
48
+ --_no-btn-fc: var(--red-100);
53
49
 
54
- .dark-mode({
55
- --_no-bg: var(--red-400);
56
- --_no-fc: var(--black-600);
57
- });
58
-
59
- .highcontrast-dark-mode({
60
- --_no-bg: var(--red-400);
61
- --_no-fc: var(--white);
50
+ .highcontrast-mode({
51
+ --_no-bg: var(--red-500);
62
52
  });
63
53
  }
64
54
  }
65
55
 
66
56
  &__info {
67
57
  --_no-bc: var(--theme-secondary-300);
68
- --_no-bg: var(--theme-secondary-200);
69
- --_no-btn-bg-focus: var(--theme-secondary-300);
70
- --_no-btn-bg-active: var(--theme-secondary-300);
58
+ --_no-bg: var(--theme-secondary-100);
59
+ --_no-btn-bg-focus: var(--theme-secondary-200);
60
+ --_no-btn-bg-active: var(--theme-secondary-200);
61
+ --_no-btn-fc: var(--theme-secondary-500);
71
62
  --_no-code-bg: var(--theme-secondary-300);
72
63
 
73
- &:not(.@{baseClass}__important) {
74
- .highcontrast-mode({
75
- --_no-bg: var(--theme-secondary-300);
76
- });
77
-
78
- .highcontrast-dark-mode({
79
- --_no-bg: var(--theme-secondary-300);
80
- });
81
- }
82
-
83
64
  &.@{baseClass}__important {
84
65
  --_no-bc: var(--_no-bg);
85
66
  --_no-bg: var(--theme-secondary-400);
86
67
  --_no-btn-bg-active: var(--theme-secondary-500);
87
- --_no-btn-bg-focus: var(--theme-secondary-400);
68
+ --_no-btn-bg-focus: var(--theme-secondary-500);
69
+ --_no-btn-fc: var(--theme-secondary-100);
88
70
 
89
- .dark-mode({
90
- --_no-bg: var(--theme-secondary-400);
91
- --_no-fc: var(--black-600);
92
- });
93
-
94
- .highcontrast-dark-mode({
95
- --_no-bg: var(--theme-secondary-400);
96
- --_no-fc: var(--white);
71
+ .highcontrast-mode({
72
+ --_no-bg: var(--theme-secondary-500);
97
73
  });
98
74
  }
99
75
  }
100
76
 
101
77
  &__success {
102
78
  --_no-bc: var(--green-300);
103
- --_no-bg: var(--green-200);
104
- --_no-btn-bg-active: var(--green-300);
105
- --_no-btn-bg-focus: var(--green-300);
106
-
107
- &:not(.@{baseClass}__important) {
108
- .highcontrast-mode({
109
- --_no-bg: var(--green-300);
110
- });
111
- }
79
+ --_no-bg: var(--green-100);
80
+ --_no-btn-bg-active: var(--green-200);
81
+ --_no-btn-bg-focus: var(--green-200);
82
+ --_no-btn-fc: var(--green-500);
83
+ --_no-code-bg: var(--green-300);
112
84
 
113
85
  &.@{baseClass}__important {
114
86
  --_no-bc: var(--_no-bg);
115
87
  --_no-bg: var(--green-400);
116
- --_no-fc: var(--black-600);
117
88
  --_no-btn-bg-active: var(--green-500);
118
- --_no-btn-bg-focus: var(--green-400);
119
-
120
- .dark-mode({
121
- --_no-bg: var(--green-400);
122
- --_no-fc: var(--white);
123
- });
89
+ --_no-btn-bg-focus: var(--green-500);
90
+ --_no-btn-fc: var(--green-100);
124
91
 
125
92
  .highcontrast-mode({
126
- --_no-bg: var(--green-400);
127
- --_no-fc: var(--white);
93
+ --_no-bg: var(--green-500);
128
94
  });
129
95
  }
130
96
  }
131
97
 
132
98
  &__warning {
133
- --_no-bc: var(--yellow-400);
134
- --_no-bg: var(--yellow-200);
135
- --_no-btn-bg-active: var(--yellow-400);
136
- --_no-btn-bg-focus: var(--yellow-300);
99
+ --_no-bc: var(--yellow-300);
100
+ --_no-bg: var(--yellow-100);
101
+ --_no-btn-bg-active: var(--yellow-200);
102
+ --_no-btn-bg-focus: var(--yellow-200);
103
+ --_no-btn-fc: var(--yellow-600);
137
104
  --_no-code-bg: var(--yellow-300);
138
105
 
139
- &:not(.@{baseClass}__important) {
140
- .highcontrast-mode({
141
- --_no-bg: var(--yellow-300);
142
- });
143
- }
144
-
145
106
  &.@{baseClass}__important {
146
107
  --_no-bc: var(--_no-bg);
147
108
  --_no-bg: var(--yellow-400);
148
- --_no-fc: var(--black-600);
149
- --_no-btn-bg-active: var(--yellow-500);
150
- --_no-btn-bg-focus: var(--yellow-400);
109
+ --_no-fc: var(--black);
110
+ --_no-btn-fc: var(--_no-fc);
111
+ --_no-btn-bg-active: var(--yellow-300);
112
+ --_no-btn-bg-focus: var(--yellow-300);
151
113
 
152
114
  .dark-mode({
153
- --_no-bg: var(--yellow-500);
154
- --_no-fc: var(--white);
115
+ --_no-fc: var(--yellow-200);
155
116
  });
156
117
 
157
118
  .highcontrast-mode({
158
119
  --_no-bg: var(--yellow-500);
159
120
  --_no-fc: var(--white);
121
+ --_no-btn-bg-active: transparent;
122
+ --_no-btn-bg-focus: transparent;
160
123
  });
161
124
  }
162
125
  }
@@ -173,15 +136,15 @@
173
136
  }
174
137
 
175
138
  &:active {
176
- background: var(--_no-btn-bg-active);
139
+ background-color: var(--_no-btn-bg-active, inherit) !important;
177
140
  }
178
141
 
179
142
  &:focus,
180
143
  &:hover {
181
- background: var(--_no-btn-bg-focus);
144
+ background-color: var(--_no-btn-bg-focus, inherit) !important;
182
145
  }
183
146
 
184
- color: inherit;
147
+ color: var(--_no-btn-fc, inherit) !important;
185
148
  padding: var(--su8);
186
149
  }
187
150
 
@@ -0,0 +1,26 @@
1
+ import { runComponentTests } from "../../test/test-utils";
2
+ import { html } from "@open-wc/testing";
3
+ import "../../index";
4
+
5
+ describe("notice", () => {
6
+ runComponentTests({
7
+ type: "visual",
8
+ baseClass: "s-notice",
9
+ variants: ["info", "success", "warning", "danger"],
10
+ modifiers: {
11
+ primary: ["important"],
12
+ },
13
+ attributes: {
14
+ ariaHidden: "false",
15
+ },
16
+ children: {
17
+ default: `Test notice`,
18
+ },
19
+ tag: "aside",
20
+ template: ({ component, testid }) => html`
21
+ <div class="d-inline-block p8" data-testid="${testid}">
22
+ ${component}
23
+ </div>
24
+ `,
25
+ });
26
+ });
@@ -0,0 +1,20 @@
1
+ import { runComponentTests } from "../../test/test-utils";
2
+ import "../../index";
3
+
4
+ describe("pagination", () => {
5
+ runComponentTests({
6
+ type: "a11y",
7
+ baseClass: "s-pagination",
8
+ children: {
9
+ default: `
10
+ <a class="s-pagination--item" href="#">Prev</a>
11
+ <a class="s-pagination--item" href="#">1</a>
12
+ <span class="s-pagination--item is-selected" aria-current="page">2</span>
13
+ <a class="s-pagination--item" href="#">3</a>
14
+ <span class="s-pagination--item s-pagination--item__clear">…</span>
15
+ <a class="s-pagination--item" href="#">100</a>
16
+ <a class="s-pagination--item" href="#">Next</a>
17
+ `,
18
+ }
19
+ });
20
+ });
@@ -0,0 +1,26 @@
1
+ import { html } from "@open-wc/testing";
2
+ import { runComponentTests } from "../../test/test-utils";
3
+ import "../../index";
4
+
5
+ describe("pagination", () => {
6
+ runComponentTests({
7
+ type: "visual",
8
+ baseClass: "s-pagination",
9
+ children: {
10
+ default: `
11
+ <a class="s-pagination--item" href="#">Prev</a>
12
+ <a class="s-pagination--item" href="#">1</a>
13
+ <span class="s-pagination--item is-selected" aria-current="page">2</span>
14
+ <a class="s-pagination--item" href="#">3</a>
15
+ <span class="s-pagination--item s-pagination--item__clear">…</span>
16
+ <a class="s-pagination--item" href="#">100</a>
17
+ <a class="s-pagination--item" href="#">Next</a>
18
+ `,
19
+ },
20
+ template: ({ component, testid }) => html`
21
+ <div class="d-inline-block p8" data-testid="${testid}">
22
+ ${component}
23
+ </div>
24
+ `,
25
+ });
26
+ });
@@ -380,15 +380,15 @@
380
380
 
381
381
  // Hotness
382
382
  &.is-warm {
383
- color: var(--_ps-state-fc, var(--yellow-600));
383
+ color: var(--_ps-state-fc, var(--yellow-500));
384
384
  }
385
385
 
386
386
  &.is-hot {
387
- color: var(--_ps-state-fc, var(--orange-600));
387
+ color: var(--_ps-state-fc, var(--orange-500));
388
388
  }
389
389
 
390
390
  &.is-supernova {
391
- color: var(--_ps-state-fc, var(--red-600));
391
+ color: var(--_ps-state-fc, var(--red-500));
392
392
  }
393
393
 
394
394
  // Status
@@ -228,11 +228,11 @@
228
228
  }
229
229
 
230
230
  .s-sidebarwidget--header {
231
- background-color: var(~"--@{name}-300");
231
+ background-color: var(~"--@{name}-200");
232
232
  color: var(--fc-medium);
233
233
  }
234
234
 
235
- background-color: var(~"--@{name}-200");
235
+ background-color: var(~"--@{name}-100");
236
236
  border-color: var(--_sw-bc);
237
237
  }
238
238
  }
@@ -0,0 +1,15 @@
1
+ import { runComponentTests } from "../../test/test-utils";
2
+ import "../../index";
3
+
4
+ describe("spinner", () => {
5
+ runComponentTests({
6
+ type: "a11y",
7
+ baseClass: "s-spinner",
8
+ modifiers: {
9
+ primary: ["xs", "sm", "md", "lg"],
10
+ },
11
+ children: {
12
+ default: `<div class="v-visible-sr">Loading…</div>`,
13
+ },
14
+ });
15
+ });
@@ -0,0 +1,43 @@
1
+ import { html } from "@open-wc/testing";
2
+ import { runComponentTests } from "../../test/test-utils";
3
+ import "../../index";
4
+
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const template = ({ component, testid }: any) => html`
7
+ <div class="d-inline-block p8" data-testid="${testid}">${component}</div>
8
+ `;
9
+ describe("spinner", () => {
10
+ // default, sizes
11
+ runComponentTests({
12
+ type: "visual",
13
+ baseClass: "s-spinner",
14
+ modifiers: {
15
+ primary: ["xs", "sm", "md", "lg"],
16
+ },
17
+ children: {
18
+ default: `<div class="v-visible-sr">Loading…</div>`,
19
+ },
20
+ template,
21
+ });
22
+ // applied font color
23
+ runComponentTests({
24
+ type: "visual",
25
+ baseClass: "s-spinner",
26
+ modifiers: {
27
+ global: ["fc-theme-primary"],
28
+ },
29
+ children: {
30
+ default: `<div class="v-visible-sr">Loading…</div>`,
31
+ },
32
+ template,
33
+ });
34
+ // .is-loading
35
+ runComponentTests({
36
+ type: "visual",
37
+ baseClass: "is-loading",
38
+ children: {
39
+ default: `Loading…`,
40
+ },
41
+ template,
42
+ });
43
+ });
@@ -0,0 +1,30 @@
1
+ import { runComponentTests } from "../../test/test-utils";
2
+ import { html } from "@open-wc/testing";
3
+ import "../../index";
4
+
5
+ describe("toast > notice", () => {
6
+ // This is a test of notice component wrapped in a toast component
7
+ runComponentTests({
8
+ type: "a11y",
9
+ baseClass: "s-notice", // s-toast is a wrapper around s-notice
10
+ variants: ["info", "success", "warning", "danger"],
11
+ modifiers: {
12
+ primary: ["important"],
13
+ },
14
+ children: {
15
+ toast: `<span id="message">Test toast</span>`,
16
+ },
17
+ tag: "aside",
18
+ template: ({ component, testid }) => html`
19
+ <div
20
+ class="s-toast ps-static t0 l0"
21
+ role="alertdialog"
22
+ aria-hidden="false"
23
+ aria-labelledby="message"
24
+ data-testid="${testid}"
25
+ >
26
+ ${component}
27
+ </div>
28
+ `
29
+ });
30
+ });
@@ -11,16 +11,20 @@ describe("toast > notice", () => {
11
11
  modifiers: {
12
12
  primary: ["important"],
13
13
  },
14
- attributes: {
15
- ariaHidden: "false",
16
- },
17
14
  children: {
18
- toast: "Test toast",
15
+ toast: `<span id="message">Test toast</span>`,
19
16
  },
20
17
  tag: "aside",
21
18
  template: ({ component, testid }) => html`
22
- <div data-testid="${testid}" class="s-toast" aria-hidden="false">
23
- ${component}
19
+ <div class="d-inline-block p8" data-testid="${testid}">
20
+ <div
21
+ class="s-toast ps-static t0 l0"
22
+ role="alertdialog"
23
+ aria-hidden="false"
24
+ aria-labelledby="message"
25
+ >
26
+ ${component}
27
+ </div>
24
28
  </div>
25
29
  `,
26
30
  });
@@ -21,15 +21,11 @@
21
21
  &.s-toggle-switch--label-off {
22
22
  --_ts-multiple-bg: var(--black-400);
23
23
  --_ts-multiple-fc: var(--white);
24
-
25
- .dark-mode({ --_ts-multiple-bg: var(--black-350); });
26
24
  }
27
25
 
28
26
  &:not(.s-toggle-switch--label-off) {
29
27
  --_ts-multiple-bg: var(--green-400);
30
- --_ts-multiple-fc: var(--_white-static);
31
-
32
- .highcontrast-mode({ --_ts-multiple-fc: var(--white); });
28
+ --_ts-multiple-fc: var(--white);
33
29
  }
34
30
  }
35
31
 
@@ -102,6 +98,7 @@
102
98
  background-repeat: no-repeat;
103
99
  border-radius: 1000px;
104
100
  cursor: pointer;
101
+ flex-shrink: 0;
105
102
  height: var(--su-static24);
106
103
  margin: 0; // guard against production adding 5px of margin to these
107
104
  transition: background-position 0.2s ease;
@@ -10,6 +10,15 @@
10
10
  // CONTEXTUAL STYLES
11
11
  .highcontrast-mode({
12
12
  --_up-bg-bc-hc: var(--black-400);
13
+ &.has-error {
14
+ --_up-bg-bc-hc-state: var(--red-500);
15
+ }
16
+ &.has-success {
17
+ --_up-bg-bc-hc-state: var(--green-400);
18
+ }
19
+ &.has-warning {
20
+ --_up-bg-bc-hc-state: var(--yellow-500);
21
+ }
13
22
  });
14
23
 
15
24
  // STATES
@@ -22,30 +31,27 @@
22
31
  }
23
32
 
24
33
  &.has-error {
25
- --_up-bg: var(--red-200);
26
- --_up-bg-focus: var(--red-300);
27
- --_up-bg-bc: var(--red-400);
28
- --_up-bg-bc-hc-state: var(--red-400);
34
+ --_up-bg: var(--red-100);
35
+ --_up-bg-focus: var(--red-200);
36
+ --_up-bg-bc: var(--red-300);
29
37
  --_up-focus-ring-color: var(--focus-ring-error);
30
- --_up-link-fc: var(--red-600);
38
+ --_up-link-fc: var(--red-500);
31
39
  }
32
40
 
33
41
  &.has-success {
34
42
  --_up-bg: var(--green-100);
35
43
  --_up-bg-focus: var(--green-200);
36
- --_up-bg-bc: var(--green-400);
37
- --_up-bg-bc-hc-state: var(--green-400);
44
+ --_up-bg-bc: var(--green-300);
38
45
  --_up-focus-ring-color: var(--focus-ring-success);
39
- --_up-link-fc: var(--green-600);
46
+ --_up-link-fc: var(--green-400);
40
47
  }
41
48
 
42
49
  &.has-warning {
43
- --_up-bg: var(--yellow-200);
44
- --_up-bg-focus: var(--yellow-300);
45
- --_up-bg-bc: var(--yellow-400);
46
- --_up-bg-bc-hc-state: var(--yellow-400);
50
+ --_up-bg: var(--yellow-100);
51
+ --_up-bg-focus: var(--yellow-200);
52
+ --_up-bg-bc: var(--yellow-300);
47
53
  --_up-focus-ring-color: var(--focus-ring-warning);
48
- --_up-link-fc: var(--yellow-600);
54
+ --_up-link-fc: var(--yellow-500);
49
55
  }
50
56
 
51
57
  &.is-active {