@stackoverflow/stacks 1.9.0 → 1.9.1

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 (132) hide show
  1. package/README.md +161 -153
  2. package/dist/components/table/table.d.ts +26 -4
  3. package/dist/css/stacks.css +21 -6
  4. package/dist/css/stacks.min.css +1 -1
  5. package/dist/js/stacks.js +93 -64
  6. package/dist/js/stacks.min.js +1 -1
  7. package/lib/atomic/border.less +397 -397
  8. package/lib/atomic/color.less +210 -210
  9. package/lib/atomic/flex.less +426 -426
  10. package/lib/atomic/gap.less +44 -44
  11. package/lib/atomic/grid.less +139 -139
  12. package/lib/atomic/misc.less +343 -343
  13. package/lib/atomic/spacing.less +342 -342
  14. package/lib/atomic/typography.less +267 -267
  15. package/lib/atomic/width-height.less +194 -194
  16. package/lib/base/body.less +44 -44
  17. package/lib/base/configuration-static.less +61 -61
  18. package/lib/base/fieldset.less +5 -5
  19. package/lib/base/icon.less +11 -11
  20. package/lib/base/internal.less +220 -220
  21. package/lib/base/reset-meyer.less +64 -64
  22. package/lib/base/reset-normalize.less +449 -449
  23. package/lib/base/reset.less +20 -20
  24. package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +21 -21
  25. package/lib/components/activity-indicator/activity-indicator.less +40 -40
  26. package/lib/components/activity-indicator/activity-indicator.visual.test.ts +23 -23
  27. package/lib/components/anchor/anchor.less +61 -61
  28. package/lib/components/avatar/avatar.a11y.test.ts +36 -36
  29. package/lib/components/avatar/avatar.less +108 -108
  30. package/lib/components/avatar/avatar.visual.test.ts +54 -54
  31. package/lib/components/award-bling/award-bling.a11y.test.ts +17 -0
  32. package/lib/components/award-bling/award-bling.less +31 -31
  33. package/lib/components/award-bling/award-bling.visual.test.ts +26 -0
  34. package/lib/components/badge/badge.less +251 -251
  35. package/lib/components/banner/banner.a11y.test.ts +37 -0
  36. package/lib/components/banner/banner.less +51 -51
  37. package/lib/components/banner/banner.test.ts +73 -77
  38. package/lib/components/banner/banner.ts +149 -149
  39. package/lib/components/banner/banner.visual.test.ts +37 -36
  40. package/lib/components/block-link/block-link.a11y.test.ts +68 -0
  41. package/lib/components/block-link/block-link.less +80 -80
  42. package/lib/components/block-link/block-link.visual.test.ts +61 -0
  43. package/lib/components/breadcrumbs/breadcrumbs.a11y.test.ts +37 -0
  44. package/lib/components/breadcrumbs/breadcrumbs.less +41 -41
  45. package/lib/components/breadcrumbs/breadcrumbs.visual.test.ts +37 -0
  46. package/lib/components/button/button.a11y.test.ts +32 -32
  47. package/lib/components/button/button.less +502 -502
  48. package/lib/components/button/button.visual.test.ts +52 -52
  49. package/lib/components/button-group/button-group.less +83 -83
  50. package/lib/components/card/card.a11y.test.ts +13 -0
  51. package/lib/components/card/card.less +29 -29
  52. package/lib/components/card/card.visual.test.ts +54 -0
  53. package/lib/components/check-control/check-control.less +17 -17
  54. package/lib/components/check-group/check-group.less +19 -19
  55. package/lib/components/checkbox_radio/checkbox_radio.less +158 -158
  56. package/lib/components/code-block/code-block.less +116 -116
  57. package/lib/components/description/description.less +9 -9
  58. package/lib/components/empty-state/empty-state.less +16 -16
  59. package/lib/components/expandable/expandable.less +118 -118
  60. package/lib/components/expandable/expandable.test.ts +51 -53
  61. package/lib/components/expandable/expandable.ts +238 -238
  62. package/lib/components/input-fill/input-fill.less +35 -35
  63. package/lib/components/input-icon/input-icon.less +45 -45
  64. package/lib/components/input-message/input-message.less +48 -48
  65. package/lib/components/input_textarea/input_textarea.less +166 -166
  66. package/lib/components/label/label.less +111 -111
  67. package/lib/components/link/link.less +119 -119
  68. package/lib/components/link-preview/link-preview.less +139 -139
  69. package/lib/components/menu/menu.less +41 -41
  70. package/lib/components/modal/modal.less +113 -113
  71. package/lib/components/modal/modal.ts +379 -379
  72. package/lib/components/navigation/navigation.less +134 -134
  73. package/lib/components/navigation/navigation.ts +128 -128
  74. package/lib/components/notice/notice.less +203 -203
  75. package/lib/components/page-title/page-title.less +51 -51
  76. package/lib/components/pagination/pagination.less +52 -52
  77. package/lib/components/popover/popover.less +148 -148
  78. package/lib/components/popover/popover.ts +651 -651
  79. package/lib/components/popover/tooltip.test.ts +62 -66
  80. package/lib/components/popover/tooltip.ts +343 -343
  81. package/lib/components/popover/tooltip.visual.test.ts +31 -31
  82. package/lib/components/post-summary/post-summary.less +415 -415
  83. package/lib/components/progress-bar/progress-bar.less +291 -291
  84. package/lib/components/prose/prose.less +452 -452
  85. package/lib/components/select/select.less +148 -148
  86. package/lib/components/sidebar-widget/sidebar-widget.less +257 -258
  87. package/lib/components/spinner/spinner.less +103 -103
  88. package/lib/components/table/table.less +307 -292
  89. package/lib/components/table/table.test.ts +366 -0
  90. package/lib/components/table/table.ts +296 -263
  91. package/lib/components/table-container/table-container.less +4 -4
  92. package/lib/components/tag/tag.less +213 -213
  93. package/lib/components/toast/toast.less +35 -35
  94. package/lib/components/toast/toast.test.ts +63 -67
  95. package/lib/components/toast/toast.ts +357 -357
  96. package/lib/components/toast/toast.visual.test.ts +27 -27
  97. package/lib/components/toggle-switch/toggle-switch.less +110 -110
  98. package/lib/components/topbar/topbar.less +436 -435
  99. package/lib/components/uploader/uploader.less +195 -195
  100. package/lib/components/uploader/uploader.ts +205 -205
  101. package/lib/components/user-card/user-card.less +129 -129
  102. package/lib/controllers.ts +33 -33
  103. package/lib/exports/constants-colors.less +1112 -1111
  104. package/lib/exports/constants-helpers.less +108 -108
  105. package/lib/exports/constants-type.less +153 -153
  106. package/lib/exports/exports.less +15 -15
  107. package/lib/exports/mixins.less +299 -299
  108. package/lib/index.ts +32 -32
  109. package/lib/input-utils.less +44 -44
  110. package/lib/stacks-dynamic.less +24 -24
  111. package/lib/stacks-static.less +93 -93
  112. package/lib/stacks.less +13 -13
  113. package/lib/stacks.ts +113 -113
  114. package/lib/test/open-wc-testing-patch.d.ts +26 -0
  115. package/lib/test/test-utils.ts +466 -444
  116. package/lib/tsconfig.build.json +4 -0
  117. package/lib/tsconfig.json +16 -13
  118. package/package.json +106 -105
  119. package/dist/components/activity-indicator/activity-indicator.a11y.test.d.ts +0 -1
  120. package/dist/components/activity-indicator/activity-indicator.visual.test.d.ts +0 -1
  121. package/dist/components/avatar/avatar.a11y.test.d.ts +0 -1
  122. package/dist/components/avatar/avatar.visual.test.d.ts +0 -1
  123. package/dist/components/banner/banner.test.d.ts +0 -1
  124. package/dist/components/banner/banner.visual.test.d.ts +0 -1
  125. package/dist/components/button/button.a11y.test.d.ts +0 -1
  126. package/dist/components/button/button.visual.test.d.ts +0 -1
  127. package/dist/components/expandable/expandable.test.d.ts +0 -1
  128. package/dist/components/popover/tooltip.test.d.ts +0 -1
  129. package/dist/components/popover/tooltip.visual.test.d.ts +0 -1
  130. package/dist/components/toast/toast.test.d.ts +0 -1
  131. package/dist/components/toast/toast.visual.test.d.ts +0 -1
  132. package/dist/test/test-utils.d.ts +0 -136
