foundation-rails 6.3.1.0 → 6.4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/bower.json +3 -3
  3. data/lib/foundation/rails/version.rb +1 -1
  4. data/lib/generators/foundation/install_generator.rb +1 -1
  5. data/lib/generators/foundation/templates/_settings.scss +291 -48
  6. data/vendor/assets/js/entries/foundation-plugins.js +25 -0
  7. data/vendor/assets/js/entries/foundation.js +101 -0
  8. data/vendor/assets/js/entries/plugins/foundation.abide.js +4 -0
  9. data/vendor/assets/js/entries/plugins/foundation.accordion.js +4 -0
  10. data/vendor/assets/js/entries/plugins/foundation.accordionMenu.js +5 -0
  11. data/vendor/assets/js/entries/plugins/foundation.core.js +21 -0
  12. data/vendor/assets/js/entries/plugins/foundation.drilldown.js +4 -0
  13. data/vendor/assets/js/entries/plugins/foundation.dropdown.js +5 -0
  14. data/vendor/assets/js/entries/plugins/foundation.dropdownMenu.js +4 -0
  15. data/vendor/assets/js/entries/plugins/foundation.equalizer.js +4 -0
  16. data/vendor/assets/js/entries/plugins/foundation.interchange.js +4 -0
  17. data/vendor/assets/js/entries/plugins/foundation.magellan.js +4 -0
  18. data/vendor/assets/js/entries/plugins/foundation.offcanvas.js +4 -0
  19. data/vendor/assets/js/entries/plugins/foundation.orbit.js +5 -0
  20. data/vendor/assets/js/entries/plugins/foundation.responsiveAccordionTabs.js +5 -0
  21. data/vendor/assets/js/entries/plugins/foundation.responsiveMenu.js +5 -0
  22. data/vendor/assets/js/entries/plugins/foundation.responsiveToggle.js +5 -0
  23. data/vendor/assets/js/entries/plugins/foundation.reveal.js +4 -0
  24. data/vendor/assets/js/entries/plugins/foundation.slider.js +5 -0
  25. data/vendor/assets/js/entries/plugins/foundation.smoothScroll.js +5 -0
  26. data/vendor/assets/js/entries/plugins/foundation.sticky.js +5 -0
  27. data/vendor/assets/js/entries/plugins/foundation.tabs.js +5 -0
  28. data/vendor/assets/js/entries/plugins/foundation.toggler.js +5 -0
  29. data/vendor/assets/js/entries/plugins/foundation.tooltip.js +4 -0
  30. data/vendor/assets/js/entries/plugins/foundation.util.box.js +4 -0
  31. data/vendor/assets/js/entries/plugins/foundation.util.imageLoader.js +5 -0
  32. data/vendor/assets/js/entries/plugins/foundation.util.keyboard.js +4 -0
  33. data/vendor/assets/js/entries/plugins/foundation.util.mediaQuery.js +4 -0
  34. data/vendor/assets/js/entries/plugins/foundation.util.motion.js +5 -0
  35. data/vendor/assets/js/entries/plugins/foundation.util.nest.js +5 -0
  36. data/vendor/assets/js/entries/plugins/foundation.util.timer.js +5 -0
  37. data/vendor/assets/js/entries/plugins/foundation.util.touch.js +7 -0
  38. data/vendor/assets/js/entries/plugins/foundation.util.triggers.js +5 -0
  39. data/vendor/assets/js/foundation.abide.js.es6 +18 -15
  40. data/vendor/assets/js/foundation.accordion.js.es6 +37 -23
  41. data/vendor/assets/js/foundation.accordionMenu.js.es6 +96 -51
  42. data/vendor/assets/js/foundation.core.js.es6 +46 -87
  43. data/vendor/assets/js/foundation.drilldown.js.es6 +47 -29
  44. data/vendor/assets/js/foundation.dropdown.js.es6 +84 -122
  45. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +44 -28
  46. data/vendor/assets/js/foundation.equalizer.js.es6 +18 -17
  47. data/vendor/assets/js/foundation.interchange.js.es6 +26 -19
  48. data/vendor/assets/js/foundation.js.es6 +8 -3
  49. data/vendor/assets/js/foundation.magellan.js.es6 +36 -30
  50. data/vendor/assets/js/foundation.offcanvas.js.es6 +148 -36
  51. data/vendor/assets/js/foundation.orbit.js.es6 +26 -18
  52. data/vendor/assets/js/foundation.plugin.js.es6 +54 -0
  53. data/vendor/assets/js/foundation.positionable.js.es6 +206 -0
  54. data/vendor/assets/js/{foundation.zf.responsiveAccordionTabs.js.es6 → foundation.responsiveAccordionTabs.js.es6} +33 -30
  55. data/vendor/assets/js/foundation.responsiveMenu.js.es6 +37 -29
  56. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +17 -16
  57. data/vendor/assets/js/foundation.reveal.js.es6 +61 -79
  58. data/vendor/assets/js/foundation.slider.js.es6 +33 -18
  59. data/vendor/assets/js/foundation.smoothScroll.js.es6 +135 -0
  60. data/vendor/assets/js/foundation.sticky.js.es6 +25 -17
  61. data/vendor/assets/js/foundation.tabs.js.es6 +35 -27
  62. data/vendor/assets/js/foundation.toggler.js.es6 +15 -13
  63. data/vendor/assets/js/foundation.tooltip.js.es6 +100 -108
  64. data/vendor/assets/js/foundation.util.box.js.es6 +114 -78
  65. data/vendor/assets/js/foundation.util.core.js.es6 +52 -0
  66. data/vendor/assets/js/foundation.util.imageLoader.js.es6 +45 -0
  67. data/vendor/assets/js/foundation.util.keyboard.js.es6 +41 -31
  68. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +59 -55
  69. data/vendor/assets/js/foundation.util.motion.js.es6 +4 -5
  70. data/vendor/assets/js/foundation.util.nest.js.es6 +9 -23
  71. data/vendor/assets/js/{foundation.util.timerAndImageLoader.js.es6 → foundation.util.timer.js.es6} +2 -42
  72. data/vendor/assets/js/foundation.util.touch.js.es6 +91 -294
  73. data/vendor/assets/js/foundation.util.triggers.js.es6 +199 -141
  74. data/vendor/assets/scss/_global.scss +29 -1
  75. data/vendor/assets/scss/components/_accordion-menu.scss +148 -13
  76. data/vendor/assets/scss/components/_accordion.scss +5 -0
  77. data/vendor/assets/scss/components/_breadcrumbs.scss +26 -9
  78. data/vendor/assets/scss/components/_button-group.scss +4 -4
  79. data/vendor/assets/scss/components/_button.scss +59 -12
  80. data/vendor/assets/scss/components/_card.scss +10 -2
  81. data/vendor/assets/scss/components/_drilldown.scss +90 -41
  82. data/vendor/assets/scss/components/_dropdown-menu.scss +52 -6
  83. data/vendor/assets/scss/components/_dropdown.scss +8 -1
  84. data/vendor/assets/scss/components/_flex.scss +85 -2
  85. data/vendor/assets/scss/components/_menu.scss +267 -162
  86. data/vendor/assets/scss/components/_off-canvas.scss +159 -45
  87. data/vendor/assets/scss/components/_pagination.scss +1 -1
  88. data/vendor/assets/scss/components/_reveal.scss +13 -11
  89. data/vendor/assets/scss/components/_slider.scss +0 -1
  90. data/vendor/assets/scss/components/_sticky.scss +1 -0
  91. data/vendor/assets/scss/components/_table.scss +7 -6
  92. data/vendor/assets/scss/components/_tabs.scss +1 -1
  93. data/vendor/assets/scss/components/_title-bar.scss +1 -1
  94. data/vendor/assets/scss/components/_tooltip.scss +74 -21
  95. data/vendor/assets/scss/components/_top-bar.scss +2 -0
  96. data/vendor/assets/scss/forms/_fieldset.scss +0 -1
  97. data/vendor/assets/scss/forms/_meter.scss +7 -1
  98. data/vendor/assets/scss/forms/_select.scss +4 -3
  99. data/vendor/assets/scss/forms/_text.scss +11 -2
  100. data/vendor/assets/scss/foundation.scss +17 -3
  101. data/vendor/assets/scss/grid/_flex-grid.scss +3 -52
  102. data/vendor/assets/scss/prototype/_arrow.scss +36 -0
  103. data/vendor/assets/scss/prototype/_border-box.scss +35 -0
  104. data/vendor/assets/scss/prototype/_border-none.scss +35 -0
  105. data/vendor/assets/scss/prototype/_bordered.scss +54 -0
  106. data/vendor/assets/scss/prototype/_box.scss +23 -0
  107. data/vendor/assets/scss/prototype/_display.scss +50 -0
  108. data/vendor/assets/scss/prototype/_font-styling.scss +95 -0
  109. data/vendor/assets/scss/prototype/_list-style-type.scss +95 -0
  110. data/vendor/assets/scss/prototype/_overflow.scss +72 -0
  111. data/vendor/assets/scss/prototype/_position.scss +114 -0
  112. data/vendor/assets/scss/prototype/_prototype.scss +91 -0
  113. data/vendor/assets/scss/prototype/_relation.scss +157 -0
  114. data/vendor/assets/scss/prototype/_rotate.scss +31 -0
  115. data/vendor/assets/scss/prototype/_rounded.scss +54 -0
  116. data/vendor/assets/scss/prototype/_separator.scss +96 -0
  117. data/vendor/assets/scss/prototype/_shadow.scss +43 -0
  118. data/vendor/assets/scss/prototype/_sizing.scss +73 -0
  119. data/vendor/assets/scss/prototype/_spacing.scss +204 -0
  120. data/vendor/assets/scss/prototype/_text-decoration.scss +48 -0
  121. data/vendor/assets/scss/prototype/_text-transformation.scss +48 -0
  122. data/vendor/assets/scss/prototype/_text-utilities.scss +88 -0
  123. data/vendor/assets/scss/prototype/_typescale.scss +20 -0
  124. data/vendor/assets/scss/settings/_settings.scss +291 -48
  125. data/vendor/assets/scss/typography/_base.scss +2 -2
  126. data/vendor/assets/scss/typography/_helpers.scss +6 -4
  127. data/vendor/assets/scss/util/_breakpoint.scss +60 -1
  128. data/vendor/assets/scss/util/_color.scss +8 -5
  129. data/vendor/assets/scss/util/_mixins.scss +45 -5
  130. data/vendor/assets/scss/xy-grid/_cell.scss +179 -0
  131. data/vendor/assets/scss/xy-grid/_classes.scss +455 -0
  132. data/vendor/assets/scss/xy-grid/_collapse.scss +54 -0
  133. data/vendor/assets/scss/xy-grid/_frame.scss +54 -0
  134. data/vendor/assets/scss/xy-grid/_grid.scss +56 -0
  135. data/vendor/assets/scss/xy-grid/_gutters.scss +45 -0
  136. data/vendor/assets/scss/xy-grid/_layout.scss +33 -0
  137. data/vendor/assets/scss/xy-grid/_position.scss +28 -0
  138. data/vendor/assets/scss/xy-grid/_xy-grid.scss +52 -0
  139. metadata +73 -4
