@stackoverflow/stacks 1.3.6 → 1.4.0

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.
@@ -1,256 +1,225 @@
1
- //
2
- // STACK OVERFLOW
3
- // BADGES
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
- // TABLE OF CONTENTS
10
- // • BASE STYLE
11
- // • STYLE VARIATIONS
12
- // • LAYOUTS & SIZES
13
- //
14
- // ===========================================================================
15
- // $ MIXIN
16
- // Any badge we use will always modify the same items, so to save time,
17
- // here's a mixin to state all that CSS.
18
- // ---------------------------------------------------------------------------
19
- .badge-styles(@border: transparent, @background: transparent, @color: inherit) {
20
- border-color: @border;
21
- background-color: @background;
22
- color: @color;
23
- }
24
-
25
- // ===========================================================================
26
- // $ BASE STYLE
27
- // The same style is applied to all badges. Do not modify the core style.
28
- // ---------------------------------------------------------------------------
29
1
  .s-badge {
30
- display: inline-flex;
31
- align-items: center;
32
- justify-content: center;
33
- min-width: 0;
34
- padding: 0 var(--su6);
35
- border-width: 1px;
36
- border-style: solid;
37
- border-radius: var(--br-sm);
38
- font-size: var(--fs-caption);
39
- font-weight: normal;
40
- line-height: 2;
41
- text-decoration: none;
42
- vertical-align: middle;
43
- white-space: nowrap;
44
-
45
- .badge-styles(var(--bc-medium), var(--black-050), var(--black-700));
46
-
47
- a&:hover {
48
- text-decoration: none;
49
- }
50
- }
51
-
52
- // $ BADGE IMAGE
53
- // When we have a badge image
54
- // ---------------------------------------------------------------------------
55
- .s-badge--image {
56
- display: inline-flex;
57
- align-self: center;
58
- margin-right: var(--su1);
59
- margin-left: calc((var(--su4) + var(--su1)) * -1);
60
- }
61
-
62
- // $ BADGE ICON
63
- // When we have a badge icon
64
- // ---------------------------------------------------------------------------
65
- .s-badge__icon {
66
- gap: 0.3em;
67
- }
68
-
69
- // $ BADGE SIZES
70
- // ---------------------------------------------------------------------------
71
- .s-badge__sm {
72
- min-width: 18px;
73
- align-self: flex-start;
74
- padding-right: var(--su4);
75
- padding-left: var(--su4);
76
- font-size: var(--fs-fine);
77
- line-height: 1.8;
78
- }
79
-
80
- .s-badge__xs {
81
- align-self: flex-start;
82
- padding-right: var(--su2);
83
- padding-left: var(--su2);
84
- font-size: var(--fs-fine);
85
- line-height: 1.5;
86
- }
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;
87
12
 
