foundation-rails 6.2.4.0 → 6.3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/Rakefile +2 -0
  4. data/bower.json +2 -2
  5. data/lib/foundation/rails/version.rb +1 -1
  6. data/lib/generators/foundation/templates/_settings.scss +117 -70
  7. data/lib/generators/foundation/templates/foundation_and_overrides.scss +2 -1
  8. data/vendor/assets/_vendor/normalize-scss/sass/_normalize.scss +3 -0
  9. data/vendor/assets/_vendor/normalize-scss/sass/normalize/_import-now.scss +11 -0
  10. data/vendor/assets/_vendor/normalize-scss/sass/normalize/_normalize-mixin.scss +676 -0
  11. data/vendor/assets/_vendor/normalize-scss/sass/normalize/_variables.scss +36 -0
  12. data/vendor/assets/_vendor/normalize-scss/sass/normalize/_vertical-rhythm.scss +61 -0
  13. data/vendor/assets/_vendor/sassy-lists/stylesheets/functions/_purge.scss +38 -0
  14. data/vendor/assets/_vendor/sassy-lists/stylesheets/functions/_remove.scss +31 -0
  15. data/vendor/assets/_vendor/sassy-lists/stylesheets/functions/_replace.scss +46 -0
  16. data/vendor/assets/_vendor/sassy-lists/stylesheets/functions/_to-list.scss +27 -0
  17. data/vendor/assets/_vendor/sassy-lists/stylesheets/helpers/_missing-dependencies.scss +25 -0
  18. data/vendor/assets/_vendor/sassy-lists/stylesheets/helpers/_true.scss +13 -0
  19. data/vendor/assets/js/foundation.abide.js.es6 +28 -0
  20. data/vendor/assets/js/foundation.accordion.js.es6 +1 -1
  21. data/vendor/assets/js/foundation.accordionMenu.js.es6 +9 -1
  22. data/vendor/assets/js/foundation.core.js.es6 +4 -4
  23. data/vendor/assets/js/foundation.drilldown.js.es6 +128 -14
  24. data/vendor/assets/js/foundation.dropdown.js.es6 +48 -42
  25. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +20 -18
  26. data/vendor/assets/js/foundation.equalizer.js.es6 +12 -6
  27. data/vendor/assets/js/foundation.interchange.js.es6 +3 -2
  28. data/vendor/assets/js/foundation.js.es6 +2 -1
  29. data/vendor/assets/js/foundation.magellan.js.es6 +28 -9
  30. data/vendor/assets/js/foundation.offcanvas.js.es6 +90 -123
  31. data/vendor/assets/js/foundation.orbit.js.es6 +61 -10
  32. data/vendor/assets/js/foundation.responsiveMenu.js.es6 +2 -0
  33. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +52 -12
  34. data/vendor/assets/js/foundation.reveal.js.es6 +48 -48
  35. data/vendor/assets/js/foundation.slider.js.es6 +124 -42
  36. data/vendor/assets/js/foundation.sticky.js.es6 +11 -9
  37. data/vendor/assets/js/foundation.tabs.js.es6 +164 -35
  38. data/vendor/assets/js/foundation.toggler.js.es6 +3 -0
  39. data/vendor/assets/js/foundation.tooltip.js.es6 +20 -10
  40. data/vendor/assets/js/foundation.util.box.js.es6 +2 -2
  41. data/vendor/assets/js/foundation.util.keyboard.js.es6 +37 -0
  42. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +16 -0
  43. data/vendor/assets/js/foundation.util.motion.js.es6 +7 -1
  44. data/vendor/assets/js/foundation.util.nest.js.es6 +10 -5
  45. data/vendor/assets/js/foundation.util.timerAndImageLoader.js.es6 +6 -4
  46. data/vendor/assets/js/foundation.util.triggers.js.es6 +54 -36
  47. data/vendor/assets/js/foundation.zf.responsiveAccordionTabs.js.es6 +240 -0
  48. data/vendor/assets/scss/_global.scss +25 -450
  49. data/vendor/assets/scss/components/_accordion-menu.scss +8 -4
  50. data/vendor/assets/scss/components/_accordion.scss +43 -22
  51. data/vendor/assets/scss/components/_badge.scss +17 -9
  52. data/vendor/assets/scss/components/_breadcrumbs.scss +7 -5
  53. data/vendor/assets/scss/components/_button-group.scss +54 -6
  54. data/vendor/assets/scss/components/_button.scss +27 -16
  55. data/vendor/assets/scss/components/_callout.scss +3 -2
  56. data/vendor/assets/scss/components/_card.scss +121 -0
  57. data/vendor/assets/scss/components/_close-button.scss +54 -13
  58. data/vendor/assets/scss/components/_drilldown.scss +19 -5
  59. data/vendor/assets/scss/components/_dropdown-menu.scss +23 -18
  60. data/vendor/assets/scss/components/_dropdown.scss +14 -7
  61. data/vendor/assets/scss/components/_flex-video.scss +1 -63
  62. data/vendor/assets/scss/components/_float.scss +1 -1
  63. data/vendor/assets/scss/components/_label.scss +16 -8
  64. data/vendor/assets/scss/components/_media-object.scss +2 -3
  65. data/vendor/assets/scss/components/_menu.scss +68 -33
  66. data/vendor/assets/scss/components/_off-canvas.scss +231 -80
  67. data/vendor/assets/scss/components/_orbit.scss +8 -6
  68. data/vendor/assets/scss/components/_pagination.scss +42 -22
  69. data/vendor/assets/scss/components/_progress-bar.scss +1 -1
  70. data/vendor/assets/scss/components/_responsive-embed.scss +66 -0
  71. data/vendor/assets/scss/components/_reveal.scss +17 -11
  72. data/vendor/assets/scss/components/_slider.scss +6 -1
  73. data/vendor/assets/scss/components/_sticky.scss +3 -3
  74. data/vendor/assets/scss/components/_switch.scss +47 -36
  75. data/vendor/assets/scss/components/_table.scss +83 -23
  76. data/vendor/assets/scss/components/_tabs.scss +54 -23
  77. data/vendor/assets/scss/components/_thumbnail.scss +17 -4
  78. data/vendor/assets/scss/components/_title-bar.scss +5 -6
  79. data/vendor/assets/scss/components/_tooltip.scss +15 -12
  80. data/vendor/assets/scss/components/_top-bar.scss +11 -8
  81. data/vendor/assets/scss/forms/_checkbox.scss +2 -1
  82. data/vendor/assets/scss/forms/_error.scss +10 -6
  83. data/vendor/assets/scss/forms/_fieldset.scss +7 -7
  84. data/vendor/assets/scss/forms/_input-group.scss +17 -11
  85. data/vendor/assets/scss/forms/_label.scss +2 -0
  86. data/vendor/assets/scss/forms/_meter.scss +9 -10
  87. data/vendor/assets/scss/forms/_progress.scss +9 -9
  88. data/vendor/assets/scss/forms/_range.scss +20 -15
  89. data/vendor/assets/scss/forms/_select.scss +26 -8
  90. data/vendor/assets/scss/forms/_text.scss +19 -16
  91. data/vendor/assets/scss/foundation.scss +19 -3
  92. data/vendor/assets/scss/grid/_classes.scss +31 -14
  93. data/vendor/assets/scss/grid/_column.scss +10 -24
  94. data/vendor/assets/scss/grid/_flex-grid.scss +84 -76
  95. data/vendor/assets/scss/grid/_grid.scss +0 -16
  96. data/vendor/assets/scss/grid/_gutter.scss +53 -5
  97. data/vendor/assets/scss/grid/_layout.scss +3 -3
  98. data/vendor/assets/scss/grid/_position.scss +3 -3
  99. data/vendor/assets/scss/grid/_row.scss +24 -19
  100. data/vendor/assets/scss/settings/_settings.scss +117 -70
  101. data/vendor/assets/scss/typography/_base.scss +110 -44
  102. data/vendor/assets/scss/typography/_helpers.scss +1 -0
  103. data/vendor/assets/scss/typography/_print.scss +7 -3
  104. data/vendor/assets/scss/typography/_typography.scss +0 -2
  105. data/vendor/assets/scss/util/_breakpoint.scss +28 -19
  106. data/vendor/assets/scss/util/_color.scss +69 -16
  107. data/vendor/assets/scss/util/_flex.scss +20 -3
  108. data/vendor/assets/scss/util/_math.scss +72 -0
  109. data/vendor/assets/scss/util/_mixins.scss +63 -26
  110. data/vendor/assets/scss/util/_selector.scss +3 -2
  111. data/vendor/assets/scss/util/_unit.scss +61 -4
  112. data/vendor/assets/scss/util/_util.scss +1 -0
  113. data/vendor/assets/scss/util/_value.scss +33 -0
  114. metadata +17 -2