@@ -469,10 +469,10 @@ $abbr-underline: 1px dotted $black !default;
469
469
  }
470
470
 
471
471
  // Abbreviations
472
- abbr {
472
+ abbr, abbr[title] {
473
473
  border-bottom: $abbr-underline;
474
- color: $body-font-color;
475
474
  cursor: help;
475
+ text-decoration: none;
476
476
  }
477
477
 
478
478
  // Figures
@@ -70,9 +70,11 @@ $stat-font-size: 2.5rem !default;
70
70
  }
71
71
  }
72
72
 
73
- // Use to remove the bullets from an unordered list
74
- .no-bullet {
75
- margin-#{$global-left}: 0;
76
- list-style: none;
73
+ ul, ol {
74
+ // Use to remove numbers from ordered list & bullets from unordered list
75
+ &.no-bullet {
76
+ margin-#{$global-left}: 0;
77
+ list-style: none;
78
+ }
77
79
  }
78
80
  }
@@ -144,6 +144,10 @@ $breakpoint-classes: (small medium large) !default;
144
144
  $bp: index($-zf-breakpoints-keys, $value);
145
145
  $pbp: index($-zf-breakpoints-keys, $print-breakpoint);
146
146
 
147
+ // Make breakpoint size available as a variable
148
+ $old-zf-size: $-zf-zero-breakpoint;
149
+ $-zf-size: nth($value, 1) !global; // get the first value to account for `only` and `down` keywords
150
+
147
151
  // If $str is still an empty string, no media query is needed
