@stackoverflow/stacks 1.4.2 → 1.5.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.
@@ -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,
23
23
  // Users
24
- &__admin,
25
- &__moderator,
26
- &__staff {
24
+ &&__admin,
25
+ &&__moderator,
26
+ &&__staff {
27
27
  --_ba-bc: currentColor;
28
28
  }
29
29
  });
@@ -29,76 +29,86 @@
29
29
  // (no longer visible) element itself to remain at the top, thereby forcing the excess pixels to be added
30
30
  // above the top, not below the bottom. And because extending content above the document top will not do
31
31
  // anything to the document height, there is no jumping during the transition.
32
-
33
- @stacks-internals-s-expandable-transition-duration: 100ms;
32
+ // see custom property "--_ex-transition-duration"
34
33
 
35
34
  // Per the answer referenced above, the component can only guarantee smooth transitions if above a minimum
36
35
  // height and can only guarantee the element will be hidden is below a maximimum height.
37
36
  // The minimum height has been set at 10px because that's below the height of a single line of text in an s-description.
38
- @stacks-internal-s-expandable-min-expected-height: 10px;
39
- @stacks-internal-s-expandable-max-expected-height: 1500px;
37
+ // see custom properties "--_ex-min-expected-height" and "--_ex-content-mb"
40
38
 
41
39
  .s-expandable {
42
- display: flex;
43
- -webkit-clip-path: polygon(-1000000px -1000000px, 1000000px -1000000px, 1000000px 1000000px, -1000000px 1000000px);
44
- clip-path: polygon(-1000000px -1000000px, 1000000px -1000000px, 1000000px 1000000px, -1000000px 1000000px);
45
- align-items: flex-start; // see comment above
46
- transition: clip-path 0s @stacks-internals-s-expandable-transition-duration, -webkit-clip-path 0s @stacks-internals-s-expandable-transition-duration;
40
+ // CONSTANTS
41
+ --_ex-clip-path: polygon(-1000000px -1000000px, 1000000px -1000000px, 1000000px 1000000px, -1000000px 1000000px);
42
+ --_ex-min-expected-height: 10px;
43
+ --_ex-transition-duration: 100ms;
44
+ // VARIABLES
45
+ --_ex-after-h: 10px;
46
+ --_ex-after-hmx: 0;
47
+ --_ex-after-transition:
48
+ height var(--_ex-transition-duration) linear,
49
+ max-height 0s var(--_ex-transition-duration) linear;
50
+ --_ex-content-hmx: 1000000px;
51
+ --_ex-content-mb: 0;
52
+ --_ex-content-o: unset;
53
+ --_ex-content-transform: unset;
54
+ --_ex-content-transition:
55
+ margin-bottom var(--_ex-transition-duration) cubic-bezier(0, 0, 0, 1),
56
+ transform var(--_ex-transition-duration) cubic-bezier(1, 0, 1, 1),
57
+ opacity var(--_ex-transition-duration) cubic-bezier(1, 0, 1, 1);
47
58
 
59
+ &:not(.is-expanded) {
60
+ --_ex-after-h: 0;
61
+ --_ex-after-hmx: var(--_ex-min-expected-height);
62
+ --_ex-after-transition: height var(--_ex-min-expected-height) linear;
63
+ --_ex-content-hmx: 0;
64
+ --_ex-content-mb: -1500px;
65
+ --_ex-content-o: 0;
66
+ --_ex-content-transform: scaleY(0);
67
+ --_ex-content-transition:
68
+ margin-bottom var(--_ex-transition-duration) cubic-bezier(1, 0, 1, 1),
69
+ visibility 0s var(--_ex-transition-duration),
70
+ max-height 0s var(--_ex-transition-duration),
71
+ transform var(--_ex-transition-duration) cubic-bezier(0, 1, 1, 1),
72
+ opacity var(--_ex-transition-duration) cubic-bezier(0, 1, 1, 1);
73
+
74
+ & .s-expandable--content {
75
+ @supports ((-webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)) or (clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%))) {
76
+ --_ex-content-o: 1;
77
+ --_ex-content-transform: none;
78
+ }
79
+ }
80
+
81
+ -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
82
+ clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
83
+ overflow: hidden;
84
+ transition: none;
85
+ }
48
86
  &:after {
49
- content: '';
87
+ height: var(--_ex-after-h);
88
+ max-height: var(--_ex-after-hmx);
89
+ transition: var(--_ex-after-transition);
90
+
50
91
  -ms-flex-preferred-size: 0;
92
+ content: '';
51
93
  flex-basis: 0;
52
- height: @stacks-internal-s-expandable-min-expected-height;
53
- max-height: 0;
54
- transition:
55
- height @stacks-internals-s-expandable-transition-duration linear,
56
- max-height 0s @stacks-internals-s-expandable-transition-duration linear;
57
94
  }