@@ -1,63 +1 @@
1
- // Foundation for Sites by ZURB
2
- // foundation.zurb.com
3
- // Licensed under MIT Open Source
4
-
5
- ////
6
- /// @group flex-video
7
- ////
8
-
9
- /// Margin below a flex video container.
10
- /// @type Number
11
- $flexvideo-margin-bottom: rem-calc(16) !default;
12
-
13
- /// Padding used to create a 4:3 aspect ratio.
14
- /// @type Number
15
- $flexvideo-ratio: 4 by 3 !default;
16
-
17
- /// Padding used to create a 16:9 aspect ratio.
18
- /// @type Number
19
- $flexvideo-ratio-widescreen: 16 by 9 !default;
20
-
21
- /// Creates a percentage height that can be used as padding in a flex video container.
22
- /// @param {List} $ratio - Ratio to use to calculate the height, formatted as `x by y`.
23
- /// @return {Number} A percentage value that can be used as the `padding-bottom` parameter of a flex video container.
24
- @function flex-video($ratio) {
25
- $w: nth($ratio, 1);
26
- $h: nth($ratio, 3);
27
- @return $h / $w * 100%;
28
- }
29
-
30
- /// Creates a flex video container.
31
- /// @param {List} $ratio [$flexvideo-ratio] - Ratio to use for the container, formatted as `x by y`.
32
- @mixin flex-video($ratio: $flexvideo-ratio) {
33
- position: relative;
34
- height: 0;
35
- padding-bottom: flex-video($ratio);
36
- margin-bottom: $flexvideo-margin-bottom;
37
- overflow: hidden;
38
-
39
- iframe,
40
- object,
41
- embed,
42
- video {
43
- position: absolute;
44
- top: 0;
45
- #{$global-left}: 0;
46
- width: 100%;
47
- height: 100%;
48
- }
49
- }
50
-
51
- @mixin foundation-flex-video {
52
- .flex-video {
53
- @include flex-video;
54
-
55
- &.widescreen {
56
- padding-bottom: flex-video($flexvideo-ratio-widescreen);
57
- }
58
-
59
- &.vimeo {
60
- padding-top: 0;
61
- }
62
- }
63
- }
1
+ @import 'responsive-embed';
@@ -17,8 +17,8 @@
17
17
 
