foundation-rails 6.1.2.0 → 6.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -6
  3. data/README.md +1 -1
  4. data/Rakefile +5 -1
  5. data/bower.json +3 -3
  6. data/foundation-rails.gemspec +1 -0
  7. data/lib/foundation-rails.rb +1 -0
  8. data/lib/foundation/rails/version.rb +1 -1
  9. data/lib/generators/foundation/templates/foundation_and_overrides.scss +2 -2
  10. data/vendor/assets/js/foundation.abide.js.es6 +462 -0
  11. data/vendor/assets/js/{foundation.accordion.js → foundation.accordion.js.es6} +55 -47
  12. data/vendor/assets/js/{foundation.accordionMenu.js → foundation.accordionMenu.js.es6} +46 -35
  13. data/vendor/assets/js/{foundation.core.js → foundation.core.js.es6} +10 -8
  14. data/vendor/assets/js/{foundation.drilldown.js → foundation.drilldown.js.es6} +75 -49
  15. data/vendor/assets/js/{foundation.dropdown.js → foundation.dropdown.js.es6} +100 -88
  16. data/vendor/assets/js/{foundation.dropdownMenu.js → foundation.dropdownMenu.js.es6} +134 -128
  17. data/vendor/assets/js/{foundation.equalizer.js → foundation.equalizer.js.es6} +72 -61
  18. data/vendor/assets/js/{foundation.interchange.js → foundation.interchange.js.es6} +44 -45
  19. data/vendor/assets/js/{foundation.js → foundation.js.es6} +0 -0
  20. data/vendor/assets/js/{foundation.magellan.js → foundation.magellan.js.es6} +80 -83
  21. data/vendor/assets/js/foundation.offcanvas.js.es6 +395 -0
  22. data/vendor/assets/js/foundation.orbit.js.es6 +445 -0
  23. data/vendor/assets/js/{foundation.responsiveMenu.js → foundation.responsiveMenu.js.es6} +37 -31
  24. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +112 -0
  25. data/vendor/assets/js/foundation.reveal.js.es6 +544 -0
  26. data/vendor/assets/js/{foundation.slider.js → foundation.slider.js.es6} +235 -184
  27. data/vendor/assets/js/{foundation.sticky.js → foundation.sticky.js.es6} +177 -166
  28. data/vendor/assets/js/{foundation.tabs.js → foundation.tabs.js.es6} +138 -118
  29. data/vendor/assets/js/{foundation.toggler.js → foundation.toggler.js.es6} +34 -37
  30. data/vendor/assets/js/{foundation.tooltip.js → foundation.tooltip.js.es6} +162 -153
  31. data/vendor/assets/js/foundation.util.box.js.es6 +183 -0
  32. data/vendor/assets/js/{foundation.util.keyboard.js → foundation.util.keyboard.js.es6} +54 -54
  33. data/vendor/assets/js/{foundation.util.mediaQuery.js → foundation.util.mediaQuery.js.es6} +46 -46
  34. data/vendor/assets/js/{foundation.util.motion.js → foundation.util.motion.js.es6} +58 -48
  35. data/vendor/assets/js/foundation.util.nest.js.es6 +76 -0
  36. data/vendor/assets/js/foundation.util.timerAndImageLoader.js.es6 +86 -0
  37. data/vendor/assets/js/{foundation.util.touch.js → foundation.util.touch.js.es6} +2 -2
  38. data/vendor/assets/js/foundation.util.triggers.js.es6 +239 -0
  39. data/vendor/assets/scss/_global.scss +28 -27
  40. data/vendor/assets/scss/components/_badge.scss +1 -1
  41. data/vendor/assets/scss/components/_button-group.scss +77 -26
  42. data/vendor/assets/scss/components/_button.scss +8 -8
  43. data/vendor/assets/scss/components/_callout.scss +2 -2
  44. data/vendor/assets/scss/components/_drilldown.scss +4 -0
  45. data/vendor/assets/scss/components/_dropdown-menu.scss +104 -54
  46. data/vendor/assets/scss/components/_flex.scss +28 -0
  47. data/vendor/assets/scss/components/_label.scss +1 -1
  48. data/vendor/assets/scss/components/_media-object.scss +37 -7
  49. data/vendor/assets/scss/components/_menu-icon.scss +9 -0
  50. data/vendor/assets/scss/components/_menu.scss +127 -29
  51. data/vendor/assets/scss/components/_off-canvas.scss +1 -0
  52. data/vendor/assets/scss/components/_pagination.scss +3 -3
  53. data/vendor/assets/scss/components/_progress-bar.scss +1 -25
  54. data/vendor/assets/scss/components/_reveal.scss +12 -6
  55. data/vendor/assets/scss/components/_slider.scss +3 -35
  56. data/vendor/assets/scss/components/_table.scss +8 -0
  57. data/vendor/assets/scss/components/_tabs.scss +5 -10
  58. data/vendor/assets/scss/components/_title-bar.scss +27 -10
  59. data/vendor/assets/scss/components/_tooltip.scss +0 -4
  60. data/vendor/assets/scss/components/_top-bar.scss +93 -21
  61. data/vendor/assets/scss/components/_visibility.scss +1 -1
  62. data/vendor/assets/scss/forms/_checkbox.scss +1 -1
  63. data/vendor/assets/scss/forms/_error.scss +7 -5
  64. data/vendor/assets/scss/forms/_forms.scss +3 -0
  65. data/vendor/assets/scss/forms/_help-text.scss +1 -1
  66. data/vendor/assets/scss/forms/_input-group.scss +44 -9
  67. data/vendor/assets/scss/forms/_meter.scss +109 -0
  68. data/vendor/assets/scss/forms/_progress.scss +85 -0
  69. data/vendor/assets/scss/forms/_range.scss +144 -0
  70. data/vendor/assets/scss/forms/_select.scss +1 -1
  71. data/vendor/assets/scss/forms/_text.scss +10 -1
  72. data/vendor/assets/scss/foundation.scss +16 -5
  73. data/vendor/assets/scss/grid/_classes.scss +5 -18
  74. data/vendor/assets/scss/grid/_column.scss +13 -11
  75. data/vendor/assets/scss/grid/_flex-grid.scss +54 -80
  76. data/vendor/assets/scss/grid/_grid.scss +22 -10
  77. data/vendor/assets/scss/grid/_layout.scss +18 -0
  78. data/vendor/assets/scss/grid/_row.scss +11 -15
  79. data/vendor/assets/scss/motion-ui/_classes.scss +10 -3
  80. data/vendor/assets/scss/motion-ui/effects/_fade.scss +4 -1
  81. data/vendor/assets/scss/motion-ui/effects/_zoom.scss +1 -1
  82. data/vendor/assets/scss/motion-ui/transitions/_slide.scss +1 -1
  83. data/vendor/assets/scss/motion-ui/util/_transition.scss +1 -1
  84. data/vendor/assets/scss/settings/_settings.scss +64 -47
  85. data/vendor/assets/scss/typography/_base.scss +4 -0
  86. data/vendor/assets/scss/typography/_print.scss +9 -5
  87. data/vendor/assets/scss/util/_breakpoint.scss +31 -25
  88. data/vendor/assets/scss/util/_color.scss +19 -0
  89. data/vendor/assets/scss/util/_flex.scss +68 -0
  90. data/vendor/assets/scss/util/_mixins.scss +13 -7
  91. data/vendor/assets/scss/util/_util.scss +1 -5
  92. data/vendor/assets/scss/util/_value.scss +9 -28
  93. metadata +51 -31
  94. data/vendor/assets/js/foundation.abide.js +0 -418
  95. data/vendor/assets/js/foundation.offcanvas.js +0 -376
  96. data/vendor/assets/js/foundation.orbit.js +0 -421
  97. data/vendor/assets/js/foundation.responsiveToggle.js +0 -106
  98. data/vendor/assets/js/foundation.reveal.js +0 -514
  99. data/vendor/assets/js/foundation.util.box.js +0 -169
  100. data/vendor/assets/js/foundation.util.nest.js +0 -63
  101. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +0 -82
  102. data/vendor/assets/js/foundation.util.triggers.js +0 -224
