@stackoverflow/stacks 0.73.1 → 0.76.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 (87) hide show
  1. package/LICENSE.MD +9 -9
  2. package/README.md +47 -47
  3. package/dist/controllers/index.d.ts +7 -0
  4. package/dist/controllers/s-expandable-control.d.ts +17 -0
  5. package/dist/controllers/s-modal.d.ts +97 -0
  6. package/dist/controllers/s-navigation-tablist.d.ts +36 -0
  7. package/dist/controllers/s-popover.d.ts +155 -0
  8. package/dist/controllers/s-table.d.ts +8 -0
  9. package/dist/controllers/s-tooltip.d.ts +82 -0
  10. package/dist/controllers/s-uploader.d.ts +48 -0
  11. package/dist/css/stacks.css +441 -141
  12. package/dist/css/stacks.min.css +1 -1
  13. package/dist/index.d.ts +3 -0
  14. package/dist/js/stacks.js +6130 -5488
  15. package/dist/js/stacks.min.js +1 -1
  16. package/dist/stacks.d.ts +21 -0
  17. package/lib/css/atomic/_stacks-borders.less +378 -378
  18. package/lib/css/atomic/_stacks-colors.less +209 -209
  19. package/lib/css/atomic/_stacks-flex.less +374 -374
  20. package/lib/css/atomic/_stacks-grid.less +174 -173
  21. package/lib/css/atomic/_stacks-misc.less +343 -342
  22. package/lib/css/atomic/_stacks-spacing.less +168 -162
  23. package/lib/css/atomic/_stacks-typography.less +273 -270
  24. package/lib/css/atomic/_stacks-width-height.less +195 -189
  25. package/lib/css/base/_stacks-body.less +44 -46
  26. package/lib/css/base/_stacks-configuration-static.less +59 -59
  27. package/lib/css/base/_stacks-icons.less +20 -20
  28. package/lib/css/base/_stacks-internals.less +220 -230
  29. package/lib/css/base/_stacks-reset-meyer.less +64 -64
  30. package/lib/css/base/_stacks-reset-normalize.less +449 -449
  31. package/lib/css/base/_stacks-reset.less +20 -20
  32. package/lib/css/components/_stacks-activity-indicator.less +45 -45
  33. package/lib/css/components/_stacks-avatars.less +189 -189
  34. package/lib/css/components/_stacks-badges.less +209 -209
  35. package/lib/css/components/_stacks-banners.less +80 -81
  36. package/lib/css/components/_stacks-blank-states.less +26 -26
  37. package/lib/css/components/_stacks-breadcrumbs.less +44 -44
  38. package/lib/css/components/_stacks-button-groups.less +104 -104
  39. package/lib/css/components/_stacks-buttons.less +658 -660
  40. package/lib/css/components/_stacks-cards.less +44 -44
  41. package/lib/css/components/_stacks-code-blocks.less +130 -130
  42. package/lib/css/components/_stacks-collapsible.less +104 -104
  43. package/lib/css/components/_stacks-inputs.less +728 -724
  44. package/lib/css/components/_stacks-link-previews.less +136 -136
  45. package/lib/css/components/_stacks-links.less +218 -218
  46. package/lib/css/components/_stacks-menu.less +47 -47
  47. package/lib/css/components/_stacks-modals.less +133 -133
  48. package/lib/css/components/_stacks-navigation.less +146 -146
  49. package/lib/css/components/_stacks-notices.less +233 -233
  50. package/lib/css/components/_stacks-page-titles.less +60 -60
  51. package/lib/css/components/_stacks-pagination.less +55 -55
  52. package/lib/css/components/_stacks-popovers.less +197 -197
  53. package/lib/css/components/_stacks-post-summary.less +425 -311
  54. package/lib/css/components/_stacks-progress-bars.less +331 -331
  55. package/lib/css/components/_stacks-prose.less +503 -503
  56. package/lib/css/components/_stacks-spinner.less +107 -107
  57. package/lib/css/components/_stacks-tables.less +341 -341
  58. package/lib/css/components/_stacks-tags.less +237 -209
  59. package/lib/css/components/_stacks-toggle-switches.less +144 -137
  60. package/lib/css/components/_stacks-topbar.less +425 -440
  61. package/lib/css/components/_stacks-uploader.less +210 -210
  62. package/lib/css/components/_stacks-user-cards.less +169 -193
  63. package/lib/css/components/_stacks-widget-dynamic.less +33 -33
  64. package/lib/css/components/_stacks-widget-static.less +272 -272
  65. package/lib/css/exports/_stacks-constants-colors.less +1112 -1098
  66. package/lib/css/exports/_stacks-constants-helpers.less +139 -139
  67. package/lib/css/exports/_stacks-constants-type.less +152 -91
  68. package/lib/css/exports/_stacks-exports.less +15 -15
  69. package/lib/css/exports/_stacks-mixins.less +220 -220
  70. package/lib/css/stacks-dynamic.less +35 -36
  71. package/lib/css/stacks-static.less +86 -86
  72. package/lib/ts/controllers/index.ts +8 -0
  73. package/lib/ts/controllers/s-expandable-control.ts +189 -190
  74. package/lib/ts/controllers/s-modal.ts +321 -323
  75. package/lib/ts/controllers/s-navigation-tablist.ts +118 -119
  76. package/lib/ts/controllers/s-popover.ts +547 -549
  77. package/lib/ts/controllers/s-table.ts +220 -220
  78. package/lib/ts/controllers/s-tooltip.ts +246 -247
  79. package/lib/ts/controllers/s-uploader.ts +172 -174
  80. package/lib/ts/index.ts +20 -0
  81. package/lib/ts/stacks.ts +88 -83
  82. package/lib/tsconfig.json +13 -11
  83. package/package.json +87 -71
  84. package/dist/css/stacks-flexgrid-shim.min.css +0 -1
  85. package/lib/css/base/_stacks-configuration-dynamic.less +0 -106
  86. package/lib/ts/finalize.ts +0 -1
  87. package/lib/ts/stimulus.d.ts +0 -4
