Initial commit

This commit is contained in:
Samuel Philipp 2016-10-28 19:33:25 +02:00
commit b953a6c158
326 changed files with 76065 additions and 0 deletions

View file

@ -0,0 +1,151 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// Outputs CSS classes for the grid.
/// @access private
@mixin foundation-grid(
$row: 'row',
$column: 'column',
$column-row: 'column-row',
$push: 'push',
$pull: 'pull',
$center: 'centered',
$uncenter: 'uncentered',
$collapse: 'collapse',
$uncollapse: 'uncollapse',
$offset: 'offset',
$end: 'end',
$expanded: 'expanded'
) {
// Row
.#{$row} {
@include grid-row;
// Collapsing
&.#{$collapse} {
> .#{$column} {
@include grid-col-collapse;
}
}
// Nesting
& & {
@include grid-row-nest($grid-column-gutter);
&.#{$collapse} {
margin-left: 0;
margin-right: 0;
}
}
// Expanded (full-width) row
&.#{$expanded} {
max-width: none;
.#{$row} {
margin-left: auto;
margin-right: auto;
}
}
}
// Column
.#{$column} {
@include grid-col;
@if $grid-column-align-edge {
&.#{$end} {
@include grid-col-end;
}
}
}
// Column row
// The double .row class is needed to bump up the specificity
.#{$column}.#{$row}.#{$row} {
float: none;
// To properly nest a column row, padding and margin is removed
.#{$row} & {
padding-left: 0;
padding-right: 0;
margin-left: 0;
margin-right: 0;
}
}
@include -zf-each-breakpoint {
@for $i from 1 through $grid-column-count {
// Column width
.#{$-zf-size}-#{$i} {
@include grid-col-size($i);
}
// Source ordering
@if $i < $grid-column-count {
.#{$-zf-size}-#{$push}-#{$i} {
@include grid-col-pos($i);
}
.#{$-zf-size}-#{$pull}-#{$i} {
@include grid-col-pos(-$i);
}
}
// Offsets
$o: $i - 1;
.#{$-zf-size}-#{$offset}-#{$o} {
@include grid-col-off($o);
}
}
// Block grid
@for $i from 1 through $block-grid-max {
.#{$-zf-size}-up-#{$i} {
@include grid-layout($i, ".#{$column}");
}
}
// Responsive collapsing
.#{$-zf-size}-#{$collapse} {
> .#{$column} { @include grid-col-collapse; }
.#{$row},
.#{$expanded}.#{$row} &.#{$row} {
margin-left: 0;
margin-right: 0;
}
}
.#{$-zf-size}-#{$uncollapse} {
$gutter: -zf-get-bp-val($grid-column-gutter, $-zf-size);
> .#{$column} { @include grid-col-uncollapse($gutter); }
}
// Positioning
.#{$-zf-size}-#{$center} {
@include grid-col-pos(center);
}
// Gutter adjustment
.#{$-zf-size}-#{$uncenter},
.#{$-zf-size}-#{$push}-0,
.#{$-zf-size}-#{$pull}-0 {
@include grid-col-unpos;
}
}
@if $column == 'column' {
.columns {
// scss-lint:disable PlaceholderInExtend
@extend .column;
}
}
}

View file

@ -0,0 +1,126 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// Calculates the width of a column based on a number of factors.
///
/// @param {Number|List} $columns
/// Width of the column. Accepts multiple values:
/// - A percentage value will make the column that exact size.
/// - A single digit will make the column span that number of columns wide, taking into account the column count of the parent row.
/// - A string of the format "x of y" will make a column that is *x* columns wide, assuming *y* total columns for the parent.
///
/// @returns {Number} A calculated percentage value.
@function grid-column($columns) {
$width: 0%;
// Parsing percents, decimals, and column counts
@if type-of($columns) == 'number' {
@if unit($columns) == '%' {
$width: $columns;
}
@else if $columns < 1 {
$width: percentage($columns);
}
@else {
$width: percentage($columns / $grid-column-count);
}
}
// Parsing "n of n" expressions
@else if type-of($columns) == 'list' {
@if length($columns) != 3 {
@error 'Wrong syntax for grid-column(). Use the format "n of n".';
}
@else {
$width: percentage(nth($columns, 1) / nth($columns, 3));
}
}
// Anything else is incorrect
@else {
@error 'Wrong syntax for grid-column(). Use a number, decimal, percentage, or "n of n".';
}
@return $width;
}
/// Creates a grid column.
///
/// @param {Mixed} $columns [$grid-column-count] - Width of the column. Refer to the `grid-column()` function to see possible values.
/// @param {Number} $gutter [$grid-column-gutter] - Spacing between columns.
@mixin grid-column(
$columns: $grid-column-count,
$gutter: $grid-column-gutter
) {
@include grid-column-size($columns);
float: $global-left;
// 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;
}
// Last column alignment
@if $grid-column-align-edge {
&:last-child:not(:first-child) {
float: $global-right;
}
}
}
/// Creates a grid column row. This is the equivalent of adding `.row` and `.column` to the same element.
///
/// @param {Number} $gutter [$grid-column-gutter] - Width of the gutters on either side of the column row.
@mixin grid-column-row(
$gutter: $grid-column-gutter
) {
@include grid-row;
@include grid-column($gutter: $gutter);
&,
&:last-child {
float: none;
}
}
/// Shorthand for `grid-column()`.
/// @alias grid-column
@function grid-col(
$columns: $grid-column-count
) {
@return grid-column($columns);
}
/// Shorthand for `grid-column()`.
/// @alias grid-column
@mixin grid-col(
$columns: $grid-column-count,
$gutter: $grid-column-gutter
) {
@include grid-column($columns, $gutter);
}
/// Shorthand for `grid-column-row()`.
/// @alias grid-column-row
@mixin grid-col-row(
$gutter: $grid-column-gutter
) {
@include grid-column-row($gutter);
}

