@codeforamerica/marcomms-design-system 1.1.4 → 1.2.1

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,332 @@
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
+ $max-width: 1200px;
17
+
18
+ // Breakpoints: name, min-width, container-width
19
+ $breakpoints: (
20
+ sm: (480px, 480px),
21
+ md: (768px, 768px),
22
+ lg: (1024px, $max-width)
23
+ );
24
+
25
+ // Calculated values
26
+ $gutter-compensation: calc($gutter-width * -0.5);
27
+ $half-gutter-width: calc($gutter-width * 0.5);
28
+
29
+ // ------
30
+ // Mixins
31
+ // ------
32
+
33
+ @mixin flex-container($direction: row, $wrap: wrap) {
34
+ display: flex;
35
+ flex-flow: $direction $wrap;
275
36
  }
276
37
 
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
- }
38
+ @mixin col-base {
39
+ box-sizing: border-box;
40
+ flex: 0 0 auto;
41
+ }
42
+
43
+ @mixin col-size($size) {
44
+ // Calculate width accounting for gaps between columns
45
+ $gap-count: $grid-columns - 1;
46
+ $total-gap-width: $gap-count * $gutter-width;
47
+ $available-width: calc(100% - #{$total-gap-width});
48
+ $width: calc(#{$available-width} / #{$grid-columns} * #{$size});
49
+
50
+ // For single column, add back the gap space
51
+ @if $size == $grid-columns {
52
+ $width: 100%;
53
+ }
350
54
 
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
- }
55
+ @else {
56
+ $additional-gaps: $size - 1;
57
+ $width: calc(#{$width} + #{$additional-gaps * $gutter-width});
58
+ }
371
59
 
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;
60
+ flex-basis: $width;
61
+ max-width: $width;
398
62
  }
399
63
 
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;
64
+ // ----------
65
+ // Containers
66
+ // ----------
411
67
 
412
68
  .wrapper {
413
69
  box-sizing: border-box;
414
- max-width: $flexboxgrid-max-width;
70
+ max-width: $max-width;
415
71
  margin: 0 auto;
72
+ padding-inline: $outer-margin;
416
73
  }
417
74
 
418
75
  .container-fluid {
419
- margin-right: auto;
420
- margin-left: auto;
421
- padding-right: $outer-margin;
422
- padding-left: $outer-margin;
76
+ margin-inline: auto;
77
+ display: flex;
78
+ flex-direction: column;
79
+ width: 100%;
423
80
  }
424
81
 
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;
82
+ // When wrapper and container-fluid are combined, wrapper handles padding
83
+ .wrapper.container-fluid {
84
+ padding-inline: $outer-margin;
434
85
  }
435
86
 
436
- .row.reverse {
437
- @include flex-direction(row-reverse);
87
+ .container {
88
+ margin-inline: auto;
89
+ padding-inline: $outer-margin;
90
+ display: flex;
91
+ flex-direction: column;
92
+ width: 100%;
438
93
  }
439
94
 
440
- .col.reverse {
441
- @include flex-direction(column-reverse);
442
- }
95
+ // ----
96
+ // Rows
97
+ // ----
443
98
 
444
- @mixin flexboxgrid-sass-col-common {
445
- box-sizing: border-box;
99
+ .row {
100
+ @include flex-container(row, wrap);
446
101
 
447
- // split @include flex(0, 0, auto) into individual props
448
- @include flex-grow(0);
449
- @include flex-shrink(0);
102
+ box-sizing: border-box;
103
+ flex-basis: 100%;
104
+ column-gap: $gutter-width;
105
+ row-gap: 0;
450
106
 
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
107
+ // Row variants
108
+ &.reverse {
109
+ flex-direction: row-reverse;
110
+ }
454
111
 
455
- padding-right: $half-gutter-width;
456
- padding-left: $half-gutter-width;
112
+ // No gutters modifier
113
+ &--no-gutters {
114
+ column-gap: 0;
115
+ row-gap: 0;
116
+ }
457
117
  }
458
118
 
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;
119
+ .container-fluid > .row {
120
+ flex: 1;
121
+ }
122
+
123
+ // Testing variant - shows grid lines between columns
124
+ .container-fluid--grid-test {
125
+ position: relative;
126
+
127
+ // Fill the outer margins with light grey
128
+ &::before {
129
+ content: '';
130
+ position: absolute;
131
+ top: 0;
132
+ left: 0;
133
+ right: 0;
134
+ bottom: 0;
135
+ pointer-events: none;
136
+ z-index: 0;
137
+ background:
138
+ // Left margin
139
+ linear-gradient(
140
+ to right,
141
+ rgba(200, 200, 200, 0.3) 0,
142
+ rgba(200, 200, 200, 0.3) $outer-margin,
143
+ transparent $outer-margin
144
+ ),
145
+ // Right margin
146
+ linear-gradient(
147
+ to left,
148
+ rgba(200, 200, 200, 0.3) 0,
149
+ rgba(200, 200, 200, 0.3) $outer-margin,
150
+ transparent $outer-margin
151
+ );
469
152
  }
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;
153
+
154
+ // Fill the gaps between columns with light grey
155
+ &::after {
156
+ content: '';
157
+ position: absolute;
158
+ top: 0;
159
+ left: $outer-margin;
160
+ right: $outer-margin;
161
+ bottom: 0;
162
+ pointer-events: none;
163
+ z-index: 1;
164
+ background-image: repeating-linear-gradient(
165
+ to right,
166
+ transparent 0,
167
+ transparent calc((100% - #{$gutter-width * 11}) / 12), // Column width
168
+ rgba(200, 200, 200, 0.4) calc((100% - #{$gutter-width * 11}) / 12), // Start of gap
169
+ rgba(200, 200, 200, 0.4) calc((100% - #{$gutter-width * 11}) / 12 + #{$gutter-width}), // End of gap
170
+ transparent calc((100% - #{$gutter-width * 11}) / 12 + #{$gutter-width}) // Next column starts
171
+ );
172
+ }
173
+
174
+ .row {
175
+ position: relative;
176
+ z-index: 2;
475
177
  }
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
178
  }
496
179
 
497
- .top-#{$name} {
498
- @include align-items(flex-start);
499
- }
180
+ // -------
181
+ // Columns
182
+ // -------
500
183
 
501
- .middle-#{$name} {
502
- @include align-items(center);
503
- }
184
+ // Auto-width column
185
+ .col-xs {
186
+ @include col-base;
504
187
 
505
- .bottom-#{$name} {
506
- @include align-items(flex-end);
507
- }
508
-
509
- .around-#{$name} {
510
- @include justify-content(space-around);
188
+ flex-grow: 1;
189
+ flex-basis: 0;
190
+ max-width: 100%;
511
191
  }
512
192
 
513
- .between-#{$name} {
514
- @include justify-content(space-between);
193
+ // Sized columns (1-12)
194
+ @for $i from 1 through $grid-columns {
195
+ .col-xs-#{$i} {
196
+ @include col-base;
197
+ @include col-size($i);
198
+ }
515
199
  }
516
200
 
517
- .first-#{$name} {
518
- order: -1;
201
+ // Column reverse
202
+ .col.reverse {
203
+ flex-direction: column-reverse;
519
204
  }
520
205
 
521
- .last-#{$name} {
522
- order: 1;
523
- }
206
+ // ------------------
207
+ // Responsive columns
208
+ // ------------------
524
209
 
210
+ @each $name, $values in $breakpoints {
211
+ $min-width: list.nth($values, 1);
212
+ $container-width: list.nth($values, 2);
525
213
 
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) {
214
+ @media only screen and (min-width: $min-width) {
531
215
  .container {
532
- width: $container;
216
+ width: $container-width;
533
217
  }
534
218
 
219
+ // Auto-width column
535
220
  .col-#{$name} {
536
- @include flexboxgrid-sass-col-common;
537
- @include flex-basis(auto);
221
+ @include col-base;
222
+
223
+ flex-grow: 1;
224
+ flex-basis: 0;
225
+ max-width: 100%;
538
226
  }
227
+
228
+ // Sized columns (1-12)
539
229
  @for $i from 1 through $grid-columns {
540
230
  .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;
231
+ @include col-base;
232
+ @include col-size($i);
544
233
  }
545
234
  }
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
235
+
236
+ // Row flex sizing
237
+ @for $i from 1 through 3 {
238
+ .row-#{$name}-#{$i} {
239
+ flex: $i !important;
550
240
  }
551
241
  }
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
242
 
562
- .center-#{$name} {
563
- @include justify-content(center);
564
- text-align: center;
243
+ // Row ordering
244
+ .row-first-#{$name} {
245
+ order: -1;
565
246
  }
566
247
 
567
- .end-#{$name} {
568
- @include justify-content(flex-end);
569
- text-align: end;
248
+ .row-last-#{$name} {
249
+ order: 1;
570
250
  }
251
+ }
252
+ }
571
253
 
572
- .top-#{$name} {
573
- @include align-items(flex-start);
574
- }
254
+ // -------------------
255
+ // Alignment Utilities
256
+ // -------------------
575
257
 
576
- .middle-#{$name} {
577
- @include align-items(center);
578
- }
258
+ // Horizontal alignment (justify-content)
259
+ .start-xs { justify-content: flex-start; }
579
260
 
