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
@@ -115,29 +115,9 @@ $paragraph-margin-bottom: 1rem !default;
115
115
  /// @type String
116
116
  $paragraph-text-rendering: optimizeLegibility !default;
117
117
 
118
- /// Text color of code samples.
119
- /// @type Color
120
- $code-color: $black !default;
121
-
122
- /// Font family of code samples.
123
- /// @type String | List
124
- $code-font-family: $font-family-monospace !default;
125
-
126
- /// Font weight of text in code samples.
127
- /// @type String
128
- $code-font-weight: $global-weight-normal !default;
129
-
130
- /// Background color of code samples.
131
- /// @type Color
132
- $code-background: $light-gray !default;
133
-
134
- /// Border around code samples.
135
- /// @type List
136
- $code-border: 1px solid $medium-gray !default;
137
-
138
- /// Padding around text of code samples.
139
- /// @type Number | List
140
- $code-padding: rem-calc(2 5 1) !default;
118
+ /// Use the `.code-inline` component as default for `<code>` elements.
119
+ /// @type Boolean
120
+ $enable-code-inline: true;
141
121
 
142
122
  /// Default color for links.
143
123
  /// @type Color
@@ -215,17 +195,9 @@ $blockquote-padding: rem-calc(9 20 0 19) !default;
215
195
  /// @type List
216
196
  $blockquote-border: 1px solid $medium-gray !default;
217
197
 
218
- /// Font size for `<cite>` elements.
219
- /// @type Number
220
- $cite-font-size: rem-calc(13) !default;
221
-
222
- /// Text color for `<cite>` elements.
223
- /// @type Color
224
- $cite-color: $dark-gray !default;
225
-
226
- /// Pseudo content for `<cite>` elements.
227
- /// @type String
228
- $cite-pseudo-content: '\2014 \0020' !default;
198
+ /// Use the `.cite-block` component as default for `<cite>` elements.
199
+ /// @type Boolean
200
+ $enable-cite-block: true;
229
201
 
230
202
  /// Font family for `<kbd>` elements.
231
203
  /// @type String | List
@@ -457,14 +429,12 @@ $abbr-underline: 1px dotted $black !default;
457
429
  }
458
430
  }
459
431
 
