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.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Rakefile +5 -6
- data/lib/foundation/rails/version.rb +1 -1
- data/vendor/assets/js/foundation.abide.js +781 -0
- data/vendor/assets/js/foundation.accordion.js +511 -0
- data/vendor/assets/js/foundation.accordionMenu.js +527 -0
- data/vendor/assets/js/foundation.core.js +860 -0
- data/vendor/assets/js/foundation.drilldown.js +759 -0
- data/vendor/assets/js/foundation.dropdown.js +1131 -0
- data/vendor/assets/js/foundation.dropdownMenu.js +678 -0
- data/vendor/assets/js/foundation.equalizer.js +542 -0
- data/vendor/assets/js/foundation.interchange.js +399 -0
- data/vendor/assets/js/{foundation.js.es6 → foundation.js} +11 -12
- data/vendor/assets/js/foundation.magellan.js +449 -0
- data/vendor/assets/js/foundation.offcanvas.js +1052 -0
- data/vendor/assets/js/foundation.orbit.js +767 -0
- data/vendor/assets/js/foundation.responsiveAccordionTabs.js +440 -0
- data/vendor/assets/js/foundation.responsiveMenu.js +362 -0
- data/vendor/assets/js/foundation.responsiveToggle.js +336 -0
- data/vendor/assets/js/foundation.reveal.js +1066 -0
- data/vendor/assets/js/foundation.slider.js +1236 -0
- data/vendor/assets/js/foundation.smoothScroll.js +303 -0
- data/vendor/assets/js/foundation.sticky.js +1001 -0
- data/vendor/assets/js/foundation.tabs.js +678 -0
- data/vendor/assets/js/foundation.toggler.js +602 -0
- data/vendor/assets/js/foundation.tooltip.js +1195 -0
- data/vendor/assets/js/{foundation.util.box.js.es6 → foundation.util.box.js} +154 -41
- data/vendor/assets/js/foundation.util.imageLoader.js +163 -0
- data/vendor/assets/js/foundation.util.keyboard.js +298 -0
- data/vendor/assets/js/foundation.util.mediaQuery.js +353 -0
- data/vendor/assets/js/foundation.util.motion.js +231 -0
- data/vendor/assets/js/foundation.util.nest.js +181 -0
- data/vendor/assets/js/foundation.util.timer.js +170 -0
- data/vendor/assets/js/foundation.util.timerAndImageLoader.js +90 -0
- data/vendor/assets/js/foundation.util.touch.js +275 -0
- data/vendor/assets/js/foundation.util.triggers.js +399 -0
- data/vendor/assets/js/foundation.zf.responsiveAccordionTabs.js +262 -0
- metadata +37 -71
- data/vendor/assets/js/entries/foundation-plugins.js +0 -25
- data/vendor/assets/js/entries/foundation.js +0 -101
- data/vendor/assets/js/entries/plugins/foundation.abide.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.accordion.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.accordionMenu.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.core.js +0 -21
- data/vendor/assets/js/entries/plugins/foundation.drilldown.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.dropdown.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.dropdownMenu.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.equalizer.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.interchange.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.magellan.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.offcanvas.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.orbit.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.responsiveAccordionTabs.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.responsiveMenu.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.responsiveToggle.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.reveal.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.slider.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.smoothScroll.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.sticky.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.tabs.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.toggler.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.tooltip.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.util.box.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.util.imageLoader.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.util.keyboard.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.util.mediaQuery.js +0 -4
- data/vendor/assets/js/entries/plugins/foundation.util.motion.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.util.nest.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.util.timer.js +0 -5
- data/vendor/assets/js/entries/plugins/foundation.util.touch.js +0 -7
- data/vendor/assets/js/entries/plugins/foundation.util.triggers.js +0 -5
- data/vendor/assets/js/foundation.abide.js.es6 +0 -587
- data/vendor/assets/js/foundation.accordion.js.es6 +0 -329
- data/vendor/assets/js/foundation.accordionMenu.js.es6 +0 -328
- data/vendor/assets/js/foundation.core.js.es6 +0 -337
- data/vendor/assets/js/foundation.drilldown.js.es6 +0 -536
- data/vendor/assets/js/foundation.dropdown.js.es6 +0 -394
- data/vendor/assets/js/foundation.dropdownMenu.js.es6 +0 -458
- data/vendor/assets/js/foundation.equalizer.js.es6 +0 -318
- data/vendor/assets/js/foundation.interchange.js.es6 +0 -210
- data/vendor/assets/js/foundation.magellan.js.es6 +0 -257
- data/vendor/assets/js/foundation.offcanvas.js.es6 +0 -546
- data/vendor/assets/js/foundation.orbit.js.es6 +0 -531
- data/vendor/assets/js/foundation.plugin.js.es6 +0 -54
- data/vendor/assets/js/foundation.positionable.js.es6 +0 -206
- data/vendor/assets/js/foundation.responsiveAccordionTabs.js.es6 +0 -243
- data/vendor/assets/js/foundation.responsiveMenu.js.es6 +0 -155
- data/vendor/assets/js/foundation.responsiveToggle.js.es6 +0 -156
- data/vendor/assets/js/foundation.reveal.js.es6 +0 -585
- data/vendor/assets/js/foundation.slider.js.es6 +0 -712
- data/vendor/assets/js/foundation.smoothScroll.js.es6 +0 -135
- data/vendor/assets/js/foundation.sticky.js.es6 +0 -507
- data/vendor/assets/js/foundation.tabs.js.es6 +0 -498
- data/vendor/assets/js/foundation.toggler.js.es6 +0 -150
- data/vendor/assets/js/foundation.tooltip.js.es6 +0 -462
- data/vendor/assets/js/foundation.util.core.js.es6 +0 -52
- data/vendor/assets/js/foundation.util.imageLoader.js.es6 +0 -45
- data/vendor/assets/js/foundation.util.keyboard.js.es6 +0 -162
- data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +0 -234
- data/vendor/assets/js/foundation.util.motion.js.es6 +0 -104
- data/vendor/assets/js/foundation.util.nest.js.es6 +0 -67
- data/vendor/assets/js/foundation.util.timer.js.es6 +0 -48
- data/vendor/assets/js/foundation.util.touch.js.es6 +0 -149
- data/vendor/assets/js/foundation.util.triggers.js.es6 +0 -268
@@ -0,0 +1,1052 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
/******/
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
/******/
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId]) {
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
/******/ }
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ i: moduleId,
|
15
|
+
/******/ l: false,
|
16
|
+
/******/ exports: {}
|
17
|
+
/******/ };
|
18
|
+
/******/
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
/******/
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.l = true;
|
24
|
+
/******/
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
/******/
|
29
|
+
/******/
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
/******/
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
/******/
|
36
|
+
/******/ // identity function for calling harmony imports with the correct context
|
37
|
+
/******/ __webpack_require__.i = function(value) { return value; };
|
38
|
+
/******/
|
39
|
+
/******/ // define getter function for harmony exports
|
40
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
41
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
42
|
+
/******/ Object.defineProperty(exports, name, {
|
43
|
+
/******/ configurable: false,
|
44
|
+
/******/ enumerable: true,
|
45
|
+
/******/ get: getter
|
46
|
+
/******/ });
|
47
|
+
/******/ }
|
48
|
+
/******/ };
|
49
|
+
/******/
|
50
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
51
|
+
/******/ __webpack_require__.n = function(module) {
|
52
|
+
/******/ var getter = module && module.__esModule ?
|
53
|
+
/******/ function getDefault() { return module['default']; } :
|
54
|
+
/******/ function getModuleExports() { return module; };
|
55
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
56
|
+
/******/ return getter;
|
57
|
+
/******/ };
|
58
|
+
/******/
|
59
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
60
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
61
|
+
/******/
|
62
|
+
/******/ // __webpack_public_path__
|
63
|
+
/******/ __webpack_require__.p = "";
|
64
|
+
/******/
|
65
|
+
/******/ // Load entry module and return exports
|
66
|
+
/******/ return __webpack_require__(__webpack_require__.s = 88);
|
67
|
+
/******/ })
|
68
|
+
/************************************************************************/
|
69
|
+
/******/ ({
|
70
|
+
|
71
|
+
/***/ 0:
|
72
|
+
/***/ (function(module, exports) {
|
73
|
+
|
74
|
+
module.exports = jQuery;
|
75
|
+
|
76
|
+
/***/ }),
|
77
|
+
|
78
|
+
/***/ 1:
|
79
|
+
/***/ (function(module, exports) {
|
80
|
+
|
81
|
+
module.exports = {Foundation: window.Foundation};
|
82
|
+
|
83
|
+
/***/ }),
|
84
|
+
|
85
|
+
/***/ 2:
|
86
|
+
/***/ (function(module, exports) {
|
87
|
+
|
88
|
+
module.exports = {Plugin: window.Foundation.Plugin};
|
89
|
+
|
90
|
+
/***/ }),
|
91
|
+
|
92
|
+
/***/ 22:
|
93
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
94
|
+
|
95
|
+
"use strict";
|
96
|
+
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
97
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation_core__ = __webpack_require__(1);
|
98
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__foundation_core__);
|
99
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_offcanvas__ = __webpack_require__(52);
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
__WEBPACK_IMPORTED_MODULE_0__foundation_core__["Foundation"].plugin(__WEBPACK_IMPORTED_MODULE_1__foundation_offcanvas__["a" /* OffCanvas */], 'OffCanvas');
|
104
|
+
|
105
|
+
/***/ }),
|
106
|
+
|
107
|
+
/***/ 3:
|
108
|
+
/***/ (function(module, exports) {
|
109
|
+
|
110
|
+
module.exports = {rtl: window.Foundation.rtl, GetYoDigits: window.Foundation.GetYoDigits, transitionend: window.Foundation.transitionend};
|
111
|
+
|
112
|
+
/***/ }),
|
113
|
+
|
114
|
+
/***/ 4:
|
115
|
+
/***/ (function(module, exports) {
|
116
|
+
|
117
|
+
module.exports = {Motion: window.Foundation.Motion, Move: window.Foundation.Move};
|
118
|
+
|
119
|
+
/***/ }),
|
120
|
+
|
121
|
+
/***/ 5:
|
122
|
+
/***/ (function(module, exports) {
|
123
|
+
|
124
|
+
module.exports = {Keyboard: window.Foundation.Keyboard};
|
125
|
+
|
126
|
+
/***/ }),
|
127
|
+
|
128
|
+
/***/ 52:
|
129
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
130
|
+
|
131
|
+
"use strict";
|
132
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OffCanvas; });
|
133
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
134
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
135
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(5);
|
136
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__);
|
137
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__ = __webpack_require__(6);
|
138
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__);
|
139
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_core__ = __webpack_require__(3);
|
140
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__);
|
141
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_plugin__ = __webpack_require__(2);
|
142
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_plugin___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__foundation_plugin__);
|
143
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_util_triggers__ = __webpack_require__(7);
|
144
|
+
|
145
|
+
|
146
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
147
|
+
|
148
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
149
|
+
|
150
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
151
|
+
|
152
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
/**
|
163
|
+
* OffCanvas module.
|
164
|
+
* @module foundation.offcanvas
|
165
|
+
* @requires foundation.util.keyboard
|
166
|
+
* @requires foundation.util.mediaQuery
|
167
|
+
* @requires foundation.util.triggers
|
168
|
+
*/
|
169
|
+
|
170
|
+
var OffCanvas = function (_Plugin) {
|
171
|
+
_inherits(OffCanvas, _Plugin);
|
172
|
+
|
173
|
+
function OffCanvas() {
|
174
|
+
_classCallCheck(this, OffCanvas);
|
175
|
+
|
176
|
+
return _possibleConstructorReturn(this, (OffCanvas.__proto__ || Object.getPrototypeOf(OffCanvas)).apply(this, arguments));
|
177
|
+
}
|
178
|
+
|
179
|
+
_createClass(OffCanvas, [{
|
180
|
+
key: '_setup',
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Creates a new instance of an off-canvas wrapper.
|
184
|
+
* @class
|
185
|
+
* @name OffCanvas
|
186
|
+
* @fires OffCanvas#init
|
187
|
+
* @param {Object} element - jQuery object to initialize.
|
188
|
+
* @param {Object} options - Overrides to the default plugin settings.
|
189
|
+
*/
|
190
|
+
value: function _setup(element, options) {
|
191
|
+
var _this3 = this;
|
192
|
+
|
193
|
+
this.className = 'OffCanvas'; // ie9 back compat
|
194
|
+
this.$element = element;
|
195
|
+
this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, OffCanvas.defaults, this.$element.data(), options);
|
196
|
+
this.contentClasses = { base: [], reveal: [] };
|
197
|
+
this.$lastTrigger = __WEBPACK_IMPORTED_MODULE_0_jquery___default()();
|
198
|
+
this.$triggers = __WEBPACK_IMPORTED_MODULE_0_jquery___default()();
|
199
|
+
this.position = 'left';
|
200
|
+
this.$content = __WEBPACK_IMPORTED_MODULE_0_jquery___default()();
|
201
|
+
this.nested = !!this.options.nested;
|
202
|
+
|
203
|
+
// Defines the CSS transition/position classes of the off-canvas content container.
|
204
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(['push', 'overlap']).each(function (index, val) {
|
205
|
+
_this3.contentClasses.base.push('has-transition-' + val);
|
206
|
+
});
|
207
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(['left', 'right', 'top', 'bottom']).each(function (index, val) {
|
208
|
+
_this3.contentClasses.base.push('has-position-' + val);
|
209
|
+
_this3.contentClasses.reveal.push('has-reveal-' + val);
|
210
|
+
});
|
211
|
+
|
212
|
+
// Triggers init is idempotent, just need to make sure it is initialized
|
213
|
+
__WEBPACK_IMPORTED_MODULE_5__foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a);
|
214
|
+
__WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["MediaQuery"]._init();
|
215
|
+
|
216
|
+
this._init();
|
217
|
+
this._events();
|
218
|
+
|
219
|
+
__WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["Keyboard"].register('OffCanvas', {
|
220
|
+
'ESCAPE': 'close'
|
221
|
+
});
|
222
|
+
}
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Initializes the off-canvas wrapper by adding the exit overlay (if needed).
|
226
|
+
* @function
|
227
|
+
* @private
|
228
|
+
*/
|
229
|
+
|
230
|
+
}, {
|
231
|
+
key: '_init',
|
232
|
+
value: function _init() {
|
233
|
+
var id = this.$element.attr('id');
|
234
|
+
|
235
|
+
this.$element.attr('aria-hidden', 'true');
|
236
|
+
|
237
|
+
// Find off-canvas content, either by ID (if specified), by siblings or by closest selector (fallback)
|
238
|
+
if (this.options.contentId) {
|
239
|
+
this.$content = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + this.options.contentId);
|
240
|
+
} else if (this.$element.siblings('[data-off-canvas-content]').length) {
|
241
|
+
this.$content = this.$element.siblings('[data-off-canvas-content]').first();
|
242
|
+
} else {
|
243
|
+
this.$content = this.$element.closest('[data-off-canvas-content]').first();
|
244
|
+
}
|
245
|
+
|
246
|
+
if (!this.options.contentId) {
|
247
|
+
// Assume that the off-canvas element is nested if it isn't a sibling of the content
|
248
|
+
this.nested = this.$element.siblings('[data-off-canvas-content]').length === 0;
|
249
|
+
} else if (this.options.contentId && this.options.nested === null) {
|
250
|
+
// Warning if using content ID without setting the nested option
|
251
|
+
// Once the element is nested it is required to work properly in this case
|
252
|
+
console.warn('Remember to use the nested option if using the content ID option!');
|
253
|
+
}
|
254
|
+
|
255
|
+
if (this.nested === true) {
|
256
|
+
// Force transition overlap if nested
|
257
|
+
this.options.transition = 'overlap';
|
258
|
+
// Remove appropriate classes if already assigned in markup
|
259
|
+
this.$element.removeClass('is-transition-push');
|
260
|
+
}
|
261
|
+
|
262
|
+
this.$element.addClass('is-transition-' + this.options.transition + ' is-closed');
|
263
|
+
|
264
|
+
// Find triggers that affect this element and add aria-expanded to them
|
265
|
+
this.$triggers = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document).find('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-expanded', 'false').attr('aria-controls', id);
|
266
|
+
|
267
|
+
// Get position by checking for related CSS class
|
268
|
+
this.position = this.$element.is('.position-left, .position-top, .position-right, .position-bottom') ? this.$element.attr('class').match(/position\-(left|top|right|bottom)/)[1] : this.position;
|
269
|
+
|
270
|
+
// Add an overlay over the content if necessary
|
271
|
+
if (this.options.contentOverlay === true) {
|
272
|
+
var overlay = document.createElement('div');
|
273
|
+
var overlayPosition = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.$element).css("position") === 'fixed' ? 'is-overlay-fixed' : 'is-overlay-absolute';
|
274
|
+
overlay.setAttribute('class', 'js-off-canvas-overlay ' + overlayPosition);
|
275
|
+
this.$overlay = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(overlay);
|
276
|
+
if (overlayPosition === 'is-overlay-fixed') {
|
277
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.$overlay).insertAfter(this.$element);
|
278
|
+
} else {
|
279
|
+
this.$content.append(this.$overlay);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className);
|
284
|
+
|
285
|
+
if (this.options.isRevealed === true) {
|
286
|
+
this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2];
|
287
|
+
this._setMQChecker();
|
288
|
+
}
|
289
|
+
|
290
|
+
if (this.options.transitionTime) {
|
291
|
+
this.$element.css('transition-duration', this.options.transitionTime);
|
292
|
+
}
|
293
|
+
|
294
|
+
// Initally remove all transition/position CSS classes from off-canvas content container.
|
295
|
+
this._removeContentClasses();
|
296
|
+
}
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Adds event handlers to the off-canvas wrapper and the exit overlay.
|
300
|
+
* @function
|
301
|
+
* @private
|
302
|
+
*/
|
303
|
+
|
304
|
+
}, {
|
305
|
+
key: '_events',
|
306
|
+
value: function _events() {
|
307
|
+
this.$element.off('.zf.trigger .zf.offcanvas').on({
|
308
|
+
'open.zf.trigger': this.open.bind(this),
|
309
|
+
'close.zf.trigger': this.close.bind(this),
|
310
|
+
'toggle.zf.trigger': this.toggle.bind(this),
|
311
|
+
'keydown.zf.offcanvas': this._handleKeyboard.bind(this)
|
312
|
+
});
|
313
|
+
|
314
|
+
if (this.options.closeOnClick === true) {
|
315
|
+
var $target = this.options.contentOverlay ? this.$overlay : this.$content;
|
316
|
+
$target.on({ 'click.zf.offcanvas': this.close.bind(this) });
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
/**
|
321
|
+
* Applies event listener for elements that will reveal at certain breakpoints.
|
322
|
+
* @private
|
323
|
+
*/
|
324
|
+
|
325
|
+
}, {
|
326
|
+
key: '_setMQChecker',
|
327
|
+
value: function _setMQChecker() {
|
328
|
+
var _this = this;
|
329
|
+
|
330
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('changed.zf.mediaquery', function () {
|
331
|
+
if (__WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["MediaQuery"].atLeast(_this.options.revealOn)) {
|
332
|
+
_this.reveal(true);
|
333
|
+
} else {
|
334
|
+
_this.reveal(false);
|
335
|
+
}
|
336
|
+
}).one('load.zf.offcanvas', function () {
|
337
|
+
if (__WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["MediaQuery"].atLeast(_this.options.revealOn)) {
|
338
|
+
_this.reveal(true);
|
339
|
+
}
|
340
|
+
});
|
341
|
+
}
|
342
|
+
|
343
|
+
/**
|
344
|
+
* Removes the CSS transition/position classes of the off-canvas content container.
|
345
|
+
* Removing the classes is important when another off-canvas gets opened that uses the same content container.
|
346
|
+
* @private
|
347
|
+
*/
|
348
|
+
|
349
|
+
}, {
|
350
|
+
key: '_removeContentClasses',
|
351
|
+
value: function _removeContentClasses(hasReveal) {
|
352
|
+
this.$content.removeClass(this.contentClasses.base.join(' '));
|
353
|
+
if (hasReveal === true) {
|
354
|
+
this.$content.removeClass(this.contentClasses.reveal.join(' '));
|
355
|
+
}
|
356
|
+
}
|
357
|
+
|
358
|
+
/**
|
359
|
+
* Adds the CSS transition/position classes of the off-canvas content container, based on the opening off-canvas element.
|
360
|
+
* Beforehand any transition/position class gets removed.
|
361
|
+
* @param {Boolean} hasReveal - true if related off-canvas element is revealed.
|
362
|
+
* @private
|
363
|
+
*/
|
364
|
+
|
365
|
+
}, {
|
366
|
+
key: '_addContentClasses',
|
367
|
+
value: function _addContentClasses(hasReveal) {
|
368
|
+
this._removeContentClasses();
|
369
|
+
this.$content.addClass('has-transition-' + this.options.transition + ' has-position-' + this.position);
|
370
|
+
if (hasReveal === true) {
|
371
|
+
this.$content.addClass('has-reveal-' + this.position);
|
372
|
+
}
|
373
|
+
}
|
374
|
+
|
375
|
+
/**
|
376
|
+
* Handles the revealing/hiding the off-canvas at breakpoints, not the same as open.
|
377
|
+
* @param {Boolean} isRevealed - true if element should be revealed.
|
378
|
+
* @function
|
379
|
+
*/
|
380
|
+
|
381
|
+
}, {
|
382
|
+
key: 'reveal',
|
383
|
+
value: function reveal(isRevealed) {
|
384
|
+
if (isRevealed) {
|
385
|
+
this.close();
|
386
|
+
this.isRevealed = true;
|
387
|
+
this.$element.attr('aria-hidden', 'false');
|
388
|
+
this.$element.off('open.zf.trigger toggle.zf.trigger');
|
389
|
+
this.$element.removeClass('is-closed');
|
390
|
+
} else {
|
391
|
+
this.isRevealed = false;
|
392
|
+
this.$element.attr('aria-hidden', 'true');
|
393
|
+
this.$element.off('open.zf.trigger toggle.zf.trigger').on({
|
394
|
+
'open.zf.trigger': this.open.bind(this),
|
395
|
+
'toggle.zf.trigger': this.toggle.bind(this)
|
396
|
+
});
|
397
|
+
this.$element.addClass('is-closed');
|
398
|
+
}
|
399
|
+
this._addContentClasses(isRevealed);
|
400
|
+
}
|
401
|
+
|
402
|
+
/**
|
403
|
+
* Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers.
|
404
|
+
* @private
|
405
|
+
*/
|
406
|
+
|
407
|
+
}, {
|
408
|
+
key: '_stopScrolling',
|
409
|
+
value: function _stopScrolling(event) {
|
410
|
+
return false;
|
411
|
+
}
|
412
|
+
|
413
|
+
// Taken and adapted from http://stackoverflow.com/questions/16889447/prevent-full-page-scrolling-ios
|
414
|
+
// Only really works for y, not sure how to extend to x or if we need to.
|
415
|
+
|
416
|
+
}, {
|
417
|
+
key: '_recordScrollable',
|
418
|
+
value: function _recordScrollable(event) {
|
419
|
+
var elem = this; // called from event handler context with this as elem
|
420
|
+
|
421
|
+
// If the element is scrollable (content overflows), then...
|
422
|
+
if (elem.scrollHeight !== elem.clientHeight) {
|
423
|
+
// If we're at the top, scroll down one pixel to allow scrolling up
|
424
|
+
if (elem.scrollTop === 0) {
|
425
|
+
elem.scrollTop = 1;
|
426
|
+
}
|
427
|
+
// If we're at the bottom, scroll up one pixel to allow scrolling down
|
428
|
+
if (elem.scrollTop === elem.scrollHeight - elem.clientHeight) {
|
429
|
+
elem.scrollTop = elem.scrollHeight - elem.clientHeight - 1;
|
430
|
+
}
|
431
|
+
}
|
432
|
+
elem.allowUp = elem.scrollTop > 0;
|
433
|
+
elem.allowDown = elem.scrollTop < elem.scrollHeight - elem.clientHeight;
|
434
|
+
elem.lastY = event.originalEvent.pageY;
|
435
|
+
}
|
436
|
+
}, {
|
437
|
+
key: '_stopScrollPropagation',
|
438
|
+
value: function _stopScrollPropagation(event) {
|
439
|
+
var elem = this; // called from event handler context with this as elem
|
440
|
+
var up = event.pageY < elem.lastY;
|
441
|
+
var down = !up;
|
442
|
+
elem.lastY = event.pageY;
|
443
|
+
|
444
|
+
if (up && elem.allowUp || down && elem.allowDown) {
|
445
|
+
event.stopPropagation();
|
446
|
+
} else {
|
447
|
+
event.preventDefault();
|
448
|
+
}
|
449
|
+
}
|
450
|
+
|
451
|
+
/**
|
452
|
+
* Opens the off-canvas menu.
|
453
|
+
* @function
|
454
|
+
* @param {Object} event - Event object passed from listener.
|
455
|
+
* @param {jQuery} trigger - element that triggered the off-canvas to open.
|
456
|
+
* @fires OffCanvas#opened
|
457
|
+
*/
|
458
|
+
|
459
|
+
}, {
|
460
|
+
key: 'open',
|
461
|
+
value: function open(event, trigger) {
|
462
|
+
if (this.$element.hasClass('is-open') || this.isRevealed) {
|
463
|
+
return;
|
464
|
+
}
|
465
|
+
var _this = this;
|
466
|
+
|
467
|
+
if (trigger) {
|
468
|
+
this.$lastTrigger = trigger;
|
469
|
+
}
|
470
|
+
|
471
|
+
if (this.options.forceTo === 'top') {
|
472
|
+
window.scrollTo(0, 0);
|
473
|
+
} else if (this.options.forceTo === 'bottom') {
|
474
|
+
window.scrollTo(0, document.body.scrollHeight);
|
475
|
+
}
|
476
|
+
|
477
|
+
if (this.options.transitionTime && this.options.transition !== 'overlap') {
|
478
|
+
this.$element.siblings('[data-off-canvas-content]').css('transition-duration', this.options.transitionTime);
|
479
|
+
} else {
|
480
|
+
this.$element.siblings('[data-off-canvas-content]').css('transition-duration', '');
|
481
|
+
}
|
482
|
+
|
483
|
+
/**
|
484
|
+
* Fires when the off-canvas menu opens.
|
485
|
+
* @event OffCanvas#opened
|
486
|
+
*/
|
487
|
+
this.$element.addClass('is-open').removeClass('is-closed');
|
488
|
+
|
489
|
+
this.$triggers.attr('aria-expanded', 'true');
|
490
|
+
this.$element.attr('aria-hidden', 'false').trigger('opened.zf.offcanvas');
|
491
|
+
|
492
|
+
this.$content.addClass('is-open-' + this.position);
|
493
|
+
|
494
|
+
// If `contentScroll` is set to false, add class and disable scrolling on touch devices.
|
495
|
+
if (this.options.contentScroll === false) {
|
496
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').addClass('is-off-canvas-open').on('touchmove', this._stopScrolling);
|
497
|
+
this.$element.on('touchstart', this._recordScrollable);
|
498
|
+
this.$element.on('touchmove', this._stopScrollPropagation);
|
499
|
+
}
|
500
|
+
|
501
|
+
if (this.options.contentOverlay === true) {
|
502
|
+
this.$overlay.addClass('is-visible');
|
503
|
+
}
|
504
|
+
|
505
|
+
if (this.options.closeOnClick === true && this.options.contentOverlay === true) {
|
506
|
+
this.$overlay.addClass('is-closable');
|
507
|
+
}
|
508
|
+
|
509
|
+
if (this.options.autoFocus === true) {
|
510
|
+
this.$element.one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["transitionend"])(this.$element), function () {
|
511
|
+
if (!_this.$element.hasClass('is-open')) {
|
512
|
+
return; // exit if prematurely closed
|
513
|
+
}
|
514
|
+
var canvasFocus = _this.$element.find('[data-autofocus]');
|
515
|
+
if (canvasFocus.length) {
|
516
|
+
canvasFocus.eq(0).focus();
|
517
|
+
} else {
|
518
|
+
_this.$element.find('a, button').eq(0).focus();
|
519
|
+
}
|
520
|
+
});
|
521
|
+
}
|
522
|
+
|
523
|
+
if (this.options.trapFocus === true) {
|
524
|
+
this.$content.attr('tabindex', '-1');
|
525
|
+
__WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["Keyboard"].trapFocus(this.$element);
|
526
|
+
}
|
527
|
+
|
528
|
+
this._addContentClasses();
|
529
|
+
}
|
530
|
+
|
531
|
+
/**
|
532
|
+
* Closes the off-canvas menu.
|
533
|
+
* @function
|
534
|
+
* @param {Function} cb - optional cb to fire after closure.
|
535
|
+
* @fires OffCanvas#closed
|
536
|
+
*/
|
537
|
+
|
538
|
+
}, {
|
539
|
+
key: 'close',
|
540
|
+
value: function close(cb) {
|
541
|
+
if (!this.$element.hasClass('is-open') || this.isRevealed) {
|
542
|
+
return;
|
543
|
+
}
|
544
|
+
|
545
|
+
var _this = this;
|
546
|
+
|
547
|
+
this.$element.removeClass('is-open');
|
548
|
+
|
549
|
+
this.$element.attr('aria-hidden', 'true')
|
550
|
+
/**
|
551
|
+
* Fires when the off-canvas menu opens.
|
552
|
+
* @event OffCanvas#closed
|
553
|
+
*/
|
554
|
+
.trigger('closed.zf.offcanvas');
|
555
|
+
|
556
|
+
this.$content.removeClass('is-open-left is-open-top is-open-right is-open-bottom');
|
557
|
+
|
558
|
+
// If `contentScroll` is set to false, remove class and re-enable scrolling on touch devices.
|
559
|
+
if (this.options.contentScroll === false) {
|
560
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').removeClass('is-off-canvas-open').off('touchmove', this._stopScrolling);
|
561
|
+
this.$element.off('touchstart', this._recordScrollable);
|
562
|
+
this.$element.off('touchmove', this._stopScrollPropagation);
|
563
|
+
}
|
564
|
+
|
565
|
+
if (this.options.contentOverlay === true) {
|
566
|
+
this.$overlay.removeClass('is-visible');
|
567
|
+
}
|
568
|
+
|
569
|
+
if (this.options.closeOnClick === true && this.options.contentOverlay === true) {
|
570
|
+
this.$overlay.removeClass('is-closable');
|
571
|
+
}
|
572
|
+
|
573
|
+
this.$triggers.attr('aria-expanded', 'false');
|
574
|
+
|
575
|
+
if (this.options.trapFocus === true) {
|
576
|
+
this.$content.removeAttr('tabindex');
|
577
|
+
__WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["Keyboard"].releaseFocus(this.$element);
|
578
|
+
}
|
579
|
+
|
580
|
+
// Listen to transitionEnd and add class when done.
|
581
|
+
this.$element.one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["transitionend"])(this.$element), function (e) {
|
582
|
+
_this.$element.addClass('is-closed');
|
583
|
+
_this._removeContentClasses();
|
584
|
+
});
|
585
|
+
}
|
586
|
+
|
587
|
+
/**
|
588
|
+
* Toggles the off-canvas menu open or closed.
|
589
|
+
* @function
|
590
|
+
* @param {Object} event - Event object passed from listener.
|
591
|
+
* @param {jQuery} trigger - element that triggered the off-canvas to open.
|
592
|
+
*/
|
593
|
+
|
594
|
+
}, {
|
595
|
+
key: 'toggle',
|
596
|
+
value: function toggle(event, trigger) {
|
597
|
+
if (this.$element.hasClass('is-open')) {
|
598
|
+
this.close(event, trigger);
|
599
|
+
} else {
|
600
|
+
this.open(event, trigger);
|
601
|
+
}
|
602
|
+
}
|
603
|
+
|
604
|
+
/**
|
605
|
+
* Handles keyboard input when detected. When the escape key is pressed, the off-canvas menu closes, and focus is restored to the element that opened the menu.
|
606
|
+
* @function
|
607
|
+
* @private
|
608
|
+
*/
|
609
|
+
|
610
|
+
}, {
|
611
|
+
key: '_handleKeyboard',
|
612
|
+
value: function _handleKeyboard(e) {
|
613
|
+
var _this4 = this;
|
614
|
+
|
615
|
+
__WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["Keyboard"].handleKey(e, 'OffCanvas', {
|
616
|
+
close: function () {
|
617
|
+
_this4.close();
|
618
|
+
_this4.$lastTrigger.focus();
|
619
|
+
return true;
|
620
|
+
},
|
621
|
+
handled: function () {
|
622
|
+
e.stopPropagation();
|
623
|
+
e.preventDefault();
|
624
|
+
}
|
625
|
+
});
|
626
|
+
}
|
627
|
+
|
628
|
+
/**
|
629
|
+
* Destroys the offcanvas plugin.
|
630
|
+
* @function
|
631
|
+
*/
|
632
|
+
|
633
|
+
}, {
|
634
|
+
key: '_destroy',
|
635
|
+
value: function _destroy() {
|
636
|
+
this.close();
|
637
|
+
this.$element.off('.zf.trigger .zf.offcanvas');
|
638
|
+
this.$overlay.off('.zf.offcanvas');
|
639
|
+
}
|
640
|
+
}]);
|
641
|
+
|
642
|
+
return OffCanvas;
|
643
|
+
}(__WEBPACK_IMPORTED_MODULE_4__foundation_plugin__["Plugin"]);
|
644
|
+
|
645
|
+
OffCanvas.defaults = {
|
646
|
+
/**
|
647
|
+
* Allow the user to click outside of the menu to close it.
|
648
|
+
* @option
|
649
|
+
* @type {boolean}
|
650
|
+
* @default true
|
651
|
+
*/
|
652
|
+
closeOnClick: true,
|
653
|
+
|
654
|
+
/**
|
655
|
+
* Adds an overlay on top of `[data-off-canvas-content]`.
|
656
|
+
* @option
|
657
|
+
* @type {boolean}
|
658
|
+
* @default true
|
659
|
+
*/
|
660
|
+
contentOverlay: true,
|
661
|
+
|
662
|
+
/**
|
663
|
+
* Target an off-canvas content container by ID that may be placed anywhere. If null the closest content container will be taken.
|
664
|
+
* @option
|
665
|
+
* @type {?string}
|
666
|
+
* @default null
|
667
|
+
*/
|
668
|
+
contentId: null,
|
669
|
+
|
670
|
+
/**
|
671
|
+
* Define the off-canvas element is nested in an off-canvas content. This is required when using the contentId option for a nested element.
|
672
|
+
* @option
|
673
|
+
* @type {boolean}
|
674
|
+
* @default null
|
675
|
+
*/
|
676
|
+
nested: null,
|
677
|
+
|
678
|
+
/**
|
679
|
+
* Enable/disable scrolling of the main content when an off canvas panel is open.
|
680
|
+
* @option
|
681
|
+
* @type {boolean}
|
682
|
+
* @default true
|
683
|
+
*/
|
684
|
+
contentScroll: true,
|
685
|
+
|
686
|
+
/**
|
687
|
+
* Amount of time in ms the open and close transition requires. If none selected, pulls from body style.
|
688
|
+
* @option
|
689
|
+
* @type {number}
|
690
|
+
* @default null
|
691
|
+
*/
|
692
|
+
transitionTime: null,
|
693
|
+
|
694
|
+
/**
|
695
|
+
* Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'.
|
696
|
+
* @option
|
697
|
+
* @type {string}
|
698
|
+
* @default push
|
699
|
+
*/
|
700
|
+
transition: 'push',
|
701
|
+
|
702
|
+
/**
|
703
|
+
* Force the page to scroll to top or bottom on open.
|
704
|
+
* @option
|
705
|
+
* @type {?string}
|
706
|
+
* @default null
|
707
|
+
*/
|
708
|
+
forceTo: null,
|
709
|
+
|
710
|
+
/**
|
711
|
+
* Allow the offcanvas to remain open for certain breakpoints.
|
712
|
+
* @option
|
713
|
+
* @type {boolean}
|
714
|
+
* @default false
|
715
|
+
*/
|
716
|
+
isRevealed: false,
|
717
|
+
|
718
|
+
/**
|
719
|
+
* Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option.
|
720
|
+
* @option
|
721
|
+
* @type {?string}
|
722
|
+
* @default null
|
723
|
+
*/
|
724
|
+
revealOn: null,
|
725
|
+
|
726
|
+
/**
|
727
|
+
* Force focus to the offcanvas on open. If true, will focus the opening trigger on close.
|
728
|
+
* @option
|
729
|
+
* @type {boolean}
|
730
|
+
* @default true
|
731
|
+
*/
|
732
|
+
autoFocus: true,
|
733
|
+
|
734
|
+
/**
|
735
|
+
* Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
|
736
|
+
* @option
|
737
|
+
* @type {string}
|
738
|
+
* @default reveal-for-
|
739
|
+
* @todo improve the regex testing for this.
|
740
|
+
*/
|
741
|
+
revealClass: 'reveal-for-',
|
742
|
+
|
743
|
+
/**
|
744
|
+
* Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
|
745
|
+
* @option
|
746
|
+
* @type {boolean}
|
747
|
+
* @default false
|
748
|
+
*/
|
749
|
+
trapFocus: false
|
750
|
+
};
|
751
|
+
|
752
|
+
|
753
|
+
|
754
|
+
/***/ }),
|
755
|
+
|
756
|
+
/***/ 6:
|
757
|
+
/***/ (function(module, exports) {
|
758
|
+
|
759
|
+
module.exports = {MediaQuery: window.Foundation.MediaQuery};
|
760
|
+
|
761
|
+
/***/ }),
|
762
|
+
|
763
|
+
/***/ 7:
|
764
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
765
|
+
|
766
|
+
"use strict";
|
767
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Triggers; });
|
768
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
|
769
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
|
770
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_motion__ = __webpack_require__(4);
|
771
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_motion___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__foundation_util_motion__);
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
var MutationObserver = function () {
|
778
|
+
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
|
779
|
+
for (var i = 0; i < prefixes.length; i++) {
|
780
|
+
if (prefixes[i] + 'MutationObserver' in window) {
|
781
|
+
return window[prefixes[i] + 'MutationObserver'];
|
782
|
+
}
|
783
|
+
}
|
784
|
+
return false;
|
785
|
+
}();
|
786
|
+
|
787
|
+
var triggers = function (el, type) {
|
788
|
+
el.data(type).split(' ').forEach(function (id) {
|
789
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + id)[type === 'close' ? 'trigger' : 'triggerHandler'](type + '.zf.trigger', [el]);
|
790
|
+
});
|
791
|
+
};
|
792
|
+
|
793
|
+
var Triggers = {
|
794
|
+
Listeners: {
|
795
|
+
Basic: {},
|
796
|
+
Global: {}
|
797
|
+
},
|
798
|
+
Initializers: {}
|
799
|
+
};
|
800
|
+
|
801
|
+
Triggers.Listeners.Basic = {
|
802
|
+
openListener: function () {
|
803
|
+
triggers(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 'open');
|
804
|
+
},
|
805
|
+
closeListener: function () {
|
806
|
+
var id = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('close');
|
807
|
+
if (id) {
|
808
|
+
triggers(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 'close');
|
809
|
+
} else {
|
810
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).trigger('close.zf.trigger');
|
811
|
+
}
|
812
|
+
},
|
813
|
+
toggleListener: function () {
|
814
|
+
var id = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('toggle');
|
815
|
+
if (id) {
|
816
|
+
triggers(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 'toggle');
|
817
|
+
} else {
|
818
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).trigger('toggle.zf.trigger');
|
819
|
+
}
|
820
|
+
},
|
821
|
+
closeableListener: function (e) {
|
822
|
+
e.stopPropagation();
|
823
|
+
var animation = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('closable');
|
824
|
+
|
825
|
+
if (animation !== '') {
|
826
|
+
__WEBPACK_IMPORTED_MODULE_1__foundation_util_motion__["Motion"].animateOut(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), animation, function () {
|
827
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).trigger('closed.zf');
|
828
|
+
});
|
829
|
+
} else {
|
830
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).fadeOut().trigger('closed.zf');
|
831
|
+
}
|
832
|
+
},
|
833
|
+
toggleFocusListener: function () {
|
834
|
+
var id = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('toggle-focus');
|
835
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + id).triggerHandler('toggle.zf.trigger', [__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)]);
|
836
|
+
}
|
837
|
+
};
|
838
|
+
|
839
|
+
// Elements with [data-open] will reveal a plugin that supports it when clicked.
|
840
|
+
Triggers.Initializers.addOpenListener = function ($elem) {
|
841
|
+
$elem.off('click.zf.trigger', Triggers.Listeners.Basic.openListener);
|
842
|
+
$elem.on('click.zf.trigger', '[data-open]', Triggers.Listeners.Basic.openListener);
|
843
|
+
};
|
844
|
+
|
845
|
+
// Elements with [data-close] will close a plugin that supports it when clicked.
|
846
|
+
// If used without a value on [data-close], the event will bubble, allowing it to close a parent component.
|
847
|
+
Triggers.Initializers.addCloseListener = function ($elem) {
|
848
|
+
$elem.off('click.zf.trigger', Triggers.Listeners.Basic.closeListener);
|
849
|
+
$elem.on('click.zf.trigger', '[data-close]', Triggers.Listeners.Basic.closeListener);
|
850
|
+
};
|
851
|
+
|
852
|
+
// Elements with [data-toggle] will toggle a plugin that supports it when clicked.
|
853
|
+
Triggers.Initializers.addToggleListener = function ($elem) {
|
854
|
+
$elem.off('click.zf.trigger', Triggers.Listeners.Basic.toggleListener);
|
855
|
+
$elem.on('click.zf.trigger', '[data-toggle]', Triggers.Listeners.Basic.toggleListener);
|
856
|
+
};
|
857
|
+
|
858
|
+
// Elements with [data-closable] will respond to close.zf.trigger events.
|
859
|
+
Triggers.Initializers.addCloseableListener = function ($elem) {
|
860
|
+
$elem.off('close.zf.trigger', Triggers.Listeners.Basic.closeableListener);
|
861
|
+
$elem.on('close.zf.trigger', '[data-closeable], [data-closable]', Triggers.Listeners.Basic.closeableListener);
|
862
|
+
};
|
863
|
+
|
864
|
+
// Elements with [data-toggle-focus] will respond to coming in and out of focus
|
865
|
+
Triggers.Initializers.addToggleFocusListener = function ($elem) {
|
866
|
+
$elem.off('focus.zf.trigger blur.zf.trigger', Triggers.Listeners.Basic.toggleFocusListener);
|
867
|
+
$elem.on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', Triggers.Listeners.Basic.toggleFocusListener);
|
868
|
+
};
|
869
|
+
|
870
|
+
// More Global/complex listeners and triggers
|
871
|
+
Triggers.Listeners.Global = {
|
872
|
+
resizeListener: function ($nodes) {
|
873
|
+
if (!MutationObserver) {
|
874
|
+
//fallback for IE 9
|
875
|
+
$nodes.each(function () {
|
876
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).triggerHandler('resizeme.zf.trigger');
|
877
|
+
});
|
878
|
+
}
|
879
|
+
//trigger all listening elements and signal a resize event
|
880
|
+
$nodes.attr('data-events', "resize");
|
881
|
+
},
|
882
|
+
scrollListener: function ($nodes) {
|
883
|
+
if (!MutationObserver) {
|
884
|
+
//fallback for IE 9
|
885
|
+
$nodes.each(function () {
|
886
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).triggerHandler('scrollme.zf.trigger');
|
887
|
+
});
|
888
|
+
}
|
889
|
+
//trigger all listening elements and signal a scroll event
|
890
|
+
$nodes.attr('data-events', "scroll");
|
891
|
+
},
|
892
|
+
closeMeListener: function (e, pluginId) {
|
893
|
+
var plugin = e.namespace.split('.')[0];
|
894
|
+
var plugins = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-' + plugin + ']').not('[data-yeti-box="' + pluginId + '"]');
|
895
|
+
|
896
|
+
plugins.each(function () {
|
897
|
+
var _this = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this);
|
898
|
+
_this.triggerHandler('close.zf.trigger', [_this]);
|
899
|
+
});
|
900
|
+
}
|
901
|
+
};
|
902
|
+
|
903
|
+
// Global, parses whole document.
|
904
|
+
Triggers.Initializers.addClosemeListener = function (pluginName) {
|
905
|
+
var yetiBoxes = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-yeti-box]'),
|
906
|
+
plugNames = ['dropdown', 'tooltip', 'reveal'];
|
907
|
+
|
908
|
+
if (pluginName) {
|
909
|
+
if (typeof pluginName === 'string') {
|
910
|
+
plugNames.push(pluginName);
|
911
|
+
} else if (typeof pluginName === 'object' && typeof pluginName[0] === 'string') {
|
912
|
+
plugNames.concat(pluginName);
|
913
|
+
} else {
|
914
|
+
console.error('Plugin names must be strings');
|
915
|
+
}
|
916
|
+
}
|
917
|
+
if (yetiBoxes.length) {
|
918
|
+
var listeners = plugNames.map(function (name) {
|
919
|
+
return 'closeme.zf.' + name;
|
920
|
+
}).join(' ');
|
921
|
+
|
922
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off(listeners).on(listeners, Triggers.Listeners.Global.closeMeListener);
|
923
|
+
}
|
924
|
+
};
|
925
|
+
|
926
|
+
function debounceGlobalListener(debounce, trigger, listener) {
|
927
|
+
var timer = void 0,
|
928
|
+
args = Array.prototype.slice.call(arguments, 3);
|
929
|
+
__WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off(trigger).on(trigger, function (e) {
|
930
|
+
if (timer) {
|
931
|
+
clearTimeout(timer);
|
932
|
+
}
|
933
|
+
timer = setTimeout(function () {
|
934
|
+
listener.apply(null, args);
|
935
|
+
}, debounce || 10); //default time to emit scroll event
|
936
|
+
});
|
937
|
+
}
|
938
|
+
|
939
|
+
Triggers.Initializers.addResizeListener = function (debounce) {
|
940
|
+
var $nodes = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-resize]');
|
941
|
+
if ($nodes.length) {
|
942
|
+
debounceGlobalListener(debounce, 'resize.zf.trigger', Triggers.Listeners.Global.resizeListener, $nodes);
|
943
|
+
}
|
944
|
+
};
|
945
|
+
|
946
|
+
Triggers.Initializers.addScrollListener = function (debounce) {
|
947
|
+
var $nodes = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-scroll]');
|
948
|
+
if ($nodes.length) {
|
949
|
+
debounceGlobalListener(debounce, 'scroll.zf.trigger', Triggers.Listeners.Global.scrollListener, $nodes);
|
950
|
+
}
|
951
|
+
};
|
952
|
+
|
953
|
+
Triggers.Initializers.addMutationEventsListener = function ($elem) {
|
954
|
+
if (!MutationObserver) {
|
955
|
+
return false;
|
956
|
+
}
|
957
|
+
var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]');
|
958
|
+
|
959
|
+
//element callback
|
960
|
+
var listeningElementsMutation = function (mutationRecordsList) {
|
961
|
+
var $target = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(mutationRecordsList[0].target);
|
962
|
+
|
963
|
+
//trigger the event handler for the element depending on type
|
964
|
+
switch (mutationRecordsList[0].type) {
|
965
|
+
case "attributes":
|
966
|
+
if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") {
|
967
|
+
$target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]);
|
968
|
+
}
|
969
|
+
if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") {
|
970
|
+
$target.triggerHandler('resizeme.zf.trigger', [$target]);
|
971
|
+
}
|
972
|
+
if (mutationRecordsList[0].attributeName === "style") {
|
973
|
+
$target.closest("[data-mutate]").attr("data-events", "mutate");
|
974
|
+
$target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
|
975
|
+
}
|
976
|
+
break;
|
977
|
+
|
978
|
+
case "childList":
|
979
|
+
$target.closest("[data-mutate]").attr("data-events", "mutate");
|
980
|
+
$target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
|
981
|
+
break;
|
982
|
+
|
983
|
+
default:
|
984
|
+
return false;
|
985
|
+
//nothing
|
986
|
+
}
|
987
|
+
};
|
988
|
+
|
989
|
+
if ($nodes.length) {
|
990
|
+
//for each element that needs to listen for resizing, scrolling, or mutation add a single observer
|
991
|
+
for (var i = 0; i <= $nodes.length - 1; i++) {
|
992
|
+
var elementObserver = new MutationObserver(listeningElementsMutation);
|
993
|
+
elementObserver.observe($nodes[i], { attributes: true, childList: true, characterData: false, subtree: true, attributeFilter: ["data-events", "style"] });
|
994
|
+
}
|
995
|
+
}
|
996
|
+
};
|
997
|
+
|
998
|
+
Triggers.Initializers.addSimpleListeners = function () {
|
999
|
+
var $document = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document);
|
1000
|
+
|
1001
|
+
Triggers.Initializers.addOpenListener($document);
|
1002
|
+
Triggers.Initializers.addCloseListener($document);
|
1003
|
+
Triggers.Initializers.addToggleListener($document);
|
1004
|
+
Triggers.Initializers.addCloseableListener($document);
|
1005
|
+
Triggers.Initializers.addToggleFocusListener($document);
|
1006
|
+
};
|
1007
|
+
|
1008
|
+
Triggers.Initializers.addGlobalListeners = function () {
|
1009
|
+
var $document = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document);
|
1010
|
+
Triggers.Initializers.addMutationEventsListener($document);
|
1011
|
+
Triggers.Initializers.addResizeListener();
|
1012
|
+
Triggers.Initializers.addScrollListener();
|
1013
|
+
Triggers.Initializers.addClosemeListener();
|
1014
|
+
};
|
1015
|
+
|
1016
|
+
Triggers.init = function ($, Foundation) {
|
1017
|
+
if (typeof $.triggersInitialized === 'undefined') {
|
1018
|
+
var $document = $(document);
|
1019
|
+
|
1020
|
+
if (document.readyState === "complete") {
|
1021
|
+
Triggers.Initializers.addSimpleListeners();
|
1022
|
+
Triggers.Initializers.addGlobalListeners();
|
1023
|
+
} else {
|
1024
|
+
$(window).on('load', function () {
|
1025
|
+
Triggers.Initializers.addSimpleListeners();
|
1026
|
+
Triggers.Initializers.addGlobalListeners();
|
1027
|
+
});
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
$.triggersInitialized = true;
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
if (Foundation) {
|
1034
|
+
Foundation.Triggers = Triggers;
|
1035
|
+
// Legacy included to be backwards compatible for now.
|
1036
|
+
Foundation.IHearYou = Triggers.Initializers.addGlobalListeners;
|
1037
|
+
}
|
1038
|
+
};
|
1039
|
+
|
1040
|
+
|
1041
|
+
|
1042
|
+
/***/ }),
|
1043
|
+
|
1044
|
+
/***/ 88:
|
1045
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1046
|
+
|
1047
|
+
module.exports = __webpack_require__(22);
|
1048
|
+
|
1049
|
+
|
1050
|
+
/***/ })
|
1051
|
+
|
1052
|
+
/******/ });
|