@codeforamerica/marcomms-design-system 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,690 +1,336 @@
1
1
  @use "sass:math";
2
2
  @use "sass:list";
3
- @use "sass:meta";
4
-
5
- // Flexbox Mixins
6
- // http://philipwalton.github.io/solved-by-flexbox/
7
- // https://github.com/philipwalton/solved-by-flexbox
8
- //
9
- // Copyright (c) 2013 Brian Franco
10
- //
11
- // Permission is hereby granted, free of charge, to any person obtaining a
12
- // copy of this software and associated documentation files (the
13
- // "Software"), to deal in the Software without restriction, including
14
- // without limitation the rights to use, copy, modify, merge, publish,
15
- // distribute, sublicense, and/or sell copies of the Software, and to
16
- // permit persons to whom the Software is furnished to do so, subject to
17
- // the following conditions:
18
- // The above copyright notice and this permission notice shall be included
19
- // in all copies or substantial portions of the Software.
20
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23
- // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24
- // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25
- // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26
- // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
- //
28
- // This is a set of mixins for those who want to mess around with flexbox
29
- // using the native support of current browsers. For full support table
30
- // check: http://caniuse.com/flexbox
31
- //
32
- // Basically this will use:
33
- //
34
- // * Fallback, old syntax (IE10, mobile webkit browsers - no wrapping)
35
- // * Final standards syntax (FF, Safari, Chrome, IE11, Opera)
36
- //
37
- // This was inspired by:
38
- //
39
- // * http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/
40
- //
41
- // With help from:
42
- //
43
- // * http://w3.org/tr/css3-flexbox/
44
- // * http://the-echoplex.net/flexyboxes/
45
- // * http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx
46
- // * http://css-tricks.com/using-flexbox/
47
- // * http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/
48
- // * https://developer.mozilla.org/en-us/docs/web/guide/css/flexible_boxes
49
-
50
- //----------------------------------------------------------------------
51
-
52
- // Flexbox Containers
53
- //
54
- // The 'flex' value causes an element to generate a block-level flex
55
- // container box.
56
- //
57
- // The 'inline-flex' value causes an element to generate a inline-level
58
- // flex container box.
59
- //
60
- // display: flex | inline-flex
61
- //
62
- // http://w3.org/tr/css3-flexbox/#flex-containers
63
- //
64
- // (Placeholder selectors for each type, for those who rather @extend)
65
-
66
- @mixin flexbox {
67
- display: -webkit-box;
68
- display: -webkit-flex;
69
- display: -moz-flex;
70
- display: -ms-flexbox;
71
- display: flex;
72
- }
73
-
74
- %flexbox { @include flexbox; }
75
-
76
- //----------------------------------
77
-
78
- @mixin inline-flex {
79
- display: -webkit-inline-box;
80
- display: -webkit-inline-flex;
81
- display: -moz-inline-flex;
82
- display: -ms-inline-flexbox;
83
- display: inline-flex;
84
- }
85
-
86
- %inline-flex { @include inline-flex; }
87
-
88
- //----------------------------------------------------------------------
89
-
90
- // Flexbox Direction
91
- //
92
- // The 'flex-direction' property specifies how flex items are placed in
93
- // the flex container, by setting the direction of the flex container's
94
- // main axis. This determines the direction that flex items are laid out in.
95
- //
96
- // Values: row | row-reverse | column | column-reverse
97
- // Default: row
98
- //
99
- // http://w3.org/tr/css3-flexbox/#flex-direction-property
100
-
101
- @mixin flex-direction($value: row) {
102
- @if $value == row-reverse {
103
- -webkit-box-direction: reverse;
104
- -webkit-box-orient: horizontal;
105
- } @else if $value == column {
106
- -webkit-box-direction: normal;
107
- -webkit-box-orient: vertical;
108
- } @else if $value == column-reverse {
109
- -webkit-box-direction: reverse;
110
- -webkit-box-orient: vertical;
111
- } @else {
112
- -webkit-box-direction: normal;
113
- -webkit-box-orient: horizontal;
114
- }
115
- -webkit-flex-direction: $value;
116
- -moz-flex-direction: $value;
117
- -ms-flex-direction: $value;
118
- flex-direction: $value;
119
- }
120
- // Shorter version:
121
- @mixin flex-dir($args...) { @include flex-direction($args...); }
122
-
123
- //----------------------------------------------------------------------
124
-
125
- // Flexbox Wrap
126
- //
127
- // The 'flex-wrap' property controls whether the flex container is single-line
128
- // or multi-line, and the direction of the cross-axis, which determines
129
- // the direction new lines are stacked in.
130
- //
131
- // Values: nowrap | wrap | wrap-reverse
132
- // Default: nowrap
133
- //
134
- // http://w3.org/tr/css3-flexbox/#flex-wrap-property
135
-
136
- @mixin flex-wrap($value: nowrap) {
137
- // No Webkit Box fallback.
138
- -webkit-flex-wrap: $value;
139
- -moz-flex-wrap: $value;
140
- @if $value == nowrap {
141
- -ms-flex-wrap: none;
142
- } @else {
143
- -ms-flex-wrap: $value;
144
- }
145
- flex-wrap: $value;
146
- }
147
-
148
- //----------------------------------------------------------------------
149
-
150
- // Flexbox Flow (shorthand)
151
- //
152
- // The 'flex-flow' property is a shorthand for setting the 'flex-direction'
153
- // and 'flex-wrap' properties, which together define the flex container's
154
- // main and cross axes.
155
- //
156
- // Values: <flex-direction> | <flex-wrap>
157
- // Default: row nowrap
158
- //
159
- // http://w3.org/tr/css3-flexbox/#flex-flow-property
160
-
161
- @mixin flex-flow($values: (row nowrap)) {
162
- // No Webkit Box fallback.
163
- -webkit-flex-flow: $values;
164
- -moz-flex-flow: $values;
165
- -ms-flex-flow: $values;
166
- flex-flow: $values;
167
- }
168
-
169
- //----------------------------------------------------------------------
170
-
171
- // Flexbox Order
172
- //
173
- // The 'order' property controls the order in which flex items appear within
174
- // their flex container, by assigning them to ordinal groups.
175
- //
176
- // Default: 0
177
- //
178
- // http://w3.org/tr/css3-flexbox/#order-property
179
-
180
- @mixin order($int: 0) {
181
- -webkit-box-ordinal-group: $int + 1;
182
- -webkit-order: $int;
183
- -moz-order: $int;
184
- -ms-flex-order: $int;
185
- order: $int;
186
- }
187
-
188
- //----------------------------------------------------------------------
189
-
190
- // Flexbox Grow
191
- //
192
- // The 'flex-grow' property sets the flex grow factor. Negative numbers
193
- // are invalid.
194
- //
195
- // Default: 0
196
- //
197
- // http://w3.org/tr/css3-flexbox/#flex-grow-property
198
-
199
- @mixin flex-grow($int: 0) {
200
- -webkit-box-flex: $int;
201
- -webkit-flex-grow: $int;
202
- -moz-flex-grow: $int;
203
- -ms-flex-positive: $int;
204
- flex-grow: $int;
205
- }
206
3
 