460
- // Citations
461
- cite {
462
- display: block;
463
- font-size: $cite-font-size;
464
- color: $cite-color;
465
-
466
- &:before {
467
- content: $cite-pseudo-content;
432
+ // Inline Citations
433
+ @if ($enable-cite-block == true) {
434
+ cite {
435
+ // Extending a class is not recommended.
436
+ // TODO: Break the typography-base/typography-helpers separation
437
+ @extend .cite-block;
468
438
  }
469
439
  }
470
440
 
@@ -481,15 +451,10 @@ $abbr-underline: 1px dotted $black !default;
481
451
  }
482
452
 
483
453
  // Code
484
- code {
485
- padding: $code-padding;
486
-
487
- border: $code-border;
488
- background-color: $code-background;
489
-
490
- font-family: $code-font-family;
491
- font-weight: $code-font-weight;
492
- color: $code-color;
454
+ @if ($enable-code-inline == true) {
455
+ code {
456
+ @extend .code-inline;
457
+ }
493
458
  }
494
459
 
495
460
  // Keystrokes
@@ -38,6 +38,92 @@ $subheader-margin-bottom: 0.5rem !default;
38
38
  /// @type Number
39
39
  $stat-font-size: 2.5rem !default;
40
40
 
41
+ /// Text color for `.cite-block` component.
42
+ /// @type Color
43
+ $cite-color: $dark-gray !default;
44
+
45
+ /// Font size for `.cite-block` component.
46
+ /// @type Number
47
+ $cite-font-size: rem-calc(13) !default;
48
+
49
+ /// Pseudo content for `.cite-block` component.
50
+ /// @type String
51
+ $cite-pseudo-content: '\2014 \0020' !default;
52
+
53
+ /// Text color of `.code-inline` and `.code-block` components.
54
+ /// @type Color
55
+ $code-color: $black !default;
56
+
57
+ /// Font family of `.code-inline` and `.code-block` components.
58
+ /// @type String | List
59
+ $code-font-family: $font-family-monospace !default;
60
+
61
+ /// Font weight of text in `.code-inline` and `.code-block` components.
62
+ /// @type String
63
+ $code-font-weight: $global-weight-normal !default;
64
+
65
+ /// Background color of `.code-inline` and `.code-block` components.
66
+ /// @type Color
67
+ $code-background: $light-gray !default;
68
+
69
+ /// Border around `.code-inline` and `.code-block` components.
70
+ /// @type List
71
+ $code-border: 1px solid $medium-gray !default;
72
+
73
+ /// Padding around text of the `.code-inline` component.
74
+ /// @type Number | List
75
+ $code-padding: rem-calc(2 5 1) !default;
76
+
77
+ /// Padding around text of the `.code-block` component.
78
+ /// @type Number | List
79
+ $code-block-padding: 1rem !default;
80
+
81
+ /// Margin under the `.code-block` component.
82
+ /// @type Number
83
+ $code-block-margin-bottom: 1.5rem !default;
84
+
85
+ @mixin cite-block {
86
+ display: block;
87
+ color: $cite-color;
88
+ font-size: $cite-font-size;
89
+
90
+ &:before {
91
+ content: $cite-pseudo-content;
92
+ }
93
+ }
94
+
95
+ /// Add basic styles for a code helper.
96
+ /// See `code-inline` and `code-block` mixins.
97
+ @mixin code-style {
98
+ border: $code-border;
99
+ background-color: $code-background;
100
+
101
+ font-family: $code-font-family;
102
+ font-weight: $code-font-weight;
103
+ color: $code-color;
104
+ }
105
+
106
+ /// Make code helper from the `code-style` mixin inline.
107
+ /// Used to generate `.code-inline`
108
+ @mixin code-inline {
109
+ display: inline;
110
+ max-width: 100%;
111
+ word-wrap: break-word;
112
+
113
+ padding: $code-padding;
114
+ }
115
+
116
+ /// Make code helper from the `code-style` mixin a block.
117
+ /// Used to generate `.code-block`
118
+ @mixin code-block {
119
+ display: block;
120
+ overflow: auto;
121
+ white-space: pre;
122
+
123
+ padding: $code-block-padding;
124
+ margin-bottom: $code-block-margin-bottom;
125
+ }
126
+
41
127
  @mixin foundation-typography-helpers {
42
128
  // Use to create a subheading under a main header
43
129
  // Make sure you pair the two elements in a <header> element, like this:
@@ -77,4 +163,18 @@ $stat-font-size: 2.5rem !default;
77
163
  list-style: none;
78
164
  }
79
165
  }
166
+
167
+ .cite-block {
168
+ @include cite-block;
169
+ }
170
+
171
+ .code-inline {
172
+ @include code-style;
173
+ @include code-inline;
174
+ }
175
+
176
+ .code-block {
177
+ @include code-style;
178
+ @include code-block;
179
+ }
80
180
  }
@@ -19,13 +19,19 @@ $print-hrefs: true !default;
19
19
 