88
- // $$ Badge Counts
89
- // ---------------------------------------------------------------------------
90
- .s-badge__gold {
91
- .badge-styles(var(--gold-darker), var(--gold-lighter), var(--black-700));
92
- }
93
- .s-badge__silver {
94
- .badge-styles(var(--silver-darker), var(--silver-lighter), var(--black-700));
95
- }
96
- .s-badge__bronze {
97
- .badge-styles(var(--bronze-darker), var(--bronze-lighter), var(--black-700));
98
- }
99
- .s-badge__gold,
100
- .s-badge__silver,
101
- .s-badge__bronze {
102
13
  .highcontrast-mode({
103
- border-color: currentColor;
104
- color: var(--black-900);
14
+ // Badge counts
15
+ &__gold,
16
+ &__silver,
17
+ &__bronze,
18
+ // Number counts
19
+ &__rep,
20
+ &__rep-down,
21
+ &__votes,
22
+ // Users
23
+ &__admin,
24
+ &__moderator,
25
+ &__staff {
26
+ --_ba-bc: currentColor;
27
+ }
105
28
  });
106
- }
107
-
108
- // $$ Number Counts
109
- // ---------------------------------------------------------------------------
110
- .s-badge__bounty {
111
- .badge-styles(transparent, var(--blue-600), var(--white));
112
- }
113
- .s-badge__votes {
114
- .badge-styles(var(--black-150), var(--white), var(--black-700));
115
-
116
- .highcontrast-mode({ border-color: currentColor; });
117
- }
118
- .s-badge__answered {
119
- .badge-styles(transparent, var(--green-400), var(--white));
120
- }
121
- .s-badge__rep {
122
- .badge-styles(var(--green-400), var(--white), var(--green-500));
123
- .highcontrast-mode({ border-color: currentColor; });
124
- }
125
- .s-badge__rep-down {
126
- .badge-styles(var(--red-400), var(--white), var(--red-500));
127
- .highcontrast-mode({ border-color: currentColor; });
128
- }
129
- .s-badge__important {
130
- .badge-styles(transparent, var(--red-600), var(--white));
131
- }
132
-
133
- // $$ Users
134
- // ---------------------------------------------------------------------------
135
- .s-badge__admin {
136
- .badge-styles(var(--theme-primary-200), var(--theme-primary-075), var(--theme-primary-800));
137
- .highcontrast-mode({ border-color: currentColor; });
138
- }
139
- .s-badge__moderator {
140
- .badge-styles(var(--theme-secondary-200), var(--theme-secondary-075), var(--theme-secondary-800));
141
- .highcontrast-mode({ border-color: currentColor; });
142
-
143
- &:before {
144
- --s-badge-moderator-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");
145
-
146
- content: "";
147
- display: inline-block;
148
- background-color: currentColor;
149
- -webkit-mask: var(--s-badge-moderator-icon) no-repeat center;
150
- mask: var(--s-badge-moderator-icon) no-repeat center;
151
- -webkit-mask-size: contain;
152
- mask-size: contain;
153
29
 
154
- width: 12px;
155
- height: 14px;
156
- margin-top: -1px;
157
- margin-right: 3px;
30
+ // MODIFIERS
31
+ // Sizes
32
+ &&__xs,
33
+ &&__sm {
34
+ --_ba-as: flex-start;
35
+ --_ba-fs: var(--fs-fine);
158
36
  }
159
-
160
- &.s-badge__sm:before {
161
- --s-badge-moderator-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");
162
-
163
- width: 9px;
164
- height: 11px;
165
- margin-top: 0;
166
- margin-right: 2px;
37
+ &&__xs {
38
+ --_ba-lh: 1.5;
39
+ --_ba-px: var(--su2);
40
+ --_ba-wmn: calc(var(--su-static16) + var(--su-static2));
167
41
  }
168
-
169
- &.s-badge__xs:before {
170
- --s-badge-moderator-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");
171
-
172
- width: 7px;
173
- height: 9px;
174
- margin-top: 0;
42
+ &&__sm {
43
+ --_ba-lh: 1.8;
44
+ --_ba-px: var(--su4);
45
+ --_ba-wmn: calc(var(--su-static16) + var(--su-static2));
175
46
  }
176
- }
177
47
 
178
- .s-badge__staff {
179
- // Staff badges are always "Stack Overflow Orange"
180
- .badge-styles(var(--orange-300), var(--orange-100), var(--orange-900));
181
- .highcontrast-mode({ border-color: currentColor; });
182
- }
48
+ // Badge counts
49
+ &&__gold,
50
+ &&__silver,
51
+ &&__bronze {
52
+ --_ba-fc: var(--black-700);
183
53
 
184
- // $$ States
185
- // ---------------------------------------------------------------------------
186
- &.s-badge__danger {
187
- color: var(--red-900);
188
- background-color: var(--red-100);
189
- border-color: var(--red-600);
190
-
191
- &.s-badge__filled {
192
- color: @white;
193
- background-color: var(--red-500);
194
- border-color: transparent;
195
-
196
- .highcontrast-mode({ color: var(--white); });
54
+ .highcontrast-mode({ --_ba-fc: var(--black-900); });
197
55
  }
198
- }
199
-
200
- &.s-badge__info {
201
- color: var(--blue-900);
202
- background-color: var(--blue-100);
203
- border-color: var(--blue-600);
204
- }
205
-
206
- &.s-badge__warning {
207
- color: var(--yellow-900);
208
- background-color: var(--yellow-100);
209
- border-color: var(--yellow-600);
210
- }
211
-
212
- &.s-badge__muted {
213
- color: var(--black-900);
214
- background-color: var(--black-100);
215
- border-color: var(--black-600);
216
-
217
- &.s-badge__filled {
218
- color: var(--white);
219
- background-color: var(--black-700);
220
- border-color: transparent;
56
+ &&__gold {
57
+ --_ba-bc: var(--gold-darker);
58
+ --_ba-bg: var(--gold-lighter);
59
+ }
60
+ &&__silver {
61
+ --_ba-bc: var(--silver-darker);
62
+ --_ba-bg: var(--silver-lighter);
63
+ }
64
+ &&__bronze {
65
+ --_ba-bc: var(--bronze-darker);
66
+ --_ba-bg: var(--bronze-lighter);
221
67
  }
222
- }
223
68
 
224
- // $$ Award Count
225
- // ---------------------------------------------------------------------------
226
- .s-award-bling {
227
- display: flex;
228
- align-items: center;
229
- color: inherit;
69
+ // Number counts
70
+ &&__answered,
71
+ &&__bounty,
72
+ &&__important {
73
+ --_ba-bc: transparent;
74
+ --_ba-fc: var(--white);
75
+ }
76
+ &&__rep,
77
+ &&__rep-down,
78
+ &&__votes {
79
+ --_ba-bg: var(--white);
80
+ }
81
+ &&__answered {
82
+ --_ba-bg: var(--green-400);
83
+ }
84
+ &&__bounty {
85
+ --_ba-bg: var(--blue-600);
86
+ }
87
+ &&__important {
88
+ --_ba-bg: var(--red-600);
89
+ }
90
+ &&__rep {
91
+ --_ba-bc: var(--green-400);
92
+ --_ba-fc: var(--green-500);
93
+ }
94
+ &&__rep-down {
95
+ --_ba-bc: var(--red-400);
96
+ --_ba-fc: var(--red-500);
97
+ }
98
+ &&__votes {
99
+ --_ba-bc: var(--black-150);
100
+ --_ba-fc: var(--black-700);
101
+ }
230
102
 
231
- &:before {
232
- content: "";
233
- margin-right: 4px;
234
- width: 8px;
235
- height: 8px;
236
- border-radius: 100%;
103
+ // Users
104
+ &&__admin {
105
+ --_ba-bc: var(--theme-primary-200);
106
+ --_ba-bg: var(--theme-primary-075);
107
+ --_ba-fc: var(--theme-primary-800);
237
108
  }
109
+ &&__moderator {
110
+ --_ba-bc: var(--theme-secondary-200);
111
+ --_ba-bg: var(--theme-secondary-075);
112
+ --_ba-fc: var(--theme-secondary-800);
113
+ --_ba-g: calc(var(--su-static4) - var(--su-static1)); // 3px
114
+ // :before icon
115
+ --_ba-before-h: calc(var(--su-static16) - var(--su-static2)); // 14px
116
+ --_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");
117
+ --_ba-before-mt: calc(var(--su-static1) * -1); // -1px
118
+ --_ba-before-w: var(--su-static12);
119
+
120
+ // Sizes
121
+ &.s-badge__xs {
122
+ --_ba-before-h: calc(var(--su-static8) + var(--su-static1)); // 9px
123
+ --_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");
124
+ --_ba-before-mt: 0;
125
+ --_ba-before-w: calc(var(--su-static8) - var(--su-static1)); // 7px
126
+ }
127
+ &.s-badge__sm {
128
+ --_ba-g: var(--su-static2);
129
+ --_ba-before-h: calc(var(--su-static12) - var(--su-static1)); // 11px
130
+ --_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");
131
+ --_ba-before-mt: 0;
132
+ --_ba-before-w: calc(var(--su-static8) + var(--su-static1)); // 9px
133
+ }
238
134
 
239
- &.s-award-bling__gold {
240
135
  &:before {
241
- background-color: var(--gold);
136
+ height: var(--_ba-before-h);
137
+ margin-top: var(--_ba-before-mt);
138
+ width: var(--_ba-before-w);
139
+
140
+ content: "";
141
+ display: inline-block;
142
+ background-color: currentColor;
143
+ -webkit-mask: var(--_ba-before-icon) no-repeat center;
144
+ mask: var(--_ba-before-icon) no-repeat center;
145
+ -webkit-mask-size: contain;
146
+ mask-size: contain;
242
147
  }
243
148
  }
149
+ &&__staff {
150
+ // Staff badges are always "Stack Overflow Orange"
151
+ --_ba-bc: var(--orange-300);
152
+ --_ba-bg: var(--orange-100);
153
+ --_ba-fc: var(--orange-900);
154
+ }
244
155
 
245
- &.s-award-bling__silver {
246
- &:before {
247
- background-color: var(--silver);
156
+ // VARIANTS
157
+ &&__danger,
158
+ &&__muted {
159
+ &.s-badge__filled {
160
+ --_ba-bc: transparent;
248
161
  }
249
162
  }
163
+ &&__danger {
164
+ --_ba-bc: var(--red-600);
165
+ --_ba-bg: var(--red-100);
166
+ --_ba-fc: var(--red-900);
250
167
 
251
- &.s-award-bling__bronze {
252
- &:before {
253
- background-color: var(--bronze);
168
+ &.s-badge__filled {
169
+ --_ba-bg: var(--red-500);
170
+ --_ba-fc: @white;
171
+
172
+ .highcontrast-mode({ --_ba-fc: var(--white); });
173
+ }
174
+ }
175
+ &&__info {
176
+ --_ba-bc: var(--blue-600);
177
+ --_ba-bg: var(--blue-100);
178
+ --_ba-fc: var(--blue-900);
179
+ }
180
+ &&__warning {
181
+ --_ba-bc: var(--yellow-600);
182
+ --_ba-bg: var(--yellow-100);
183
+ --_ba-fc: var(--yellow-900);
184
+ }
185
+ &&__muted {
186
+ --_ba-bc: var(--black-600);
187
+ --_ba-bg: var(--black-100);
188
+ --_ba-fc: var(--black-900);
189
+
190
+ &.s-badge__filled {
191
+ --_ba-bg: var(--black-700);
192
+ --_ba-fc: var(--white);
254
193
  }
255
194
  }
195
+
196
+ & &--image {
197
+ display: inline-flex;
198
+ align-self: center;
199
+ margin-right: var(--su1);
200
+ margin-left: calc((var(--su4) + var(--su1)) * -1);
201
+ }
202
+
203
+ a&:hover {
204
+ text-decoration: none;
205
+ }
206
+
207
+ align-self: var(--_ba-as);
208
+ background-color: var(--_ba-bg);
209
+ border: var(--su-static1) solid var(--_ba-bc);
210
+ color: var(--_ba-fc);
211
+ font-size: var(--_ba-fs);
212
+ gap: var(--_ba-g);
213
+ line-height: var(--_ba-lh);
214
+ min-width: var(--_ba-wmn);
215
+ padding: var(--_ba-py) var(--_ba-px);
216
+
217
+ align-items: center;
218
+ border-radius: var(--br-sm);
219
+ display: inline-flex;
220
+ font-weight: normal;
221
+ justify-content: center;
222
+ text-decoration: none;
223
+ vertical-align: middle;
224
+ white-space: nowrap;
256
225
  }
@@ -1,44 +1,37 @@
1
- //
2
- // STACK OVERFLOW
3
- // BREADCRUMBS
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
-
10
1
  .s-breadcrumbs {
11
- display: flex;
12
- flex-wrap: wrap;
13
- align-items: start;
14
- color: var(--black-200);
15
- font-size: var(--fs-caption);
2
+ --_br-divider-px: var(--su4);
3
+ --_br-link-fc: var(--fc-light);
16
4
 
17
- .s-breadcrumbs--item {
5
+ // CONTEXTUAL STYLES
6
+ #stacks-internals #screen-sm({
7
+ --_br-divider-px: var(--su2);
8
+ });
9
+
10
+ // CHILD ELEMENTS
11
+ & &--item {
12
+ align-items: center;
18
13
  display: flex;
19
14
  flex-wrap: nowrap;
20
- align-items: center;
21
- margin-top: var(--su2);
22
15
  margin-bottom: var(--su2);
16
+ margin-top: var(--su2);
23
17
  }
24
-
25
- .s-breadcrumbs--divider {
26
- margin-right: var(--su4);
27
- margin-left: var(--su4);
28
-
18
+ & &--divider {
29
19
  .highcontrast-mode({ color: var(--fc-light); });
30
20
 
31
- #stacks-internals #screen-sm({
32
- margin-right: var(--su2);
33
- margin-left: var(--su2);
34
- });
21
+ margin-left: var(--_br-divider-px);
22
+ margin-right: var(--_br-divider-px);
35
23
  }
36
-
37
- .s-breadcrumbs--link {
38
- color: var(--fc-light);
24
+ & &--link {
25
+ color: var(--_br-link-fc);
39
26
 
40
27
  &:hover {
41
- color: var(--fc-medium);
28
+ --_br-link-fc: var(--fc-medium);
42
29
  }
43
30
  }
31
+
32
+ align-items: flex-start;
33
+ color: var(--black-200);
34
+ display: flex;
35
+ flex-wrap: wrap;
36
+ font-size: var(--fs-caption);
44
37
  }
@@ -73,7 +73,8 @@
73
73
  box-shadow: 0 0 0 var(--su-static4) var(--focus-ring);
74
74
  }
75
75
 
76
- &[disabled] {
76
+ &[disabled],
77
+ &[aria-disabled="true"] {
77
78
  opacity: var(--_o-disabled-static);
78
79
  pointer-events: none;
79
80
  box-shadow: none !important;
@@ -600,7 +601,8 @@
600
601
  &:hover,
601
602
  &:active,
602
603
  &:focus,
603
- &[disabled] {
604
+ &[disabled]
605
+ &[aria-disabled="true"] {
604
606
  background: none;
605
607
  box-shadow: none;
606
608
  }
@@ -1,44 +1,26 @@
1
- //
2
- // STACK OVERFLOW
3
- // CARDS
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
- // TABLE OF CONTENTS
10
- // • BASE STYLE
11
- // • MODIFIERS
12
- //
13
- // ============================================================================
14
- // $ BASE STYLE
15
- // ----------------------------------------------------------------------------
16
1
  .s-card {
17
- padding: var(--su12);
18
- border: 1px solid var(--bc-medium);
19
- border-radius: var(--br-sm);
20
- background-color: var(--white);
2
+ --_ca-bc: var(--bc-medium);
21
3
 
22
- p:last-of-type {
23
- margin-bottom: 0;
4
+ a& {
5
+ text-decoration: none !important;
24
6
  }
25
- }
7
+ &&__muted {
8
+ --_ca-bc: var(--bc-light);
26
9
 
27
- // ============================================================================
28
- // $ MODIFIERS
29
- // ----------------------------------------------------------------------------
30
- .s-card__muted {
31
- border-color: var(--bc-light);
10
+ // Dim only the first child card content
11
+ > * {
12
+ opacity: 0.65;
13
+ }
14
+ }
32
15
 
33
- // Dim only the first child card content
34
- > * {
35
- opacity: 0.65;
16
+ // CHILD ELEMENTS
17
+ p:last-of-type {
18
+ margin-bottom: 0;
36
19
  }
37
- }
38
20
 
39
- // ============================================================================
40
- // $ LINKED CARDS
41
- // ----------------------------------------------------------------------------
42
- a.s-card {
43
- text-decoration: none !important;
21
+ border: 1px solid var(--_ca-bc);
22
+
23
+ background-color: var(--white);
24
+ border-radius: var(--br-sm);
25
+ padding: var(--su12);
44
26
  }