foundation-rails 6.3.1.0 → 6.4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/bower.json +3 -3
  3. data/lib/foundation/rails/version.rb +1 -1
  4. data/lib/generators/foundation/install_generator.rb +1 -1
  5. data/lib/generators/foundation/templates/_settings.scss +291 -48
  6. data/vendor/assets/js/entries/foundation-plugins.js +25 -0
  7. data/vendor/assets/js/entries/foundation.js +101 -0
  8. data/vendor/assets/js/entries/plugins/foundation.abide.js +4 -0
  9. data/vendor/assets/js/entries/plugins/foundation.accordion.js +4 -0
  10. data/vendor/assets/js/entries/plugins/foundation.accordionMenu.js +5 -0
  11. data/vendor/assets/js/entries/plugins/foundation.core.js +21 -0
  12. data/vendor/assets/js/entries/plugins/foundation.drilldown.js +4 -0
  13. data/vendor/assets/js/entries/plugins/foundation.dropdown.js +5 -0
  14. data/vendor/assets/js/entries/plugins/foundation.dropdownMenu.js +4 -0
  15. data/vendor/assets/js/entries/plugins/foundation.equalizer.js +4 -0
  16. data/vendor/assets/js/entries/plugins/foundation.interchange.js +4 -0
  17. data/vendor/assets/js/entries/plugins/foundation.magellan.js +4 -0
  18. data/vendor/assets/js/entries/plugins/foundation.offcanvas.js +4 -0
  19. data/vendor/assets/js/entries/plugins/foundation.orbit.js +5 -0
  20. data/vendor/assets/js/entries/plugins/foundation.responsiveAccordionTabs.js +5 -0
  21. data/vendor/assets/js/entries/plugins/foundation.responsiveMenu.js +5 -0
  22. data/vendor/assets/js/entries/plugins/foundation.responsiveToggle.js +5 -0
  23. data/vendor/assets/js/entries/plugins/foundation.reveal.js +4 -0
  24. data/vendor/assets/js/entries/plugins/foundation.slider.js +5 -0
  25. data/vendor/assets/js/entries/plugins/foundation.smoothScroll.js +5 -0
  26. data/vendor/assets/js/entries/plugins/foundation.sticky.js +5 -0
  27. data/vendor/assets/js/entries/plugins/foundation.tabs.js +5 -0
  28. data/vendor/assets/js/entries/plugins/foundation.toggler.js +5 -0
  29. data/vendor/assets/js/entries/plugins/foundation.tooltip.js +4 -0
  30. data/vendor/assets/js/entries/plugins/foundation.util.box.js +4 -0
  31. data/vendor/assets/js/entries/plugins/foundation.util.imageLoader.js +5 -0
  32. data/vendor/assets/js/entries/plugins/foundation.util.keyboard.js +4 -0
  33. data/vendor/assets/js/entries/plugins/foundation.util.mediaQuery.js +4 -0
  34. data/vendor/assets/js/entries/plugins/foundation.util.motion.js +5 -0
  35. data/vendor/assets/js/entries/plugins/foundation.util.nest.js +5 -0
  36. data/vendor/assets/js/entries/plugins/foundation.util.timer.js +5 -0
  37. data/vendor/assets/js/entries/plugins/foundation.util.touch.js +7 -0
  38. data/vendor/assets/js/entries/plugins/foundation.util.triggers.js +5 -0
  39. data/vendor/assets/js/foundation.abide.js.es6 +18 -15
  40. data/vendor/assets/js/foundation.accordion.js.es6 +37 -23
  41. data/vendor/assets/js/foundation.accordionMenu.js.es6 +96 -51
  42. data/vendor/assets/js/foundation.core.js.es6 +46 -87
  43. data/vendor/assets/js/foundation.drilldown.js.es6 +47 -29
  44. data/vendor/assets/js/foundation.dropdown.js.es6 +84 -122
  45. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +44 -28
  46. data/vendor/assets/js/foundation.equalizer.js.es6 +18 -17
  47. data/vendor/assets/js/foundation.interchange.js.es6 +26 -19
  48. data/vendor/assets/js/foundation.js.es6 +8 -3
  49. data/vendor/assets/js/foundation.magellan.js.es6 +36 -30
  50. data/vendor/assets/js/foundation.offcanvas.js.es6 +148 -36
  51. data/vendor/assets/js/foundation.orbit.js.es6 +26 -18
  52. data/vendor/assets/js/foundation.plugin.js.es6 +54 -0
  53. data/vendor/assets/js/foundation.positionable.js.es6 +206 -0
  54. data/vendor/assets/js/{foundation.zf.responsiveAccordionTabs.js.es6 → foundation.responsiveAccordionTabs.js.es6} +33 -30
  55. data/vendor/assets/js/foundation.responsiveMenu.js.es6 +37 -29
  56. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +17 -16
  57. data/vendor/assets/js/foundation.reveal.js.es6 +61 -79
  58. data/vendor/assets/js/foundation.slider.js.es6 +33 -18
  59. data/vendor/assets/js/foundation.smoothScroll.js.es6 +135 -0
  60. data/vendor/assets/js/foundation.sticky.js.es6 +25 -17
  61. data/vendor/assets/js/foundation.tabs.js.es6 +35 -27
  62. data/vendor/assets/js/foundation.toggler.js.es6 +15 -13
  63. data/vendor/assets/js/foundation.tooltip.js.es6 +100 -108
  64. data/vendor/assets/js/foundation.util.box.js.es6 +114 -78
  65. data/vendor/assets/js/foundation.util.core.js.es6 +52 -0
  66. data/vendor/assets/js/foundation.util.imageLoader.js.es6 +45 -0
  67. data/vendor/assets/js/foundation.util.keyboard.js.es6 +41 -31
  68. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +59 -55
  69. data/vendor/assets/js/foundation.util.motion.js.es6 +4 -5
  70. data/vendor/assets/js/foundation.util.nest.js.es6 +9 -23
  71. data/vendor/assets/js/{foundation.util.timerAndImageLoader.js.es6 → foundation.util.timer.js.es6} +2 -42
  72. data/vendor/assets/js/foundation.util.touch.js.es6 +91 -294
  73. data/vendor/assets/js/foundation.util.triggers.js.es6 +199 -141
  74. data/vendor/assets/scss/_global.scss +29 -1
  75. data/vendor/assets/scss/components/_accordion-menu.scss +148 -13
  76. data/vendor/assets/scss/components/_accordion.scss +5 -0
  77. data/vendor/assets/scss/components/_breadcrumbs.scss +26 -9
  78. data/vendor/assets/scss/components/_button-group.scss +4 -4
  79. data/vendor/assets/scss/components/_button.scss +59 -12
  80. data/vendor/assets/scss/components/_card.scss +10 -2
  81. data/vendor/assets/scss/components/_drilldown.scss +90 -41
  82. data/vendor/assets/scss/components/_dropdown-menu.scss +52 -6
  83. data/vendor/assets/scss/components/_dropdown.scss +8 -1
  84. data/vendor/assets/scss/components/_flex.scss +85 -2
  85. data/vendor/assets/scss/components/_menu.scss +267 -162
  86. data/vendor/assets/scss/components/_off-canvas.scss +159 -45
  87. data/vendor/assets/scss/components/_pagination.scss +1 -1
  88. data/vendor/assets/scss/components/_reveal.scss +13 -11
  89. data/vendor/assets/scss/components/_slider.scss +0 -1
  90. data/vendor/assets/scss/components/_sticky.scss +1 -0
  91. data/vendor/assets/scss/components/_table.scss +7 -6
  92. data/vendor/assets/scss/components/_tabs.scss +1 -1
  93. data/vendor/assets/scss/components/_title-bar.scss +1 -1
  94. data/vendor/assets/scss/components/_tooltip.scss +74 -21
  95. data/vendor/assets/scss/components/_top-bar.scss +2 -0
  96. data/vendor/assets/scss/forms/_fieldset.scss +0 -1
  97. data/vendor/assets/scss/forms/_meter.scss +7 -1
  98. data/vendor/assets/scss/forms/_select.scss +4 -3
  99. data/vendor/assets/scss/forms/_text.scss +11 -2
  100. data/vendor/assets/scss/foundation.scss +17 -3
  101. data/vendor/assets/scss/grid/_flex-grid.scss +3 -52
  102. data/vendor/assets/scss/prototype/_arrow.scss +36 -0
  103. data/vendor/assets/scss/prototype/_border-box.scss +35 -0
  104. data/vendor/assets/scss/prototype/_border-none.scss +35 -0
  105. data/vendor/assets/scss/prototype/_bordered.scss +54 -0
  106. data/vendor/assets/scss/prototype/_box.scss +23 -0
  107. data/vendor/assets/scss/prototype/_display.scss +50 -0
  108. data/vendor/assets/scss/prototype/_font-styling.scss +95 -0
  109. data/vendor/assets/scss/prototype/_list-style-type.scss +95 -0
  110. data/vendor/assets/scss/prototype/_overflow.scss +72 -0
  111. data/vendor/assets/scss/prototype/_position.scss +114 -0
  112. data/vendor/assets/scss/prototype/_prototype.scss +91 -0
  113. data/vendor/assets/scss/prototype/_relation.scss +157 -0
  114. data/vendor/assets/scss/prototype/_rotate.scss +31 -0
  115. data/vendor/assets/scss/prototype/_rounded.scss +54 -0
  116. data/vendor/assets/scss/prototype/_separator.scss +96 -0
  117. data/vendor/assets/scss/prototype/_shadow.scss +43 -0
  118. data/vendor/assets/scss/prototype/_sizing.scss +73 -0
  119. data/vendor/assets/scss/prototype/_spacing.scss +204 -0
  120. data/vendor/assets/scss/prototype/_text-decoration.scss +48 -0
  121. data/vendor/assets/scss/prototype/_text-transformation.scss +48 -0
  122. data/vendor/assets/scss/prototype/_text-utilities.scss +88 -0
  123. data/vendor/assets/scss/prototype/_typescale.scss +20 -0
  124. data/vendor/assets/scss/settings/_settings.scss +291 -48
  125. data/vendor/assets/scss/typography/_base.scss +2 -2
  126. data/vendor/assets/scss/typography/_helpers.scss +6 -4
  127. data/vendor/assets/scss/util/_breakpoint.scss +60 -1
  128. data/vendor/assets/scss/util/_color.scss +8 -5
  129. data/vendor/assets/scss/util/_mixins.scss +45 -5
  130. data/vendor/assets/scss/xy-grid/_cell.scss +179 -0
  131. data/vendor/assets/scss/xy-grid/_classes.scss +455 -0
  132. data/vendor/assets/scss/xy-grid/_collapse.scss +54 -0
  133. data/vendor/assets/scss/xy-grid/_frame.scss +54 -0
  134. data/vendor/assets/scss/xy-grid/_grid.scss +56 -0
  135. data/vendor/assets/scss/xy-grid/_gutters.scss +45 -0
  136. data/vendor/assets/scss/xy-grid/_layout.scss +33 -0
  137. data/vendor/assets/scss/xy-grid/_position.scss +28 -0
  138. data/vendor/assets/scss/xy-grid/_xy-grid.scss +52 -0
  139. metadata +73 -4
