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,31 +1,43 @@
1
1
  'use strict';
2
2
 
3
- !function($) {
3
+ import $ from 'jquery';
4
+ import { Keyboard } from './foundation.util.keyboard';
5
+ import { Motion } from './foundation.util.motion';
6
+ import { Timer } from './foundation.util.timer';
7
+ import { onImagesLoaded } from './foundation.util.imageLoader';
8
+ import { GetYoDigits } from './foundation.util.core';
9
+ import { Plugin } from './foundation.plugin';
10
+ import { Touch } from './foundation.util.touch'
11
+
4
12
 
5
13
  /**
6
14
  * Orbit module.
7
15
  * @module foundation.orbit
8
16
  * @requires foundation.util.keyboard
9
17
  * @requires foundation.util.motion
10
- * @requires foundation.util.timerAndImageLoader
18
+ * @requires foundation.util.timer
19
+ * @requires foundation.util.imageLoader
11
20
  * @requires foundation.util.touch
12
21
  */
13
22
 
14
- class Orbit {
23
+ class Orbit extends Plugin {
15
24
  /**
16
25
  * Creates a new instance of an orbit carousel.
17
26
  * @class
27
+ * @name Orbit
18
28
  * @param {jQuery} element - jQuery object to make into an Orbit Carousel.
19
29
  * @param {Object} options - Overrides to the default plugin settings.
20
30
  */
21
- constructor(element, options){
31
+ _setup(element, options){
22
32
  this.$element = element;
23
33
  this.options = $.extend({}, Orbit.defaults, this.$element.data(), options);
34
+ this.className = 'Orbit'; // ie9 back compat
35
+
36
+ Touch.init($); // Touch init is idempotent, we just need to make sure it's initialied.
24
37
 
25
38
  this._init();
26
39
 
27
- Foundation.registerPlugin(this, 'Orbit');
28
- Foundation.Keyboard.register('Orbit', {
40
+ Keyboard.register('Orbit', {
29
41
  'ltr': {
30
42
  'ARROW_RIGHT': 'next',
31
43
  'ARROW_LEFT': 'previous'
@@ -51,7 +63,7 @@ class Orbit {
51
63
 
52
64
  var $images = this.$element.find('img'),
53
65
  initActive = this.$slides.filter('.is-active'),
54
- id = this.$element[0].id || Foundation.GetYoDigits(6, 'orbit');
66
+ id = this.$element[0].id || GetYoDigits(6, 'orbit');
55
67
 
56
68
  this.$element.attr({
57
69
  'data-resize': id,
@@ -67,7 +79,7 @@ class Orbit {
67
79
  }
68
80
 
69
81
  if ($images.length) {
70
- Foundation.onImagesLoaded($images, this._prepareForOrbit.bind(this));
82
+ onImagesLoaded($images, this._prepareForOrbit.bind(this));
71
83
  } else {
72
84
  this._prepareForOrbit();//hehe
73
85
  }
@@ -102,7 +114,7 @@ class Orbit {
102
114
  */
103
115
  geoSync() {
104
116
  var _this = this;
105
- this.timer = new Foundation.Timer(
117
+ this.timer = new Timer(
106
118
  this.$element,
107
119
  {
108
120
  duration: this.options.timerDelay,
@@ -232,7 +244,7 @@ class Orbit {
232
244
  if (this.options.accessible) {
233
245
  this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e) {
234
246
  // handle keyboard event with keyboard util
235
- Foundation.Keyboard.handleKey(e, 'Orbit', {
247
+ Keyboard.handleKey(e, 'Orbit', {
236
248
  next: function() {
237
249
  _this.changeSlide(true);
238
250
  },
@@ -331,7 +343,7 @@ class Orbit {
331
343
  }
332
344
 
333
345
  if (this.options.useMUI && !this.$element.is(':hidden')) {
334
- Foundation.Motion.animateIn(
346
+ Motion.animateIn(
335
347
  $newSlide.addClass('is-active').css({'position': 'absolute', 'top': 0}),
336
348
  this.options[`animInFrom${dirIn}`],
337
349
  function(){
@@ -339,7 +351,7 @@ class Orbit {
339
351
  .attr('aria-live', 'polite');
340
352
  });
341
353
 
342
- Foundation.Motion.animateOut(
354
+ Motion.animateOut(
343
355
  $curSlide.removeClass('is-active'),
344
356
  this.options[`animOutTo${dirOut}`],
345
357
  function(){
@@ -381,9 +393,8 @@ class Orbit {
381
393
  * Destroys the carousel and hides the element.
382
394
  * @function
383
395
  */
384
- destroy() {
396
+ _destroy() {
385
397
  this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide();
386
- Foundation.unregisterPlugin(this);
387
398
  }
388
399
  }
389
400
 
@@ -517,7 +528,4 @@ Orbit.defaults = {
517
528
  useMUI: true
518
529
  };
519
530
 
520
- // Window exports
521
- Foundation.plugin(Orbit, 'Orbit');
522
-
523
- }(jQuery);
531
+ export {Orbit};
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ import $ from 'jquery';
4
+ import { GetYoDigits } from './foundation.util.core';
5
+
6
+ // Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST
7
+ // {function} _setup (replaces previous constructor),
8
+ // {function} _destroy (replaces previous destroy)
9
+ class Plugin {
10
+
11
+ constructor(element, options) {
12
+ this._setup(element, options);
13
+ var pluginName = getPluginName(this);
14
+ this.uuid = GetYoDigits(6, pluginName);
15
+
16
+ if(!this.$element.attr(`data-${pluginName}`)){ this.$element.attr(`data-${pluginName}`, this.uuid); }
17
+ if(!this.$element.data('zfPlugin')){ this.$element.data('zfPlugin', this); }
18
+ /**
19
+ * Fires when the plugin has initialized.
20
+ * @event Plugin#init
21
+ */
22
+ this.$element.trigger(`init.zf.${pluginName}`);
23
+ }
24
+
25
+ destroy() {
26
+ this._destroy();
27
+ var pluginName = getPluginName(this);
28
+ this.$element.removeAttr(`data-${pluginName}`).removeData('zfPlugin')
29
+ /**
30
+ * Fires when the plugin has been destroyed.
31
+ * @event Plugin#destroyed
32
+ */
33
+ .trigger(`destroyed.zf.${pluginName}`);
34
+ for(var prop in this){
35
+ this[prop] = null;//clean up script to prep for garbage collection.
36
+ }
37
+ }
38
+ }
39
+
40
+ // Convert PascalCase to kebab-case
41
+ // Thank you: http://stackoverflow.com/a/8955580
42
+ function hyphenate(str) {
43
+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
44
+ }
45
+
46
+ function getPluginName(obj) {
47
+ if(typeof(obj.constructor.name) !== 'undefined') {
48
+ return hyphenate(obj.constructor.name);
49
+ } else {
50
+ return hyphenate(obj.className);
51
+ }
52
+ }
53
+
54
+ export {Plugin};
@@ -0,0 +1,206 @@
1
+ 'use strict';
2
+
3
+ import { Box } from './foundation.util.box';
4
+ import { Plugin } from './foundation.plugin';
5
+ import { rtl as Rtl } from './foundation.util.core';
6
+
7
+ const POSITIONS = ['left', 'right', 'top', 'bottom'];
8
+ const VERTICAL_ALIGNMENTS = ['top', 'bottom', 'center'];
9
+ const HORIZONTAL_ALIGNMENTS = ['left', 'right', 'center'];
10
+
11
+ const ALIGNMENTS = {
12
+ 'left': VERTICAL_ALIGNMENTS,
13
+ 'right': VERTICAL_ALIGNMENTS,
14
+ 'top': HORIZONTAL_ALIGNMENTS,
15
+ 'bottom': HORIZONTAL_ALIGNMENTS
16
+ }
17
+
18
+ function nextItem(item, array) {
19
+ var currentIdx = array.indexOf(item);
20
+ if(currentIdx === array.length - 1) {
21
+ return array[0];
22
+ } else {
23
+ return array[currentIdx + 1];
24
+ }
25
+ }
26
+
27
+
28
+ class Positionable extends Plugin {
29
+ /**
30
+ * Abstract class encapsulating the tether-like explicit positioning logic
31
+ * including repositioning based on overlap.
32
+ * Expects classes to define defaults for vOffset, hOffset, position,
33
+ * alignment, allowOverlap, and allowBottomOverlap. They can do this by
34
+ * extending the defaults, or (for now recommended due to the way docs are
35
+ * generated) by explicitly declaring them.
36
+ *
37
+ **/
38
+
39
+ _init() {
40
+ this.triedPositions = {};
41
+ this.position = this.options.position === 'auto' ? this._getDefaultPosition() : this.options.position;
42
+ this.alignment = this.options.alignment === 'auto' ? this._getDefaultAlignment() : this.options.alignment;
43
+ }
44
+
45
+ _getDefaultPosition () {
46
+ return 'bottom';
47
+ }
48
+
49
+ _getDefaultAlignment() {
50
+ switch(this.position) {
51
+ case 'bottom':
52
+ case 'top':
53
+ return Rtl() ? 'right' : 'left';
54
+ case 'left':
55
+ case 'right':
56
+ return 'bottom';
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Adjusts the positionable possible positions by iterating through alignments
62
+ * and positions.
63
+ * @function
64
+ * @private
65
+ */
66
+ _reposition() {
67
+ if(this._alignmentsExhausted(this.position)) {
68
+ this.position = nextItem(this.position, POSITIONS);
69
+ this.alignment = ALIGNMENTS[this.position][0];
70
+ } else {
71
+ this._realign();
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Adjusts the dropdown pane possible positions by iterating through alignments
77
+ * on the current position.
78
+ * @function
79
+ * @private
80
+ */
81
+ _realign() {
82
+ this._addTriedPosition(this.position, this.alignment)
83
+ this.alignment = nextItem(this.alignment, ALIGNMENTS[this.position])
84
+ }
85
+
86
+ _addTriedPosition(position, alignment) {
87
+ this.triedPositions[position] = this.triedPositions[position] || []
88
+ this.triedPositions[position].push(alignment);
89
+ }
90
+
91
+ _positionsExhausted() {
92
+ var isExhausted = true;
93
+ for(var i = 0; i < POSITIONS.length; i++) {
94
+ isExhausted = isExhausted && this._alignmentsExhausted(POSITIONS[i]);
95
+ }
96
+ return isExhausted;
97
+ }
98
+
99
+ _alignmentsExhausted(position) {
100
+ return this.triedPositions[position] && this.triedPositions[position].length == ALIGNMENTS[position].length;
101
+ }
102
+
103
+
104
+ // When we're trying to center, we don't want to apply offset that's going to
105
+ // take us just off center, so wrap around to return 0 for the appropriate
106
+ // offset in those alignments. TODO: Figure out if we want to make this
107
+ // configurable behavior... it feels more intuitive, especially for tooltips, but
108
+ // it's possible someone might actually want to start from center and then nudge
109
+ // slightly off.
110
+ _getVOffset() {
111
+ return this.options.vOffset;
112
+ }
113
+
114
+ _getHOffset() {
115
+ return this.options.hOffset;
116
+ }
117
+
118
+
119
+ _setPosition($anchor, $element, $parent) {
120
+ if($anchor.attr('aria-expanded') === 'false'){ return false; }
121
+ var $eleDims = Box.GetDimensions($element),
122
+ $anchorDims = Box.GetDimensions($anchor);
123
+
124
+
125
+ $element.offset(Box.GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
126
+
127
+ if(!this.options.allowOverlap) {
128
+ var overlaps = {};
129
+ var minOverlap = 100000000;
130
+ // default coordinates to how we start, in case we can't figure out better
131
+ var minCoordinates = {position: this.position, alignment: this.alignment};
132
+ while(!this._positionsExhausted()) {
133
+ let overlap = Box.OverlapArea($element, $parent, false, false, this.options.allowBottomOverlap);
134
+ if(overlap === 0) {
135
+ return;
136
+ }
137
+
138
+ if(overlap < minOverlap) {
139
+ minOverlap = overlap;
140
+ minCoordinates = {position: this.position, alignment: this.alignment};
141
+ }
142
+
143
+ this._reposition();
144
+
145
+ $element.offset(Box.GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
146
+ }
147
+ // If we get through the entire loop, there was no non-overlapping
148
+ // position available. Pick the version with least overlap.
149
+ this.position = minCoordinates.position;
150
+ this.alignment = minCoordinates.alignment;
151
+ $element.offset(Box.GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
152
+ }
153
+ }
154
+
155
+ }
156
+
157
+ Positionable.defaults = {
158
+ /**
159
+ * Position of positionable relative to anchor. Can be left, right, bottom, top, or auto.
160
+ * @option
161
+ * @type {string}
162
+ * @default 'auto'
163
+ */
164
+ position: 'auto',
165
+ /**
166
+ * Alignment of positionable relative to anchor. Can be left, right, bottom, top, center, or auto.
167
+ * @option
168
+ * @type {string}
169
+ * @default 'auto'
170
+ */
171
+ alignment: 'auto',
172
+ /**
173
+ * Allow overlap of container/window. If false, dropdown positionable first
174
+ * try to position as defined by data-position and data-alignment, but
175
+ * reposition if it would cause an overflow.
176
+ * @option
177
+ * @type {boolean}
178
+ * @default false
179
+ */
180
+ allowOverlap: false,
181
+ /**
182
+ * Allow overlap of only the bottom of the container. This is the most common
183
+ * behavior for dropdowns, allowing the dropdown to extend the bottom of the
184
+ * screen but not otherwise influence or break out of the container.
185
+ * @option
186
+ * @type {boolean}
187
+ * @default true
188
+ */
189
+ allowBottomOverlap: true,
190
+ /**
191
+ * Number of pixels the positionable should be separated vertically from anchor
192
+ * @option
193
+ * @type {number}
194
+ * @default 0
195
+ */
196
+ vOffset: 0,
197
+ /**
198
+ * Number of pixels the positionable should be separated horizontally from anchor
199
+ * @option
200
+ * @type {number}
201
+ * @default 0
202
+ */
203
+ hOffset: 0,
204
+ }
205
+
206
+ export {Positionable};
@@ -1,39 +1,56 @@
1
1
  'use strict';
2
2
 
3
- !function($) {
3
+ import $ from 'jquery';
4
+ import { MediaQuery } from './foundation.util.mediaQuery';
5
+ import { GetYoDigits } from './foundation.util.core';
6
+ import { Plugin }from './foundation.plugin';
7
+
8
+ import { Accordion } from './foundation.accordion';
9
+ import { Tabs } from './foundation.tabs';
10
+
11
+ // The plugin matches the plugin classes with these plugin instances.
12
+ var MenuPlugins = {
13
+ tabs: {
14
+ cssClass: 'tabs',
15
+ plugin: Tabs
16
+ },
17
+ accordion: {
18
+ cssClass: 'accordion',
19
+ plugin: Accordion
20
+ }
21
+ };
22
+
4
23
 
5
24
  /**
6
25
  * ResponsiveAccordionTabs module.
7
26
  * @module foundation.responsiveAccordionTabs
8
- * @requires foundation.util.keyboard
9
- * @requires foundation.util.timerAndImageLoader
10
27
  * @requires foundation.util.motion
11
28
  * @requires foundation.accordion
12
29
  * @requires foundation.tabs
13
30
  */
14
31
 
15
- class ResponsiveAccordionTabs {
32
+ class ResponsiveAccordionTabs extends Plugin{
16
33
  /**
17
34
  * Creates a new instance of a responsive accordion tabs.
18
35
  * @class
36
+ * @name ResponsiveAccordionTabs
19
37
  * @fires ResponsiveAccordionTabs#init
20
- * @param {jQuery} element - jQuery object to make into a dropdown menu.
38
+ * @param {jQuery} element - jQuery object to make into Responsive Accordion Tabs.
21
39
  * @param {Object} options - Overrides to the default plugin settings.
22
40
  */
23
- constructor(element, options) {
41
+ _setup(element, options) {
24
42
  this.$element = $(element);
25
43
  this.options = $.extend({}, this.$element.data(), options);
26
44
  this.rules = this.$element.data('responsive-accordion-tabs');
27
45
  this.currentMq = null;
28
46
  this.currentPlugin = null;
47
+ this.className = 'ResponsiveAccordionTabs'; // ie9 back compat
29
48
  if (!this.$element.attr('id')) {
30
- this.$element.attr('id',Foundation.GetYoDigits(6, 'responsiveaccordiontabs'));
49
+ this.$element.attr('id',GetYoDigits(6, 'responsiveaccordiontabs'));
31
50
  };
32
51
 
33
52
  this._init();
34
53
  this._events();
35
-
36
- Foundation.registerPlugin(this, 'ResponsiveAccordionTabs');
37
54
  }
38
55
 
39
56
  /**
@@ -42,6 +59,8 @@ class ResponsiveAccordionTabs {
42
59
  * @private
43
60
  */
44
61
  _init() {
62
+ MediaQuery._init();
63
+
45
64
  // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules
46
65
  if (typeof this.rules === 'string') {
47
66
  let rulesTree = {};
@@ -116,7 +135,7 @@ class ResponsiveAccordionTabs {
116
135
  var matchedMq, _this = this;
117
136
  // Iterate through each rule and find the last matching rule
118
137
  $.each(this.rules, function(key) {
119
- if (Foundation.MediaQuery.atLeast(key)) {
138
+ if (MediaQuery.atLeast(key)) {
120
139
  matchedMq = key;
121
140
  }
122
141
  });
@@ -174,7 +193,7 @@ class ResponsiveAccordionTabs {
174
193
  if (toSet === 'accordion') {
175
194
  $panels.each(function(key,value){
176
195
  $(value).appendTo($liHeads.get(key)).addClass('accordion-content').attr('data-tab-content','').removeClass('is-active').css({height:''});
177
- $('[data-tabs-content='+_this.$element.attr('id')+']').after('<div id="tabs-placeholder-'+_this.$element.attr('id')+'"></div>').remove();
196
+ $('[data-tabs-content='+_this.$element.attr('id')+']').after('<div id="tabs-placeholder-'+_this.$element.attr('id')+'"></div>').detach();
178
197
  $liHeads.addClass('accordion-item').attr('data-accordion-item','');
179
198
  $liHeadsA.addClass('accordion-title');
180
199
  });
@@ -190,7 +209,7 @@ class ResponsiveAccordionTabs {
190
209
  $panels.each(function(key,value){
191
210
  var tempValue = $(value).appendTo($tabsContent).addClass(tabsPanel);
192
211
  var hash = $liHeadsA.get(key).hash.slice(1);
193
- var id = $(value).attr('id') || Foundation.GetYoDigits(6, 'accordion');
212
+ var id = $(value).attr('id') || GetYoDigits(6, 'accordion');
194
213
  if (hash !== id) {
195
214
  if (hash !== '') {
196
215
  $(value).attr('id',hash);
@@ -213,28 +232,12 @@ class ResponsiveAccordionTabs {
213
232
  * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out.
214
233
  * @function
215
234
  */
216
- destroy() {
235
+ _destroy() {
217
236
  if (this.currentPlugin) this.currentPlugin.destroy();
218
237
  $(window).off('.zf.ResponsiveAccordionTabs');
219
- Foundation.unregisterPlugin(this);
220
238
  }
221
239
  }
222
240
 
223
241
  ResponsiveAccordionTabs.defaults = {};
224
242
 
225
- // The plugin matches the plugin classes with these plugin instances.
226
- var MenuPlugins = {
227
- tabs: {
228
- cssClass: 'tabs',
229
- plugin: Foundation._plugins.tabs || null
230
- },
231
- accordion: {
232
- cssClass: 'accordion',
233
- plugin: Foundation._plugins.accordion || null
234
- }
235
- };
236
-
237
- // Window exports
238
- Foundation.plugin(ResponsiveAccordionTabs, 'ResponsiveAccordionTabs');
239
-
240
- }(jQuery);
243
+ export {ResponsiveAccordionTabs};