foundation-rails 6.4.1.0 → 6.4.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Rakefile +5 -6
  4. data/lib/foundation/rails/version.rb +1 -1
  5. data/vendor/assets/js/foundation.abide.js +781 -0
  6. data/vendor/assets/js/foundation.accordion.js +511 -0
  7. data/vendor/assets/js/foundation.accordionMenu.js +527 -0
  8. data/vendor/assets/js/foundation.core.js +860 -0
  9. data/vendor/assets/js/foundation.drilldown.js +759 -0
  10. data/vendor/assets/js/foundation.dropdown.js +1131 -0
  11. data/vendor/assets/js/foundation.dropdownMenu.js +678 -0
  12. data/vendor/assets/js/foundation.equalizer.js +542 -0
  13. data/vendor/assets/js/foundation.interchange.js +399 -0
  14. data/vendor/assets/js/{foundation.js.es6 → foundation.js} +11 -12
  15. data/vendor/assets/js/foundation.magellan.js +449 -0
  16. data/vendor/assets/js/foundation.offcanvas.js +1052 -0
  17. data/vendor/assets/js/foundation.orbit.js +767 -0
  18. data/vendor/assets/js/foundation.responsiveAccordionTabs.js +440 -0
  19. data/vendor/assets/js/foundation.responsiveMenu.js +362 -0
  20. data/vendor/assets/js/foundation.responsiveToggle.js +336 -0
  21. data/vendor/assets/js/foundation.reveal.js +1066 -0
  22. data/vendor/assets/js/foundation.slider.js +1236 -0
  23. data/vendor/assets/js/foundation.smoothScroll.js +303 -0
  24. data/vendor/assets/js/foundation.sticky.js +1001 -0
  25. data/vendor/assets/js/foundation.tabs.js +678 -0
  26. data/vendor/assets/js/foundation.toggler.js +602 -0
  27. data/vendor/assets/js/foundation.tooltip.js +1195 -0
  28. data/vendor/assets/js/{foundation.util.box.js.es6 → foundation.util.box.js} +154 -41
  29. data/vendor/assets/js/foundation.util.imageLoader.js +163 -0
  30. data/vendor/assets/js/foundation.util.keyboard.js +298 -0
  31. data/vendor/assets/js/foundation.util.mediaQuery.js +353 -0
  32. data/vendor/assets/js/foundation.util.motion.js +231 -0
  33. data/vendor/assets/js/foundation.util.nest.js +181 -0
  34. data/vendor/assets/js/foundation.util.timer.js +170 -0
  35. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +90 -0
  36. data/vendor/assets/js/foundation.util.touch.js +275 -0
  37. data/vendor/assets/js/foundation.util.triggers.js +399 -0
  38. data/vendor/assets/js/foundation.zf.responsiveAccordionTabs.js +262 -0
  39. metadata +37 -71
  40. data/vendor/assets/js/entries/foundation-plugins.js +0 -25
  41. data/vendor/assets/js/entries/foundation.js +0 -101
  42. data/vendor/assets/js/entries/plugins/foundation.abide.js +0 -4
  43. data/vendor/assets/js/entries/plugins/foundation.accordion.js +0 -4
  44. data/vendor/assets/js/entries/plugins/foundation.accordionMenu.js +0 -5
  45. data/vendor/assets/js/entries/plugins/foundation.core.js +0 -21
  46. data/vendor/assets/js/entries/plugins/foundation.drilldown.js +0 -4
  47. data/vendor/assets/js/entries/plugins/foundation.dropdown.js +0 -5
  48. data/vendor/assets/js/entries/plugins/foundation.dropdownMenu.js +0 -4
  49. data/vendor/assets/js/entries/plugins/foundation.equalizer.js +0 -4
  50. data/vendor/assets/js/entries/plugins/foundation.interchange.js +0 -4
  51. data/vendor/assets/js/entries/plugins/foundation.magellan.js +0 -4
  52. data/vendor/assets/js/entries/plugins/foundation.offcanvas.js +0 -4
  53. data/vendor/assets/js/entries/plugins/foundation.orbit.js +0 -5
  54. data/vendor/assets/js/entries/plugins/foundation.responsiveAccordionTabs.js +0 -5
  55. data/vendor/assets/js/entries/plugins/foundation.responsiveMenu.js +0 -5
  56. data/vendor/assets/js/entries/plugins/foundation.responsiveToggle.js +0 -5
  57. data/vendor/assets/js/entries/plugins/foundation.reveal.js +0 -4
  58. data/vendor/assets/js/entries/plugins/foundation.slider.js +0 -5
  59. data/vendor/assets/js/entries/plugins/foundation.smoothScroll.js +0 -5
  60. data/vendor/assets/js/entries/plugins/foundation.sticky.js +0 -5
  61. data/vendor/assets/js/entries/plugins/foundation.tabs.js +0 -5
  62. data/vendor/assets/js/entries/plugins/foundation.toggler.js +0 -5
  63. data/vendor/assets/js/entries/plugins/foundation.tooltip.js +0 -4
  64. data/vendor/assets/js/entries/plugins/foundation.util.box.js +0 -4
  65. data/vendor/assets/js/entries/plugins/foundation.util.imageLoader.js +0 -5
  66. data/vendor/assets/js/entries/plugins/foundation.util.keyboard.js +0 -4
  67. data/vendor/assets/js/entries/plugins/foundation.util.mediaQuery.js +0 -4
  68. data/vendor/assets/js/entries/plugins/foundation.util.motion.js +0 -5
  69. data/vendor/assets/js/entries/plugins/foundation.util.nest.js +0 -5
  70. data/vendor/assets/js/entries/plugins/foundation.util.timer.js +0 -5
  71. data/vendor/assets/js/entries/plugins/foundation.util.touch.js +0 -7
  72. data/vendor/assets/js/entries/plugins/foundation.util.triggers.js +0 -5
  73. data/vendor/assets/js/foundation.abide.js.es6 +0 -587
  74. data/vendor/assets/js/foundation.accordion.js.es6 +0 -329
  75. data/vendor/assets/js/foundation.accordionMenu.js.es6 +0 -328
  76. data/vendor/assets/js/foundation.core.js.es6 +0 -337
  77. data/vendor/assets/js/foundation.drilldown.js.es6 +0 -536
  78. data/vendor/assets/js/foundation.dropdown.js.es6 +0 -394
  79. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +0 -458
  80. data/vendor/assets/js/foundation.equalizer.js.es6 +0 -318
  81. data/vendor/assets/js/foundation.interchange.js.es6 +0 -210
  82. data/vendor/assets/js/foundation.magellan.js.es6 +0 -257
  83. data/vendor/assets/js/foundation.offcanvas.js.es6 +0 -546
  84. data/vendor/assets/js/foundation.orbit.js.es6 +0 -531
  85. data/vendor/assets/js/foundation.plugin.js.es6 +0 -54
  86. data/vendor/assets/js/foundation.positionable.js.es6 +0 -206
  87. data/vendor/assets/js/foundation.responsiveAccordionTabs.js.es6 +0 -243
  88. data/vendor/assets/js/foundation.responsiveMenu.js.es6 +0 -155
  89. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +0 -156
  90. data/vendor/assets/js/foundation.reveal.js.es6 +0 -585
  91. data/vendor/assets/js/foundation.slider.js.es6 +0 -712
  92. data/vendor/assets/js/foundation.smoothScroll.js.es6 +0 -135
  93. data/vendor/assets/js/foundation.sticky.js.es6 +0 -507
  94. data/vendor/assets/js/foundation.tabs.js.es6 +0 -498
  95. data/vendor/assets/js/foundation.toggler.js.es6 +0 -150
  96. data/vendor/assets/js/foundation.tooltip.js.es6 +0 -462
  97. data/vendor/assets/js/foundation.util.core.js.es6 +0 -52
  98. data/vendor/assets/js/foundation.util.imageLoader.js.es6 +0 -45
  99. data/vendor/assets/js/foundation.util.keyboard.js.es6 +0 -162
  100. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +0 -234
  101. data/vendor/assets/js/foundation.util.motion.js.es6 +0 -104
  102. data/vendor/assets/js/foundation.util.nest.js.es6 +0 -67
  103. data/vendor/assets/js/foundation.util.timer.js.es6 +0 -48
  104. data/vendor/assets/js/foundation.util.touch.js.es6 +0 -149
  105. data/vendor/assets/js/foundation.util.triggers.js.es6 +0 -268
