@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.
Files changed (31) hide show
  1. package/dist/css/stacks.css +3565 -2093
  2. package/dist/css/stacks.min.css +1 -1
  3. package/lib/css/atomic/colors.less +1 -1
  4. package/lib/css/atomic/flex.less +53 -2
  5. package/lib/css/components/activity-indicator.less +3 -3
  6. package/lib/css/components/badges.less +11 -11
  7. package/lib/css/components/button-groups.less +59 -83
  8. package/lib/css/components/buttons.less +384 -585
  9. package/lib/css/components/code-blocks.less +98 -125
  10. package/lib/css/components/expandable.less +69 -59
  11. package/lib/css/components/inputs.less +38 -24
  12. package/lib/css/components/link-previews.less +110 -122
  13. package/lib/css/components/links.less +0 -16
  14. package/lib/css/components/modals.less +95 -120
  15. package/lib/css/components/notices.less +187 -180
  16. package/lib/css/components/popovers.less +132 -181
  17. package/lib/css/components/post-summary.less +0 -9
  18. package/lib/css/components/progress-bars.less +236 -297
  19. package/lib/css/components/prose.less +293 -380
  20. package/lib/css/components/sidebar-widgets.less +251 -0
  21. package/lib/css/components/spinner.less +54 -104
  22. package/lib/css/components/tables.less +0 -24
  23. package/lib/css/components/toggle-switches.less +69 -120
  24. package/lib/css/components/topbar.less +10 -11
  25. package/lib/css/components/user-cards.less +91 -144
  26. package/lib/css/stacks-dynamic.less +0 -1
  27. package/lib/css/stacks-static.less +1 -1
  28. package/package.json +11 -11
  29. package/lib/css/components/_styles-template.less +0 -78
  30. package/lib/css/components/widget-dynamic.less +0 -33
  31. package/lib/css/components/widget-static.less +0 -274
@@ -7,7 +7,7 @@
7
7
  // visit https://stackoverflow.design/
8
8
  //
9
9
  // ============================================================================
10
- // UTLITY OVERRIDES
10
+ // UTILITY OVERRIDES
11
11
  // Instead of re-adding colors to unique class names, use these atomic classes
12
12
  // for text and background colors
13
13
  // ============================================================================
@@ -54,6 +54,8 @@
54
54
  #stacks-internals #flex-builder-helpers .create-flex-count-cols(@num, (@count + 1));
55
55
  }
56
56
 
57
+ // DEPRECATED - START
58
+ //
57
59
  // -- FLEX GUTTERS
58
60
  // ============================================================================
59
61
  // We need two mixins to properly generate flex gutters:
@@ -151,6 +153,38 @@
151
153
  // widths for the new gutters.
152
154
  #stacks-internals #flex-builder-helpers .flex-fixed-item-spacing(@spacing, @flex-cols);
153
155
  }
156
+ //
157
+ // DEPRECATED - END
158
+
159
+ // -- FLEX GAP
160
+ // ------------------------------------------------------------------------
161
+ // [1] FIXED WIDTH ITEMS
162
+ // This makes the fixed width items to account for gaps.
163
+ //
164
+ // [2] UNIFORM CHILD FLEX ITEMS
165
+ // This class allows you to uniformly state the width of `.flex--item`
166
+ // divs within a `.d-flex` element. In particular we adjust the flex-basis
167
+ // and max-width here to account for gaps.
168
+ // ------------------------------------------------------------------------
169
+ .flex-fixed-item-spacing-gap(@spacing, @num, @count: 1) when (@count =< @num) {
170
+ @itemWidth: (@count * 100% / @num);
171
+ @gapRatio: ((@num - @count) / @num);
172
+
173
+ > .flex--item@{count}, // [1]
174
+ &.flex__allitems@{count} > .d-flex, // [2]
175
+ &.flex__allitems@{count} > .flex--item { // [2]
176
+ flex-basis: calc(~"@{itemWidth} - (@{spacing} * @{gapRatio})");
177
+ }
178
+
179
+ #stacks-internals #flex-builder-helpers .flex-fixed-item-spacing-gap(@spacing, @num, (@count + 1));
180
+ }
181
+
182
+
183
+ .gap-spacing(@spacing) {
184
+ #stacks-internals #flex-builder-settings();
185
+
186
+ #stacks-internals #flex-builder-helpers .flex-fixed-item-spacing-gap(@spacing, @flex-cols);
187
+ }
154
188
  }
155
189
  }
156
190
 
@@ -194,9 +228,24 @@
194
228
  }
195
229
  // ============================================================================
196
230
  // $ FLEX SPACING
197
- // Insert spaces or gutters in between flex items
231
+ // Insert spaces or gaps in between flex items
198
232
  // ----------------------------------------------------------------------------