207
- //----------------------------------------------------------------------
208
-
209
- // Flexbox Shrink
210
- //
211
- // The 'flex-shrink' property sets the flex shrink factor. Negative numbers
212
- // are invalid.
213
- //
214
- // Default: 1
215
- //
216
- // http://w3.org/tr/css3-flexbox/#flex-shrink-property
217
-
218
- @mixin flex-shrink($int: 1) {
219
- -webkit-flex-shrink: $int;
220
- -moz-flex-shrink: $int;
221
- -ms-flex-negative: $int;
222
- flex-shrink: $int;
223
- }
4
+ // ===========
5
+ // Grid System
6
+ // ===========
224
7
 
225
- //----------------------------------------------------------------------
226
-
227
- // Flexbox Basis
228
- //
229
- // The 'flex-basis' property sets the flex basis. Negative lengths are invalid.
230
- //
231
- // Values: Like "width"
232
- // Default: auto
233
- //
234
- // http://www.w3.org/TR/css3-flexbox/#flex-basis-property
235
-
236
- @mixin flex-basis($value: auto) {
237
- -webkit-flex-basis: $value;
238
- -moz-flex-basis: $value;
239
- -ms-flex-preferred-size: $value;
240
- flex-basis: $value;
241
- }
8
+ // -------------
9
+ // Configuration
10
+ // -------------
242
11
 