@@ -1,7 +1,15 @@
1
1
  'use strict';
2
2
 
3
- !function($) {
3
+ import $ from 'jquery';
4
+ import { Keyboard } from './foundation.util.keyboard';
5
+ import { Move } from './foundation.util.motion';
6
+ import { GetYoDigits, rtl as Rtl } from './foundation.util.core';
4
7
 
8
+ import { Plugin } from './foundation.plugin';
9
+
10
+ import { Touch } from './foundation.util.touch';
11
+
12
+ import { Triggers } from './foundation.util.triggers';
5
13
  /**
6
14
  * Slider module.
7
15
  * @module foundation.slider
@@ -11,21 +19,26 @@
11
19
  * @requires foundation.util.touch
12
20
  */
13
21
 
14
- class Slider {
22
+ class Slider extends Plugin {
15
23
  /**
16
24
  * Creates a new instance of a slider control.
17
25
  * @class
26
+ * @name Slider
18
27
  * @param {jQuery} element - jQuery object to make into a slider control.
19
28
  * @param {Object} options - Overrides to the default plugin settings.
20
29
  */
21
- constructor(element, options) {
30
+ _setup(element, options) {
22
31
  this.$element = element;
23
32
  this.options = $.extend({}, Slider.defaults, this.$element.data(), options);
33
+ this.className = 'Slider'; // ie9 back compat
34
+
35
+ // Touch and Triggers inits are idempotent, we just need to make sure it's initialied.
36
+ Touch.init($);
37
+ Triggers.init($);
24
38
 
25
39
  this._init();
26
40
 
27
- Foundation.registerPlugin(this, 'Slider');
28
- Foundation.Keyboard.register('Slider', {
41
+ Keyboard.register('Slider', {
29
42
  'ltr': {
30
43
  'ARROW_RIGHT': 'increase',
31
44
  'ARROW_UP': 'increase',
@@ -34,7 +47,9 @@ class Slider {
34
47
  'SHIFT_ARROW_RIGHT': 'increase_fast',
35
48
  'SHIFT_ARROW_UP': 'increase_fast',
36
49
  'SHIFT_ARROW_DOWN': 'decrease_fast',
37
- 'SHIFT_ARROW_LEFT': 'decrease_fast'
50
+ 'SHIFT_ARROW_LEFT': 'decrease_fast',
51
+ 'HOME': 'min',
52
+ 'END': 'max'
38
53
  },
39
54
  'rtl': {
40
55
  'ARROW_LEFT': 'increase',
@@ -258,7 +273,7 @@ class Slider {
258
273
  //because we don't know exactly how the handle will be moved, check the amount of time it should take to move.
259
274
  var moveTime = this.$element.data('dragging') ? 1000/60 : this.options.moveTime;
260
275
 
261
- Foundation.Move(moveTime, $hndl, function() {
276
+ Move(moveTime, $hndl, function() {
262
277
  // adjusting the left/top property of the handle, based on the percentage calculated above
263
278
  // if movement isNaN, that is because the slider is hidden and we cannot determine handle width,
264
279
  // fall back to next best guess.
@@ -297,7 +312,7 @@ class Slider {
297
312
  */
298
313
  _setInitAttr(idx) {
299
314
  var initVal = (idx === 0 ? this.options.initialStart : this.options.initialEnd)
300
- var id = this.inputs.eq(idx).attr('id') || Foundation.GetYoDigits(6, 'slider');
315
+ var id = this.inputs.eq(idx).attr('id') || GetYoDigits(6, 'slider');
301
316
  this.inputs.eq(idx).attr({
302
317
  'id': id,
303
318
  'max': this.options.end,
@@ -373,7 +388,7 @@ class Slider {
373
388
  value = this._value(offsetPct);
374
389
 
375
390
  // turn everything around for RTL, yay math!
376
- if (Foundation.rtl() && !this.options.vertical) {value = this.options.end - value;}
391
+ if (Rtl() && !this.options.vertical) {value = this.options.end - value;}
377
392
 
378
393
  value = _this._adjustValue(null, value);
379
394
  //boolean flag for the setHandlePos fn, specifically for vertical sliders
@@ -504,7 +519,7 @@ class Slider {
504
519
  newValue;
505
520
 
506
521
  // handle keyboard event with keyboard util
507
- Foundation.Keyboard.handleKey(e, 'Slider', {
522
+ Keyboard.handleKey(e, 'Slider', {
508
523
  decrease: function() {
509
524
  newValue = oldValue - _this.options.step;
510
525
  },
@@ -517,6 +532,12 @@ class Slider {
517
532
  increase_fast: function() {
518
533
  newValue = oldValue + _this.options.step * 10;
519
534
  },
535
+ min: function() {
536
+ newValue = _this.options.start;
537
+ },
538
+ max: function() {
539
+ newValue = _this.options.end;
540
+ },
520
541
  handled: function() { // only set handle pos when event was handled specially
521
542
  e.preventDefault();
522
543
  _this._setHandlePos(_$handle, newValue, true);
@@ -532,14 +553,12 @@ class Slider {
532
553
  /**
533
554
  * Destroys the slider plugin.
534
555
  */
535
- destroy() {
556
+ _destroy() {
536
557
  this.handles.off('.zf.slider');
537
558
  this.inputs.off('.zf.slider');
538
559
  this.$element.off('.zf.slider');
539
560
 
540
561
  clearTimeout(this.timeout);
541
-
542
- Foundation.unregisterPlugin(this);
543
562
  }
544
563
  }
545
564
 
@@ -690,8 +709,4 @@ function baseLog(base, value) {
690
709
  return Math.log(value)/Math.log(base)
691
710
  }
692
711
 
693
- // Window exports
694
- Foundation.plugin(Slider, 'Slider');
695
-
696
- }(jQuery);
697
-
712
+ export {Slider};
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ import $ from 'jquery';
4
+ import { GetYoDigits } from './foundation.util.core';
5
+ import { Plugin } from './foundation.plugin';
6
+
7
+ /**
8
+ * SmoothScroll module.
9
+ * @module foundation.smooth-scroll
10
+ */
11
+ class SmoothScroll extends Plugin {
12
+ /**
13
+ * Creates a new instance of SmoothScroll.
14
+ * @class
15
+ * @name SmoothScroll
16
+ * @fires SmoothScroll#init
17
+ * @param {Object} element - jQuery object to add the trigger to.
18
+ * @param {Object} options - Overrides to the default plugin settings.
19
+ */
20
+ _setup(element, options) {
21
+ this.$element = element;
22
+ this.options = $.extend({}, SmoothScroll.defaults, this.$element.data(), options);
23
+ this.className = 'SmoothScroll'; // ie9 back compat
24
+
25
+ this._init();
26
+ }
27
+
28
+ /**
29
+ * Initialize the SmoothScroll plugin
30
+ * @private
31
+ */
32
+ _init() {
33
+ var id = this.$element[0].id || GetYoDigits(6, 'smooth-scroll');
34
+ var _this = this;
35
+ this.$element.attr({
36
+ 'id': id
37
+ });
38
+
39
+ this._events();
40
+ }
41
+
42
+ /**
43
+ * Initializes events for SmoothScroll.
44
+ * @private
45
+ */
46
+ _events() {
47
+ var _this = this;
48
+
49
+ // click handler function.
50
+ var handleLinkClick = function(e) {
51
+ // exit function if the event source isn't coming from an anchor with href attribute starts with '#'
52
+ if(!$(this).is('a[href^="#"]')) {
53
+ return false;
54
+ }
55
+
56
+ var arrival = this.getAttribute('href');
57
+
58
+ _this._inTransition = true;
59
+
60
+ SmoothScroll.scrollToLoc(arrival, _this.options, function() {
61
+ _this._inTransition = false;
62
+ });
63
+
64
+ e.preventDefault();
65
+ };
66
+
67
+ this.$element.on('click.zf.smoothScroll', handleLinkClick)
68
+ this.$element.on('click.zf.smoothScroll', 'a[href^="#"]', handleLinkClick);
69
+ }
70
+
71
+ /**
72
+ * Function to scroll to a given location on the page.
73
+ * @param {String} loc - A properly formatted jQuery id selector. Example: '#foo'
74
+ * @param {Object} options - The options to use.
75
+ * @param {Function} callback - The callback function.
76
+ * @static
77
+ * @function
78
+ */
79
+ static scrollToLoc(loc, options = SmoothScroll.defaults, callback) {
80
+ // Do nothing if target does not exist to prevent errors
81
+ if (!$(loc).length) {
82
+ return false;
83
+ }
84
+
85
+ var scrollPos = Math.round($(loc).offset().top - options.threshold / 2 - options.offset);
86
+
87
+ $('html, body').stop(true).animate(
88
+ { scrollTop: scrollPos },
89
+ options.animationDuration,
90
+ options.animationEasing,
91
+ function() {
92
+ if(callback && typeof callback == "function"){
93
+ callback();
94
+ }
95
+ }
96
+ );
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Default settings for plugin.
102
+ */
103
+ SmoothScroll.defaults = {
104
+ /**
105
+ * Amount of time, in ms, the animated scrolling should take between locations.
106
+ * @option
107
+ * @type {number}
108
+ * @default 500
109
+ */
110
+ animationDuration: 500,
111
+ /**
112
+ * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`.
113
+ * @option
114
+ * @type {string}
115
+ * @default 'linear'
116
+ * @see {@link https://api.jquery.com/animate|Jquery animate}
117
+ */
118
+ animationEasing: 'linear',
119
+ /**
120
+ * Number of pixels to use as a marker for location changes.
121
+ * @option
122
+ * @type {number}
123
+ * @default 50
124
+ */
125
+ threshold: 50,
126
+ /**
127
+ * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.
128
+ * @option
129
+ * @type {number}
130
+ * @default 0
131
+ */
132
+ offset: 0
133
+ }
134
+
135
+ export {SmoothScroll}
@@ -1,6 +1,10 @@
1
1
  'use strict';
2
2
 
3
- !function($) {
3
+ import $ from 'jquery';
4
+ import { GetYoDigits } from './foundation.util.core';
5
+ import { MediaQuery } from './foundation.util.mediaQuery';
6
+ import { Plugin } from './foundation.plugin';
7
+ import { Triggers } from './foundation.util.triggers';
4
8
 
5
9
  /**
6
10
  * Sticky module.
@@ -9,20 +13,23 @@
9
13
  * @requires foundation.util.mediaQuery
10
14
  */
11
15
 
12
- class Sticky {
16
+ class Sticky extends Plugin {
13
17
  /**
14
18
  * Creates a new instance of a sticky thing.
15
19
  * @class
20
+ * @name Sticky
16
21
  * @param {jQuery} element - jQuery object to make sticky.
17
22
  * @param {Object} options - options object passed when creating the element programmatically.
18
23
  */
19
- constructor(element, options) {
24
+ _setup(element, options) {
20
25
  this.$element = element;
21
26
  this.options = $.extend({}, Sticky.defaults, this.$element.data(), options);
27
+ this.className = 'Sticky'; // ie9 back compat
22
28
 
23
- this._init();
29
+ // Triggers init is idempotent, just need to make sure it is initialized
30
+ Triggers.init($);
24
31
 
25
- Foundation.registerPlugin(this, 'Sticky');
32
+ this._init();
26
33
  }
27
34
 
28
35
  /**
@@ -31,14 +38,19 @@ class Sticky {
31
38
  * @private
32
39
  */
33
40
  _init() {
41
+ MediaQuery._init();
42
+
34
43
  var $parent = this.$element.parent('[data-sticky-container]'),
35
- id = this.$element[0].id || Foundation.GetYoDigits(6, 'sticky'),
44
+ id = this.$element[0].id || GetYoDigits(6, 'sticky'),
36
45
  _this = this;
37
46
 
38
- if (!$parent.length) {
47
+ if($parent.length){
48
+ this.$container = $parent;
49
+ } else {
39
50
  this.wasWrapped = true;
51
+ this.$element.wrap(this.options.container);
52
+ this.$container = this.$element.parent();
40
53
  }
41
- this.$container = $parent.length ? $parent : $(this.options.container).wrapInner(this.$element);
42
54
  this.$container.addClass(this.options.containerClass);
43
55
 
44
56
  this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id, 'data-mutate': id });
@@ -105,7 +117,7 @@ class Sticky {
105
117
  /**
106
118
  * Adds event handlers for the scrolling element.
107
119
  * @private
108
- * @param {String} id - psuedo-random id for unique scroll event listener.
120
+ * @param {String} id - pseudo-random id for unique scroll event listener.
109
121
  */
110
122
  _events(id) {
111
123
  var _this = this,
@@ -146,7 +158,7 @@ class Sticky {
146
158
  /**
147
159
  * Handler for events.
148
160
  * @private
149
- * @param {String} id - psuedo-random id for unique scroll event listener.
161
+ * @param {String} id - pseudo-random id for unique scroll event listener.
150
162
  */
151
163
  _eventsHandler(id) {
152
164
  var _this = this,
@@ -293,7 +305,7 @@ class Sticky {
293
305
  * @private
294
306
  */
295
307
  _setSizes(cb) {
296
- this.canStick = Foundation.MediaQuery.is(this.options.stickyOn);
308
+ this.canStick = MediaQuery.is(this.options.stickyOn);
297
309
  if (!this.canStick) {
298
310
  if (cb && typeof cb === 'function') { cb(); }
299
311
  }
@@ -376,7 +388,7 @@ class Sticky {
376
388
  * Removes event listeners, JS-added css properties and classes, and unwraps the $element if the JS added the $container.
377
389
  * @function
378
390
  */
379
- destroy() {
391
+ _destroy() {
380
392
  this._removeSticky(true);
381
393
 
382
394
  this.$element.removeClass(`${this.options.stickyClass} is-anchored is-at-top`)
@@ -401,7 +413,6 @@ class Sticky {
401
413
  height: ''
402
414
  });
403
415
  }
404
- Foundation.unregisterPlugin(this);
405
416
  }
406
417
  }
407
418
 
@@ -493,7 +504,4 @@ function emCalc(em) {
493
504
  return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em;
494
505
  }
495
506
 
496
- // Window exports
497
- Foundation.plugin(Sticky, 'Sticky');
498
-
499
- }(jQuery);
507
+ export {Sticky};
@@ -1,29 +1,32 @@
1
1
  'use strict';
2
2
 
3
- !function($) {
4
-
3
+ import $ from 'jquery';
4
+ import { Keyboard } from './foundation.util.keyboard';
5
+ import { onImagesLoaded } from './foundation.util.imageLoader';
6
+ import { Plugin } from './foundation.plugin';
5
7
  /**
6
8
  * Tabs module.
7
9
  * @module foundation.tabs
8
10
  * @requires foundation.util.keyboard
9
- * @requires foundation.util.timerAndImageLoader if tabs contain images
11
+ * @requires foundation.util.imageLoader if tabs contain images
10
12
  */
11
13
 
12
- class Tabs {
14
+ class Tabs extends Plugin {
13
15
  /**
14
16
  * Creates a new instance of tabs.
15
17
  * @class
18
+ * @name Tabs
16
19
  * @fires Tabs#init
17
20
  * @param {jQuery} element - jQuery object to make into tabs.
18
21
  * @param {Object} options - Overrides to the default plugin settings.
19
22
  */
20
- constructor(element, options) {
23
+ _setup(element, options) {
21
24
  this.$element = element;
22
25
  this.options = $.extend({}, Tabs.defaults, this.$element.data(), options);
26
+ this.className = 'Tabs'; // ie9 back compat
23
27
 
24
28
  this._init();
25
- Foundation.registerPlugin(this, 'Tabs');
26
- Foundation.Keyboard.register('Tabs', {
29
+ Keyboard.register('Tabs', {
27
30
  'ENTER': 'open',
28
31
  'SPACE': 'open',
29
32
  'ARROW_RIGHT': 'next',
@@ -50,7 +53,7 @@ class Tabs {
50
53
  var $elem = $(this),
51
54
  $link = $elem.find('a'),
52
55
  isActive = $elem.hasClass(`${_this.options.linkActiveClass}`),
53
- hash = $link[0].hash.slice(1),
56
+ hash = $link.attr('data-tabs-target') || $link[0].hash.slice(1),
54
57
  linkId = $link[0].id ? $link[0].id : `${hash}-label`,
55
58
  $tabContent = $(`#${hash}`);
56
59
 
@@ -60,15 +63,19 @@ class Tabs {
60
63
  'role': 'tab',
61
64
  'aria-controls': hash,
62
65
  'aria-selected': isActive,
63
- 'id': linkId
66
+ 'id': linkId,
67
+ 'tabindex': isActive ? '0' : '-1'
64
68
  });
65
69
 
66
70
  $tabContent.attr({
67
71
  'role': 'tabpanel',
68
- 'aria-hidden': !isActive,
69
72
  'aria-labelledby': linkId
70
73
  });
71
74
 
75
+ if(!isActive) {
76
+ $tabContent.attr('aria-hidden', 'true');
77
+ }
78
+
72
79
  if(isActive && _this.options.autoFocus){
73
80
  $(window).load(function() {
74
81
  $('html, body').animate({ scrollTop: $elem.offset().top }, _this.options.deepLinkSmudgeDelay, () => {
@@ -81,7 +88,7 @@ class Tabs {
81
88
  var $images = this.$tabContent.find('img');
82
89
 
83
90
  if ($images.length) {
84
- Foundation.onImagesLoaded($images, this._setHeight.bind(this));
91
+ onImagesLoaded($images, this._setHeight.bind(this));
85
92
  } else {
86
93
  this._setHeight();
87
94
  }
@@ -185,7 +192,7 @@ class Tabs {
185
192
  });
186
193
 
187
194
  // handle keyboard event with keyboard util
188
- Foundation.Keyboard.handleKey(e, 'Tabs', {
195
+ Keyboard.handleKey(e, 'Tabs', {
189
196
  open: function() {
190
197
  $element.find('[role="tab"]').focus();
191
198
  _this._handleTabChange($element);
@@ -234,8 +241,8 @@ class Tabs {
234
241
  var $oldTab = this.$element.
235
242
  find(`.${this.options.linkClass}.${this.options.linkActiveClass}`),
236
243
  $tabLink = $target.find('[role="tab"]'),
237
- hash = $tabLink[0].hash,
238
- $targetContent = this.$tabContent.find(hash);
244
+ hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1),
245
+ $targetContent = this.$tabContent.find(`#${hash}`);
239
246
 
240
247
  //close old tab
241
248
  this._collapseTab($oldTab);
@@ -271,16 +278,18 @@ class Tabs {
271
278
  */
272
279
  _openTab($target) {
273
280
  var $tabLink = $target.find('[role="tab"]'),
274
- hash = $tabLink[0].hash,
275
- $targetContent = this.$tabContent.find(hash);
281
+ hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1),
282
+ $targetContent = this.$tabContent.find(`#${hash}`);
276
283
 
277
284
  $target.addClass(`${this.options.linkActiveClass}`);
278
285
 
279
- $tabLink.attr({'aria-selected': 'true'});
286
+ $tabLink.attr({
287
+ 'aria-selected': 'true',
288
+ 'tabindex': '0'
289
+ });
280
290
 
281
291
  $targetContent
282
- .addClass(`${this.options.panelActiveClass}`)
283
- .attr({'aria-hidden': 'false'});
292
+ .addClass(`${this.options.panelActiveClass}`).removeAttr('aria-hidden');
284
293
  }
285
294
 
286
295
  /**
@@ -292,11 +301,14 @@ class Tabs {
292
301
  var $target_anchor = $target
293
302
  .removeClass(`${this.options.linkActiveClass}`)
294
303
  .find('[role="tab"]')
295
- .attr({ 'aria-selected': 'false' });
304
+ .attr({
305
+ 'aria-selected': 'false',
306
+ 'tabindex': -1
307
+ });
296
308
 
297
309
  $(`#${$target_anchor.attr('aria-controls')}`)
298
310
  .removeClass(`${this.options.panelActiveClass}`)
299
- .attr({ 'aria-hidden': 'true' });
311
+ .attr({ 'aria-hidden': 'true' })
300
312
  }
301
313
 
302
314
  /**
@@ -364,7 +376,7 @@ class Tabs {
364
376
  * Destroys an instance of an tabs.
365
377
  * @fires Tabs#destroyed
366
378
  */
367
- destroy() {
379
+ _destroy() {
368
380
  this.$element
369
381
  .find(`.${this.options.linkClass}`)
370
382
  .off('.zf.tabs').hide().end()
@@ -381,7 +393,6 @@ class Tabs {
381
393
  $(window).off('popstate', this._checkDeepLink);
382
394
  }
383
395
 
384
- Foundation.unregisterPlugin(this);
385
396
  }
386
397
  }
387
398
 
@@ -484,7 +495,4 @@ Tabs.defaults = {
484
495
  panelActiveClass: 'is-active'
485
496
  };
486
497
 
487
- // Window exports
488
- Foundation.plugin(Tabs, 'Tabs');
489
-
490
- }(jQuery);
498
+ export {Tabs};