@@ -1,12 +1,15 @@
1
+ 'use strict';
2
+
3
+ !function($) {
4
+
1
5
  /**
2
6
  * Tooltip module.
3
7
  * @module foundation.tooltip
4
8
  * @requires foundation.util.box
5
9
  * @requires foundation.util.triggers
6
10
  */
7
- !function($, document, Foundation){
8
- 'use strict';
9
11
 
12
+ class Tooltip {
10
13
  /**
11
14
  * Creates a new instance of a Tooltip.
12
15
  * @class
@@ -14,7 +17,7 @@
14
17
  * @param {jQuery} element - jQuery object to attach a tooltip to.
15
18
  * @param {Object} options - object to extend the default configuration.
16
19
  */
17
- function Tooltip(element, options){
20
+ constructor(element, options) {
18
21
  this.$element = element;
19
22
  this.options = $.extend({}, Tooltip.defaults, this.$element.data(), options);
20
23
 
@@ -25,100 +28,11 @@
25
28
  Foundation.registerPlugin(this, 'Tooltip');
26
29
  }
27
30
 
28
- Tooltip.defaults = {
29
- disableForTouch: false,
30
- /**
31
- * Time, in ms, before a tooltip should open on hover.
32
- * @option
33
- * @example 200
34
- */
35
- hoverDelay: 200,
36
- /**
37
- * Time, in ms, a tooltip should take to fade into view.
38
- * @option
39
- * @example 150
40
- */
41
- fadeInDuration: 150,
42
- /**
43
- * Time, in ms, a tooltip should take to fade out of view.
44
- * @option
45
- * @example 150
46
- */
47
- fadeOutDuration: 150,
48
- /**
49
- * Disables hover events from opening the tooltip if set to true
50
- * @option
51
- * @example false
52
- */
53
- disableHover: false,
54
- /**
55
- * Optional addtional classes to apply to the tooltip template on init.
56
- * @option
57
- * @example 'my-cool-tip-class'
58
- */
59
- templateClasses: '',
60
- /**
61
- * Non-optional class added to tooltip templates. Foundation default is 'tooltip'.
62
- * @option
63
- * @example 'tooltip'
64
- */
65
- tooltipClass: 'tooltip',
66
- /**
67
- * Class applied to the tooltip anchor element.
68
- * @option
69
- * @example 'has-tip'
70
- */
71
- triggerClass: 'has-tip',
72
- /**
73
- * Minimum breakpoint size at which to open the tooltip.
74
- * @option
75
- * @example 'small'
76
- */
77
- showOn: 'small',
78
- /**
79
- * Custom template to be used to generate markup for tooltip.
80
- * @option
81
- * @example '<div class="tooltip"></div>'
82
- */
83
- template: '',
84
- /**
85
- * Text displayed in the tooltip template on open.
86
- * @option
87
- * @example 'Some cool space fact here.'
88
- */
89
- tipText: '',
90
- touchCloseText: 'Tap to close.',
91
- /**
92
- * Allows the tooltip to remain open if triggered with a click or touch event.
93
- * @option
94
- * @example true
95
- */
96
- clickOpen: true,
97
- /**
98
- * Additional positioning classes, set by the JS
99
- * @option
100
- * @example 'top'
101
- */
102
- positionClass: '',
103
- /**
104
- * Distance, in pixels, the template should push away from the anchor on the Y axis.
105
- * @option
106
- * @example 10
107
- */
108
- vOffset: 10,
109
- /**
110
- * Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side.
111
- * @option
112
- * @example 12
113
- */
114
- hOffset: 12
115
- };
116
-
117
31
  /**
118
32
  * Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anchor.
119
33
  * @private
120
34
  */
121
- Tooltip.prototype._init = function(){
35
+ _init() {
122
36
  var elemId = this.$element.attr('aria-describedby') || Foundation.GetYoDigits(6, 'tooltip');
123
37
 
124
38
  this.options.positionClass = this._getPositionClass(this.$element);
@@ -143,14 +57,14 @@
143
57
  this.classChanged = false;
144
58
 
145
59
  this._events();
146
- };
60
+ }
147
61
 
148
62
  /**
149
63
  * Grabs the current positioning class, if present, and returns the value or an empty string.
150
64
  * @private
151
65
  */
152
- Tooltip.prototype._getPositionClass = function(element){
153
- if(!element){ return ''; }
66
+ _getPositionClass(element) {
67
+ if (!element) { return ''; }
154
68
  // var position = element.attr('class').match(/top|left|right/g);
155
69
  var position = element[0].className.match(/\b(top|left|right)\b/g);
156
70
  position = position ? position[0] : '';
@@ -160,8 +74,8 @@
160
74
  * builds the tooltip element, adds attributes, and returns the template.
161
75
  * @private
162
76
  */
163
- Tooltip.prototype._buildTemplate = function(id){
164
- var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass + ' ' + this.options.templateClasses).trim();
77
+ _buildTemplate(id) {
78
+ var templateClasses = (`${this.options.tooltipClass} ${this.options.positionClass} ${this.options.templateClasses}`).trim();
165
79
  var $template = $('<div></div>').addClass(templateClasses).attr({
166
80
  'role': 'tooltip',
167
81
  'aria-hidden': true,
@@ -170,55 +84,54 @@
170
84
  'id': id
171
85
  });
172
86
  return $template;
173
- };
87
+ }
174
88
 
175
89
  /**
176
90
  * Function that gets called if a collision event is detected.
177
91
  * @param {String} position - positioning class to try
178
92
  * @private
179
93
  */
180
- Tooltip.prototype._reposition = function(position){
94
+ _reposition(position) {
181
95
  this.usedPositions.push(position ? position : 'bottom');
182
96
 
183
97
  //default, try switching to opposite side
184
- if(!position && (this.usedPositions.indexOf('top') < 0)){
98
+ if (!position && (this.usedPositions.indexOf('top') < 0)) {
185
99
  this.template.addClass('top');
186
- }else if(position === 'top' && (this.usedPositions.indexOf('bottom') < 0)){
100
+ } else if (position === 'top' && (this.usedPositions.indexOf('bottom') < 0)) {
187
101
  this.template.removeClass(position);
188
- }else if(position === 'left' && (this.usedPositions.indexOf('right') < 0)){
102
+ } else if (position === 'left' && (this.usedPositions.indexOf('right') < 0)) {
189
103
  this.template.removeClass(position)
190
104
  .addClass('right');
191
- }else if(position === 'right' && (this.usedPositions.indexOf('left') < 0)){
105
+ } else if (position === 'right' && (this.usedPositions.indexOf('left') < 0)) {
192
106
  this.template.removeClass(position)
193
107
  .addClass('left');
194
108
  }
195
109
 
196
110
  //if default change didn't work, try bottom or left first
197
- else if(!position && (this.usedPositions.indexOf('top') > -1) && (this.usedPositions.indexOf('left') < 0)){
111
+ else if (!position && (this.usedPositions.indexOf('top') > -1) && (this.usedPositions.indexOf('left') < 0)) {
198
112
  this.template.addClass('left');
199
- }else if(position === 'top' && (this.usedPositions.indexOf('bottom') > -1) && (this.usedPositions.indexOf('left') < 0)){
113
+ } else if (position === 'top' && (this.usedPositions.indexOf('bottom') > -1) && (this.usedPositions.indexOf('left') < 0)) {
200
114
  this.template.removeClass(position)
201
115
  .addClass('left');
202
- }else if(position === 'left' && (this.usedPositions.indexOf('right') > -1) && (this.usedPositions.indexOf('bottom') < 0)){
116
+ } else if (position === 'left' && (this.usedPositions.indexOf('right') > -1) && (this.usedPositions.indexOf('bottom') < 0)) {
203
117
  this.template.removeClass(position);
204
- }else if(position === 'right' && (this.usedPositions.indexOf('left') > -1) && (this.usedPositions.indexOf('bottom') < 0)){
118
+ } else if (position === 'right' && (this.usedPositions.indexOf('left') > -1) && (this.usedPositions.indexOf('bottom') < 0)) {
205
119
  this.template.removeClass(position);
206
120
  }
207
121
  //if nothing cleared, set to bottom
208
- else{
122
+ else {
209
123
  this.template.removeClass(position);
210
124
  }
211
125
  this.classChanged = true;
212
126
  this.counter--;
213
-
214
- };
127
+ }
215
128
 
216
129
  /**
217
130
  * sets the position class of an element and recursively calls itself until there are no more possible positions to attempt, or the tooltip element is no longer colliding.
218
131
  * if the tooltip is larger than the screen width, default to full width - any user selected margin
219
132
  * @private
220
133
  */
221
- Tooltip.prototype._setPosition = function(){
134
+ _setPosition() {
222
135
  var position = this._getPositionClass(this.template),
223
136
  $tipDims = Foundation.Box.GetDimensions(this.template),
224
137
  $anchorDims = Foundation.Box.GetDimensions(this.$element),
@@ -227,7 +140,7 @@
227
140
  offset = (param === 'height') ? this.options.vOffset : this.options.hOffset,
228
141
  _this = this;
229
142
 
230
- if(($tipDims.width >= $tipDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.template))){
143
+ if (($tipDims.width >= $tipDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.template))) {
231
144
  this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
232
145
  // this.$element.offset(Foundation.GetOffsets(this.template, this.$element, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
233
146
  'width': $anchorDims.windowDims.width - (this.options.hOffset * 2),
@@ -238,11 +151,11 @@
238
151
 
239
152
  this.template.offset(Foundation.Box.GetOffsets(this.template, this.$element,'center ' + (position || 'bottom'), this.options.vOffset, this.options.hOffset));
240
153
 
241
- while(!Foundation.Box.ImNotTouchingYou(this.template) && this.counter){
154
+ while(!Foundation.Box.ImNotTouchingYou(this.template) && this.counter) {
242
155
  this._reposition(position);
243
156
  this._setPosition();
244
157
  }
245
- };
158
+ }
246
159
 
247
160
  /**
248
161
  * reveals the tooltip, and fires an event to close any other open tooltips on the page
@@ -250,8 +163,8 @@
250
163
  * @fires Tooltip#show
251
164
  * @function
252
165
  */
253
- Tooltip.prototype.show = function(){
254
- if(this.options.showOn !== 'all' && !Foundation.MediaQuery.atLeast(this.options.showOn)){
166
+ show() {
167
+ if (this.options.showOn !== 'all' && !Foundation.MediaQuery.atLeast(this.options.showOn)) {
255
168
  // console.error('The screen is too small to display this tooltip');
256
169
  return false;
257
170
  }
@@ -273,7 +186,7 @@
273
186
  });
274
187
  _this.isActive = true;
275
188
  // console.log(this.template);
276
- this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function(){
189
+ this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function() {
277
190
  //maybe do stuff?
278
191
  });
279
192
  /**
@@ -281,23 +194,23 @@
281
194
  * @event Tooltip#show
282
195
  */
283
196
  this.$element.trigger('show.zf.tooltip');
284
- };
197
+ }
285
198
 
286
199
  /**
287
200
  * Hides the current tooltip, and resets the positioning class if it was changed due to collision
288
201
  * @fires Tooltip#hide
289
202
  * @function
290
203
  */
291
- Tooltip.prototype.hide = function(){
204
+ hide() {
292
205
  // console.log('hiding', this.$element.data('yeti-box'));
293
206
  var _this = this;
294
207
  this.template.stop().attr({
295
208
  'aria-hidden': true,
296
209
  'data-is-active': false
297
- }).fadeOut(this.options.fadeOutDuration, function(){
210
+ }).fadeOut(this.options.fadeOutDuration, function() {
298
211
  _this.isActive = false;
299
212
  _this.isClick = false;
300
- if(_this.classChanged){
213
+ if (_this.classChanged) {
301
214
  _this.template
302
215
  .removeClass(_this._getPositionClass(_this.template))
303
216
  .addClass(_this.options.positionClass);
@@ -312,53 +225,54 @@
312
225
  * @event Tooltip#hide
313
226
  */
314
227
  this.$element.trigger('hide.zf.tooltip');
315
- };
228
+ }
316
229
 
317
230
  /**
318
231
  * adds event listeners for the tooltip and its anchor
319
232
  * TODO combine some of the listeners like focus and mouseenter, etc.
320
233
  * @private
321
234
  */
322
- Tooltip.prototype._events = function(){
235
+ _events() {
323
236
  var _this = this;
324
237
  var $template = this.template;
325
238
  var isFocus = false;
326
239
 
327
- if(!this.options.disableHover){
240
+ if (!this.options.disableHover) {
328
241
 
329
242
  this.$element
330
- .on('mouseenter.zf.tooltip', function(e){
331
- if(!_this.isActive){
332
- _this.timeout = setTimeout(function(){
243
+ .on('mouseenter.zf.tooltip', function(e) {
244
+ if (!_this.isActive) {
245
+ _this.timeout = setTimeout(function() {
333
246
  _this.show();
334
247
  }, _this.options.hoverDelay);
335
248
  }
336
249
  })
337
- .on('mouseleave.zf.tooltip', function(e){
250
+ .on('mouseleave.zf.tooltip', function(e) {
338
251
  clearTimeout(_this.timeout);
339
- if(!isFocus || (!_this.isClick && _this.options.clickOpen)){
252
+ if (!isFocus || (!_this.isClick && _this.options.clickOpen)) {
340
253
  _this.hide();
341
254
  }
342
255
  });
343
256
  }
344
- if(this.options.clickOpen){
345
- this.$element.on('mousedown.zf.tooltip', function(e){
257
+
258
+ if (this.options.clickOpen) {
259
+ this.$element.on('mousedown.zf.tooltip', function(e) {
346
260
  e.stopImmediatePropagation();
347
- if(_this.isClick){
261
+ if (_this.isClick) {
348
262
  _this.hide();
349
263
  // _this.isClick = false;
350
- }else{
264
+ } else {
351
265
  _this.isClick = true;
352
- if((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive){
266
+ if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) {
353
267
  _this.show();
354
268
  }
355
269
  }
356
270
  });
357
271
  }
358
272
 
359
- if(!this.options.disableForTouch){
273
+ if (!this.options.disableForTouch) {
360
274
  this.$element
361
- .on('tap.zf.tooltip touchend.zf.tooltip', function(e){
275
+ .on('tap.zf.tooltip touchend.zf.tooltip', function(e) {
362
276
  _this.isActive ? _this.hide() : _this.show();
363
277
  });
364
278
  }
@@ -370,45 +284,47 @@
370
284
  });
371
285
 
372
286
  this.$element
373
- .on('focus.zf.tooltip', function(e){
287
+ .on('focus.zf.tooltip', function(e) {
374
288
  isFocus = true;
375
289
  // console.log(_this.isClick);
376
- if(_this.isClick){
290
+ if (_this.isClick) {
377
291
  return false;
378
- }else{
292
+ } else {
379
293
  // $(window)
380
294
  _this.show();
381
295
  }
382
296
  })
383
297
 
384
- .on('focusout.zf.tooltip', function(e){
298
+ .on('focusout.zf.tooltip', function(e) {
385
299
  isFocus = false;
386
300
  _this.isClick = false;
387
301
  _this.hide();
388
302
  })
389
303
 
390
- .on('resizeme.zf.trigger', function(){
391
- if(_this.isActive){
304
+ .on('resizeme.zf.trigger', function() {
305
+ if (_this.isActive) {
392
306
  _this._setPosition();
393
307
  }
394
308
  });
395
- };
309
+ }
310
+
396
311
  /**
397
312
  * adds a toggle method, in addition to the static show() & hide() functions
398
313
  * @function
399
314
  */
400
- Tooltip.prototype.toggle = function(){
401
- if(this.isActive){
315
+ toggle() {
316
+ if (this.isActive) {
402
317
  this.hide();
403
- }else{
318
+ } else {
404
319
  this.show();
405
320
  }
406
- };
321
+ }
322
+
407
323
  /**
408
324
  * Destroys an instance of tooltip, removes template element from the view.
409
325
  * @function
410
326
  */
411
- Tooltip.prototype.destroy = function(){
327
+ destroy() {
412
328
  this.$element.attr('title', this.template.text())
413
329
  .off('.zf.trigger .zf.tootip')
414
330
  // .removeClass('has-tip')
@@ -420,10 +336,103 @@
420
336
  this.template.remove();
421
337
 
422
338
  Foundation.unregisterPlugin(this);
423
- };
339
+ }
340
+ }
341
+
342
+ Tooltip.defaults = {
343
+ disableForTouch: false,
344
+ /**
345
+ * Time, in ms, before a tooltip should open on hover.
346
+ * @option
347
+ * @example 200
348
+ */
349
+ hoverDelay: 200,
350
+ /**
351
+ * Time, in ms, a tooltip should take to fade into view.
352
+ * @option
353
+ * @example 150
354
+ */
355
+ fadeInDuration: 150,
356
+ /**
357
+ * Time, in ms, a tooltip should take to fade out of view.
358
+ * @option
359
+ * @example 150
360
+ */
361
+ fadeOutDuration: 150,
362
+ /**
363
+ * Disables hover events from opening the tooltip if set to true
364
+ * @option
365
+ * @example false
366
+ */
367
+ disableHover: false,
368
+ /**
369
+ * Optional addtional classes to apply to the tooltip template on init.
370
+ * @option
371
+ * @example 'my-cool-tip-class'
372
+ */
373
+ templateClasses: '',
374
+ /**
375
+ * Non-optional class added to tooltip templates. Foundation default is 'tooltip'.
376
+ * @option
377
+ * @example 'tooltip'
378
+ */
379
+ tooltipClass: 'tooltip',
380
+ /**
381
+ * Class applied to the tooltip anchor element.
382
+ * @option
383
+ * @example 'has-tip'
384
+ */
385
+ triggerClass: 'has-tip',
386
+ /**
387
+ * Minimum breakpoint size at which to open the tooltip.
388
+ * @option
389
+ * @example 'small'
390
+ */
391
+ showOn: 'small',
392
+ /**
393
+ * Custom template to be used to generate markup for tooltip.
394
+ * @option
395
+ * @example '&lt;div class="tooltip"&gt;&lt;/div&gt;'
396
+ */
397
+ template: '',
398
+ /**
399
+ * Text displayed in the tooltip template on open.
400
+ * @option
401
+ * @example 'Some cool space fact here.'
402
+ */
403
+ tipText: '',
404
+ touchCloseText: 'Tap to close.',
424
405
  /**
425
- * TODO utilize resize event trigger
406
+ * Allows the tooltip to remain open if triggered with a click or touch event.
407
+ * @option
408
+ * @example true
426
409
  */
410
+ clickOpen: true,
411
+ /**
412
+ * Additional positioning classes, set by the JS
413
+ * @option
414
+ * @example 'top'
415
+ */
416
+ positionClass: '',
417
+ /**
418
+ * Distance, in pixels, the template should push away from the anchor on the Y axis.
419
+ * @option
420
+ * @example 10
421
+ */
422
+ vOffset: 10,
423
+ /**
424
+ * Distance, in pixels, the template should push away from the anchor on the X axis, if aligned to a side.
425
+ * @option
426
+ * @example 12
427
+ */
428
+ hOffset: 12
429
+ };
430
+
431
+ /**
432
+ * TODO utilize resize event trigger
433
+ */
434
+
435
+ // Window exports
436
+ Foundation.plugin(Tooltip, 'Tooltip');
427
437
 
428
- Foundation.plugin(Tooltip, 'Tooltip');
429
- }(jQuery, window.document, window.Foundation);
438
+ }(jQuery);