148
152
  @if $str == '' {
149
153
  @content;
@@ -163,6 +167,9 @@ $breakpoint-classes: (small medium large) !default;
163
167
  }
164
168
  }
165
169
  }
170
+
171
+ // Restore the old breakpoint size
172
+ $-zf-size: $old-zf-size !global;
166
173
  }
167
174
 
168
175
  /// Convers the breakpoints map to a URL-encoded string, like this: `key1=value1&key2=value2`. The value is then dropped into the CSS for a special `<meta>` tag, which is read by the Foundation JavaScript. This is how we transfer values from Sass to JavaScript, so they can be defined in one place.
@@ -211,6 +218,53 @@ $breakpoint-classes: (small medium large) !default;
211
218
 
212
219
  }
213
220
 
221
+ /// Return a list of our named breakpoints less than $key. Useful for dealing with
222
+ /// responsive gutters for the grid.
223
+ /// @access private
224
+ ///
225
+ /// @param {String} $key - Key to use as last breakpoint.
226
+ ///
227
+ /// @returns {Array} The list of breakpoints up to and. If $key is auto, returns breakpoints above the zero
228
+ @function -zf-breakpoints-less-than($key) {
229
+ $list: ();
230
+ $found_key: false;
231
+
232
+ @each $name in $-zf-breakpoints-keys {
233
+ @if ($name == $key) {
234
+ $found_key: true;
235
+ }
236
+ @if not $found_key {
237
+ $list: append($list, $name);
238
+ }
239
+ }
240
+ @return $list;
241
+ }
242
+
243
+ /// Return a list of our named breakpoints less than $key. Useful for dealing with
244
+ /// responsive gutters for the grid.
245
+ /// @access private
246
+ ///
247
+ /// @param {String} $breakpoing - a named or non-named breakpoing.
248
+ ///
249
+ /// @returns {Array} The list of breakpoints up to and. If $key is auto, returns breakpoints above the zero
250
+ @function -zf-closest-named-breakpoint($breakpoint) {
251
+ $last: $-zf-zero-breakpoint;
252
+ $found: false;
253
+
254
+ $value: unitless-calc($breakpoint, 1px);
255
+ @each $key, $val in $breakpoints {
256
+ @if not $found {
257
+ @if unitless-calc($val) > $value {
258
+ $found: true;
259
+ } @else {
260
+ $last: $key;
261
+ }
262
+ }
263
+ }
264
+
265
+ @return $last;
266
+ }
267
+
214
268
  /// Get a value for a breakpoint from a responsive config map or single value.
215
269
  /// - If the config is a single value, return it regardless of `$value`.
216
270
  /// - If the config is a map and has the key `$value`, the exact breakpoint value is returned.
@@ -227,9 +281,14 @@ $breakpoint-classes: (small medium large) !default;
227
281
  @return $map;
228
282
  }
229
283
 
284
+
230
285
  // Check if the breakpoint name exists globally
231
286
  @if not map-has-key($breakpoints, $value) {
232
- @return null;
287
+ @if type-of($value) == 'number' {
288
+ $value: -zf-closest-named-breakpoint($value);
289
+ } @else {
290
+ @return null;
291
+ }
233
292
  }
234
293
  // Check if the breakpoint name exists in the local config map
