@stackoverflow/stacks 2.5.3 → 2.5.5

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 (101) hide show
  1. package/LICENSE.MD +9 -9
  2. package/README.md +180 -180
  3. package/dist/css/stacks.css +104 -122
  4. package/dist/css/stacks.min.css +1 -1
  5. package/lib/atomic/border.less +139 -139
  6. package/lib/atomic/color.less +36 -36
  7. package/lib/atomic/flex.less +426 -426
  8. package/lib/atomic/gap.less +44 -44
  9. package/lib/atomic/grid.less +139 -139
  10. package/lib/atomic/misc.less +374 -374
  11. package/lib/atomic/spacing.less +98 -98
  12. package/lib/atomic/typography.less +264 -264
  13. package/lib/atomic/width-height.less +194 -194
  14. package/lib/base/body.less +44 -44
  15. package/lib/base/configuration-static.less +61 -61
  16. package/lib/base/fieldset.less +5 -5
  17. package/lib/base/icon.less +11 -11
  18. package/lib/base/internal.less +220 -220
  19. package/lib/base/reset-meyer.less +64 -64
  20. package/lib/base/reset-normalize.less +449 -449
  21. package/lib/base/reset.less +20 -20
  22. package/lib/components/activity-indicator/activity-indicator.less +53 -53
  23. package/lib/components/anchor/anchor.less +78 -68
  24. package/lib/components/avatar/avatar.less +108 -108
  25. package/lib/components/award-bling/award-bling.less +31 -31
  26. package/lib/components/badge/badge.less +258 -258
  27. package/lib/components/banner/banner.less +44 -44
  28. package/lib/components/banner/banner.ts +149 -149
  29. package/lib/components/block-link/block-link.less +82 -82
  30. package/lib/components/breadcrumbs/breadcrumbs.less +41 -41
  31. package/lib/components/button/button.less +473 -473
  32. package/lib/components/button-group/button-group.less +82 -82
  33. package/lib/components/card/card.less +37 -37
  34. package/lib/components/check-control/check-control.less +17 -17
  35. package/lib/components/check-group/check-group.less +19 -19
  36. package/lib/components/checkbox_radio/checkbox_radio.less +159 -159
  37. package/lib/components/code-block/code-block.fixtures.ts +88 -88
  38. package/lib/components/code-block/code-block.less +116 -116
  39. package/lib/components/description/description.less +9 -9
  40. package/lib/components/empty-state/empty-state.less +16 -16
  41. package/lib/components/expandable/expandable.less +118 -118
  42. package/lib/components/expandable/expandable.ts +238 -238
  43. package/lib/components/input-fill/input-fill.less +35 -35
  44. package/lib/components/input-icon/input-icon.less +45 -45
  45. package/lib/components/input-message/input-message.less +49 -49
  46. package/lib/components/input_textarea/input_textarea.less +150 -150
  47. package/lib/components/label/label.less +110 -110
  48. package/lib/components/link/link.less +135 -120
  49. package/lib/components/link-preview/link-preview.less +148 -148
  50. package/lib/components/menu/menu.less +41 -41
  51. package/lib/components/modal/modal.less +118 -118
  52. package/lib/components/modal/modal.ts +383 -383
  53. package/lib/components/navigation/navigation.less +136 -136
  54. package/lib/components/navigation/navigation.ts +128 -128
  55. package/lib/components/notice/notice.less +195 -195
  56. package/lib/components/page-title/page-title.less +51 -51
  57. package/lib/components/pagination/pagination.less +65 -65
  58. package/lib/components/popover/popover.less +159 -157
  59. package/lib/components/popover/popover.ts +651 -651
  60. package/lib/components/popover/tooltip.ts +343 -343
  61. package/lib/components/post-summary/post-summary.less +457 -447
  62. package/lib/components/progress-bar/progress-bar.less +291 -291
  63. package/lib/components/prose/prose.less +452 -452
  64. package/lib/components/select/select.less +138 -138
  65. package/lib/components/sidebar-widget/sidebar-widget.less +257 -257
  66. package/lib/components/spinner/spinner.less +103 -103
  67. package/lib/components/table/table.less +307 -307
  68. package/lib/components/table/table.ts +296 -296
  69. package/lib/components/table-container/table-container.less +4 -4
  70. package/lib/components/tag/tag.less +186 -186
  71. package/lib/components/toast/toast.less +35 -35
  72. package/lib/components/toast/toast.ts +357 -357
  73. package/lib/components/toggle-switch/toggle-switch.less +104 -104
  74. package/lib/components/topbar/topbar.less +553 -553
  75. package/lib/components/uploader/uploader.less +205 -205
  76. package/lib/components/uploader/uploader.ts +207 -207
  77. package/lib/components/user-card/user-card.less +129 -129
  78. package/lib/controllers.ts +33 -33
  79. package/lib/exports/color-mixins.less +283 -283
  80. package/lib/exports/color-sets.less +711 -711
  81. package/lib/exports/color.less +65 -65
  82. package/lib/exports/constants-helpers.less +108 -108
  83. package/lib/exports/constants-type.less +155 -155
  84. package/lib/exports/exports.less +15 -15
  85. package/lib/exports/mixins.less +333 -333
  86. package/lib/exports/spacing-mixins.less +67 -67
  87. package/lib/index.ts +32 -32
  88. package/lib/input-utils.less +41 -41
  89. package/lib/stacks-dynamic.less +24 -24
  90. package/lib/stacks-static.less +93 -93
  91. package/lib/stacks.less +13 -13
  92. package/lib/stacks.ts +113 -113
  93. package/lib/test/a11y-test-utils.ts +94 -94
  94. package/lib/test/assertions.ts +36 -36
  95. package/lib/test/less-test-utils.ts +28 -28
  96. package/lib/test/open-wc-testing-patch.d.ts +26 -26
  97. package/lib/test/test-utils.ts +364 -364
  98. package/lib/test/visual-test-utils.ts +58 -58
  99. package/lib/tsconfig.build.json +4 -4
  100. package/lib/tsconfig.json +17 -17
  101. package/package.json +115 -115
