Upgrade to bootstrap 4.5
[roojs1] / scss / bootstrap / mixins / _grid-framework.scss
1 // Framework grid generation
2 //
3 // Used only by Bootstrap to generate the correct number of grid classes given
4 // any value of `$grid-columns`.
5
6 @mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $grid-breakpoints) {
7   // Common properties for all breakpoints
8   %grid-column {
9     position: relative;
10     width: 100%;
11     padding-right: $gutter / 2;
12     padding-left: $gutter / 2;
13   }
14
15   @each $breakpoint in map-keys($breakpoints) {
16     $infix: breakpoint-infix($breakpoint, $breakpoints);
17
18     @if $columns > 0 {
19       // Allow columns to stretch full width below their breakpoints
20       @for $i from 1 through $columns {
21         .col#{$infix}-#{$i} {
22           @extend %grid-column;
23         }
24       }
25     }
26
27     .col#{$infix},
28     .col#{$infix}-auto {
29       @extend %grid-column;
30     }
31
32     @include media-breakpoint-up($breakpoint, $breakpoints) {
33       // Provide basic `.col-{bp}` classes for equal-width flexbox columns
34       .col#{$infix} {
35         flex-basis: 0;
36         flex-grow: 1;
37         max-width: 100%;
38       }
39
40       @if $grid-row-columns > 0 {
41         @for $i from 1 through $grid-row-columns {
42           .row-cols#{$infix}-#{$i} {
43             @include row-cols($i);
44           }
45         }
46       }
47
48       .col#{$infix}-auto {
49         @include make-col-auto();
50       }
51
52       @if $columns > 0 {
53         @for $i from 1 through $columns {
54           .col#{$infix}-#{$i} {
55             @include make-col($i, $columns);
56           }
57         }
58       }
59
60       .order#{$infix}-first { order: -1; }
61
62       .order#{$infix}-last { order: $columns + 1; }
63
64       @for $i from 0 through $columns {
65         .order#{$infix}-#{$i} { order: $i; }
66       }
67
68       @if $columns > 0 {
69         // `$columns - 1` because offsetting by the width of an entire row isn't possible
70         @for $i from 0 through ($columns - 1) {
71           @if not ($infix == "" and $i == 0) { // Avoid emitting useless .offset-0
72             .offset#{$infix}-#{$i} {
73               @include make-col-offset($i, $columns);
74             }
75           }
76         }
77       }
78     }
79   }
80 }