18
18
  .float-center {
19
19
  display: block;
20
- margin-left: auto;
21
20
  margin-right: auto;
21
+ margin-left: auto;
22
22
  }
23
23
 
24
24
  .clearfix {
@@ -12,7 +12,15 @@ $label-background: $primary-color !default;
12
12
 
13
13
  /// Default text color for labels.
14
14
  /// @type Color
15
- $label-color: foreground($label-background) !default;
15
+ $label-color: $white !default;
16
+
17
+ /// Alternate text color for labels.
18
+ /// @type Color
19
+ $label-color-alt: $black !default;
20
+
21
+ /// Coloring classes. A map of classes to output in your CSS, like `.secondary`, `.success`, and so on.
22
+ /// @type Map
23
+ $label-palette: $foundation-palette !default;
16
24
 
17
25
  /// Default font size for labels.
18
26
  /// @type Number
@@ -30,11 +38,13 @@ $label-radius: $global-radius !default;
30
38
  @mixin label {
31
39
  display: inline-block;
32
40
  padding: $label-padding;
41
+
42
+ border-radius: $label-radius;
43
+
33
44
  font-size: $label-font-size;
34
45
  line-height: 1;
35
46
  white-space: nowrap;
36
47
  cursor: default;
37
- border-radius: $label-radius;
38
48
  }
39
49
 
40
50
  @mixin foundation-label {
@@ -44,12 +54,10 @@ $label-radius: $global-radius !default;
44
54
  background: $label-background;
45
55
  color: $label-color;
46
56
 
47
- @each $name, $color in $foundation-palette {
48
- @if $name != primary {
49
- &.#{$name} {
50
- background: $color;
51
- color: foreground($color);
52
- }
57
+ @each $name, $color in $label-palette {
58
+ &.#{$name} {
59
+ background: $color;
60
+ color: color-pick-contrast($color, ($label-color, $label-color-alt));
53
61
  }
54
62
  }
55
63
  }
@@ -20,8 +20,8 @@ $mediaobject-image-width-stacked: 100% !default;
20
20
 
21
21
  /// Adds styles for a media object container.
22
22
  @mixin media-object-container {
23
- margin-bottom: $mediaobject-margin-bottom;
24
23
  display: if($global-flexbox, flex, block);
24
+ margin-bottom: $mediaobject-margin-bottom;
25
25
 
26
26
  @if $global-flexbox {
27
27
  flex-wrap: nowrap;
@@ -97,9 +97,8 @@ $mediaobject-image-width-stacked: 100% !default;
97
97
  @include media-object-section;
98
98
 
99
99
  @if $global-flexbox {
100
- // scss-lint:disable ZeroUnit
101
100
  &.main-section {
102
- flex: 1 1 0px;
101
+ flex: 1 1 0px; // sass-lint:disable-line zero-unit
103
102
  }
104
103
  }
105
104
  @else {
@@ -24,22 +24,30 @@ $menu-item-color-active: $white !default;
24
24
 
25
25
  /// Background color of an active menu item.
26
26
  /// @type Color
27
- $menu-item-background-active: map-get($foundation-palette, primary) !default;
27
+ $menu-item-background-active: get-color(primary) !default;
28
28
 
29
29
  /// Spacing between an icon and text in a menu item.
30
30
  /// @type Number
31
31
  $menu-icon-spacing: 0.25rem !default;
32
32
 
33
+ /// Background color for an hovered menu item.
34
+ /// @type Color
35
+ $menu-item-background-hover: $light-gray !default;
36
+
37
+ /// Color for bordered menu
38
+ /// @type Color
39
+ $menu-border: $light-gray !default;
40
+
33
41
  /// Creates the base styles for a Menu.
34
42
  @mixin menu-base {
35
43
  margin: $menu-margin;
36
44
  list-style-type: none;
37
45
 
38
46
  @if $global-flexbox {
39
- width: 100%;
40
47
  display: flex;
41
48
  flex-wrap: nowrap;
42
49
  align-items: center;
50
+ width: 100%;
43
51
  }
44
52
 
45
53
  // List items are table cell to allow for vertical alignment
@@ -64,6 +72,7 @@ $menu-icon-spacing: 0.25rem !default;
64
72
 
65
73
  // Reset styles of inner elements
66
74
  input,
75
+ select,
67
76
  a,
68
77
  button {
69
78
  margin-bottom: 0;
@@ -73,16 +82,19 @@ $menu-icon-spacing: 0.25rem !default;
73
82
  /// Expands the items of a Menu, so each item is the same width.
74
83
  @mixin menu-expand {
75
84
  @if $global-flexbox {
76
- // scss-lint:disable ZeroUnit
77
85
  > li {
78
- flex: 1 1 0px;
86
+ flex: 1 1 0px; // sass-lint:disable-line zero-unit
79
87
  }
80
88
  }
81
89
  @else {
82
- width: 100%;
83
90
  display: table;
91
+ width: 100%;
84
92
  table-layout: fixed;
85
93
  }
94
+
95
+ > li:first-child:last-child {
96
+ width: 100%;
97
+ }
86
98
  }
87
99
 
88
100
  /// Sets the direction of a Menu.
@@ -112,8 +124,8 @@ $menu-icon-spacing: 0.25rem !default;
112
124
  }
113
125
 
114
126
  > li > a {
115
- align-items: flex-start;
116
127
  justify-content: flex-start;
128
+ align-items: flex-start;
117
129
  }
118
130
  }
119
131
  @else {
@@ -130,9 +142,9 @@ $menu-icon-spacing: 0.25rem !default;
130
142
  /// Creates a simple Menu, which has no padding or hover state.
131
143
  @mixin menu-simple {
132
144
  li {
133
- line-height: 1;
134
145
  display: inline-block;
135
146
  margin-#{$global-right}: get-side($menu-item-padding, $global-right);
147
+ line-height: 1;
136
148
  }
137
149
 
138
150
  a {
@@ -206,8 +218,8 @@ $menu-icon-spacing: 0.25rem !default;
206
218
  }
207
219
  @else {
208
220
  align-self: stretch;
209
- text-align: center;
210
221
  margin-bottom: $menu-icon-spacing;
222
+ text-align: center;
211
223
  }
212
224
  }
213
225
  }
@@ -215,12 +227,13 @@ $menu-icon-spacing: 0.25rem !default;
215
227
  }
216
228
 
217
229
  @mixin menu-text {
218
- font-weight: bold;
219
- color: inherit;
220
- line-height: 1;
221
230
  padding-top: 0;
222
231
  padding-bottom: 0;
223
232
  padding: $menu-item-padding;
233
+
234
+ font-weight: bold;
235
+ line-height: 1;
236
+ color: inherit;
224
237
  }
225
238
 
226
239
  @mixin foundation-menu {
@@ -228,24 +241,32 @@ $menu-icon-spacing: 0.25rem !default;
228
241
  @include menu-base;
229
242
  @include menu-icons;
230
243
 
231
- // Orientation
232
- @include menu-direction(horizontal);
244
+ // Default orientation: horizontal
245
+ &, &.horizontal {
246
+ @include menu-direction(horizontal);
247
+ }
248
+
249
+ // Even-width modifier for horizontal orientation
250
+ &.expanded {
251
+ @include menu-expand;
252
+ }
233
253
 
254
+ // Vertical orientation modifier
234
255
  &.vertical {
235
256
  @include menu-direction(vertical);
236
257
  }
237
258
 
238
- @each $size in $breakpoint-classes {
239
- @if $size != $-zf-zero-breakpoint {
240
- @include breakpoint($size) {
241
- &.#{$size}-horizontal {
242
- @include menu-direction(horizontal);
243
- }
259
+ @include -zf-each-breakpoint($small: false) {
260
+ &.#{$-zf-size}-horizontal {
261
+ @include menu-direction(horizontal);
262
+ }
244
263
 
245
- &.#{$size}-vertical {
246
- @include menu-direction(vertical);
247
- }
248
- }
264
+ &.#{$-zf-size}-expanded {
265
+ @include menu-expand;
266
+ }
267
+
268
+ &.#{$-zf-size}-vertical {
269
+ @include menu-direction(vertical);
249
270
  }
250
271
  }
251
272
 
@@ -268,18 +289,15 @@ $menu-icon-spacing: 0.25rem !default;
268
289
  }