@@ -1,374 +1,374 @@
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: (@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: -(@spacing / 2);
142
-
143
- // -- FLUID ITEMS
144
- > .d-flex,
145
- > .flex--item {
146
- margin: (@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
- .gs2 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su2); }
200
- .gs4 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su4); }
201
- .gs6 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su6); }
202
- .gs8 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su8); }
203
- .gs12 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su12); }
204
- .gs16 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su16); }
205
- .gs24 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su24); }
206
- .gs32 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su32); }
207
- .gs48 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su48); }
208
- .gs64 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su64); }
209
-
210
- // On rows, remove top and bottom margins
211
- .gsx {
212
- &,
213
- > .d-flex,
214
- > [class*="flex--item"] {
215
- margin-top: 0;
216
- margin-bottom: 0;
217
- }
218
- }
219
-
220
- // On columns, remove left and right margins
221
- .gsy {
222
- &,
223
- > .d-flex,
224
- > [class*="flex--item"] {
225
- margin-right: 0;
226
- margin-left: 0;
227
- }
228
- }
229
-
230
-
231
- // ============================================================================
232
- // $ ATOMIC CLASSES
233
- // ----------------------------------------------------------------------------
234
- // -- FLEX DIRECTION
235
- // This determines the direction content flows within a parent container.
236
- // The default values are row.
237
- // ----------------------------------------------------------------------------
238
- #stacks-internals #responsify('.fd-row', { flex-direction: row !important; });
239
- #stacks-internals #responsify('.fd-row-reverse', { flex-direction: row-reverse !important; });
240
- #stacks-internals #responsify('.fd-column', { flex-direction: column !important; });
241
- #stacks-internals #responsify('.fd-column-reverse', { flex-direction: column-reverse !important; });
242
-
243
- // -- FLEX WRAP
244
- // This determines if a parent's child items will wrap or not.
245
- // ----------------------------------------------------------------------------
246
- #stacks-internals #responsify('.fw-wrap', { flex-wrap: wrap !important; });
247
- #stacks-internals #responsify('.fw-reverse', { flex-wrap: wrap-reverse !important; });
248
- #stacks-internals #responsify('.fw-nowrap', { flex-wrap: nowrap !important; });
249
-
250
- // -- JUSTIFY CONTENT
251
- // Defines the child alignment along the parent's main axis
252
- // ----------------------------------------------------------------------------
253
- #stacks-internals #responsify('.jc-center', { justify-content: center !important; });
254
- #stacks-internals #responsify('.jc-end', { justify-content: flex-end !important; });
255
- #stacks-internals #responsify('.jc-space-around', { justify-content: space-around !important; });
256
- #stacks-internals #responsify('.jc-space-between', { justify-content: space-between !important; });
257
- #stacks-internals #responsify('.jc-space-evenly', { justify-content: space-evenly !important; });
258
- #stacks-internals #responsify('.jc-start', { justify-content: flex-start !important; });
259
-
260
- // -- ALIGN CONTENT
261
- // Aligns the container's lines when there is extra space in the
262
- // cross-axis. Note that this only works when a parent container
263
- // has more than one line.
264
- // ----------------------------------------------------------------------------
265
- .ac-center { align-content: center !important; }
266
- .ac-end { align-content: flex-end !important; }
267
- .ac-space-around { align-content: space-around !important; }
268
- .ac-space-between { align-content: space-between !important; }
269
- .ac-start { align-content: flex-start !important; }
270
- .ac-stretch { align-content: stretch !important; }
271
-
272
- // -- ALIGN ITEMS
273
- // Defines the default behavior for how child items align along
274
- // the parent's cross axis. Think of it the cross-axis for
275
- // justify-content.
276
- // ----------------------------------------------------------------------------
277
- #stacks-internals #build-classes(
278
- responsive,
279
- '.ai',
280
- {
281
- .template(@value) when (@value=start), (@value=end) { align-items: ~"flex-@{value}" !important; }
282
- .template(@value) when (default()) { align-items: @value !important; };
283
- },
284
- baseline center end start stretch
285
- );
286
-
287
- // -- CENTER ITEMS
288
- // A common combination of classes is .jc-center and .ai-center.
289
- // Use this class when you want both.
290
- // ----------------------------------------------------------------------------
291
- .flex__center {
292
- .jc-center;
293
- .ai-center;
294
- }
295
-
296
- // -- ALIGN SELF
297
- // Allows child containers to re-align themselves regardless
298
- // of the parent's main axis direction.
299
- // ----------------------------------------------------------------------------
300
- #stacks-internals #build-classes(
301
- responsive,
302
- '.as',
303
- {
304
- .template(@value) when (@value=start), (@value=end) { align-self: ~"flex-@{value}" !important; }
305
- .template(@value) when (default()) { align-self: @value !important; };
306
- },
307
- auto baseline center end start stretch
308
- );
309
-
310
- // -- FLEX
311
- // Graduating scale of flex-grow and flex-shrink values
312
- // ----------------------------------------------------------------------------
313
- #stacks-internals #responsify('.fl-grow1', { flex-grow: 1 !important; });
314
- #stacks-internals #responsify('.fl-grow0', { flex-grow: 0 !important; });
315
- #stacks-internals #responsify('.fl-shrink1', { flex-shrink: 1 !important; });
316
- #stacks-internals #responsify('.fl-shrink0', { flex-shrink: 0 !important; });
317
- #stacks-internals #responsify('.fl-none', { flex: none !important; });
318
- #stacks-internals #responsify('.fl-initial', { flex: 0 1 auto !important; });
319
- #stacks-internals #responsify('.fl-auto', { flex: 1 1 auto !important; });
320
- #stacks-internals #responsify('.fl-equal', { flex: 1 1 0% !important; });
321
-
322
- // -- Ordering
323
- // Designate a child container's position.
324
- // ----------------------------------------------------------------------------
325
- #stacks-internals #responsify('.order-first', { order: -1 !important; });
326
- #stacks-internals #responsify('.order-last', { order: 1 !important; });
327
-
328
-
329
- // ============================================================================
330
- // $ DEPRECATED CLASSES
331
- // ----------------------------------------------------------------------------
332
-
333
- // -- FLEX FLOW
334
- // This is another shorthand property for flex-direction and flex-wrap.
335
- // Default value is "row nowrap".
336
- // ----------------------------------------------------------------------------
337
- .ff-row-wrap { flex-flow: row wrap !important; }
338
- .ff-row-nowrap { flex-flow: row nowrap !important; }
339
- .ff-row-reverse-wrap { flex-flow: row-reverse wrap !important; }
340
- .ff-row-reverse-nowrap { flex-flow: row-reverse nowrap !important; }
341
- .ff-column-wrap { flex-flow: column wrap !important; }
342
- .ff-column-nowrap { flex-flow: column nowrap !important; }
343
- .ff-column-reverse-wrap { flex-flow: column-reverse wrap !important; }
344
- .ff-column-reverse-nowrap { flex-flow: column-reverse nowrap !important; }
345
-
346
- // -- FLEX
347
- // Graduating scale of flex-grow and flex-shrink values
348
- // ----------------------------------------------------------------------------
349
- #stacks-internals #responsify('.fl0', { flex: 0 auto !important; });
350
- #stacks-internals #responsify('.fl1', { flex: 1 auto !important; });
351
- .fl2 { flex: 2 auto !important; }
352
- .fl3 { flex: 3 auto !important; }
353
- .fl4 { flex: 4 auto !important; }
354
- .fl5 { flex: 5 auto !important; }
355
-
356
- // -- FLEX SHRINK
357
- // Specifies the flex-shrink factor, which states how much an item will
358
- // shrink relative to other flex items in the container when there isn't
359
- // enough space in the row. Default value is 1.
360
- // ----------------------------------------------------------------------------
361
- .fl-shrink2 { flex-shrink: 2; }
362
- .fl-shrink3 { flex-shrink: 3; }
363
- .fl-shrink4 { flex-shrink: 4; }
364
- .fl-shrink5 { flex-shrink: 5; }
365
-
366
- // -- FLEX GROW
367
- // Specifies the flex-shrink grow, which states how much an item will
368
- // grow relative to other flex items in the container when there isn't
369
- // enough space in the row. Default value is 1.
370
- // ----------------------------------------------------------------------------
371
- .fl-grow2 { flex-grow: 2; }
372
- .fl-grow3 { flex-grow: 3; }
373
- .fl-grow4 { flex-grow: 4; }
374
- .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: (@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: -(@spacing / 2);
142
+
143
+ // -- FLUID ITEMS
144
+ > .d-flex,
145
+ > .flex--item {
146
+ margin: (@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
+ .gs2 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su2); }
200
+ .gs4 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su4); }
201
+ .gs6 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su6); }
202
+ .gs8 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su8); }
203
+ .gs12 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su12); }
204
+ .gs16 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su16); }
205
+ .gs24 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su24); }
206
+ .gs32 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su32); }
207
+ .gs48 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su48); }
208
+ .gs64 { #stacks-internals #flex-builder-helpers .gutter-spacing(@su64); }
209
+
210
+ // On rows, remove top and bottom margins
211
+ .gsx {
212
+ &,
213
+ > .d-flex,
214
+ > [class*="flex--item"] {
215
+ margin-top: 0;
216
+ margin-bottom: 0;
217
+ }
218
+ }
219
+
220
+ // On columns, remove left and right margins
221
+ .gsy {
222
+ &,
223
+ > .d-flex,
224
+ > [class*="flex--item"] {
225
+ margin-right: 0;
226
+ margin-left: 0;
227
+ }
228
+ }
229
+
230
+
231
+ // ============================================================================
232
+ // $ ATOMIC CLASSES
233
+ // ----------------------------------------------------------------------------
234
+ // -- FLEX DIRECTION
235
+ // This determines the direction content flows within a parent container.
236
+ // The default values are row.
237
+ // ----------------------------------------------------------------------------
238
+ #stacks-internals #responsify('.fd-row', { flex-direction: row !important; });
239
+ #stacks-internals #responsify('.fd-row-reverse', { flex-direction: row-reverse !important; });
240
+ #stacks-internals #responsify('.fd-column', { flex-direction: column !important; });
241
+ #stacks-internals #responsify('.fd-column-reverse', { flex-direction: column-reverse !important; });
242
+
243
+ // -- FLEX WRAP
244
+ // This determines if a parent's child items will wrap or not.
245
+ // ----------------------------------------------------------------------------
246
+ #stacks-internals #responsify('.fw-wrap', { flex-wrap: wrap !important; });
247
+ #stacks-internals #responsify('.fw-reverse', { flex-wrap: wrap-reverse !important; });
248
+ #stacks-internals #responsify('.fw-nowrap', { flex-wrap: nowrap !important; });
249
+
250
+ // -- JUSTIFY CONTENT
251
+ // Defines the child alignment along the parent's main axis
252
+ // ----------------------------------------------------------------------------
253
+ #stacks-internals #responsify('.jc-center', { justify-content: center !important; });
254
+ #stacks-internals #responsify('.jc-end', { justify-content: flex-end !important; });
255
+ #stacks-internals #responsify('.jc-space-around', { justify-content: space-around !important; });
256
+ #stacks-internals #responsify('.jc-space-between', { justify-content: space-between !important; });
257
+ #stacks-internals #responsify('.jc-space-evenly', { justify-content: space-evenly !important; });
258
+ #stacks-internals #responsify('.jc-start', { justify-content: flex-start !important; });
259
+
260
+ // -- ALIGN CONTENT
261
+ // Aligns the container's lines when there is extra space in the
262
+ // cross-axis. Note that this only works when a parent container
263
+ // has more than one line.
264
+ // ----------------------------------------------------------------------------
265
+ .ac-center { align-content: center !important; }
266
+ .ac-end { align-content: flex-end !important; }
267
+ .ac-space-around { align-content: space-around !important; }
268
+ .ac-space-between { align-content: space-between !important; }
269
+ .ac-start { align-content: flex-start !important; }
270
+ .ac-stretch { align-content: stretch !important; }
271
+
272
+ // -- ALIGN ITEMS
273
+ // Defines the default behavior for how child items align along
274
+ // the parent's cross axis. Think of it the cross-axis for
275
+ // justify-content.
276
+ // ----------------------------------------------------------------------------
277
+ #stacks-internals #build-classes(
278
+ responsive,
279
+ '.ai',
280
+ {
281
+ .template(@value) when (@value=start), (@value=end) { align-items: ~"flex-@{value}" !important; }
282
+ .template(@value) when (default()) { align-items: @value !important; };
283
+ },
284
+ baseline center end start stretch
285
+ );
286
+
287
+ // -- CENTER ITEMS
288
+ // A common combination of classes is .jc-center and .ai-center.
289
+ // Use this class when you want both.
290
+ // ----------------------------------------------------------------------------
291
+ .flex__center {
292
+ .jc-center;
293
+ .ai-center;
294
+ }
295
+
296
+ // -- ALIGN SELF
297
+ // Allows child containers to re-align themselves regardless
298
+ // of the parent's main axis direction.
299
+ // ----------------------------------------------------------------------------
300
+ #stacks-internals #build-classes(
301
+ responsive,
302
+ '.as',
303
+ {
304
+ .template(@value) when (@value=start), (@value=end) { align-self: ~"flex-@{value}" !important; }
305
+ .template(@value) when (default()) { align-self: @value !important; };
306
+ },
307
+ auto baseline center end start stretch
308
+ );
309
+
310
+ // -- FLEX
311
+ // Graduating scale of flex-grow and flex-shrink values
312
+ // ----------------------------------------------------------------------------
313
+ #stacks-internals #responsify('.fl-grow1', { flex-grow: 1 !important; });
314
+ #stacks-internals #responsify('.fl-grow0', { flex-grow: 0 !important; });
315
+ #stacks-internals #responsify('.fl-shrink1', { flex-shrink: 1 !important; });
316
+ #stacks-internals #responsify('.fl-shrink0', { flex-shrink: 0 !important; });
317
+ #stacks-internals #responsify('.fl-none', { flex: none !important; });
318
+ #stacks-internals #responsify('.fl-initial', { flex: 0 1 auto !important; });
319
+ #stacks-internals #responsify('.fl-auto', { flex: 1 1 auto !important; });
320
+ #stacks-internals #responsify('.fl-equal', { flex: 1 1 0% !important; });
321
+
322
+ // -- Ordering
323
+ // Designate a child container's position.
324
+ // ----------------------------------------------------------------------------
325
+ #stacks-internals #responsify('.order-first', { order: -1 !important; });
326
+ #stacks-internals #responsify('.order-last', { order: 1 !important; });
327
+
328
+
329
+ // ============================================================================
330
+ // $ DEPRECATED CLASSES
331
+ // ----------------------------------------------------------------------------
332
+
333
+ // -- FLEX FLOW
334
+ // This is another shorthand property for flex-direction and flex-wrap.
335
+ // Default value is "row nowrap".
336
+ // ----------------------------------------------------------------------------
337
+ .ff-row-wrap { flex-flow: row wrap !important; }
338
+ .ff-row-nowrap { flex-flow: row nowrap !important; }
339
+ .ff-row-reverse-wrap { flex-flow: row-reverse wrap !important; }
340
+ .ff-row-reverse-nowrap { flex-flow: row-reverse nowrap !important; }
341
+ .ff-column-wrap { flex-flow: column wrap !important; }
342
+ .ff-column-nowrap { flex-flow: column nowrap !important; }
343
+ .ff-column-reverse-wrap { flex-flow: column-reverse wrap !important; }
344
+ .ff-column-reverse-nowrap { flex-flow: column-reverse nowrap !important; }
345
+
346
+ // -- FLEX
347
+ // Graduating scale of flex-grow and flex-shrink values
348
+ // ----------------------------------------------------------------------------
349
+ #stacks-internals #responsify('.fl0', { flex: 0 auto !important; });
350
+ #stacks-internals #responsify('.fl1', { flex: 1 auto !important; });
351
+ .fl2 { flex: 2 auto !important; }
352
+ .fl3 { flex: 3 auto !important; }
353
+ .fl4 { flex: 4 auto !important; }
354
+ .fl5 { flex: 5 auto !important; }
355
+
356
+ // -- FLEX SHRINK
357
+ // Specifies the flex-shrink factor, which states how much an item will
358
+ // shrink relative to other flex items in the container when there isn't
359
+ // enough space in the row. Default value is 1.
360
+ // ----------------------------------------------------------------------------
361
+ .fl-shrink2 { flex-shrink: 2; }
362
+ .fl-shrink3 { flex-shrink: 3; }
363
+ .fl-shrink4 { flex-shrink: 4; }
364
+ .fl-shrink5 { flex-shrink: 5; }
365
+
366
+ // -- FLEX GROW
367
+ // Specifies the flex-shrink grow, which states how much an item will
368
+ // grow relative to other flex items in the container when there isn't
369
+ // enough space in the row. Default value is 1.
370
+ // ----------------------------------------------------------------------------
371
+ .fl-grow2 { flex-grow: 2; }
372
+ .fl-grow3 { flex-grow: 3; }
373
+ .fl-grow4 { flex-grow: 4; }
374
+ .fl-grow5 { flex-grow: 5; }