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,52 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import $ from 'jquery';
|
4
|
+
|
5
|
+
// Core Foundation Utilities, utilized in a number of places.
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Returns a boolean for RTL support
|
9
|
+
*/
|
10
|
+
function rtl() {
|
11
|
+
return $('html').attr('dir') === 'rtl';
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* returns a random base-36 uid with namespacing
|
16
|
+
* @function
|
17
|
+
* @param {Number} length - number of random base-36 digits desired. Increase for more random strings.
|
18
|
+
* @param {String} namespace - name of plugin to be incorporated in uid, optional.
|
19
|
+
* @default {String} '' - if no plugin name is provided, nothing is appended to the uid.
|
20
|
+
* @returns {String} - unique id
|
21
|
+
*/
|
22
|
+
function GetYoDigits(length, namespace){
|
23
|
+
length = length || 6;
|
24
|
+
return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? `-${namespace}` : '');
|
25
|
+
}
|
26
|
+
|
27
|
+
function transitionend($elem){
|
28
|
+
var transitions = {
|
29
|
+
'transition': 'transitionend',
|
30
|
+
'WebkitTransition': 'webkitTransitionEnd',
|
31
|
+
'MozTransition': 'transitionend',
|
32
|
+
'OTransition': 'otransitionend'
|
33
|
+
};
|
34
|
+
var elem = document.createElement('div'),
|
35
|
+
end;
|
36
|
+
|
37
|
+
for (var t in transitions){
|
38
|
+
if (typeof elem.style[t] !== 'undefined'){
|
39
|
+
end = transitions[t];
|
40
|
+
}
|
41
|
+
}
|
42
|
+
if(end){
|
43
|
+
return end;
|
44
|
+
}else{
|
45
|
+
end = setTimeout(function(){
|
46
|
+
$elem.triggerHandler('transitionend', [$elem]);
|
47
|
+
}, 1);
|
48
|
+
return 'transitionend';
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
export {rtl, GetYoDigits, transitionend};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
import $ from 'jquery';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Runs a callback function when images are fully loaded.
|
7
|
+
* @param {Object} images - Image(s) to check if loaded.
|
8
|
+
* @param {Func} callback - Function to execute when image is fully loaded.
|
9
|
+
*/
|
10
|
+
function onImagesLoaded(images, callback){
|
11
|
+
var self = this,
|
12
|
+
unloaded = images.length;
|
13
|
+
|
14
|
+
if (unloaded === 0) {
|
15
|
+
callback();
|
16
|
+
}
|
17
|
+
|
18
|
+
images.each(function(){
|
19
|
+
// Check if image is loaded
|
20
|
+
if (this.complete && this.naturalWidth !== undefined) {
|
21
|
+
singleImageLoaded();
|
22
|
+
}
|
23
|
+
else {
|
24
|
+
// If the above check failed, simulate loading on detached element.
|
25
|
+
var image = new Image();
|
26
|
+
// Still count image as loaded if it finalizes with an error.
|
27
|
+
var events = "load.zf.images error.zf.images";
|
28
|
+
$(image).one(events, function me(event){
|
29
|
+
// Unbind the event listeners. We're using 'one' but only one of the two events will have fired.
|
30
|
+
$(this).off(events, me);
|
31
|
+
singleImageLoaded();
|
32
|
+
});
|
33
|
+
image.src = $(this).attr('src');
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
function singleImageLoaded() {
|
38
|
+
unloaded--;
|
39
|
+
if (unloaded === 0) {
|
40
|
+
callback();
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
export { onImagesLoaded };
|
@@ -8,13 +8,16 @@
|
|
8
8
|
|
9
9
|
'use strict';
|
10
10
|
|
11
|
-
|
11
|
+
import $ from 'jquery';
|
12
|
+
import { rtl as Rtl } from './foundation.util.core';
|
12
13
|
|
13
14
|
const keyCodes = {
|
14
15
|
9: 'TAB',
|
15
16
|
13: 'ENTER',
|
16
17
|
27: 'ESCAPE',
|
17
18
|
32: 'SPACE',
|
19
|
+
35: 'END',
|
20
|
+
36: 'HOME',
|
18
21
|
37: 'ARROW_LEFT',
|
19
22
|
38: 'ARROW_UP',
|
20
23
|
39: 'ARROW_RIGHT',
|
@@ -23,6 +26,31 @@ const keyCodes = {
|
|
23
26
|
|
24
27
|
var commands = {}
|
25
28
|
|
29
|
+
// Functions pulled out to be referenceable from internals
|
30
|
+
function findFocusable($element) {
|
31
|
+
if(!$element) {return false; }
|
32
|
+
return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function() {
|
33
|
+
if (!$(this).is(':visible') || $(this).attr('tabindex') < 0) { return false; } //only have visible elements and those that have a tabindex greater or equal 0
|
34
|
+
return true;
|
35
|
+
});
|
36
|
+
}
|
37
|
+
|
38
|
+
function parseKey(event) {
|
39
|
+
var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase();
|
40
|
+
|
41
|
+
// Remove un-printable characters, e.g. for `fromCharCode` calls for CTRL only events
|
42
|
+
key = key.replace(/\W+/, '');
|
43
|
+
|
44
|
+
if (event.shiftKey) key = `SHIFT_${key}`;
|
45
|
+
if (event.ctrlKey) key = `CTRL_${key}`;
|
46
|
+
if (event.altKey) key = `ALT_${key}`;
|
47
|
+
|
48
|
+
// Remove trailing underscore, in case only modifiers were used (e.g. only `CTRL_ALT`)
|
49
|
+
key = key.replace(/_$/, '');
|
50
|
+
|
51
|
+
return key;
|
52
|
+
}
|
53
|
+
|
26
54
|
var Keyboard = {
|
27
55
|
keys: getKeyCodes(keyCodes),
|
28
56
|
|
@@ -32,21 +60,7 @@ var Keyboard = {
|
|
32
60
|
* @param {Event} event - the event generated by the event handler
|
33
61
|
* @return String key - String that represents the key pressed
|
34
62
|
*/
|
35
|
-
parseKey
|
36
|
-
var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase();
|
37
|
-
|
38
|
-
// Remove un-printable characters, e.g. for `fromCharCode` calls for CTRL only events
|
39
|
-
key = key.replace(/\W+/, '');
|
40
|
-
|
41
|
-
if (event.shiftKey) key = `SHIFT_${key}`;
|
42
|
-
if (event.ctrlKey) key = `CTRL_${key}`;
|
43
|
-
if (event.altKey) key = `ALT_${key}`;
|
44
|
-
|
45
|
-
// Remove trailing underscore, in case only modifiers were used (e.g. only `CTRL_ALT`)
|
46
|
-
key = key.replace(/_$/, '');
|
47
|
-
|
48
|
-
return key;
|
49
|
-
},
|
63
|
+
parseKey: parseKey,
|
50
64
|
|
51
65
|
/**
|
52
66
|
* Handles the given (keyboard) event
|
@@ -66,7 +80,7 @@ var Keyboard = {
|
|
66
80
|
if (typeof commandList.ltr === 'undefined') { // this component does not differentiate between ltr and rtl
|
67
81
|
cmds = commandList; // use plain list
|
68
82
|
} else { // merge ltr and rtl: if document is rtl, rtl overwrites ltr and vice versa
|
69
|
-
if (
|
83
|
+
if (Rtl()) cmds = $.extend({}, commandList.ltr, commandList.rtl);
|
70
84
|
|
71
85
|
else cmds = $.extend({}, commandList.rtl, commandList.ltr);
|
72
86
|
}
|
@@ -90,13 +104,8 @@ var Keyboard = {
|
|
90
104
|
* @param {jQuery} $element - jQuery object to search within
|
91
105
|
* @return {jQuery} $focusable - all focusable elements within `$element`
|
92
106
|
*/
|
93
|
-
|
94
|
-
|
95
|
-
return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function() {
|
96
|
-
if (!$(this).is(':visible') || $(this).attr('tabindex') < 0) { return false; } //only have visible elements and those that have a tabindex greater or equal 0
|
97
|
-
return true;
|
98
|
-
});
|
99
|
-
},
|
107
|
+
|
108
|
+
findFocusable: findFocusable,
|
100
109
|
|
101
110
|
/**
|
102
111
|
* Returns the component name name
|
@@ -106,23 +115,26 @@ var Keyboard = {
|
|
106
115
|
|
107
116
|
register(componentName, cmds) {
|
108
117
|
commands[componentName] = cmds;
|
109
|
-
},
|
118
|
+
},
|
110
119
|
|
120
|
+
|
121
|
+
// TODO9438: These references to Keyboard need to not require global. Will 'this' work in this context?
|
122
|
+
//
|
111
123
|
/**
|
112
124
|
* Traps the focus in the given element.
|
113
125
|
* @param {jQuery} $element jQuery object to trap the foucs into.
|
114
126
|
*/
|
115
127
|
trapFocus($element) {
|
116
|
-
var $focusable =
|
128
|
+
var $focusable = findFocusable($element),
|
117
129
|
$firstFocusable = $focusable.eq(0),
|
118
130
|
$lastFocusable = $focusable.eq(-1);
|
119
131
|
|
120
132
|
$element.on('keydown.zf.trapfocus', function(event) {
|
121
|
-
if (event.target === $lastFocusable[0] &&
|
133
|
+
if (event.target === $lastFocusable[0] && parseKey(event) === 'TAB') {
|
122
134
|
event.preventDefault();
|
123
135
|
$firstFocusable.focus();
|
124
136
|
}
|
125
|
-
else if (event.target === $firstFocusable[0] &&
|
137
|
+
else if (event.target === $firstFocusable[0] && parseKey(event) === 'SHIFT_TAB') {
|
126
138
|
event.preventDefault();
|
127
139
|
$lastFocusable.focus();
|
128
140
|
}
|
@@ -147,6 +159,4 @@ function getKeyCodes(kcs) {
|
|
147
159
|
return k;
|
148
160
|
}
|
149
161
|
|
150
|
-
|
151
|
-
|
152
|
-
}(jQuery);
|
162
|
+
export {Keyboard};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
import $ from 'jquery';
|
4
4
|
|
5
5
|
// Default set of media queries
|
6
6
|
const defaultQueries = {
|
@@ -13,7 +13,55 @@ const defaultQueries = {
|
|
13
13
|
'only screen and (min-device-pixel-ratio: 2),' +
|
14
14
|
'only screen and (min-resolution: 192dpi),' +
|
15
15
|
'only screen and (min-resolution: 2dppx)'
|
16
|
-
};
|
16
|
+
};
|
17
|
+
|
18
|
+
|
19
|
+
// matchMedia() polyfill - Test a CSS media type/query in JS.
|
20
|
+
// Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license
|
21
|
+
let matchMedia = window.matchMedia || (function() {
|
22
|
+
'use strict';
|
23
|
+
|
24
|
+
// For browsers that support matchMedium api such as IE 9 and webkit
|
25
|
+
var styleMedia = (window.styleMedia || window.media);
|
26
|
+
|
27
|
+
// For those that don't support matchMedium
|
28
|
+
if (!styleMedia) {
|
29
|
+
var style = document.createElement('style'),
|
30
|
+
script = document.getElementsByTagName('script')[0],
|
31
|
+
info = null;
|
32
|
+
|
33
|
+
style.type = 'text/css';
|
34
|
+
style.id = 'matchmediajs-test';
|
35
|
+
|
36
|
+
script && script.parentNode && script.parentNode.insertBefore(style, script);
|
37
|
+
|
38
|
+
// 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
|
39
|
+
info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
|
40
|
+
|
41
|
+
styleMedia = {
|
42
|
+
matchMedium(media) {
|
43
|
+
var text = `@media ${media}{ #matchmediajs-test { width: 1px; } }`;
|
44
|
+
|
45
|
+
// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
|
46
|
+
if (style.styleSheet) {
|
47
|
+
style.styleSheet.cssText = text;
|
48
|
+
} else {
|
49
|
+
style.textContent = text;
|
50
|
+
}
|
51
|
+
|
52
|
+
// Test if media query is true or false
|
53
|
+
return info.width === '1px';
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
return function(media) {
|
59
|
+
return {
|
60
|
+
matches: styleMedia.matchMedium(media || 'all'),
|
61
|
+
media: media || 'all'
|
62
|
+
};
|
63
|
+
}
|
64
|
+
})();
|
17
65
|
|
18
66
|
var MediaQuery = {
|
19
67
|
queries: [],
|
@@ -27,6 +75,11 @@ var MediaQuery = {
|
|
27
75
|
*/
|
28
76
|
_init() {
|
29
77
|
var self = this;
|
78
|
+
var $meta = $('meta.foundation-mq');
|
79
|
+
if(!$meta.length){
|
80
|
+
$('<meta class="foundation-mq">').appendTo(document.head);
|
81
|
+
}
|
82
|
+
|
30
83
|
var extractedStyles = $('.foundation-mq').css('font-family');
|
31
84
|
var namedQueries;
|
32
85
|
|
@@ -56,7 +109,7 @@ var MediaQuery = {
|
|
56
109
|
var query = this.get(size);
|
57
110
|
|
58
111
|
if (query) {
|
59
|
-
return
|
112
|
+
return matchMedia(query).matches;
|
60
113
|
}
|
61
114
|
|
62
115
|
return false;
|
@@ -107,7 +160,7 @@ var MediaQuery = {
|
|
107
160
|
for (var i = 0; i < this.queries.length; i++) {
|
108
161
|
var query = this.queries[i];
|
109
162
|
|
110
|
-
if (
|
163
|
+
if (matchMedia(query.value).matches) {
|
111
164
|
matched = query;
|
112
165
|
}
|
113
166
|
}
|
@@ -125,7 +178,7 @@ var MediaQuery = {
|
|
125
178
|
* @private
|
126
179
|
*/
|
127
180
|
_watcher() {
|
128
|
-
$(window).on('resize.zf.mediaquery', () => {
|
181
|
+
$(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', () => {
|
129
182
|
var newSize = this._getCurrentSize(), currentSize = this.current;
|
130
183
|
|
131
184
|
if (newSize !== currentSize) {
|
@@ -139,54 +192,7 @@ var MediaQuery = {
|
|
139
192
|
}
|
140
193
|
};
|
141
194
|
|
142
|
-
Foundation.MediaQuery = MediaQuery;
|
143
|
-
|
144
|
-
// matchMedia() polyfill - Test a CSS media type/query in JS.
|
145
|
-
// Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license
|
146
|
-
window.matchMedia || (window.matchMedia = function() {
|
147
|
-
'use strict';
|
148
|
-
|
149
|
-
// For browsers that support matchMedium api such as IE 9 and webkit
|
150
|
-
var styleMedia = (window.styleMedia || window.media);
|
151
|
-
|
152
|
-
// For those that don't support matchMedium
|
153
|
-
if (!styleMedia) {
|
154
|
-
var style = document.createElement('style'),
|
155
|
-
script = document.getElementsByTagName('script')[0],
|
156
|
-
info = null;
|
157
|
-
|
158
|
-
style.type = 'text/css';
|
159
|
-
style.id = 'matchmediajs-test';
|
160
|
-
|
161
|
-
script && script.parentNode && script.parentNode.insertBefore(style, script);
|
162
195
|
|
163
|
-
// 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
|
164
|
-
info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
|
165
|
-
|
166
|
-
styleMedia = {
|
167
|
-
matchMedium(media) {
|
168
|
-
var text = `@media ${media}{ #matchmediajs-test { width: 1px; } }`;
|
169
|
-
|
170
|
-
// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
|
171
|
-
if (style.styleSheet) {
|
172
|
-
style.styleSheet.cssText = text;
|
173
|
-
} else {
|
174
|
-
style.textContent = text;
|
175
|
-
}
|
176
|
-
|
177
|
-
// Test if media query is true or false
|
178
|
-
return info.width === '1px';
|
179
|
-
}
|
180
|
-
}
|
181
|
-
}
|
182
|
-
|
183
|
-
return function(media) {
|
184
|
-
return {
|
185
|
-
matches: styleMedia.matchMedium(media || 'all'),
|
186
|
-
media: media || 'all'
|
187
|
-
};
|
188
|
-
}
|
189
|
-
}());
|
190
196
|
|
191
197
|
// Thank you: https://github.com/sindresorhus/query-string
|
192
198
|
function parseStyleToObject(str) {
|
@@ -225,6 +231,4 @@ function parseStyleToObject(str) {
|
|
225
231
|
return styleObject;
|
226
232
|
}
|
227
233
|
|
228
|
-
|
229
|
-
|
230
|
-
}(jQuery);
|
234
|
+
export {MediaQuery};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
import $ from 'jquery';
|
4
|
+
import { transitionend } from './foundation.util.core';
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Motion module.
|
@@ -83,7 +84,7 @@ function animate(isIn, element, animation, cb) {
|
|
83
84
|
});
|
84
85
|
|
85
86
|
// Clean up the animation when it finishes
|
86
|
-
element.one(
|
87
|
+
element.one(transitionend(element), finish);
|
87
88
|
|
88
89
|
// Hides the element (for out animations), resets the element, and runs a callback
|
89
90
|
function finish() {
|
@@ -99,7 +100,5 @@ function animate(isIn, element, animation, cb) {
|
|
99
100
|
}
|
100
101
|
}
|
101
102
|
|
102
|
-
|
103
|
-
Foundation.Motion = Motion;
|
103
|
+
export {Move, Motion};
|
104
104
|
|
105
|
-
}(jQuery);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
import $ from 'jquery';
|
4
4
|
|
5
5
|
const Nest = {
|
6
6
|
Feather(menu, type = 'zf') {
|
@@ -9,16 +9,18 @@ const Nest = {
|
|
9
9
|
var items = menu.find('li').attr({'role': 'menuitem'}),
|
10
10
|
subMenuClass = `is-${type}-submenu`,
|
11
11
|
subItemClass = `${subMenuClass}-item`,
|
12
|
-
hasSubClass = `is-${type}-submenu-parent
|
12
|
+
hasSubClass = `is-${type}-submenu-parent`,
|
13
|
+
applyAria = (type !== 'accordion'); // Accordions handle their own ARIA attriutes.
|
13
14
|
|
14
15
|
items.each(function() {
|
15
16
|
var $item = $(this),
|
16
17
|
$sub = $item.children('ul');
|
17
18
|
|
18
19
|
if ($sub.length) {
|
19
|
-
$item
|
20
|
-
|
21
|
-
|
20
|
+
$item.addClass(hasSubClass);
|
21
|
+
$sub.addClass(`submenu ${subMenuClass}`).attr({'data-submenu': ''});
|
22
|
+
if(applyAria) {
|
23
|
+
$item.attr({
|
22
24
|
'aria-haspopup': true,
|
23
25
|
'aria-label': $item.children('a:first').text()
|
24
26
|
});
|
@@ -28,7 +30,7 @@ const Nest = {
|
|
28
30
|
if(type === 'drilldown') {
|
29
31
|
$item.attr({'aria-expanded': false});
|
30
32
|
}
|
31
|
-
|
33
|
+
}
|
32
34
|
$sub
|
33
35
|
.addClass(`submenu ${subMenuClass}`)
|
34
36
|
.attr({
|
@@ -59,23 +61,7 @@ const Nest = {
|
|
59
61
|
.removeClass(`${subMenuClass} ${subItemClass} ${hasSubClass} is-submenu-item submenu is-active`)
|
60
62
|
.removeAttr('data-submenu').css('display', '');
|
61
63
|
|
62
|
-
// console.log( menu.find('.' + subMenuClass + ', .' + subItemClass + ', .has-submenu, .is-submenu-item, .submenu, [data-submenu]')
|
63
|
-
// .removeClass(subMenuClass + ' ' + subItemClass + ' has-submenu is-submenu-item submenu')
|
64
|
-
// .removeAttr('data-submenu'));
|
65
|
-
// items.each(function(){
|
66
|
-
// var $item = $(this),
|
67
|
-
// $sub = $item.children('ul');
|
68
|
-
// if($item.parent('[data-submenu]').length){
|
69
|
-
// $item.removeClass('is-submenu-item ' + subItemClass);
|
70
|
-
// }
|
71
|
-
// if($sub.length){
|
72
|
-
// $item.removeClass('has-submenu');
|
73
|
-
// $sub.removeClass('submenu ' + subMenuClass).removeAttr('data-submenu');
|
74
|
-
// }
|
75
|
-
// });
|
76
64
|
}
|
77
65
|
}
|
78
66
|
|
79
|
-
|
80
|
-
|
81
|
-
}(jQuery);
|
67
|
+
export {Nest};
|