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.
- checksums.yaml +4 -4
- data/bower.json +3 -3
- data/lib/foundation/rails/version.rb +1 -1
- data/lib/generators/foundation/install_generator.rb +1 -1
- data/lib/generators/foundation/templates/_settings.scss +291 -48
- data/vendor/assets/js/entries/foundation-plugins.js +25 -0
- data/vendor/assets/js/entries/foundation.js +101 -0
- data/vendor/assets/js/entries/plugins/foundation.abide.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.accordion.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.accordionMenu.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.core.js +21 -0
- data/vendor/assets/js/entries/plugins/foundation.drilldown.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.dropdown.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.dropdownMenu.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.equalizer.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.interchange.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.magellan.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.offcanvas.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.orbit.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.responsiveAccordionTabs.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.responsiveMenu.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.responsiveToggle.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.reveal.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.slider.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.smoothScroll.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.sticky.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.tabs.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.toggler.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.tooltip.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.util.box.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.util.imageLoader.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.util.keyboard.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.util.mediaQuery.js +4 -0
- data/vendor/assets/js/entries/plugins/foundation.util.motion.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.util.nest.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.util.timer.js +5 -0
- data/vendor/assets/js/entries/plugins/foundation.util.touch.js +7 -0
- data/vendor/assets/js/entries/plugins/foundation.util.triggers.js +5 -0
- data/vendor/assets/js/foundation.abide.js.es6 +18 -15
- data/vendor/assets/js/foundation.accordion.js.es6 +37 -23
- data/vendor/assets/js/foundation.accordionMenu.js.es6 +96 -51
- data/vendor/assets/js/foundation.core.js.es6 +46 -87
- data/vendor/assets/js/foundation.drilldown.js.es6 +47 -29
- data/vendor/assets/js/foundation.dropdown.js.es6 +84 -122
- data/vendor/assets/js/foundation.dropdownMenu.js.es6 +44 -28
- data/vendor/assets/js/foundation.equalizer.js.es6 +18 -17
- data/vendor/assets/js/foundation.interchange.js.es6 +26 -19
- data/vendor/assets/js/foundation.js.es6 +8 -3
- data/vendor/assets/js/foundation.magellan.js.es6 +36 -30
- data/vendor/assets/js/foundation.offcanvas.js.es6 +148 -36
- data/vendor/assets/js/foundation.orbit.js.es6 +26 -18
- data/vendor/assets/js/foundation.plugin.js.es6 +54 -0
- data/vendor/assets/js/foundation.positionable.js.es6 +206 -0
- data/vendor/assets/js/{foundation.zf.responsiveAccordionTabs.js.es6 → foundation.responsiveAccordionTabs.js.es6} +33 -30
- data/vendor/assets/js/foundation.responsiveMenu.js.es6 +37 -29
- data/vendor/assets/js/foundation.responsiveToggle.js.es6 +17 -16
- data/vendor/assets/js/foundation.reveal.js.es6 +61 -79
- data/vendor/assets/js/foundation.slider.js.es6 +33 -18
- data/vendor/assets/js/foundation.smoothScroll.js.es6 +135 -0
- data/vendor/assets/js/foundation.sticky.js.es6 +25 -17
- data/vendor/assets/js/foundation.tabs.js.es6 +35 -27
- data/vendor/assets/js/foundation.toggler.js.es6 +15 -13
- data/vendor/assets/js/foundation.tooltip.js.es6 +100 -108
- data/vendor/assets/js/foundation.util.box.js.es6 +114 -78
- data/vendor/assets/js/foundation.util.core.js.es6 +52 -0
- data/vendor/assets/js/foundation.util.imageLoader.js.es6 +45 -0
- data/vendor/assets/js/foundation.util.keyboard.js.es6 +41 -31
- data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +59 -55
- data/vendor/assets/js/foundation.util.motion.js.es6 +4 -5
- data/vendor/assets/js/foundation.util.nest.js.es6 +9 -23
- data/vendor/assets/js/{foundation.util.timerAndImageLoader.js.es6 → foundation.util.timer.js.es6} +2 -42
- data/vendor/assets/js/foundation.util.touch.js.es6 +91 -294
- data/vendor/assets/js/foundation.util.triggers.js.es6 +199 -141
- data/vendor/assets/scss/_global.scss +29 -1
- data/vendor/assets/scss/components/_accordion-menu.scss +148 -13
- data/vendor/assets/scss/components/_accordion.scss +5 -0
- data/vendor/assets/scss/components/_breadcrumbs.scss +26 -9
- data/vendor/assets/scss/components/_button-group.scss +4 -4
- data/vendor/assets/scss/components/_button.scss +59 -12
- data/vendor/assets/scss/components/_card.scss +10 -2
- data/vendor/assets/scss/components/_drilldown.scss +90 -41
- data/vendor/assets/scss/components/_dropdown-menu.scss +52 -6
- data/vendor/assets/scss/components/_dropdown.scss +8 -1
- data/vendor/assets/scss/components/_flex.scss +85 -2
- data/vendor/assets/scss/components/_menu.scss +267 -162
- data/vendor/assets/scss/components/_off-canvas.scss +159 -45
- data/vendor/assets/scss/components/_pagination.scss +1 -1
- data/vendor/assets/scss/components/_reveal.scss +13 -11
- data/vendor/assets/scss/components/_slider.scss +0 -1
- data/vendor/assets/scss/components/_sticky.scss +1 -0
- data/vendor/assets/scss/components/_table.scss +7 -6
- data/vendor/assets/scss/components/_tabs.scss +1 -1
- data/vendor/assets/scss/components/_title-bar.scss +1 -1
- data/vendor/assets/scss/components/_tooltip.scss +74 -21
- data/vendor/assets/scss/components/_top-bar.scss +2 -0
- data/vendor/assets/scss/forms/_fieldset.scss +0 -1
- data/vendor/assets/scss/forms/_meter.scss +7 -1
- data/vendor/assets/scss/forms/_select.scss +4 -3
- data/vendor/assets/scss/forms/_text.scss +11 -2
- data/vendor/assets/scss/foundation.scss +17 -3
- data/vendor/assets/scss/grid/_flex-grid.scss +3 -52
- data/vendor/assets/scss/prototype/_arrow.scss +36 -0
- data/vendor/assets/scss/prototype/_border-box.scss +35 -0
- data/vendor/assets/scss/prototype/_border-none.scss +35 -0
- data/vendor/assets/scss/prototype/_bordered.scss +54 -0
- data/vendor/assets/scss/prototype/_box.scss +23 -0
- data/vendor/assets/scss/prototype/_display.scss +50 -0
- data/vendor/assets/scss/prototype/_font-styling.scss +95 -0
- data/vendor/assets/scss/prototype/_list-style-type.scss +95 -0
- data/vendor/assets/scss/prototype/_overflow.scss +72 -0
- data/vendor/assets/scss/prototype/_position.scss +114 -0
- data/vendor/assets/scss/prototype/_prototype.scss +91 -0
- data/vendor/assets/scss/prototype/_relation.scss +157 -0
- data/vendor/assets/scss/prototype/_rotate.scss +31 -0
- data/vendor/assets/scss/prototype/_rounded.scss +54 -0
- data/vendor/assets/scss/prototype/_separator.scss +96 -0
- data/vendor/assets/scss/prototype/_shadow.scss +43 -0
- data/vendor/assets/scss/prototype/_sizing.scss +73 -0
- data/vendor/assets/scss/prototype/_spacing.scss +204 -0
- data/vendor/assets/scss/prototype/_text-decoration.scss +48 -0
- data/vendor/assets/scss/prototype/_text-transformation.scss +48 -0
- data/vendor/assets/scss/prototype/_text-utilities.scss +88 -0
- data/vendor/assets/scss/prototype/_typescale.scss +20 -0
- data/vendor/assets/scss/settings/_settings.scss +291 -48
- data/vendor/assets/scss/typography/_base.scss +2 -2
- data/vendor/assets/scss/typography/_helpers.scss +6 -4
- data/vendor/assets/scss/util/_breakpoint.scss +60 -1
- data/vendor/assets/scss/util/_color.scss +8 -5
- data/vendor/assets/scss/util/_mixins.scss +45 -5
- data/vendor/assets/scss/xy-grid/_cell.scss +179 -0
- data/vendor/assets/scss/xy-grid/_classes.scss +455 -0
- data/vendor/assets/scss/xy-grid/_collapse.scss +54 -0
- data/vendor/assets/scss/xy-grid/_frame.scss +54 -0
- data/vendor/assets/scss/xy-grid/_grid.scss +56 -0
- data/vendor/assets/scss/xy-grid/_gutters.scss +45 -0
- data/vendor/assets/scss/xy-grid/_layout.scss +33 -0
- data/vendor/assets/scss/xy-grid/_position.scss +28 -0
- data/vendor/assets/scss/xy-grid/_xy-grid.scss +52 -0
- metadata +73 -4
@@ -0,0 +1,25 @@
|
|
1
|
+
import { Abide } from '../foundation.abide';
|
2
|
+
import { Accordion } from '../foundation.accordion';
|
3
|
+
import { AccordionMenu } from '../foundation.accordionMenu';
|
4
|
+
import { Drilldown } from '../foundation.drilldown';
|
5
|
+
import { Dropdown } from '../foundation.dropdown';
|
6
|
+
import { DropdownMenu } from '../foundation.dropdownMenu';
|
7
|
+
import { Equalizer } from '../foundation.equalizer';
|
8
|
+
import { Interchange } from '../foundation.interchange';
|
9
|
+
import { Magellan } from '../foundation.magellan';
|
10
|
+
import { OffCanvas } from '../foundation.offcanvas';
|
11
|
+
import { Orbit } from '../foundation.orbit';
|
12
|
+
import { ResponsiveMenu } from '../foundation.responsiveMenu';
|
13
|
+
import { ResponsiveToggle } from '../foundation.responsiveToggle';
|
14
|
+
import { Reveal } from '../foundation.reveal';
|
15
|
+
import { Slider } from '../foundation.slider';
|
16
|
+
import { SmoothScroll } from '../foundation.smoothScroll';
|
17
|
+
import { Sticky } from '../foundation.sticky';
|
18
|
+
import { Tabs } from '../foundation.tabs';
|
19
|
+
import { Toggler } from '../foundation.toggler';
|
20
|
+
import { Tooltip } from '../foundation.tooltip';
|
21
|
+
import { ResponsiveAccordionTabs } from '../foundation.responsiveAccordionTabs';
|
22
|
+
|
23
|
+
export {
|
24
|
+
Abide, Accordion, AccordionMenu, Drilldown, Dropdown, DropdownMenu, Equalizer, Interchange, Magellan, OffCanvas, Orbit, ResponsiveMenu, ResponsiveToggle, Reveal, Slider, SmoothScroll, Sticky, Tabs, Toggler, Tooltip, ResponsiveAccordionTabs
|
25
|
+
}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import $ from 'jquery';
|
2
|
+
|
3
|
+
import { Foundation } from '../foundation.core';
|
4
|
+
Foundation.addToJquery($);
|
5
|
+
|
6
|
+
// Add Foundation Utils to Foundation global namespace for backwards
|
7
|
+
// compatibility.
|
8
|
+
|
9
|
+
import { rtl, GetYoDigits, transitionend } from '../foundation.util.core';
|
10
|
+
Foundation.rtl = rtl;
|
11
|
+
Foundation.GetYoDigits = GetYoDigits;
|
12
|
+
Foundation.transitionend = transitionend;
|
13
|
+
|
14
|
+
import { Box } from '../foundation.util.box'
|
15
|
+
import { onImagesLoaded } from '../foundation.util.imageLoader';
|
16
|
+
import { Keyboard } from '../foundation.util.keyboard';
|
17
|
+
import { MediaQuery } from '../foundation.util.mediaQuery';
|
18
|
+
import { Motion, Move } from '../foundation.util.motion';
|
19
|
+
import { Nest } from '../foundation.util.nest';
|
20
|
+
import { Timer } from '../foundation.util.timer';
|
21
|
+
|
22
|
+
Foundation.Box = Box;
|
23
|
+
Foundation.onImagesLoaded = onImagesLoaded;
|
24
|
+
Foundation.Keyboard = Keyboard;
|
25
|
+
Foundation.MediaQuery = MediaQuery;
|
26
|
+
Foundation.Motion = Motion;
|
27
|
+
Foundation.Move = Move;
|
28
|
+
Foundation.Nest = Nest;
|
29
|
+
Foundation.Timer = Timer;
|
30
|
+
|
31
|
+
// Touch and Triggers previously were almost purely sede effect driven,
|
32
|
+
// so no // need to add it to Foundation, just init them.
|
33
|
+
|
34
|
+
import { Touch } from '../foundation.util.touch';
|
35
|
+
Touch.init($);
|
36
|
+
|
37
|
+
import { Triggers } from '../foundation.util.triggers';
|
38
|
+
Triggers.init($, Foundation);
|
39
|
+
|
40
|
+
import { Abide } from '../foundation.abide';
|
41
|
+
Foundation.plugin(Abide, 'Abide');
|
42
|
+
|
43
|
+
import { Accordion } from '../foundation.accordion';
|
44
|
+
Foundation.plugin(Accordion, 'Accordion');
|
45
|
+
|
46
|
+
import { AccordionMenu } from '../foundation.accordionMenu';
|
47
|
+
Foundation.plugin(AccordionMenu, 'AccordionMenu');
|
48
|
+
|
49
|
+
import { Drilldown } from '../foundation.drilldown';
|
50
|
+
Foundation.plugin(Drilldown, 'Drilldown');
|
51
|
+
|
52
|
+
import { Dropdown } from '../foundation.dropdown';
|
53
|
+
Foundation.plugin(Dropdown, 'Dropdown');
|
54
|
+
|
55
|
+
import { DropdownMenu } from '../foundation.dropdownMenu';
|
56
|
+
Foundation.plugin(DropdownMenu, 'DropdownMenu');
|
57
|
+
|
58
|
+
import { Equalizer } from '../foundation.equalizer';
|
59
|
+
Foundation.plugin(Equalizer, 'Equalizer');
|
60
|
+
|
61
|
+
import { Interchange } from '../foundation.interchange';
|
62
|
+
Foundation.plugin(Interchange, 'Interchange');
|
63
|
+
|
64
|
+
import { Magellan } from '../foundation.magellan';
|
65
|
+
Foundation.plugin(Magellan, 'Magellan');
|
66
|
+
|
67
|
+
import { OffCanvas } from '../foundation.offcanvas';
|
68
|
+
Foundation.plugin(OffCanvas, 'OffCanvas');
|
69
|
+
|
70
|
+
import { Orbit } from '../foundation.orbit';
|
71
|
+
Foundation.plugin(Orbit, 'Orbit');
|
72
|
+
|
73
|
+
import { ResponsiveMenu } from '../foundation.responsiveMenu';
|
74
|
+
Foundation.plugin(ResponsiveMenu, 'ResponsiveMenu');
|
75
|
+
|
76
|
+
import { ResponsiveToggle } from '../foundation.responsiveToggle';
|
77
|
+
Foundation.plugin(ResponsiveToggle, 'ResponsiveToggle');
|
78
|
+
|
79
|
+
import { Reveal } from '../foundation.reveal';
|
80
|
+
Foundation.plugin(Reveal, 'Reveal');
|
81
|
+
|
82
|
+
import { Slider } from '../foundation.slider';
|
83
|
+
Foundation.plugin(Slider, 'Slider');
|
84
|
+
|
85
|
+
import { SmoothScroll } from '../foundation.smoothScroll';
|
86
|
+
Foundation.plugin(SmoothScroll, 'SmoothScroll');
|
87
|
+
|
88
|
+
import { Sticky } from '../foundation.sticky';
|
89
|
+
Foundation.plugin(Sticky, 'Sticky');
|
90
|
+
|
91
|
+
import { Tabs } from '../foundation.tabs';
|
92
|
+
Foundation.plugin(Tabs, 'Tabs');
|
93
|
+
|
94
|
+
import { Toggler } from '../foundation.toggler';
|
95
|
+
Foundation.plugin(Toggler, 'Toggler');
|
96
|
+
|
97
|
+
import { Tooltip } from '../foundation.tooltip';
|
98
|
+
Foundation.plugin(Tooltip, 'Tooltip');
|
99
|
+
|
100
|
+
import { ResponsiveAccordionTabs } from '../foundation.responsiveAccordionTabs';
|
101
|
+
Foundation.plugin(ResponsiveAccordionTabs, 'ResponsiveAccordionTabs');
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import $ from 'jquery';
|
2
|
+
|
3
|
+
import { Foundation } from '../../foundation.core';
|
4
|
+
Foundation.addToJquery($);
|
5
|
+
|
6
|
+
// These are now separated out, but historically were a part of this module,
|
7
|
+
// and since this is here for backwards compatibility we include them in
|
8
|
+
// this entry.
|
9
|
+
import {rtl, GetYoDigits, transitionend} from '../../foundation.util.core';
|
10
|
+
Foundation.rtl = rtl;
|
11
|
+
Foundation.GetYoDigits = GetYoDigits;
|
12
|
+
Foundation.transitionend = transitionend;
|
13
|
+
|
14
|
+
// Every plugin depends on plugin now, we can include that on the core for the
|
15
|
+
// script inclusion path.
|
16
|
+
|
17
|
+
import { Plugin } from '../../foundation.plugin';
|
18
|
+
Foundation.Plugin = Plugin;
|
19
|
+
|
20
|
+
|
21
|
+
window.Foundation = Foundation;
|
@@ -1,27 +1,28 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
import $ from 'jquery';
|
4
|
+
import { Plugin } from './foundation.plugin';
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Abide module.
|
7
8
|
* @module foundation.abide
|
8
9
|
*/
|
9
10
|
|
10
|
-
class Abide {
|
11
|
+
class Abide extends Plugin {
|
11
12
|
/**
|
12
13
|
* Creates a new instance of Abide.
|
13
14
|
* @class
|
15
|
+
* @name Abide
|
14
16
|
* @fires Abide#init
|
15
17
|
* @param {Object} element - jQuery object to add the trigger to.
|
16
18
|
* @param {Object} options - Overrides to the default plugin settings.
|
17
19
|
*/
|
18
|
-
|
20
|
+
_setup(element, options = {}) {
|
19
21
|
this.$element = element;
|
20
22
|
this.options = $.extend({}, Abide.defaults, this.$element.data(), options);
|
21
23
|
|
24
|
+
this.className = 'Abide'; // ie9 back compat
|
22
25
|
this._init();
|
23
|
-
|
24
|
-
Foundation.registerPlugin(this, 'Abide');
|
25
26
|
}
|
26
27
|
|
27
28
|
/**
|
@@ -242,7 +243,7 @@ class Abide {
|
|
242
243
|
}
|
243
244
|
|
244
245
|
/**
|
245
|
-
* Goes through a form to find inputs and proceeds to validate them in ways specific to their type.
|
246
|
+
* Goes through a form to find inputs and proceeds to validate them in ways specific to their type.
|
246
247
|
* Ignores inputs with data-abide-ignore, type="hidden" or disabled attributes set
|
247
248
|
* @fires Abide#invalid
|
248
249
|
* @fires Abide#valid
|
@@ -453,7 +454,7 @@ class Abide {
|
|
453
454
|
* Destroys an instance of Abide.
|
454
455
|
* Removes error styles and classes from elements, without resetting their values.
|
455
456
|
*/
|
456
|
-
|
457
|
+
_destroy() {
|
457
458
|
var _this = this;
|
458
459
|
this.$element
|
459
460
|
.off('.abide')
|
@@ -465,8 +466,6 @@ class Abide {
|
|
465
466
|
.each(function() {
|
466
467
|
_this.removeErrorClasses($(this));
|
467
468
|
});
|
468
|
-
|
469
|
-
Foundation.unregisterPlugin(this);
|
470
469
|
}
|
471
470
|
}
|
472
471
|
|
@@ -538,7 +537,7 @@ Abide.defaults = {
|
|
538
537
|
number : /^[-+]?\d*(?:[\.\,]\d+)?$/,
|
539
538
|
|
540
539
|
// amex, visa, diners
|
541
|
-
card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
|
540
|
+
card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(?:222[1-9]|2[3-6][0-9]{2}|27[0-1][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
|
542
541
|
cvv : /^([0-9]){3,4}$/,
|
543
542
|
|
544
543
|
// http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
|
@@ -560,7 +559,14 @@ Abide.defaults = {
|
|
560
559
|
day_month_year : /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
|
561
560
|
|
562
561
|
// #FFF or #FFFFFF
|
563
|
-
color : /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})
|
562
|
+
color : /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
|
563
|
+
|
564
|
+
// Domain || URL
|
565
|
+
website: {
|
566
|
+
test: (text) => {
|
567
|
+
return Abide.defaults.patterns['domain'].test(text) || Abide.defaults.patterns['url'].test(text);
|
568
|
+
}
|
569
|
+
}
|
564
570
|
},
|
565
571
|
|
566
572
|
/**
|
@@ -578,7 +584,4 @@ Abide.defaults = {
|
|
578
584
|
}
|
579
585
|
}
|
580
586
|
|
581
|
-
|
582
|
-
Foundation.plugin(Abide, 'Abide');
|
583
|
-
|
584
|
-
}(jQuery);
|
587
|
+
export {Abide};
|
@@ -1,30 +1,33 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
import $ from 'jquery';
|
4
|
+
import { Keyboard } from './foundation.util.keyboard';
|
5
|
+
import { GetYoDigits } from './foundation.util.core';
|
6
|
+
import { Plugin } from './foundation.plugin';
|
4
7
|
|
5
8
|
/**
|
6
9
|
* Accordion module.
|
7
10
|
* @module foundation.accordion
|
8
11
|
* @requires foundation.util.keyboard
|
9
|
-
* @requires foundation.util.motion
|
10
12
|
*/
|
11
13
|
|
12
|
-
class Accordion {
|
14
|
+
class Accordion extends Plugin {
|
13
15
|
/**
|
14
16
|
* Creates a new instance of an accordion.
|
15
17
|
* @class
|
18
|
+
* @name Accordion
|
16
19
|
* @fires Accordion#init
|
17
20
|
* @param {jQuery} element - jQuery object to make into an accordion.
|
18
21
|
* @param {Object} options - a plain object with settings to override the default options.
|
19
22
|
*/
|
20
|
-
|
23
|
+
_setup(element, options) {
|
21
24
|
this.$element = element;
|
22
25
|
this.options = $.extend({}, Accordion.defaults, this.$element.data(), options);
|
23
26
|
|
27
|
+
this.className = 'Accordion'; // ie9 back compat
|
24
28
|
this._init();
|
25
29
|
|
26
|
-
|
27
|
-
Foundation.Keyboard.register('Accordion', {
|
30
|
+
Keyboard.register('Accordion', {
|
28
31
|
'ENTER': 'toggle',
|
29
32
|
'SPACE': 'toggle',
|
30
33
|
'ARROW_DOWN': 'next',
|
@@ -43,7 +46,7 @@ class Accordion {
|
|
43
46
|
this.$tabs.each(function(idx, el) {
|
44
47
|
var $el = $(el),
|
45
48
|
$content = $el.children('[data-tab-content]'),
|
46
|
-
id = $content[0].id ||
|
49
|
+
id = $content[0].id || GetYoDigits(6, 'accordion'),
|
47
50
|
linkId = el.id || `${id}-label`;
|
48
51
|
|
49
52
|
$el.find('a:first').attr({
|
@@ -118,7 +121,7 @@ class Accordion {
|
|
118
121
|
e.preventDefault();
|
119
122
|
_this.toggle($tabContent);
|
120
123
|
}).on('keydown.zf.accordion', function(e){
|
121
|
-
|
124
|
+
Keyboard.handleKey(e, 'Accordion', {
|
122
125
|
toggle: function() {
|
123
126
|
_this.toggle($tabContent);
|
124
127
|
},
|
@@ -153,6 +156,10 @@ class Accordion {
|
|
153
156
|
* @function
|
154
157
|
*/
|
155
158
|
toggle($target) {
|
159
|
+
if ($target.closest('[data-accordion]').is('[disabled]')) {
|
160
|
+
console.info('Cannot toggle an accordion that is disabled.');
|
161
|
+
return;
|
162
|
+
}
|
156
163
|
if($target.parent().hasClass('is-active')) {
|
157
164
|
this.up($target);
|
158
165
|
} else {
|
@@ -178,6 +185,14 @@ class Accordion {
|
|
178
185
|
* @function
|
179
186
|
*/
|
180
187
|
down($target, firstTime) {
|
188
|
+
/**
|
189
|
+
* checking firstTime allows for initial render of the accordion
|
190
|
+
* to render preset is-active panes.
|
191
|
+
*/
|
192
|
+
if ($target.closest('[data-accordion]').is('[disabled]') && !firstTime) {
|
193
|
+
console.info('Cannot call down on an accordion that is disabled.');
|
194
|
+
return;
|
195
|
+
}
|
181
196
|
$target
|
182
197
|
.attr('aria-hidden', false)
|
183
198
|
.parent('[data-tab-content]')
|
@@ -212,6 +227,11 @@ class Accordion {
|
|
212
227
|
* @function
|
213
228
|
*/
|
214
229
|
up($target) {
|
230
|
+
if ($target.closest('[data-accordion]').is('[disabled]')) {
|
231
|
+
console.info('Cannot call up on an accordion that is disabled.');
|
232
|
+
return;
|
233
|
+
}
|
234
|
+
|
215
235
|
var $aunts = $target.parent().siblings(),
|
216
236
|
_this = this;
|
217
237
|
|
@@ -219,15 +239,13 @@ class Accordion {
|
|
219
239
|
return;
|
220
240
|
}
|
221
241
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
});
|
230
|
-
// });
|
242
|
+
$target.slideUp(_this.options.slideSpeed, function () {
|
243
|
+
/**
|
244
|
+
* Fires when the tab is done collapsing up.
|
245
|
+
* @event Accordion#up
|
246
|
+
*/
|
247
|
+
_this.$element.trigger('up.zf.accordion', [$target]);
|
248
|
+
});
|
231
249
|
|
232
250
|
$target.attr('aria-hidden', true)
|
233
251
|
.parent().removeClass('is-active');
|
@@ -243,14 +261,13 @@ class Accordion {
|
|
243
261
|
* @fires Accordion#destroyed
|
244
262
|
* @function
|
245
263
|
*/
|
246
|
-
|
264
|
+
_destroy() {
|
247
265
|
this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', '');
|
248
266
|
this.$element.find('a').off('.zf.accordion');
|
249
267
|
if(this.options.deepLink) {
|
250
268
|
$(window).off('popstate', this._checkDeepLink);
|
251
269
|
}
|
252
270
|
|
253
|
-
Foundation.unregisterPlugin(this);
|
254
271
|
}
|
255
272
|
}
|
256
273
|
|
@@ -309,7 +326,4 @@ Accordion.defaults = {
|
|
309
326
|
updateHistory: false
|
310
327
|
};
|
311
328
|
|
312
|
-
|
313
|
-
Foundation.plugin(Accordion, 'Accordion');
|
314
|
-
|
315
|
-
}(jQuery);
|
329
|
+
export {Accordion};
|