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
@@ -1,6 +1,32 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
import $ from 'jquery';
|
4
|
+
|
5
|
+
import { MediaQuery } from './foundation.util.mediaQuery';
|
6
|
+
import { GetYoDigits } from './foundation.util.core';
|
7
|
+
import { Plugin } from './foundation.plugin';
|
8
|
+
|
9
|
+
import { DropdownMenu } from './foundation.dropdownMenu';
|
10
|
+
import { Drilldown } from './foundation.drilldown';
|
11
|
+
import { AccordionMenu } from './foundation.accordionMenu';
|
12
|
+
|
13
|
+
let MenuPlugins = {
|
14
|
+
dropdown: {
|
15
|
+
cssClass: 'dropdown',
|
16
|
+
plugin: DropdownMenu
|
17
|
+
},
|
18
|
+
drilldown: {
|
19
|
+
cssClass: 'drilldown',
|
20
|
+
plugin: Drilldown
|
21
|
+
},
|
22
|
+
accordion: {
|
23
|
+
cssClass: 'accordion-menu',
|
24
|
+
plugin: AccordionMenu
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
// import "foundation.util.triggers.js";
|
29
|
+
|
4
30
|
|
5
31
|
/**
|
6
32
|
* ResponsiveMenu module.
|
@@ -9,24 +35,24 @@
|
|
9
35
|
* @requires foundation.util.mediaQuery
|
10
36
|
*/
|
11
37
|
|
12
|
-
class ResponsiveMenu {
|
38
|
+
class ResponsiveMenu extends Plugin {
|
13
39
|
/**
|
14
40
|
* Creates a new instance of a responsive menu.
|
15
41
|
* @class
|
42
|
+
* @name ResponsiveMenu
|
16
43
|
* @fires ResponsiveMenu#init
|
17
44
|
* @param {jQuery} element - jQuery object to make into a dropdown menu.
|
18
45
|
* @param {Object} options - Overrides to the default plugin settings.
|
19
46
|
*/
|
20
|
-
|
47
|
+
_setup(element, options) {
|
21
48
|
this.$element = $(element);
|
22
49
|
this.rules = this.$element.data('responsive-menu');
|
23
50
|
this.currentMq = null;
|
24
51
|
this.currentPlugin = null;
|
52
|
+
this.className = 'ResponsiveMenu'; // ie9 back compat
|
25
53
|
|
26
54
|
this._init();
|
27
55
|
this._events();
|
28
|
-
|
29
|
-
Foundation.registerPlugin(this, 'ResponsiveMenu');
|
30
56
|
}
|
31
57
|
|
32
58
|
/**
|
@@ -35,6 +61,8 @@ class ResponsiveMenu {
|
|
35
61
|
* @private
|
36
62
|
*/
|
37
63
|
_init() {
|
64
|
+
|
65
|
+
MediaQuery._init();
|
38
66
|
// The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules
|
39
67
|
if (typeof this.rules === 'string') {
|
40
68
|
let rulesTree = {};
|
@@ -60,7 +88,7 @@ class ResponsiveMenu {
|
|
60
88
|
this._checkMediaQueries();
|
61
89
|
}
|
62
90
|
// Add data-mutate since children may need it.
|
63
|
-
this.$element.attr('data-mutate', (this.$element.attr('data-mutate') ||
|
91
|
+
this.$element.attr('data-mutate', (this.$element.attr('data-mutate') || GetYoDigits(6, 'responsive-menu')));
|
64
92
|
}
|
65
93
|
|
66
94
|
/**
|
@@ -88,7 +116,7 @@ class ResponsiveMenu {
|
|
88
116
|
var matchedMq, _this = this;
|
89
117
|
// Iterate through each rule and find the last matching rule
|
90
118
|
$.each(this.rules, function(key) {
|
91
|
-
if (
|
119
|
+
if (MediaQuery.atLeast(key)) {
|
92
120
|
matchedMq = key;
|
93
121
|
}
|
94
122
|
});
|
@@ -116,32 +144,12 @@ class ResponsiveMenu {
|
|
116
144
|
* Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out.
|
117
145
|
* @function
|
118
146
|
*/
|
119
|
-
|
147
|
+
_destroy() {
|
120
148
|
this.currentPlugin.destroy();
|
121
149
|
$(window).off('.zf.ResponsiveMenu');
|
122
|
-
Foundation.unregisterPlugin(this);
|
123
150
|
}
|
124
151
|
}
|
125
152
|
|
126
153
|
ResponsiveMenu.defaults = {};
|
127
154
|
|
128
|
-
|
129
|
-
var MenuPlugins = {
|
130
|
-
dropdown: {
|
131
|
-
cssClass: 'dropdown',
|
132
|
-
plugin: Foundation._plugins['dropdown-menu'] || null
|
133
|
-
},
|
134
|
-
drilldown: {
|
135
|
-
cssClass: 'drilldown',
|
136
|
-
plugin: Foundation._plugins['drilldown'] || null
|
137
|
-
},
|
138
|
-
accordion: {
|
139
|
-
cssClass: 'accordion-menu',
|
140
|
-
plugin: Foundation._plugins['accordion-menu'] || null
|
141
|
-
}
|
142
|
-
};
|
143
|
-
|
144
|
-
// Window exports
|
145
|
-
Foundation.plugin(ResponsiveMenu, 'ResponsiveMenu');
|
146
|
-
|
147
|
-
}(jQuery);
|
155
|
+
export {ResponsiveMenu};
|
@@ -1,29 +1,34 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
import $ from 'jquery';
|
4
|
+
|
5
|
+
import { MediaQuery } from './foundation.util.mediaQuery';
|
6
|
+
import { Motion } from './foundation.util.motion';
|
7
|
+
import { Plugin } from './foundation.plugin';
|
4
8
|
|
5
9
|
/**
|
6
10
|
* ResponsiveToggle module.
|
7
11
|
* @module foundation.responsiveToggle
|
8
12
|
* @requires foundation.util.mediaQuery
|
13
|
+
* @requires foundation.util.motion
|
9
14
|
*/
|
10
15
|
|
11
|
-
class ResponsiveToggle {
|
16
|
+
class ResponsiveToggle extends Plugin {
|
12
17
|
/**
|
13
18
|
* Creates a new instance of Tab Bar.
|
14
19
|
* @class
|
20
|
+
* @name ResponsiveToggle
|
15
21
|
* @fires ResponsiveToggle#init
|
16
22
|
* @param {jQuery} element - jQuery object to attach tab bar functionality to.
|
17
23
|
* @param {Object} options - Overrides to the default plugin settings.
|
18
24
|
*/
|
19
|
-
|
25
|
+
_setup(element, options) {
|
20
26
|
this.$element = $(element);
|
21
27
|
this.options = $.extend({}, ResponsiveToggle.defaults, this.$element.data(), options);
|
28
|
+
this.className = 'ResponsiveToggle'; // ie9 back compat
|
22
29
|
|
23
30
|
this._init();
|
24
31
|
this._events();
|
25
|
-
|
26
|
-
Foundation.registerPlugin(this, 'ResponsiveToggle');
|
27
32
|
}
|
28
33
|
|
29
34
|
/**
|
@@ -32,6 +37,7 @@ class ResponsiveToggle {
|
|
32
37
|
* @private
|
33
38
|
*/
|
34
39
|
_init() {
|
40
|
+
MediaQuery._init();
|
35
41
|
var targetID = this.$element.data('responsive-toggle');
|
36
42
|
if (!targetID) {
|
37
43
|
console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.');
|
@@ -77,7 +83,7 @@ class ResponsiveToggle {
|
|
77
83
|
*/
|
78
84
|
_update() {
|
79
85
|
// Mobile
|
80
|
-
if (!
|
86
|
+
if (!MediaQuery.atLeast(this.options.hideFor)) {
|
81
87
|
this.$element.show();
|
82
88
|
this.$targetMenu.hide();
|
83
89
|
}
|
@@ -95,20 +101,20 @@ class ResponsiveToggle {
|
|
95
101
|
* @fires ResponsiveToggle#toggled
|
96
102
|
*/
|
97
103
|
toggleMenu() {
|
98
|
-
if (!
|
104
|
+
if (!MediaQuery.atLeast(this.options.hideFor)) {
|
99
105
|
/**
|
100
106
|
* Fires when the element attached to the tab bar toggles.
|
101
107
|
* @event ResponsiveToggle#toggled
|
102
108
|
*/
|
103
109
|
if(this.options.animate) {
|
104
110
|
if (this.$targetMenu.is(':hidden')) {
|
105
|
-
|
111
|
+
Motion.animateIn(this.$targetMenu, this.animationIn, () => {
|
106
112
|
this.$element.trigger('toggled.zf.responsiveToggle');
|
107
113
|
this.$targetMenu.find('[data-mutate]').triggerHandler('mutateme.zf.trigger');
|
108
114
|
});
|
109
115
|
}
|
110
116
|
else {
|
111
|
-
|
117
|
+
Motion.animateOut(this.$targetMenu, this.animationOut, () => {
|
112
118
|
this.$element.trigger('toggled.zf.responsiveToggle');
|
113
119
|
});
|
114
120
|
}
|
@@ -121,13 +127,11 @@ class ResponsiveToggle {
|
|
121
127
|
}
|
122
128
|
};
|
123
129
|
|
124
|
-
|
130
|
+
_destroy() {
|
125
131
|
this.$element.off('.zf.responsiveToggle');
|
126
132
|
this.$toggler.off('.zf.responsiveToggle');
|
127
133
|
|
128
134
|
$(window).off('changed.zf.mediaquery', this._updateMqHandler);
|
129
|
-
|
130
|
-
Foundation.unregisterPlugin(this);
|
131
135
|
}
|
132
136
|
}
|
133
137
|
|
@@ -149,7 +153,4 @@ ResponsiveToggle.defaults = {
|
|
149
153
|
animate: false
|
150
154
|
};
|
151
155
|
|
152
|
-
|
153
|
-
Foundation.plugin(ResponsiveToggle, 'ResponsiveToggle');
|
154
|
-
|
155
|
-
}(jQuery);
|
156
|
+
export { ResponsiveToggle };
|
@@ -1,33 +1,39 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
import $ from 'jquery';
|
4
|
+
import { Keyboard } from './foundation.util.keyboard';
|
5
|
+
import { MediaQuery } from './foundation.util.mediaQuery';
|
6
|
+
import { Motion } from './foundation.util.motion';
|
7
|
+
import { Plugin } from './foundation.plugin';
|
8
|
+
import { Triggers } from './foundation.util.triggers';
|
4
9
|
|
5
10
|
/**
|
6
11
|
* Reveal module.
|
7
12
|
* @module foundation.reveal
|
8
13
|
* @requires foundation.util.keyboard
|
9
|
-
* @requires foundation.util.box
|
10
14
|
* @requires foundation.util.triggers
|
11
15
|
* @requires foundation.util.mediaQuery
|
12
16
|
* @requires foundation.util.motion if using animations
|
13
17
|
*/
|
14
18
|
|
15
|
-
class Reveal {
|
19
|
+
class Reveal extends Plugin {
|
16
20
|
/**
|
17
21
|
* Creates a new instance of Reveal.
|
18
22
|
* @class
|
23
|
+
* @name Reveal
|
19
24
|
* @param {jQuery} element - jQuery object to use for the modal.
|
20
25
|
* @param {Object} options - optional parameters.
|
21
26
|
*/
|
22
|
-
|
27
|
+
_setup(element, options) {
|
23
28
|
this.$element = element;
|
24
29
|
this.options = $.extend({}, Reveal.defaults, this.$element.data(), options);
|
30
|
+
this.className = 'Reveal'; // ie9 back compat
|
25
31
|
this._init();
|
26
32
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
33
|
+
// Triggers init is idempotent, just need to make sure it is initialized
|
34
|
+
Triggers.init($);
|
35
|
+
|
36
|
+
Keyboard.register('Reveal', {
|
31
37
|
'ESCAPE': 'close',
|
32
38
|
});
|
33
39
|
}
|
@@ -37,9 +43,10 @@ class Reveal {
|
|
37
43
|
* @private
|
38
44
|
*/
|
39
45
|
_init() {
|
46
|
+
MediaQuery._init();
|
40
47
|
this.id = this.$element.attr('id');
|
41
48
|
this.isActive = false;
|
42
|
-
this.cached = {mq:
|
49
|
+
this.cached = {mq: MediaQuery.current};
|
43
50
|
this.isMobile = mobileSniff();
|
44
51
|
|
45
52
|
this.$anchor = $(`[data-open="${this.id}"]`).length ? $(`[data-open="${this.id}"]`) : $(`[data-toggle="${this.id}"]`);
|
@@ -81,8 +88,14 @@ class Reveal {
|
|
81
88
|
* @private
|
82
89
|
*/
|
83
90
|
_makeOverlay() {
|
91
|
+
var additionalOverlayClasses = '';
|
92
|
+
|
93
|
+
if (this.options.additionalOverlayClasses) {
|
94
|
+
additionalOverlayClasses = ' ' + this.options.additionalOverlayClasses;
|
95
|
+
}
|
96
|
+
|
84
97
|
return $('<div></div>')
|
85
|
-
.addClass('reveal-overlay')
|
98
|
+
.addClass('reveal-overlay' + additionalOverlayClasses)
|
86
99
|
.appendTo(this.options.appendTo);
|
87
100
|
}
|
88
101
|
|
@@ -142,16 +155,6 @@ class Reveal {
|
|
142
155
|
}
|
143
156
|
});
|
144
157
|
|
145
|
-
if (this.$anchor.length) {
|
146
|
-
this.$anchor.on('keydown.zf.reveal', function(e) {
|
147
|
-
if (e.which === 13 || e.which === 32) {
|
148
|
-
e.stopPropagation();
|
149
|
-
e.preventDefault();
|
150
|
-
_this.open();
|
151
|
-
}
|
152
|
-
});
|
153
|
-
}
|
154
|
-
|
155
158
|
if (this.options.closeOnClick && this.options.overlay) {
|
156
159
|
this.$overlay.off('.zf.reveal').on('click.zf.reveal', function(e) {
|
157
160
|
if (e.target === _this.$element[0] ||
|
@@ -184,11 +187,16 @@ class Reveal {
|
|
184
187
|
* @fires Reveal#open
|
185
188
|
*/
|
186
189
|
open() {
|
190
|
+
// either update or replace browser history
|
187
191
|
if (this.options.deepLink) {
|
188
192
|
var hash = `#${this.id}`;
|
189
193
|
|
190
194
|
if (window.history.pushState) {
|
191
|
-
|
195
|
+
if (this.options.updateHistory) {
|
196
|
+
window.history.pushState({}, '', hash);
|
197
|
+
} else {
|
198
|
+
window.history.replaceState({}, '', hash);
|
199
|
+
}
|
192
200
|
} else {
|
193
201
|
window.location.hash = hash;
|
194
202
|
}
|
@@ -253,14 +261,14 @@ class Reveal {
|
|
253
261
|
})
|
254
262
|
.focus();
|
255
263
|
addRevealOpenClasses();
|
256
|
-
|
264
|
+
Keyboard.trapFocus(_this.$element);
|
257
265
|
}
|
258
266
|
if (this.options.overlay) {
|
259
|
-
|
267
|
+
Motion.animateIn(this.$overlay, 'fade-in');
|
260
268
|
}
|
261
|
-
|
269
|
+
Motion.animateIn(this.$element, this.options.animationIn, () => {
|
262
270
|
if(this.$element) { // protect against object having been removed
|
263
|
-
this.focusableElements =
|
271
|
+
this.focusableElements = Keyboard.findFocusable(this.$element);
|
264
272
|
afterAnimation();
|
265
273
|
}
|
266
274
|
});
|
@@ -280,19 +288,17 @@ class Reveal {
|
|
280
288
|
'tabindex': -1
|
281
289
|
})
|
282
290
|
.focus();
|
283
|
-
|
291
|
+
Keyboard.trapFocus(this.$element);
|
292
|
+
|
293
|
+
addRevealOpenClasses();
|
294
|
+
|
295
|
+
this._extraHandlers();
|
284
296
|
|
285
297
|
/**
|
286
298
|
* Fires when the modal has successfully opened.
|
287
299
|
* @event Reveal#open
|
288
300
|
*/
|
289
301
|
this.$element.trigger('open.zf.reveal');
|
290
|
-
|
291
|
-
addRevealOpenClasses();
|
292
|
-
|
293
|
-
setTimeout(() => {
|
294
|
-
this._extraHandlers();
|
295
|
-
}, 0);
|
296
302
|
}
|
297
303
|
|
298
304
|
/**
|
@@ -302,7 +308,7 @@ class Reveal {
|
|
302
308
|
_extraHandlers() {
|
303
309
|
var _this = this;
|
304
310
|
if(!this.$element) { return; } // If we're in the middle of cleanup, don't freak out
|
305
|
-
this.focusableElements =
|
311
|
+
this.focusableElements = Keyboard.findFocusable(this.$element);
|
306
312
|
|
307
313
|
if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) {
|
308
314
|
$('body').on('click.zf.reveal', function(e) {
|
@@ -315,44 +321,15 @@ class Reveal {
|
|
315
321
|
|
316
322
|
if (this.options.closeOnEsc) {
|
317
323
|
$(window).on('keydown.zf.reveal', function(e) {
|
318
|
-
|
324
|
+
Keyboard.handleKey(e, 'Reveal', {
|
319
325
|
close: function() {
|
320
326
|
if (_this.options.closeOnEsc) {
|
321
327
|
_this.close();
|
322
|
-
_this.$anchor.focus();
|
323
328
|
}
|
324
329
|
}
|
325
330
|
});
|
326
331
|
});
|
327
332
|
}
|
328
|
-
|
329
|
-
// lock focus within modal while tabbing
|
330
|
-
this.$element.on('keydown.zf.reveal', function(e) {
|
331
|
-
var $target = $(this);
|
332
|
-
// handle keyboard event with keyboard util
|
333
|
-
Foundation.Keyboard.handleKey(e, 'Reveal', {
|
334
|
-
open: function() {
|
335
|
-
if (_this.$element.find(':focus').is(_this.$element.find('[data-close]'))) {
|
336
|
-
setTimeout(function() { // set focus back to anchor if close button has been activated
|
337
|
-
_this.$anchor.focus();
|
338
|
-
}, 1);
|
339
|
-
} else if ($target.is(_this.focusableElements)) { // dont't trigger if acual element has focus (i.e. inputs, links, ...)
|
340
|
-
_this.open();
|
341
|
-
}
|
342
|
-
},
|
343
|
-
close: function() {
|
344
|
-
if (_this.options.closeOnEsc) {
|
345
|
-
_this.close();
|
346
|
-
_this.$anchor.focus();
|
347
|
-
}
|
348
|
-
},
|
349
|
-
handled: function(preventDefault) {
|
350
|
-
if (preventDefault) {
|
351
|
-
e.preventDefault();
|
352
|
-
}
|
353
|
-
}
|
354
|
-
});
|
355
|
-
});
|
356
333
|
}
|
357
334
|
|
358
335
|
/**
|
@@ -369,17 +346,13 @@ class Reveal {
|
|
369
346
|
// Motion UI method of hiding
|
370
347
|
if (this.options.animationOut) {
|
371
348
|
if (this.options.overlay) {
|
372
|
-
|
373
|
-
}
|
374
|
-
else {
|
375
|
-
finishUp();
|
349
|
+
Motion.animateOut(this.$overlay, 'fade-out');
|
376
350
|
}
|
377
351
|
|
378
|
-
|
352
|
+
Motion.animateOut(this.$element, this.options.animationOut, finishUp);
|
379
353
|
}
|
380
354
|
// jQuery method of hiding
|
381
355
|
else {
|
382
|
-
|
383
356
|
this.$element.hide(this.options.hideDelay);
|
384
357
|
|
385
358
|
if (this.options.overlay) {
|
@@ -418,7 +391,7 @@ class Reveal {
|
|
418
391
|
}
|
419
392
|
|
420
393
|
|
421
|
-
|
394
|
+
Keyboard.releaseFocus(_this.$element);
|
422
395
|
|
423
396
|
_this.$element.attr('aria-hidden', true);
|
424
397
|
|
@@ -445,6 +418,8 @@ class Reveal {
|
|
445
418
|
window.location.hash = '';
|
446
419
|
}
|
447
420
|
}
|
421
|
+
|
422
|
+
this.$anchor.focus();
|
448
423
|
}
|
449
424
|
|
450
425
|
/**
|
@@ -463,7 +438,7 @@ class Reveal {
|
|
463
438
|
* Destroys an instance of a modal.
|
464
439
|
* @function
|
465
440
|
*/
|
466
|
-
|
441
|
+
_destroy() {
|
467
442
|
if (this.options.overlay) {
|
468
443
|
this.$element.appendTo($(this.options.appendTo)); // move $element outside of $overlay to prevent error unregisterPlugin()
|
469
444
|
this.$overlay.hide().off().remove();
|
@@ -471,8 +446,6 @@ class Reveal {
|
|
471
446
|
this.$element.hide().off();
|
472
447
|
this.$anchor.off('.zf');
|
473
448
|
$(window).off(`.zf.reveal:${this.id}`);
|
474
|
-
|
475
|
-
Foundation.unregisterPlugin(this);
|
476
449
|
};
|
477
450
|
}
|
478
451
|
|
@@ -575,19 +548,28 @@ Reveal.defaults = {
|
|
575
548
|
* @default false
|
576
549
|
*/
|
577
550
|
deepLink: false,
|
551
|
+
/**
|
552
|
+
* Update the browser history with the open modal
|
553
|
+
* @option
|
554
|
+
* @default false
|
555
|
+
*/
|
556
|
+
updateHistory: false,
|
578
557
|
/**
|
579
558
|
* Allows the modal to append to custom div.
|
580
559
|
* @option
|
581
560
|
* @type {string}
|
582
561
|
* @default "body"
|
583
562
|
*/
|
584
|
-
appendTo: "body"
|
585
|
-
|
563
|
+
appendTo: "body",
|
564
|
+
/**
|
565
|
+
* Allows adding additional class names to the reveal overlay.
|
566
|
+
* @option
|
567
|
+
* @type {string}
|
568
|
+
* @default ''
|
569
|
+
*/
|
570
|
+
additionalOverlayClasses: ''
|
586
571
|
};
|
587
572
|
|
588
|
-
// Window exports
|
589
|
-
Foundation.plugin(Reveal, 'Reveal');
|
590
|
-
|
591
573
|
function iPhoneSniff() {
|
592
574
|
return /iP(ad|hone|od).*OS/.test(window.navigator.userAgent);
|
593
575
|
}
|
@@ -600,4 +582,4 @@ function mobileSniff() {
|
|
600
582
|
return iPhoneSniff() || androidSniff();
|
601
583
|
}
|
602
584
|
|
603
|
-
}
|
585
|
+
export {Reveal};
|