58
- }
59
-
60
- .s-expandable--content {
61
- -ms-flex-preferred-size: 100%;
62
- flex-basis: 100%;
63
- max-height: 1000000px;
64
- margin-bottom: 0;
65
- -webkit-transform-origin: 0 0;
66
- transform-origin: 0 0;
67
- transition:
68
- margin-bottom @stacks-internals-s-expandable-transition-duration cubic-bezier(0, 0, 0, 1),
69
- transform @stacks-internals-s-expandable-transition-duration cubic-bezier(1, 0, 1, 1),
70
- opacity @stacks-internals-s-expandable-transition-duration cubic-bezier(1, 0, 1, 1);
71
- }
95
+ & &--content {
96
+ max-height: var(--_ex-content-hmx);
97
+ margin-bottom: var(--_ex-content-mb);
98
+ opacity: var(--_ex-content-o);
99
+ -webkit-transform: var(--_ex-content-transform);
100
+ transform: var(--_ex-content-transform);
72
101
 
73
- .s-expandable:not(.is-expanded) {
74
- overflow: hidden;
75
- -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
76
- clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
77
- transition: none;
78
-
79
- .s-expandable--content {
80
- visibility: hidden;
81
- max-height: 0;
82
- margin-bottom: -@stacks-internal-s-expandable-max-expected-height;
83
- opacity: 0;
84
- -webkit-transform: scaleY(0);
85
- transform: scaleY(0);
86
- transition:
87
- margin-bottom @stacks-internals-s-expandable-transition-duration cubic-bezier(1, 0, 1, 1),
88
- visibility 0s @stacks-internals-s-expandable-transition-duration,
89
- max-height 0s @stacks-internals-s-expandable-transition-duration,
90
- transform @stacks-internals-s-expandable-transition-duration cubic-bezier(0, 1, 1, 1),
91
- opacity @stacks-internals-s-expandable-transition-duration cubic-bezier(0, 1, 1, 1);
92
- @supports ((-webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)) or (clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%))) {
93
- opacity: 1;
94
- -webkit-transform: none;
95
- transform: none;
96
- }
102
+ -ms-flex-preferred-size: 100%;
103
+ flex-basis: 100%;
104
+ -webkit-transform-origin: 0 0;
105
+ transform-origin: 0 0;
106
+ transition: var(--_ex-content-transition);
97
107
  }
98
108
 