@@ -1,251 +1,251 @@
1
- .s-badge {
2
- --_ba-as: unset;
3
- --_ba-bc: var(--bc-medium);
4
- --_ba-bg: var(--black-050);
5
- --_ba-fc: var(--black-700);
6
- --_ba-fs: var(--fs-caption);
7
- --_ba-g: 0.3em;
8
- --_ba-lh: 2;
9
- --_ba-px: var(--su6);
10
- --_ba-py: 0;
11
- --_ba-wmn: 0;
12
-
13
- // CONTEXTUAL STYLES
14
- .highcontrast-mode({
15
- // Badge counts
16
- &&__gold,
17
- &&__silver,
18
- &&__bronze,
19
- // Number counts
20
- &&__rep,
21
- &&__rep-down,
22
- &&__votes:not(&__answered),
23
- // Users
24
- &&__admin,
25
- &&__moderator,
26
- &&__staff {
27
- --_ba-bc: currentColor;
28
- }
29
- });
30
-
31
- // MODIFIERS
32
- // Sizes
33
- &&__xs,
34
- &&__sm {
35
- --_ba-as: flex-start;
36
- --_ba-fs: var(--fs-fine);
37
- }
38
-
39
- &&__xs {
40
- --_ba-lh: 1.5;
41
- --_ba-px: var(--su2);
42
- --_ba-wmn: calc(var(--su-static16) + var(--su-static2));
43
- }
44
-
45
- &&__sm {
46
- --_ba-lh: 1.8;
47
- --_ba-px: var(--su4);
48
- --_ba-wmn: calc(var(--su-static16) + var(--su-static2));
49
- }
50
-
51
- // Badge counts
52
- &&__gold,
53
- &&__silver,
54
- &&__bronze {
55
- --_ba-fc: var(--black-700);
56
-
57
- .highcontrast-mode({
58
- --_ba-fc: var(--black-900);
59
- });
60
- }
61
-
62
- &&__gold {
63
- --_ba-bc: var(--gold-darker);
64
- --_ba-bg: var(--gold-lighter);
65
- }
66
-
67
- &&__silver {
68
- --_ba-bc: var(--silver-darker);
69
- --_ba-bg: var(--silver-lighter);
70
- }
71
-
72
- &&__bronze {
73
- --_ba-bc: var(--bronze-darker);
74
- --_ba-bg: var(--bronze-lighter);
75
- }
76
-
77
- // Number counts
78
- &&__answered,
79
- &&__bounty,
80
- &&__important {
81
- --_ba-bc: transparent;
82
- --_ba-fc: var(--white);
83
- }
84
-
85
- &&__rep,
86
- &&__rep-down,
87
- &&__votes:not(&__answered) {
88
- --_ba-bg: var(--white);
89
- }
90
-
91
- &&__answered {
92
- --_ba-bg: var(--green-400);
93
- }
94
-
95
- &&__bounty {
96
- --_ba-bg: var(--blue-600);
97
- }
98
-
99
- &&__important {
100
- --_ba-bg: var(--red-600);
101
- }
102
-
103
- &&__rep {
104
- --_ba-bc: var(--green-400);
105
- --_ba-fc: var(--green-500);
106
- }
107
-
108
- &&__rep-down {
109
- --_ba-bc: var(--red-400);
110
- --_ba-fc: var(--red-500);
111
- }
112
-
113
- &&__votes:not(&__answered) {
114
- --_ba-bc: var(--black-150);
115
- --_ba-fc: var(--black-700);
116
- }
117
-
118
- // Users
119
- &&__admin {
120
- --_ba-bc: var(--theme-primary-200);
121
- --_ba-bg: var(--theme-primary-075);
122
- --_ba-fc: var(--theme-primary-800);
123
- }
124
-
125
- &&__moderator {
126
- --_ba-bc: var(--theme-secondary-200);
127
- --_ba-bg: var(--theme-secondary-075);
128
- --_ba-fc: var(--theme-secondary-800);
129
- --_ba-g: calc(var(--su-static4) - var(--su-static1)); // 3px
130
- // :before icon
131
- --_ba-before-h: calc(var(--su-static16) - var(--su-static2)); // 14px
132
- --_ba-before-icon: url("data:image/svg+xml,%3Csvg width='12' height='14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.528.746c.257-.329.675-.327.93 0l4.42 5.66c.258.329.257.864 0 1.192l-4.42 5.66c-.256.328-.674.327-.93 0l-4.42-5.66c-.257-.329-.256-.865 0-1.192l4.42-5.66z' fill='%23fff'/%3E%3C/svg%3E");
133
- --_ba-before-mt: calc(var(--su-static1) * -1); // -1px
134
- --_ba-before-w: var(--su-static12);
135
-
136
- // Sizes
137
- &.s-badge__xs {
138
- --_ba-before-h: calc(var(--su-static8) + var(--su-static1)); // 9px
139
- --_ba-before-icon: url("data:image/svg+xml,%3Csvg width='7' height='9' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 .246c.3-.329.701-.327 1 0L6.776 4c.3.329.298.672 0 1L4 8.75c-.299.329-.702.327-1 0L.224 5c-.284-.324-.285-.675 0-1L3 .246z' fill='%23fff'/%3E%3C/svg%3E");
140
- --_ba-before-mt: 0;
141
- --_ba-before-w: calc(var(--su-static8) - var(--su-static1)); // 7px
142
- }
143
-
144
- &.s-badge__sm {
145
- --_ba-g: var(--su-static2);
146
- --_ba-before-h: calc(var(--su-static12) - var(--su-static1)); // 11px
147
- --_ba-before-icon: url("data:image/svg+xml,%3Csvg width='9' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.55.246c.257-.329.647-.327.903 0l3.36 4.66c.256.329.256.864 0 1.192L4.45 10.75c-.257.329-.644.327-.9 0L.192 6.098c-.256-.329-.256-.865 0-1.192L3.55.246z' fill='%23fff'/%3E%3C/svg%3E");
148
- --_ba-before-mt: 0;
149
- --_ba-before-w: calc(var(--su-static8) + var(--su-static1)); // 9px
150
- }
151
-
152
- &:before {
153
- height: var(--_ba-before-h);
154
- margin-top: var(--_ba-before-mt);
155
- width: var(--_ba-before-w);
156
-
157
- content: "";
158
- display: inline-block;
159
- background-color: currentColor;
160
- -webkit-mask: var(--_ba-before-icon) no-repeat center;
161
- mask: var(--_ba-before-icon) no-repeat center;
162
- -webkit-mask-size: contain;
163
- mask-size: contain;
164
- }
165
- }
166
-
167
- &&__staff {
168
- // Staff badges are always "Stack Overflow Orange"
169
- --_ba-bc: var(--orange-300);
170
- --_ba-bg: var(--orange-100);
171
- --_ba-fc: var(--orange-900);
172
- }
173
-
174
- // VARIANTS
175
- &&__danger,
176
- &&__muted {
177
- &.s-badge__filled {
178
- --_ba-bc: transparent;
179
- }
180
- }
181
-
182
- &&__danger {
183
- --_ba-bc: var(--red-600);
184
- --_ba-bg: var(--red-100);
185
- --_ba-fc: var(--red-900);
186
-
187
- &.s-badge__filled {
188
- --_ba-bg: var(--red-500);
189
- --_ba-fc: @white;
190
-
191
- .highcontrast-mode({
192
- --_ba-fc: var(--white);
193
- });
194
- }
195
- }
196
- &&__info {
197
- --_ba-bc: var(--blue-600);
198
- --_ba-bg: var(--blue-100);
199
- --_ba-fc: var(--blue-900);
200
- }
201
-
202
- &&__warning {
203
- --_ba-bc: var(--yellow-600);
204
- --_ba-bg: var(--yellow-100);
205
- --_ba-fc: var(--yellow-900);
206
- }
207
-
208
- &&__muted {
209
- --_ba-bc: var(--black-600);
210
- --_ba-bg: var(--black-100);
211
- --_ba-fc: var(--black-900);
212
-
213
- &.s-badge__filled {
214
- --_ba-bg: var(--black-700);
215
- --_ba-fc: var(--white);
216
- }
217
- }
218
-
219
- // CHILD ELEMENTS
220
- &--image, // Included with no base class to account for usage in .s-progress__badge
221
- & &--image {
222
- align-self: center;
223
- display: inline-flex;
224
- margin-right: var(--su1);
225
- margin-left: calc((var(--su4) + var(--su1)) * -1);
226
- }
227
-
228
- // INTERACTION
229
- a&:hover {
230
- text-decoration: none;
231
- }
232
-
233
- align-self: var(--_ba-as);
234
- background-color: var(--_ba-bg);
235
- border: var(--su-static1) solid var(--_ba-bc);
236
- color: var(--_ba-fc);
237
- font-size: var(--_ba-fs);
238
- gap: var(--_ba-g);
239
- line-height: var(--_ba-lh);
240
- min-width: var(--_ba-wmn);
241
- padding: var(--_ba-py) var(--_ba-px);
242
-
243
- align-items: center;
244
- border-radius: var(--br-sm);
245
- display: inline-flex;
246
- font-weight: normal;
247
- justify-content: center;
248
- text-decoration: none;
249
- vertical-align: middle;
250
- white-space: nowrap;
251
- }
1
+ .s-badge {
2
+ --_ba-as: unset;
3
+ --_ba-bc: var(--bc-medium);
4
+ --_ba-bg: var(--black-050);
5
+ --_ba-fc: var(--black-700);
6
+ --_ba-fs: var(--fs-caption);
7
+ --_ba-g: 0.3em;
8
+ --_ba-lh: 2;
9
+ --_ba-px: var(--su6);
10
+ --_ba-py: 0;
11
+ --_ba-wmn: 0;
12
+
13
+ // CONTEXTUAL STYLES
14
+ .highcontrast-mode({
15
+ // Badge counts
16
+ &&__gold,
17
+ &&__silver,
18
+ &&__bronze,
19
+ // Number counts
20
+ &&__rep,
21
+ &&__rep-down,
22
+ &&__votes:not(&__answered),
23
+ // Users
24
+ &&__admin,
25
+ &&__moderator,
26
+ &&__staff {
27
+ --_ba-bc: currentColor;
28
+ }
29
+ });
30
+
31
+ // MODIFIERS
32
+ // Sizes
33
+ &&__xs,
34
+ &&__sm {
35
+ --_ba-as: flex-start;
36
+ --_ba-fs: var(--fs-fine);
37
+ }
38
+
39
+ &&__xs {
40
+ --_ba-lh: 1.5;
41
+ --_ba-px: var(--su2);
42
+ --_ba-wmn: calc(var(--su-static16) + var(--su-static2));
43
+ }
44
+
45
+ &&__sm {
46
+ --_ba-lh: 1.8;
47
+ --_ba-px: var(--su4);
48
+ --_ba-wmn: calc(var(--su-static16) + var(--su-static2));
49
+ }
50
+
51
+ // Badge counts
52
+ &&__gold,
53
+ &&__silver,
54
+ &&__bronze {
55
+ --_ba-fc: var(--black-700);
56
+
57
+ .highcontrast-mode({
58
+ --_ba-fc: var(--black-900);
59
+ });
60
+ }
61
+
62
+ &&__gold {
63
+ --_ba-bc: var(--gold-darker);
64
+ --_ba-bg: var(--gold-lighter);
65
+ }
66
+
67
+ &&__silver {
68
+ --_ba-bc: var(--silver-darker);
69
+ --_ba-bg: var(--silver-lighter);
70
+ }
71
+
72
+ &&__bronze {
73
+ --_ba-bc: var(--bronze-darker);
74
+ --_ba-bg: var(--bronze-lighter);
75
+ }
76
+
77
+ // Number counts
78
+ &&__answered,
79
+ &&__bounty,
80
+ &&__important {
81
+ --_ba-bc: transparent;
82
+ --_ba-fc: var(--white);
83
+ }
84
+
85
+ &&__rep,
86
+ &&__rep-down,
87
+ &&__votes:not(&__answered) {
88
+ --_ba-bg: var(--white);
89
+ }
90
+
91
+ &&__answered {
92
+ --_ba-bg: var(--green-400);
93
+ }
94
+
95
+ &&__bounty {
96
+ --_ba-bg: var(--blue-600);
97
+ }
98
+
99
+ &&__important {
100
+ --_ba-bg: var(--red-600);
101
+ }
102
+
103
+ &&__rep {
104
+ --_ba-bc: var(--green-400);
105
+ --_ba-fc: var(--green-500);
106
+ }
107
+
108
+ &&__rep-down {
109
+ --_ba-bc: var(--red-400);
110
+ --_ba-fc: var(--red-500);
111
+ }
112
+
113
+ &&__votes:not(&__answered) {
114
+ --_ba-bc: var(--black-150);
115
+ --_ba-fc: var(--black-700);
116
+ }
117
+
118
+ // Users
119
+ &&__admin {
120
+ --_ba-bc: var(--theme-primary-200);
121
+ --_ba-bg: var(--theme-primary-075);
122
+ --_ba-fc: var(--theme-primary-800);
123
+ }
124
+
125
+ &&__moderator {
126
+ --_ba-bc: var(--theme-secondary-200);
127
+ --_ba-bg: var(--theme-secondary-075);
128
+ --_ba-fc: var(--theme-secondary-800);
129
+ --_ba-g: calc(var(--su-static4) - var(--su-static1)); // 3px
130
+ // :before icon
131
+ --_ba-before-h: calc(var(--su-static16) - var(--su-static2)); // 14px
132
+ --_ba-before-icon: url("data:image/svg+xml,%3Csvg width='12' height='14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.528.746c.257-.329.675-.327.93 0l4.42 5.66c.258.329.257.864 0 1.192l-4.42 5.66c-.256.328-.674.327-.93 0l-4.42-5.66c-.257-.329-.256-.865 0-1.192l4.42-5.66z' fill='%23fff'/%3E%3C/svg%3E");
133
+ --_ba-before-mt: calc(var(--su-static1) * -1); // -1px
134
+ --_ba-before-w: var(--su-static12);
135
+
136
+ // Sizes
137
+ &.s-badge__xs {
138
+ --_ba-before-h: calc(var(--su-static8) + var(--su-static1)); // 9px
139
+ --_ba-before-icon: url("data:image/svg+xml,%3Csvg width='7' height='9' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 .246c.3-.329.701-.327 1 0L6.776 4c.3.329.298.672 0 1L4 8.75c-.299.329-.702.327-1 0L.224 5c-.284-.324-.285-.675 0-1L3 .246z' fill='%23fff'/%3E%3C/svg%3E");
140
+ --_ba-before-mt: 0;
141
+ --_ba-before-w: calc(var(--su-static8) - var(--su-static1)); // 7px
142
+ }
143
+
144
+ &.s-badge__sm {
145
+ --_ba-g: var(--su-static2);
146
+ --_ba-before-h: calc(var(--su-static12) - var(--su-static1)); // 11px
147
+ --_ba-before-icon: url("data:image/svg+xml,%3Csvg width='9' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.55.246c.257-.329.647-.327.903 0l3.36 4.66c.256.329.256.864 0 1.192L4.45 10.75c-.257.329-.644.327-.9 0L.192 6.098c-.256-.329-.256-.865 0-1.192L3.55.246z' fill='%23fff'/%3E%3C/svg%3E");
148
+ --_ba-before-mt: 0;
149
+ --_ba-before-w: calc(var(--su-static8) + var(--su-static1)); // 9px
150
+ }
151
+
152
+ &:before {
153
+ height: var(--_ba-before-h);
154
+ margin-top: var(--_ba-before-mt);
155
+ width: var(--_ba-before-w);
156
+
157
+ content: "";
158
+ display: inline-block;
159
+ background-color: currentColor;
160
+ -webkit-mask: var(--_ba-before-icon) no-repeat center;
161
+ mask: var(--_ba-before-icon) no-repeat center;
162
+ -webkit-mask-size: contain;
163
+ mask-size: contain;
164
+ }
165
+ }
166
+
167
+ &&__staff {
168
+ // Staff badges are always "Stack Overflow Orange"
169
+ --_ba-bc: var(--orange-300);
170
+ --_ba-bg: var(--orange-100);
171
+ --_ba-fc: var(--orange-900);
172
+ }
173
+
174
+ // VARIANTS
175
+ &&__danger,
176
+ &&__muted {
177
+ &.s-badge__filled {
178
+ --_ba-bc: transparent;
179
+ }
180
+ }
181
+
182
+ &&__danger {
183
+ --_ba-bc: var(--red-600);
184
+ --_ba-bg: var(--red-100);
185
+ --_ba-fc: var(--red-900);
186
+
187
+ &.s-badge__filled {
188
+ --_ba-bg: var(--red-500);
189
+ --_ba-fc: @white;
190
+
191
+ .highcontrast-mode({
192
+ --_ba-fc: var(--white);
193
+ });
194
+ }
195
+ }
196
+ &&__info {
197
+ --_ba-bc: var(--blue-600);
198
+ --_ba-bg: var(--blue-100);
199
+ --_ba-fc: var(--blue-900);
200
+ }
201
+
202
+ &&__warning {
203
+ --_ba-bc: var(--yellow-600);
204
+ --_ba-bg: var(--yellow-100);
205
+ --_ba-fc: var(--yellow-900);
206
+ }
207
+
208
+ &&__muted {
209
+ --_ba-bc: var(--black-600);
210
+ --_ba-bg: var(--black-100);
211
+ --_ba-fc: var(--black-900);
212
+
213
+ &.s-badge__filled {
214
+ --_ba-bg: var(--black-700);
215
+ --_ba-fc: var(--white);
216
+ }
217
+ }
218
+
219
+ // CHILD ELEMENTS
220
+ &--image, // Included with no base class to account for usage in .s-progress__badge
221
+ & &--image {
222
+ align-self: center;
223
+ display: inline-flex;
224
+ margin-right: var(--su1);
225
+ margin-left: calc((var(--su4) + var(--su1)) * -1);
226
+ }
227
+
228
+ // INTERACTION
229
+ a&:hover {
230
+ text-decoration: none;
231
+ }
232
+
233
+ align-self: var(--_ba-as);
234
+ background-color: var(--_ba-bg);
235
+ border: var(--su-static1) solid var(--_ba-bc);
236
+ color: var(--_ba-fc);
237
+ font-size: var(--_ba-fs);
238
+ gap: var(--_ba-g);
239
+ line-height: var(--_ba-lh);
240
+ min-width: var(--_ba-wmn);
241
+ padding: var(--_ba-py) var(--_ba-px);
242
+
243
+ align-items: center;
244
+ border-radius: var(--br-sm);
245
+ display: inline-flex;
246
+ font-weight: normal;
247
+ justify-content: center;
248
+ text-decoration: none;
249
+ vertical-align: middle;
250
+ white-space: nowrap;
251
+ }
@@ -0,0 +1,37 @@
1
+ import { runComponentTests } from "../../test/test-utils";
2
+ import "../../index";
3
+
4
+ const bannerChild = `
5
+ <div
6
+ class="d-flex flex__center jc-space-between s-banner--container"
7
+ role="alertdialog"
8
+ aria-labelledby="banner-title"
9
+ aria-describedby="banner-description"
10
+ >
11
+ <div aria-label="banner message">
12
+ <h2 id="banner-title">Banner heading</h2>
13
+ <p id="banner-description">Banner description</p>
14
+ </div>
15
+ <div class="ml-auto myn8">
16
+ <span class="s-btn s-banner--btn">Close</span>
17
+ </div>
18
+ </div>
19
+ `;
20
+
21
+ describe("banner", () => {
22
+ runComponentTests({
23
+ type: "a11y",
24
+ baseClass: "s-banner",
25
+ variants: ["info", "success", "warning", "danger"],
26
+ modifiers: {
27
+ primary: ["important"],
28
+ },
29
+ attributes: {
30
+ role: "alert",
31
+ ariaHidden: "false",
32
+ },
33
+ children: {
34
+ default: bannerChild,
35
+ },
36
+ });
37
+ });
@@ -1,51 +1,51 @@
1
- // See also ./lib/components/notice/notice.less
2
- // TODO deprecate .s-banner (by turning it into a modifier on .s-notice)
3
- // This would reduce the amount of CSS we ship to the client and simplify our codebase
4
- .s-banner {
5
- --_no-x-offset: 0; // [1]
6
- .construct-notice-component(s-banner);
7
-
8
- &[aria-hidden="true"] { // If you want to hide and reveal the banner
9
- --_no-x-offset: calc(var(--su48) + var(--su2) * -1); // -50px
10
- opacity: 0;
11
- visibility: hidden;
12
- }
13
-
14
- &[aria-hidden="false"] {
15
- --_no-x-offset: calc(var(--su48) + var(--su1)); // 49px
16
- opacity: 1;
17
- visibility: visible;
18
- }
19
-
20
- &.is-pinned { // If you want to put the banner above the topbar
21
- z-index: calc(var(--zi-navigation-fixed) + 1);
22
- }
23
-
24
- &__body-pt {
25
- padding-top: 93px;
26
- }
27
-
28
- & &--container { // When we want to keep hero content capped
29
- margin: 0 auto;
30
- max-width: calc(var(--s-step) * 10);
31
- position: relative;
32
- width: 100%;
33
- }
34
-
35
- border-width: var(--su-static1) 0;
36
- inset: 0 0 auto 0;
37
- padding: var(--su12);
38
- position: fixed;
39
- -webkit-transform: translate3d(0, var(--_no-x-offset), 0);
40
- transform: translate3d(0, var(--_no-x-offset), 0);
41
- width: 100%;
42
- z-index: calc(var(--zi-navigation-fixed) - 1); // Tuck below topbar
43
- }
44
-
45
- // [1] When we use .s-banner, we need to adjust the padding-top on
46
- // the body tag. This class correctly adjusts the body padding ONLY if
47
- // the notice is one line. If it wraps to multiple lines, more classes or
48
- // (ideally) JS will need to be used to determine the notice's height
49
- // at the time of render. The padding value is determined like so:
50
- // 50px (top bar) + 44px (notice height) - 1px (bottom border)
51
- // The borders subtraction are necessary to neatly tuck everything together.
1
+ // See also ./lib/components/notice/notice.less
2
+ // TODO deprecate .s-banner (by turning it into a modifier on .s-notice)
3
+ // This would reduce the amount of CSS we ship to the client and simplify our codebase
4
+ .s-banner {
5
+ --_no-x-offset: 0; // [1]
6
+ .construct-notice-component(s-banner);
7
+
8
+ &[aria-hidden="true"] { // If you want to hide and reveal the banner
9
+ --_no-x-offset: calc(var(--su48) + var(--su2) * -1); // -50px
10
+ opacity: 0;
11
+ visibility: hidden;
12
+ }
13
+
14
+ &[aria-hidden="false"] {
15
+ --_no-x-offset: calc(var(--su48) + var(--su1)); // 49px
16
+ opacity: 1;
17
+ visibility: visible;
18
+ }
19
+
20
+ &.is-pinned { // If you want to put the banner above the topbar
21
+ z-index: calc(var(--zi-navigation-fixed) + 1);
22
+ }
23
+
24
+ &__body-pt {
25
+ padding-top: 93px;
26
+ }
27
+
28
+ & &--container { // When we want to keep hero content capped
29
+ margin: 0 auto;
30
+ max-width: calc(var(--s-step) * 10);
31
+ position: relative;
32
+ width: 100%;
33
+ }
34
+
35
+ border-width: var(--su-static1) 0;
36
+ inset: 0 0 auto 0;
37
+ padding: var(--su12);
38
+ position: fixed;
39
+ -webkit-transform: translate3d(0, var(--_no-x-offset), 0);
40
+ transform: translate3d(0, var(--_no-x-offset), 0);
41
+ width: 100%;
42
+ z-index: calc(var(--zi-navigation-fixed) - 1); // Tuck below topbar
43
+ }
44
+
45
+ // [1] When we use .s-banner, we need to adjust the padding-top on
46
+ // the body tag. This class correctly adjusts the body padding ONLY if
47
+ // the notice is one line. If it wraps to multiple lines, more classes or
48
+ // (ideally) JS will need to be used to determine the notice's height
49
+ // at the time of render. The padding value is determined like so:
50
+ // 50px (top bar) + 44px (notice height) - 1px (bottom border)
51
+ // The borders subtraction are necessary to neatly tuck everything together.