View file

@ -0,0 +1,274 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group flex-grid
////
/// 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.
/// @param {Number} $columns [null] - Number of columns to use for this row. If set to `null` (the default), the global column count will be used.
/// @param {Boolean} $base [true] - Set to `false` to prevent basic styles from being output. Useful if you're calling this mixin on the same element twice, as it prevents duplicate CSS output.
/// @param {Number} $gutter [$grid-column-gutter] - Gutter to use when inverting margins, in case the row is nested.
@mixin flex-grid-row(
$behavior: null,
$width: $grid-row-width,
$columns: null,
$base: true,
$gutter: $grid-column-gutter
) {
$margin: auto;
@if index($behavior, nest) != null {
@include grid-row-nest($gutter);
@if index($behavior, collapse) != null {
margin-left: 0;
margin-right: 0;
}
}
@else {
max-width: $width;
margin-left: auto;
margin-right: auto;
}
@if $base {
display: flex;
flex-flow: row wrap;
}
@if $columns != null {
@include grid-context($columns, $base) {
@content;
}
}
}
/// Calculates the `flex` property for a flex grid column. It accepts all of the same values as the basic `grid-column()` function, along with two extras:
/// - `null` (the default) will make the column expand to fill space.
/// - `shrink` will make the column contract, so it only takes up the horizontal space it needs.
///
/// @param {Mixed} $columns [null] - Width of the column.
@function flex-grid-column($columns: null) {
// scss-lint:disable ZeroUnit
$flex: 1 1 0px;
@if $columns == shrink {
$flex: 0 0 auto;
}
@else if $columns != null {
$flex: 0 0 grid-column($columns);
}
@return $flex;
}
/// Creates a column for a flex grid. By default, the column will stretch to the full width of its container, but this can be overridden with sizing classes, or by using the `unstack` class on the parent flex row.
///
/// @param {Mixed} $columns [null] - Width of the column. Refer to the `flex-grid-column()` function to see possible values.
/// @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
) {
// 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;
}
// fixes recent Chrome version not limiting child width
// https://stackoverflow.com/questions/34934586/white-space-nowrap-and-flexbox-did-not-work-in-chrome
@if $columns == null {
min-width: initial;
}
// 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) {
@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) {
@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) {
@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 {
@include flex-grid-row;
// Nesting behavior
& & {
@include flex-grid-row(nest, $base: false);
}
// Expanded row
&.expanded {
max-width: none;
}
&.collapse {
> .column { @include grid-col-collapse; }
}
}
// Column
.column {
@include flex-grid-column;
}
// Column row
// The double .row class is needed to bump up the specificity
.column.row.row {
float: none;
display: block;
// To properly nest a column row, padding and margin is removed
.row & {
padding-left: 0;
padding-right: 0;
margin-left: 0;
margin-right: 0;
}
}
@include -zf-each-breakpoint {
@for $i from 1 through $grid-column-count {
// Sizing (percentage)
.#{$-zf-size}-#{$i} {
flex: flex-grid-column($i);
max-width: grid-column($i);
}
// Offsets
$o: $i - 1;
.#{$-zf-size}-offset-#{$o} {
@include grid-column-offset($o);
}
}
// Source ordering
@for $i from 1 through 6 {
.#{$-zf-size}-order-#{$i} {
@include flex-order($i);
}
}
// Block grid
@for $i from 1 through $block-grid-max {
.#{$-zf-size}-up-#{$i} {
@include flex-grid-layout($i);
}
}
@if $-zf-size != $-zf-zero-breakpoint {
// Sizing (expand)
@include breakpoint($-zf-size) {
.#{$-zf-size}-expand {
flex: flex-grid-column();
}
}
// Auto-stacking/unstacking
@at-root (without: media) {
.row.#{$-zf-size}-unstack {
> .column {
flex: flex-grid-column(100%);
@include breakpoint($-zf-size) {
flex: flex-grid-column();
}
}
}
}
}
// Responsive collapsing
.#{$-zf-size}-collapse {
> .column { @include grid-col-collapse; }
}
.#{$-zf-size}-uncollapse {
$gutter: -zf-get-bp-val($grid-column-gutter, $-zf-size);
> .column { @include grid-col-uncollapse($gutter); }
}
}
// Sizing (shrink)
.shrink {
flex: flex-grid-column(shrink);
max-width: 100%;
}
// Vertical alignment using align-items and align-self
// Remove these in 6.3
@each $vdir, $prop in $-zf-flex-align {
.column.align-#{$vdir} {
@include flex-align-self($vdir);
}
}
.columns {
// scss-lint:disable PlaceholderInExtend
@extend .column;
}
}

