foundation-rails 6.2.3.0 → 6.2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/bower.json +1 -1
  3. data/lib/foundation/rails/version.rb +1 -1
  4. data/lib/generators/foundation/templates/_settings.scss +7 -0
  5. data/vendor/assets/js/foundation.accordion.js.es6 +13 -24
  6. data/vendor/assets/js/foundation.accordionMenu.js.es6 +9 -10
  7. data/vendor/assets/js/foundation.core.js.es6 +1 -1
  8. data/vendor/assets/js/foundation.drilldown.js.es6 +21 -9
  9. data/vendor/assets/js/foundation.dropdown.js.es6 +11 -8
  10. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +46 -21
  11. data/vendor/assets/js/foundation.equalizer.js.es6 +3 -1
  12. data/vendor/assets/js/foundation.interchange.js.es6 +1 -1
  13. data/vendor/assets/js/foundation.magellan.js.es6 +3 -1
  14. data/vendor/assets/js/foundation.offcanvas.js.es6 +41 -27
  15. data/vendor/assets/js/foundation.orbit.js.es6 +23 -15
  16. data/vendor/assets/js/foundation.reveal.js.es6 +10 -3
  17. data/vendor/assets/js/foundation.slider.js.es6 +1 -1
  18. data/vendor/assets/js/foundation.sticky.js.es6 +18 -7
  19. data/vendor/assets/js/foundation.tooltip.js.es6 +2 -1
  20. data/vendor/assets/js/foundation.util.box.js.es6 +2 -2
  21. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +1 -1
  22. data/vendor/assets/js/foundation.util.nest.js.es6 +1 -1
  23. data/vendor/assets/js/foundation.util.timerAndImageLoader.js.es6 +1 -1
  24. data/vendor/assets/js/foundation.util.triggers.js.es6 +1 -1
  25. data/vendor/assets/scss/components/_button.scss +24 -6
  26. data/vendor/assets/scss/components/_drilldown.scss +1 -1
  27. data/vendor/assets/scss/components/_off-canvas.scss +1 -0
  28. data/vendor/assets/scss/components/_orbit.scss +1 -0
  29. data/vendor/assets/scss/components/_pagination.scss +13 -2
  30. data/vendor/assets/scss/components/_reveal.scss +3 -3
  31. data/vendor/assets/scss/components/_switch.scss +4 -0
  32. data/vendor/assets/scss/components/_table.scss +39 -4
  33. data/vendor/assets/scss/components/_title-bar.scss +0 -4
  34. data/vendor/assets/scss/components/_top-bar.scss +4 -2
  35. data/vendor/assets/scss/forms/_input-group.scss +4 -3
  36. data/vendor/assets/scss/forms/_meter.scss +3 -1
  37. data/vendor/assets/scss/forms/_progress.scss +9 -0
  38. data/vendor/assets/scss/forms/_text.scss +6 -2
  39. data/vendor/assets/scss/foundation.scss +1 -1
  40. data/vendor/assets/scss/grid/_classes.scss +14 -10
  41. data/vendor/assets/scss/grid/_flex-grid.scss +19 -9
  42. data/vendor/assets/scss/grid/_layout.scss +27 -2
  43. data/vendor/assets/scss/grid/_position.scss +4 -1
  44. data/vendor/assets/scss/grid/_row.scss +1 -2
  45. data/vendor/assets/scss/settings/_settings.scss +7 -0
  46. data/vendor/assets/scss/util/_breakpoint.scss +12 -15
  47. data/vendor/assets/scss/util/_color.scss +13 -0
  48. data/vendor/assets/scss/util/_mixins.scss +6 -2
  49. data/vendor/assets/scss/util/_unit.scss +5 -0
  50. metadata +2 -2
@@ -5,6 +5,8 @@
5
5
  /**
6
6
  * Equalizer module.
7
7
  * @module foundation.equalizer
8
+ * @requires foundation.util.mediaQuery
9
+ * @requires foundation.util.timerAndImageLoader if equalizer contains images
8
10
  */