269
290
  }
270
291
 
271
- // Even-width
272
- &.expanded {
273
- @include menu-expand;
274
-
275
- > li:first-child:last-child {
276
- width: 100%;
277
- }
278
- }
279
-
280
292
  // Vertical icons
281
293
  &.icon-top {
282
294
  @include menu-icons(top, $base: false);
295
+ // Make vertical menu with icons on top work
296
+ &.vertical {
297
+ a > span {
298
+ margin: auto;
299
+ }
300
+ }
283
301
  }
284
302
 
285
303
  // Nesting
@@ -289,8 +307,25 @@ $menu-icon-spacing: 0.25rem !default;
289
307
 
290
308
  // Active state
291
309
  .active > a {
292
- color: $menu-item-color-active;
293
310
  background: $menu-item-background-active;
311
+ color: $menu-item-color-active;
312
+ }
313
+
314
+ // Menu with border
315
+ &.menu-bordered {
316
+ li {
317
+ border: 1px solid $menu-border;
318
+ &:not(:first-child) {
319
+ border-top: 0;
320
+ }
321
+ }
322
+ }
323
+
324
+ // Menu with background hover
325
+ &.menu-hover {
326
+ li:hover {
327
+ background-color: $menu-item-background-hover;
328
+ }
294
329
  }
