foundation-rails 6.5.3.0 → 6.6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +100 -86
  3. data/bower.json +2 -2
  4. data/foundation-rails.gemspec +5 -5
  5. data/lib/foundation/rails/version.rb +1 -1
  6. data/lib/generators/foundation/templates/_settings.scss +37 -11
  7. data/vendor/assets/js/foundation.cjs.js +1060 -370
  8. data/vendor/assets/js/foundation.cjs.js.map +1 -1
  9. data/vendor/assets/js/foundation.es6.js +926 -326
  10. data/vendor/assets/js/foundation.es6.js.map +1 -1
  11. data/vendor/assets/js/foundation.esm.js +1048 -358
  12. data/vendor/assets/js/foundation.esm.js.map +1 -1
  13. data/vendor/assets/js/foundation.js +1063 -393
  14. data/vendor/assets/js/foundation.js.map +1 -1
  15. data/vendor/assets/js/foundation.min.js +1 -1
  16. data/vendor/assets/js/foundation.min.js.map +1 -1
  17. data/vendor/assets/js/plugins/foundation.abide.js +201 -11
  18. data/vendor/assets/js/plugins/foundation.abide.js.map +1 -1
  19. data/vendor/assets/js/plugins/foundation.abide.min.js +1 -1
  20. data/vendor/assets/js/plugins/foundation.abide.min.js.map +1 -1
  21. data/vendor/assets/js/plugins/foundation.accordion.js +22 -19
  22. data/vendor/assets/js/plugins/foundation.accordion.js.map +1 -1
  23. data/vendor/assets/js/plugins/foundation.accordion.min.js +1 -1
  24. data/vendor/assets/js/plugins/foundation.accordion.min.js.map +1 -1
  25. data/vendor/assets/js/plugins/foundation.accordionMenu.js +2 -4
  26. data/vendor/assets/js/plugins/foundation.accordionMenu.js.map +1 -1
  27. data/vendor/assets/js/plugins/foundation.accordionMenu.min.js +1 -1
  28. data/vendor/assets/js/plugins/foundation.accordionMenu.min.js.map +1 -1
  29. data/vendor/assets/js/plugins/foundation.core.js +140 -28
  30. data/vendor/assets/js/plugins/foundation.core.js.map +1 -1
  31. data/vendor/assets/js/plugins/foundation.core.min.js +1 -1
  32. data/vendor/assets/js/plugins/foundation.core.min.js.map +1 -1
  33. data/vendor/assets/js/plugins/foundation.drilldown.js +29 -19
  34. data/vendor/assets/js/plugins/foundation.drilldown.js.map +1 -1
  35. data/vendor/assets/js/plugins/foundation.drilldown.min.js +1 -1
  36. data/vendor/assets/js/plugins/foundation.drilldown.min.js.map +1 -1
  37. data/vendor/assets/js/plugins/foundation.dropdown.js +30 -13
  38. data/vendor/assets/js/plugins/foundation.dropdown.js.map +1 -1
  39. data/vendor/assets/js/plugins/foundation.dropdown.min.js +1 -1
  40. data/vendor/assets/js/plugins/foundation.dropdown.min.js.map +1 -1
  41. data/vendor/assets/js/plugins/foundation.dropdownMenu.js +67 -38
  42. data/vendor/assets/js/plugins/foundation.dropdownMenu.js.map +1 -1
  43. data/vendor/assets/js/plugins/foundation.dropdownMenu.min.js +1 -1
  44. data/vendor/assets/js/plugins/foundation.dropdownMenu.min.js.map +1 -1
  45. data/vendor/assets/js/plugins/foundation.equalizer.js +1 -1
  46. data/vendor/assets/js/plugins/foundation.equalizer.min.js +1 -1
  47. data/vendor/assets/js/plugins/foundation.equalizer.min.js.map +1 -1
  48. data/vendor/assets/js/plugins/foundation.interchange.js +48 -13
  49. data/vendor/assets/js/plugins/foundation.interchange.js.map +1 -1
  50. data/vendor/assets/js/plugins/foundation.interchange.min.js +1 -1
  51. data/vendor/assets/js/plugins/foundation.interchange.min.js.map +1 -1
  52. data/vendor/assets/js/plugins/foundation.magellan.js +340 -12
  53. data/vendor/assets/js/plugins/foundation.magellan.js.map +1 -1
  54. data/vendor/assets/js/plugins/foundation.magellan.min.js +1 -1
  55. data/vendor/assets/js/plugins/foundation.magellan.min.js.map +1 -1
  56. data/vendor/assets/js/plugins/foundation.offcanvas.js +234 -56
  57. data/vendor/assets/js/plugins/foundation.offcanvas.js.map +1 -1
  58. data/vendor/assets/js/plugins/foundation.offcanvas.min.js +1 -1
  59. data/vendor/assets/js/plugins/foundation.offcanvas.min.js.map +1 -1
  60. data/vendor/assets/js/plugins/foundation.orbit.js +31 -4
  61. data/vendor/assets/js/plugins/foundation.orbit.js.map +1 -1
  62. data/vendor/assets/js/plugins/foundation.orbit.min.js +1 -1
  63. data/vendor/assets/js/plugins/foundation.orbit.min.js.map +1 -1
  64. data/vendor/assets/js/plugins/foundation.responsiveAccordionTabs.js +91 -18
  65. data/vendor/assets/js/plugins/foundation.responsiveAccordionTabs.js.map +1 -1
  66. data/vendor/assets/js/plugins/foundation.responsiveAccordionTabs.min.js +1 -1
  67. data/vendor/assets/js/plugins/foundation.responsiveAccordionTabs.min.js.map +1 -1
  68. data/vendor/assets/js/plugins/foundation.responsiveMenu.js +1 -1
  69. data/vendor/assets/js/plugins/foundation.responsiveMenu.min.js +1 -1
  70. data/vendor/assets/js/plugins/foundation.responsiveMenu.min.js.map +1 -1
  71. data/vendor/assets/js/plugins/foundation.responsiveToggle.js +1 -1
  72. data/vendor/assets/js/plugins/foundation.responsiveToggle.min.js +1 -1
  73. data/vendor/assets/js/plugins/foundation.responsiveToggle.min.js.map +1 -1
  74. data/vendor/assets/js/plugins/foundation.reveal.js +19 -12
  75. data/vendor/assets/js/plugins/foundation.reveal.js.map +1 -1
  76. data/vendor/assets/js/plugins/foundation.reveal.min.js +1 -1
  77. data/vendor/assets/js/plugins/foundation.reveal.min.js.map +1 -1
  78. data/vendor/assets/js/plugins/foundation.slider.js +20 -15
  79. data/vendor/assets/js/plugins/foundation.slider.js.map +1 -1
  80. data/vendor/assets/js/plugins/foundation.slider.min.js +1 -1
  81. data/vendor/assets/js/plugins/foundation.slider.min.js.map +1 -1
  82. data/vendor/assets/js/plugins/foundation.smoothScroll.js +2 -2
  83. data/vendor/assets/js/plugins/foundation.smoothScroll.js.map +1 -1
  84. data/vendor/assets/js/plugins/foundation.smoothScroll.min.js +1 -1
  85. data/vendor/assets/js/plugins/foundation.smoothScroll.min.js.map +1 -1
  86. data/vendor/assets/js/plugins/foundation.sticky.js +26 -18
  87. data/vendor/assets/js/plugins/foundation.sticky.js.map +1 -1
  88. data/vendor/assets/js/plugins/foundation.sticky.min.js +1 -1
  89. data/vendor/assets/js/plugins/foundation.sticky.min.js.map +1 -1
  90. data/vendor/assets/js/plugins/foundation.tabs.js +24 -21
  91. data/vendor/assets/js/plugins/foundation.tabs.js.map +1 -1
  92. data/vendor/assets/js/plugins/foundation.tabs.min.js +1 -1
  93. data/vendor/assets/js/plugins/foundation.tabs.min.js.map +1 -1
  94. data/vendor/assets/js/plugins/foundation.toggler.js +24 -9
  95. data/vendor/assets/js/plugins/foundation.toggler.js.map +1 -1
  96. data/vendor/assets/js/plugins/foundation.toggler.min.js +1 -1
  97. data/vendor/assets/js/plugins/foundation.toggler.min.js.map +1 -1
  98. data/vendor/assets/js/plugins/foundation.tooltip.js +31 -18
  99. data/vendor/assets/js/plugins/foundation.tooltip.js.map +1 -1
  100. data/vendor/assets/js/plugins/foundation.tooltip.min.js +1 -1
  101. data/vendor/assets/js/plugins/foundation.tooltip.min.js.map +1 -1
  102. data/vendor/assets/js/plugins/foundation.util.box.js +1 -59
  103. data/vendor/assets/js/plugins/foundation.util.box.js.map +1 -1
  104. data/vendor/assets/js/plugins/foundation.util.box.min.js +1 -1
  105. data/vendor/assets/js/plugins/foundation.util.box.min.js.map +1 -1
  106. data/vendor/assets/js/plugins/foundation.util.imageLoader.js +1 -1
  107. data/vendor/assets/js/plugins/foundation.util.imageLoader.min.js +1 -1
  108. data/vendor/assets/js/plugins/foundation.util.imageLoader.min.js.map +1 -1
  109. data/vendor/assets/js/plugins/foundation.util.keyboard.js +9 -8
  110. data/vendor/assets/js/plugins/foundation.util.keyboard.js.map +1 -1
  111. data/vendor/assets/js/plugins/foundation.util.keyboard.min.js +1 -1
  112. data/vendor/assets/js/plugins/foundation.util.keyboard.min.js.map +1 -1
  113. data/vendor/assets/js/plugins/foundation.util.mediaQuery.js +121 -17
  114. data/vendor/assets/js/plugins/foundation.util.mediaQuery.js.map +1 -1
  115. data/vendor/assets/js/plugins/foundation.util.mediaQuery.min.js +1 -1
  116. data/vendor/assets/js/plugins/foundation.util.mediaQuery.min.js.map +1 -1
  117. data/vendor/assets/js/plugins/foundation.util.motion.js +1 -2
  118. data/vendor/assets/js/plugins/foundation.util.motion.js.map +1 -1
  119. data/vendor/assets/js/plugins/foundation.util.motion.min.js +1 -1
  120. data/vendor/assets/js/plugins/foundation.util.motion.min.js.map +1 -1
  121. data/vendor/assets/js/plugins/foundation.util.nest.js +1 -1
  122. data/vendor/assets/js/plugins/foundation.util.nest.min.js +1 -1
  123. data/vendor/assets/js/plugins/foundation.util.nest.min.js.map +1 -1
  124. data/vendor/assets/js/plugins/foundation.util.timer.js +1 -1
  125. data/vendor/assets/js/plugins/foundation.util.timer.min.js +1 -1
  126. data/vendor/assets/js/plugins/foundation.util.timer.min.js.map +1 -1
  127. data/vendor/assets/js/plugins/foundation.util.touch.js +2 -2
  128. data/vendor/assets/js/plugins/foundation.util.touch.js.map +1 -1
  129. data/vendor/assets/js/plugins/foundation.util.touch.min.js +1 -1
  130. data/vendor/assets/js/plugins/foundation.util.touch.min.js.map +1 -1
  131. data/vendor/assets/js/plugins/foundation.util.triggers.js +3 -2
  132. data/vendor/assets/js/plugins/foundation.util.triggers.js.map +1 -1
  133. data/vendor/assets/js/plugins/foundation.util.triggers.min.js +1 -1
  134. data/vendor/assets/js/plugins/foundation.util.triggers.min.js.map +1 -1
  135. data/vendor/assets/scss/components/_accordion.scss +10 -2
  136. data/vendor/assets/scss/components/_button-group.scss +37 -10
  137. data/vendor/assets/scss/components/_button.scss +119 -104
  138. data/vendor/assets/scss/components/_callout.scss +12 -10
  139. data/vendor/assets/scss/components/_close-button.scss +28 -3
  140. data/vendor/assets/scss/components/_menu.scss +5 -1
  141. data/vendor/assets/scss/components/_off-canvas.scss +6 -1
  142. data/vendor/assets/scss/components/_pagination.scss +10 -2
  143. data/vendor/assets/scss/components/_switch.scss +14 -0
  144. data/vendor/assets/scss/components/_table.scss +1 -0
  145. data/vendor/assets/scss/forms/_select.scss +4 -0
  146. data/vendor/assets/scss/foundation.scss +8 -3
  147. data/vendor/assets/scss/grid/_classes.scss +25 -12
  148. data/vendor/assets/scss/grid/_column.scss +1 -31
  149. data/vendor/assets/scss/prototype/_rounded.scss +6 -2
  150. data/vendor/assets/scss/prototype/_spacing.scss +7 -5
  151. data/vendor/assets/scss/settings/_settings.scss +37 -11
  152. data/vendor/assets/scss/typography/_base.scss +16 -51
  153. data/vendor/assets/scss/typography/_helpers.scss +100 -0
  154. data/vendor/assets/scss/typography/_print.scss +8 -2
  155. data/vendor/assets/scss/util/_breakpoint.scss +172 -97
  156. data/vendor/assets/scss/util/_math.scss +75 -0
  157. data/vendor/assets/scss/util/_mixins.scss +81 -25
  158. data/vendor/assets/scss/util/_value.scss +40 -0
  159. data/vendor/assets/scss/xy-grid/_cell.scss +186 -99
  160. data/vendor/assets/scss/xy-grid/_classes.scss +26 -29
  161. data/vendor/assets/scss/xy-grid/_collapse.scss +2 -2
  162. data/vendor/assets/scss/xy-grid/_layout.scss +10 -8
  163. data/vendor/assets/scss/xy-grid/_position.scss +32 -9
  164. metadata +8 -9