9
11
 
10
12
  class Equalizer {
@@ -285,7 +287,7 @@ Equalizer.defaults = {
285
287
  * @option
286
288
  * @example true
287
289
  */
288
- equalizeOnStack: true,
290
+ equalizeOnStack: false,
289
291
  /**
290
292
  * Enable height equalization row by row.
291
293
  * @option
@@ -139,7 +139,7 @@ class Interchange {
139
139
 
140
140
  // Replacing images
141
141
  if (this.$element[0].nodeName === 'IMG') {
142
- this.$element.attr('src', path).load(function() {
142
+ this.$element.attr('src', path).on('load', function() {
143
143
  _this.currentPath = path;
144
144
  })
145
145
  .trigger(trigger);
@@ -103,6 +103,8 @@ class Magellan {
103
103
  * @function
104
104
  */
105
105
  scrollToLoc(loc) {
106
+ // Do nothing if target does not exist to prevent errors
107
+ if (!$(loc).length) {return false;}
106
108
  var scrollPos = Math.round($(loc).offset().top - this.options.threshold / 2 - this.options.barOffset);
107
109
 
108
110
  $('html, body').stop(true).animate({ scrollTop: scrollPos }, this.options.animationDuration, this.options.animationEasing);
@@ -139,7 +141,7 @@ class Magellan {
139
141
  }
140
142
 
141
143
  this.$active.removeClass(this.options.activeClass);
142
- this.$active = this.$links.eq(curIdx).addClass(this.options.activeClass);
144
+ this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass);
143
145
 
144
146
  if(this.options.deepLinking){
145
147
  var hash = this.$active[0].getAttribute('href');
@@ -27,7 +27,11 @@ class OffCanvas {
27
27
  this._init();
28
28
  this._events();
29
29
 
30
- Foundation.registerPlugin(this, 'OffCanvas');
30
+ Foundation.registerPlugin(this, 'OffCanvas')
31
+ Foundation.Keyboard.register('OffCanvas', {
32
+ 'ESCAPE': 'close'
33
+ });
34
+
31
35
  }
32
36
 
33
37
  /**
@@ -169,16 +173,15 @@ class OffCanvas {
169
173
  * Fires when the off-canvas menu opens.
170
174
  * @event OffCanvas#opened
171
175
  */
172
- Foundation.Move(this.options.transitionTime, this.$element, function() {
173
- $('[data-off-canvas-wrapper]').addClass('is-off-canvas-open is-open-'+ _this.options.position);
174
176
 
175
- _this.$element
176
- .addClass('is-open')
177
+ var $wrapper = $('[data-off-canvas-wrapper]');
178
+ $wrapper.addClass('is-off-canvas-open is-open-'+ _this.options.position);
179
+
180
+ _this.$element.addClass('is-open')
177
181
 
178
182
  // if (_this.options.isSticky) {
179
183
  // _this._stick();
180
184
  // }
181
- });
182
185
 
183
186
  this.$triggers.attr('aria-expanded', 'true');
184
187
  this.$element.attr('aria-hidden', 'false')
@@ -193,14 +196,21 @@ class OffCanvas {
193
196
  }
194
197
 
195
198
  if (this.options.autoFocus) {
196
- this.$element.one(Foundation.transitionend(this.$element), function() {
197
- _this.$element.find('a, button').eq(0).focus();
199
+ $wrapper.one(Foundation.transitionend($wrapper), function() {
200
+ if(_this.$element.hasClass('is-open')) { // handle double clicks
201
+ _this.$element.attr('tabindex', '-1');
202
+ _this.$element.focus();
203
+ }
198
204
  });
199
205
  }
200
206
 
201
207
  if (this.options.trapFocus) {
202
- $('[data-off-canvas-content]').attr('tabindex', '-1');
203
- this._trapFocus();
208
+ $wrapper.one(Foundation.transitionend($wrapper), function() {
209
+ if(_this.$element.hasClass('is-open')) { // handle double clicks
210
+ _this.$element.attr('tabindex', '-1');
211
+ _this.trapFocus();
212
+ }
213
+ });
204
214
  }
205
215
  }
206
216
 
@@ -214,15 +224,14 @@ class OffCanvas {
214
224
  last = focusable.eq(-1);
215
225
 
216
226
  focusable.off('.zf.offcanvas').on('keydown.zf.offcanvas', function(e) {
217
- if (e.which === 9 || e.keycode === 9) {
218
- if (e.target === last[0] && !e.shiftKey) {
219
- e.preventDefault();
220
- first.focus();
221
- }
222
- if (e.target === first[0] && e.shiftKey) {
223
- e.preventDefault();
224
- last.focus();
225
- }
227
+ var key = Foundation.Keyboard.parseKey(e);
228
+ if (key === 'TAB' && e.target === last[0]) {
229
+ e.preventDefault();
230
+ first.focus();
231
+ }
232
+ if (key === 'SHIFT_TAB' && e.target === first[0]) {
233
+ e.preventDefault();
234
+ last.focus();
226
235
  }
227
236
  });
228
237
  }
@@ -304,13 +313,18 @@ class OffCanvas {
304
313
  * @function
305
314
  * @private
306
315
  */
307
- _handleKeyboard(event) {
308
- if (event.which !== 27) return;
309
-
310
- event.stopPropagation();
311
- event.preventDefault();
312
- this.close();
313
- this.$lastTrigger.focus();
316
+ _handleKeyboard(e) {
317
+ Foundation.Keyboard.handleKey(e, 'OffCanvas', {
318
+ close: () => {
319
+ this.close();
320
+ this.$lastTrigger.focus();
321
+ return true;
322
+ },
323
+ handled: () => {
324
+ e.stopPropagation();
325
+ e.preventDefault();
326
+ }
327
+ });
314
328
  }
315
329
 
316
330
  /**
@@ -370,7 +384,7 @@ OffCanvas.defaults = {
370
384
  revealOn: null,
371
385
 
372
386
  /**
373
- * Force focus to the offcanvas on open. If true, will focus the opening trigger on close.
387
+ * Force focus to the offcanvas on open. If true, will focus the opening trigger on close. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
374
388
  * @option
375
389
  * @example true
376
390
  */
@@ -216,23 +216,25 @@ class Orbit {
216
216
  _this.changeSlide(ltr, $slide, idx);
217
217
  });
218
218
  }
219
-
220
- this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e) {
221
- // handle keyboard event with keyboard util
222
- Foundation.Keyboard.handleKey(e, 'Orbit', {
223
- next: function() {
224
- _this.changeSlide(true);
225
- },
226
- previous: function() {
227
- _this.changeSlide(false);
228
- },
229
- handled: function() { // if bullet is focused, make sure focus moves
230
- if ($(e.target).is(_this.$bullets)) {
231
- _this.$bullets.filter('.is-active').focus();
219
+
220
+ if (this.options.accessible) {
221
+ this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e) {
222
+ // handle keyboard event with keyboard util
223
+ Foundation.Keyboard.handleKey(e, 'Orbit', {
224
+ next: function() {
225
+ _this.changeSlide(true);
226
+ },
227
+ previous: function() {
228
+ _this.changeSlide(false);
229
+ },
230
+ handled: function() { // if bullet is focused, make sure focus moves
231
+ if ($(e.target).is(_this.$bullets)) {
232
+ _this.$bullets.filter('.is-active').focus();
233
+ }
232
234
  }
233
- }
235
+ });
234
236
  });
235
- });
237
+ }
236
238
  }
237
239
  }
238
240
 
@@ -266,6 +268,12 @@ class Orbit {
266
268
  }
267
269
 
268
270
  if ($newSlide.length) {
271
+ /**
272
+ * Triggers before the next slide starts animating in and only if a next slide has been found.
273
+ * @event Orbit#beforeslidechange
274
+ */
275
+ this.$element.trigger('beforeslidechange.zf.orbit', [$curSlide, $newSlide]);
276
+
269
277
  if (this.options.bullets) {
270
278
  idx = idx || this.$slides.index($newSlide); //grab index to update bullets
271
279
  this._updateBullets(idx);
@@ -157,7 +157,11 @@ class Reveal {
157
157
 
158
158
  if (this.options.closeOnClick && this.options.overlay) {
159
159
  this.$overlay.off('.zf.reveal').on('click.zf.reveal', function(e) {
160
- if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { return; }
160
+ if (e.target === _this.$element[0] ||
161
+ $.contains(_this.$element[0], e.target) ||
162
+ !$.contains(document, e.target)) {
163
+ return;
164
+ }
161
165
  _this.close();
162
166
  });
163
167
  }
@@ -238,7 +242,6 @@ class Reveal {
238
242
  'tabindex': -1
239
243
  })
240
244
  .focus();
241
- console.log('focus');
242
245
  }
243
246
  if (this.options.overlay) {
244
247
  Foundation.Motion.animateIn(this.$overlay, 'fade-in');
@@ -293,7 +296,9 @@ class Reveal {
293
296
 
294
297
  if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) {
295
298
  $('body').on('click.zf.reveal', function(e) {
296
- if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { return; }
299
+ if (e.target === _this.$element[0] ||
300
+ $.contains(_this.$element[0], e.target) ||
301
+ !$.contains(document, e.target)) { return; }
297
302
  _this.close();
298
303
  });
299
304
  }
@@ -317,6 +322,7 @@ class Reveal {
317
322
  // handle keyboard event with keyboard util
318
323
  Foundation.Keyboard.handleKey(e, 'Reveal', {
319
324
  tab_forward: function() {
325
+ _this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element);
320
326
  if (_this.$element.find(':focus').is(_this.focusableElements.eq(-1))) { // left modal downwards, setting focus to first element
321
327
  _this.focusableElements.eq(0).focus();
322
328
  return true;
@@ -326,6 +332,7 @@ class Reveal {
326
332
  }
327
333
  },
328
334
  tab_backward: function() {
335
+ _this.focusableElements = Foundation.Keyboard.findFocusable(_this.$element);
329
336
  if (_this.$element.find(':focus').is(_this.focusableElements.eq(0)) || _this.$element.is(':focus')) { // left modal upwards, setting focus to last element
330
337
  _this.focusableElements.eq(-1).focus();
331
338
  return true;
@@ -292,7 +292,7 @@ class Slider {
292
292
  } else {
293
293
  barXY = eventFromBar;
294
294
  }
295
- offsetPct = percent(barXY, barDim);
295
+ var offsetPct = percent(barXY, barDim);
296
296
 
297
297
  value = (this.options.end - this.options.start) * offsetPct + this.options.start;
298
298
 
@@ -47,6 +47,10 @@ class Sticky {
47
47
  this.scrollCount = this.options.checkEvery;
48
48
  this.isStuck = false;
49
49
  $(window).one('load.zf.sticky', function(){
50
+ //We calculate the container height to have correct values for anchor points offset calculation.
51
+ _this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height;
52
+ _this.$container.css('height', _this.containerHeight);
53
+ _this.elemHeight = _this.containerHeight;
50
54
  if(_this.options.anchor !== ''){
51
55
  _this.$anchor = $('#' + _this.options.anchor);
52
56
  }else{
@@ -263,7 +267,9 @@ class Sticky {
263
267
  */
264
268
  _setSizes(cb) {
265
269
  this.canStick = Foundation.MediaQuery.atLeast(this.options.stickyOn);
266
- if (!this.canStick) { cb(); }
270
+ if (!this.canStick) {
271
+ if (cb && typeof cb === 'function') { cb(); }
272
+ }
267
273
  var _this = this,
268
274
  newElemWidth = this.$container[0].getBoundingClientRect().width,
269
275
  comp = window.getComputedStyle(this.$container[0]),
@@ -289,12 +295,17 @@ class Sticky {
289
295
  });
290
296
  this.elemHeight = newContainerHeight;
291
297
 
292
- if (this.isStuck) {
293
- this.$element.css({"left":this.$container.offset().left + parseInt(comp['padding-left'], 10)});
294
- }
298
+ if (this.isStuck) {
299
+ this.$element.css({"left":this.$container.offset().left + parseInt(comp['padding-left'], 10)});
300
+ } else {
301
+ if (this.$element.hasClass('is-at-bottom')) {
302
+ var anchorPt = (this.points ? this.points[1] - this.$container.offset().top : this.anchorHeight) - this.elemHeight;
303
+ this.$element.css('top', anchorPt);
304
+ }
305
+ }
295
306
 
296
307
  this._setBreakPoints(newContainerHeight, function() {
297
- if (cb) { cb(); }
308
+ if (cb && typeof cb === 'function') { cb(); }
298
309
  });
299
310
  }
300
311
 
@@ -306,7 +317,7 @@ class Sticky {
306
317
  */
307
318
  _setBreakPoints(elemHeight, cb) {
308
319
  if (!this.canStick) {
309
- if (cb) { cb(); }
320
+ if (cb && typeof cb === 'function') { cb(); }
310
321
  else { return false; }
311
322
  }
312
323
  var mTop = emCalc(this.options.marginTop),
@@ -330,7 +341,7 @@ class Sticky {
330
341
  this.topPoint = topPoint;
331
342
  this.bottomPoint = bottomPoint;
332
343
 
333
- if (cb) { cb(); }
344
+ if (cb && typeof cb === 'function') { cb(); }
334
345
  }
335
346
 
336
347
  /**
@@ -6,6 +6,7 @@
6
6
  * Tooltip module.
7
7
  * @module foundation.tooltip
8
8
  * @requires foundation.util.box
9
+ * @requires foundation.util.mediaQuery
9
10
  * @requires foundation.util.triggers
10
11
  */
11
12
 
@@ -49,7 +50,7 @@ class Tooltip {
49
50
  'data-yeti-box': elemId,
50
51
  'data-toggle': elemId,
51
52
  'data-resize': elemId
52
- }).addClass(this.triggerClass);
53
+ }).addClass(this.options.triggerClass);
53
54
 
54
55
  //helper variables to track movement on collisions
55
56
  this.usedPositions = [];
@@ -174,7 +174,7 @@ function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) {
174
174
  break;
175
175
  case 'left bottom':
176
176
  return {
177
- left: $anchorDims.offset.left - ($eleDims.width + hOffset),
177
+ left: $anchorDims.offset.left,
178
178
  top: $anchorDims.offset.top + $anchorDims.height
179
179
  };
180
180
  break;
@@ -186,7 +186,7 @@ function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) {
186
186
  break;
187
187
  default:
188
188
  return {
189
- left: (Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left),
189
+ left: (Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left + hOffset),
190
190
  top: $anchorDims.offset.top + $anchorDims.height + vOffset
191
191
  }
192
192
  }
@@ -142,7 +142,7 @@ window.matchMedia || (window.matchMedia = function() {
142
142
  style.type = 'text/css';
143
143
  style.id = 'matchmediajs-test';
144
144
 
145
- script.parentNode.insertBefore(style, script);
145
+ script && script.parentNode && script.parentNode.insertBefore(style, script);
146
146
 
147
147
  // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
148
148
  info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
@@ -50,7 +50,7 @@ const Nest = {
50
50
  hasSubClass = `is-${type}-submenu-parent`;
51
51
 
52
52
  menu
53
- .find('*')
53
+ .find('>li, .menu, .menu > li')
54
54
  .removeClass(`${subMenuClass} ${subItemClass} ${hasSubClass} is-submenu-item submenu is-active`)
55
55
  .removeAttr('data-submenu').css('display', '');
56
56
 
@@ -29,7 +29,7 @@ function Timer(elem, options, cb) {
29
29
  if(options.infinite){
30
30
  _this.restart();//rerun the timer.
31
31
  }
32
- cb();
32
+ if (cb && typeof cb === 'function') { cb(); }
33
33
  }, remain);
34
34
  elem.trigger(`timerstart.zf.${nameSpace}`);
35
35
  }
@@ -63,7 +63,7 @@ $(document).on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', functi
63
63
  * @function
64
64
  * @private
65
65
  */
66
- $(window).load(() => {
66
+ $(window).on('load', () => {
67
67
  checkListeners();
68
68
  });
69
69
 
@@ -51,6 +51,14 @@ $button-sizes: (
51
51
  /// @type List
52
52
  $button-opacity-disabled: 0.25 !default;
53
53
 
54
+ /// Background color lightness on hover for buttons.
55
+ /// @type Number
56
+ $button-background-hover-lightness: -20% !default;
57
+
58
+ /// Color lightness on hover for hollow buttons.
59
+ /// @type Number
60
+ $button-hollow-hover-lightness: -50% !default;
61
+
54
62
  // Internal: flip from margin-right to margin-left for defaults
55
63
  @if $global-text-direction == 'rtl' {
56
64
  $button-margin: 0 0 $global-margin $global-margin !default;
@@ -96,14 +104,15 @@ $button-opacity-disabled: 0.25 !default;
96
104
  @mixin button-style(
97
105
  $background: $button-background,
98
106
  $background-hover: $button-background-hover,
99
- $color: $button-color
107
+ $color: $button-color,
108
+ $background-hover-lightness: $button-background-hover-lightness
100
109
  ) {
101
110
  @if $color == auto {
102
111
  $color: foreground($background, $button-color-alt, $button-color);
103
112
  }
104
113
 
105
114
  @if $background-hover == auto {
106
- $background-hover: scale-color($background, $lightness: -20%);
115
+ $background-hover: scale-color($background, $lightness: $background-hover-lightness);
107
116
  }
108
117
 
109
118
  background-color: $background;
@@ -123,8 +132,11 @@ $button-opacity-disabled: 0.25 !default;
123
132
  }
124
133
  }
125
134
 
126
- @mixin button-hollow-style($color: $primary-color) {
127
- $color-hover: scale-color($color, $lightness: -50%);
135
+ @mixin button-hollow-style(
136
+ $color: $primary-color,
137
+ $hover-lightness: $button-hollow-hover-lightness
138
+ ) {
139
+ $color-hover: scale-color($color, $lightness: $hover-lightness);
128
140
 
129
141
  border: 1px solid $color;
130
142
  color: $color;
@@ -136,12 +148,12 @@ $button-opacity-disabled: 0.25 !default;
136
148
  }
137
149
 
138
150
  /// Adds disabled styles to a button by fading the element, reseting the cursor, and disabling pointer events.
139
- @mixin button-disabled {
151
+ @mixin button-disabled($color: $primary-color) {
140
152
  opacity: $button-opacity-disabled;
141
153
  cursor: not-allowed;
142
154
 
143
155
  &:hover, &:focus {
144
- background-color: $button-background;
156
+ background-color: $color;
145
157
  color: $button-color;
146
158
  }
147
159
  }
@@ -242,6 +254,12 @@ $button-opacity-disabled: 0.25 !default;
242
254
  &.disabled,
243
255
  &[disabled] {
244
256
  @include button-disabled;
257
+
258
+ @each $name, $color in $foundation-palette {
259
+ &.#{$name} {
260
+ @include button-disabled($color);
261
+ }
262
+ }
245
263
  }
246
264
 
247
265
  // Dropdown arrow