foundation-rails 6.3.0.0 → 6.3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -41,8 +41,10 @@ class Sticky {
41
41
  this.$container = $parent.length ? $parent : $(this.options.container).wrapInner(this.$element);
42
42
  this.$container.addClass(this.options.containerClass);
43
43
 
44
- this.$element.addClass(this.options.stickyClass)
45
- .attr({'data-resize': id});
44
+ this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id, 'data-mutate': id });
45
+ if (this.options.anchor !== '') {
46
+ $('#' + _this.options.anchor).attr({ 'data-mutate': id });
47
+ }
46
48
 
47
49
  this.scrollCount = this.options.checkEvery;
48
50
  this.isStuck = false;
@@ -127,17 +129,39 @@ class Sticky {
127
129
 
128
130
  this.$element.off('resizeme.zf.trigger')
129
131
  .on('resizeme.zf.trigger', function(e, el) {
130
- _this._setSizes(function() {
131
- _this._calc(false);
132
- if (_this.canStick) {
133
- if (!_this.isOn) {
134
- _this._events(id);
135
- }
136
- } else if (_this.isOn) {
137
- _this._pauseListeners(scrollListener);
138
- }
139
- });
132
+ _this._eventsHandler(id);
133
+ });
134
+
135
+ this.$element.on('mutateme.zf.trigger', function (e, el) {
136
+ _this._eventsHandler(id);
140
137
  });
138
+
139
+ if(this.$anchor) {
140
+ this.$anchor.on('mutateme.zf.trigger', function (e, el) {
141
+ _this._eventsHandler(id);
142
+ });
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Handler for events.
148
+ * @private
149
+ * @param {String} id - psuedo-random id for unique scroll event listener.
150
+ */
151
+ _eventsHandler(id) {
152
+ var _this = this,
153
+ scrollListener = this.scrollListener = `scroll.zf.${id}`;
154
+
155
+ _this._setSizes(function() {
156
+ _this._calc(false);
157
+ if (_this.canStick) {
158
+ if (!_this.isOn) {
159
+ _this._events(id);
160
+ }
161
+ } else if (_this.isOn) {
162
+ _this._pauseListeners(scrollListener);
163
+ }
164
+ });
141
165
  }
142
166
 
143
167
  /**
@@ -362,7 +386,8 @@ class Sticky {
362
386
  bottom: '',
363
387
  'max-width': ''
364
388
  })
365
- .off('resizeme.zf.trigger');
389
+ .off('resizeme.zf.trigger')
390
+ .off('mutateme.zf.trigger');
366
391
  if (this.$anchor && this.$anchor.length) {
367
392
  this.$anchor.off('change.zf.sticky');
368
393
  }
@@ -384,67 +409,78 @@ Sticky.defaults = {
384
409
  /**
385
410
  * Customizable container template. Add your own classes for styling and sizing.
386
411
  * @option
387
- * @example '<div data-sticky-container class="small-6 columns"></div>'
412
+ * @type {string}
413
+ * @default '<div data-sticky-container></div>'
388
414
  */
389
415
  container: '<div data-sticky-container></div>',
390
416
  /**
391
- * Location in the view the element sticks to.
417
+ * Location in the view the element sticks to. Can be `'top'` or `'bottom'`.
392
418
  * @option
393
- * @example 'top'
419
+ * @type {string}
420
+ * @default 'top'
394
421
  */
395
422
  stickTo: 'top',
396
423
  /**
397
424
  * If anchored to a single element, the id of that element.
398
425
  * @option
399
- * @example 'exampleId'
426
+ * @type {string}
427
+ * @default ''
400
428
  */
401
429
  anchor: '',
402
430
  /**
403
431
  * If using more than one element as anchor points, the id of the top anchor.
404
432
  * @option
405
- * @example 'exampleId:top'
433
+ * @type {string}
434
+ * @default ''
406
435
  */
407
436
  topAnchor: '',
408
437
  /**
409
438
  * If using more than one element as anchor points, the id of the bottom anchor.
410
439
  * @option
411
- * @example 'exampleId:bottom'
440
+ * @type {string}
441
+ * @default ''
412
442
  */
413
443
  btmAnchor: '',
414
444
  /**
415
445
  * Margin, in `em`'s to apply to the top of the element when it becomes sticky.
416
446
  * @option
417
- * @example 1
447
+ * @type {number}
448
+ * @default 1
418
449
  */
419
450
  marginTop: 1,
420
451
  /**
421
452
  * Margin, in `em`'s to apply to the bottom of the element when it becomes sticky.
422
453
  * @option
423
- * @example 1
454
+ * @type {number}
455
+ * @default 1
424
456
  */
425
457
  marginBottom: 1,
426
458
  /**
427
459
  * Breakpoint string that is the minimum screen size an element should become sticky.
428
460
  * @option
429
- * @example 'medium'
461
+ * @type {string}
462
+ * @default 'medium'
430
463
  */
431
464
  stickyOn: 'medium',
432
465
  /**
433
466
  * Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`.
434
467
  * @option
435
- * @example 'sticky'
468
+ * @type {string}
469
+ * @default 'sticky'
436
470
  */
437
471
  stickyClass: 'sticky',
438
472
  /**
439
473
  * Class applied to sticky container. Foundation defaults to `sticky-container`.
440
474
  * @option
441
- * @example 'sticky-container'
475
+ * @type {string}
476
+ * @default 'sticky-container'
442
477
  */
443
478
  containerClass: 'sticky-container',
444
479
  /**
445
480
  * Number of scroll events between the plugin's recalculating sticky points. Setting it to `0` will cause it to recalc every scroll event, setting it to `-1` will prevent recalc on scroll.
446
481
  * @option
447
- * @example 50
482
+ * @type {number}
483
+ * @default -1
448
484
  */
449
485
  checkEvery: -1
450
486
  };
@@ -76,34 +76,7 @@ class Tabs {
76
76
  });