View file

@ -0,0 +1,60 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// The maximum width of a row.
/// @type Number
$grid-row-width: $global-width !default;
/// The default column count of a grid. Changing this value affects the logic of the grid mixins, and the number of CSS classes output.
/// @type Number
$grid-column-count: 12 !default;
/// The amount of space between columns at different screen sizes. To use just one size, set the variable to a number instead of a map.
/// @type Map | Length
/// @since 6.1.0
$grid-column-gutter: (
small: 20px,
medium: 30px,
) !default;
/// If `true`, the last column in a row will align to the opposite edge of the row.
/// @type Boolean
$grid-column-align-edge: true !default;
/// The highest number of `.x-up` classes available when using the block grid CSS.
/// @type Number
$block-grid-max: 8 !default;
// Internal value to store the end column float direction
$-zf-end-float: if($grid-column-align-edge, $global-right, $global-left);
// The last piece to transition the responsive gutter feature
// Remove this in 6.3
$grid-column-responsive-gutter: null !default;
@if $grid-column-responsive-gutter {
// scss-lint:disable DebugStatement
@warn 'Rename $grid-column-responsive-gutter to $grid-column-gutter to remove this warning.';
$grid-column-gutter: $grid-column-responsive-gutter;
}
// If a single value is passed as a gutter, convert it to a map so the code knows what to do with it
@if type-of($grid-column-gutter) == 'number' {
$grid-column-gutter: (
small: $grid-column-gutter,
);
}
@import 'row';
@import 'column';
@import 'size';
@import 'position';
@import 'gutter';
@import 'classes';
@import 'layout';
@import 'flex-grid';

View file

@ -0,0 +1,34 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// Collapse the gutters on a column by removing the padding. **Note:** only use this mixin within a breakpoint. To collapse a column's gutters on all screen sizes, use the `$gutter` parameter of the `grid-column()` mixin instead.
@mixin grid-column-collapse {
padding-left: 0;
padding-right: 0;
}
/// Un-collapse the gutters on a column by re-adding the padding.
///
/// @param {Number} $gutter [$grid-column-gutter] - Spacing between columns.
@mixin grid-column-uncollapse($gutter: $grid-column-gutter) {
$gutter: rem-calc($gutter) / 2;
padding-left: $gutter;
padding-right: $gutter;
}
/// Shorthand for `grid-column-collapse()`.
/// @alias grid-column-collapse
@mixin grid-col-collapse {
@include grid-column-collapse;
}
/// Shorthand for `grid-column-uncollapse()`.
/// @alias grid-column-uncollapse
@mixin grid-col-uncollapse($gutter: $grid-column-gutter) {
@include grid-column-uncollapse($gutter);
}

View file

@ -0,0 +1,51 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// Sizes child elements so that `$n` number of items appear on each row.
///
/// @param {Number} $n - Number of elements to display per row.
/// @param {String} $selector ['.column'] - Selector(s) to use for child elements.
@mixin grid-layout(
$n,
$selector: '.column'
) {
& > #{$selector} {
width: percentage(1/$n);
float: $global-left;
&:nth-of-type(1n) {
clear: none;
}
&:nth-of-type(#{$n}n+1) {
clear: both;
}
&:last-child {
float: left;
}
}
}
/// Adds extra CSS to block grid children so the last items in the row center automatically. Apply this to the columns, not the row.
///
/// @param {Number} $n - Number of items that appear in each row.
@mixin grid-layout-center-last($n) {
@for $i from 1 to $n {
@if $i == 1 {
&:nth-child(#{$n}n+1):last-child {
margin-left: (100 - 100/$n * $i) / 2 * 1%;
}
}
@else {
&:nth-child(#{$n}n+1):nth-last-child(#{$i}) {
margin-left: (100 - 100/$n * $i) / 2 * 1%;
}
}
}
}

