foundation-rails 6.3.0.0 → 6.3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +1 -1
  4. data/LICENSE.txt +1 -1
  5. data/Rakefile +1 -1
  6. data/bower.json +2 -2
  7. data/lib/foundation/rails/version.rb +1 -1
  8. data/lib/generators/foundation/templates/_settings.scss +0 -1
  9. data/vendor/assets/js/foundation.abide.js.es6 +26 -13
  10. data/vendor/assets/js/foundation.accordion.js.es6 +94 -5
  11. data/vendor/assets/js/foundation.accordionMenu.js.es6 +4 -2
  12. data/vendor/assets/js/foundation.core.js.es6 +1 -1
  13. data/vendor/assets/js/foundation.drilldown.js.es6 +44 -21
  14. data/vendor/assets/js/foundation.dropdown.js.es6 +26 -12
  15. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +24 -13
  16. data/vendor/assets/js/foundation.equalizer.js.es6 +6 -3
  17. data/vendor/assets/js/foundation.interchange.js.es6 +5 -1
  18. data/vendor/assets/js/foundation.magellan.js.es6 +14 -7
  19. data/vendor/assets/js/foundation.offcanvas.js.es6 +70 -15
  20. data/vendor/assets/js/foundation.orbit.js.es6 +36 -18
  21. data/vendor/assets/js/foundation.responsiveMenu.js.es6 +0 -3
  22. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +12 -16
  23. data/vendor/assets/js/foundation.reveal.js.es6 +39 -19
  24. data/vendor/assets/js/foundation.slider.js.es6 +37 -19
  25. data/vendor/assets/js/foundation.sticky.js.es6 +61 -25
  26. data/vendor/assets/js/foundation.tabs.js.es6 +74 -46
  27. data/vendor/assets/js/foundation.toggler.js.es6 +2 -1
  28. data/vendor/assets/js/foundation.tooltip.js.es6 +30 -15
  29. data/vendor/assets/js/foundation.util.timerAndImageLoader.js.es6 +1 -1
  30. data/vendor/assets/js/foundation.util.triggers.js.es6 +0 -47
  31. data/vendor/assets/scss/_global.scss +6 -0
  32. data/vendor/assets/scss/components/_accordion.scss +1 -1
  33. data/vendor/assets/scss/components/_breadcrumbs.scss +5 -2
  34. data/vendor/assets/scss/components/_button-group.scss +18 -8
  35. data/vendor/assets/scss/components/_button.scss +46 -8
  36. data/vendor/assets/scss/components/_card.scss +1 -1
  37. data/vendor/assets/scss/components/_flex.scss +6 -0
  38. data/vendor/assets/scss/components/_menu.scss +30 -3
  39. data/vendor/assets/scss/components/_responsive-embed.scss +6 -2
  40. data/vendor/assets/scss/components/_reveal.scss +2 -2
  41. data/vendor/assets/scss/foundation.scss +3 -3
  42. data/vendor/assets/scss/grid/_classes.scss +6 -2
  43. data/vendor/assets/scss/grid/_column.scss +1 -1
  44. data/vendor/assets/scss/grid/_flex-grid.scss +22 -2
  45. data/vendor/assets/scss/grid/_grid.scss +4 -0
  46. data/vendor/assets/scss/settings/_settings.scss +0 -1
  47. data/vendor/assets/scss/typography/_base.scss +1 -1
  48. data/vendor/assets/scss/typography/_print.scss +5 -0
  49. data/vendor/assets/scss/util/_direction.scss +31 -0
  50. data/vendor/assets/scss/util/_math.scss +1 -1
  51. data/vendor/assets/scss/util/_typography.scss +26 -0
  52. data/vendor/assets/scss/util/_util.scss +2 -0
  53. data/vendor/assets/scss/util/_value.scss +20 -0
  54. metadata +5 -3
