vendor/assets/scss/grid/_flex-grid.scss in foundation-rails-6.1.2.0 vs vendor/assets/scss/grid/_flex-grid.scss in foundation-rails-6.2.0.0

- old
+ new

@@ -4,25 +4,10 @@ //// /// @group flex-grid //// -$-zf-flex-justify: ( - 'left': flex-start, - 'right': flex-end, - 'center': center, - 'justify': space-between, - 'spaced': space-around, -); - -$-zf-flex-align: ( - 'top': flex-start, - 'bottom': flex-end, - 'middle': center, - 'stretch': stretch, -); - /// Creates a container for a flex grid row. /// /// @param {Keyword|List} $behavior [null] /// Modifications to the default grid styles. `nest` indicates the row will be placed inside another row. `collapse` indicates that the columns inside this row will not have padding. `nest collapse` combines both behaviors. /// @param {Number} $width [$grid-row-width] - Maximum width of the row. @@ -34,17 +19,16 @@ $width: $grid-row-width, $columns: null, $base: true, $gutter: $grid-column-gutter ) { - $behavior: -zf-get-options($behavior, nest collapse); $margin: auto; - @if map-get($behavior, nest) { + @if index($behavior, nest) != null { @include grid-row-nest($gutter); - @if map-get($behavior, collapse) { + @if index($behavior, collapse) != null { margin-left: 0; margin-right: 0; } } @else { @@ -90,81 +74,76 @@ /// @param {Number} $gutter [$grid-column-gutter] - Space between columns, added as a left and right padding. @mixin flex-grid-column( $columns: null, $gutter: $grid-column-gutter ) { - @if $gutter != null { - $gutter: rem-calc($gutter) / 2; - } - @else { - @each $breakpoint, $gutter in $grid-column-responsive-gutter { - $padding: rem-calc($gutter) / 2; + // Base properties + flex: flex-grid-column($columns); + // Gutters + @if type-of($gutter) == 'map' { + @each $breakpoint, $value in $gutter { + $padding: rem-calc($value) / 2; + @include breakpoint($breakpoint) { padding-left: $padding; padding-right: $padding; } } } + @else if type-of($gutter) == 'number' and strip-unit($gutter) > 0 { + $padding: rem-calc($gutter) / 2; + padding-left: $padding; + padding-right: $padding; + } - flex: flex-grid-column($columns); - padding-left: $gutter; - padding-right: $gutter; - // max-width fixes IE 10/11 not respecting the flex-basis property @if $columns != null and $columns != shrink { max-width: grid-column($columns); } } +/// Creates a block grid for a flex grid row. +/// +/// @param {Number} $n - Number of columns to display on each row. +/// @param {String} $selector - Selector to use to target columns within the row. +@mixin flex-grid-layout( + $n, + $selector: '.column' +) { + flex-wrap: wrap; + + > #{$selector} { + $pct: percentage(1/$n); + + flex: 0 0 $pct; + max-width: $pct; + } +} + /// Changes the source order of a flex grid column. Columns with lower numbers appear first in the layout. /// @param {Number} $order [0] - Order number to apply. @mixin flex-grid-order($order: 0) { - order: $order; + @warn 'This mixin is being replaced by flex-order(). flex-grid-order() will be removed in Foundation 6.3.'; + @include flex-order($order); } /// Horizontally or vertically aligns the columns within a flex row. Apply this mixin to a flex row. /// /// @param {Keyword} $x [null] - Horizontal alignment to use. Can be `left`, `right`, `center`, `justify`, or `spaced`. Or, set it to `null` (the default) to not set horizontal alignment. /// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment. @mixin flex-grid-row-align($x: null, $y: null) { - @if $x { - @if map-has-key($-zf-flex-justify, $x) { - $x: map-get($-zf-flex-justify, $x); - } - @else { - @warn 'flex-grid-row-align(): #{$x} is not a valid value for horizontal alignment. Use left, right, center, justify, or spaced.' - } - } - - @if $y { - @if map-has-key($-zf-flex-align, $y) { - $y: map-get($-zf-flex-align, $y); - } - @else { - @warn 'flex-grid-row-align(): #{$y} is not a valid value for vertical alignment. Use top, bottom, middle, or stretch.' - } - } - - justify-content: $x; - align-items: $y; + @warn 'This mixin is being replaced by flex-align(). flex-grid-row-align() will be removed in Foundation 6.3.'; + @include flex-align($x, $y); } /// Vertically align a single column within a flex row. Apply this mixin to a flex column. /// /// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment. @mixin flex-grid-column-align($y: null) { - @if $y { - @if map-has-key($-zf-flex-align, $y) { - $y: map-get($-zf-flex-align, $y); - } - @else { - @warn 'flex-grid-column-align(): #{$y} is not a valid value for alignment. Use top, bottom, middle, or stretch.' - } - } - - align-self: $y; + @warn 'This mixin is being replaced by flex-align-self(). flex-grid-column-align() will be removed in Foundation 6.3.'; + @include flex-align-self($y); } @mixin foundation-flex-grid { // Row .row { @@ -218,17 +197,28 @@ .#{$-zf-size}-offset-#{$o} { @include grid-column-offset($o); } } + // Source ordering @for $i from 1 through 6 { - // Source ordering .#{$-zf-size}-order-#{$i} { - @include flex-grid-order($i); + @include flex-order($i); } + + .#{$-zf-size}-up-#{$i} { + @include flex-grid-layout($i); + } } + // Block grid + @for $i from 1 through $block-grid-max { + .#{$-zf-size}-up-#{$i} { + @include grid-layout($i); + } + } + @if $-zf-size != small { // Sizing (expand) @include breakpoint($-zf-size) { .#{$-zf-size}-expand { flex: flex-grid-column(); @@ -253,42 +243,26 @@ .#{$-zf-size}-collapse { > .column { @include grid-col-collapse; } } .#{$-zf-size}-uncollapse { - $gutter: null; + $gutter: -zf-get-bp-val($grid-column-gutter, $-zf-size); - @if $grid-column-gutter { - $gutter: $grid-column-gutter; - } - @else { - $gutter: -zf-get-bp-val($grid-column-responsive-gutter, $-zf-size); - } > .column { @include grid-col-uncollapse($gutter); } } } // Sizing (shrink) .shrink { flex: flex-grid-column(shrink); max-width: 100%; } - // Horizontal alignment using justify-content - @each $hdir, $prop in map-remove($-zf-flex-justify, left) { - .row.align-#{$hdir} { - @include flex-grid-row-align($x: $hdir); - } - } - // Vertical alignment using align-items and align-self + // Remove these in 6.3 @each $vdir, $prop in $-zf-flex-align { - .row.align-#{$vdir} { - @include flex-grid-row-align($y: $vdir); - } - .column.align-#{$vdir} { - @include flex-grid-column-align($vdir); + @include flex-align-self($vdir); } } .columns { // scss-lint:disable PlaceholderInExtend