580
- .bottom-#{$name} {
581
- @include align-items(flex-end);
582
- }
261
+ .center-xs { justify-content: center; }
583
262
 
584
- .around-#{$name} {
585
- @include justify-content(space-around);
586
- }
263
+ .end-xs { justify-content: flex-end; }
587
264
 
588
- .between-#{$name} {
589
- @include justify-content(space-between);
590
- }
265
+ .around-xs { justify-content: space-around; }
591
266
 
592
- .first-#{$name} {
593
- order: -1;
594
- }
267
+ .between-xs { justify-content: space-between; }
595
268
 
596
- .last-#{$name} {
597
- order: 1;
598
- }
599
- }
600
- }
269
+ // Vertical alignment (align-items)
270
+ .top-xs { align-items: flex-start; }
601
271
 
602
- .row {
603
- flex-basis: 100%;
604
- row-gap: var(--spacing-layout-1);
605
- }
272
+ .middle-xs { align-items: center; }
606
273
 
607
- .row--no-gutters {
608
- margin-left: 0;
609
- margin-right: 0;
274
+ .bottom-xs { align-items: flex-end; }
610
275
 
611
- & > *[class*='col-'] {
612
- padding-left: 0;
613
- padding-right: 0;
276
+ .stretch-xs {
277
+ align-items: stretch;
278
+
279
+ > * {
280
+ display: flex;
614
281
  }
615
282
  }
616
283
 
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
- }
284
+ // Ordering
285
+ .first-xs { order: -1; }
642
286
 
643
- }
287
+ .last-xs { order: 1; }
644
288
 
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
- }
289
+ // Responsive alignment utilities
290
+ @each $name, $values in $breakpoints {
291
+ $min-width: list.nth($values, 1);
663
292
 
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
- }
293
+ @media only screen and (min-width: $min-width) {
294
+ // Horizontal alignment
295
+ .start-#{$name} { justify-content: flex-start; }
296
+ .center-#{$name} { justify-content: center; }
297
+ .end-#{$name} { justify-content: flex-end; }
298
+ .around-#{$name} { justify-content: space-around; }
299
+ .between-#{$name} { justify-content: space-between; }
669
300
 
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
- }
301
+ // Vertical alignment
302
+ .top-#{$name} { align-items: flex-start; }
303
+ .middle-#{$name} { align-items: center; }
304
+ .bottom-#{$name} { align-items: flex-end; }
305
+ .stretch-#{$name} {
306
+ align-items: stretch;
675
307
 
676
- // Alignment class for stretching items to fill row
677
- .stretch-xs,
678
- .stretch-#{$name} {
679
- align-items: stretch;
308
+ & > * {
309
+ display: flex;
310
+ flex-direction: column;
311
+ }
680
312
 
681
- & > * {
682
- display: flex;
313
+ & > * > *{
314
+ height: 100%;
315
+ }
683
316
  }
317
+
318
+ // Ordering
319
+ .first-#{$name} { order: -1; }
320
+ .last-#{$name} { order: 1; }
684
321
  }
685
322
  }
686
323
 
324
+ // -----------------
325
+ // Utility Functions
326
+ // -----------------
327
+
687
328
  @function column-span($columns) {
688
- $width: ( math.div($flexboxgrid-max-width - $outer-margin, $grid-columns) * $columns ) - $gutter-width;
329
+ $width: math.div($max-width - $outer-margin, $grid-columns) * $columns - $gutter-width;
330
+
689
331
  @return $width;
690
332
  }