View file

@ -0,0 +1,73 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// Reposition a column.
///
/// @param {Number|Keyword} $position - Direction and amount to move. The column will move equal to the width of the column count specified. A positive number will push the column to the right, while a negative number will pull it to the left. Set to center to center the column.
@mixin grid-column-position($position) {
@if type-of($position) == 'number' {
$offset: percentage($position / $grid-column-count);
position: relative;
#{$global-left}: $offset;
}
@else if $position == center {
float: none;
margin-left: auto;
margin-right: auto;
}
@else {
@warn 'Wrong syntax for grid-column-position(). Enter a positive or negative number, or center.';
}
}
/// Reset a position definition.
@mixin grid-column-unposition {
position: static;
margin-left: 0;
margin-right: 0;
float: left;
}
/// Offsets a column to the right by `$n` columns.
/// @param {Number|List} $n - Width to offset by. You can pass in any value accepted by the `grid-column()` mixin, such as `6`, `50%`, or `1 of 2`.
@mixin grid-column-offset($n) {
margin-#{$global-left}: grid-column($n);
}
/// Disable the default behavior of the last column in a row aligning to the opposite edge.
@mixin grid-column-end {
// This extra specificity is required for the property to be applied
&:last-child:last-child {
float: $global-left;
}
}
/// Shorthand for `grid-column-position()`.
/// @alias grid-column-position
@mixin grid-col-pos($position) {
@include grid-column-position($position);
}
/// Shorthand for `grid-column-unposition()`.
/// @alias grid-column-unposition
@mixin grid-col-unpos {
@include grid-column-unposition;
}
/// Shorthand for `grid-column-offset()`.
/// @alias grid-column-offset
@mixin grid-col-off($n) {
@include grid-column-offset($n);
}
/// Shorthand for `grid-column-end()`.
/// @alias grid-column-end
@mixin grid-col-end {
@include grid-column-end;
}

View file

@ -0,0 +1,95 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// Change the behavior of columns defined inside this mixin to use a different column count.
/// @content
///
/// @param {Number} $columns - Number of columns to use.
/// @param {Boolean} $root [false]
/// If `false`, selectors inside this mixin will nest inside the parent selector.
/// If `true`, selectors will not nest.
@mixin grid-context(
$columns,
$root: false
) {
// Store the current column count so it can be re-set later
$old-grid-column-count: $grid-column-count;
$grid-column-count: $columns !global;
@if $root {
@at-root { @content; }
}
@else {
@content;
}
// Restore the old column count
$grid-column-count: $old-grid-column-count;
}
/// Creates a grid row.
/// @content
///
/// @param {Number} $columns [null] - Column count for this row. `null` will use the default column count.
/// @param {Keywords} $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.
/// @param {Boolean} $cf [true] - Whether or not to include a clearfix.
/// @param {Number} $gutter [$grid-column-gutter] - Gutter to use when inverting margins, in case the row is nested.
@mixin grid-row(
$columns: null,
$behavior: null,
$width: $grid-row-width,
$cf: true,
$gutter: $grid-column-gutter
) {
$margin: auto;
@if index($behavior, nest) != null {
@include grid-row-nest($gutter);
@if index($behavior, collapse) != null {
margin-left: 0;
margin-right: 0;
}
}
@else {
max-width: $width;
margin-left: auto;
margin-right: auto;
}
@if $cf {
@include clearfix;
}
@if $columns != null {
@include grid-context($columns) {
@content;
}
}
}
/// Inverts the margins of a row to nest it inside of a column.
///
/// @param {Map|null} $gutter [null] - Gutter value to use when inverting the margins. Set to `null` to refer to the responsive gutter settings.
@mixin grid-row-nest($gutter: $grid-column-gutter) {
@if type-of($gutter) == 'number' {
$gutter: ($-zf-zero-breakpoint: $gutter);
}
max-width: none;
@each $breakpoint, $value in $gutter {
$margin: rem-calc($value) / 2 * -1;
@include breakpoint($breakpoint) {
margin-left: $margin;
margin-right: $margin;
}
}
}

View file

@ -0,0 +1,24 @@
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group grid
////
/// Set the width of a grid column.
///
/// @param {Number|List} $width [$grid-column-count] - Width to make the column. You can pass in any value accepted by the `grid-column()` function, such as `6`, `50%`, or `1 of 2`.
@mixin grid-column-size(
$columns: $grid-column-count
) {
width: grid-column($columns);
}
/// Shorthand for `grid-column-size()`.
/// @alias grid-column-size
@mixin grid-col-size(
$columns: $grid-column-count
) {
@include grid-column-size($columns);
}