@@ -1,498 +0,0 @@
1
- 'use strict';
2
-
3
- import $ from 'jquery';
4
- import { Keyboard } from './foundation.util.keyboard';
5
- import { onImagesLoaded } from './foundation.util.imageLoader';
6
- import { Plugin } from './foundation.plugin';
7
- /**
8
- * Tabs module.
9
- * @module foundation.tabs
10
- * @requires foundation.util.keyboard
11
- * @requires foundation.util.imageLoader if tabs contain images
12
- */
13
-
14
- class Tabs extends Plugin {
15
- /**
16
- * Creates a new instance of tabs.
17
- * @class
18
- * @name Tabs
19
- * @fires Tabs#init
20
- * @param {jQuery} element - jQuery object to make into tabs.
21
- * @param {Object} options - Overrides to the default plugin settings.
22
- */
23
- _setup(element, options) {
24
- this.$element = element;
25
- this.options = $.extend({}, Tabs.defaults, this.$element.data(), options);
26
- this.className = 'Tabs'; // ie9 back compat
27
-
28
- this._init();
29
- Keyboard.register('Tabs', {
30
- 'ENTER': 'open',
31
- 'SPACE': 'open',
32
- 'ARROW_RIGHT': 'next',
33
- 'ARROW_UP': 'previous',
34
- 'ARROW_DOWN': 'next',
35
- 'ARROW_LEFT': 'previous'
36
- // 'TAB': 'next',
37
- // 'SHIFT_TAB': 'previous'
38
- });
39
- }
40
-
41
- /**
42
- * Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab.
43
- * @private
44
- */
45
- _init() {
46
- var _this = this;
47
-
48
- this.$element.attr({'role': 'tablist'});
49
- this.$tabTitles = this.$element.find(`.${this.options.linkClass}`);
50
- this.$tabContent = $(`[data-tabs-content="${this.$element[0].id}"]`);
51
-
52
- this.$tabTitles.each(function(){
53
- var $elem = $(this),
54
- $link = $elem.find('a'),
55
- isActive = $elem.hasClass(`${_this.options.linkActiveClass}`),
56
- hash = $link.attr('data-tabs-target') || $link[0].hash.slice(1),
57
- linkId = $link[0].id ? $link[0].id : `${hash}-label`,
58
- $tabContent = $(`#${hash}`);
59
-
60
- $elem.attr({'role': 'presentation'});
61
-
62
- $link.attr({
63
- 'role': 'tab',
64
- 'aria-controls': hash,
65
- 'aria-selected': isActive,
66
- 'id': linkId,
67
- 'tabindex': isActive ? '0' : '-1'
68
- });
69
-
70
- $tabContent.attr({
71
- 'role': 'tabpanel',
72
- 'aria-labelledby': linkId
73
- });
74
-
75
- if(!isActive) {
76
- $tabContent.attr('aria-hidden', 'true');
77
- }
78
-
79
- if(isActive && _this.options.autoFocus){
80
- $(window).load(function() {
81
- $('html, body').animate({ scrollTop: $elem.offset().top }, _this.options.deepLinkSmudgeDelay, () => {
82
- $link.focus();
83
- });
84
- });
85
- }
86
- });
87
- if(this.options.matchHeight) {
88
- var $images = this.$tabContent.find('img');
89
-
90
- if ($images.length) {
91
- onImagesLoaded($images, this._setHeight.bind(this));
92
- } else {
93
- this._setHeight();
94
- }
95
- }
96
-
97
- //current context-bound function to open tabs on page load or history popstate
98
- this._checkDeepLink = () => {
99
- var anchor = window.location.hash;
100
- //need a hash and a relevant anchor in this tabset
101
- if(anchor.length) {
102
- var $link = this.$element.find('[href$="'+anchor+'"]');
103
- if ($link.length) {
104
- this.selectTab($(anchor), true);
105
-
106
- //roll up a little to show the titles
107
- if (this.options.deepLinkSmudge) {
108
- var offset = this.$element.offset();
109
- $('html, body').animate({ scrollTop: offset.top }, this.options.deepLinkSmudgeDelay);
110
- }
111
-
112
- /**
113
- * Fires when the zplugin has deeplinked at pageload
114
- * @event Tabs#deeplink
115
- */
116
- this.$element.trigger('deeplink.zf.tabs', [$link, $(anchor)]);
117
- }
118
- }
119
- }
120
-
121
- //use browser to open a tab, if it exists in this tabset
122
- if (this.options.deepLink) {
123
- this._checkDeepLink();
124
- }
125
-
126
- this._events();
127
- }
128
-
129
- /**
130
- * Adds event handlers for items within the tabs.
131
- * @private
132
- */
133
- _events() {
134
- this._addKeyHandler();
135
- this._addClickHandler();
136
- this._setHeightMqHandler = null;
137
-
138
- if (this.options.matchHeight) {
139
- this._setHeightMqHandler = this._setHeight.bind(this);
140
-
141
- $(window).on('changed.zf.mediaquery', this._setHeightMqHandler);
142
- }
143
-
144
- if(this.options.deepLink) {
145
- $(window).on('popstate', this._checkDeepLink);
146
- }
147
- }
148
-
149
- /**
150
- * Adds click handlers for items within the tabs.
151
- * @private
152
- */
153
- _addClickHandler() {
154
- var _this = this;
155
-
156
- this.$element
157
- .off('click.zf.tabs')
158
- .on('click.zf.tabs', `.${this.options.linkClass}`, function(e){
159
- e.preventDefault();
160
- e.stopPropagation();
161
- _this._handleTabChange($(this));
162
- });
163
- }
164
-
165
- /**
166
- * Adds keyboard event handlers for items within the tabs.
167
- * @private
168
- */
169
- _addKeyHandler() {
170
- var _this = this;
171
-
172
- this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function(e){
173
- if (e.which === 9) return;
174
-
175
-
176
- var $element = $(this),
177
- $elements = $element.parent('ul').children('li'),
178
- $prevElement,
179
- $nextElement;
180
-
181
- $elements.each(function(i) {
182
- if ($(this).is($element)) {
183
- if (_this.options.wrapOnKeys) {
184
- $prevElement = i === 0 ? $elements.last() : $elements.eq(i-1);
185
- $nextElement = i === $elements.length -1 ? $elements.first() : $elements.eq(i+1);
186
- } else {
187
- $prevElement = $elements.eq(Math.max(0, i-1));
188
- $nextElement = $elements.eq(Math.min(i+1, $elements.length-1));
189
- }
190
- return;
191
- }
192
- });
193
-
194
- // handle keyboard event with keyboard util
195
- Keyboard.handleKey(e, 'Tabs', {
196
- open: function() {
197
- $element.find('[role="tab"]').focus();
198
- _this._handleTabChange($element);
199
- },
200
- previous: function() {
201
- $prevElement.find('[role="tab"]').focus();
202
- _this._handleTabChange($prevElement);
203
- },
204
- next: function() {
205
- $nextElement.find('[role="tab"]').focus();
206
- _this._handleTabChange($nextElement);
207
- },
208
- handled: function() {
209
- e.stopPropagation();
210
- e.preventDefault();
211
- }
212
- });
213
- });
214
- }
215
-
216
- /**
217
- * Opens the tab `$targetContent` defined by `$target`. Collapses active tab.
218
- * @param {jQuery} $target - Tab to open.
219
- * @param {boolean} historyHandled - browser has already handled a history update
220
- * @fires Tabs#change
221
- * @function
222
- */
223
- _handleTabChange($target, historyHandled) {
224
-
225
- /**
226
- * Check for active class on target. Collapse if exists.
227
- */
228
- if ($target.hasClass(`${this.options.linkActiveClass}`)) {
229
- if(this.options.activeCollapse) {
230
- this._collapseTab($target);
231
-
232
- /**
233
- * Fires when the zplugin has successfully collapsed tabs.
234
- * @event Tabs#collapse
235
- */
236
- this.$element.trigger('collapse.zf.tabs', [$target]);
237
- }
238
- return;
239
- }
240
-
241
- var $oldTab = this.$element.
242
- find(`.${this.options.linkClass}.${this.options.linkActiveClass}`),
243
- $tabLink = $target.find('[role="tab"]'),
244
- hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1),
245
- $targetContent = this.$tabContent.find(`#${hash}`);
246
-
247
- //close old tab
248
- this._collapseTab($oldTab);
249
-
250
- //open new tab
251
- this._openTab($target);
252
-
253
- //either replace or update browser history
254
- if (this.options.deepLink && !historyHandled) {
255
- var anchor = $target.find('a').attr('href');
256
-
257
- if (this.options.updateHistory) {
258
- history.pushState({}, '', anchor);
259
- } else {
260
- history.replaceState({}, '', anchor);
261
- }
262
- }
263
-
264
- /**
265
- * Fires when the plugin has successfully changed tabs.
266
- * @event Tabs#change
267
- */
268
- this.$element.trigger('change.zf.tabs', [$target, $targetContent]);
269
-
270
- //fire to children a mutation event
271
- $targetContent.find("[data-mutate]").trigger("mutateme.zf.trigger");
272
- }
273
-
274
- /**
275
- * Opens the tab `$targetContent` defined by `$target`.
276
- * @param {jQuery} $target - Tab to Open.
277
- * @function
278
- */
279
- _openTab($target) {
280
- var $tabLink = $target.find('[role="tab"]'),
281
- hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1),
282
- $targetContent = this.$tabContent.find(`#${hash}`);
283
-
284
- $target.addClass(`${this.options.linkActiveClass}`);
285
-
286
- $tabLink.attr({
287
- 'aria-selected': 'true',
288
- 'tabindex': '0'
289
- });
290
-
291
- $targetContent
292
- .addClass(`${this.options.panelActiveClass}`).removeAttr('aria-hidden');
293
- }
294
-
295
- /**
296
- * Collapses `$targetContent` defined by `$target`.
297
- * @param {jQuery} $target - Tab to Open.
298
- * @function
299
- */
300
- _collapseTab($target) {
301
- var $target_anchor = $target
302
- .removeClass(`${this.options.linkActiveClass}`)
303
- .find('[role="tab"]')
304
- .attr({
305
- 'aria-selected': 'false',
306
- 'tabindex': -1
307
- });
308
-
309
- $(`#${$target_anchor.attr('aria-controls')}`)
310
- .removeClass(`${this.options.panelActiveClass}`)
311
- .attr({ 'aria-hidden': 'true' })
312
- }
313
-
314
- /**
315
- * Public method for selecting a content pane to display.
316
- * @param {jQuery | String} elem - jQuery object or string of the id of the pane to display.
317
- * @param {boolean} historyHandled - browser has already handled a history update
318
- * @function
319
- */
320
- selectTab(elem, historyHandled) {
321
- var idStr;
322
-
323
- if (typeof elem === 'object') {
324
- idStr = elem[0].id;
325
- } else {
326
- idStr = elem;
327
- }
328
-
329
- if (idStr.indexOf('#') < 0) {
330
- idStr = `#${idStr}`;
331
- }
332
-
333
- var $target = this.$tabTitles.find(`[href$="${idStr}"]`).parent(`.${this.options.linkClass}`);
334
-
335
- this._handleTabChange($target, historyHandled);
336
- };
337
- /**
338
- * Sets the height of each panel to the height of the tallest panel.
339
- * If enabled in options, gets called on media query change.
340
- * If loading content via external source, can be called directly or with _reflow.
341
- * If enabled with `data-match-height="true"`, tabs sets to equal height
342
- * @function
343
- * @private
344
- */
345
- _setHeight() {
346
- var max = 0,
347
- _this = this; // Lock down the `this` value for the root tabs object
348
-
349
- this.$tabContent
350
- .find(`.${this.options.panelClass}`)
351
- .css('height', '')
352
- .each(function() {
353
-
354
- var panel = $(this),
355
- isActive = panel.hasClass(`${_this.options.panelActiveClass}`); // get the options from the parent instead of trying to get them from the child
356
-
357
- if (!isActive) {
358
- panel.css({'visibility': 'hidden', 'display': 'block'});
359
- }
360
-
361
- var temp = this.getBoundingClientRect().height;
362
-
363
- if (!isActive) {
364
- panel.css({
365
- 'visibility': '',
366
- 'display': ''
367
- });
368
- }
369
-
370
- max = temp > max ? temp : max;
371
- })
372
- .css('height', `${max}px`);
373
- }
374
-
375
- /**
376
- * Destroys an instance of an tabs.
377
- * @fires Tabs#destroyed
378
- */
379
- _destroy() {
380
- this.$element
381
- .find(`.${this.options.linkClass}`)
382
- .off('.zf.tabs').hide().end()
383
- .find(`.${this.options.panelClass}`)
384
- .hide();
385
-
386
- if (this.options.matchHeight) {
387
- if (this._setHeightMqHandler != null) {
388
- $(window).off('changed.zf.mediaquery', this._setHeightMqHandler);
389
- }
390
- }
391
-
392
- if (this.options.deepLink) {
393
- $(window).off('popstate', this._checkDeepLink);
394
- }
395
-
396
- }
397
- }
398
-
399
- Tabs.defaults = {
400
- /**
401
- * Allows the window to scroll to content of pane specified by hash anchor
402
- * @option
403
- * @type {boolean}
404
- * @default false
405
- */
406
- deepLink: false,
407
-
408
- /**
409
- * Adjust the deep link scroll to make sure the top of the tab panel is visible
410
- * @option
411
- * @type {boolean}
412
- * @default false
413
- */
414
- deepLinkSmudge: false,
415
-
416
- /**
417
- * Animation time (ms) for the deep link adjustment
418
- * @option
419
- * @type {number}
420
- * @default 300
421
- */
422
- deepLinkSmudgeDelay: 300,
423
-
424
- /**
425
- * Update the browser history with the open tab
426
- * @option
427
- * @type {boolean}
428
- * @default false
429
- */
430
- updateHistory: false,
431
-
432
- /**
433
- * Allows the window to scroll to content of active pane on load if set to true.
434
- * Not recommended if more than one tab panel per page.
435
- * @option
436
- * @type {boolean}
437
- * @default false
438
- */
439
- autoFocus: false,
440
-
441
- /**
442
- * Allows keyboard input to 'wrap' around the tab links.
443
- * @option
444
- * @type {boolean}
445
- * @default true
446
- */
447
- wrapOnKeys: true,
448
-
449
- /**
450
- * Allows the tab content panes to match heights if set to true.
451
- * @option
452
- * @type {boolean}
453
- * @default false
454
- */
455
- matchHeight: false,
456
-
457
- /**
458
- * Allows active tabs to collapse when clicked.
459
- * @option
460
- * @type {boolean}
461
- * @default false
462
- */
463
- activeCollapse: false,
464
-
465
- /**
466
- * Class applied to `li`'s in tab link list.
467
- * @option
468
- * @type {string}
469
- * @default 'tabs-title'
470
- */
471
- linkClass: 'tabs-title',
472
-
473
- /**
474
- * Class applied to the active `li` in tab link list.
475
- * @option
476
- * @type {string}
477
- * @default 'is-active'
478
- */
479
- linkActiveClass: 'is-active',
480
-
481
- /**
482
- * Class applied to the content containers.
483
- * @option
484
- * @type {string}
485
- * @default 'tabs-panel'
486
- */
487
- panelClass: 'tabs-panel',
488
-
489
- /**
490
- * Class applied to the active content container.
491
- * @option
492
- * @type {string}
493
- * @default 'is-active'
494
- */
495
- panelActiveClass: 'is-active'
496
- };
497
-
498
- export {Tabs};