295
330
  }
296
331
 
@@ -6,146 +6,271 @@
6
6
  /// @group off-canvas
7
7
  ////
8
8
 
9
- /// Width of an off-canvas menu.
9
+ /// Width of a left/right off-canvas panel.
10
10
  /// @type Number
11
11
  $offcanvas-size: 250px !default;
12
12
 
13
- /// Background color of an off-canvas menu.
13
+ /// Height of a top/bottom off-canvas panel.
14
+ /// @type Number
15
+ $offcanvas-vertical-size: 250px !default;
16
+
17
+ /// Background color of an off-canvas panel.
14
18
  /// @type Color
15
19
  $offcanvas-background: $light-gray !default;
16
20
 
17
- /// Z-index of an off-canvas menu.
21
+ /// Box shadow for the off-canvas panel.
22
+ /// @type Shadow
23
+ $offcanvas-shadow: 0 0 10px rgba($black, 0.7) !default;
24
+
25
+ /// Z-index of an off-canvas panel with the `push` transition.
18
26
  /// @type Number
19
- $offcanvas-zindex: -1 !default;
27
+ $offcanvas-push-zindex: 1 !default;
20
28
 
21
- /// Length of the animation on an off-canvas menu.
29
+ /// Z-index of an off-canvas panel with the `overlap` transition.
30
+ /// @type Number
31
+ $offcanvas-overlap-zindex: 10 !default;
32
+
33
+ /// Z-index of an off-canvas panel using the `reveal-for-*` classes or mixin.
34
+ /// @type Number
35
+ $offcanvas-reveal-zindex: 1 !default;
36
+
37
+ /// Length of the animation on an off-canvas panel.
22
38
  /// @type Number
