@stackoverflow/stacks 1.0.0-beta.0 → 1.1.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 (74) hide show
  1. package/README.md +47 -47
  2. package/dist/controllers/s-popover.d.ts +11 -2
  3. package/dist/css/stacks.css +214 -3
  4. package/dist/css/stacks.min.css +1 -1
  5. package/dist/js/stacks.js +18 -2
  6. package/dist/js/stacks.min.js +1 -1
  7. package/lib/css/atomic/borders.less +378 -378
  8. package/lib/css/atomic/colors.less +209 -209
  9. package/lib/css/atomic/flex.less +375 -375
  10. package/lib/css/atomic/grid.less +174 -174
  11. package/lib/css/atomic/misc.less +343 -343
  12. package/lib/css/atomic/spacing.less +342 -314
  13. package/lib/css/atomic/typography.less +273 -273
  14. package/lib/css/atomic/width-height.less +194 -194
  15. package/lib/css/base/body.less +44 -44
  16. package/lib/css/base/configuration-static.less +61 -61
  17. package/lib/css/base/icons.less +20 -20
  18. package/lib/css/base/internals.less +220 -220
  19. package/lib/css/base/reset-meyer.less +64 -64
  20. package/lib/css/base/reset-normalize.less +449 -449
  21. package/lib/css/base/reset.less +20 -20
  22. package/lib/css/components/activity-indicator.less +44 -45
  23. package/lib/css/components/avatars.less +189 -189
  24. package/lib/css/components/badges.less +209 -209
  25. package/lib/css/components/banners.less +80 -80
  26. package/lib/css/components/blank-states.less +26 -26
  27. package/lib/css/components/breadcrumbs.less +44 -44
  28. package/lib/css/components/button-groups.less +104 -104
  29. package/lib/css/components/buttons.less +665 -665
  30. package/lib/css/components/cards.less +44 -44
  31. package/lib/css/components/code-blocks.less +130 -130
  32. package/lib/css/components/collapsible.less +104 -104
  33. package/lib/css/components/inputs.less +728 -728
  34. package/lib/css/components/link-previews.less +136 -136
  35. package/lib/css/components/links.less +218 -218
  36. package/lib/css/components/menu.less +47 -47
  37. package/lib/css/components/modals.less +133 -133
  38. package/lib/css/components/navigation.less +146 -146
  39. package/lib/css/components/notices.less +233 -233
  40. package/lib/css/components/page-titles.less +60 -60
  41. package/lib/css/components/pagination.less +55 -55
  42. package/lib/css/components/popovers.less +197 -197
  43. package/lib/css/components/post-summary.less +425 -425
  44. package/lib/css/components/progress-bars.less +330 -330
  45. package/lib/css/components/prose.less +503 -503
  46. package/lib/css/components/spinner.less +107 -107
  47. package/lib/css/components/tables.less +341 -341
  48. package/lib/css/components/tags.less +236 -236
  49. package/lib/css/components/toggle-switches.less +144 -144
  50. package/lib/css/components/topbar.less +427 -427
  51. package/lib/css/components/uploader.less +210 -210
  52. package/lib/css/components/user-cards.less +169 -169
  53. package/lib/css/components/widget-dynamic.less +33 -33
  54. package/lib/css/components/widget-static.less +273 -273
  55. package/lib/css/exports/constants-colors.less +1092 -1092
  56. package/lib/css/exports/constants-helpers.less +108 -108
  57. package/lib/css/exports/constants-type.less +153 -153
  58. package/lib/css/exports/exports.less +15 -15
  59. package/lib/css/exports/mixins.less +237 -237
  60. package/lib/css/stacks-dynamic.less +35 -35
  61. package/lib/css/stacks-static.less +86 -86
  62. package/lib/css/stacks.less +13 -13
  63. package/lib/ts/controllers/index.ts +7 -7
  64. package/lib/ts/controllers/s-expandable-control.ts +188 -188
  65. package/lib/ts/controllers/s-modal.ts +321 -321
  66. package/lib/ts/controllers/s-navigation-tablist.ts +117 -117
  67. package/lib/ts/controllers/s-popover.ts +567 -547
  68. package/lib/ts/controllers/s-table.ts +220 -220
  69. package/lib/ts/controllers/s-tooltip.ts +246 -246
  70. package/lib/ts/controllers/s-uploader.ts +172 -172
  71. package/lib/ts/index.ts +20 -20
  72. package/lib/ts/stacks.ts +88 -88
  73. package/lib/tsconfig.json +13 -13
  74. package/package.json +86 -87