243
- //----------------------------------------------------------------------
244
-
245
- // Flexbox "Flex" (shorthand)
246
- //
247
- // The 'flex' property specifies the components of a flexible length: the
248
- // flex grow factor and flex shrink factor, and the flex basis. When an
249
- // element is a flex item, 'flex' is consulted instead of the main size
250
- // property to determine the main size of the element. If an element is
251
- // not a flex item, 'flex' has no effect.
252
- //
253
- // Values: none | <flex-grow> <flex-shrink> || <flex-basis>
254
- // Default: See individual properties (1 1 0).
255
- //
256
- // http://w3.org/tr/css3-flexbox/#flex-property
257
-
258
- @mixin flex($fg: 1, $fs: null, $fb: null) {
259
-
260
- // Set a variable to be used by box-flex properties
261
- $fg-boxflex: $fg;
262
-
263
- // Box-Flex only supports a flex-grow value so let's grab the
264
- // first item in the list and just return that.
265
- @if meta.type-of($fg) == 'list' {
266
- $fg-boxflex: list.nth($fg, 1);
267
- }
268
-
269
- -webkit-box-flex: $fg-boxflex;
270
- -webkit-flex: $fg $fs $fb;
271
- -moz-box-flex: $fg-boxflex;
272
- -moz-flex: $fg $fs $fb;
273
- -ms-flex: $fg $fs $fb;
274
- flex: $fg $fs $fb;
12
+ $grid-columns: 12;
13
+ $base-font-size: 20px;
14
+ $gutter-width: 1.5 * $base-font-size; // 30px - equivalent to --spacing-layout-1
15
+ $outer-margin: 1.5 * $base-font-size; // 30px - equivalent to --spacing-layout-1
16
+ $row-spacing: var(--spacing-layout-1); // Default spacing between rows
17
+ $max-width: 1200px;
18
+
19
+ // Breakpoints: name, min-width, container-width
20
+ $breakpoints: (
21
+ sm: (480px, 480px),
22
+ md: (768px, 768px),
23
+ lg: (1024px, $max-width)
24
+ );
25
+
26
+ // Calculated values
27
+ $gutter-compensation: calc($gutter-width * -0.5);
28
+ $half-gutter-width: calc($gutter-width * 0.5);
29
+
30
+ // ------
31
+ // Mixins
32
+ // ------
33
+
34
+ @mixin flex-container($direction: row, $wrap: wrap) {
35
+ display: flex;
36
+ flex-flow: $direction $wrap;
275
37
  }
276
38
 
277
- //----------------------------------------------------------------------
278
-
279
- // Flexbox Justify Content
280
- //
281
- // The 'justify-content' property aligns flex items along the main axis
282
- // of the current line of the flex container. This is done after any flexible
283
- // lengths and any auto margins have been resolved. Typically it helps distribute
284
- // extra free space leftover when either all the flex items on a line are
285
- // inflexible, or are flexible but have reached their maximum size. It also
286
- // exerts some control over the alignment of items when they overflow the line.
287
- //
288
- // Note: 'space-*' values not supported in older syntaxes.
289
- //
290
- // Values: flex-start | flex-end | center | space-between | space-around
291
- // Default: flex-start
292
- //
293
- // http://w3.org/tr/css3-flexbox/#justify-content-property
294
-
295
- @mixin justify-content($value: flex-start) {
296
- @if $value == flex-start {
297
- -webkit-box-pack: start;
298
- -ms-flex-pack: start;
299
- } @else if $value == flex-end {
300
- -webkit-box-pack: end;
301
- -ms-flex-pack: end;
302
- } @else if $value == space-between {
303
- -webkit-box-pack: justify;
304
- -ms-flex-pack: justify;
305
- } @else if $value == space-around {
306
- -ms-flex-pack: distribute;
307
- } @else {
308
- -webkit-box-pack: $value;
309
- -ms-flex-pack: $value;
310
- }
311
- -webkit-justify-content: $value;
312
- -moz-justify-content: $value;
313
- justify-content: $value;
314
- }
315
- // Shorter version:
316
- @mixin flex-just($args...) { @include justify-content($args...); }
317
-
318
- //----------------------------------------------------------------------
319
-
320
- // Flexbox Align Items
321
- //
322
- // Flex items can be aligned in the cross axis of the current line of the
323
- // flex container, similar to 'justify-content' but in the perpendicular
324
- // direction. 'align-items' sets the default alignment for all of the flex
325
- // container's items, including anonymous flex items. 'align-self' allows
326
- // this default alignment to be overridden for individual flex items. (For
327
- // anonymous flex items, 'align-self' always matches the value of 'align-items'
328
- // on their associated flex container.)
329
- //
330
- // Values: flex-start | flex-end | center | baseline | stretch
331
- // Default: stretch
332
- //
333
- // http://w3.org/tr/css3-flexbox/#align-items-property
334
-
335
- @mixin align-items($value: stretch) {
336
- @if $value == flex-start {
337
- -webkit-box-align: start;
338
- -ms-flex-align: start;
339
- } @else if $value == flex-end {
340
- -webkit-box-align: end;
341
- -ms-flex-align: end;
342
- } @else {
343
- -webkit-box-align: $value;
344
- -ms-flex-align: $value;
345
- }
346
- -webkit-align-items: $value;
347
- -moz-align-items: $value;
348
- align-items: $value;
349
- }
39
+ @mixin col-base {
40
+ box-sizing: border-box;
41
+ flex: 0 0 auto;
42
+ }
43
+
44
+ @mixin col-size($size) {
45
+ // Calculate width accounting for gaps between columns
46
+ $gap-count: $grid-columns - 1;
47
+ $total-gap-width: $gap-count * $gutter-width;
48
+ $available-width: calc(100% - #{$total-gap-width});
49
+ $width: calc(#{$available-width} / #{$grid-columns} * #{$size});
50
+
51
+ // For single column, add back the gap space
52
+ @if $size == $grid-columns {
53
+ $width: 100%;
54
+ }
350
55
 
351
- //----------------------------------
352
-
353
- // Flexbox Align Self
354
- //
355
- // Values: auto | flex-start | flex-end | center | baseline | stretch
356
- // Default: auto
357
-
358
- @mixin align-self($value: auto) {
359
- // No Webkit Box Fallback.
360
- -webkit-align-self: $value;
361
- -moz-align-self: $value;
362
- @if $value == flex-start {
363
- -ms-flex-item-align: start;
364
- } @else if $value == flex-end {
365
- -ms-flex-item-align: end;
366
- } @else {
367
- -ms-flex-item-align: $value;
368
- }
369
- align-self: $value;
370
- }
56
+ @else {
57
+ $additional-gaps: $size - 1;
58
+ $width: calc(#{$width} + #{$additional-gaps * $gutter-width});
59
+ }
371
60
 
372
- //----------------------------------------------------------------------
373
-
374
- // Flexbox Align Content
375
- //
376
- // The 'align-content' property aligns a flex container's lines within the
377
- // flex container when there is extra space in the cross-axis, similar to
378
- // how 'justify-content' aligns individual items within the main-axis. Note,
379
- // this property has no effect when the flexbox has only a single line.
380
- //
381
- // Values: flex-start | flex-end | center | space-between | space-around | stretch
382
- // Default: stretch
383
- //
384
- // http://w3.org/tr/css3-flexbox/#align-content-property
385
-
386
- @mixin align-content($value: stretch) {
387
- // No Webkit Box Fallback.
388
- -webkit-align-content: $value;
389
- -moz-align-content: $value;
390
- @if $value == flex-start {
391
- -ms-flex-line-pack: start;
392
- } @else if $value == flex-end {
393
- -ms-flex-line-pack: end;
394
- } @else {
395
- -ms-flex-line-pack: $value;
396
- }
397
- align-content: $value;
61
+ flex-basis: $width;
62
+ max-width: $width;
398
63
  }
399
64
 
400
- $base-font-size: 20px;
401
-
402
- $grid-columns: 12;
403
- $gutter-width: 1.5 * $base-font-size; // equivalent to --gutter-width token (i.e. --spacing-layout-1)
404
- $outer-margin: 1.5 * $base-font-size; // equivalent to --outer-margin token (i.e. --spacing-layout-1)
405
-
406
- $breakpoints: sm 480px 480px, md 768px 768px;
407
- $flexboxgrid-max-width: 1200px;
408
-
409
- $gutter-compensation: $gutter-width * .5 * -1;
410
- $half-gutter-width: $gutter-width * .5;
65
+ // ----------
66
+ // Containers
67
+ // ----------
411
68
 
412
69
  .wrapper {
413
70
  box-sizing: border-box;
414
- max-width: $flexboxgrid-max-width;
71
+ max-width: $max-width;
415
72
  margin: 0 auto;
73
+ padding-inline: $outer-margin;
416
74
  }
417
75
 
418
76
  .container-fluid {
419
- margin-right: auto;
420
- margin-left: auto;
421
- padding-right: $outer-margin;
422
- padding-left: $outer-margin;
77
+ margin-inline: auto;
78
+ display: flex;
79
+ flex-direction: column;
80
+ width: 100%;
423
81
  }
424
82
 
425
- .row {
426
- @include flexbox();
427
- @include flex(0, 1, auto);
428
- @include flex-direction(row);
429
- @include flex-wrap(wrap);
430
-
431
- box-sizing: border-box;
432
- margin-right: $gutter-compensation;
433
- margin-left: $gutter-compensation;
83
+ // When wrapper and container-fluid are combined, wrapper handles padding
84
+ .wrapper.container-fluid {
85
+ padding-inline: $outer-margin;
434
86
  }
435
87
 
436
- .row.reverse {
437
- @include flex-direction(row-reverse);
88
+ .container {
89
+ margin-inline: auto;
90
+ padding-inline: $outer-margin;
91
+ display: flex;
92
+ flex-direction: column;
93
+ width: 100%;
438
94
  }
439
95
 
440
- .col.reverse {
441
- @include flex-direction(column-reverse);
442
- }
96
+ // ----
97
+ // Rows
98
+ // ----
99
+
100
+ .row {
101
+ @include flex-container(row, wrap);
443
102
 
444
- @mixin flexboxgrid-sass-col-common {
445
103
  box-sizing: border-box;
104
+ flex-basis: 100%;
105
+ gap: $gutter-width;
446
106
 
447
- // split @include flex(0, 0, auto) into individual props
448
- @include flex-grow(0);
449
- @include flex-shrink(0);
107
+ // Default spacing between rows
108
+ & + .row {
109
+ margin-top: $row-spacing;
110
+ }
450
111
 
451
- // we leave @include flex-basis(auto) out of common because
452
- // in some spots we need it and some we dont
453
- // more why here: https://github.com/kristoferjoseph/flexboxgrid/issues/126
112
+ // Row variants
113
+ &.reverse {
114
+ flex-direction: row-reverse;
115
+ }
454
116
 
455
- padding-right: $half-gutter-width;
456
- padding-left: $half-gutter-width;
117
+ // No gutters modifier
118
+ &--no-gutters {
119
+ gap: 0;
120
+ }
457
121
  }
458
122
 
459
- $name: xs;
460
- .col-#{$name} {
461
- @include flexboxgrid-sass-col-common;
462
- @include flex-basis(auto);
463
- }
464
- @for $i from 1 through $grid-columns {
465
- .col-#{$name}-#{$i} {
466
- @include flexboxgrid-sass-col-common;
467
- @include flex-basis(math.div(100%, $grid-columns) * $i);
468
- max-width: math.div(100%, $grid-columns) * $i;
123
+ .container-fluid > .row {
124
+ flex: 1;
125
+ }
126
+
127
+ // Testing variant - shows grid lines between columns
128
+ .container-fluid--grid-test {
129
+ position: relative;
130
+
131
+ // Fill the outer margins with light grey
132
+ &::before {
133
+ content: '';
134
+ position: absolute;
135
+ top: 0;
136
+ left: 0;
137
+ right: 0;
138
+ bottom: 0;
139
+ pointer-events: none;
140
+ z-index: 0;
141
+ background:
142
+ // Left margin
143
+ linear-gradient(
144
+ to right,
145
+ rgba(200, 200, 200, 0.3) 0,
146
+ rgba(200, 200, 200, 0.3) $outer-margin,
147
+ transparent $outer-margin
148
+ ),
149
+ // Right margin
150
+ linear-gradient(
151
+ to left,
152
+ rgba(200, 200, 200, 0.3) 0,
153
+ rgba(200, 200, 200, 0.3) $outer-margin,
154
+ transparent $outer-margin
155
+ );
469
156
  }
470
- }
471
- @for $i from 1 through $grid-columns {
472
- .col-#{$name}-offset-#{$i} {
473
- @include flexboxgrid-sass-col-common;
474
- margin-left: math.div(100%, $grid-columns) * $i;
157
+
158
+ // Fill the gaps between columns with light grey
159
+ &::after {
160
+ content: '';
161
+ position: absolute;
162
+ top: 0;
163
+ left: $outer-margin;
164
+ right: $outer-margin;
165
+ bottom: 0;
166
+ pointer-events: none;
167
+ z-index: 1;
168
+ background-image: repeating-linear-gradient(
169
+ to right,
170
+ transparent 0,
171
+ transparent calc((100% - #{$gutter-width * 11}) / 12), // Column width
172
+ rgba(200, 200, 200, 0.4) calc((100% - #{$gutter-width * 11}) / 12), // Start of gap
173
+ rgba(200, 200, 200, 0.4) calc((100% - #{$gutter-width * 11}) / 12 + #{$gutter-width}), // End of gap
174
+ transparent calc((100% - #{$gutter-width * 11}) / 12 + #{$gutter-width}) // Next column starts
175
+ );
176
+ }
177
+
178
+ .row {
179
+ position: relative;
180
+ z-index: 2;
475
181
  }
476
- }
477
- .col-#{$name} {
478
- @include flex-grow(1);
479
- @include flex-basis(0);
480
- max-width: 100%;
481
- }
482
- .start-#{$name} {
483
- @include justify-content(flex-start);
484
- text-align: start;
485
- }
486
-
487
- .center-#{$name} {
488
- @include justify-content(center);
489
- text-align: center;
490
- }
491
-
492
- .end-#{$name} {
493
- @include justify-content(flex-end);
494
- text-align: end;
495
182
  }
496
183
 
497
- .top-#{$name} {
498
- @include align-items(flex-start);
499
- }
184
+ // -------
185
+ // Columns
186
+ // -------
500
187
 
501
- .middle-#{$name} {
502
- @include align-items(center);
503
- }
188
+ // Auto-width column
189
+ .col-xs {
190
+ @include col-base;
504
191
 
505
- .bottom-#{$name} {
506
- @include align-items(flex-end);
507
- }
508
-
509
- .around-#{$name} {
510
- @include justify-content(space-around);
192
+ flex-grow: 1;
193
+ flex-basis: 0;
194
+ max-width: 100%;
511
195
  }
512
196
 
513
- .between-#{$name} {
514
- @include justify-content(space-between);
197
+ // Sized columns (1-12)
198
+ @for $i from 1 through $grid-columns {
199
+ .col-xs-#{$i} {
200
+ @include col-base;
201
+ @include col-size($i);
202
+ }
515
203
  }
516
204
 
517
- .first-#{$name} {
518
- order: -1;
205
+ // Column reverse
206
+ .col.reverse {
207
+ flex-direction: column-reverse;
519
208
  }
520
209
 
521
- .last-#{$name} {
522
- order: 1;
523
- }
210
+ // ------------------
211
+ // Responsive columns
212
+ // ------------------
524
213
 
214
+ @each $name, $values in $breakpoints {
215
+ $min-width: list.nth($values, 1);
216
+ $container-width: list.nth($values, 2);
525
217
 
526
- @each $breakpoint in $breakpoints {
527
- $name: list.nth($breakpoint, 1);
528
- $size: list.nth($breakpoint, 2);
529
- $container: list.nth($breakpoint, 3);
530
- @media only screen and (min-width: $size) {
218
+ @media only screen and (min-width: $min-width) {
531
219
  .container {
532
- width: $container;
220
+ width: $container-width;
533
221
  }
534
222
 
223
+ // Auto-width column
535
224
  .col-#{$name} {
536
- @include flexboxgrid-sass-col-common;
537
- @include flex-basis(auto);
225
+ @include col-base;
226
+
227
+ flex-grow: 1;
228
+ flex-basis: 0;
229
+ max-width: 100%;
538
230
  }
231
+
232
+ // Sized columns (1-12)
539
233
  @for $i from 1 through $grid-columns {
540
234
  .col-#{$name}-#{$i} {
541
- @include flexboxgrid-sass-col-common;
542
- @include flex-basis(math.div(100%, $grid-columns) * $i);
543
- max-width: math.div(100%, $grid-columns) * $i;
235
+ @include col-base;
236
+ @include col-size($i);
544
237
  }
545
238
  }
546
- @for $i from 1 through $grid-columns {
547
- .col-#{$name}-offset-#{$i} {
548
- @include flexboxgrid-sass-col-common;
549
- margin-left: math.div(100%, $grid-columns) * $i
239
+
240
+ // Row flex sizing
241
+ @for $i from 1 through 3 {
242
+ .row-#{$name}-#{$i} {
243
+ flex: $i !important;
550
244
  }
551
245
  }
552
- .col-#{$name} {
553
- @include flex-grow(1);
554
- @include flex-basis(0);
555
- max-width: 100%;
556
- }
557
- .start-#{$name} {
558
- @include justify-content(flex-start);
559
- text-align: start;
560
- }
561
246
 
562
- .center-#{$name} {
563
- @include justify-content(center);
564
- text-align: center;
247
+ // Row ordering
248
+ .row-first-#{$name} {
249
+ order: -1;
565
250
  }
566
251
 
567
- .end-#{$name} {
568
- @include justify-content(flex-end);
569
- text-align: end;
252
+ .row-last-#{$name} {
253
+ order: 1;
570
254
  }
255
+ }
256
+ }
571
257
 
572
- .top-#{$name} {
573
- @include align-items(flex-start);
574
- }
258
+ // -------------------
259
+ // Alignment Utilities
260
+ // -------------------
575
261
 
576
- .middle-#{$name} {
577
- @include align-items(center);
578
- }
262
+ // Horizontal alignment (justify-content)
263
+ .start-xs { justify-content: flex-start; }
579
264
 
580
- .bottom-#{$name} {
581
- @include align-items(flex-end);
582
- }
265
+ .center-xs { justify-content: center; }
583
266
 