199
- // TODO: Make this play nice with spacing units… or yeet this in the age of gap
233
+ .g0, .gx0, .gy0 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su0)); }
234
+ .g1, .gx1, .gy1 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su1)); }
235
+ .g2, .gx2, .gy2 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su2)); }
236
+ .g4, .gx4, .gy4 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su4)); }
237
+ .g6, .gx6, .gy6 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su6)); }
238
+ .g8, .gx8, .gy8 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su8)); }
239
+ .g12, .gx12, .gy12 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su12)); }
240
+ .g16, .gx16, .gy16 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su16)); }
241
+ .g24, .gx24, .gy24 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su24)); }
242
+ .g32, .gx32, .gy32 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su32)); }
243
+ .g48, .gx48, .gy48 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su48)); }
244
+ .g64, .gx64, .gy64 { #stacks-internals #flex-builder-helpers .gap-spacing(var(--su64)); }
245
+
246
+
247
+ // DEPRECATED - START
248
+ //
200
249
  .gs2 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su2)); }
201
250
  .gs4 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su4)); }
202
251
  .gs6 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su6)); }
@@ -227,6 +276,8 @@
227
276
  margin-left: 0;
228
277
  }
229
278
  }
279
+ //
280
+ // DEPRECATED - END
230
281
 
231
282
 
232
283
  // ============================================================================
@@ -8,15 +8,15 @@
8
8
 
9
9
  // VARIANTS
10
10
  &&__success {
11
- --_ai-bg-color: var(--green-500);
11
+ --_ai-bg: var(--green-500);
12
12
  --_ai-focus-ring: var(--focus-ring-success);
13
13
  }
14
14
  &&__warning {
15
- --_ai-bg-color: var(--yellow-600);
15
+ --_ai-bg: var(--yellow-600);
16
16
  --_ai-focus-ring: var(--focus-ring-warning);
17
17
  }
18
18
  &&__danger {
19
- --_ai-bg-color: var(--red-500);
19
+ --_ai-bg: var(--red-500);
20
20
  --_ai-focus-ring: var(--focus-ring-error);
21
21
  }
22
22
 
@@ -13,17 +13,17 @@
13
13
  // CONTEXTUAL STYLES
14
14
  .highcontrast-mode({
15
15
  // Badge counts
16
- &__gold,
17
- &__silver,
18
- &__bronze,
16
+ &&__gold,
17
+ &&__silver,
18
+ &&__bronze,
19
19
  // Number counts
20
- &__rep,
21
- &__rep-down,
22
- &__votes,
20
+ &&__rep,
21
+ &&__rep-down,
22
+ &&__votes:not(&__answered),
23
23
  // Users
24
- &__admin,
25
- &__moderator,
26
- &__staff {
24
+ &&__admin,
25
+ &&__moderator,
26
+ &&__staff {
27
27
  --_ba-bc: currentColor;
28
28
  }
29
29
  });
@@ -76,7 +76,7 @@
76
76
  }
77
77
  &&__rep,
78
78
  &&__rep-down,