235
294
  @else if map-has-key($map, $value) {
@@ -4,6 +4,8 @@
4
4
 
5
5
  @import 'math';
6
6
 
7
+ $contrast-warnings: true !default;
8
+
7
9
  ////
8
10
  /// @group functions
9
11
  ////
@@ -55,11 +57,12 @@
55
57
 
56
58
  /// Checks the luminance of `$base`, and returns the color from `$colors` (list of colors) that has the most contrast.
57
59
  ///
58
- /// @param {Color} $color1 - First color to compare.
59
- /// @param {Color} $color2 - Second color to compare.
60
+ /// @param {Color} $base - Color to check luminance.
61
+ /// @param {List} $colors [($white, $black)] - Colors to compare.
62
+ /// @param {Number} $tolerance [$global-color-pick-contrast-tolerance] - Contrast tolerance.
60
63
  ///
61
- /// @returns {Number} The contrast ratio of the compared colors.
62
- @function color-pick-contrast($base, $colors: ($white, $black), $tolerance: 0) {
64
+ /// @returns {Color} the color from `$colors` (list of colors) that has the most contrast.
65
+ @function color-pick-contrast($base, $colors: ($white, $black), $tolerance: $global-color-pick-contrast-tolerance) {
63
66
  $contrast: color-contrast($base, nth($colors, 1));
64
67
  $best: nth($colors, 1);
65
68
 
@@ -71,7 +74,7 @@
71
74
  }
72
75
  }
73
76
 
74
- @if ($contrast < 3) {
77
+ @if ($contrast-warnings and $contrast < 3) {
75
78
  @warn "Contrast ratio of #{$best} on #{$base} is pretty bad, just #{$contrast}";
76
79
  }
77
80
 
@@ -6,6 +6,33 @@
6
6
  /// @group functions
7
7
  ////
8
8
 
9
+ /// Creates an inner box-shadow for only one side
10
+ ///
11
+ /// @param {Keyword} $side - Side the shadow is supposed to appear. Can be `top`, `left`, `right` or `bottom`.
12
+ /// @param {Number} $size - Width for the target side.
13
+ /// @param {Color} $color - Color of the shadow.
14
+ @mixin inner-side-shadow(
15
+ $side: bottom,
16
+ $size: 20px,
17
+ $color: rgba($black, 0.25)
18
+ ) {
19
+
20
+ $helper: round($size * 0.65);
21
+
22
+ @if ($side == top) {
23
+ box-shadow: inset 0 $helper $size (-1)*$helper $color;
24
+ }
25
+ @elseif ($side == left) {
26
+ box-shadow: inset $helper 0 $size (-1)*$helper $color;
27
+ }
28
+ @elseif ($side == right) {
29
+ box-shadow: inset (-1)*$helper 0 $size (-1)*$helper $color;
30
+ }
31
+ @elseif ($side == bottom) {
32
+ box-shadow: inset 0 (-1)*$helper $size (-1)*$helper $color;
33
+ }
34
+ }
35
+
9
36
  /// Creates a CSS triangle, which can be used for dropdown arrows, dropdown pips, and more. Use this mixin inside a `&::before` or `&::after` selector, to attach the triangle to an existing element.
10
37
  ///
11
38
  /// @param {Number} $triangle-size - Width of the triangle.
@@ -99,7 +126,7 @@
99
126
  background: $color;
100
127
  box-shadow: $shadow;
101
128
 
102
- content: '';
129
+ content: '';
103
130
  }
104
131
 
105
132
  // Hover state
@@ -182,12 +209,17 @@
182
209
 
183
210
  /// Makes an element visually hidden, but still accessible to keyboards and assistive devices.
184
211
  /// @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility Hiding Content for Accessibility
212
+ /// @link http://hugogiraudel.com/2016/10/13/css-hide-and-seek/
185
213
  @mixin element-invisible {
186
214
  position: absolute !important;
187
215
  width: 1px;
188
216
  height: 1px;
217
+ padding: 0;
189
218
  overflow: hidden;
190
- clip: rect(0, 0, 0, 0);
219
+ clip: rect(0,0,0,0);
220
+ white-space: nowrap;
221
+ clip-path: inset(50%);
222
+ border: 0;
191
223
  }
192
224
 
193
225
  /// Reverses the CSS output created by the `element-invisible()` mixin.
@@ -197,6 +229,8 @@
197
229
  height: auto;
198
230
  overflow: visible;
199
231
  clip: auto;
232
+ white-space: normal;
233
+ clip-path: none;
200
234
  }
201
235
 
202
236
  /// Vertically centers the element inside of its first non-static parent,
@@ -227,7 +261,8 @@
227
261
  /// Iterates through breakpoints defined in `$breakpoint-classes` and prints the CSS inside the mixin at each breakpoint's media query. Use this with the grid, or any other component that has responsive classes.
228
262
  ///
229
263
  /// @param {Boolean} $small [true] - If `false`, the mixin will skip the `small` breakpoint. Use this with components that don't prefix classes with `small-`, only `medium-` and up.