@@ -260,7 +260,7 @@ class Dropdown {
260
260
  open() {
261
261
  // var _this = this;
262
262
  /**
263
- * Fires to close other open dropdowns
263
+ * Fires to close other open dropdowns, typically when dropdown is opening
264
264
  * @event Dropdown#closeme
265
265
  */
266
266
  this.$element.trigger('closeme.zf.dropdown', this.$element.attr('id'));
@@ -317,6 +317,10 @@ class Dropdown {
317
317
  this.counter = 4;
318
318
  this.usedPositions.length = 0;
319
319
  }
320
+ /**
321
+ * Fires once the dropdown is no longer visible.
322
+ * @event Dropdown#hide
323
+ */
320
324
  this.$element.trigger('hide.zf.dropdown', [this.$element]);
321
325
 
322
326
  if (this.options.trapFocus) {
@@ -351,63 +355,73 @@ class Dropdown {
351
355
 
352
356
  Dropdown.defaults = {
353
357
  /**
354
- * Class that designates bounding container of Dropdown (Default: window)
358
+ * Class that designates bounding container of Dropdown (default: window)
355
359
  * @option
356
- * @example 'dropdown-parent'
360
+ * @type {?string}
361
+ * @default null
357
362
  */
358
363
  parentClass: null,
359
364
  /**
360
365
  * Amount of time to delay opening a submenu on hover event.
361
366
  * @option
362
- * @example 250
367
+ * @type {number}
368
+ * @default 250
363
369
  */
364
370
  hoverDelay: 250,
365
371
  /**
366
372
  * Allow submenus to open on hover events
367
373
  * @option
368
- * @example false
374
+ * @type {boolean}
375
+ * @default false
369
376
  */
370
377
  hover: false,
371
378
  /**
372
379
  * Don't close dropdown when hovering over dropdown pane
373
380
  * @option
374
- * @example true
381
+ * @type {boolean}
382
+ * @default false
375
383
  */
376
384
  hoverPane: false,
377
385
  /**
378
386
  * Number of pixels between the dropdown pane and the triggering element on open.
379
387
  * @option
380
- * @example 1
388
+ * @type {number}
389
+ * @default 1
381
390
  */
382
391
  vOffset: 1,
383
392
  /**
384
393
  * Number of pixels between the dropdown pane and the triggering element on open.
385
394
  * @option
386
- * @example 1
395
+ * @type {number}
396
+ * @default 1
387
397
  */
388
398
  hOffset: 1,
389
399
  /**
390
400
  * Class applied to adjust open position. JS will test and fill this in.
391
401
  * @option
392
- * @example 'top'
402
+ * @type {string}
403
+ * @default ''
393
404
  */
394
405
  positionClass: '',
395
406
  /**
396
407
  * Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands.
397
408
  * @option
398
- * @example false
409
+ * @type {boolean}
410
+ * @default false
399
411
  */
400
412
  trapFocus: false,
401
413
  /**
402
414
  * Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening.
403
415
  * @option
404
- * @example true
416
+ * @type {boolean}
417
+ * @default false
405
418
  */
406
419
  autoFocus: false,
407
420
  /**
408
421
  * Allows a click on the body to close the dropdown.
409
422
  * @option
410
- * @example false
423
+ * @type {boolean}
424
+ * @default false
411
425
  */
412
426
  closeOnClick: false
413
427
  }
@@ -104,7 +104,7 @@ class DropdownMenu {
104
104
 
105
105
  // Handle Leaf element Clicks
106
106
  if(_this.options.closeOnClickInside){
107
- this.$menuItems.on('click.zf.dropdownmenu touchend.zf.dropdownmenu', function(e) {
107
+ this.$menuItems.on('click.zf.dropdownmenu', function(e) {
108
108
  var $elem = $(this),
109
109
  hasSub = $elem.hasClass(parClass);
110
110
  if(!hasSub){
@@ -359,68 +359,79 @@ DropdownMenu.defaults = {
359
359
  /**
360
360
  * Disallows hover events from opening submenus
361
361
  * @option
362
- * @example false
362
+ * @type {boolean}
363
+ * @default false
363
364
  */
364
365
  disableHover: false,
365
366
  /**
366
367
  * Allow a submenu to automatically close on a mouseleave event, if not clicked open.
367
368
  * @option
368
- * @example true
369
+ * @type {boolean}
370
+ * @default true
369
371
  */
370
372
  autoclose: true,
371
373
  /**
372
374
  * Amount of time to delay opening a submenu on hover event.
373
375
  * @option
374
- * @example 50
376
+ * @type {number}
377
+ * @default 50
375
378
  */
376
379
  hoverDelay: 50,
377
380
  /**
378
381
  * Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu.
379
382
  * @option
380
- * @example true
383
+ * @type {boolean}
384
+ * @default false
381
385
  */
382
386
  clickOpen: false,
383
387
  /**
384
388
  * Amount of time to delay closing a submenu on a mouseleave event.
385
389
  * @option
386
- * @example 500
390
+ * @type {number}
391
+ * @default 500
387
392
  */
388
393
 
389
394
  closingTime: 500,
390
395
  /**
391
- * Position of the menu relative to what direction the submenus should open. Handled by JS.
396
+ * Position of the menu relative to what direction the submenus should open. Handled by JS. Can be `'left'` or `'right'`.
392
397
  * @option
393
- * @example 'left'
398
+ * @type {string}
399
+ * @default 'left'
394
400
  */
395
401
  alignment: 'left',
396
402
  /**
397
403
  * Allow clicks on the body to close any open submenus.
398
404
  * @option
399
- * @example true
405
+ * @type {boolean}
406
+ * @default true
400
407
  */
401
408
  closeOnClick: true,
402
409
  /**
403
410
  * Allow clicks on leaf anchor links to close any open submenus.
404
411
  * @option
405
- * @example true
412
+ * @type {boolean}
413
+ * @default true
406
414
  */
407
415
  closeOnClickInside: true,
408
416
  /**
409
417
  * Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class.
410
418
  * @option
411
- * @example 'vertical'
419
+ * @type {string}
420
+ * @default 'vertical'
412
421
  */
413
422
  verticalClass: 'vertical',
414
423
  /**
415
424
  * Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class.
416
425
  * @option
417
- * @example 'align-right'
426
+ * @type {string}
427
+ * @default 'align-right'
418
428
  */
419
429
  rightClass: 'align-right',
420
430
  /**
421
431
  * Boolean to force overide the clicking of links to perform default action, on second touch event for mobile.
422
432
  * @option
423
- * @example false
433
+ * @type {boolean}
434
+ * @default true
424
435
  */
425
436
  forceFollow: true
426
437
  };
@@ -291,19 +291,22 @@ Equalizer.defaults = {
291
291
  /**
292
292
  * Enable height equalization when stacked on smaller screens.
293
293
  * @option
294
- * @example true
294
+ * @type {boolean}
295
+ * @default false
295
296
  */
296
297
  equalizeOnStack: false,
297
298
  /**
298
299
  * Enable height equalization row by row.
299
300
  * @option
300
- * @example false
301
+ * @type {boolean}
302
+ * @default false
301
303
  */
302
304
  equalizeByRow: false,
303
305
  /**
304
306
  * String representing the minimum breakpoint size the plugin should equalize heights on.
305
307
  * @option
306
- * @example 'medium'
308
+ * @type {string}
309
+ * @default ''
307
310
  */
308
311
  equalizeOn: ''
309
312
  };
@@ -103,8 +103,10 @@ class Interchange {
103
103
  rules = this.options.rules;
104
104
  }
105
105
  else {
106
- rules = this.$element.data('interchange').match(/\[.*?\]/g);
106
+ rules = this.$element.data('interchange');
107
107
  }
108
+
109
+ rules = typeof rules === 'string' ? rules.match(/\[.*?\]/g) : rules;
108
110
 
109
111
  for (var i in rules) {
110
112
  if(rules.hasOwnProperty(i)) {
@@ -183,6 +185,8 @@ Interchange.defaults = {
183
185
  /**
184
186
  * Rules to be applied to Interchange elements. Set with the `data-interchange` array notation.
185
187
  * @option
188
+ * @type {?array}
189
+ * @default null
186
190
  */
187
191
  rules: null
188
192
  };
@@ -203,37 +203,44 @@ Magellan.defaults = {
203
203
  /**
204
204
  * Amount of time, in ms, the animated scrolling should take between locations.
205
205
  * @option
206
- * @example 500
206
+ * @type {number}
207
+ * @default 500
207
208
  */
208
209
  animationDuration: 500,
209
210
  /**
210
- * Animation style to use when scrolling between locations.
211
+ * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`.
211
212
  * @option
212
- * @example 'ease-in-out'
213
+ * @type {string}
214
+ * @default 'linear'
215
+ * @see {@link https://api.jquery.com/animate|Jquery animate}
213
216
  */
214
217
  animationEasing: 'linear',
215
218
  /**
216
219
  * Number of pixels to use as a marker for location changes.
217
220
  * @option
218
- * @example 50
221
+ * @type {number}
222
+ * @default 50
219
223
  */
220
224
  threshold: 50,
221
225
  /**
222
226
  * Class applied to the active locations link on the magellan container.
223
227
  * @option
224
- * @example 'active'
228
+ * @type {string}
229
+ * @default 'active'
225
230
  */
226
231
  activeClass: 'active',
227
232
  /**
228
233
  * Allows the script to manipulate the url of the current page, and if supported, alter the history.
229
234
  * @option
230
- * @example true
235
+ * @type {boolean}
236
+ * @default false
231
237
  */
232
238
  deepLinking: false,
233
239
  /**
234
240
  * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.
235
241
  * @option
236
- * @example 25
242
+ * @type {number}
243
+ * @default 0
237
244
  */
238
245
  barOffset: 0
239
246
  }
@@ -5,6 +5,7 @@
5
5
  /**
6
6
  * OffCanvas module.
7
7
  * @module foundation.offcanvas
8
+ * @requires foundation.util.keyboard
8
9
  * @requires foundation.util.mediaQuery
9
10
  * @requires foundation.util.triggers
10
11
  * @requires foundation.util.motion
@@ -131,7 +132,7 @@ class OffCanvas {
131
132
  } else {
132
133
  this.isRevealed = false;
133
134
  this.$element.attr('aria-hidden', 'true');
134
- this.$element.on({
135
+ this.$element.off('open.zf.trigger toggle.zf.trigger').on({
135
136
  'open.zf.trigger': this.open.bind(this),
136
137
  'toggle.zf.trigger': this.toggle.bind(this)
137
138
  });
@@ -146,7 +147,41 @@ class OffCanvas {
146
147
  * @private
147
148
  */
148
149
  _stopScrolling(event) {
149
- return false;
150
+ return false;
151
+ }
152
+
153
+ // Taken and adapted from http://stackoverflow.com/questions/16889447/prevent-full-page-scrolling-ios
154
+ // Only really works for y, not sure how to extend to x or if we need to.
155
+ _recordScrollable(event) {
156
+ let elem = this; // called from event handler context with this as elem
157
+
158
+ // If the element is scrollable (content overflows), then...
159
+ if (elem.scrollHeight !== elem.clientHeight) {
160
+ // If we're at the top, scroll down one pixel to allow scrolling up
161
+ if (elem.scrollTop === 0) {
162
+ elem.scrollTop = 1;
163
+ }
164
+ // If we're at the bottom, scroll up one pixel to allow scrolling down
165
+ if (elem.scrollTop === elem.scrollHeight - elem.clientHeight) {
166
+ elem.scrollTop = elem.scrollHeight - elem.clientHeight - 1;
167
+ }
168
+ }
169
+ elem.allowUp = elem.scrollTop > 0;
170
+ elem.allowDown = elem.scrollTop < (elem.scrollHeight - elem.clientHeight);
171
+ elem.lastY = event.originalEvent.pageY;
172
+ }
173
+
174
+ _stopScrollPropagation(event) {
175
+ let elem = this; // called from event handler context with this as elem
176
+ let up = event.pageY < elem.lastY;
177
+ let down = !up;
178
+ elem.lastY = event.pageY;
179
+
180
+ if((up && elem.allowUp) || (down && elem.allowDown)) {
181
+ event.stopPropagation();
182
+ } else {
183
+ event.preventDefault();
184
+ }
150
185
  }
151
186
 
152
187
  /**
@@ -183,6 +218,8 @@ class OffCanvas {
183
218
  // If `contentScroll` is set to false, add class and disable scrolling on touch devices.
184
219
  if (this.options.contentScroll === false) {
185
220
  $('body').addClass('is-off-canvas-open').on('touchmove', this._stopScrolling);
221
+ this.$element.on('touchstart', this._recordScrollable);
222
+ this.$element.on('touchmove', this._stopScrollPropagation);
186
223
  }
187
224
 
188
225
  if (this.options.contentOverlay === true) {
@@ -195,7 +232,12 @@ class OffCanvas {
195
232
 
196
233
  if (this.options.autoFocus === true) {
197
234
  this.$element.one(Foundation.transitionend(this.$element), function() {
198
- _this.$element.find('a, button').eq(0).focus();
235
+ var canvasFocus = _this.$element.find('[data-autofocus]');
236
+ if (canvasFocus.length) {
237
+ canvasFocus.eq(0).focus();
238
+ } else {
239
+ _this.$element.find('a, button').eq(0).focus();
240
+ }
199
241
  });
200
242
  }
201
243
 
@@ -228,6 +270,8 @@ class OffCanvas {
228
270
  // If `contentScroll` is set to false, remove class and re-enable scrolling on touch devices.
229
271
  if (this.options.contentScroll === false) {
230
272
  $('body').removeClass('is-off-canvas-open').off('touchmove', this._stopScrolling);
273
+ this.$element.off('touchstart', this._recordScrollable);
274
+ this.$element.off('touchmove', this._stopScrollPropagation);
231
275
  }
232
276
 
233
277
  if (this.options.contentOverlay === true) {
@@ -297,78 +341,89 @@ OffCanvas.defaults = {
297
341
  /**
298
342
  * Allow the user to click outside of the menu to close it.
299
343
  * @option
300
- * @example true
344
+ * @type {boolean}
345
+ * @default true
301
346
  */
302
347
  closeOnClick: true,
303
348
 
304
349
  /**
305
350
  * Adds an overlay on top of `[data-off-canvas-content]`.
306
351
  * @option
307
- * @example true
352
+ * @type {boolean}
353
+ * @default true
308
354
  */
309
355
  contentOverlay: true,
310
356
 
311
357
  /**
312
358
  * Enable/disable scrolling of the main content when an off canvas panel is open.
313
359
  * @option
314
- * @example true
360
+ * @type {boolean}
361
+ * @default true
315
362
  */
316
363
  contentScroll: true,
317
364
 
318
365
  /**
319
366
  * Amount of time in ms the open and close transition requires. If none selected, pulls from body style.
320
367
  * @option
321
- * @example 500
368
+ * @type {number}
369
+ * @default 0
322
370
  */
323
371
  transitionTime: 0,
324
372
 
325
373
  /**
326
374
  * Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'.
327
375
  * @option
328
- * @example push
376
+ * @type {string}
377
+ * @default push
329
378
  */
330
379
  transition: 'push',
331
380
 
332
381
  /**
333
382
  * Force the page to scroll to top or bottom on open.
334
383
  * @option
335
- * @example top
384
+ * @type {?string}
385
+ * @default null
336
386
  */
337
387
  forceTo: null,
338
388
 
339
389
  /**
340
390
  * Allow the offcanvas to remain open for certain breakpoints.
341
391
  * @option
342
- * @example false
392
+ * @type {boolean}
393
+ * @default false
343
394
  */
344
395
  isRevealed: false,
345
396
 
346
397
  /**
347
398
  * Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option.
348
399
  * @option
349
- * @example reveal-for-large
400
+ * @type {?string}
401
+ * @default null
350
402
  */
351
403
  revealOn: null,
352
404
 
353
405
  /**
354
406
  * Force focus to the offcanvas on open. If true, will focus the opening trigger on close.
355
407
  * @option
356
- * @example true
408
+ * @type {boolean}
409
+ * @default true
357
410
  */
358
411
  autoFocus: true,
359
412
 
360
413
  /**
361
414
  * Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
362
415
  * @option
363
- * TODO improve the regex testing for this.
364
- * @example reveal-for-large
416
+ * @type {string}
417
+ * @default reveal-for-
418
+ * @todo improve the regex testing for this.
365
419
  */
366
420
  revealClass: 'reveal-for-',
367
421
 
368
422
  /**
369
423
  * Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
370
424
  * @option
371
- * @example true
425
+ * @type {boolean}
426
+ * @default false
372
427
  */
373
428
  trapFocus: false
374
429
  }