23
39
  $offcanvas-transition-length: 0.5s !default;
24
40
 
25
- /// Timing function of the animation on an off-canvas menu.
41
+ /// Timing function of the animation on an off-canvas panel.
26
42
  /// @type Keyword
27
43
  $offcanvas-transition-timing: ease !default;
28
44
 
29
45
  /// If `true`, a revealed off-canvas will be fixed-position, and scroll with the screen.
46
+ /// @type Bool
30
47
  $offcanvas-fixed-reveal: true !default;
31
48
 
32
- /// Background color for the overlay that appears when an off-canvas menu is open.
49
+ /// Background color for the overlay that appears when an off-canvas panel is open.
33
50
  /// @type Color
34
51
  $offcanvas-exit-background: rgba($white, 0.25) !default;
35
52
 
36
- /// CSS class used for the main content area. The off-canvas mixins use this to target the page body.
53
+ /// CSS class used for the main content area. The off-canvas mixins use this to target the page content.
37
54
  $maincontent-class: 'off-canvas-content' !default;
38
55
 
39
- /// Box shadow to place under the main content area. This shadow overlaps the off-canvas menus.
40
- /// @type Shadow
41
- $maincontent-shadow: 0 0 10px rgba($black, 0.5) !default;
42
-
43
56
  /// Adds baseline styles for off-canvas. This CSS is required to make the other pieces work.
