@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.
@@ -1,197 +1,148 @@
1
- //
2
- // STACK OVERFLOW
3
- // POPOVERS
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
- // • VARIABLES
11
- // • BASE STYLE
12
- // • ARROWS
13
- // • LOCATIONS
14
- //
15
- // ============================================================================
16
- // $ BASE STYLES
17
- // ----------------------------------------------------------------------------
18
1
  .s-popover {
19
- display: none;
20
- position: absolute;
21
- max-width: 24rem;
22
- padding: var(--su12);
23
- z-index: var(--zi-popovers);
24
- border-radius: var(--br-md);
25
- border: 1px solid var(--bc-medium);
26
- background-color: var(--white);
27
- box-shadow: var(--bs-md);
28
- color: var(--fc-dark);
29
- font-size: var(--fs-body1);
30
- min-width: 12rem;
31
- width: 100%;
32
-
33
- // Guard against popovers being in a container with white-space: nowrap
34
- // Without this, the content pops *out* of the popover.
35
- white-space: normal;
36
-
2
+ --_po-bg: var(--white);
3
+ --_po-bc: var(--bc-medium);
4
+ --_po-bs: var(--bs-md);
5
+ --_po-d: none;
6
+ --_po-wmn: 12rem;
7
+ --_po-w: 100%;
8
+ // arrow
9
+ --_po-arrow-fc: var(--white);
10
+ --_po-arrow-b: unset;
11
+ --_po-arrow-l: unset;
12
+ --_po-arrow-r: unset;
13
+ --_po-arrow-t: unset;
14
+ --_po-arrow-ps: calc(var(--su6) * -1); // ps suffix used for placement, not positioning value
15
+ --_po-arrow-after-b: unset;
16
+ --_po-arrow-after-l: unset;
17
+ --_po-arrow-after-r: unset;
18
+ --_po-arrow-after-t: unset;
19
+ --_po-arrow-after-bs: unset;
20
+
21
+ // CONTEXTUAL STYLES
37
22
  .dark-mode({
38
- background-color: var(--black-075);
39
- border-color: var(--bc-light);
40
- box-shadow: var(--bs-lg);
23
+ --_po-bg: var(--black-075);
24
+ --_po-bc: var(--bc-light);
25
+ --_po-bs: var(--bs-lg);
26
+ --_po-arrow-fc: var(--black-075);
41
27
  });
42
-
43
- &.s-popover__tooltip {
44
- width: auto;
45
- min-width: unset;
46
- }
47
-
28
+
29
+ // MODIFIERS
48
30
  &.is-visible {
49
- display: block;
31
+ --_po-d: block;
50
32
  }
51
-
52
- &[data-popper-placement^="top"] > .s-popover--arrow,
53
- .s-popover--arrow__bc,
54
- .s-popover--arrow__bl,
55
- .s-popover--arrow__br {
56
- bottom: calc(var(--su6) * -1);
57
-
58
- &:after {
59
- bottom: 1px;
60
- box-shadow: 2px 2px 5px 0 hsla(0, 0, 0, 0.07), 2px 2px 2px -1px hsla(0, 0, 0, 0.1);
61
-
62
- .highcontrast-mode({
63
- box-shadow: 1px 1px 0 0 var(--bc-medium);
64
- });
65
- }
33
+ &&__tooltip {
34
+ --_po-wmn: unset;
35
+ --_po-w: auto;
66
36
  }
67
-
68
- &[data-popper-placement^="bottom"] > .s-popover--arrow,
69
- .s-popover--arrow__tc,
70
- .s-popover--arrow__tl,
71
- .s-popover--arrow__tr {
72
- top: calc(var(--su6) * -1);
73
-
74
- &:after {
75
- top: 1px;
76
- box-shadow: -1px -1px 1px 0 hsla(0, 0, 0, 0.12);
77
-
78
- .highcontrast-mode({
79
- box-shadow: -1px -1px 0 0 var(--bc-medium);
80
- });
81
- }
37
+
38
+ // CHILD ELEMENTS
39
+ // Arrow
40
+ &[data-popper-placement^="top"] > &--arrow,
41
+ & &--arrow__bc,
42
+ & &--arrow__bl,
43
+ & &--arrow__br {
44
+ --_po-arrow-b: var(--_po-arrow-ps);
45
+ --_po-arrow-after-b: var(--su-static1);
46
+ --_po-arrow-after-bs: 2px 2px 5px 0 hsla(0, 0%, 0%, 0.07), 2px 2px 2px -1px hsla(0, 0%, 0%, 0.1);
47
+ .highcontrast-mode({ --_po-arrow-after-bs: 1px 1px 0 0 var(--bc-medium); });
82
48
  }
83
-
84
- &[data-popper-placement^="left"] > .s-popover--arrow,
85
- .s-popover--arrow__rc,
86
- .s-popover--arrow__rt,
87
- .s-popover--arrow__rb {
88
- right: calc(var(--su6) * -1);
89
-
90
- &:after {
91
- right: 1px;
92
- box-shadow: 2px -2px 5px 0 hsla(0, 0, 0, 0.07), 2px -2px 2px -1px hsla(0, 0, 0, 0.1);
93
-
94
- .highcontrast-mode({
95
- box-shadow: 1px -1px 0 0 var(--bc-medium);
96
- });
97
- }
49
+ &[data-popper-placement^="bottom"] > &--arrow,
50
+ & &--arrow__tc,
51
+ & &--arrow__tl,
52
+ & &--arrow__tr {
53
+ --_po-arrow-t: var(--_po-arrow-ps);
54
+ --_po-arrow-after-t: var(--su-static1);
55
+ --_po-arrow-after-bs: -1px -1px 1px 0 hsla(0, 0%, 0%, 0.12);
56
+ .highcontrast-mode({ --_po-arrow-after-bs: -1px -1px 0 0 var(--bc-medium); });
98
57
  }
99
-
100
- &[data-popper-placement^="right"] > .s-popover--arrow,
101
- .s-popover--arrow__lc,
102
- .s-popover--arrow__lt,
103
- .s-popover--arrow__lb {
104
- left: calc(var(--su6) * -1);
105
-
106
- &:after {
107
- left: 1px;
108
- box-shadow: -2px 2px 5px 0 hsla(0, 0, 0, 0.07), -2px 2px 2px -1px hsla(0, 0, 0, 0.1);
109
-
110
- .highcontrast-mode({
111
- box-shadow: -1px 1px 0 0 var(--bc-medium);
112
- });
113
- }
58
+ &[data-popper-placement^="left"] > &--arrow,
59
+ & &--arrow__rc,
60
+ & &--arrow__rt,
61
+ & &--arrow__rb {
62
+ --_po-arrow-r: var(--_po-arrow-ps);
63
+ --_po-arrow-after-r: var(--su-static1);
64
+ --_po-arrow-after-bs: 2px -2px 5px 0 hsla(0, 0%, 0%, 0.07), 2px -2px 2px -1px hsla(0, 0%, 0%, 0.1);
65
+ .highcontrast-mode({ --_po-arrow-after-bs: 1px -1px 0 0 var(--bc-medium); });
114
66
  }
115
-
116
- .s-popover--arrow__tc,
117
- .s-popover--arrow__bc {
118
- left: calc(50% - var(--su6));
67
+ &[data-popper-placement^="right"] > &--arrow,
68
+ & &--arrow__lc,
69
+ & &--arrow__lt,
70
+ & &--arrow__lb {
71
+ --_po-arrow-l: var(--_po-arrow-ps);
72
+ --_po-arrow-after-l: var(--su-static1);
73
+ --_po-arrow-after-bs: -2px 2px 5px 0 hsla(0, 0%, 0%, 0.07), -2px 2px 2px -1px hsla(0, 0%, 0%, 0.1);
74
+ .highcontrast-mode({ --_po-arrow-after-bs: -1px 1px 0 0 var(--bc-medium); });
119
75
  }
120
-
121
- .s-popover--arrow__lc,
122
- .s-popover--arrow__rc {
123
- top: calc(50% - var(--su6));
76
+ & &--arrow__tc,
77
+ & &--arrow__bc {
78
+ --_po-arrow-l: calc(50% - var(--su6));
124
79
  }
125
-
126
- .s-popover--arrow__tr,
80
+ & &--arrow__lc,
81
+ & &--arrow__rc {
82
+ --_po-arrow-t: calc(50% - var(--su6));
83
+ }
84
+ & &--arrow__tr,
127
85
  .s-popover--arrow__br {
128
- right: var(--su12);
86
+ --_po-arrow-r: var(--su12);
129
87
  }
130
-
131
- .s-popover--arrow__rb,
132
- .s-popover--arrow__lb {
133
- bottom: var(--su12);
88
+ & &--arrow__rb,
89
+ & &--arrow__lb {
90
+ --_po-arrow-b: var(--su12);
134
91
  }
135
- }
136
-
137
- // ============================================================================
138
- // $ CLOSE BUTTON
139
- // ----------------------------------------------------------------------------
140
-
141
- .s-popover--close {
142
- float: right; // Use floats for title wrapping
143
- top: calc(var(--su8) * -1); // Compensate for s-popover's padding
144
- right: calc(var(--su8) * -1); // Compensate for s-popover's padding
145
- padding: var(--su8) !important;
146
- }
147
-
148
- // ============================================================================
149
- // $ ARROWS
150
- // ----------------------------------------------------------------------------
151
- //
152
- // TABLE OF CONTENTS
153
- // • BASE STYLE
154
- // • LOCATIONS
155
- // • TOP
156
- // • BOTTOM
157
- // • TOP & BOTTOM DIRECTIONS (Left, Center, Right)
158
- // • LEFT
159
- // • RIGHT
160
- // • LEFT & RIGHT DIRECTIONS (Top, Center, Bottom)
161
- //
162
- // ============================================================================
163
- // $ BASE STYLE
164
- // Sets the base arrow style for tooltips, popovers, and dropdowns.
165
- // ----------------------------------------------------------------------------
92
+ & &--arrow {
93
+ &,
94
+ &:before,
95
+ &:after {
96
+ display: block;
97
+ height: var(--su12);
98
+ position: absolute;
99
+ width: var(--su12);
100
+ z-index: -1;
101
+ }
102
+ &:before, // This renders our border
103
+ &:after {
104
+ content: '';
105
+ transform: rotate(45deg);
106
+ }
107
+ &:after { // This renders our foreground color
108
+ bottom: var(--_po-arrow-after-b);
109
+ box-shadow: var(--_po-arrow-after-bs);
110
+ left: var(--_po-arrow-after-l);
111
+ right: var(--_po-arrow-after-r);
112
+ top: var(--_po-arrow-after-t);
113
+
114
+ background: currentColor;
115
+ border-radius: calc(var(--su-static1) * 1.5);
116
+ }
166
117
 
167
- .s-popover--arrow,
168
- .s-popover--arrow:before,
169
- .s-popover--arrow:after {
118
+ bottom: var(--_po-arrow-b);
119
+ color: var(--_po-arrow-fc);
120
+ left: var(--_po-arrow-l);
121
+ right: var(--_po-arrow-r);
122
+ top: var(--_po-arrow-t);
123
+ }
124
+ // Close btn
125
+ & &--close {
126
+ float: right; // Use floats for title wrapping
127
+ top: calc(var(--su8) * -1); // Compensate for s-popover's padding
128
+ right: calc(var(--su8) * -1); // Compensate for s-popover's padding
129
+ padding: var(--su8) !important;
130
+ }
131
+
132
+ background-color: var(--_po-bg);
133
+ border: 1px solid var(--_po-bc);
134
+ box-shadow: var(--_po-bs);
135
+ display: var(--_po-d);
136
+ min-width: var(--_po-wmn);
137
+ width: var(--_po-w);
138
+
139
+ border-radius: var(--br-md);
140
+ color: var(--fc-dark);
141
+ font-size: var(--fs-body1);
142
+ max-width: 24rem;
143
+ padding: var(--su12);
170
144
  position: absolute;
171
- display: block;
172
- width: var(--su12);
173
- height: var(--su12);
174
- z-index: -1;
175
- }
176
-
177
- .s-popover--arrow {
178
- color: var(--white);
179
-
180
- .dark-mode({
181
- color: var(--black-075);
182
- });
183
- }
184
-
185
- .s-popover--arrow:before {
186
- // This renders our border
187
- content: '';
188
- transform: rotate(45deg);
189
- }
190
-
191
- .s-popover--arrow:after {
192
- // This renders our foreground color
193
- content: '';
194
- transform: rotate(45deg);
195
- border-radius: 1.5px;
196
- background: currentColor;
197
- }
145
+ white-space: normal; // Guard against popovers being in a container with white-space: nowrap. Without this, the content pops *out* of the popover.
146
+ z-index: var(--zi-popovers);
147
+ }
148
+
@@ -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
- position: relative;
18
- width: var(--su-static24);
19
- height: var(--su-static24);
20
- text-align: left; // 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.
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
- &.s-spinner__xs {
43
- width: var(--su-static12);
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
- // Cross-browser fixes. These are all practically no-ops, so we could just specify them
79
- // without browser hacks, but that would be punishing non-broken browsers with extra
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
- position: relative;
101
- padding-left: 2.2em;
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
- opacity: 0.3;
107
- left: 0.6em;
108
- top: calc(50% - 0.6em);
109
- width: 1.23076923em;
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
- border-radius: var(--br-circle);
70
+ opacity: 0.3;
115
71
  }
116
-
117
72
  &:after {
118
- content: "";
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
- border-radius: var(--br-circle);
129
- animation: s-spinner-rotate 0.9s infinite
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.