77
77
  });
78
78
  }
79
-
80
- //use browser to open a tab, if it exists in this tabset
81
- if (_this.options.deepLink) {
82
- var anchor = window.location.hash;
83
- //need a hash and a relevant anchor in this tabset
84
- if(anchor.length) {
85
- var $link = $elem.find('[href="'+anchor+'"]');
86
- if ($link.length) {
87
- _this.selectTab($(anchor));
88
-
89
- //roll up a little to show the titles
90
- if (_this.options.deepLinkSmudge) {
91
- $(window).load(function() {
92
- var offset = $elem.offset();
93
- $('html, body').animate({ scrollTop: offset.top }, _this.options.deepLinkSmudgeDelay);
94
- });
95
- }
96
-
97
- /**
98
- * Fires when the zplugin has deeplinked at pageload
99
- * @event Tabs#deeplink
100
- */
101
- $elem.trigger('deeplink.zf.tabs', [$link, $(anchor)]);
102
- }
103
- }
104
- }
105
79
  });
106
-
107
80
  if(this.options.matchHeight) {
108
81
  var $images = this.$tabContent.find('img');
109
82
 
@@ -114,6 +87,35 @@ class Tabs {
114
87
  }
115
88
  }
116
89
 
90
+ //current context-bound function to open tabs on page load or history popstate
91
+ this._checkDeepLink = () => {
92
+ var anchor = window.location.hash;
93
+ //need a hash and a relevant anchor in this tabset
94
+ if(anchor.length) {
95
+ var $link = this.$element.find('[href$="'+anchor+'"]');
96
+ if ($link.length) {
97
+ this.selectTab($(anchor), true);
98
+
99
+ //roll up a little to show the titles
100
+ if (this.options.deepLinkSmudge) {
101
+ var offset = this.$element.offset();
102
+ $('html, body').animate({ scrollTop: offset.top }, this.options.deepLinkSmudgeDelay);
103
+ }
104
+
105
+ /**
106
+ * Fires when the zplugin has deeplinked at pageload
107
+ * @event Tabs#deeplink
108
+ */
109
+ this.$element.trigger('deeplink.zf.tabs', [$link, $(anchor)]);
110
+ }
111
+ }
112
+ }
113
+
114
+ //use browser to open a tab, if it exists in this tabset
115
+ if (this.options.deepLink) {
116
+ this._checkDeepLink();
117
+ }
118
+
117
119
  this._events();