@@ -70,3 +70,78 @@
70
70
  $h: nth($ratio, 3);
71
71
  @return $h / $w * 100%;
72
72
  }
73
+
74
+ /// Parse the given `$fraction` to numerators and denumerators.
75
+ ///
76
+ /// @param {*} $fraction - Value representing a fraction to parse. It can be formatted as `50%`, `1 of 2`, `1/2` or `50` (no denominator would be returned).
77
+ ///
78
+ /// @return {List} List of parsed values with numerator at first position and denumerator as second. These values may be null.
79
+ @function zf-parse-fraction($fraction) {
80
+
81
+ @if type-of($fraction) == 'number' {
82
+ // "50%"
83
+ @if unit($fraction) == '%' {
84
+ @return (strip-unit($fraction), 100);
85
+ }
86
+ @else if (unit($fraction) == '') {
87
+ // "0.5"
88
+ @if $fraction < 1 {
89
+ @return ($fraction * 100, 100);
90
+ }
91
+ // "50"
92
+ @else {
93
+ @return ($fraction, null);
94
+ }
95
+ }
96
+ }
97
+
98
+ @else if type-of($fraction) == 'list' {
99
+ // "50 of 100", "50/100"...
100
+ @if length($fraction) == 3
101
+ and type-of(nth($fraction, 1) == 'number')
102
+ and type-of(nth($fraction, 3) == 'number') {
103
+ @return (nth($fraction, 1), nth($fraction, 3));
104
+ }
105
+ }
106
+
107
+ @return (null, null);
108
+ }
109
+
110
+ /// Returns whether the given `$value` represents a fraction. Supports formats like `50%`, `1 of 2`, `1 per 2` or `1/2`.
111
+ ///
112
+ /// @param {*} $value - Value to test.
113
+ /// @param {Boolean} $allow-no-denominator [false] - If `true`, simple numbers without denominators like `50` are supported.
114
+ ///
115
+ /// @return {Boolean} `true` if `$value` represents a fraction, `false` otherwise.
116
+ @function zf-is-fraction($value, $allow-no-denominator: false) {
117
+ $parsed: zf-parse-fraction($value);
118
+ @return not(nth($parsed, 1) == null
119
+ or (nth($parsed, 2) == null and $allow-no-denominator == false));
120
+ }
121
+
122
+ /// Calculate a percentage from a given fraction.
123
+ ///
124
+ /// @param {Number|List} $fraction - Value representing a fraction to use to calculate the percentage, formatted as `50` (relative to `$denominator`), `50%`, `1 of 2` or `1/2`.
125
+ /// @param {Number|List} $denominator - Default value to use as denominator when `$fraction` represents an absolute value.
126
+ @function fraction-to-percentage(
127
+ $fraction,
128
+ $denominator: null
129
+ ) {
130
+ $parsed: zf-parse-fraction($fraction);
131
+ $parsed-nominator: nth($parsed, 1);
132
+ $parsed-denominator: nth($parsed, 2);
133
+
134
+ @if $parsed-nominator == null {
135
+ @error 'Wrong syntax for "fraction-to-percentage()". Use a number, decimal, percentage, or "n of n" / "n/n".';
136
+ }
137
+ @if $parsed-denominator == null {
138
+ @if type-of($denominator) == 'number' {
139
+ $parsed-denominator: $denominator;
140
+ }
141
+ @else {
142
+ @error 'Error with "fraction-to-percentage()". A default "$denominator" is required to support absolute values';
143
+ }
144
+ }
145
+
146
+ @return percentage($parsed-nominator / $parsed-denominator);
147
+ }
@@ -207,25 +207,36 @@
207
207
  /// Makes an element visually hidden, but still accessible to keyboards and assistive devices.