584
- .around-#{$name} {
585
- @include justify-content(space-around);
586
- }
267
+ .end-xs { justify-content: flex-end; }
587
268
 
588
- .between-#{$name} {
589
- @include justify-content(space-between);
590
- }
269
+ .around-xs { justify-content: space-around; }
591
270
 
592
- .first-#{$name} {
593
- order: -1;
594
- }
271
+ .between-xs { justify-content: space-between; }
595
272
 
596
- .last-#{$name} {
597
- order: 1;
598
- }
599
- }
600
- }
273
+ // Vertical alignment (align-items)
274
+ .top-xs { align-items: flex-start; }
601
275
 
602
- .row {
603
- flex-basis: 100%;
604
- row-gap: var(--spacing-layout-1);
605
- }
276
+ .middle-xs { align-items: center; }
606
277
 
607
- .row--no-gutters {
608
- margin-left: 0;
609
- margin-right: 0;
278
+ .bottom-xs { align-items: flex-end; }
610
279
 
611
- & > *[class*='col-'] {
612
- padding-left: 0;
613
- padding-right: 0;
280
+ .stretch-xs {
281
+ align-items: stretch;
282
+
283
+ > * {
284
+ display: flex;
614
285
  }
615
286
  }
616
287
 
617
- .container-fluid {
618
- display: flex;
619
- flex-direction: column;
620
-
621
- & > .row {
622
- flex: 1;
623
- }
624
-
625
- @each $breakpoint in $breakpoints {
626
- $name: list.nth($breakpoint, 1);
627
- $size: list.nth($breakpoint, 2);
628
- @media only screen and (min-width: $size) {
629
- @for $i from 1 through 3 {
630
- .row-#{$name}-#{$i} {
631
- flex: $i !important;
632
- }
633
- .row-first-#{$name} {
634
- order: -1;
635
- }
636
- .row-last-#{$name} {
637
- order: 1;
638
- }
639
- }
640
- }
641
- }
288
+ // Ordering
289
+ .first-xs { order: -1; }
642
290
 
