@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.
- package/README.md +161 -153
- package/dist/components/table/table.d.ts +26 -4
- package/dist/css/stacks.css +21 -6
- package/dist/css/stacks.min.css +1 -1
- package/dist/js/stacks.js +93 -64
- package/dist/js/stacks.min.js +1 -1
- package/lib/atomic/border.less +397 -397
- package/lib/atomic/color.less +210 -210
- package/lib/atomic/flex.less +426 -426
- package/lib/atomic/gap.less +44 -44
- package/lib/atomic/grid.less +139 -139
- package/lib/atomic/misc.less +343 -343
- package/lib/atomic/spacing.less +342 -342
- package/lib/atomic/typography.less +267 -267
- package/lib/atomic/width-height.less +194 -194
- package/lib/base/body.less +44 -44
- package/lib/base/configuration-static.less +61 -61
- package/lib/base/fieldset.less +5 -5
- package/lib/base/icon.less +11 -11
- package/lib/base/internal.less +220 -220
- package/lib/base/reset-meyer.less +64 -64
- package/lib/base/reset-normalize.less +449 -449
- package/lib/base/reset.less +20 -20
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +21 -21
- package/lib/components/activity-indicator/activity-indicator.less +40 -40
- package/lib/components/activity-indicator/activity-indicator.visual.test.ts +23 -23
- package/lib/components/anchor/anchor.less +61 -61
- package/lib/components/avatar/avatar.a11y.test.ts +36 -36
- package/lib/components/avatar/avatar.less +108 -108
- package/lib/components/avatar/avatar.visual.test.ts +54 -54
- package/lib/components/award-bling/award-bling.a11y.test.ts +17 -0
- package/lib/components/award-bling/award-bling.less +31 -31
- package/lib/components/award-bling/award-bling.visual.test.ts +26 -0
- package/lib/components/badge/badge.less +251 -251
- package/lib/components/banner/banner.a11y.test.ts +37 -0
- package/lib/components/banner/banner.less +51 -51
- package/lib/components/banner/banner.test.ts +73 -77
- package/lib/components/banner/banner.ts +149 -149
- package/lib/components/banner/banner.visual.test.ts +37 -36
- package/lib/components/block-link/block-link.a11y.test.ts +68 -0
- package/lib/components/block-link/block-link.less +80 -80
- package/lib/components/block-link/block-link.visual.test.ts +61 -0
- package/lib/components/breadcrumbs/breadcrumbs.a11y.test.ts +37 -0
- package/lib/components/breadcrumbs/breadcrumbs.less +41 -41
- package/lib/components/breadcrumbs/breadcrumbs.visual.test.ts +37 -0
- package/lib/components/button/button.a11y.test.ts +32 -32
- package/lib/components/button/button.less +502 -502
- package/lib/components/button/button.visual.test.ts +52 -52
- package/lib/components/button-group/button-group.less +83 -83
- package/lib/components/card/card.a11y.test.ts +13 -0
- package/lib/components/card/card.less +29 -29
- package/lib/components/card/card.visual.test.ts +54 -0
- package/lib/components/check-control/check-control.less +17 -17
- package/lib/components/check-group/check-group.less +19 -19
- package/lib/components/checkbox_radio/checkbox_radio.less +158 -158
- package/lib/components/code-block/code-block.less +116 -116
- package/lib/components/description/description.less +9 -9
- package/lib/components/empty-state/empty-state.less +16 -16
- package/lib/components/expandable/expandable.less +118 -118
- package/lib/components/expandable/expandable.test.ts +51 -53
- package/lib/components/expandable/expandable.ts +238 -238
- package/lib/components/input-fill/input-fill.less +35 -35
- package/lib/components/input-icon/input-icon.less +45 -45
- package/lib/components/input-message/input-message.less +48 -48
- package/lib/components/input_textarea/input_textarea.less +166 -166
- package/lib/components/label/label.less +111 -111
- package/lib/components/link/link.less +119 -119
- package/lib/components/link-preview/link-preview.less +139 -139
- package/lib/components/menu/menu.less +41 -41
- package/lib/components/modal/modal.less +113 -113
- package/lib/components/modal/modal.ts +379 -379
- package/lib/components/navigation/navigation.less +134 -134
- package/lib/components/navigation/navigation.ts +128 -128
- package/lib/components/notice/notice.less +203 -203
- package/lib/components/page-title/page-title.less +51 -51
- package/lib/components/pagination/pagination.less +52 -52
- package/lib/components/popover/popover.less +148 -148
- package/lib/components/popover/popover.ts +651 -651
- package/lib/components/popover/tooltip.test.ts +62 -66
- package/lib/components/popover/tooltip.ts +343 -343
- package/lib/components/popover/tooltip.visual.test.ts +31 -31
- package/lib/components/post-summary/post-summary.less +415 -415
- package/lib/components/progress-bar/progress-bar.less +291 -291
- package/lib/components/prose/prose.less +452 -452
- package/lib/components/select/select.less +148 -148
- package/lib/components/sidebar-widget/sidebar-widget.less +257 -258
- package/lib/components/spinner/spinner.less +103 -103
- package/lib/components/table/table.less +307 -292
- package/lib/components/table/table.test.ts +366 -0
- package/lib/components/table/table.ts +296 -263
- package/lib/components/table-container/table-container.less +4 -4
- package/lib/components/tag/tag.less +213 -213
- package/lib/components/toast/toast.less +35 -35
- package/lib/components/toast/toast.test.ts +63 -67
- package/lib/components/toast/toast.ts +357 -357
- package/lib/components/toast/toast.visual.test.ts +27 -27
- package/lib/components/toggle-switch/toggle-switch.less +110 -110
- package/lib/components/topbar/topbar.less +436 -435
- package/lib/components/uploader/uploader.less +195 -195
- package/lib/components/uploader/uploader.ts +205 -205
- package/lib/components/user-card/user-card.less +129 -129
- package/lib/controllers.ts +33 -33
- package/lib/exports/constants-colors.less +1112 -1111
- package/lib/exports/constants-helpers.less +108 -108
- package/lib/exports/constants-type.less +153 -153
- package/lib/exports/exports.less +15 -15
- package/lib/exports/mixins.less +299 -299
- package/lib/index.ts +32 -32
- package/lib/input-utils.less +44 -44
- package/lib/stacks-dynamic.less +24 -24
- package/lib/stacks-static.less +93 -93
- package/lib/stacks.less +13 -13
- package/lib/stacks.ts +113 -113
- package/lib/test/open-wc-testing-patch.d.ts +26 -0
- package/lib/test/test-utils.ts +466 -444
- package/lib/tsconfig.build.json +4 -0
- package/lib/tsconfig.json +16 -13
- package/package.json +106 -105
- package/dist/components/activity-indicator/activity-indicator.a11y.test.d.ts +0 -1
- package/dist/components/activity-indicator/activity-indicator.visual.test.d.ts +0 -1
- package/dist/components/avatar/avatar.a11y.test.d.ts +0 -1
- package/dist/components/avatar/avatar.visual.test.d.ts +0 -1
- package/dist/components/banner/banner.test.d.ts +0 -1
- package/dist/components/banner/banner.visual.test.d.ts +0 -1
- package/dist/components/button/button.a11y.test.d.ts +0 -1
- package/dist/components/button/button.visual.test.d.ts +0 -1
- package/dist/components/expandable/expandable.test.d.ts +0 -1
- package/dist/components/popover/tooltip.test.d.ts +0 -1
- package/dist/components/popover/tooltip.visual.test.d.ts +0 -1
- package/dist/components/toast/toast.test.d.ts +0 -1
- package/dist/components/toast/toast.visual.test.d.ts +0 -1
- 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.
|