208
208
  /// @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility Hiding Content for Accessibility
209
209
  /// @link http://hugogiraudel.com/2016/10/13/css-hide-and-seek/
210
- @mixin element-invisible {
211
- position: absolute !important;
212
- width: 1px;
213
- height: 1px;
214
- padding: 0;
215
- overflow: hidden;
216
- clip: rect(0,0,0,0);
217
- white-space: nowrap;
218
- border: 0;
210
+ ///
211
+ /// @param {Boolean} $enforce - If `true`, use `!important` on applied properties
212
+ @mixin element-invisible(
213
+ $enforce: true
214
+ ) {
215
+ $important: if($enforce, '!important', null);
216
+
217
+ position: absolute #{$important};
218
+ width: 1px #{$important};
219
+ height: 1px #{$important};
220
+ padding: 0 #{$important};
221
+ overflow: hidden #{$important};
222
+ clip: rect(0,0,0,0) #{$important};
223
+ white-space: nowrap #{$important};
224
+ border: 0 #{$important};
219
225
  }
220
226
 
221
227
  /// Reverses the CSS output created by the `element-invisible()` mixin.
222
- @mixin element-invisible-off {
223
- position: static !important;
224
- width: auto;
225
- height: auto;
226
- overflow: visible;
227
- clip: auto;
228
- white-space: normal;
228
+ /// @param {Boolean} $enforce - If `true`, use `!important` on applied properties
229
+ @mixin element-invisible-off(
230
+ $enforce: true
231
+ ) {
232
+ $important: if($enforce, '!important', null);
233
+
234
+ position: static #{$important};
235
+ width: auto #{$important};
236
+ height: auto #{$important};
237
+ overflow: visible #{$important};
238
+ clip: auto #{$important};
239
+ white-space: normal #{$important};
229
240
  }
230
241
 
231
242
  /// Vertically centers the element inside of its first non-static parent,
@@ -257,22 +268,64 @@
257
268
  ///
258
269
  /// @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.
259
270
  /// @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.
260
- @mixin -zf-each-breakpoint($small: true, $auto-insert-breakpoints: true) {
261
- $list: $breakpoint-classes;
271
+ @mixin -zf-each-breakpoint(
272
+ $small: true,
273
+ $auto-insert-breakpoints: true
274
+ ) {
275
+ @include -zf-each-breakpoint-in(auto, -zf-bool($small), -zf-bool($auto-insert-breakpoints)) {
276
+ @content
277
+ };
278
+ }
279
+
280
+ /// Iterates with `@content` through the given list of breakpoints `$breakpoints`.
281
+ ///
282
+ /// @access private
283
+ ///
284
+ /// @param {Keyword|List} $breakpoints [auto] - Breakpoints to iterates on. It can be a breakpoint name, list of breakpoints or `auto` for all breakpoints.
285
+ /// @param {Boolean|Null} $zero-breakpoint [null] - Whether the zero-breakpoint (often `small`) must be included. If `true`, it will always be added to the list if not already there. If `false`, it will always be removed. Does nothing by default.
286
+ /// @param {Boolean|Keyword} $media-queries [true] - Whether media-queries must be generated. If `for-lists`, only generate media-queries when `$breakpoints` is a list.
287
+ @mixin -zf-each-breakpoint-in(
288
+ $breakpoints: auto,
289
+ $zero-breakpoint: null,
290
+ $media-queries: true
291
+ ) {
292
+ $-list: ();
293
+ $-breakpoints-is-a-list: true;
262
294
 
263
- @if not $small {
264
- $list: sl-remove($list, $-zf-zero-breakpoint);
295
+ // Retrieve the list of breakpoint(s) to iterate on.
296
+ @if $breakpoints == auto {
297
+ $-list: $breakpoint-classes;
298
+ }
299
+ @else if type-of($breakpoints) == 'list' {
300
+ $-list: $breakpoints;
301
+ }
302
+ @else if type-of($breakpoints) == 'string' {
303
+ $-list: ($breakpoints);
304
+ $-breakpoints-is-a-list: false;
305
+ }
306
+ @else {
307
+ @error 'Wrong syntax for "$breakpoints" in "-zf-each-breakpoint-in()". Got "#{$breakpoints}" (#{type-of($breakpoints)}). Expected a breakpoint name, a list of breakpoints or "auto"';
265
308
  }
266
309
 
267
- @each $name in $list {
310
+ // Add or remove the zero breakpoint according to `$zero-breakpoint`
311
+ @if $zero-breakpoint == true {
312
+ $-list: join(($-zf-zero-breakpoint), sl-remove($-list, $-zf-zero-breakpoint));
313
+ }
314
+ @else if $zero-breakpoint == false {
315
+ $-list: sl-remove($-list, $-zf-zero-breakpoint);
316
+ }
317
+
318
+ // Iterate on breakpoint(s)
319
+ @each $bp in $-list {
268
320
  $old-zf-size: null;
269
321
  @if global-variable-exists(-zf-size) {
270
322
  $old-zf-size: $-zf-size;
271
323
  }
272
- $-zf-size: $name !global;
324
+ $-zf-size: $bp !global;
273
325
 
274
- @if $auto-insert-breakpoints {
275
- @include breakpoint($name) {
326
+ @if ($media-queries == true
327
+ or ($media-queries == 'for-lists' and $-breakpoints-is-a-list)) {
328
+ @include breakpoint($bp) {
276
329
  @content;
277
330
  }
278
331
  }
@@ -307,7 +360,10 @@
307
360
  @else {
308
361
  // breakpoint name
309
362
  @if type-of($name) == 'string' {
310
- $name: -zf-get-bp-val($map, $name);
363
+ $bp-value: -zf-get-bp-val($map, $name);
364
+ @if $bp-value != null {
365
+ $name: $bp-value;
366
+ }
311
367
  }
312
368
 
313
369
  // breakpoint value
@@ -139,6 +139,35 @@
139
139
 
140
140
  }
141
141
 
142
+ /// Return a join of the two given strings `$str1` and `$str2`.
143
+ /// If the two strings are not empty, they are separated by `$delimiter`.
144
+ ///
145
+ /// @param {String} $str1 [null] - First string to join.
146
+ /// @param {String} $str1 [null] - Second string to join.
147
+ /// @param {String} $delimiter [null] - Delimieter between `$str1` and `$str2`.
148
+ ///
149
+ /// @returns {String} Join of `$str1`, `$delimiter` and `$str2`.
150
+ @function zf-str-join(
151
+ $str1: null,
152
+ $str2: null,
153
+ $delimiter: null
154
+ ) {
155
+ $ret: '';
156
+
157
+ @if $str1 and str-length($str1) > 0 {
158
+ $ret: $ret + $str1;
159
+
160
+ @if $delimiter and str-length($delimiter) > 0 and $str2 and str-length($str2) > 0 {
161
+ $ret: $ret + $delimiter;
162
+ }
163
+ }
164
+ @if $str2 and str-length($str2) > 0 {
165
+ $ret: $ret + $str2;
166
+ }
167
+
168
+ @return $ret;
169
+ }
170
+
142
171
  /// Safely return a value from a map.
143
172
  ///
144
173
  /// @param {Map} $map - Map to retrieve a value from.
@@ -158,3 +187,14 @@
158
187
  @error '`#{$map}` is not a valid map';
159
188
  }
160
189
  }
190
+
191
+ /// Convert the given `$val` to a Boolean. Empty values are considered as false.
192
+ ////
193
+ /// @access private
194
+ ///
195
+ /// @param {*} $val - Value to convert.
196
+ ///
197
+ /// @returns {Boolean} Converted Boolean value.
198
+ @function -zf-bool($val) {
199
+ @return $val != false and has-value($val);
200
+ }
@@ -6,154 +6,245 @@
6
6
  /// @group xy-grid
7
7
  ////
8
8
 
9
- /// Calculate the percentage size of a cell.
9
+ /// Returns the appropriate CSS flex value for a cell base.
10
+ ///
11
+ /// @param {Keyword} $size [full] - The size of your cell. Accepts `full`, `auto`, `shrink`, `grow`, or any other value representing a cell size (it will be treated as `shrink`).
12
+ ///
13
+ /// @returns {List} The cell flex property value.
14
+ @function xy-cell-base($size: full) {
15
+ @if ($size == 'auto') {
16
+ @return 1 1 0px;
17
+ }
18
+ @else if ($size == 'grow') {
19
+ @return 1 0 auto;
20
+ }
21
+ @else if ($size == 'shrink' or $size == 'full' or zf-is-fraction($size, $allow-no-denominator: true)) {
22
+ @return 0 0 auto;
23
+ }
24
+ @return null;
25
+ }
26
+
27
+ /// Calculate the size of a cell gutters.
28
+ ///
29
+ /// @param {Number|Map} $gutters [$grid-margin-gutters] - Map or single value for gutters.
30
+ /// @param {String} $breakpoint [null] - The name of the breakpoint size in your gutters map to get the size from. If `auto`, returns the responsive gutters map `$gutters`. If using with the `breakpoint()` mixin this will be set automatically unless manually entered.
31
+ ///
32
+ /// @returns {Number|Map} The cell gutter size or the responsive gutters map.
33
+ @function xy-cell-gutters(
34
+ $gutters: $grid-margin-gutters,
35
+ $breakpoint: null
36
+ ) {
37
+ // For `auto`, returns the responsive map `$gutters`.
38
+ @if ($breakpoint == 'auto') {
39
+ @return $gutters;
40
+ }
41
+
42
+ // Use the contextual breakpoint by default.
43
+ $breakpoint: -zf-current-breakpoint($breakpoint);
44
+
45
+ @if ($breakpoint) {
46
+ @return -zf-get-bp-val($gutters, $breakpoint);
47
+ }
48
+ @else {
49
+ @return -zf-get-bp-val($gutters, $-zf-zero-breakpoint) or 0;
50
+ }
51
+ }
52
+
53
+ /// Returns the percentage size of a cell.
10
54
  ///
11
55
  /// @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`.
56
+ ///
57
+ /// @returns {Number} Size of the cell (in percent).
12
58
  @function xy-cell-size(
13
59
  $size: $grid-columns
14
60
  ) {
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
- }
61
+ @return fraction-to-percentage($size, $denominator: $grid-columns);
62
+ }
63
+
64
+ /// Returns the appropriate CSS value for a cell size.
65
+ ///
66
+ /// Gutters-related arguments are required for cells with margin gutters (by default) as the gutter is included in the width.
67
+ ///
68
+ /// @param {Keyword|Number} $size [full] - The size of your cell. Can be `full`, `auto`, `shrink` or any fraction like `6`, `50%`, `1 of 2` or `1/2`.
69
+ /// @param {Number|Map} $gutters [$grid-margin-gutters] - Map or single value for gutters.
70
+ /// @param {Keyword} $gutter-type [margin] - Type of gutter to output. Accepts `margin`, `padding` or `none`.
71
+ /// @param {String} $breakpoint [null] - The name of the breakpoint size in your gutters map to get the size from. If `auto`, returns a map of sizes adapted to responsive gutters. If using with the `breakpoint()` mixin this will be set automatically unless manually entered.
72
+ ///
73
+ /// @returns {Number|String|Map} The cell sizing property value, or a responsive map of them.
74
+ @function xy-cell-size-css(
75
+ $size: full,
76
+ $gutters: $grid-margin-gutters,
77
+ $gutter-type: margin,
78
+ $breakpoint: null
79
+ ) {
80
+ $margin-gutter: 0;
81
+
82
+ @if ($size == 'auto' or $size == 'shrink') {
83
+ @return auto;
26
84
  }
27
85
 
28
- // Parsing "n of n" or "n/n" expressions
29
- @else if 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".';
86
+ // For cells with margin gutters, the gutter is included in the width.
87
+ @if ($gutter-type == 'margin') {
88
+ $margin-gutter: xy-cell-gutters($gutters, $breakpoint);
89
+ @if ($margin-gutter == null) {
90
+ @error 'xy-cell-size: no gutters were found in `$gutters` for "$breakpoint: #{$breakpoint}"';
32
91
  }
33
- @else {
34
- $size: percentage(nth($size, 1) / nth($size, 3));
92
+ }
93
+
94
+ // Calculate the cell size (number)
95
+ $size-raw: if($size == 'full', 100%, xy-cell-size($size));
96
+
97
+ // Calculate the cell CSS size including gutters (string)
98
+ // If the cell has responsive margin gutters, return a responsive map of sizes.
99
+ @if type-of($margin-gutter) == 'map' {
100
+ $responsive-css-sizes: ();
101
+
102
+ @each $bp, $mg in $margin-gutter {
103
+ $size-css: if($mg == 0, $size-raw, calc(#{$size-raw} - #{rem-calc($mg)}));
104
+ $responsive-css-sizes: map-merge($responsive-css-sizes, ($bp: $size-css));
35
105
  }
106
+
107
+ @return $responsive-css-sizes;
36
108
  }
37
- // Anything else is incorrect
109
+ // Otherwise, return a single CSS size.
38
110
  @else {
39
- @error 'Wrong syntax for xy-cell-size(). Use a number, decimal, percentage, or "n of n" / "n/n".';
111
+ $css-size: if($margin-gutter == 0, $size-raw, calc(#{$size-raw} - #{rem-calc($margin-gutter)}));
112
+ @return $css-size;
40
113
  }
41
-
42
- @return $size;
43
114
  }
44
115
 
45
116
  /// Sets base flex properties for cells.
46
117
  ///
47
- /// @param {Keyword} $size [full] - The size of your cell. Accepts `full`, `auto`, `shrink` or `grow`.
118
+ /// @param {Keyword} $size [full] - The size of your cell. Accepts `full`, `auto`, `shrink`, `grow`, or any other value representing a cell size (it will be treated as `shrink`).
48
119
  @mixin xy-cell-base($size: full) {
120
+ $base: xy-cell-base($size);
121
+
122
+ flex: #{$base};
123
+
124
+ // Set base styles for "full" only
49
125
  @if($size == 'full') {
50
- // This is the base style, all others inherit from it
51
- flex: 0 0 auto;
52
126
  min-height: 0px;
53
127
  min-width: 0px;
54
128
  }
55
- @else if ($size == 'auto') {
56
- flex: 1 1 0px; // sass-lint:disable-line zero-unit
57
- }
58
- @else if ($size == 'shrink') {
59
- flex: 0 0 auto;
60
- }
61
- @else if ($size == 'grow') {
62
- flex: 1 0 auto;
63
- }
64
129
  }
65
130
 
66
131
  /// Resets a cells width (or height if vertical is true) as well as strips its gutters.
67
132
  ///
68
133
  /// @param {Boolean} $vertical [false] - Set to true to output vertical (height) styles rather than widths.
69
134
  @mixin xy-cell-reset($vertical: true) {
70
- $direction: if($vertical == true, width, height);
135
+ $direction: if($vertical == true, height, width);
71
136
  #{$direction}: auto;
72
137
  max-#{$direction}: none;
73
138
  }
74
139
 
75
- // Sets our cell widths or heights depending on gutter type.
76
- @mixin -xy-cell-properties($size, $margin-gutter, $vertical) {
140
+ /// Sets sizing properties for cells.
141
+ ///
142
+ /// Gutters-related arguments are required for cells with margin gutters (by default) as the gutter is included in the width.
143
+ ///
144
+ /// @param {Keyword|Number} $size [full] - The size of your cell. Can be `full` (100% width), `auto` (use all available space), `shrink` (use only the required space) or any fraction (`6`, `50%`, `1 of 2` or `1/2`...).
145
+ /// @param {Number|Map} $gutters [$grid-margin-gutters] - Map or single value for gutters.
146
+ /// @param {Keyword} $gutter-type [margin] - Type of gutter to output. Accepts `margin`, `padding` or `none`.
147
+ /// @param {String} $breakpoint [null] - The name of the breakpoint size in your gutters map to get the size from. If `auto`, generates sizes adapted for responsive gutters. If using with the `breakpoint()` mixin this will be set automatically unless manually entered.
148
+ /// @param {Boolean} $vertical [false] - Set to true to output vertical (height) styles rather than widths.
149
+ @mixin xy-cell-size(
150
+ $size: full,
151
+ $gutters: $grid-margin-gutters,
152
+ $gutter-type: margin,
153
+ $breakpoint: null,
154
+ $vertical: false
155
+ ) {
156
+ $sizes: xy-cell-size-css($size, $gutters, $gutter-type, $breakpoint);
77
157
  $direction: if($vertical == true, height, width);
78
- @if($size == 'full') {
79
- $val: if($margin-gutter == 0, 100%, calc(100% - #{rem-calc($margin-gutter)}));
80
- #{$direction}: $val;
158
+
159
+ @if (type-of($sizes) == 'map') {
160
+ @include -zf-breakpoint-value(auto, $sizes) {
161
+ #{$direction}: $-zf-bp-value;
162
+ }
81
163
  }
82
- @else if ($size == 'auto') {
83
- #{$direction}: auto;
84
- $val: if($margin-gutter == 0, 100%, calc(100% - #{rem-calc($margin-gutter)}));
164
+ @else {
165
+ #{$direction}: $sizes;
85
166
  }
86
- @else if ($size == 'shrink') {
87
- #{$direction}: auto;
167
+ }
168
+
169
+ /// Sets gutters properties for cells.
170
+ ///
171
+ /// @param {Number|Map} $gutters [$grid-margin-gutters] - Map or single value for gutters.
172
+ /// @param {Keyword} $gutter-type [margin] - Type of gutter to output. Accepts `margin`, `padding` or `none`.
173
+ /// @param {List} $gutter-position [null] - The position to apply gutters to. Accepts `top`, `bottom`, `left`, `right` in any combination. By default `right left` for horizontal cells and `top bottom` for vertical cells.
174
+ /// @param {String} $breakpoint [null] - The name of the breakpoint size in your gutters map to get the size from. If `auto`, generates responsive gutters. If using with the `breakpoint()` mixin this will be set automatically unless manually entered.
175
+ /// @param {Boolean} $vertical [false] - Direction of the gutters to output. See `$gutter-position`.
176
+ @mixin xy-cell-gutters(
177
+ $gutters: $grid-margin-gutters,
178
+ $gutter-type: margin,
179
+ $gutter-position: null,
180
+ $breakpoint: null,
181
+ $vertical: false
182
+ ) {
183
+ // Get the default gutter position according to cell direction
184
+ @if($gutter-position == null) {
185
+ $gutter-position: if($vertical == true, top bottom, left right);
88
186
  }
89
- @else {
90
- $val: if($margin-gutter == 0, #{xy-cell-size($size)}, calc(#{xy-cell-size($size)} - #{rem-calc($margin-gutter)}));
91
- #{$direction}: $val;
187
+
188
+ // Get the gutter width for this breakpoint
189
+ $gutter-width: xy-cell-gutters($gutters, $breakpoint);
190
+ @if ($gutter-width == null) {
191
+ @error 'xy-cell-gutters: no gutters were found in `$gutters` for "$breakpoint: #{$breakpoint}"';
192
+ }
193
+
194
+ @if ($gutter-type and $gutter-type != none) {
195
+ @include xy-gutters($gutter-width, $gutter-type, $gutter-position);
92
196
  }
93
197
  }
94
198
 
95
199
  /// Creates a cell for your grid.
96
200
  ///
97
- /// @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.
98
- /// @param {Boolean} $gutter-output [true] - Whether or not to output gutters
201
+ /// @param {Keyword|Number} $size [full] - The size of your cell. Can be `full` (100% width), `auto` (use all available space), `shrink` (use only the required space) or any fraction (`6`, `50%`, `1 of 2` or `1/2`...).
202
+ /// @param {Boolean} $gutter-output [null] - [DEPRECATED] Whether or not to output gutters.
99
203
  /// @param {Number|Map} $gutters [$grid-margin-gutters] - Map or single value for gutters.
100
- /// @param {Keyword} $gutter-type [margin] - Map or single value for gutters.
101
- /// @param {List} $gutter-position [right left] - The position to apply gutters to. Accepts `top`, `bottom`, `left`, `right` in any combination.
102
- /// @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.
204
+ /// @param {Keyword} $gutter-type [margin] - Type of gutter to output. Accepts `margin`, `padding` or `none`.
205
+ /// @param {List} $gutter-position [null] - The position to apply gutters to. Accepts `top`, `bottom`, `left`, `right` in any combination. By default `right left` for horizontal cells and `top bottom` for vertical cells.
206
+ /// @param {String} $breakpoint [null] - The name of the breakpoint size in your gutters map to get the size from. If `auto`, generates responsive gutters. If using with the `breakpoint()` mixin this will be set automatically unless manually entered.
103
207
  /// @param {Boolean} $vertical [false] - Set to true to output vertical (height) styles rather than widths.
208
+ /// @param {List} $output [(base size gutters)] - Cell parts to output. You will need to generate others parts of the cell seperately, it may not work properly otherwise.
104
209
  @mixin xy-cell(
105
210
  $size: full,
106
- $gutter-output: true,
211
+ $gutter-output: null,
107
212
  $gutters: $grid-margin-gutters,
108
213
  $gutter-type: margin,
109
- $gutter-position: right left,
214
+ $gutter-position: null,
110
215
  $breakpoint: null,
111
- $vertical: false
216
+ $vertical: false,
217
+ $output: (base size gutters)
112
218
  ) {
113
- $bp-is-fallback: false;
114
-
115
- @if($breakpoint == null) {
116
- // If `$bp-size` is available then use this, otherwise revert to the smallest bp.
117
- @if(variable-exists(-zf-size) and type-of($-zf-size) != 'number') and $-zf-size != null {
118
- $breakpoint: $-zf-size;
119
- }
120
- @else {
121
- $breakpoint: $-zf-zero-breakpoint;
122
- $bp-is-fallback: true;
219
+ // Default for $gutter-output
220
+ @if ($gutter-output != null) {
221
+ @warn 'xy-cell: $gutter-output is deprecated and will be removed. See migration notes at https://git.io/foundation-6-6-0';
222
+ @if ($gutter-output == false) {
223
+ $output: sl-remove($output, gutters);
123
224
  }
124
225
  }
125
226
 
126
- // Get the gutter for the given breakpoint/value.
127
- $gutter: -zf-get-bp-val($gutters, $breakpoint);
128
- // If the breakpoint is a fallback, use a fallback gutter as well
129
- @if ($bp-is-fallback == true and $gutter == null) {
130
- $gutter: 0;
131
- }
132
-
133
- @if($gutter != null) {
134
- // Base flex properties
227
+ @if (index($output, base)) {
135
228
  @include xy-cell-base($size);
136
-
137
- @if($gutter-type == 'margin') {
138
- @include -xy-cell-properties($size, $gutter, $vertical);
139
- }
140
- @else {
141
- @include -xy-cell-properties($size, 0, $vertical);
142
- }
143
-
144
- @if $gutter-output {
145
- @include xy-gutters($gutter, $gutter-type, $gutter-position);
146
- }
147
229
  }
148
- @else {
149
- @warn 'xy-cell: no gutters were found in `$gutters` for "$breakpoint: #{$breakpoint}", cell was not generated`'
230
+ @if (index($output, size)) {
231
+ @include xy-cell-size($size, $gutters, $gutter-type, $breakpoint, $vertical);
232
+ }
233
+ @if (index($output, gutters)) {
234
+ @include xy-cell-gutters($gutters, $gutter-type, $gutter-position, $breakpoint, $vertical);
150
235
  }
151
236
  }
152
237
 
153
238
  /// Creates a single breakpoint sized grid. Used to generate our grid classes.
154
239
  ///
155
- /// @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.
156
- /// @param {Boolean} $gutter-output [true] - Whether or not to output gutters
240
+ /// `xy-cell-static()` is deprecated and will be removed.
241
+ /// Use `xy-cell()` instead with `$output: (size gutters)` to not generate the cell base.
242
+ /// See migration notes at https://git.io/foundation-6-6-0
243
+ ///
244
+ /// @deprecated v6.6.0
245
+ ///
246
+ /// @param {Keyword|Number} $size [full] - The size of your cell. Can be `full` (100% width), `auto` (use all available space), `shrink` (use only the required space) or any fraction (`6`, `50%`, `1 of 2` or `1/2`...).
247
+ /// @param {Boolean} $gutter-output [true] - Whether or not to output gutters. Always `true` for margin gutters.
157
248
  /// @param {Number|Map} $gutters [$grid-margin-gutters] - Map or single value for gutters.
158
249
  /// @param {Keyword} $gutter-type [margin] - Map or single value for gutters.
159
250
  /// @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.
@@ -166,20 +257,16 @@
166
257
  $breakpoint: $-zf-zero-breakpoint,
167
258
  $vertical: false
168
259
  ) {
260
+ @warn 'xy-cell-static() mixin is deprecated and will be removed. Use "xy-cell()" instead. See migration notes at https://git.io/foundation-6-6-0';
169
261
 
170
262
  $gutter: -zf-get-bp-val($gutters, $breakpoint);
171
263
  $gutter-position: if($vertical == true, top bottom, left right);
172
264
 
173
- @if($gutter-type == 'margin') {
174
- @include -xy-cell-properties($size, $gutter, $vertical);
175
- }
176
- @else {
177
- @include -xy-cell-properties($size, 0, $vertical);
178
- }
265
+ $-gutter-output: if($gutter-type == 'margin', true, $gutter-output);
266
+ $-gutter-margin: if($gutter-type == 'margin', $gutter, 0);
179
267
 
180
- // If we want to output the gutters
181
- @if($gutter-output) {
182
- // TODO: Figure out if we need to pass breakpoint in here too.
268
+ @include -xy-cell-properties($size, $-gutter-margin, $vertical);
269
+ @if ($-gutter-output) {
183
270
  @include xy-gutters($gutter, $gutter-type, $gutter-position);
184
271
  }
185
272
  }