643
- }
291
+ .last-xs { order: 1; }
644
292
 
645
- @each $breakpoint in $breakpoints {
646
- $name: list.nth($breakpoint, 1);
647
-
648
- // Stop Flexbox Grid alignment from affecting text-alignment
649
- .start-xs,
650
- .center-xs,
651
- .end-xs,
652
- .start-#{$name},
653
- .center-#{$name},
654
- .end-#{$name} {
655
- text-align: inherit;
656
- }
657
-
658
- // Alignment class for aligning row items at the top of a row
659
- .top-xs,
660
- .top-#{$name} {
661
- align-items: flex-start;
662
- }
293
+ // Responsive alignment utilities
294
+ @each $name, $values in $breakpoints {
295
+ $min-width: list.nth($values, 1);
663
296
 
664
- // Alignment class for aligning row items in the middle of a row vertically
665
- .middle-xs,
666
- .middle-#{$name} {
667
- align-items: center;
668
- }
297
+ @media only screen and (min-width: $min-width) {
298
+ // Horizontal alignment
299
+ .start-#{$name} { justify-content: flex-start; }
300
+ .center-#{$name} { justify-content: center; }
301
+ .end-#{$name} { justify-content: flex-end; }
302
+ .around-#{$name} { justify-content: space-around; }
303
+ .between-#{$name} { justify-content: space-between; }
669
304
 
670
- // Alignment class for aligning row items at the bottom of a row
671
- .bottom-xs,
672
- .bottom-#{$name} {
673
- align-items: flex-end;
674
- }
305
+ // Vertical alignment
306
+ .top-#{$name} { align-items: flex-start; }
307
+ .middle-#{$name} { align-items: center; }
308
+ .bottom-#{$name} { align-items: flex-end; }
309
+ .stretch-#{$name} {
310
+ align-items: stretch;
675
311
 
676
- // Alignment class for stretching items to fill row
677
- .stretch-xs,
678
- .stretch-#{$name} {
679
- align-items: stretch;
312
+ & > * {
313
+ display: flex;
314
+ flex-direction: column;
315
+ }
680
316
 
681
- & > * {
682
- display: flex;
317
+ & > * > *{
318
+ height: 100%;
319
+ }
683
320
  }
321
+
322
+ // Ordering
323
+ .first-#{$name} { order: -1; }
324
+ .last-#{$name} { order: 1; }
684
325
  }
685
326
  }
686
327
 
328
+ // -----------------
329
+ // Utility Functions
330
+ // -----------------
331
+
687
332
  @function column-span($columns) {
688
- $width: ( math.div($flexboxgrid-max-width - $outer-margin, $grid-columns) * $columns ) - $gutter-width;
333
+ $width: math.div($max-width - $outer-margin, $grid-columns) * $columns - $gutter-width;
334
+
689
335
  @return $width;
690
336
  }