44
57
  @mixin off-canvas-basics {
45
- // Extra properties needed on <html> and <body> to make off-canvas work
46
- html,
47
- body {
48
- height: 100%;
58
+ // Hides overflow on body when an off-canvas panel is open.
59
+ .is-off-canvas-open {
60
+ overflow: hidden;
49
61
  }
50
62
 
51
- .off-canvas-wrapper {
52
- width: 100%;
53
- overflow-x: hidden;
54
- position: relative;
55
- backface-visibility: hidden;
56
- -webkit-overflow-scrolling: auto;
57
- }
58
-
59
- .off-canvas-wrapper-inner {
60
- @include clearfix;
61
- position: relative;
62
- width: 100%;
63
- min-height: 100%;
64
- transition: transform $offcanvas-transition-length $offcanvas-transition-timing;
65
- }
66
-
67
- // Container for page content
68
- .off-canvas-content,
69
- .#{$maincontent-class} {
70
- min-height: 100%;
71
- background: $body-background;
72
- transition: transform $offcanvas-transition-length $offcanvas-transition-timing;
73
- backface-visibility: hidden;
74
- z-index: 1;
75
- padding-bottom: 0.1px; // Prevents margin collapsing, which would reveal the box shadow of the wrapper
76
-
77
- @if has-value($maincontent-shadow) {
78
- box-shadow: $maincontent-shadow;
79
- }
80
- }
81
-
82
- // Click-to-exit overlay (generated by JavaScript)
83
- .js-off-canvas-exit {
84
- display: none;
63
+ // Off-canvas overlay (generated by JavaScript)
64
+ .js-off-canvas-overlay {
85
65
  position: absolute;
86
66
  top: 0;
87
67
  left: 0;
68
+
88
69
  width: 100%;
89
70
  height: 100%;
71
+
72
+ transition: opacity $offcanvas-transition-length $offcanvas-transition-timing, visibility $offcanvas-transition-length $offcanvas-transition-timing;
73
+
90
74
  background: $offcanvas-exit-background;
91
- cursor: pointer;
92
- transition: background $offcanvas-transition-length $offcanvas-transition-timing;
75
+
76
+ opacity: 0;
77
+ visibility: hidden;
78
+
79
+ overflow: hidden;
80
+
81
+ &.is-visible {
82
+ opacity: 1;
83
+ visibility: visible;
84
+ }
85
+
86
+ &.is-closable {
87
+ cursor: pointer;
88
+ }
89
+
90
+ &.is-overlay-absolute {
91
+ position: absolute;
92
+ }
93
+
94
+ &.is-overlay-fixed {
95
+ position: fixed;
96
+ }
93
97
  }
94
98
  }
95
99
 
96
- /// Adds basic styles for an off-canvas menu.
97
- @mixin off-canvas-base {
100
+ // Adds basic styles for an off-canvas wrapper.
101
+ @mixin off-canvas-wrapper() {
102
+ position: relative;
103
+ overflow: hidden;
104
+ }
105
+
106
+ /// Adds basic styles for an off-canvas panel.
107
+ @mixin off-canvas-base(
108
+ $background: $offcanvas-background,
109
+ $transition: $offcanvas-transition-length $offcanvas-transition-timing,
110
+ $fixed: true
111
+ ) {
98
112
  @include disable-mouse-outline;
99
- position: absolute;
100
- background: $offcanvas-background;
101
- z-index: $offcanvas-zindex;
102
- max-height: 100%;
103
- overflow-y: auto;
104
- transform: translateX(0);
113
+
114
+ @if $fixed == true {
115
+ position: fixed;
116
+ }
117
+ @else {
118
+ position: absolute;
119
+ }
120
+
121
+ z-index: $offcanvas-push-zindex;
122
+
123
+ transition: transform $transition;
124
+ backface-visibility: hidden;
125
+
126
+ background: $background;
127
+
128
+ // Overlap only styles.
129
+ &.is-transition-overlap {
130
+ z-index: $offcanvas-overlap-zindex;
131
+
132
+ &.is-open {
133
+ box-shadow: $offcanvas-shadow;
134
+ }
135
+ }
136
+
137
+ // Sets transform to 0 to show an off-canvas panel.
138
+ &.is-open {
139
+ transform: translate(0, 0);
140
+ }
105
141
  }
106
142
 
143
+ /// Adds styles to position an off-canvas panel to the left/right/top/bottom.
107
144
  @mixin off-canvas-position(
108
145
  $position: left,
109
- $size: $offcanvas-size,
110
- $fixed: false
146
+ $orientation: horizontal,
147
+ $size: if($orientation == horizontal, $offcanvas-size, $offcanvas-vertical-size)
111
148
  ) {
112
149
  @if $position == left {
113
- left: -$size;
114
150
  top: 0;
151
+ left: 0;
115
152
  width: $size;
153
+ height: 100%;
154
+
155
+ transform: translateX(-$size);
156
+ overflow-y: auto;
157
+
158
+ // Sets the open position for the content
159
+ &.is-open ~ .#{$maincontent-class} {
160
+ transform: translateX($size);
161
+ }
116
162
  }
117
163
  @else if $position == right {
118
- right: -$size;
119
164
  top: 0;
165
+ right: 0;
120
166
  width: $size;
167
+ height: 100%;
168
+
169
+ transform: translateX($size);
170
+ overflow-y: auto;
171
+
172
+ // Sets the open position for the content
173
+ &.is-open ~ .#{$maincontent-class} {
174
+ transform: translateX(-$size);
175
+ }
121
176
  }
177
+ @else if $position == top {
178
+ top: 0;
179
+ left: 0;
180
+
181
+ width: 100%;
182
+ height: $size;
183
+
184
+ transform: translateY(-$size);
185
+ overflow-x: auto;
186
+
187
+ // Sets the open position for the content
188
+ &.is-open ~ .#{$maincontent-class} {
189
+ transform: translateY($size);
190
+ }
191
+ }
192
+ @else if $position == bottom {
193
+ bottom: 0;
194
+ left: 0;
195
+
196
+ width: 100%;
197
+ height: $size;
198
+
199
+ transform: translateY($size);
200
+ overflow-x: auto;
201
+
202
+ // Sets the open position for the content
203
+ &.is-open ~ .#{$maincontent-class} {
204
+ transform: translateY(-$size);
205
+ }
206
+ }
207
+
208
+ // If $offcanvas-shadow is set, add it as a pseudo-element.
209
+ // This mimics the off-canvas panel having a lower z-index, without having to have one.
210
+ @if $offcanvas-shadow {
211
+ &.is-transition-push::after {
212
+ position: absolute;
122
213
 
123
- // Generates an open state class that matches the width of the menu
124
- @at-root {
125
- .is-open-#{$position} {
126
214
  @if $position == left {
127
- transform: translateX($size);
215
+ top: 0;
216
+ right: 0;
217
+
218
+ height: 100%;
219
+ width: 1px;
128
220
  }
129
221
  @else if $position == right {
130
- transform: translateX(-$size);
222
+ top: 0;
223
+ left: 0;
224
+
225
+ height: 100%;
226
+ width: 1px;
227
+ }
228
+ @else if $position == top {
229
+ bottom: 0;
230
+ left: 0;
231
+
232
+ height: 1px;
233
+ width: 100%;
131
234
  }
235
+ @else if $position == bottom {
236
+ top: 0;
237
+ left: 0;
238
+
239
+ height: 1px;
240
+ width: 100%;
241
+ }
242
+
243
+ box-shadow: $offcanvas-shadow;
244
+ content: " ";
132
245
  }
133
246
  }
247
+
248
+ // No transform on overlap transition
249
+ &.is-transition-overlap.is-open ~ .#{$maincontent-class} {
250
+ transform: none;
251
+ }
252
+ }
253
+
254
+ /// Sets the styles for the content container.
255
+ @mixin off-canvas-content() {
256
+ transition: transform $offcanvas-transition-length $offcanvas-transition-timing;
257
+ backface-visibility: hidden;
134
258
  }