79
- &&__votes {
79
+ &&__votes:not(&__answered) {
80
80
  --_ba-bg: var(--white);
81
81
  }
82
82
  &&__answered {
@@ -96,7 +96,7 @@
96
96
  --_ba-bc: var(--red-400);
97
97
  --_ba-fc: var(--red-500);
98
98
  }
99
- &&__votes {
99
+ &&__votes:not(&__answered) {
100
100
  --_ba-bc: var(--black-150);
101
101
  --_ba-fc: var(--black-700);
102
102
  }
@@ -1,104 +1,80 @@
1
- //
2
- // STACK OVERFLOW
3
- // BUTTON GROUPS
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
- // • BUTTON GROUP CONTAINER
11
-
12
- // ============================================================================
13
- // $ CONTAINER
14
- // ----------------------------------------------------------------------------
15
1
  .s-btn-group {
16
- display: flex;
17
- flex-wrap: wrap;
18
- margin-bottom: 1px; // Compensate for buttons having a margin bottom of -1px to account for row wrapping
19
-
20
- .s-btn {
21
- margin-bottom: -1px; // When wrapping we need to account for the border
22
- white-space: nowrap; // When the buttons wrap, they get super tall and mess up the whole layout
2
+ // CONTEXTUAL STYLES
3
+ #stacks-internals #screen-sm({
4
+ .s-btn {
5
+ &.s-btn__dropdown {
6
+ padding-right: 1.2em;
23
7
 
24
- // If it isn't the last button, we should slide the button over to account for border thickness
25
- &:not(:last-child) {
26
- margin-right: -1px;
27
- }
8
+ &:after {
9
+ right: 0.4em;
10
+ }
11
+ }
28
12
 
29
- // We don't want border-radii on interior buttons
30
- &:not(:first-child):not(:last-child) {
31
- border-radius: 0;
13
+ padding-left: 0.4em;
14
+ padding-right: 0.4em;
32
15
  }
16
+ }, @force-selector: true);
33
17
 
34
- // Kill the right border radius on the first button
35
- &:first-child:not(:only-child) {
36
- border-top-right-radius: 0;
37
- border-bottom-right-radius: 0;
38
- }
18
+ // VARIANTS
19
+ &:not(&--radio) .s-btn:not(:first-child):not(:last-child),
20
+ &&--radio .s-btn:not(:first-of-type):not(:last-of-type) {
21
+ border-radius: 0;
22
+ }
39
23
 
40
- // Kill the left border radius on the last button
41
- &:last-child:not(:only-child) {
42
- border-top-left-radius: 0;
43
- border-bottom-left-radius: 0;
44
- }
24
+ &:not(&--radio) .s-btn:first-child:not(:only-child),
25
+ &&--radio .s-btn:first-of-type:not(:last-of-type) {
26
+ border-top-right-radius: 0;
27
+ border-bottom-right-radius: 0;
28
+ }
45
29
 
46
- // When the button is active or selected, it should pop above its siblings
47
- &.is-selected {
48
- z-index: var(--zi-selected);
49
- }
30
+ &:not(&--radio) .s-btn:last-child:not(:only-child),
31
+ &&--radio .s-btn:last-of-type:not(:first-of-type) {
32
+ border-top-left-radius: 0;
33
+ border-bottom-left-radius: 0;
34
+ }
50
35
 
51
- .highcontrast-mode({
52
- &.is-selected {
53
- background-color: var(--black-400);
54
- color: var(--white);
36
+ &:not(&--radio) .s-btn:not(:last-child),
37
+ &&--radio .s-btn:not(:last-of-type) {
38
+ margin-right: calc(var(--su-static1) * -1);
39
+ }
55
40
 
56
- .s-btn--number {
57
- color: var(--black);
58
- }
41
+ // CHILD ELEMENTS
42
+ form {
43
+ &:not(:first-child):not(:last-child) {
44
+ .s-btn {
45
+ border-radius: 0;
59
46
  }
60
- });
61
-
62
- &:active {
63
- z-index: var(--zi-active);
64
47
  }
65
-
66
- #stacks-internals #screen-sm({
67
- padding-left: 0.4em;
68
- padding-right: 0.4em;
69
- }, @force-selector: true);
70
- }
71
-
72
- #stacks-internals #screen-sm({
73
- .s-btn.s-btn__dropdown {
74
- padding-right: 1.2em;
75
-
76
- &:after {
77
- right: 0.4em;
48
+ &:last-child:not(:only-child) {
49
+ .s-btn:not(:last-child) {
50
+ border-radius: 0;
51
+ }
52
+ }
53
+ &:first-child:not(:only-child) {
54
+ .s-btn:not(:first-child) {
55
+ border-radius: 0;
78
56
  }
79
57
  }
80
- }, @force-selector: true);
81
58
 
82
- .s-btn-group--container {
83
59
  display: flex;
60
+ margin-right: calc(var(--su-static1) * -1); // -1px
61
+ }
84
62
 
85
- .s-btn {
86
- margin-right: -1px; // We should slide buttons over to account for border thickness
63
+ .s-btn {
64
+ &:active {
65
+ z-index: var(--zi-active);
87
66
  }
88
-
89
- &:not(:first-child):not(:last-child) .s-btn {
90
- border-radius: 0;
67
+ &.is-selected,
68
+ &--radio:checked + .s-btn {
69
+ z-index: var(--zi-selected); // When the button is active or selected, it should pop above its siblings
91
70
  }
92
71
 
93
- &:first-child .s-btn {
94
- border-top-right-radius: 0;
95
- border-bottom-right-radius: 0;
96
- margin-left: 0;
97
- }
98
-
99
- &:last-child .s-btn {
100
- border-top-left-radius: 0;
101
- border-bottom-left-radius: 0;
102
- }
72
+ margin-bottom: calc(var(--su-static1) * -1); // When wrapping we need to account for the border
73
+ white-space: nowrap; // When the buttons wrap, they get super tall and mess up the whole layout
103
74
  }
75
+
76
+ // STATIC COMPONENT STYLES
77
+ display: flex;
78
+ flex-wrap: wrap;
79
+ margin-bottom: var(--su-static1); // Compensate for buttons having a margin bottom of -1px to account for row wrapping
104
80
  }