@@ -1,333 +1,333 @@
1
- /* stylelint-disable indentation */
2
- //
3
- // STACK OVERFLOW
4
- // MIXINS
5
- //
6
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
7
- // Stack Overflow. For documentation of all these classes and how to contribute,
8
- // visit https://stackoverflow.design/
9
- //
10
- // ============================================================================
11
- // $ Clearfix
12
- // -----------------------------------------------------------------------------
13
- .clearfix() {
14
- &:before,
15
- &:after {
16
- content: "";
17
- display: table;
18
- }
19
- &:after { clear: both; }
20
- }
21
-
22
- // ============================================================================
23
- // -- LIGHTMODE
24
- // .light-mode-forced ensures light color scheme is used in .theme-light__forced
25
- //
26
- // .light-mode-forced({ color: var(--black-600) });
27
- //
28
- // ---------------------------------------------------------------------------
29
-
30
- .light-mode-forced(@rules) {
31
- .theme-light__forced &,
32
- body.theme-system .theme-light__forced &,
33
- body.theme-dark .theme-light__forced & {
34
- @rules();
35
- }
36
- }
37
-
38
- // ===========================================================================
39
- // -- DARKMODE
40
- // .darkmode renders a dark mode override behind the
41
- // prefers-color-scheme: dark media query and .theme-system. It also
42
- // renders the same rules outside of the media query with .theme-dark
43
- //
44
- // Usage example:
45
- //
46
- // .dark-mode({ background-color: var(--black-100); });
47
- //
48
- // ---------------------------------------------------------------------------
49
-
50
- .dark-mode(@rules) {
51
- body.theme-system & {
52
- @media (prefers-color-scheme: dark) {
53
- @rules();
54
- }
55
- }
56
-
57
- body.theme-dark &,
58
- .theme-dark__forced &,
59
- body.theme-system .theme-dark__forced & {
60
- @rules();
61
- }
62
- }
63
-
64
- // ===========================================================================
65
- // -- HIGHCONTRAST
66
- // .highcontrast-mode renders a high contrast mode override for .theme-highcontrast
67
- //
68
- // Usage example:
69
- //
70
- // .highcontrast-mode({ background-color: var(--black-100); });
71
- //
72
- // ---------------------------------------------------------------------------
73
-
74
- .highcontrast-mode(@rules) {
75
- body.theme-highcontrast & {
76
- @rules();
77
- }
78
- }
79
-
80
- .highcontrast-dark-mode(@rules) {
81
- body.theme-highcontrast.theme-system & {
82
- @media (prefers-color-scheme: dark) {
83
- @rules();
84
- }
85
- }
86
- body.theme-highcontrast.theme-dark & {
87
- @rules();
88
- }
89
- }
90
-
91
- // ===========================================================================
92
- // -- FONT FACE
93
- // Used to load hosted, custom webfonts. You must provide the font's
94
- // full file path in the mixin. All modern browsers the WOFF file format.
95
- // Will automatically add various local()s to try using already-installed
96
- // fonts before downloading.
97
- // ---------------------------------------------------------------------------
98
- .font-face(@family, @path, @weight, @style) {
99
- @font-face {
100
- font-family: "@{family}";
101
- font-style: @style;
102
- font-weight: @weight;
103
- & when (@style=italic) {
104
- #stacks-internals #font-face-src(@family, @path, @weight, " Italic");
105
- }
106
- & when not (@style=italic) {
107
- #stacks-internals #font-face-src(@family, @path, @weight, "");
108
- }
109
- }
110
- }
111
-
112
-
113
- /**
114
- * Focus styles for the given context.
115
- *
116
- * Usage example:
117
- * .focus-styles(true, true);
118
- *
119
- * @inset: boolean - whether the focus style be placed inside the element.
120
- * @border: boolean - whether the element's border color change to match the focus style.
121
- */
122
- .focus-styles(@inset: false, @border: false) {
123
- & when not (@inset) and not (@border) {
124
- box-shadow: 0 0 0 var(--su-static2) var(--focus-neutral), 0 0 0 var(--su-static4) var(--focus-theme);
125
- }
126
-
127
- & when not (@inset) and (@border) {
128
- border-color: var(--focus-neutral) !important;
129
- box-shadow: 0 0 0 var(--su-static1) var(--focus-neutral), 0 0 0 calc(var(--su-static4) - var(--su-static1)) var(--focus-theme);
130
- }
131
-
132
- & when (@inset) and not (@border) {
133
- box-shadow: inset 0 0 0 var(--su-static2) var(--focus-theme), inset 0 0 0 var(--su-static4) var(--focus-neutral);
134
- }
135
-
136
- & when (@inset) and (@border) {
137
- border-color: var(--focus-theme) !important;
138
- box-shadow: inset 0 0 0 var(--su-static1) var(--focus-theme), inset 0 0 0 calc(var(--su-static4) - var(--su-static1)) var(--focus-neutral);
139
- }
140
-
141
- // We include a 2px transparent outline to ensure Windows High Contrast Forced Color Mode
142
- // includes outlines as expected See https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/
143
- outline: var(--su-static2) solid transparent !important;
144
- }
145
-
146
- // =============================================================================
147
- // -- COLORS
148
- // The following mixins let us do color math on the browser. They take a
149
- // color prefix, and they expect the different values to be stored in
150
- // --{prefix}-h, --{prefix}-s and --{prefix}-l
151
- // -----------------------------------------------------------------------------
152
-
153
- .load-color-variables(@amount) {
154
- @amountDecimal: (@amount / 100);
155
- @amountPercentage: @amount * 1%;
156
- @complementDecimal: 1 - @amountDecimal;
157
- @additionDecimal: 1 + @amountDecimal;
158
- }
159
-
160
- .assemble-color(@color-prefix) {
161
- @result: hsl(var(~"--@{color-prefix}-h"),
162
- var(~"--@{color-prefix}-s"),
163
- var(~"--@{color-prefix}-l"));
164
- }
165
-
166
- // Increase the lightness of a color in the HSL color space by an absolute amount.
167
- .native-lighten(@color-prefix, @amount) {
168
- .load-color-variables(@amount);
169
- @result: hsl(var(~"--@{color-prefix}-h"),
170
- var(~"--@{color-prefix}-s"),
171
- calc(var(~"--@{color-prefix}-l") + @amountPercentage));
172
- }
173
-
174
- // Decrease the lightness and saturation of a color in the HSL color space by absolute amounts.
175
- .native-darken-desaturate(@color-prefix, @darken-amount, @desaturate-amount) {
176
- @darkenAmountPercentage: .load-color-variables(@darken-amount)[@amountPercentage];
177
- @desaturateAmountPercentage: .load-color-variables(@desaturate-amount)[@amountPercentage];
178
- @result: hsl(var(~"--@{color-prefix}-h"),
179
- calc(var(~"--@{color-prefix}-s") - @desaturateAmountPercentage),
180
- calc(var(~"--@{color-prefix}-l") - @darkenAmountPercentage));
181
- }
182
-
183
-
184
- // Decrease the lightness of a color in the HSL color space by an absolute amount.
185
- .native-darken(@color-prefix, @amount) {
186
- .load-color-variables(@amount);
187
- @result: hsl(var(~"--@{color-prefix}-h"),
188
- var(~"--@{color-prefix}-s"),
189
- calc(var(~"--@{color-prefix}-l") - @amountPercentage));
190
- }
191
-
192
- // Mix color with white in variable proportion
193
- .native-tint(@color-prefix, @amount) {
194
- .load-color-variables(@amount);
195
- @ramount: 255 * @amountDecimal;
196
- @gamount: 255 * @amountDecimal;
197
- @bamount: 255 * @amountDecimal;
198
- @result: rgb(calc(@ramount + var(~"--@{color-prefix}-r") * @complementDecimal),
199
- calc(@gamount + var(~"--@{color-prefix}-g") * @complementDecimal),
200
- calc(@bamount + var(~"--@{color-prefix}-b") * @complementDecimal));
201
- }
202
-
203
- // Mix color with black in variable proportion
204
- .native-shade(@color-prefix, @amount) {
205
- .load-color-variables(@amount);
206
- @result: rgb(calc(var(~"--@{color-prefix}-r") * @complementDecimal),
207
- calc(var(~"--@{color-prefix}-g") * @complementDecimal),
208
- calc(var(~"--@{color-prefix}-b") * @complementDecimal));
209
- }
210
-
211
- // Set the absolute opacity of a color.
212
- .native-fade(@color-prefix, @amount) {
213
- .load-color-variables(@amount);
214
- @result: hsla(var(~"--@{color-prefix}-h"),
215
- var(~"--@{color-prefix}-s"),
216
- var(~"--@{color-prefix}-l"),
217
- @amountDecimal);
218
- }
219
-
220
- // =============================================================================
221
- // -- SIZE STYLES
222
- // The following mixins let us generate pseudo-private custom properties
223
- // for common sizes. They expect a size (@size), a prefix for the custom
224
- // property (@prefix), and an array of comma-separates abbreviated styles
225
- // (@styles).
226
- // -----------------------------------------------------------------------------
227
-
228
- .size-styles(@size, @prefix, @styles, @index: length(@styles)) {
229
- & when (@index > 0) {
230
- @style: extract(@styles, @index);
231
-
232
- // xs
233
- & when (@size = xs) and (@style = fs) {
234
- --_@{prefix}-fs: var(--fs-fine);
235
- }
236
-
237
- // sm
238
- & when (@size = sm) and (@style = fs) {
239
- --_@{prefix}-fs: var(--fs-caption);
240
- }
241
-
242
- // md
243
- & when (@size = md) and (@style = br) {
244
- --_@{prefix}-br: calc(var(--br-sm) + var(--su-static1));
245
- }
246
- & when (@size = md) and (@style = fs) {
247
- --_@{prefix}-fs: var(--fs-body3);
248
- }
249
-
250
- // lg
251
- & when (@size = lg) and (@style = br) {
252
- --_@{prefix}-br: calc(var(--br-sm) + var(--su-static1));
253
- }
254
- & when (@size = lg) and (@style = fs) {
255
- --_@{prefix}-fs: var(--fs-title);
256
- }
257
-
258
- // xl
259
- & when (@size = xl) and (@style = br) {
260
- --_@{prefix}-br: var(--br-md);
261
- }
262
- & when (@size = xl) and (@style = fs) {
263
- --_@{prefix}-fs: var(--fs-headline1);
264
- }
265
-
266
- .size-styles(@size, @prefix, @styles, @index: @index - 1);
267
- }
268
- }
269
-
270
- // =============================================================================
271
- // -- WEBKIT AUTOFILL
272
- // -----------------------------------------------------------------------------
273
- .webkit-autofill() {
274
- &:-webkit-autofill {
275
- &:focus {
276
- border-color: var(--blue-400);
277
- // Since the box shadow is overwritten to show a background, we have to re-add the focus outline
278
- -webkit-box-shadow: 0 0 0 1000px var(--blue-200) inset, 0 0 0 var(--su-static4) var(--focus-ring);
279
- }
280
-
281
- -webkit-box-shadow: 0 0 0 1000px var(--theme-secondary-200) inset; // This acts as a background color by stretching an inset box shadow across the input
282
- -webkit-text-fill-color: var(--black);
283
- border-color: var(--blue-400);
284
- transition: background-color 0s 50000s; // A hack to infinitely delay background styles that come from the browser.
285
- }
286
-
287
- &::-webkit-contacts-auto-fill-button {
288
- background-color: var(--black); // In Safari, make the autocomplete button darkmode-aware
289
- }
290
-
291
- }
292
-
293
- // ===========================================================================
294
- // Internals only beyond this point -- helpers for .font-face()
295
- // ---------------------------------------------------------------------------
296
-
297
-
298
- #stacks-internals() {
299
-
300
- // Generate all common variants for local names that this font face may have.
301
- // The CSS spec (Font Module Level 3, Section 4.3) says to use "only the Postscript
302
- // name or the full font name".
303
- // For example, given the family "Comic Sans MS", weight 800, italic, we're
304
- // trying these local names:
305
- //
306
- // - Comic Sans MS Extra Bold Italic
307
- // - ComicSansMS-ExtraBoldItalic
308
- // - Comic Sans MS 800 Italic
309
- // - ComicSansMS-800Italic
310
- //
311
- // For the weight 400 we also include the un-weight-postfixed name ("Comic Sans MS Italic").
312
-
313
- #font-face-src(@family, @path, @weight, @style-postfix) {
314
- @index: round(@weight/100);
315
- @weight-names: "Thin", "Extra Light", "Light", "Regular", "Medium", "Semi Bold", "Bold", "Extra Bold", "Black";
316
- @weight-name: extract(@weight-names, @index);
317
- #stacks-internals #font-face-src-postfix(@family, @path, "@{weight-name}", @weight, @style-postfix);
318
- }
319
-
320
- #font-face-src-postfix(@family, @path, @postfix-name, @postfix-number, @style-postfix) {
321
- @family-nospace: replace(@family, " ", "");
322
- @postfix-name-nospace: replace("@{postfix-name}@{style-postfix}", " ", "");
323
- @postfix-number-nospace: replace("@{postfix-number}@{style-postfix}", " ", "");
324
-
325
- & when (@postfix-name="Regular") {
326
- src: local("@{family} @{postfix-name}@{style-postfix}"), local("@{family-nospace}-@{postfix-name-nospace}"), local("@{family} @{postfix-number}@{style-postfix}"), local("@{family-nospace}-@{postfix-number-nospace}"), local("@{family}@{style-postfix}"), @path format("woff");
327
- }
328
-
329
- & when not (@postfix-name="Regular") {
330
- src: local("@{family} @{postfix-name}@{style-postfix}"), local("@{family-nospace}-@{postfix-name-nospace}"), local("@{family} @{postfix-number}@{style-postfix}"), local("@{family-nospace}-@{postfix-number-nospace}"), @path format("woff");
331
- }
332
- }
333
- }
1
+ /* stylelint-disable indentation */
2
+ //
3
+ // STACK OVERFLOW
4
+ // MIXINS
5
+ //
6
+ // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
7
+ // Stack Overflow. For documentation of all these classes and how to contribute,
8
+ // visit https://stackoverflow.design/
9
+ //
10
+ // ============================================================================
11
+ // $ Clearfix
12
+ // -----------------------------------------------------------------------------
13
+ .clearfix() {
14
+ &:before,
15
+ &:after {
16
+ content: "";
17
+ display: table;
18
+ }
19
+ &:after { clear: both; }
20
+ }
21
+
22
+ // ============================================================================
23
+ // -- LIGHTMODE
24
+ // .light-mode-forced ensures light color scheme is used in .theme-light__forced
25
+ //
26
+ // .light-mode-forced({ color: var(--black-600) });
27
+ //
28
+ // ---------------------------------------------------------------------------
29
+
30
+ .light-mode-forced(@rules) {
31
+ .theme-light__forced &,
32
+ body.theme-system .theme-light__forced &,
33
+ body.theme-dark .theme-light__forced & {
34
+ @rules();
35
+ }
36
+ }
37
+
38
+ // ===========================================================================
39
+ // -- DARKMODE
40
+ // .darkmode renders a dark mode override behind the
41
+ // prefers-color-scheme: dark media query and .theme-system. It also
42
+ // renders the same rules outside of the media query with .theme-dark
43
+ //
44
+ // Usage example:
45
+ //
46
+ // .dark-mode({ background-color: var(--black-100); });
47
+ //
48
+ // ---------------------------------------------------------------------------
49
+
50
+ .dark-mode(@rules) {
51
+ body.theme-system & {
52
+ @media (prefers-color-scheme: dark) {
53
+ @rules();
54
+ }
55
+ }
56
+
57
+ body.theme-dark &,
58
+ .theme-dark__forced &,
59
+ body.theme-system .theme-dark__forced & {
60
+ @rules();
61
+ }
62
+ }
63
+
64
+ // ===========================================================================
65
+ // -- HIGHCONTRAST
66
+ // .highcontrast-mode renders a high contrast mode override for .theme-highcontrast
67
+ //
68
+ // Usage example:
69
+ //
70
+ // .highcontrast-mode({ background-color: var(--black-100); });
71
+ //
72
+ // ---------------------------------------------------------------------------
73
+
74
+ .highcontrast-mode(@rules) {
75
+ body.theme-highcontrast & {
76
+ @rules();
77
+ }
78
+ }
79
+
80
+ .highcontrast-dark-mode(@rules) {
81
+ body.theme-highcontrast.theme-system & {
82
+ @media (prefers-color-scheme: dark) {
83
+ @rules();
84
+ }
85
+ }
86
+ body.theme-highcontrast.theme-dark & {
87
+ @rules();
88
+ }
89
+ }
90
+
91
+ // ===========================================================================
92
+ // -- FONT FACE
93
+ // Used to load hosted, custom webfonts. You must provide the font's
94
+ // full file path in the mixin. All modern browsers the WOFF file format.
95
+ // Will automatically add various local()s to try using already-installed
96
+ // fonts before downloading.
97
+ // ---------------------------------------------------------------------------
98
+ .font-face(@family, @path, @weight, @style) {
99
+ @font-face {
100
+ font-family: "@{family}";
101
+ font-style: @style;
102
+ font-weight: @weight;
103
+ & when (@style=italic) {
104
+ #stacks-internals #font-face-src(@family, @path, @weight, " Italic");
105
+ }
106
+ & when not (@style=italic) {
107
+ #stacks-internals #font-face-src(@family, @path, @weight, "");
108
+ }
109
+ }
110
+ }
111
+
112
+
113
+ /**
114
+ * Focus styles for the given context.
115
+ *
116
+ * Usage example:
117
+ * .focus-styles(true, true);
118
+ *
119
+ * @inset: boolean - whether the focus style be placed inside the element.
120
+ * @border: boolean - whether the element's border color change to match the focus style.
121
+ */
122
+ .focus-styles(@inset: false, @border: false) {
123
+ & when not (@inset) and not (@border) {
124
+ box-shadow: 0 0 0 var(--su-static2) var(--focus-neutral), 0 0 0 var(--su-static4) var(--focus-theme);
125
+ }
126
+
127
+ & when not (@inset) and (@border) {
128
+ border-color: var(--focus-neutral) !important;
129
+ box-shadow: 0 0 0 var(--su-static1) var(--focus-neutral), 0 0 0 calc(var(--su-static4) - var(--su-static1)) var(--focus-theme);
130
+ }
131
+
132
+ & when (@inset) and not (@border) {
133
+ box-shadow: inset 0 0 0 var(--su-static2) var(--focus-theme), inset 0 0 0 var(--su-static4) var(--focus-neutral);
134
+ }
135
+
136
+ & when (@inset) and (@border) {
137
+ border-color: var(--focus-theme) !important;
138
+ box-shadow: inset 0 0 0 var(--su-static1) var(--focus-theme), inset 0 0 0 calc(var(--su-static4) - var(--su-static1)) var(--focus-neutral);
139
+ }
140
+
141
+ // We include a 2px transparent outline to ensure Windows High Contrast Forced Color Mode
142
+ // includes outlines as expected See https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/
143
+ outline: var(--su-static2) solid transparent !important;
144
+ }
145
+
146
+ // =============================================================================
147
+ // -- COLORS
148
+ // The following mixins let us do color math on the browser. They take a
149
+ // color prefix, and they expect the different values to be stored in
150
+ // --{prefix}-h, --{prefix}-s and --{prefix}-l
151
+ // -----------------------------------------------------------------------------
152
+
153
+ .load-color-variables(@amount) {
154
+ @amountDecimal: (@amount / 100);
155
+ @amountPercentage: @amount * 1%;
156
+ @complementDecimal: 1 - @amountDecimal;
157
+ @additionDecimal: 1 + @amountDecimal;
158
+ }
159
+
160
+ .assemble-color(@color-prefix) {
161
+ @result: hsl(var(~"--@{color-prefix}-h"),
162
+ var(~"--@{color-prefix}-s"),
163
+ var(~"--@{color-prefix}-l"));
164
+ }
165
+
166
+ // Increase the lightness of a color in the HSL color space by an absolute amount.
167
+ .native-lighten(@color-prefix, @amount) {
168
+ .load-color-variables(@amount);
169
+ @result: hsl(var(~"--@{color-prefix}-h"),
170
+ var(~"--@{color-prefix}-s"),
171
+ calc(var(~"--@{color-prefix}-l") + @amountPercentage));
172
+ }
173
+
174
+ // Decrease the lightness and saturation of a color in the HSL color space by absolute amounts.
175
+ .native-darken-desaturate(@color-prefix, @darken-amount, @desaturate-amount) {
176
+ @darkenAmountPercentage: .load-color-variables(@darken-amount)[@amountPercentage];
177
+ @desaturateAmountPercentage: .load-color-variables(@desaturate-amount)[@amountPercentage];
178
+ @result: hsl(var(~"--@{color-prefix}-h"),
179
+ calc(var(~"--@{color-prefix}-s") - @desaturateAmountPercentage),
180
+ calc(var(~"--@{color-prefix}-l") - @darkenAmountPercentage));
181
+ }
182
+
183
+
184
+ // Decrease the lightness of a color in the HSL color space by an absolute amount.
185
+ .native-darken(@color-prefix, @amount) {
186
+ .load-color-variables(@amount);
187
+ @result: hsl(var(~"--@{color-prefix}-h"),
188
+ var(~"--@{color-prefix}-s"),
189
+ calc(var(~"--@{color-prefix}-l") - @amountPercentage));
190
+ }
191
+
192
+ // Mix color with white in variable proportion
193
+ .native-tint(@color-prefix, @amount) {
194
+ .load-color-variables(@amount);
195
+ @ramount: 255 * @amountDecimal;
196
+ @gamount: 255 * @amountDecimal;
197
+ @bamount: 255 * @amountDecimal;
198
+ @result: rgb(calc(@ramount + var(~"--@{color-prefix}-r") * @complementDecimal),
199
+ calc(@gamount + var(~"--@{color-prefix}-g") * @complementDecimal),
200
+ calc(@bamount + var(~"--@{color-prefix}-b") * @complementDecimal));
201
+ }
202
+
203
+ // Mix color with black in variable proportion
204
+ .native-shade(@color-prefix, @amount) {
205
+ .load-color-variables(@amount);
206
+ @result: rgb(calc(var(~"--@{color-prefix}-r") * @complementDecimal),
207
+ calc(var(~"--@{color-prefix}-g") * @complementDecimal),
208
+ calc(var(~"--@{color-prefix}-b") * @complementDecimal));
209
+ }
210
+
211
+ // Set the absolute opacity of a color.
212
+ .native-fade(@color-prefix, @amount) {
213
+ .load-color-variables(@amount);
214
+ @result: hsla(var(~"--@{color-prefix}-h"),
215
+ var(~"--@{color-prefix}-s"),
216
+ var(~"--@{color-prefix}-l"),
217
+ @amountDecimal);
218
+ }
219
+
220
+ // =============================================================================
221
+ // -- SIZE STYLES
222
+ // The following mixins let us generate pseudo-private custom properties
223
+ // for common sizes. They expect a size (@size), a prefix for the custom
224
+ // property (@prefix), and an array of comma-separates abbreviated styles
225
+ // (@styles).
226
+ // -----------------------------------------------------------------------------
227
+
228
+ .size-styles(@size, @prefix, @styles, @index: length(@styles)) {
229
+ & when (@index > 0) {
230
+ @style: extract(@styles, @index);
231
+
232
+ // xs
233
+ & when (@size = xs) and (@style = fs) {
234
+ --_@{prefix}-fs: var(--fs-fine);
235
+ }
236
+
237
+ // sm
238
+ & when (@size = sm) and (@style = fs) {
239
+ --_@{prefix}-fs: var(--fs-caption);
240
+ }
241
+
242
+ // md
243
+ & when (@size = md) and (@style = br) {
244
+ --_@{prefix}-br: calc(var(--br-sm) + var(--su-static1));
245
+ }
246
+ & when (@size = md) and (@style = fs) {
247
+ --_@{prefix}-fs: var(--fs-body3);
248
+ }
249
+
250
+ // lg
251
+ & when (@size = lg) and (@style = br) {
252
+ --_@{prefix}-br: calc(var(--br-sm) + var(--su-static1));
253
+ }
254
+ & when (@size = lg) and (@style = fs) {
255
+ --_@{prefix}-fs: var(--fs-title);
256
+ }
257
+
258
+ // xl
259
+ & when (@size = xl) and (@style = br) {
260
+ --_@{prefix}-br: var(--br-md);
261
+ }
262
+ & when (@size = xl) and (@style = fs) {
263
+ --_@{prefix}-fs: var(--fs-headline1);
264
+ }
265
+
266
+ .size-styles(@size, @prefix, @styles, @index: @index - 1);
267
+ }
268
+ }
269
+
270
+ // =============================================================================
271
+ // -- WEBKIT AUTOFILL
272
+ // -----------------------------------------------------------------------------
273
+ .webkit-autofill() {
274
+ &:-webkit-autofill {
275
+ &:focus {
276
+ border-color: var(--blue-400);
277
+ // Since the box shadow is overwritten to show a background, we have to re-add the focus outline
278
+ -webkit-box-shadow: 0 0 0 1000px var(--blue-200) inset, 0 0 0 var(--su-static4) var(--focus-ring);
279
+ }
280
+
281
+ -webkit-box-shadow: 0 0 0 1000px var(--theme-secondary-200) inset; // This acts as a background color by stretching an inset box shadow across the input
282
+ -webkit-text-fill-color: var(--black);
283
+ border-color: var(--blue-400);
284
+ transition: background-color 0s 50000s; // A hack to infinitely delay background styles that come from the browser.
285
+ }
286
+
287
+ &::-webkit-contacts-auto-fill-button {
288
+ background-color: var(--black); // In Safari, make the autocomplete button darkmode-aware
289
+ }
290
+
291
+ }
292
+
293
+ // ===========================================================================
294
+ // Internals only beyond this point -- helpers for .font-face()
295
+ // ---------------------------------------------------------------------------
296
+
297
+
298
+ #stacks-internals() {
299
+
300
+ // Generate all common variants for local names that this font face may have.
301
+ // The CSS spec (Font Module Level 3, Section 4.3) says to use "only the Postscript
302
+ // name or the full font name".
303
+ // For example, given the family "Comic Sans MS", weight 800, italic, we're
304
+ // trying these local names:
305
+ //
306
+ // - Comic Sans MS Extra Bold Italic
307
+ // - ComicSansMS-ExtraBoldItalic
308
+ // - Comic Sans MS 800 Italic
309
+ // - ComicSansMS-800Italic
310
+ //
311
+ // For the weight 400 we also include the un-weight-postfixed name ("Comic Sans MS Italic").
312
+
313
+ #font-face-src(@family, @path, @weight, @style-postfix) {
314
+ @index: round(@weight/100);
315
+ @weight-names: "Thin", "Extra Light", "Light", "Regular", "Medium", "Semi Bold", "Bold", "Extra Bold", "Black";
316
+ @weight-name: extract(@weight-names, @index);
317
+ #stacks-internals #font-face-src-postfix(@family, @path, "@{weight-name}", @weight, @style-postfix);
318
+ }
319
+
320
+ #font-face-src-postfix(@family, @path, @postfix-name, @postfix-number, @style-postfix) {
321
+ @family-nospace: replace(@family, " ", "");
322
+ @postfix-name-nospace: replace("@{postfix-name}@{style-postfix}", " ", "");
323
+ @postfix-number-nospace: replace("@{postfix-number}@{style-postfix}", " ", "");
324
+
325
+ & when (@postfix-name="Regular") {
326
+ src: local("@{family} @{postfix-name}@{style-postfix}"), local("@{family-nospace}-@{postfix-name-nospace}"), local("@{family} @{postfix-number}@{style-postfix}"), local("@{family-nospace}-@{postfix-number-nospace}"), local("@{family}@{style-postfix}"), @path format("woff");
327
+ }
328
+
329
+ & when not (@postfix-name="Regular") {
330
+ src: local("@{family} @{postfix-name}@{style-postfix}"), local("@{family-nospace}-@{postfix-name-nospace}"), local("@{family} @{postfix-number}@{style-postfix}"), local("@{family-nospace}-@{postfix-number-nospace}"), @path format("woff");
331
+ }
332
+ }
333
+ }