135
259
 
136
- /// Adds styles that reveal an off-canvas menu.
137
- /// @param {Keyword} $position [left] - Position of the off-canvas menu being revealed.
260
+ /// Adds styles that reveal an off-canvas panel.
138
261
  @mixin off-canvas-reveal(
139
- $position: left
262
+ $position: left,
263
+ $zindex: $offcanvas-reveal-zindex,
264
+ $content: $maincontent-class
140
265
  ) {
141
- #{$position}: 0;
142
- z-index: auto;
266
+ transform: none;
267
+ z-index: $zindex;
143
268
 
144
- @if $offcanvas-fixed-reveal {
145
- position: fixed;
269
+ @if not $offcanvas-fixed-reveal {
270
+ position: absolute;
146
271
  }
147
272
 
148
- & ~ .#{$maincontent-class} {
273
+ & ~ .#{$content} {
149
274
  margin-#{$position}: $offcanvas-size;
150
275
  }
151
276
  }
@@ -153,15 +278,32 @@ $maincontent-shadow: 0 0 10px rgba($black, 0.5) !default;
153
278
  @mixin foundation-off-canvas {
154
279
  @include off-canvas-basics;
155
280
 
281
+ // Off-canvas wrapper
282
+ .off-canvas-wrapper {
283
+ @include off-canvas-wrapper;
284
+ }
285
+
156
286
  // Off-canvas container
157
287
  .off-canvas {
158
288
  @include off-canvas-base;
289
+ }
290
+
291
+ // Off-canvas container with absolute position
292
+ .off-canvas-absolute {
293
+ @include off-canvas-base($fixed: false);
294
+ }
159
295
 
160
- &.position-left { @include off-canvas-position(left); }
161
- &.position-right { @include off-canvas-position(right); }
296
+ // Off-canvas position classes
297
+ .position-left { @include off-canvas-position(left, horizontal); }
298
+ .position-right { @include off-canvas-position(right, horizontal); }
299
+ .position-top { @include off-canvas-position(top, vertical); }
300
+ .position-bottom { @include off-canvas-position(bottom, vertical); }
301
+
302
+ .off-canvas-content {
303
+ @include off-canvas-content;
162
304
  }
163
305
 
164
- // Reveal off-canvas menu on larger screens
306
+ // Reveal off-canvas panel on larger screens
165
307
  @each $name, $value in $breakpoint-classes {
166
308
  @if $name != $-zf-zero-breakpoint {
167
309
  @include breakpoint($name) {
@@ -172,7 +314,16 @@ $maincontent-shadow: 0 0 10px rgba($black, 0.5) !default;
172
314
  .position-right.reveal-for-#{$name} {
173
315
  @include off-canvas-reveal(right);
174
316
  }
317
+
318
+ .position-top.reveal-for-#{$name} {
319
+ @include off-canvas-reveal(top);
320
+ }
321
+
322
+ .position-bottom.reveal-for-#{$name} {
323
+ @include off-canvas-reveal(bottom);
324
+ }
175
325
  }
176
326
  }
177
327
  }
178
328
  }
329
+