@stackoverflow/stacks 1.4.2 → 1.6.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.
- package/dist/css/stacks.css +3565 -2093
- package/dist/css/stacks.min.css +1 -1
- package/lib/css/atomic/colors.less +1 -1
- package/lib/css/atomic/flex.less +53 -2
- package/lib/css/components/activity-indicator.less +3 -3
- package/lib/css/components/badges.less +11 -11
- package/lib/css/components/button-groups.less +59 -83
- package/lib/css/components/buttons.less +384 -585
- package/lib/css/components/code-blocks.less +98 -125
- package/lib/css/components/expandable.less +69 -59
- package/lib/css/components/inputs.less +38 -24
- package/lib/css/components/link-previews.less +110 -122
- package/lib/css/components/links.less +0 -16
- package/lib/css/components/modals.less +95 -120
- package/lib/css/components/notices.less +187 -180
- package/lib/css/components/popovers.less +132 -181
- package/lib/css/components/post-summary.less +0 -9
- package/lib/css/components/progress-bars.less +236 -297
- package/lib/css/components/prose.less +293 -380
- package/lib/css/components/sidebar-widgets.less +251 -0
- package/lib/css/components/spinner.less +54 -104
- package/lib/css/components/tables.less +0 -24
- package/lib/css/components/toggle-switches.less +69 -120
- package/lib/css/components/topbar.less +10 -11
- package/lib/css/components/user-cards.less +91 -144
- package/lib/css/stacks-dynamic.less +0 -1
- package/lib/css/stacks-static.less +1 -1
- package/package.json +11 -11
- package/lib/css/components/_styles-template.less +0 -78
- package/lib/css/components/widget-dynamic.less +0 -33
- package/lib/css/components/widget-static.less +0 -274
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
.s-sidebarwidget {
|
|
2
|
+
// CONSTANTS
|
|
3
|
+
--_sw-content-px: calc(var(--su16) - var(--su1)); // subtract 1px for border
|
|
4
|
+
--_sw-content-spacing-inner: var(--su12); // the spacing between two adjacent simple items
|
|
5
|
+
--_sw-content-spacing-outer: var(--su16); // the spacing at the start/end of a group of simple items, as well as between a complex item and its separator line
|
|
6
|
+
|
|
7
|
+
// VARIABLES
|
|
8
|
+
--_sw-bc: var(--bc-medium);
|
|
9
|
+
--_sw-after-bc: var(--_sw-bc);
|
|
10
|
+
--_sw-content-bc: var(--bc-light);
|
|
11
|
+
--_sw-header-bc: var(--_sw-content-bc);
|
|
12
|
+
|
|
13
|
+
// VARIANTS
|
|
14
|
+
.alternate-color(blue);
|
|
15
|
+
.alternate-color(yellow);
|
|
16
|
+
.alternate-color(green);
|
|
17
|
+
|
|
18
|
+
// CHILD ELEMENTS
|
|
19
|
+
& &--action {
|
|
20
|
+
color: var(--blue);
|
|
21
|
+
float: right;
|
|
22
|
+
font-size: var(--fs-fine);
|
|
23
|
+
line-height: calc(var(--fs-body1) * 1.5); // 19.5px - line-height should be the same as in the outside element, so the header and action baselines line up
|
|
24
|
+
margin: 0 0 var(--su4) var(--su8);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
& &--content {
|
|
28
|
+
&.s-sidebarwidget__items {
|
|
29
|
+
&,
|
|
30
|
+
&.s-sidebarwidget__block-items .s-sidebarwidget--item {
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
padding: calc(var(--_sw-content-spacing-outer) - var(--_sw-content-spacing-inner)) var(--_sw-content-px); // the items themselves provide part of the spacing, so the content padding needs to account for that
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:active {
|
|
38
|
+
outline: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:not(table) {
|
|
42
|
+
&:not(.s-sidebarwidget__items),
|
|
43
|
+
&:not(.s-sidebarwidget__block-items) .s-sidebarwidget--item {
|
|
44
|
+
display: flex;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
border-top: var(--su-static1) solid var(--_sw-content-bc);
|
|
49
|
+
margin: 0;
|
|
50
|
+
padding: var(--_sw-content-spacing-outer) var(--_sw-content-px);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
& &--header {
|
|
54
|
+
&.s-sidebarwidget__expanding-control {
|
|
55
|
+
&:before {
|
|
56
|
+
border: calc(var(--su-static4) + var(--su-static1)) solid transparent;
|
|
57
|
+
border-left-color: var(--bc-darker);
|
|
58
|
+
border-right-width: 0;
|
|
59
|
+
content: '';
|
|
60
|
+
float: left;
|
|
61
|
+
margin-right: var(--su12);
|
|
62
|
+
margin-top: calc(calc(var(--lh-base) * 1em) / 2 - 5px); // 1.3 is our standard line height
|
|
63
|
+
transition: transform 0.3s cubic-bezier(0.4, 0.4, 0.6, 1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&[aria-expanded='true']:before {
|
|
67
|
+
transform: rotate(90deg);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.s-sidebarwidget__small-bold-text {
|
|
74
|
+
.s-sidebarwidget--action {
|
|
75
|
+
font-weight: normal;
|
|
76
|
+
line-height: calc(var(--lh-base) * var(--fs-caption)); // line-height should be the same as in the outside element, so the header and action baselines line up
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
font-size: var(--fs-caption);
|
|
80
|
+
font-weight: bold;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:first-child {
|
|
84
|
+
border-top-left-radius: var(--br-sm);
|
|
85
|
+
border-top-right-radius: var(--br-sm);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:active {
|
|
89
|
+
outline: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
background: var(--black-025);
|
|
93
|
+
border-top: var(--su-static1) solid var(--_sw-header-bc);
|
|
94
|
+
color: var(--black-600);
|
|
95
|
+
font-size: var(--fs-body2);
|
|
96
|
+
font-weight: normal;
|
|
97
|
+
margin: 0;
|
|
98
|
+
padding: var(--_sw-content-spacing-inner) var(--_sw-content-px);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
& &--item {
|
|
102
|
+
&,
|
|
103
|
+
& > :first-child {
|
|
104
|
+
&[aria-current="true"],
|
|
105
|
+
&[aria-current="page"] {
|
|
106
|
+
&:before {
|
|
107
|
+
border-left-color: var(--theme-primary-color);
|
|
108
|
+
border-left-style: solid;
|
|
109
|
+
border-left-width: calc(var(--su-static1) * 3); // 3px
|
|
110
|
+
content: '';
|
|
111
|
+
height: calc(100% + var(--_sw-content-spacing-inner));
|
|
112
|
+
left: 0;
|
|
113
|
+
margin-left: calc(var(--_sw-content-px) * -1 - var(--su-static1)); // the orange selection indicator overlaps with the widget border
|
|
114
|
+
margin-top: calc(var(--_sw-content-spacing-inner) / 2 * -1);
|
|
115
|
+
position: absolute;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
a,
|
|
119
|
+
a:visited { // TODO: this isn't the best way to go about this. There should be a "is current" highlight without font modification for more complex cases
|
|
120
|
+
color: inherit;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
color: var(--black);
|
|
124
|
+
font-weight: bold;
|
|
125
|
+
position: relative;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
margin: var(--_sw-content-spacing-inner) 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
& &--subnav {
|
|
133
|
+
li {
|
|
134
|
+
&[aria-current="page"],
|
|
135
|
+
&[aria-current="true"] {
|
|
136
|
+
a,
|
|
137
|
+
a:visited {
|
|
138
|
+
color: inherit;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
#stacks-internals #bullet-arrow(var(--theme-primary-color));
|
|
142
|
+
color: var(--black);
|
|
143
|
+
font-weight: bold;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#stacks-internals #bullet-arrow(var(--black-100));
|
|
147
|
+
background-position: 0 calc((1.2em - 10px) / 2);
|
|
148
|
+
background-repeat: no-repeat;
|
|
149
|
+
background-size: auto 10px;
|
|
150
|
+
margin-top: var(--su-static12);
|
|
151
|
+
padding-left: var(--su-static16);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
list-style-type: none;
|
|
155
|
+
margin-left: var(--su8);
|
|
156
|
+
padding-left: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
& table&--content&__items {
|
|
160
|
+
tr.s-sidebarwidget--item {
|
|
161
|
+
td {
|
|
162
|
+
padding: 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
display: table-row;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
border-collapse: separate;
|
|
169
|
+
border-spacing: var(--_sw-content-spacing-inner);
|
|
170
|
+
padding: calc(var(--_sw-content-spacing-outer) - var(--_sw-content-spacing-inner)) calc(var(--_sw-content-px) - var(--_sw-content-spacing-inner));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&:not(.s-anchors) a:not(.button):not(.s-btn):not(.post-tag):not(&--action):not(.s-user-card--link) {
|
|
174
|
+
&,
|
|
175
|
+
&:visited {
|
|
176
|
+
color: var(--black-500);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&:before { // [1]
|
|
181
|
+
content: '';
|
|
182
|
+
display: block;
|
|
183
|
+
margin-top: calc(var(--su-static1) * -1); // -1px
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&:after { // [2]
|
|
187
|
+
border: var(--su-static1) solid var(--_sw-after-bc);
|
|
188
|
+
border-radius: var(--br-sm);
|
|
189
|
+
clip-path: polygon(0% 0%, 100% 0%, 100% 50%, 0% 50%); // [3]
|
|
190
|
+
content: '';
|
|
191
|
+
// TODO: this makes no sense. revisit.
|
|
192
|
+
height: calc(2px + var(--br-sm)); // we need 2px border + 2px border radius to have the correct corner shape
|
|
193
|
+
left: calc(var(--su-static1) * -1); // -1px
|
|
194
|
+
pointer-events: none; // if the top item is clickable, then we don't want to prevent clicking the top 2 pixels
|
|
195
|
+
position: absolute;
|
|
196
|
+
right: calc(var(--su-static1) * -1); // -1px
|
|
197
|
+
top: calc(var(--su-static1) * -1); // -1px
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
background-color: var(--white);
|
|
201
|
+
border: var(--su-static1) solid var(--_sw-bc);
|
|
202
|
+
border-radius: var(--br-sm);
|
|
203
|
+
box-shadow: var(--bs-sm);
|
|
204
|
+
font-size: var(--fs-body1);
|
|
205
|
+
position: relative; // so that it's the positioning parent for the :after
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
// COLOR ALTERNATIVES
|
|
210
|
+
.alternate-color(@name) {
|
|
211
|
+
&.s-sidebarwidget__@{name} {
|
|
212
|
+
--_sw-bc: var(~"--@{name}-200");
|
|
213
|
+
|
|
214
|
+
.highcontrast-mode({
|
|
215
|
+
--_sw-bc: var(~"--@{name}-700");
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
.s-sidebarwidget--header {
|
|
219
|
+
background-color: var(~"--@{name}-100");
|
|
220
|
+
color: var(--fc-medium);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.s-sidebarwidget--header,
|
|
224
|
+
.s-sidebarwidget--content,
|
|
225
|
+
&:after {
|
|
226
|
+
border-color: var(--_sw-bc);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
background-color: var(~"--@{name}-050");
|
|
230
|
+
border-color: var(--_sw-bc);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// [1] We must support things like collapsible (in particular invisble) elements, wrapper elements,
|
|
235
|
+
// etc. Therefore every .-content and .-header must stand on its own; we cannot rely on things
|
|
236
|
+
// like :first-child, because the *first* child may not be the first *visible* child, and it may
|
|
237
|
+
// also be the :first-child of some wrapper. This is why every .-header and .-content has a
|
|
238
|
+
// border-top. But because you shouldn't see the first visible item's or header's top border
|
|
239
|
+
// (the widget itself provides for that border), we shift everything up by one pixel with the following pseudo-element.
|
|
240
|
+
|
|
241
|
+
// [2] The top item's divider line sits above the .s-sidebarwidget's top border.
|
|
242
|
+
// We could fix this by using overflow: hidden, but that would constrain users of
|
|
243
|
+
// .s-sidebarwidget to never have things like tooltips, autocompletes or the like that reach
|
|
244
|
+
// outside the widget boundaries.
|
|
245
|
+
// What we do instead is re-create the widget's top border in an absolutely positioned :after,
|
|
246
|
+
// which sits above our item's top border. Technically, a tiny corner of the item's border will
|
|
247
|
+
// still be visible, but at its highest point, this corner has a height of 0.27 pixels. And for
|
|
248
|
+
// this sub-pixel issues, we're talking about different shades of gray. So we can live with that.
|
|
249
|
+
|
|
250
|
+
// [3] In order to perfectly recreate the inner corner shape, our pseudo-element needs
|
|
251
|
+
// the border on all sides. But we can only do that if we're able to hide the bottom part.
|
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
//
|
|
2
|
-
// STACK OVERFLOW
|
|
3
|
-
// SPINNER
|
|
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
|
-
//
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// $ SPINNER BASE STYLE
|
|
14
|
-
// ----------------------------------------------------------------------------
|
|
15
|
-
|
|
16
1
|
.s-spinner {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
--_sp-baw: calc(var(--su-static1) * 3); // 3px
|
|
3
|
+
--_sp-size: var(--su-static24);
|
|
4
|
+
|
|
5
|
+
// MODIFIERS
|
|
6
|
+
&&__xs {
|
|
7
|
+
--_sp-baw: var(--su-static1);
|
|
8
|
+
--_sp-size: var(--su-static12);
|
|
9
|
+
}
|
|
10
|
+
&&__sm {
|
|
11
|
+
--_sp-baw: var(--su-static2);
|
|
12
|
+
--_sp-size: var(--su-static16);
|
|
13
|
+
}
|
|
14
|
+
&&__md {
|
|
15
|
+
--_sp-baw: var(--su-static4);
|
|
16
|
+
--_sp-size: var(--su-static32);
|
|
17
|
+
}
|
|
18
|
+
&&__lg {
|
|
19
|
+
--_sp-baw: var(--su-static6);
|
|
20
|
+
--_sp-size: var(--su-static48);
|
|
21
|
+
}
|
|
21
22
|
|
|
23
|
+
// CHILD ELEMENTS
|
|
22
24
|
&:before,
|
|
23
25
|
&:after {
|
|
26
|
+
border: var(--_sp-baw) solid currentColor;
|
|
27
|
+
|
|
28
|
+
border-radius: var(--br-circle);
|
|
24
29
|
content: '';
|
|
30
|
+
height: 100%;
|
|
25
31
|
position: absolute;
|
|
26
32
|
width: 100%;
|
|
27
|
-
height: 100%;
|
|
28
|
-
border: 3px solid currentColor;
|
|
29
|
-
border-radius: var(--br-circle);
|
|
30
33
|
}
|
|
31
34
|
&:before {
|
|
32
35
|
opacity: 0.25;
|
|
33
|
-
transform: rotate(90deg); //
|
|
36
|
+
transform: rotate(90deg); // [1]
|
|
34
37
|
}
|
|
35
38
|
&:after {
|
|
36
39
|
border-top-color: transparent;
|
|
@@ -39,99 +42,43 @@
|
|
|
39
42
|
animation: s-spinner-rotate 0.9s infinite cubic-bezier(0.5, 0.1, 0.5, 0.9);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
height: var(--su-static12);
|
|
45
|
-
&:before,
|
|
46
|
-
&:after {
|
|
47
|
-
border-width: 1px;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&.s-spinner__sm {
|
|
52
|
-
width: var(--su-static16);
|
|
53
|
-
height: var(--su-static16);
|
|
54
|
-
&:before,
|
|
55
|
-
&:after {
|
|
56
|
-
border-width: var(--su-static2);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&.s-spinner__md {
|
|
61
|
-
width: var(--su-static32);
|
|
62
|
-
height: var(--su-static32);
|
|
63
|
-
&:before,
|
|
64
|
-
&:after {
|
|
65
|
-
border-width: var(--su-static4);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&.s-spinner__lg {
|
|
70
|
-
width: var(--su-static48);
|
|
71
|
-
height: var(--su-static48);
|
|
72
|
-
&:before,
|
|
73
|
-
&:after {
|
|
74
|
-
border-width: var(--su-static6);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
45
|
+
height: var(--_sp-size);
|
|
46
|
+
width: var(--_sp-size);
|
|
77
47
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// unnecessary compositing work.
|
|
81
|
-
&,
|
|
82
|
-
&:before,
|
|
83
|
-
&:after {
|
|
84
|
-
// Safari: At least at 1dpp resolution, Safari crops the transformed elements
|
|
85
|
-
// too aggressively, leading to a very visible flat edge part of the circle.
|
|
86
|
-
// This invisible box shadow increases the area that the effects work on and thus
|
|
87
|
-
// makes the circle round again.
|
|
88
|
-
//
|
|
89
|
-
// Targeting only Safari:
|
|
90
|
-
// https://browserstrangeness.bitbucket.io/css_hacks.html#safari
|
|
91
|
-
@media not all and (min-resolution: 0.001dpcm) {
|
|
92
|
-
@supports (-webkit-appearance:none) and (stroke-color:transparent) {
|
|
93
|
-
box-shadow: 0 0 0 2px transparent;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
48
|
+
position: relative;
|
|
49
|
+
text-align: left; // [2]
|
|
97
50
|
}
|
|
98
51
|
|
|
99
52
|
.is-loading {
|
|
100
|
-
|
|
101
|
-
|
|
53
|
+
--_li-offset: 0.6em;
|
|
54
|
+
--_il-size: 1.23076923em;
|
|
102
55
|
|
|
103
|
-
&:before
|
|
56
|
+
&:before,
|
|
57
|
+
&:after {
|
|
58
|
+
border-radius: var(--br-circle);
|
|
59
|
+
border-style: solid;
|
|
60
|
+
border-width: var(--su-static2);
|
|
104
61
|
content: "";
|
|
62
|
+
height: var(--_il-size);
|
|
63
|
+
left: var(--_li-offset);
|
|
105
64
|
position: absolute;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
height: 1.23076923em;
|
|
111
|
-
border-width: 2px;
|
|
112
|
-
border-style: solid;
|
|
65
|
+
top: calc(50% - var(--_li-offset));
|
|
66
|
+
width: var(--_il-size);
|
|
67
|
+
}
|
|
68
|
+
&:before {
|
|
113
69
|
border-color: currentColor;
|
|
114
|
-
|
|
70
|
+
opacity: 0.3;
|
|
115
71
|
}
|
|
116
|
-
|
|
117
72
|
&:after {
|
|
118
|
-
|
|
119
|
-
position: absolute;
|
|
120
|
-
left: 0.6em;
|
|
121
|
-
top: calc(50% - 0.6em);
|
|
122
|
-
width: 1.23076923em;
|
|
123
|
-
height: 1.23076923em;
|
|
124
|
-
border-width: 2px;
|
|
125
|
-
border-style: solid;
|
|
73
|
+
animation: s-spinner-rotate 0.9s infinite cubic-bezier(0.5, 0.1, 0.5, 0.9);
|
|
126
74
|
border-color: transparent;
|
|
127
75
|
border-left-color: currentColor;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
cubic-bezier(0.5, 0.1, 0.5, 0.9);
|
|
131
|
-
// see _stacks-spinner.less for an explanation of the following two
|
|
132
|
-
filter: invert(0); // (*)
|
|
133
|
-
transform-origin: 50% 50% 1px; // (*)
|
|
76
|
+
filter: invert(0); // [1]
|
|
77
|
+
transform-origin: 50% 50% 1px; // [1]
|
|
134
78
|
}
|
|
79
|
+
|
|
80
|
+
padding-left: 2.2em;
|
|
81
|
+
position: relative;
|
|
135
82
|
}
|
|
136
83
|
|
|
137
84
|
// Keyframes
|
|
@@ -142,4 +89,7 @@
|
|
|
142
89
|
to {
|
|
143
90
|
transform: rotate(360deg);
|
|
144
91
|
}
|
|
145
|
-
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// [1] no-op to reduce wobble in Edge. More info: https://github.com/StackExchange/Stacks/blob/d2af26aca06c47e3f1f7a638e49b221a9e28e450/lib/css/components/_stacks-spinner.less#L16-L26
|
|
95
|
+
// [2] When within a parent that has text-align: center, the spinner's entire container spins, not just the spinner. Let's force text-align left so things spin internally.
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
// STACK OVERFLOW
|
|
3
|
-
// TABLES
|
|
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
|
-
// • CONTAINER
|
|
11
|
-
// • BASE TABLE STYLE
|
|
12
|
-
// • TABLE ALIGNMENT
|
|
13
|
-
// - Vertical alignment
|
|
14
|
-
// - Text alignment
|
|
15
|
-
// • LAYOUT VARIATIONS
|
|
16
|
-
// - Stripes
|
|
17
|
-
// - Spacing
|
|
18
|
-
// - Borders
|
|
19
|
-
// - Backgrounds
|
|
20
|
-
// - Totals row
|
|
21
|
-
// - Sortable tables
|
|
22
|
-
// • TABLE CELL SIZES
|
|
23
|
-
//
|
|
24
|
-
|
|
25
1
|
// ============================================================================
|
|
26
2
|
// $ CONTAINER
|
|
27
3
|
// Give tables an optional container for responsive scrolling
|
|
@@ -1,145 +1,94 @@
|
|
|
1
|
-
//
|
|
2
|
-
// STACK OVERFLOW
|
|
3
|
-
// TOGGLE SWITCHES
|
|
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
|
-
// $ BASE STYLE
|
|
11
|
-
// ----------------------------------------------------------------------------
|
|
12
1
|
.s-toggle-switch {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
position: relative;
|
|
41
|
-
display: block;
|
|
42
|
-
content: "";
|
|
43
|
-
width: 50%;
|
|
44
|
-
height: 100%;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&:after {
|
|
48
|
-
left: 0;
|
|
49
|
-
border-radius: 50%;
|
|
50
|
-
background: @white;
|
|
51
|
-
transition: left 0.1s ease;
|
|
52
|
-
|
|
53
|
-
.highcontrast-mode({
|
|
54
|
-
background: var(--white);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&:before {
|
|
59
|
-
display: none;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&:checked + .s-toggle-switch--indicator {
|
|
64
|
-
background: var(--green-400);
|
|
65
|
-
|
|
66
|
-
&:after {
|
|
67
|
-
left: 50%;
|
|
2
|
+
--_ts-bg: var(--black-300);
|
|
3
|
+
--_ts-bg-ps: left center;
|
|
4
|
+
--_ts-bs-color: transparent;
|
|
5
|
+
// multiple
|
|
6
|
+
--_ts-multiple-bg: unset;
|
|
7
|
+
--_ts-multiple-fc: var(--black-500);
|
|
8
|
+
|
|
9
|
+
// TODO split single and multiple toggle into two seperate components
|
|
10
|
+
&&__multiple {
|
|
11
|
+
input[type="radio"] {
|
|
12
|
+
&:checked {
|
|
13
|
+
+ label {
|
|
14
|
+
&.s-toggle-switch--label-off {
|
|
15
|
+
--_ts-multiple-bg: var(--black-500);
|
|
16
|
+
--_ts-multiple-fc: var(--white);
|
|
17
|
+
.dark-mode({ --_ts-multiple-bg: var(--black-350); });
|
|
18
|
+
}
|
|
19
|
+
&:not(.s-toggle-switch--label-off) {
|
|
20
|
+
--_ts-multiple-bg: var(--green-400);
|
|
21
|
+
--_ts-multiple-fc: @white;
|
|
22
|
+
.highcontrast-mode({ --_ts-multiple-fc: var(--white); });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
&:focus + label {
|
|
26
|
+
--_ts-bs-color: var(--focus-ring-success);
|
|
27
|
+
&.s-toggle-switch--label-off { --_ts-bs-color: var(--focus-ring-muted); }
|
|
28
|
+
}
|
|
68
29
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&:focus + .s-toggle-switch--indicator {
|
|
72
|
-
box-shadow: 0 0 0 var(--su-static4) var(--focus-ring-muted);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&:checked:focus + .s-toggle-switch--indicator {
|
|
76
|
-
box-shadow: 0 0 0 var(--su-static4) var(--focus-ring-success);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
30
|
|
|
80
|
-
&.s-toggle-switch__multiple {
|
|
81
|
-
display: flex;
|
|
82
|
-
align-items: stretch;
|
|
83
|
-
|
|
84
|
-
// First hide the radio buttons
|
|
85
|
-
input[type="radio"] {
|
|
86
|
-
position: absolute;
|
|
87
31
|
left: -999em;
|
|
88
|
-
opacity: 0;
|
|
89
32
|
margin: 0;
|
|
33
|
+
opacity: 0;
|
|
34
|
+
position: absolute;
|
|
90
35
|
}
|
|
91
|
-
|
|
92
|
-
// Next modifications to option cells
|
|
93
36
|
label {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
37
|
+
background-color: var(--_ts-multiple-bg);
|
|
38
|
+
box-shadow: 0 0 0 var(--su-static4) var(--_ts-bs-color);
|
|
39
|
+
color: var(--_ts-multiple-fc);
|
|
40
|
+
|
|
98
41
|
border-radius: 1000px;
|
|
99
|
-
|
|
42
|
+
cursor: pointer;
|
|
100
43
|
font-size: var(--fs-body1);
|
|
101
44
|
font-weight: 400;
|
|
102
45
|
line-height: 1;
|
|
46
|
+
margin: 0;
|
|
47
|
+
padding: 0.5em 0.7em;
|
|
103
48
|
text-align: center;
|
|
104
49
|
white-space: nowrap;
|
|
105
|
-
|
|
106
|
-
|
|
50
|
+
width: 100%;
|
|
107
51
|
-webkit-touch-callout: none;
|
|
108
52
|
-webkit-user-select: none;
|
|
109
53
|
user-select: none;
|
|
110
54
|
}
|
|
111
55
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
&.s-toggle-switch--label-off {
|
|
116
|
-
background-color: var(--black-500);
|
|
117
|
-
color: var(--white);
|
|
118
|
-
|
|
119
|
-
.dark-mode({
|
|
120
|
-
background-color: var(--black-350);
|
|
121
|
-
// color: var(--black);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
56
|
+
align-items: stretch;
|
|
57
|
+
display: flex;
|
|
58
|
+
}
|
|
124
59
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
60
|
+
input[type="checkbox"], // TODO DEPRECATED: drop support for nested input[type="checkbox"]
|
|
61
|
+
input[type="checkbox"]& {
|
|
62
|
+
&:checked {
|
|
63
|
+
--_ts-bg: var(--green-400);
|
|
64
|
+
--_ts-bg-ps: right center;
|
|
129
65
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
133
|
-
}
|
|
66
|
+
&:focus {
|
|
67
|
+
--_ts-bs-color: var(--focus-ring-success);
|
|
134
68
|
}
|
|
69
|
+
}
|
|
70
|
+
&:focus {
|
|
71
|
+
--_ts-bs-color: var(--focus-ring-muted);
|
|
72
|
+
outline: none;
|
|
73
|
+
}
|
|
74
|
+
&[disabled] {
|
|
75
|
+
cursor: default;
|
|
76
|
+
}
|
|
135
77
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
78
|
+
background-color: var(--_ts-bg);
|
|
79
|
+
background-position: var(--_ts-bg-ps);
|
|
80
|
+
box-shadow: 0 0 0 var(--su-static4) var(--_ts-bs-color);
|
|
139
81
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
82
|
+
appearance: none;
|
|
83
|
+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e"); // The white dot within the toggle
|
|
84
|
+
background-size: contain;
|
|
85
|
+
background-repeat: no-repeat;
|
|
86
|
+
border-radius: 1000px;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
height: var(--su-static24);
|
|
89
|
+
margin: 0; // guard against production adding 5px of margin to these
|
|
90
|
+
transition: background-position 0.2s ease;
|
|
91
|
+
vertical-align: top;
|
|
92
|
+
width: calc(var(--su-static48) - var(--su-static4));
|
|
144
93
|
}
|
|
145
94
|
}
|