20
20
  @media print {
21
21
  * {
22
+ // Ensure a "black-on-white" print by removing backgrounds,
23
+ // using black text everywhere and forcing the browser to economize ink.
22
24
  @if $print-transparent-backgrounds {
23
25
  background: transparent !important;
26
+ color: black !important; // Black prints faster: h5bp.com/s
27
+ color-adjust: economy;
28
+ }
29
+ // Otherwise, prevent any economy by the browser.
30
+ @else {
31
+ color-adjust: exact;
24
32
  }
25
33
 
26
34
  box-shadow: none !important;
27
-
28
- color: black !important; // Black prints faster: h5bp.com/s
29
35
  text-shadow: none !important;
30
36
  }
31
37
 
@@ -16,6 +16,17 @@ $breakpoints: (
16
16
  xxlarge: 1440px,
17
17
  ) !default;
18
18
 
19
+ /// A list of named HiDPI breakpoints. You can use these with the `breakpoint()` mixin to quickly create media queries for resolutions.
20
+ /// Values must represent the device pixels / web pixels ration and be unitless or in DPPX.
21
+ /// @type Map
22
+ $breakpoints-hidpi: (
23
+ hidpi-1: 1,
24
+ hidpi-1-5: 1.5,
25
+ hidpi-2: 2,
26
+ retina: 2,
27
+ hidpi-3: 3
28
+ ) !default;
29
+
19
30
  /// The largest named breakpoint in which to include print as a media type
20
31
  /// @type Keyword
21
32
  $print-breakpoint: large !default;
@@ -39,143 +50,143 @@ $breakpoint-classes: (small medium large) !default;
39
50
  ///
40
51
  /// @param {Keyword|Number} $val [small] - Breakpoint name, or px, rem, or em value to process.
41
52
  @function breakpoint($val: $-zf-zero-breakpoint) {
53
+ // Web standard Pixels per inch. (1ddpx / $std-web-dpi) = 1dpi
54
+ // See https://www.w3.org/TR/css-values-3/#absolute-lengths
55
+ $std-web-dpi: 96;
56
+
42
57
  // Size or keyword
43
58
  $bp: nth($val, 1);
59
+ // Value of the following breakpoint
60
+ $bp-next: null;
44
61
  // Value for max-width media queries
45
- $bp-max: 0;
62
+ $bp-min: null;
63
+ // Value for min-width media queries
64
+ $bp-max: null;
46
65
  // Direction of media query (up, down, or only)
47
66
  $dir: if(length($val) > 1, nth($val, 2), up);
48
- // Eventual output
49
- $str: '';
50
- // Is it a named media query?
51
- $named: false;
67
+ // If named, name of the breakpoint
68
+ $name: null;
69
+ // If the breakpoint is a HiDPI breakpoint
70
+ $hidpi: false;
52
71
 
53
72
  // Orientation media queries have a unique syntax
54
73
  @if $bp == 'landscape' or $bp == 'portrait' {
55
74
  @return '(orientation: #{$bp})';
56
75
  }
57
- @else if $bp == 'retina' {
58
- @return '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)';
59
- }
60
76
 
61
- // Try to pull a named breakpoint out of the $breakpoints map
77
+ // If a breakpoint name is given, get its value from the $breakpoints/$breakpoints-hidpi map.
62
78
  @if type-of($bp) == 'string' {
63
79
  @if map-has-key($breakpoints, $bp) {
64
- @if $dir == 'only' or $dir == 'down' {
65
- $bp-max: -zf-map-next($breakpoints, $bp);
66
- }
67
-
68
- $bp: map-get($breakpoints, $bp);
69
- $named: true;
80
+ $name: $bp;
81
+ $bp: map-get($breakpoints, $name);
82
+ $bp-next: -zf-map-next($breakpoints, $name);
83
+ }
84
+ @else if map-has-key($breakpoints-hidpi, $bp) {
85
+ $name: $bp;
86
+ $bp: map-get($breakpoints-hidpi, $name);
87
+ $bp-next: -zf-map-next-number($breakpoints-hidpi, $bp);
88
+ $hidpi: true;
70
89
  }
71
90
  @else {
72
91
  $bp: 0;
73
- @warn 'breakpoint(): "#{$val}" is not defined in your $breakpoints setting.';
92
+ @warn 'breakpoint(): "#{$val}" is not defined in your `$breakpoints` or `$breakpoints-hidpi` setting.';
74
93
  }
75
94
  }
76
95
 
77
- // Convert any pixel, rem, or unitless value to em
78
- $bp: -zf-bp-to-em($bp);
79
- // Max value is 0.2px under the next breakpoint (0.02 / 16 = 0.00125).
80
- // Use a precision under 1px to support browser zoom, but not to low to avoid rounding.
81
- // See https://github.com/zurb/foundation-sites/issues/11313
82
- @if $bp-max {
83
- $bp-max: -zf-bp-to-em($bp-max) - .00125;
96
+ @if not $name and $dir == 'only' {
97
+ @warn 'breakpoint(): Only named media queries can have an `only` range.';
98
+ @return null;
84
99
  }
85
100
 
86
- // Conditions to skip media query creation
87
- // - It's a named breakpoint that resolved to "0 down" or "0 up"
88
- // - It's a numeric breakpoint that resolved to "0 " + anything
89
- @if $bp > 0em or $dir == 'only' or $dir == 'down' {
90
- // `only` ranges use the format `(min-width: n) and (max-width: n)`
91
- @if $dir == 'only' {
92
- // Only named media queries can have an "only" range
93
- @if $named == true {
94
- // Only use "min-width" if the floor is greater than 0
95
- @if $bp > 0em {
96
- $str: $str + '(min-width: #{$bp})';
97
-
98
- // Only add "and" to the media query if there's a ceiling
99
- @if $bp-max != null {
100
- $str: $str + ' and ';
101
- }
102
- }
103
-
104
- // Only use "max-width" if there's a ceiling
105
- @if $bp-max != null {
106
- $str: $str + '(max-width: #{$bp-max})';
107
- }
108
- }
109
- @else {
110
- @warn 'breakpoint(): Only named media queries can have an `only` range.';
111
- }
112
- }
113
-
114
- // `down` ranges use the format `(max-width: n)`
115
- @else if $dir == 'down' {
116
- $max: if($named, $bp-max, $bp);
117
-
118
- // Skip media query creation if input value is exactly "0 down",
119
- // unless the function was called as "small down", in which case it's just "small only"
120
- @if $named or $bp > 0em {
121
- @if $max != null {
122
- $str: $str + '(max-width: #{$max})';
123
- }
124
- }
101
+ // Only 'only' and 'up' have a min limit.
102
+ @if $dir == 'only' or $dir == 'up' {
103
+ $bp-min: if($hidpi, strip-unit($bp), -zf-bp-to-em($bp));
104
+ }
105
+ // Only 'only' and 'down' have a max limit.
106
+ @if $dir == 'only' or $dir == 'down' {
107
+ // If the breakpoint is a value, use it as max limit.
108
+ @if not $name {
109
+ $bp-max: if($hidpi, strip-unit($bp), -zf-bp-to-em($bp));
125
110
  }
126
-
127
- // `up` ranges use the format `(min-width: n)`
128
- @else if $bp > 0em {
129
- $str: $str + '(min-width: #{$bp})';
111
+ // If the breakpoint is named, the max limit is the following breakpoint - 1px.
112
+ @else if $bp-next {
113
+ // Max value is 0.2px under the next breakpoint (0.02 / 16 = 0.00125).
114
+ // Use a precision under 1px to support browser zoom, but not to low to avoid rounding.
115
+ // See https://github.com/zurb/foundation-sites/issues/11313
116
+ $bp-max: if($hidpi, $bp-next - (1/$std-web-dpi), -zf-bp-to-em($bp-next) - 0.00125);
130
117
  }
131
118
  }
132
119
 
133
- @return $str;
120
+ // Generate the media query string from min and max limits.
121
+ @if $hidpi {
122
+ // Generate values in DPI instead of DPPX for an IE9-11/Opera mini compatibility.
123
+ // See https://caniuse.com/#feat=css-media-resolution
124
+ $bp-min-dpi: if($bp-min, $bp-min * $std-web-dpi * 1dpi, $bp-min);
125
+ $bp-max-dpi: if($bp-max, $bp-max * $std-web-dpi * 1dpi, $bp-max);
126
+ @return zf-str-join(
127
+ -zf-bp-join($bp-min, $bp-max, '-webkit-min-device-pixel-ratio', '-webkit-max-device-pixel-ratio'),
128
+ -zf-bp-join($bp-min-dpi, $bp-max-dpi, 'min-resolution', 'max-resolution'),
129
+ ', ');
130
+ }
131
+ @else {
132
+ @return -zf-bp-join($bp-min, $bp-max);
133
+ }
134
134
  }
135
135
 
136
136
  /// Wraps a media query around the content you put inside the mixin. This mixin accepts a number of values:
137
- /// - If a string is passed, the mixin will look for it in the `$breakpoints` map, and use a media query there.
137
+ /// - If a string is passed, the mixin will look for it in the `$breakpoints` and `$breakpoints-hidpi` maps, and use a media query there.
138
138
  /// - If a pixel value is passed, it will be converted to an em value using `$global-font-size` as the base.
139
139
  /// - If a rem value is passed, the unit will be changed to em.
140
140
  /// - If an em value is passed, the value will be used as-is.
141
141
  ///
142
- /// @param {Keyword|Number} $value - Breakpoint name, or px, rem, or em value to process.
142
+ /// If multiple values are passed, the mixin will generate a media query for each of them as described above.
143
+ /// Since the content is duplicated for each breakpoint, this mixin should only be used with properties that
144
+ /// change across breakpoints.
145
+ ///
146
+ /// @param {Keyword|Number} $values... - Breakpoint name or px/rem/em value to process.
143
147
  ///
144
148
  /// @output If the breakpoint is "0px and larger", outputs the content as-is. Otherwise, outputs the content wrapped in a media query.
145
- @mixin breakpoint($value) {
146
- $str: breakpoint($value);
147
- $bp: index($-zf-breakpoints-keys, $value);
148
- $pbp: index($-zf-breakpoints-keys, $print-breakpoint);
149
-
150
- $old-zf-size: null;
151
-
152
- // Make breakpoint size available as a variable
153
- @if global-variable-exists(-zf-size) {
154
- $old-zf-size: $-zf-size;
155
- }
156
- $-zf-size: nth($value, 1) !global; // get the first value to account for `only` and `down` keywords
157
-
158
- // If $str is still an empty string, no media query is needed
159
- @if $str == '' {
160
- @content;
161
- }
149
+ @mixin breakpoint($values...) {
150
+ @for $i from 1 through length($values) {
151
+ $value: nth($values, $i);
152
+ $str: breakpoint($value);
153
+ $bp: index($-zf-breakpoints-keys, nth($value, 1));
154
+ $pbp: index($-zf-breakpoints-keys, $print-breakpoint);
155
+ // Direction of media query (up, down, or only)
156
+ $dir: if(length($value) > 1, nth($value, 2), up);
157
+
158
+ $old-zf-size: null;
159
+
160
+ // Make breakpoint size available as a variable
161
+ @if global-variable-exists(-zf-size) {
162
+ $old-zf-size: $-zf-size;
163
+ }
164
+ $-zf-size: nth($value, 1) !global; // get the first value to account for `only` and `down` keywords
162
165
 
163
- // Otherwise, wrap the content in a media query
164
- @else {
165
- // For named breakpoints less than or equal to $print-breakpoint, add print to the media types
166
- @if $bp != null and $bp <= $pbp {
167
- @media print, screen and #{$str} {
168
- @content;
169
- }
166
+ // If $str is still an empty string, no media query is needed
167
+ @if $str == '' {
168
+ @content;
170
169
  }
170
+
171
+ // Otherwise, wrap the content in a media query
171
172
  @else {
172
- @media screen and #{$str} {
173
- @content;
173
+ // For named breakpoints less than or equal to $print-breakpoint, add print to the media types
174
+ // generate print if the breakpoint affects the print-breakpoint (or smaller).
175
+ // This means the current condition only needs to be extended so 'down' always generates print.
176
+ @if $bp != null and ($bp <= $pbp or $dir == down) {
177
+ @media print, screen and #{$str} {
178
+ @content;
179
+ }
180
+ }
181
+ @else {
182
+ @media screen and #{$str} {
183
+ @content;
184
+ }
174
185
  }
175
186
  }
176
- }
177
187
 
178
- $-zf-size: $old-zf-size !global;
188
+ $-zf-size: $old-zf-size !global;
189
+ }
179
190
  }
180
191
 
181
192
  /// Converts 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.
@@ -224,6 +235,26 @@ $breakpoint-classes: (small medium large) !default;
224
235
 
225
236
  }
226
237
 
238
+ /// Find the next number in a map.
239
+ /// @access private
240
+ ///
241
+ /// @param {Map} $map - Map to traverse.
242
+ /// @param {Mixed} $number - Number to use as a starting point.
243
+ ///
244
+ /// @returns {Mixed} The number following `$number`, if `$number` was found. If `$number` was not found, or `$number` was the biggest number in the map, returns `null`.
245
+ @function -zf-map-next-number($map, $number) {
246
+
247
+ $next_number: null;
248
+
249
+ @each $k, $v in $map {
250
+ @if type-of($v) == 'number' and $v > $number and ($next_number == null or $v < $next_number) {
251
+ $next_number: $v;
252
+ }
253
+ }
254
+
255
+ @return $next_number;
256
+ }
257
+
227
258
  /// Return a list of our named breakpoints less than $key. Useful for dealing with
228
259
  /// responsive gutters for the grid.
229
260
  /// @access private
@@ -321,6 +352,50 @@ $breakpoint-classes: (small medium large) !default;
321
352
  }
322
353
  }
323
354
 
355
+ /// Return the best breakpoint to use according to the calling context. It returns in order:
356
+ /// 1. the given `$value` argument if it is not null.
357
+ /// 2. the global breakpoint context `$-zf-size` if it is not null (like if called inside then `breakpoint()` mixin)
358
+ /// 3. the given `$default` argument.
359
+ /// @access private
360
+ ///
361
+ /// @param {Keyword} $value [null] - Breakpoint to use in priority if non-null.
362
+ /// @param {Keyword} $default [null] - Breakpoint to use by default if no other value can be used.
363
+ ///
364
+ /// @return {Keyword} The resolved breakpoint.
365
+ @function -zf-current-breakpoint($value: null, $default: null) {
366
+ @if ($value != null) {
367
+ @return $value;
368
+ }
369
+ @else if (variable-exists(-zf-size) and type-of($-zf-size) != 'number') and $-zf-size != null {
370
+ @return $-zf-size;
371
+ }
372
+ @else {
373
+ @return $default;
374
+ }
375
+ }
376
+
377
+ /// Return media query string from the given min and/or max limits.
378
+ /// If a limit is equal to `null` or `0`, it is ignored.
379
+ /// @access private
380
+ ///
381
+ /// @param {Number} $min [0] - Min media query limit.
382
+ /// @param {Number} $max [0] - Max media query limit.
383
+ /// @param {String} $min-name ['min-width'] - Name of the min media query limit.
384
+ /// @param {String} $delimiter ['max-width'] - Name of the max media query limit.
385
+ ///
386
+ /// @returns {String} Media Query string.
387
+ @function -zf-bp-join(
388
+ $min: 0,
389
+ $max: 0,
390
+ $min-name: 'min-width',
391
+ $max-name: 'max-width'
392
+ ) {
393
+ @return zf-str-join(
394
+ if($min and $min > 0, '(#{$min-name}: #{$min})', null),
395
+ if($max and $max > 0, '(#{$max-name}: #{$max})', null),
396
+ ' and ');
397
+ }
398
+
324
399
  $small-up: '';
325
400
  $small-only: '';
326
401