99
- &:after {
100
- height: 0;
101
- max-height: @stacks-internal-s-expandable-min-expected-height;
102
- transition: height @stacks-internals-s-expandable-transition-duration linear;
103
- }
104
- }
109
+ align-items: flex-start; // see comment above
110
+ display: flex;
111
+ -webkit-clip-path: var(--_ex-clip-path);
112
+ clip-path: var(--_ex-clip-path);
113
+ transition: clip-path 0s var(--_ex-transition-duration), -webkit-clip-path 0s var(--_ex-transition-duration);
114
+ }
@@ -1,133 +1,108 @@
1
- //
2
- // STACK OVERFLOW
3
- // MODALS
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
- // • LAYOUT TRANSITIONS
12
- //
13
- // ============================================================================
14
- // $ BASE STYLE
15
- // ----------------------------------------------------------------------------
16
1
  .s-modal {
17
- display: flex;
18
- visibility: hidden;
19
- position: fixed;
20
- z-index: var(--zi-hide); // Make sure it's also below everything so we can't interact with it.
21
-
22
- // This fills the entire viewport without having to worry about size.
23
- top: 0;
24
- right: 0;
25
- bottom: 0;
26
- left: 0;
27
- align-items: center;
28
- justify-content: center;
29
- background-color: fade(@black-900, 50%); // Background remains fixed
30
- opacity: 0;
31
- backface-visibility: hidden;
32
- transition: opacity 100ms var(--te-smooth) 0s, z-index 0s 100ms, visibility 0s 100ms; // Transition out
33
- will-change: visibility, z-index, opacity; // Not supported in Edge
34
-
35
- &[aria-hidden="false"],
36
- &[aria-hidden="false"] .s-modal--dialog {
37
- visibility: visible;
38
- z-index: var(--zi-modals);
39
- opacity: 1;
40
- transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
41
- transition: opacity 100ms var(--te-smooth) 10ms, z-index 0s 0s, visibility 0s 0s, transform 100ms var(--te-smooth) 10ms, transform 100ms var(--te-smooth) 10ms; // Transition in
2
+ --_mo-bg: fade(@black-900, 50%); // Background remains fixed
3
+ --_mo-hmx: unset;
4
+ --_mo-wmx: unset;
5
+ --_mo-close-t: var(--su8);
6
+ --_mo-dialog-bg: var(--white);
7
+ --_mo-dialog-pt: var(--su24);
8
+ --_mo-header-fc: var(--fc-dark);
9
+
10
+ // CONTEXTUAL STYLES
11
+ &[aria-hidden="false"] {
12
+ &,
13
+ .s-modal--dialog {
14
+ opacity: 1;
15
+ transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
16
+ transition: opacity 100ms var(--te-smooth) 10ms, z-index 0s 0s, visibility 0s 0s, transform 100ms var(--te-smooth) 10ms, transform 100ms var(--te-smooth) 10ms; // Transition in
17
+ visibility: visible;
18
+ z-index: var(--zi-modals);
19
+ }
42
20
  }
43
- }
44
21
 
45
- .s-modal--dialog {
46
- overflow-y: auto;
47
- visibility: hidden;
48
- z-index: var(--zi-hide); // Make sure it's also below everything so we can't interact with it.
49
- max-width: 600px;
50
- max-height: 100%;
51
- padding: var(--su24);
52
- border-radius: var(--br-lg);
53
- background-color: var(--white);
54
- box-shadow: var(--bs-lg);
55
- opacity: 0;
56
- backface-visibility: hidden;
57
- transform: translate3d(0, 30%, 0) scale3d(0.6, 0.6, 0.6);
58
-
59
- .dark-mode({
60
- background-color: var(--black-100);
61
- });
62
-
63
- @scrollbar-styles();
22
+ // MODIFIERS
23
+ &&__celebration {
24
+ --_mo-close-t: var(--su48);
25
+ --_mo-dialog-pt: var(--su64);
64
26
 
65
- transition: opacity 200ms var(--te-smooth) 0s, z-index 0s 100ms, visibility 0s 100ms, transform 100ms var(--te-smooth) 0s, transform 100ms var(--te-smooth) 0s; // Transition out
66
- will-change: visibility, z-index, opacity, transform; // Not supported by Edge
67
-
68
- .s-modal[aria-hidden="false"] & {
69
- transform: translate3d(0, 0, 0) scale3d(1, 1, 1); // Transition in
27
+ .s-modal--dialog {
28
+ .bg-confetti-animated;
29
+ }
70
30
  }
71
- }
72
-
73
- // [1] To override .s-btn class attributes
74
- .s-modal--close {
75
- position: absolute !important; // [1]
76
- top: var(--su8);
77
- right: var(--su8);
78
- padding: var(--su12) !important; // [1]
79
-
80
- .svg-icon {
81
- margin: 0 !important;
31
+ &&__full {
32
+ --_mo-hmx: calc(100% - var(--su48));
33
+ --_mo-wmx: calc(100% - var(--su48));
82
34
  }
83
- }
84
35
 
85
- // ============================================================================
86
- // $ DIALOG PIECES
87
- // ----------------------------------------------------------------------------
88
- .s-modal--header {
89
- margin-bottom: var(--su16);
90
- color: var(--fc-dark);
91
- font-size: var(--fs-headline1);
92
- font-weight: normal;
93
- line-height: var(--lh-sm);
94
- }
95
-
96
- .s-modal--body {
97
- margin-bottom: var(--su24);
98
- color: var(--fc-medium);
99
- }
100
-
101
- .s-modal--footer {
102
- margin-top: var(--su24);
103
- }
104
-
105
-
106
- // ============================================================================
107
- // $ STATES
108
- // ----------------------------------------------------------------------------
109
- .s-modal.has-danger,
110
- .s-modal.s-modal__danger {
111
- background-color: darken(fade(@red-900, 50%), 23%);
112
-
113
- .s-modal--header {
114
- color: var(--red-600);
36
+ // VARIANTS
37
+ &.has-danger,
38
+ &&__danger {
39
+ --_mo-bg: darken(fade(@red-900, 50%), 23%);
40
+ --_mo-header-fc: var(--red-600);
115
41
  }
116
- }
117
42
 
118
- .s-modal.s-modal__celebration .s-modal--dialog {
119
- padding-top: var(--su64);
120
- .bg-confetti-animated;
43
+ // CHILD ELEMENTS
44
+ & &--body {
45
+ color: var(--fc-medium);
46
+ margin-bottom: var(--su24);
47
+ }
48
+ & &--close {
49
+ // [1] To override .s-btn class attributes
50
+ .svg-icon {
51
+ margin: 0 !important;
52
+ }
53
+
54
+ padding: var(--su12) !important; // [1]
55
+ position: absolute !important; // [1]
56
+ right: var(--su8);
57
+ top: var(--_mo-close-t);
58
+ }
59
+ & &--dialog {
60
+ .dark-mode({
61
+ --_mo-dialog-bg: var(--black-100);
62
+ });
63
+
64
+ padding: var(--_mo-dialog-pt) var(--su24) var(--su24);
65
+
66
+ @scrollbar-styles();
67
+ backface-visibility: hidden;
68
+ background-color: var(--_mo-dialog-bg);
69
+ border-radius: var(--br-lg);
70
+ box-shadow: var(--bs-lg);
71
+ max-height: 100%;
72
+ max-width: 600px;
73
+ opacity: 0;
74
+ overflow-y: auto;
75
+ transform: translate3d(0, 30%, 0) scale3d(0.6, 0.6, 0.6);
76
+ transition: opacity 200ms var(--te-smooth) 0s, z-index 0s 100ms, visibility 0s 100ms, transform 100ms var(--te-smooth) 0s, transform 100ms var(--te-smooth) 0s; // Transition out
77
+ visibility: hidden;
78
+ will-change: visibility, z-index, opacity, transform; // Not supported by Edge
79
+ z-index: var(--zi-hide); // Make sure it's also below everything so we can't interact with it.
80
+ }
81
+ & &--footer {
82
+ margin-top: var(--su24);
83
+ }
84
+ & &--header {
85
+ color: var(--_mo-header-fc);
121
86
 
122
- .s-modal--close {
123
- top: var(--su48);
87
+ font-size: var(--fs-headline1);
88
+ font-weight: normal;
89
+ line-height: var(--lh-sm);
90
+ margin-bottom: var(--su16);
124
91
  }
125
- }
126
92
 
127
- // ============================================================================
128
- // $ SIZES
129
- // ----------------------------------------------------------------------------
130
- .s-modal__full {
131
- max-width: calc(100% - var(--su48));
132
- max-height: calc(100% - var(--su48));
93
+ background-color: var(--_mo-bg);
94
+ max-height: var(--_mo-hmx);
95
+ max-width: var(--_mo-wmx);
96
+
97
+ align-items: center;
98
+ backface-visibility: hidden;
99
+ display: flex;
100
+ inset: 0; // This fills the entire viewport without having to worry about size.
101
+ justify-content: center;
102
+ opacity: 0;
103
+ position: fixed;
104
+ transition: opacity 100ms var(--te-smooth) 0s, z-index 0s 100ms, visibility 0s 100ms; // Transition out
105
+ visibility: hidden;
106
+ will-change: visibility, z-index, opacity; // Not supported in Edge
107
+ z-index: var(--zi-hide); // Make sure it's also below everything so we can't interact with it.
133
108
  }