118
120
  }
119
121
 
@@ -131,6 +133,10 @@ class Tabs {
131
133
 
132
134
  $(window).on('changed.zf.mediaquery', this._setHeightMqHandler);
133
135
  }
136
+
137
+ if(this.options.deepLink) {
138
+ $(window).on('popstate', this._checkDeepLink);
139
+ }
134
140
  }
135
141
 
136
142
  /**
@@ -203,10 +209,11 @@ class Tabs {
203
209
  /**
204
210
  * Opens the tab `$targetContent` defined by `$target`. Collapses active tab.
205
211
  * @param {jQuery} $target - Tab to open.
212
+ * @param {boolean} historyHandled - browser has already handled a history update
206
213
  * @fires Tabs#change
207
214
  * @function
208
215
  */
209
- _handleTabChange($target) {
216
+ _handleTabChange($target, historyHandled) {
210
217
 
211
218
  /**
212
219
  * Check for active class on target. Collapse if exists.
@@ -237,7 +244,7 @@ class Tabs {
237
244
  this._openTab($target);
238
245
 
239
246
  //either replace or update browser history
240
- if (this.options.deepLink) {
247
+ if (this.options.deepLink && !historyHandled) {
241
248
  var anchor = $target.find('a').attr('href');
242
249
 
243
250
  if (this.options.updateHistory) {
@@ -295,9 +302,10 @@ class Tabs {
295
302
  /**
296
303
  * Public method for selecting a content pane to display.
297
304
  * @param {jQuery | String} elem - jQuery object or string of the id of the pane to display.
305
+ * @param {boolean} historyHandled - browser has already handled a history update
298
306
  * @function
299
307
  */
300
- selectTab(elem) {
308
+ selectTab(elem, historyHandled) {
301
309
  var idStr;
302
310
 
303
311
  if (typeof elem === 'object') {
@@ -310,25 +318,29 @@ class Tabs {
310
318
  idStr = `#${idStr}`;
311
319
  }
312
320
 
313
- var $target = this.$tabTitles.find(`[href="${idStr}"]`).parent(`.${this.options.linkClass}`);
321
+ var $target = this.$tabTitles.find(`[href$="${idStr}"]`).parent(`.${this.options.linkClass}`);
314
322
 
315
- this._handleTabChange($target);
323
+ this._handleTabChange($target, historyHandled);
316
324
  };
317
325
  /**
318
326
  * Sets the height of each panel to the height of the tallest panel.
319
327
  * If enabled in options, gets called on media query change.
320
328
  * If loading content via external source, can be called directly or with _reflow.
329
+ * If enabled with `data-match-height="true"`, tabs sets to equal height
321
330
  * @function
322
331
  * @private
323
332
  */
324
333
  _setHeight() {
325
- var max = 0;
334
+ var max = 0,
335
+ _this = this; // Lock down the `this` value for the root tabs object
336
+
326
337
  this.$tabContent
327
338
  .find(`.${this.options.panelClass}`)
328
339
  .css('height', '')
329
340
  .each(function() {
341
+
330
342
  var panel = $(this),
331
- isActive = panel.hasClass(`${this.options.panelActiveClass}`);
343
+ isActive = panel.hasClass(`${_this.options.panelActiveClass}`); // get the options from the parent instead of trying to get them from the child
332
344
 
333
345
  if (!isActive) {
334
346
  panel.css({'visibility': 'hidden', 'display': 'block'});
@@ -365,6 +377,10 @@ class Tabs {
365
377
  }
366
378
  }
367
379
 
380
+ if (this.options.deepLink) {
381
+ $(window).off('popstate', this._checkDeepLink);
382
+ }
383
+
368
384
  Foundation.unregisterPlugin(this);
369
385
  }
370
386
  }
@@ -373,28 +389,32 @@ Tabs.defaults = {
373
389
  /**
374
390
  * Allows the window to scroll to content of pane specified by hash anchor
375
391
  * @option
376
- * @example false
392
+ * @type {boolean}
393
+ * @default false
377
394
  */
378
395
  deepLink: false,
379
396
 
380
397
  /**
381
398
  * Adjust the deep link scroll to make sure the top of the tab panel is visible
382
399
  * @option
383
- * @example false
400
+ * @type {boolean}
401
+ * @default false
384
402
  */
385
403
  deepLinkSmudge: false,
386
404
 
387
405
  /**
388
406
  * Animation time (ms) for the deep link adjustment
389
407
  * @option
390
- * @example 300
408
+ * @type {number}
409
+ * @default 300
391
410
  */
392
411
  deepLinkSmudgeDelay: 300,
393
412
 
394
413
  /**
395
414
  * Update the browser history with the open tab
396
415
  * @option
397
- * @example false
416
+ * @type {boolean}
417
+ * @default false
398
418
  */
399
419
  updateHistory: false,
400
420
 
@@ -402,56 +422,64 @@ Tabs.defaults = {
402
422
  * Allows the window to scroll to content of active pane on load if set to true.
403
423
  * Not recommended if more than one tab panel per page.
404
424
  * @option
405
- * @example false
425
+ * @type {boolean}
426
+ * @default false
406
427
  */
407
428
  autoFocus: false,
408
429
 
409
430
  /**
410
431
  * Allows keyboard input to 'wrap' around the tab links.
411
432
  * @option
412
- * @example true
433
+ * @type {boolean}
434
+ * @default true
413
435
  */
414
436
  wrapOnKeys: true,
415
437
 
416
438
  /**
417
439
  * Allows the tab content panes to match heights if set to true.
418
440
  * @option
419
- * @example false
441
+ * @type {boolean}
442
+ * @default false
420
443
  */
421
444
  matchHeight: false,
422
445
 
423
446
  /**
424
447
  * Allows active tabs to collapse when clicked.
425
448
  * @option
426
- * @example false
449
+ * @type {boolean}
450
+ * @default false
427
451
  */
428
452
  activeCollapse: false,
429
453
 
430
454
  /**
431
455
  * Class applied to `li`'s in tab link list.
432
456
  * @option
433
- * @example 'tabs-title'
457
+ * @type {string}
458
+ * @default 'tabs-title'
434
459
  */
435
460
  linkClass: 'tabs-title',
436
461
 
437
462
  /**
438
463
  * Class applied to the active `li` in tab link list.
439
464
  * @option
440
- * @example 'is-active'
465
+ * @type {string}
466
+ * @default 'is-active'
441
467
  */
442
468
  linkActiveClass: 'is-active',
443
469
 
444
470
  /**
445
471
  * Class applied to the content containers.
446
472
  * @option
447
- * @example 'tabs-panel'
473
+ * @type {string}
474
+ * @default 'tabs-panel'
448
475
  */
449
476
  panelClass: 'tabs-panel',
450
477
 
451
478
  /**
452
479
  * Class applied to the active content container.
453
480
  * @option
454
- * @example 'is-active'
481
+ * @type {string}
482
+ * @default 'is-active'
455
483
  */
456
484
  panelActiveClass: 'is-active'
457
485
  };
@@ -136,7 +136,8 @@ Toggler.defaults = {
136
136
  /**
137
137
  * Tells the plugin if the element should animated when toggled.
138
138
  * @option
139
- * @example false
139
+ * @type {boolean}
140
+ * @default false
140
141
  */
141
142
  animate: false
142
143
  };
@@ -354,93 +354,108 @@ Tooltip.defaults = {
354
354
  /**
355
355
  * Time, in ms, before a tooltip should open on hover.
356
356
  * @option
357
- * @example 200
357
+ * @type {number}
358
+ * @default 200
358
359
  */
359
360
  hoverDelay: 200,
360
361
  /**
361
362
  * Time, in ms, a tooltip should take to fade into view.
362
363
  * @option
363
- * @example 150
364
+ * @type {number}
365
+ * @default 150
364
366
  */
365
367
  fadeInDuration: 150,
366
368
  /**
367
369
  * Time, in ms, a tooltip should take to fade out of view.
368
370
  * @option
369
- * @example 150
371
+ * @type {number}
372
+ * @default 150
370
373
  */
371
374
  fadeOutDuration: 150,
372
375
  /**
373
376
  * Disables hover events from opening the tooltip if set to true
374
377
  * @option
375
- * @example false
378
+ * @type {boolean}
379
+ * @default false
376
380
  */
377
381
  disableHover: false,
378
382
  /**
379
383
  * Optional addtional classes to apply to the tooltip template on init.
380
384
  * @option
381
- * @example 'my-cool-tip-class'
385
+ * @type {string}
386
+ * @default ''
382
387
  */
383
388
  templateClasses: '',
384
389
  /**
385
390
  * Non-optional class added to tooltip templates. Foundation default is 'tooltip'.
386
391
  * @option
387
- * @example 'tooltip'
392
+ * @type {string}
393
+ * @default 'tooltip'
388
394
  */
389
395
  tooltipClass: 'tooltip',
390
396
  /**
391
397
  * Class applied to the tooltip anchor element.
392
398
  * @option
393
- * @example 'has-tip'
399
+ * @type {string}
400
+ * @default 'has-tip'
394
401
  */
395
402
  triggerClass: 'has-tip',
396
403
  /**
397
404
  * Minimum breakpoint size at which to open the tooltip.
398
405
  * @option
399
- * @example 'small'
406
+ * @type {string}
407
+ * @default 'small'
400
408
  */
401
409
  showOn: 'small',
402
410
  /**
403
411
  * Custom template to be used to generate markup for tooltip.
404
412
  * @option
405
- * @example '&lt;div class="tooltip"&gt;&lt;/div&gt;'
413
+ * @type {string}
414
+ * @default ''
406
415
  */
407
416
  template: '',
408
417
  /**
409
418
  * Text displayed in the tooltip template on open.
410
419
  * @option
411
- * @example 'Some cool space fact here.'
420
+ * @type {string}
421
+ * @default ''
412
422
  */
413
423
  tipText: '',
414
424
  touchCloseText: 'Tap to close.',
415
425
  /**
416
426
  * Allows the tooltip to remain open if triggered with a click or touch event.
417
427
  * @option
418
- * @example true
428
+ * @type {boolean}
429
+ * @default true
419
430
  */
420
431
  clickOpen: true,
421
432
  /**
422
433
  * Additional positioning classes, set by the JS
423
434
  * @option
424
- * @example 'top'
435
+ * @type {string}
436
+ * @default ''
425
437
  */
426
438
  positionClass: '',
427
439
  /**
428
440
  * Distance, in pixels, the template should push away from the anchor on the Y axis.
429
441
  * @option
430
- * @example 10
442
+ * @type {number}
443
+ * @default 10
431
444
  */
432
445
  vOffset: 10,
433
446
  /**
434
447
  * Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side.
435
448
  * @option
436
- * @example 12
449
+ * @type {number}
450
+ * @default 12
437
451
  */
438
452
  hOffset: 12,
439
453
  /**
440
454
  * Allow HTML in tooltip. Warning: If you are loading user-generated content into tooltips,
441
455
  * allowing HTML may open yourself up to XSS attacks.
442
456
  * @option
443
- * @example false
457
+ * @type {boolean}
458
+ * @default false
444
459
  */
445
460
  allowHtml: false
446
461
  };