230
- @mixin -zf-each-breakpoint($small: true) {
264
+ /// @param {Boolean} $auto-insert-breakpoints [true] - If `false`, the mixin will iterate over breakpoints without doing the media query itself. Useful for more complex media query generation as in the margin grid.
265
+ @mixin -zf-each-breakpoint($small: true, $auto-insert-breakpoints: true) {
231
266
  $list: $breakpoint-classes;
232
267
 
233
268
  @if not $small {
@@ -237,7 +272,12 @@
237
272
  @each $name in $list {
238
273
  $-zf-size: $name !global;
239
274
 
240
- @include breakpoint($name) {
275
+ @if $auto-insert-breakpoints {
276
+ @include breakpoint($name) {
277
+ @content;
278
+ }
279
+ }
280
+ @else {
241
281
  @content;
242
282
  }
243
283
  }
@@ -247,7 +287,7 @@
247
287
  /// - For a single value, `$-zf-bp-value` is this value.
248
288
  /// - For a breakpoint name, `$-zf-bp-value` is the corresponding breakpoint value in `$map`.
249
289
  /// - For "auto", `$-zf-bp-value` is the corresponding breakpoint value in `$map` and is passed to `@content`, which is made responsive for each breakpoint of `$map`.
250
- /// @param {Number|Keyword} $name [auto] - Single value or breakpoint name to use. "auto" by default.
290
+ /// @param {Number|Array|Keyword} $name [auto] - Single value, breakpoint name, or list of breakpoint names to use. "auto" by default.
251
291
  /// @param {Number|Map} $map - Map of breakpoints and values or single value to use.
252
292
  @mixin -zf-breakpoint-value(
253
293
  $name: auto,
@@ -0,0 +1,179 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group xy-grid
7
+ ////
8
+
9
+ /// Calculate the percentage size of a cell.
10
+ ///
11
+ /// @param {Number|List} $size [$grid-columns] - Size to make the cell. You can pass a value in multiple formats, such as `6`, `50%`, `1 of 2 or 1/3.
12
+ @function xy-cell-size(
13
+ $size: $grid-columns
14
+ ) {
15
+ // Parsing percents, decimals, n of n and number counts
16
+ @if type-of($size) == 'number' {
17
+ @if unit($size) == '%' {
18
+ $size: $size;
19
+ }
20
+ @else if $size < 1 {
21
+ $size: percentage($size);
22
+ }
23
+ @else {
24
+ $size: percentage($size / $grid-columns);
25
+ }
26
+ }
27
+
28
+ // Parsing "n of n" or "n/n" expressions
29
+ @elseif type-of($size) == 'list' {
30
+ @if length($size) != 3 {
31
+ @error 'Wrong syntax for xy-cell-size(). Use the format "n of n" or "n/n".';
32
+ }
33
+ @else {
34
+ $size: percentage(nth($size, 1) / nth($size, 3));
35
+ }
36
+ }
37
+ // Anything else is incorrect
38
+ @else {
39
+ @error 'Wrong syntax for xy-cell-size(). Use a number, decimal, percentage, or "n of n" / "n/n".';
40
+ }
41
+
42
+ @return $size;
43
+ }
44
+
45
+ /// Sets base flex properties for cells.
46
+ ///
47
+ /// @param {Keyword} $size [full] - The size of your cell. Accepts `full`, `auto` or `shrink`.
48
+ @mixin xy-cell-base($size: full) {
49
+ @if($size == 'full') {
50
+ // This is the base style, all others inherit from it
51
+ flex: 0 0 auto;
52
+ min-height: 0px;
53
+ min-width: 0px;
54
+ }
55
+ @elseif ($size == 'auto') {
56
+ flex: 1 1 0px; // sass-lint:disable-line zero-unit
57
+ }
58
+ @elseif ($size == 'shrink') {
59
+ flex: 0 0 auto;
60
+ }
61
+ }
62
+
63
+ /// Resets a cells width (or height if vertical is true) as well as strips its gutters.
64
+ ///
65
+ /// @param {Boolean} $vertical [false] - Set to true to output vertical (height) styles rather than widths.
66
+ @mixin xy-cell-reset($vertical: true) {
67
+ $direction: if($vertical == true, width, height);
68
+ #{$direction}: auto;
69
+ }
70
+
71
+ // Sets our cell widths or heights depending on gutter type.
72
+ @mixin -xy-cell-properties($size, $margin-gutter, $vertical) {
73
+ $direction: if($vertical == true, height, width);
74
+ @if($size == 'full') {
75
+ $val: if($margin-gutter == 0, 100%, calc(100% - #{rem-calc($margin-gutter)}));
76
+ #{$direction}: $val;
77
+ }
78
+ @elseif ($size == 'auto') {
79
+ #{$direction}: auto;
80
+ $val: if($margin-gutter == 0, 100%, calc(100% - #{rem-calc($margin-gutter)}));
81
+ }
82
+ @elseif ($size == 'shrink') {
83
+ #{$direction}: auto;
84
+ }
85
+ @else {
86
+ $val: if($margin-gutter == 0, #{xy-cell-size($size)}, calc(#{xy-cell-size($size)} - #{rem-calc($margin-gutter)}));
87
+ #{$direction}: $val;
88
+ }
89
+ }
90
+
91
+ /// Creates a cell for your grid.
92
+ ///
93
+ /// @param {Keyword|Number} $size [full] - The size of your cell. Can be `full` (default) for 100% width, `auto` to use up available space and `shrink` to use up only required space.
94
+ /// @param {Boolean} $gutter-output [true] - Whether or not to output gutters
95
+ /// @param {Number|Map} $gutters [$grid-margin-gutters] - Map or single value for gutters.
96
+ /// @param {Keyword} $gutter-type [margin] - Map or single value for gutters.
97
+ /// @param {List} $gutter-position [right left] - The position to apply gutters to. Accepts `top`, `bottom`, `left`, `right` in any combination.
98
+ /// @param {String} $breakpoint [null] - The name of the breakpoint size in your gutters map to get the size from. If using with the `breakpoint()` mixin this will be set automatically unless manually entered.
99
+ /// @param {Boolean} $vertical [false] - Set to true to output vertical (height) styles rather than widths.
100
+ @mixin xy-cell(
101
+ $size: full,
102
+ $gutter-output: true,
103
+ $gutters: $grid-margin-gutters,
104
+ $gutter-type: margin,
105
+ $gutter-position: right left,
106
+ $breakpoint: null,
107
+ $vertical: false
108
+ ) {
109
+ @if($breakpoint == null) {
110
+ // If `$bp-size` is available then use this, otherwise revert to the smallest bp.
111
+ @if(variable-exists(-zf-size) and type-of($-zf-size) != 'number') {
112
+ $breakpoint: $-zf-size;
113
+ }
114
+ @else {
115
+ $breakpoint: $-zf-zero-breakpoint;
116
+ }
117
+ }
118
+
119
+ // Get our gutters from map if available, if not map just return the value.
120
+ $gutter: -zf-get-bp-val($gutters, $breakpoint);
121
+
122
+ // Base flex properties
123
+ @include xy-cell-base($size);
124
+
125
+ @if($gutter-type == 'margin') {
126
+ @include -xy-cell-properties($size, $gutter, $vertical);
127
+ }
128
+ @else {
129
+ @include -xy-cell-properties($size, 0, $vertical);
130
+ }
131
+
132
+ @if $gutter-output {
133
+ // If gutters = map
134
+ @if(type-of($gutters) == 'map') {
135
+ // If $gutters map has a key = $breakpoint, output the value
136
+ @if (map-has-key($gutters, $breakpoint)) {
137
+ @include xy-gutters($gutter, $gutter-type, $gutter-position);
138
+ }
139
+ }
140
+ // If not a map
141
+ @else {
142
+ @include xy-gutters($gutter, $gutter-type, $gutter-position);
143
+ }
144
+ }
145
+ }
146
+
147
+ /// Creates a single breakpoint sized grid. Used to generate our grid classes.
148
+ ///
149
+ /// @param {Keyword|Number} $size [full] - The size of your cell. Can be `full` (default) for 100% width, `auto` to use up available space and `shrink` to use up only required space.
150
+ /// @param {Boolean} $gutter-output [true] - Whether or not to output gutters
151
+ /// @param {Number|Map} $gutters [$grid-margin-gutters] - Map or single value for gutters.
152
+ /// @param {Keyword} $gutter-type [margin] - Map or single value for gutters.
153
+ /// @param {String} $breakpoint [null] - The name of the breakpoint size in your gutters map to get the size from. If using with the `breakpoint()` mixin this will be set automatically unless manually entered.
154
+ /// @param {Boolean} $vertical [false] - Set to true to output vertical (height) styles rather than widths.
155
+ @mixin xy-cell-static(
156
+ $size: full,
157
+ $gutter-output: true,
158
+ $gutters: $grid-margin-gutters,
159
+ $gutter-type: margin,
160
+ $breakpoint: $-zf-zero-breakpoint,
161
+ $vertical: false
162
+ ) {
163
+
164
+ $gutter: -zf-get-bp-val($gutters, $breakpoint);
165
+ $gutter-position: if($vertical == true, top bottom, left right);
166
+
167
+ @if($gutter-type == 'margin') {
168
+ @include -xy-cell-properties($size, $gutter, $vertical);
169
+ }
170
+ @else {
171
+ @include -xy-cell-properties($size, 0, $vertical);
172
+ }
173
+
174
+ // If we want to output the gutters
175
+ @if($gutter-output) {
176
+ // TODO: Figure out if we need to pass breakpoint in here too.
177
+ @include xy-gutters($gutter, $gutter-type, $gutter-position);
178
+ }
179
+ }
@@ -0,0 +1,455 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group xy-grid
7
+ ////
8
+
9
+ // Margin Grid classes
10
+ @mixin xy-base-grid-classes {
11
+
12
+ // Grid Container
13
+ .grid-container {
14
+ @include xy-grid-container;
15
+ }
16
+
17
+ .grid-container-padded {
18
+ @include xy-grid-container-padding;
19
+ }
20
+
21
+ // Base grid styles
22
+ .grid-x {
23
+ @include xy-grid;
24
+ }
25
+
26
+ .cell {
27
+ @include xy-cell-base();
28
+ @include xy-cell-static($grid-columns, false, $gutter-type: padding);
29
+
30
+ &.auto {
31
+ @include xy-cell-base(auto);
32
+ }
33
+
34
+ &.shrink {
35
+ @include xy-cell-base(shrink);
36
+ }
37
+
38
+ }
39
+ .grid-x {
40
+ > .auto {
41
+ @include xy-cell-static(auto, false);
42
+ }
43
+
44
+ > .shrink {
45
+ @include xy-cell-static(shrink, false);
46
+ }
47
+ }
48
+
49
+ // Auto width
50
+ @include -zf-each-breakpoint() {
51
+ // This is a bit of a hack/workaround, see these issues & PRs for the backstory:
52
+ // https://github.com/zurb/foundation-sites/issues/10244
53
+ // https://github.com/zurb/foundation-sites/pull/10222 and
54
+ // https://github.com/zurb/foundation-sites/pull/10164
55
+ .grid-x {
56
+ $str: "> #{$-zf-size}-shrink, > #{$-zf-size}-full";
57
+ @for $i from 1 through $grid-columns {
58
+ $str: $str + ", > #{$-zf-size}-#{$i}"
59
+ }
60
+ #{$str} {
61
+ flex-basis: auto;
62
+ }
63
+ }
64
+ }
65
+
66
+ @include -zf-each-breakpoint() {
67
+ @if not($-zf-size == small) {
68
+ .grid-x > .#{$-zf-size}-auto {
69
+ @include xy-cell-base(auto);
70
+ @include xy-cell-static(auto, false);
71
+ }
72
+
73
+ .grid-x > .#{$-zf-size}-shrink {
74
+ @include xy-cell-base(shrink);
75
+ @include xy-cell-static(shrink, false);
76
+ }
77
+ }
78
+
79
+ @for $i from 1 through $grid-columns {
80
+ // Sizing (percentage)
81
+ .grid-x > .#{$-zf-size}-#{$i} {
82
+ @include xy-cell-static($i, false, $gutter-type: padding);
83
+ }
84
+ }
85
+ }
86
+
87
+ // Reset width when using `.grid-margin-x` not on `.grid-x`
88
+ .grid-margin-x:not(.grid-x) > .cell {
89
+ width: auto;
90
+ }
91
+
92
+ // Reset height when using `.grid-margin-y` not on `.grid-y`
93
+ .grid-margin-y:not(.grid-y) > .cell {
94
+ height: auto;
95
+ }
96
+ }
97
+
98
+ @mixin -xy-breakpoint-cell-classes($class-breakpoint, $gutter-breakpoint, $vertical) {
99
+ $prefix: if($class-breakpoint == $-zf-zero-breakpoint, '', '#{$class-breakpoint}-');
100
+ > .#{$prefix}auto {
101
+ @include xy-cell-static(auto, false, $breakpoint: $gutter-breakpoint, $vertical: $vertical);
102
+ }
103
+
104
+ > .#{$prefix}shrink {
105
+ @include xy-cell-static(shrink, false, $breakpoint: $gutter-breakpoint, $vertical: $vertical);
106
+ }
107
+
108
+ @for $i from 1 through $grid-columns {
109
+ // Sizing (percentage)
110
+ $classname: if($vertical, '.#{$class-breakpoint}-#{$i}', '.#{$class-breakpoint}-#{$i}');
111
+
112
+ > #{$classname} {
113
+ @include xy-cell-static($i, false, $breakpoint: $gutter-breakpoint, $vertical: $vertical);
114
+ }
115
+ }
116
+ }
117
+
118
+ // Margin Grid classes
119
+ @mixin xy-margin-grid-classes(
120
+ $gutter-position: left right,
121
+ $vertical: false,
122
+ $wrapping-selector: '.grid-margin-x'
123
+ ){
124
+ #{$wrapping-selector} {
125
+ @include xy-gutters($negative: true, $gutter-position: $gutter-position);
126
+
127
+ // Base cell styles
128
+ > .cell {
129
+ @include xy-cell-static($vertical: $vertical);
130
+ }
131
+
132
+ // base styles need to all be before the auto and shrink styles
133
+ @include -zf-each-breakpoint() {
134
+ @if(type-of($grid-margin-gutters) == 'map' and map-has-key($grid-margin-gutters, $-zf-size) and $-zf-size != $-zf-zero-breakpoint) {
135
+ > .cell {
136
+ @include xy-cell-static($breakpoint: $-zf-size, $vertical: $vertical);
137
+ }
138
+ }
139
+ }
140
+
141
+ @include -zf-each-breakpoint() {
142
+
143
+ // This is purely for responsive gutters - the margin grid has to go back and adjust widths (or heights)
144
+ // for prior breakpoints based on the responsive gutter.
145
+ @if(type-of($grid-margin-gutters) == 'map' and map-has-key($grid-margin-gutters, $-zf-size)) {
146
+ @each $bp in -zf-breakpoints-less-than($-zf-size) {
147
+ @if(map-has-key($grid-margin-gutters, $bp)) {
148
+ @include -xy-breakpoint-cell-classes($bp, $-zf-size, $vertical);
149
+ }
150
+ }
151
+ }
152
+
153
+ @include -xy-breakpoint-cell-classes($-zf-size, $-zf-size, $vertical);
154
+ }
155
+ }
156
+ }
157
+
158
+ // Padding Grid classes
159
+ @mixin xy-padding-grid-classes {
160
+ .grid-padding-x {
161
+
162
+ // Negative margin for nested grids
163
+ .grid-padding-x {
164
+ @include xy-gutters($negative: true);
165
+ }
166
+
167
+ // Base cell styles
168
+ > .cell {
169
+ @include xy-gutters($gutters: $grid-padding-gutters, $gutter-type: padding);
170
+ }
171
+ }
172
+ }
173
+
174
+ // Block Grid classes
175
+ @mixin xy-block-grid-classes($margin-grid: true, $padding-grid: true) {
176
+ @if $padding-grid {
177
+ @include -zf-each-breakpoint {
178
+ @for $i from 1 through $block-grid-max {
179
+ .#{$-zf-size}-up-#{$i} {
180
+ @include xy-grid-layout($i, '.cell', false, $gutter-type: padding);
181
+ }
182
+ }
183
+ }
184
+ }
185
+
186
+ @if $margin-grid {
187
+ @include -zf-each-breakpoint {
188
+ @for $i from 1 through $block-grid-max {
189
+ // This is purely for responsive gutters - the margin grid has to go back and adjust widths (or heights)
190
+ // for prior breakpoints based on the responsive gutter.
191
+ @if(type-of($grid-margin-gutters) == 'map' and map-has-key($grid-margin-gutters, $-zf-size)) {
192
+ @each $bp in -zf-breakpoints-less-than($-zf-size) {
193
+ @if(map-has-key($grid-margin-gutters, $bp)) {
194
+ .grid-margin-x.#{$bp}-up-#{$i} {
195
+ @include xy-grid-layout($i, '.cell', false, $gutter-type: margin, $breakpoint: $bp);
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
201
+ @for $i from 1 through $block-grid-max {
202
+ .grid-margin-x.#{$-zf-size}-up-#{$i} {
203
+ @include xy-grid-layout($i, '.cell', false, $gutter-type: margin, $breakpoint: $-zf-size);
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+
210
+ // Collapse classes
211
+ @mixin xy-collapse-grid-classes($margin-grid: true, $padding-grid: true) {
212
+ @include -zf-each-breakpoint {
213
+ @if $margin-grid {
214
+ .#{$-zf-size}-margin-collapse {
215
+ @include xy-grid-collapse($gutter-type: margin);
216
+ }
217
+ }
218
+
219
+ @if $padding-grid {
220
+ .#{$-zf-size}-padding-collapse {
221
+ @include xy-grid-collapse($gutter-type: padding);
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ // Offset classes
228
+ @mixin xy-offset-cell-classes {
229
+ @include -zf-each-breakpoint {
230
+ @for $i from 1 through $grid-columns {
231
+ // Offsets
232
+ $o: $i - 1;
233
+
234
+ .#{$-zf-size}-offset-#{$o} {
235
+ @include xy-cell-offset($o, $gutters: $grid-padding-gutters, $gutter-type: padding, $breakpoint: $-zf-size);
236
+ }
237
+
238
+ .grid-margin-x > .#{$-zf-size}-offset-#{$o} {
239
+ @include xy-cell-offset($o, $breakpoint: $-zf-size);
240
+ }
241
+ }
242
+ }
243
+ }
244
+
245
+ // Vertical Grid classes
246
+ @mixin xy-vertical-grid-classes(
247
+ $margin-grid: true,
248
+ $padding-grid: true
249
+ ) {
250
+
251
+ @include -zf-each-breakpoint() {
252
+ @if not($-zf-size == small) {
253
+ }
254
+ }
255
+
256
+ .grid-y {
257
+ @include xy-grid(vertical, false);
258
+
259
+
260
+ > .cell {
261
+ @include xy-cell-reset();
262
+ }
263
+
264
+ > .auto {
265
+ @include xy-cell-static(auto, false, $breakpoint: $-zf-size, $vertical: true);
266
+ }
267
+
268
+ > .shrink {
269
+ @include xy-cell-static(shrink, false, $breakpoint: $-zf-size, $vertical: true);
270
+ }
271
+
272
+
273
+ @include -zf-each-breakpoint() {
274
+ // This is a bit of a hack/workaround, see these issues and PRs for the backstory:
275
+ // https://github.com/zurb/foundation-sites/issues/10244
276
+ // https://github.com/zurb/foundation-sites/pull/10222 and
277
+ // https://github.com/zurb/foundation-sites/pull/10164
278
+ $str: "> #{$-zf-size}-shrink, > #{$-zf-size}-full";
279
+ @for $i from 1 through $grid-columns {
280
+ $str: $str + ", > #{$-zf-size}-#{$i}"
281
+ }
282
+ #{$str} {
283
+ flex-basis: auto;
284
+ }
285
+ }
286
+
287
+ @include -zf-each-breakpoint() {
288
+ @if not($-zf-size == small) {
289
+ > .#{$-zf-size}-auto {
290
+ @include xy-cell-base(auto);
291
+ @include xy-cell-static(auto, false, $breakpoint: $-zf-size, $vertical: true);
292
+ }
293
+
294
+ > .#{$-zf-size}-shrink {
295
+ @include xy-cell-static(shrink, false, $breakpoint: $-zf-size, $vertical: true);
296
+ }
297
+
298
+ }
299
+
300
+ @for $i from 1 through $grid-columns {
301
+ // Sizing (percentage)
302
+ > .#{$-zf-size}-#{$i} {
303
+ @include xy-cell-static($i, false, $vertical: true, $gutter-type: padding);
304
+ }
305
+ }
306
+
307
+ }
308
+ }
309
+
310
+ @if $padding-grid {
311
+ .grid-padding-y {
312
+ // Negative margin for nested grids
313
+ .grid-padding-y {
314
+ @include xy-gutters($negative: true, $gutter-position: top bottom);
315
+ }
316
+
317
+ // Base cell styles
318
+ > .cell {
319
+ @include xy-gutters($gutters: $grid-padding-gutters, $gutter-type: padding, $gutter-position: top bottom);
320
+ }
321
+ }
322
+ }
323
+
324
+ @if $margin-grid {
325
+ @include xy-margin-grid-classes(top bottom, true, '.grid-margin-y')
326
+ }
327
+ }
328
+
329
+ @mixin xy-frame-grid-classes($vertical-grid: true) {
330
+ // Framed grid styles
331
+ .grid-frame {
332
+ @include xy-grid-frame;
333
+ }
334
+
335
+ .cell .grid-frame {
336
+ width: 100%; // Same as include with $nested, but with less css
337
+ }
338
+
339
+ .cell-block {
340
+ @include xy-cell-block();
341
+ }
342
+
343
+ .cell-block-y {
344
+ @include xy-cell-block(true);
345
+ }
346
+
347
+
348
+ .cell-block-container {
349
+ @include xy-cell-block-container();
350
+ }
351
+
352
+
353
+ @include -zf-each-breakpoint(false) {
354
+
355
+ .#{$-zf-size}-grid-frame {
356
+ @include xy-grid-frame;
357
+ }
358
+
359
+ .cell .#{$-zf-size}-grid-frame {
360
+ width: 100%; // Same as include with $nested, but with less css
361
+ }
362
+
363
+ .#{$-zf-size}-cell-block {
364
+ @include xy-cell-block();
365
+ }
366
+
367
+ .#{$-zf-size}-cell-block-container {
368
+ @include xy-cell-block-container();
369
+ }
370
+
371
+ .#{$-zf-size}-cell-block-y {
372
+ @include xy-cell-block(true);
373
+ }
374
+ }
375
+
376
+ @if $vertical-grid {
377
+
378
+ .grid-y {
379
+ &.grid-frame {
380
+ width: auto;
381
+ @include xy-grid-frame(true);
382
+ }
383
+
384
+ @include -zf-each-breakpoint(false) {
385
+ &.#{$-zf-size}-grid-frame {
386
+ width: auto;
387
+ @include xy-grid-frame(true);
388
+ }
389
+
390
+ }
391
+ }
392
+ .cell {
393
+ .grid-y.grid-frame {
394
+ height: 100%; // Same as include with $nested, but with less css
395
+ }
396
+ @include -zf-each-breakpoint(false) {
397
+ .grid-y.#{$-zf-size}-grid-frame {
398
+ height: 100%; // Same as include with $nested, but with less css
399
+ }
400
+ }
401
+ }
402
+ }
403
+ }
404
+
405
+ // Final classes
406
+ @mixin foundation-xy-grid-classes(
407
+ $base-grid: true,
408
+ $margin-grid: true,
409
+ $padding-grid: true,
410
+ $block-grid: true,
411
+ $collapse: true,
412
+ $offset: true,
413
+ $vertical-grid: true,
414
+ $frame-grid: true
415
+ ) {
416
+
417
+ // Base grid styles
418
+ @if($base-grid) {
419
+ @include xy-base-grid-classes();
420
+ }
421
+
422
+ // Margin grid
423
+ @if($margin-grid) {
424
+ @include xy-margin-grid-classes();
425
+ }
426
+
427
+ // Padding grid
428
+ @if($padding-grid) {
429
+ @include xy-padding-grid-classes();
430
+ }
431
+
432
+ // Block grid
433
+ @if($block-grid) {
434
+ @include xy-block-grid-classes($margin-grid, $padding-grid);
435
+ }
436
+
437
+ // Collapse gutters
438
+ @if($collapse) {
439
+ @include xy-collapse-grid-classes($margin-grid, $padding-grid);
440
+ }
441
+
442
+ // Offset gutters
443
+ @if($offset) {
444
+ @include xy-offset-cell-classes();
445
+ }
446
+
447
+ // Vertical grid
448
+ @if($vertical-grid) {
449
+ @include xy-vertical-grid-classes($margin-grid, $padding-grid);
450
+ }
451
+
452
+ @if ($frame-grid) {
453
+ @include xy-frame-grid-classes($vertical-grid)
454
+ }
455
+ }