@@ -1,375 +1,375 @@
1
- //
2
- // STACK OVERFLOW
3
- // FLEXBOX HELPERS
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
- // • MIXINS
12
- // • FLEX ELEMENTS
13
- // • FLEX SPACING
14
- // • MODIFICATIONS
15
- // • ATOMIC
16
- // • DEPRECATED
17
- //
18
- // ============================================================================
19
- // -- STACKS FLEX LAYOUT MIXINS
20
- // ============================================================================
21
- // -- FIXED COLUMN WIDTHS
22
- // ----------------------------------------------------------------------------
23
-
24
- #stacks-internals() {
25
- #flex-builder-settings() {
26
- @flex-cols: 12; // Desired flex columns
27
- }
28
- #flex-builder-helpers() {
29
- #stacks-internals #flex-builder-settings();
30
-
31
- .create-fixed-items(@num, @count: 1) when (@count =< @num) {
32
- .flex--item@{count} {
33
- flex-basis: ((@count * 100%) / @num);
34
- }
35
-
36
- #stacks-internals #flex-builder-helpers .create-fixed-items(@num, (@count + 1));
37
- }
38
-
39
- // -- AUTO FIXED WIDTH ITEMS
40
- // Automatic adjusting width items are great. And being able to specify an
41
- // item's width is equally amazing. But sometimes you want to be able to
42
- // have all items within a box container to be the same width. Instead
43
- // stating a fixed item width, apply a modifying to the box container and
44
- // all child elements will automatically be sized.
45
- // ----------------------------------------------------------------------------
46
- .create-flex-count-cols(@num, @count: 1) when (@count =< @num) {
47
- .flex__allitems@{count} {
48
- > .d-flex,
49
- > .flex--item {
50
- flex-basis: ((@count * 100%) / @num);
51
- }
52
- }
53
-
54
- #stacks-internals #flex-builder-helpers .create-flex-count-cols(@num, (@count + 1));
55
- }
56
-
57
- // -- FLEX GUTTERS
58
- // ============================================================================
59
- // We need two mixins to properly generate flex gutters:
60
- //
61
- // [1] Adjusts the fixed column max-width / flex-basis if gutters are present.
62
- // [2] Generate the desired gutters.
63
- //
64
- // ----------------------------------------------------------------------------
65
- // [1] Adjust width / flex-basis numbers
66
- //
67
- // HOW IT WORKS:
68
- // A quick primer on how this mixin works. The TL;DR is we're using a mixin
69
- // guard to start a loop that'll create all the desired `> .flex--item@{count}`
70
- // classes.
71
- //
72
- // The three mixin parameters are:
73
- // - @spacing: the desired distance our gutters should be
74
- // - @num: the number at which we should stop our loop
75
- // - @count: the current column number
76
- //
77
- // The other bit is the mixin guard portion:
78
- //
79
- // when (@count =< @num)
80
- //
81
- // This checks if we should run the mixin. Using a comparison operator,
82
- // it's checking to see if the current @count is equal to (=) or less
83
- // than (<) the desired @num total. If it is, run the mixin.
84
- //
85
- // Next the mixin runs as normal. Using the @item-width variable, we
86
- // calculate the item's width. We do this here because we need to use the
87
- // CSS calc function and this makes the code a little prettier. Using the
88
- // variable, we then update the fixed item's flex-basis and width.
89
- //
90
- // Finally we call for the mixin again within itself, assigning a new
91
- // @count value: the current value + 1. This then fires off the mixin
92
- // again, creating a loop until we've generated updated widths for all
93
- // of our desired @num.
94
- //
95
- // There are two mixins here:
96
- // • "flex-fixed-item-row" -- This is the baseline mixin.
97
- // • "flex-fixed-item-column" -- When the ".d-flex" is a column, change
98
- // the margins, setting a top and bottom margin instead of left
99
- // and right.
100
- //
101
- // ----------------------------------------------------------------------------
102
- .flex-fixed-item-spacing(@spacing, @num, @count: 1) when (@count =< @num) {
103
- @itemWidth: (@count * 100% / @num);
104
-
105
- > .flex--item@{count} {
106
- margin: calc(~"@{spacing}" / 2);
107
- }
108
-
109
- // ------------------------------------------------------------------------
110
- // [1] FIXED WIDTH ITEMS
111
- // This makes the fixed width items to account for gutters.
112
- //
113
- // [2] UNIFORM CHILD FLEX ITEMS
114
- // This class allows you to uniformly state the width of `.flex--item`
115
- // divs within a `.d-flex` element. In particular we adjust the flex-basis
116
- // and max-width here to account for gutters.
117
- // ------------------------------------------------------------------------
118
- > .flex--item@{count}, // [1]
119
- &.flex__allitems@{count} > .d-flex, // [2]
120
- &.flex__allitems@{count} > .flex--item { // [2]
121
- flex-basis: calc(~"@{itemWidth} - @{spacing}");
122
- }
123
-
124
- #stacks-internals #flex-builder-helpers .flex-fixed-item-spacing(@spacing, @num, (@count + 1));
125
- }
126
-
127
-
128
- // ----------------------------------------------------------------------------
129
- // 2. Generate the desired gutters
130
- // We halve the spacing value because the spacing value should be the
131
- // total space between items--not the total applied to each item,
132
- // which would effectively double the desired total.
133
- //
134
- // The "when" statements here refer to when we declare it's for a
135
- // row (default) or a column. When a column we need to reset the
136
- // left and right margins and add in top and bottom margins.
137
- // ----------------------------------------------------------------------------
138
- .gutter-spacing(@spacing) {
139
- #stacks-internals #flex-builder-settings();
140
-
141
- margin: calc(~"@{spacing}" / 2 * -1);
142
-
143
- // -- FLUID ITEMS
144
- > .d-flex,
145
- > .flex--item {
146
- margin: calc(~"@{spacing}" / 2);
147
- }
148
-
149
- // -- FIXED WIDTH ITEMS
150
- // Now we call for the above mixin [1] to make sure we adjust the default
151
- // widths for the new gutters.
152
- #stacks-internals #flex-builder-helpers .flex-fixed-item-spacing(@spacing, @flex-cols);
153
- }
154
- }
155
- }
156
-
157
- // -- UNIVERSAL FLEX WIDTHS
158
- // This applies a flex value it to all of a flex's direct children.
159
- // --------------------------------------------------------------------------
160
- .flex__fl-shrink0 {
161
- &,
162
- > .d-flex,
163
- > .flex--item {
164
- flex: 0 auto;
165
- }
166
- }
167
-
168
- .flex__fl-equal {
169
- &,
170
- > .d-flex,
171
- > .flex--item {
172
- flex: 1 1 0%;
173
- }
174
- }
175
-
176
- .flex__fl-grow1 {
177
- &,
178
- > .d-flex,
179
- > .flex--item {
180
- flex: 1 auto;
181
- }
182
- }
183
-
184
- & {
185
- #stacks-internals #flex-builder-settings(); // load @flex-cols
186
-
187
- // $$ FIXED WIDTH ITEMS
188
- // ----------------------------------------------------------------------------
189
- #stacks-internals #flex-builder-helpers .create-fixed-items(@flex-cols);
190
-
191
- // $$ AUTO FIXED WIDTH ITEMS
192
- // ----------------------------------------------------------------------------
193
- #stacks-internals #flex-builder-helpers .create-flex-count-cols(@flex-cols);
194
- }
195
- // ============================================================================
196
- // $ FLEX SPACING
197
- // Insert spaces or gutters in between flex items
198
- // ----------------------------------------------------------------------------
199
- // TODO: Make this play nice with spacing units… or yeet this in the age of gap
200
- .gs2 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su2)); }
201
- .gs4 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su4)); }
202
- .gs6 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su6)); }
203
- .gs8 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su8)); }
204
- .gs12 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su12)); }
205
- .gs16 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su16)); }
206
- .gs24 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su24)); }
207
- .gs32 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su32)); }
208
- .gs48 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su48)); }
209
- .gs64 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su64)); }
210
-
211
- // On rows, remove top and bottom margins
212
- .gsx {
213
- &,
214
- > .d-flex,
215
- > [class*="flex--item"] {
216
- margin-top: 0;
217
- margin-bottom: 0;
218
- }
219
- }
220
-
221
- // On columns, remove left and right margins
222
- .gsy {
223
- &,
224
- > .d-flex,
225
- > [class*="flex--item"] {
226
- margin-right: 0;
227
- margin-left: 0;
228
- }
229
- }
230
-
231
-
232
- // ============================================================================
233
- // $ ATOMIC CLASSES
234
- // ----------------------------------------------------------------------------
235
- // -- FLEX DIRECTION
236
- // This determines the direction content flows within a parent container.
237
- // The default values are row.
238
- // ----------------------------------------------------------------------------
239
- #stacks-internals #responsify('.fd-row', { flex-direction: row !important; });
240
- #stacks-internals #responsify('.fd-row-reverse', { flex-direction: row-reverse !important; });
241
- #stacks-internals #responsify('.fd-column', { flex-direction: column !important; });
242
- #stacks-internals #responsify('.fd-column-reverse', { flex-direction: column-reverse !important; });
243
-
244
- // -- FLEX WRAP
245
- // This determines if a parent's child items will wrap or not.
246
- // ----------------------------------------------------------------------------
247
- #stacks-internals #responsify('.fw-wrap', { flex-wrap: wrap !important; });
248
- #stacks-internals #responsify('.fw-reverse', { flex-wrap: wrap-reverse !important; });
249
- #stacks-internals #responsify('.fw-nowrap', { flex-wrap: nowrap !important; });
250
-
251
- // -- JUSTIFY CONTENT
252
- // Defines the child alignment along the parent's main axis
253
- // ----------------------------------------------------------------------------
254
- #stacks-internals #responsify('.jc-center', { justify-content: center !important; });
255
- #stacks-internals #responsify('.jc-end', { justify-content: flex-end !important; });
256
- #stacks-internals #responsify('.jc-space-around', { justify-content: space-around !important; });
257
- #stacks-internals #responsify('.jc-space-between', { justify-content: space-between !important; });
258
- #stacks-internals #responsify('.jc-space-evenly', { justify-content: space-evenly !important; });
259
- #stacks-internals #responsify('.jc-start', { justify-content: flex-start !important; });
260
-
261
- // -- ALIGN CONTENT
262
- // Aligns the container's lines when there is extra space in the
263
- // cross-axis. Note that this only works when a parent container
264
- // has more than one line.
265
- // ----------------------------------------------------------------------------
266
- .ac-center { align-content: center !important; }
267
- .ac-end { align-content: flex-end !important; }
268
- .ac-space-around { align-content: space-around !important; }
269
- .ac-space-between { align-content: space-between !important; }
270
- .ac-start { align-content: flex-start !important; }
271
- .ac-stretch { align-content: stretch !important; }
272
-
273
- // -- ALIGN ITEMS
274
- // Defines the default behavior for how child items align along
275
- // the parent's cross axis. Think of it the cross-axis for
276
- // justify-content.
277
- // ----------------------------------------------------------------------------
278
- #stacks-internals #build-classes(
279
- responsive,
280
- '.ai',
281
- {
282
- .template(@value) when (@value=start), (@value=end) { align-items: ~"flex-@{value}" !important; }
283
- .template(@value) when (default()) { align-items: @value !important; };
284
- },
285
- baseline center end start stretch
286
- );
287
-
288
- // -- CENTER ITEMS
289
- // A common combination of classes is .jc-center and .ai-center.
290
- // Use this class when you want both.
291
- // ----------------------------------------------------------------------------
292
- .flex__center {
293
- .jc-center;
294
- .ai-center;
295
- }
296
-
297
- // -- ALIGN SELF
298
- // Allows child containers to re-align themselves regardless
299
- // of the parent's main axis direction.
300
- // ----------------------------------------------------------------------------
301
- #stacks-internals #build-classes(
302
- responsive,
303
- '.as',
304
- {
305
- .template(@value) when (@value=start), (@value=end) { align-self: ~"flex-@{value}" !important; }
306
- .template(@value) when (default()) { align-self: @value !important; };
307
- },
308
- auto baseline center end start stretch
309
- );
310
-
311
- // -- FLEX
312
- // Graduating scale of flex-grow and flex-shrink values
313
- // ----------------------------------------------------------------------------
314
- #stacks-internals #responsify('.fl-grow1', { flex-grow: 1 !important; });
315
- #stacks-internals #responsify('.fl-grow0', { flex-grow: 0 !important; });
316
- #stacks-internals #responsify('.fl-shrink1', { flex-shrink: 1 !important; });
317
- #stacks-internals #responsify('.fl-shrink0', { flex-shrink: 0 !important; });
318
- #stacks-internals #responsify('.fl-none', { flex: none !important; });
319
- #stacks-internals #responsify('.fl-initial', { flex: 0 1 auto !important; });
320
- #stacks-internals #responsify('.fl-auto', { flex: 1 1 auto !important; });
321
- #stacks-internals #responsify('.fl-equal', { flex: 1 1 0% !important; });
322
-
323
- // -- Ordering
324
- // Designate a child container's position.
325
- // ----------------------------------------------------------------------------
326
- #stacks-internals #responsify('.order-first', { order: -1 !important; });
327
- #stacks-internals #responsify('.order-last', { order: 1 !important; });
328
-
329
-
330
- // ============================================================================
331
- // $ DEPRECATED CLASSES
332
- // ----------------------------------------------------------------------------
333
-
334
- // -- FLEX FLOW
335
- // This is another shorthand property for flex-direction and flex-wrap.
336
- // Default value is "row nowrap".
337
- // ----------------------------------------------------------------------------
338
- .ff-row-wrap { flex-flow: row wrap !important; }
339
- .ff-row-nowrap { flex-flow: row nowrap !important; }
340
- .ff-row-reverse-wrap { flex-flow: row-reverse wrap !important; }
341
- .ff-row-reverse-nowrap { flex-flow: row-reverse nowrap !important; }
342
- .ff-column-wrap { flex-flow: column wrap !important; }
343
- .ff-column-nowrap { flex-flow: column nowrap !important; }
344
- .ff-column-reverse-wrap { flex-flow: column-reverse wrap !important; }
345
- .ff-column-reverse-nowrap { flex-flow: column-reverse nowrap !important; }
346
-
347
- // -- FLEX
348
- // Graduating scale of flex-grow and flex-shrink values
349
- // ----------------------------------------------------------------------------
350
- #stacks-internals #responsify('.fl0', { flex: 0 auto !important; });
351
- #stacks-internals #responsify('.fl1', { flex: 1 auto !important; });
352
- .fl2 { flex: 2 auto !important; }
353
- .fl3 { flex: 3 auto !important; }
354
- .fl4 { flex: 4 auto !important; }
355
- .fl5 { flex: 5 auto !important; }
356
-
357
- // -- FLEX SHRINK
358
- // Specifies the flex-shrink factor, which states how much an item will
359
- // shrink relative to other flex items in the container when there isn't
360
- // enough space in the row. Default value is 1.
361
- // ----------------------------------------------------------------------------
362
- .fl-shrink2 { flex-shrink: 2; }
363
- .fl-shrink3 { flex-shrink: 3; }
364
- .fl-shrink4 { flex-shrink: 4; }
365
- .fl-shrink5 { flex-shrink: 5; }
366
-
367
- // -- FLEX GROW
368
- // Specifies the flex-shrink grow, which states how much an item will
369
- // grow relative to other flex items in the container when there isn't
370
- // enough space in the row. Default value is 1.
371
- // ----------------------------------------------------------------------------
372
- .fl-grow2 { flex-grow: 2; }
373
- .fl-grow3 { flex-grow: 3; }
374
- .fl-grow4 { flex-grow: 4; }
375
- .fl-grow5 { flex-grow: 5; }
1
+ //
2
+ // STACK OVERFLOW
3
+ // FLEXBOX HELPERS
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
+ // • MIXINS
12
+ // • FLEX ELEMENTS
13
+ // • FLEX SPACING
14
+ // • MODIFICATIONS
15
+ // • ATOMIC
16
+ // • DEPRECATED
17
+ //
18
+ // ============================================================================
19
+ // -- STACKS FLEX LAYOUT MIXINS
20
+ // ============================================================================
21
+ // -- FIXED COLUMN WIDTHS
22
+ // ----------------------------------------------------------------------------
23
+
24
+ #stacks-internals() {
25
+ #flex-builder-settings() {
26
+ @flex-cols: 12; // Desired flex columns
27
+ }
28
+ #flex-builder-helpers() {
29
+ #stacks-internals #flex-builder-settings();
30
+
31
+ .create-fixed-items(@num, @count: 1) when (@count =< @num) {
32
+ .flex--item@{count} {
33
+ flex-basis: ((@count * 100%) / @num);
34
+ }
35
+
36
+ #stacks-internals #flex-builder-helpers .create-fixed-items(@num, (@count + 1));
37
+ }
38
+
39
+ // -- AUTO FIXED WIDTH ITEMS
40
+ // Automatic adjusting width items are great. And being able to specify an
41
+ // item's width is equally amazing. But sometimes you want to be able to
42
+ // have all items within a box container to be the same width. Instead
43
+ // stating a fixed item width, apply a modifying to the box container and
44
+ // all child elements will automatically be sized.
45
+ // ----------------------------------------------------------------------------
46
+ .create-flex-count-cols(@num, @count: 1) when (@count =< @num) {
47
+ .flex__allitems@{count} {
48
+ > .d-flex,
49
+ > .flex--item {
50
+ flex-basis: ((@count * 100%) / @num);
51
+ }
52
+ }
53
+
54
+ #stacks-internals #flex-builder-helpers .create-flex-count-cols(@num, (@count + 1));
55
+ }
56
+
57
+ // -- FLEX GUTTERS
58
+ // ============================================================================
59
+ // We need two mixins to properly generate flex gutters:
60
+ //
61
+ // [1] Adjusts the fixed column max-width / flex-basis if gutters are present.
62
+ // [2] Generate the desired gutters.
63
+ //
64
+ // ----------------------------------------------------------------------------
65
+ // [1] Adjust width / flex-basis numbers
66
+ //
67
+ // HOW IT WORKS:
68
+ // A quick primer on how this mixin works. The TL;DR is we're using a mixin
69
+ // guard to start a loop that'll create all the desired `> .flex--item@{count}`
70
+ // classes.
71
+ //
72
+ // The three mixin parameters are:
73
+ // - @spacing: the desired distance our gutters should be
74
+ // - @num: the number at which we should stop our loop
75
+ // - @count: the current column number
76
+ //
77
+ // The other bit is the mixin guard portion:
78
+ //
79
+ // when (@count =< @num)
80
+ //
81
+ // This checks if we should run the mixin. Using a comparison operator,
82
+ // it's checking to see if the current @count is equal to (=) or less
83
+ // than (<) the desired @num total. If it is, run the mixin.
84
+ //
85
+ // Next the mixin runs as normal. Using the @item-width variable, we
86
+ // calculate the item's width. We do this here because we need to use the
87
+ // CSS calc function and this makes the code a little prettier. Using the
88
+ // variable, we then update the fixed item's flex-basis and width.
89
+ //
90
+ // Finally we call for the mixin again within itself, assigning a new
91
+ // @count value: the current value + 1. This then fires off the mixin
92
+ // again, creating a loop until we've generated updated widths for all
93
+ // of our desired @num.
94
+ //
95
+ // There are two mixins here:
96
+ // • "flex-fixed-item-row" -- This is the baseline mixin.
97
+ // • "flex-fixed-item-column" -- When the ".d-flex" is a column, change
98
+ // the margins, setting a top and bottom margin instead of left
99
+ // and right.
100
+ //
101
+ // ----------------------------------------------------------------------------
102
+ .flex-fixed-item-spacing(@spacing, @num, @count: 1) when (@count =< @num) {
103
+ @itemWidth: (@count * 100% / @num);
104
+
105
+ > .flex--item@{count} {
106
+ margin: calc(~"@{spacing}" / 2);
107
+ }
108
+
109
+ // ------------------------------------------------------------------------
110
+ // [1] FIXED WIDTH ITEMS
111
+ // This makes the fixed width items to account for gutters.
112
+ //
113
+ // [2] UNIFORM CHILD FLEX ITEMS
114
+ // This class allows you to uniformly state the width of `.flex--item`
115
+ // divs within a `.d-flex` element. In particular we adjust the flex-basis
116
+ // and max-width here to account for gutters.
117
+ // ------------------------------------------------------------------------
118
+ > .flex--item@{count}, // [1]
119
+ &.flex__allitems@{count} > .d-flex, // [2]
120
+ &.flex__allitems@{count} > .flex--item { // [2]
121
+ flex-basis: calc(~"@{itemWidth} - @{spacing}");
122
+ }
123
+
124
+ #stacks-internals #flex-builder-helpers .flex-fixed-item-spacing(@spacing, @num, (@count + 1));
125
+ }
126
+
127
+
128
+ // ----------------------------------------------------------------------------
129
+ // 2. Generate the desired gutters
130
+ // We halve the spacing value because the spacing value should be the
131
+ // total space between items--not the total applied to each item,
132
+ // which would effectively double the desired total.
133
+ //
134
+ // The "when" statements here refer to when we declare it's for a
135
+ // row (default) or a column. When a column we need to reset the
136
+ // left and right margins and add in top and bottom margins.
137
+ // ----------------------------------------------------------------------------
138
+ .gutter-spacing(@spacing) {
139
+ #stacks-internals #flex-builder-settings();
140
+
141
+ margin: calc(~"@{spacing}" / 2 * -1);
142
+
143
+ // -- FLUID ITEMS
144
+ > .d-flex,
145
+ > .flex--item {
146
+ margin: calc(~"@{spacing}" / 2);
147
+ }
148
+
149
+ // -- FIXED WIDTH ITEMS
150
+ // Now we call for the above mixin [1] to make sure we adjust the default
151
+ // widths for the new gutters.
152
+ #stacks-internals #flex-builder-helpers .flex-fixed-item-spacing(@spacing, @flex-cols);
153
+ }
154
+ }
155
+ }
156
+
157
+ // -- UNIVERSAL FLEX WIDTHS
158
+ // This applies a flex value it to all of a flex's direct children.
159
+ // --------------------------------------------------------------------------
160
+ .flex__fl-shrink0 {
161
+ &,
162
+ > .d-flex,
163
+ > .flex--item {
164
+ flex: 0 auto;
165
+ }
166
+ }
167
+
168
+ .flex__fl-equal {
169
+ &,
170
+ > .d-flex,
171
+ > .flex--item {
172
+ flex: 1 1 0%;
173
+ }
174
+ }
175
+
176
+ .flex__fl-grow1 {
177
+ &,
178
+ > .d-flex,
179
+ > .flex--item {
180
+ flex: 1 auto;
181
+ }
182
+ }
183
+
184
+ & {
185
+ #stacks-internals #flex-builder-settings(); // load @flex-cols
186
+
187
+ // $$ FIXED WIDTH ITEMS
188
+ // ----------------------------------------------------------------------------
189
+ #stacks-internals #flex-builder-helpers .create-fixed-items(@flex-cols);
190
+
191
+ // $$ AUTO FIXED WIDTH ITEMS
192
+ // ----------------------------------------------------------------------------
193
+ #stacks-internals #flex-builder-helpers .create-flex-count-cols(@flex-cols);
194
+ }
195
+ // ============================================================================
196
+ // $ FLEX SPACING
197
+ // Insert spaces or gutters in between flex items
198
+ // ----------------------------------------------------------------------------
199
+ // TODO: Make this play nice with spacing units… or yeet this in the age of gap
200
+ .gs2 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su2)); }
201
+ .gs4 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su4)); }
202
+ .gs6 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su6)); }
203
+ .gs8 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su8)); }
204
+ .gs12 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su12)); }
205
+ .gs16 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su16)); }
206
+ .gs24 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su24)); }
207
+ .gs32 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su32)); }
208
+ .gs48 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su48)); }
209
+ .gs64 { #stacks-internals #flex-builder-helpers .gutter-spacing(var(--su64)); }
210
+
211
+ // On rows, remove top and bottom margins
212
+ .gsx {
213
+ &,
214
+ > .d-flex,
215
+ > [class*="flex--item"] {
216
+ margin-top: 0;
217
+ margin-bottom: 0;
218
+ }
219
+ }
220
+
221
+ // On columns, remove left and right margins
222
+ .gsy {
223
+ &,
224
+ > .d-flex,
225
+ > [class*="flex--item"] {
226
+ margin-right: 0;
227
+ margin-left: 0;
228
+ }
229
+ }
230
+
231
+
232
+ // ============================================================================
233
+ // $ ATOMIC CLASSES
234
+ // ----------------------------------------------------------------------------
235
+ // -- FLEX DIRECTION
236
+ // This determines the direction content flows within a parent container.
237
+ // The default values are row.
238
+ // ----------------------------------------------------------------------------
239
+ #stacks-internals #responsify('.fd-row', { flex-direction: row !important; });
240
+ #stacks-internals #responsify('.fd-row-reverse', { flex-direction: row-reverse !important; });
241
+ #stacks-internals #responsify('.fd-column', { flex-direction: column !important; });
242
+ #stacks-internals #responsify('.fd-column-reverse', { flex-direction: column-reverse !important; });
243
+
244
+ // -- FLEX WRAP
245
+ // This determines if a parent's child items will wrap or not.
246
+ // ----------------------------------------------------------------------------
247
+ #stacks-internals #responsify('.fw-wrap', { flex-wrap: wrap !important; });
248
+ #stacks-internals #responsify('.fw-reverse', { flex-wrap: wrap-reverse !important; });
249
+ #stacks-internals #responsify('.fw-nowrap', { flex-wrap: nowrap !important; });
250
+
251
+ // -- JUSTIFY CONTENT
252
+ // Defines the child alignment along the parent's main axis
253
+ // ----------------------------------------------------------------------------
254
+ #stacks-internals #responsify('.jc-center', { justify-content: center !important; });
255
+ #stacks-internals #responsify('.jc-end', { justify-content: flex-end !important; });
256
+ #stacks-internals #responsify('.jc-space-around', { justify-content: space-around !important; });
257
+ #stacks-internals #responsify('.jc-space-between', { justify-content: space-between !important; });
258
+ #stacks-internals #responsify('.jc-space-evenly', { justify-content: space-evenly !important; });
259
+ #stacks-internals #responsify('.jc-start', { justify-content: flex-start !important; });
260
+
261
+ // -- ALIGN CONTENT
262
+ // Aligns the container's lines when there is extra space in the
263
+ // cross-axis. Note that this only works when a parent container
264
+ // has more than one line.
265
+ // ----------------------------------------------------------------------------
266
+ .ac-center { align-content: center !important; }
267
+ .ac-end { align-content: flex-end !important; }
268
+ .ac-space-around { align-content: space-around !important; }
269
+ .ac-space-between { align-content: space-between !important; }
270
+ .ac-start { align-content: flex-start !important; }
271
+ .ac-stretch { align-content: stretch !important; }
272
+
273
+ // -- ALIGN ITEMS
274
+ // Defines the default behavior for how child items align along
275
+ // the parent's cross axis. Think of it the cross-axis for
276
+ // justify-content.
277
+ // ----------------------------------------------------------------------------
278
+ #stacks-internals #build-classes(
279
+ responsive,
280
+ '.ai',
281
+ {
282
+ .template(@value) when (@value=start), (@value=end) { align-items: ~"flex-@{value}" !important; }
283
+ .template(@value) when (default()) { align-items: @value !important; };
284
+ },
285
+ baseline center end start stretch
286
+ );
287
+
288
+ // -- CENTER ITEMS
289
+ // A common combination of classes is .jc-center and .ai-center.
290
+ // Use this class when you want both.
291
+ // ----------------------------------------------------------------------------
292
+ .flex__center {
293
+ .jc-center;
294
+ .ai-center;
295
+ }
296
+
297
+ // -- ALIGN SELF
298
+ // Allows child containers to re-align themselves regardless
299
+ // of the parent's main axis direction.
300
+ // ----------------------------------------------------------------------------
301
+ #stacks-internals #build-classes(
302
+ responsive,
303
+ '.as',
304
+ {
305
+ .template(@value) when (@value=start), (@value=end) { align-self: ~"flex-@{value}" !important; }
306
+ .template(@value) when (default()) { align-self: @value !important; };
307
+ },
308
+ auto baseline center end start stretch
309
+ );
310
+
311
+ // -- FLEX
312
+ // Graduating scale of flex-grow and flex-shrink values
313
+ // ----------------------------------------------------------------------------
314
+ #stacks-internals #responsify('.fl-grow1', { flex-grow: 1 !important; });
315
+ #stacks-internals #responsify('.fl-grow0', { flex-grow: 0 !important; });
316
+ #stacks-internals #responsify('.fl-shrink1', { flex-shrink: 1 !important; });
317
+ #stacks-internals #responsify('.fl-shrink0', { flex-shrink: 0 !important; });
318
+ #stacks-internals #responsify('.fl-none', { flex: none !important; });
319
+ #stacks-internals #responsify('.fl-initial', { flex: 0 1 auto !important; });
320
+ #stacks-internals #responsify('.fl-auto', { flex: 1 1 auto !important; });
321
+ #stacks-internals #responsify('.fl-equal', { flex: 1 1 0% !important; });
322
+
323
+ // -- Ordering
324
+ // Designate a child container's position.
325
+ // ----------------------------------------------------------------------------
326
+ #stacks-internals #responsify('.order-first', { order: -1 !important; });
327
+ #stacks-internals #responsify('.order-last', { order: 1 !important; });
328
+
329
+
330
+ // ============================================================================
331
+ // $ DEPRECATED CLASSES
332
+ // ----------------------------------------------------------------------------
333
+
334
+ // -- FLEX FLOW
335
+ // This is another shorthand property for flex-direction and flex-wrap.
336
+ // Default value is "row nowrap".
337
+ // ----------------------------------------------------------------------------
338
+ .ff-row-wrap { flex-flow: row wrap !important; }
339
+ .ff-row-nowrap { flex-flow: row nowrap !important; }
340
+ .ff-row-reverse-wrap { flex-flow: row-reverse wrap !important; }
341
+ .ff-row-reverse-nowrap { flex-flow: row-reverse nowrap !important; }
342
+ .ff-column-wrap { flex-flow: column wrap !important; }
343
+ .ff-column-nowrap { flex-flow: column nowrap !important; }
344
+ .ff-column-reverse-wrap { flex-flow: column-reverse wrap !important; }
345
+ .ff-column-reverse-nowrap { flex-flow: column-reverse nowrap !important; }
346
+
347
+ // -- FLEX
348
+ // Graduating scale of flex-grow and flex-shrink values
349
+ // ----------------------------------------------------------------------------
350
+ #stacks-internals #responsify('.fl0', { flex: 0 auto !important; });
351
+ #stacks-internals #responsify('.fl1', { flex: 1 auto !important; });
352
+ .fl2 { flex: 2 auto !important; }
353
+ .fl3 { flex: 3 auto !important; }
354
+ .fl4 { flex: 4 auto !important; }
355
+ .fl5 { flex: 5 auto !important; }
356
+
357
+ // -- FLEX SHRINK
358
+ // Specifies the flex-shrink factor, which states how much an item will
359
+ // shrink relative to other flex items in the container when there isn't
360
+ // enough space in the row. Default value is 1.
361
+ // ----------------------------------------------------------------------------
362
+ .fl-shrink2 { flex-shrink: 2; }
363
+ .fl-shrink3 { flex-shrink: 3; }
364
+ .fl-shrink4 { flex-shrink: 4; }
365
+ .fl-shrink5 { flex-shrink: 5; }
366
+
367
+ // -- FLEX GROW
368
+ // Specifies the flex-shrink grow, which states how much an item will
369
+ // grow relative to other flex items in the container when there isn't
370
+ // enough space in the row. Default value is 1.
371
+ // ----------------------------------------------------------------------------
372
+ .fl-grow2 { flex-grow: 2; }
373
+ .fl-grow3 { flex-grow: 3; }
374
+ .fl-grow4 { flex-grow: 4; }
375
+ .fl-grow5 { flex-grow: 5; }