1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory(require("./foundation.util.keyboard"), require("./foundation.core"), require("jquery"), require("./foundation.util.box"), require("./foundation.util.motion"), require("./foundation.util.touch"));
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define(["./foundation.util.keyboard", "./foundation.core", "jquery", "./foundation.util.box", "./foundation.util.motion", "./foundation.util.touch"], factory);
|
6 | else if(typeof exports === 'object')
|
7 | exports["foundation.dropdown"] = factory(require("./foundation.util.keyboard"), require("./foundation.core"), require("jquery"), require("./foundation.util.box"), require("./foundation.util.motion"), require("./foundation.util.touch"));
|
8 | else
|
9 | root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.dropdown"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.util.keyboard"], root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["jQuery"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.box"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.motion"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.touch"]);
|
10 | })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__, __WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE_jquery__, __WEBPACK_EXTERNAL_MODULE__foundation_util_box__, __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__, __WEBPACK_EXTERNAL_MODULE__foundation_util_touch__) {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId]) {
|
20 | return installedModules[moduleId].exports;
|
21 | }
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | i: moduleId,
|
25 | l: false,
|
26 | exports: {}
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.l = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
47 | __webpack_require__.d = function(exports, name, getter) {
|
48 | if(!__webpack_require__.o(exports, name)) {
|
49 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
50 | }
|
51 | };
|
52 |
|
53 |
|
54 | __webpack_require__.r = function(exports) {
|
55 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
56 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
57 | }
|
58 | Object.defineProperty(exports, '__esModule', { value: true });
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | __webpack_require__.t = function(value, mode) {
|
67 | if(mode & 1) value = __webpack_require__(value);
|
68 | if(mode & 8) return value;
|
69 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
70 | var ns = Object.create(null);
|
71 | __webpack_require__.r(ns);
|
72 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
73 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
74 | return ns;
|
75 | };
|
76 |
|
77 |
|
78 | __webpack_require__.n = function(module) {
|
79 | var getter = module && module.__esModule ?
|
80 | function getDefault() { return module['default']; } :
|
81 | function getModuleExports() { return module; };
|
82 | __webpack_require__.d(getter, 'a', getter);
|
83 | return getter;
|
84 | };
|
85 |
|
86 |
|
87 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
88 |
|
89 |
|
90 | __webpack_require__.p = "";
|
91 |
|
92 |
|
93 |
|
94 | return __webpack_require__(__webpack_require__.s = 4);
|
95 | })
|
96 |
|
97 | ({
|
98 |
|
99 | "./foundation.core":
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | (function(module, exports) {
|
105 |
|
106 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
|
107 |
|
108 | }),
|
109 |
|
110 | "./foundation.util.box":
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | (function(module, exports) {
|
116 |
|
117 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_box__;
|
118 |
|
119 | }),
|
120 |
|
121 | "./foundation.util.keyboard":
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | (function(module, exports) {
|
127 |
|
128 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__;
|
129 |
|
130 | }),
|
131 |
|
132 | "./foundation.util.motion":
|
133 |
|
134 |
|
135 |
|
136 |
|
137 | (function(module, exports) {
|
138 |
|
139 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__;
|
140 |
|
141 | }),
|
142 |
|
143 | "./foundation.util.touch":
|
144 |
|
145 |
|
146 |
|
147 |
|
148 | (function(module, exports) {
|
149 |
|
150 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_touch__;
|
151 |
|
152 | }),
|
153 |
|
154 | "./js/entries/plugins/foundation.dropdown.js":
|
155 |
|
156 |
|
157 |
|
158 |
|
159 | (function(module, __webpack_exports__, __webpack_require__) {
|
160 |
|
161 | "use strict";
|
162 | __webpack_require__.r(__webpack_exports__);
|
163 | var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./foundation.core");
|
164 | var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
|
165 | __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
|
166 |
|
167 | var _foundation_dropdown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./js/foundation.dropdown.js");
|
168 | __webpack_require__.d(__webpack_exports__, "Dropdown", function() { return _foundation_dropdown__WEBPACK_IMPORTED_MODULE_1__["Dropdown"]; });
|
169 |
|
170 |
|
171 |
|
172 | _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_dropdown__WEBPACK_IMPORTED_MODULE_1__["Dropdown"], 'Dropdown');
|
173 |
|
174 |
|
175 | }),
|
176 |
|
177 | "./js/foundation.dropdown.js":
|
178 |
|
179 |
|
180 |
|
181 |
|
182 | (function(module, __webpack_exports__, __webpack_require__) {
|
183 |
|
184 | "use strict";
|
185 | __webpack_require__.r(__webpack_exports__);
|
186 | __webpack_require__.d(__webpack_exports__, "Dropdown", function() { return Dropdown; });
|
187 | var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "jquery");
|
188 | var jquery__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
|
189 | var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./foundation.util.keyboard");
|
190 | var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__);
|
191 | var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./foundation.core");
|
192 | var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__);
|
193 | var _foundation_positionable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( "./js/foundation.positionable.js");
|
194 | var _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( "./js/foundation.util.triggers.js");
|
195 | var _foundation_util_touch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( "./foundation.util.touch");
|
196 | var _foundation_util_touch__WEBPACK_IMPORTED_MODULE_5___default = __webpack_require__.n(_foundation_util_touch__WEBPACK_IMPORTED_MODULE_5__);
|
197 |
|
198 |
|
199 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
200 |
|
201 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
202 |
|
203 | 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); } }
|
204 |
|
205 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
206 |
|
207 | function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
208 |
|
209 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
210 |
|
211 | function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
212 |
|
213 | function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
214 |
|
215 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
216 |
|
217 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
218 |
|
219 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 | var Dropdown =
|
237 |
|
238 | function (_Positionable) {
|
239 | _inherits(Dropdown, _Positionable);
|
240 |
|
241 | function Dropdown() {
|
242 | _classCallCheck(this, Dropdown);
|
243 |
|
244 | return _possibleConstructorReturn(this, _getPrototypeOf(Dropdown).apply(this, arguments));
|
245 | }
|
246 |
|
247 | _createClass(Dropdown, [{
|
248 | key: "_setup",
|
249 |
|
250 | |
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 | value: function _setup(element, options) {
|
259 | this.$element = element;
|
260 | this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Dropdown.defaults, this.$element.data(), options);
|
261 | this.className = 'Dropdown';
|
262 |
|
263 |
|
264 | _foundation_util_touch__WEBPACK_IMPORTED_MODULE_5__["Touch"].init(jquery__WEBPACK_IMPORTED_MODULE_0___default.a);
|
265 | _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_4__["Triggers"].init(jquery__WEBPACK_IMPORTED_MODULE_0___default.a);
|
266 |
|
267 | this._init();
|
268 |
|
269 | _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].register('Dropdown', {
|
270 | 'ENTER': 'toggle',
|
271 | 'SPACE': 'toggle',
|
272 | 'ESCAPE': 'close'
|
273 | });
|
274 | }
|
275 | |
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 | }, {
|
282 | key: "_init",
|
283 | value: function _init() {
|
284 | var $id = this.$element.attr('id');
|
285 | this.$anchors = jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-toggle=\"".concat($id, "\"]")).length ? jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-toggle=\"".concat($id, "\"]")) : jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-open=\"".concat($id, "\"]"));
|
286 | this.$anchors.attr({
|
287 | 'aria-controls': $id,
|
288 | 'data-is-focus': false,
|
289 | 'data-yeti-box': $id,
|
290 | 'aria-haspopup': true,
|
291 | 'aria-expanded': false
|
292 | });
|
293 |
|
294 | this._setCurrentAnchor(this.$anchors.first());
|
295 |
|
296 | if (this.options.parentClass) {
|
297 | this.$parent = this.$element.parents('.' + this.options.parentClass);
|
298 | } else {
|
299 | this.$parent = null;
|
300 | }
|
301 |
|
302 |
|
303 | if (typeof this.$element.attr('aria-labelledby') === 'undefined') {
|
304 |
|
305 | if (typeof this.$currentAnchor.attr('id') === 'undefined') {
|
306 | this.$currentAnchor.attr('id', Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__["GetYoDigits"])(6, 'dd-anchor'));
|
307 | }
|
308 |
|
309 | this.$element.attr('aria-labelledby', this.$currentAnchor.attr('id'));
|
310 | }
|
311 |
|
312 | this.$element.attr({
|
313 | 'aria-hidden': 'true',
|
314 | 'data-yeti-box': $id,
|
315 | 'data-resize': $id
|
316 | });
|
317 |
|
318 | _get(_getPrototypeOf(Dropdown.prototype), "_init", this).call(this);
|
319 |
|
320 | this._events();
|
321 | }
|
322 | }, {
|
323 | key: "_getDefaultPosition",
|
324 | value: function _getDefaultPosition() {
|
325 |
|
326 | var position = this.$element[0].className.match(/(top|left|right|bottom)/g);
|
327 |
|
328 | if (position) {
|
329 | return position[0];
|
330 | } else {
|
331 | return 'bottom';
|
332 | }
|
333 | }
|
334 | }, {
|
335 | key: "_getDefaultAlignment",
|
336 | value: function _getDefaultAlignment() {
|
337 |
|
338 | var horizontalPosition = /float-(\S+)/.exec(this.$currentAnchor.attr('class'));
|
339 |
|
340 | if (horizontalPosition) {
|
341 | return horizontalPosition[1];
|
342 | }
|
343 |
|
344 | return _get(_getPrototypeOf(Dropdown.prototype), "_getDefaultAlignment", this).call(this);
|
345 | }
|
346 | |
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 | }, {
|
354 | key: "_setPosition",
|
355 | value: function _setPosition() {
|
356 | this.$element.removeClass("has-position-".concat(this.position, " has-alignment-").concat(this.alignment));
|
357 |
|
358 | _get(_getPrototypeOf(Dropdown.prototype), "_setPosition", this).call(this, this.$currentAnchor, this.$element, this.$parent);
|
359 |
|
360 | this.$element.addClass("has-position-".concat(this.position, " has-alignment-").concat(this.alignment));
|
361 | }
|
362 | |
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 | }, {
|
371 | key: "_setCurrentAnchor",
|
372 | value: function _setCurrentAnchor(el) {
|
373 | this.$currentAnchor = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
|
374 | }
|
375 | |
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 | }, {
|
382 | key: "_events",
|
383 | value: function _events() {
|
384 | var _this = this,
|
385 | hasTouch = 'ontouchstart' in window || typeof window.ontouchstart !== 'undefined';
|
386 |
|
387 | this.$element.on({
|
388 | 'open.zf.trigger': this.open.bind(this),
|
389 | 'close.zf.trigger': this.close.bind(this),
|
390 | 'toggle.zf.trigger': this.toggle.bind(this),
|
391 | 'resizeme.zf.trigger': this._setPosition.bind(this)
|
392 | });
|
393 | this.$anchors.off('click.zf.trigger').on('click.zf.trigger', function (e) {
|
394 | _this._setCurrentAnchor(this);
|
395 |
|
396 | if (
|
397 | _this.options.forceFollow === false ||
|
398 |
|
399 | hasTouch && _this.options.hover && _this.$element.hasClass('is-open') === false) {
|
400 | e.preventDefault();
|
401 | }
|
402 | });
|
403 |
|
404 | if (this.options.hover) {
|
405 | this.$anchors.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () {
|
406 | _this._setCurrentAnchor(this);
|
407 |
|
408 | var bodyData = jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').data();
|
409 |
|
410 | if (typeof bodyData.whatinput === 'undefined' || bodyData.whatinput === 'mouse') {
|
411 | clearTimeout(_this.timeout);
|
412 | _this.timeout = setTimeout(function () {
|
413 | _this.open();
|
414 |
|
415 | _this.$anchors.data('hover', true);
|
416 | }, _this.options.hoverDelay);
|
417 | }
|
418 | }).on('mouseleave.zf.dropdown', Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__["ignoreMousedisappear"])(function () {
|
419 | clearTimeout(_this.timeout);
|
420 | _this.timeout = setTimeout(function () {
|
421 | _this.close();
|
422 |
|
423 | _this.$anchors.data('hover', false);
|
424 | }, _this.options.hoverDelay);
|
425 | }));
|
426 |
|
427 | if (this.options.hoverPane) {
|
428 | this.$element.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () {
|
429 | clearTimeout(_this.timeout);
|
430 | }).on('mouseleave.zf.dropdown', Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__["ignoreMousedisappear"])(function () {
|
431 | clearTimeout(_this.timeout);
|
432 | _this.timeout = setTimeout(function () {
|
433 | _this.close();
|
434 |
|
435 | _this.$anchors.data('hover', false);
|
436 | }, _this.options.hoverDelay);
|
437 | }));
|
438 | }
|
439 | }
|
440 |
|
441 | this.$anchors.add(this.$element).on('keydown.zf.dropdown', function (e) {
|
442 | var $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
|
443 | visibleFocusableElements = _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].findFocusable(_this.$element);
|
444 | _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].handleKey(e, 'Dropdown', {
|
445 | open: function open() {
|
446 | if ($target.is(_this.$anchors) && !$target.is('input, textarea')) {
|
447 | _this.open();
|
448 |
|
449 | _this.$element.attr('tabindex', -1).focus();
|
450 |
|
451 | e.preventDefault();
|
452 | }
|
453 | },
|
454 | close: function close() {
|
455 | _this.close();
|
456 |
|
457 | _this.$anchors.focus();
|
458 | }
|
459 | });
|
460 | });
|
461 | }
|
462 | |
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 | }, {
|
469 | key: "_addBodyHandler",
|
470 | value: function _addBodyHandler() {
|
471 | var $body = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).not(this.$element),
|
472 | _this = this;
|
473 |
|
474 | $body.off('click.zf.dropdown tap.zf.dropdown').on('click.zf.dropdown tap.zf.dropdown', function (e) {
|
475 | if (_this.$anchors.is(e.target) || _this.$anchors.find(e.target).length) {
|
476 | return;
|
477 | }
|
478 |
|
479 | if (_this.$element.is(e.target) || _this.$element.find(e.target).length) {
|
480 | return;
|
481 | }
|
482 |
|
483 | _this.close();
|
484 |
|
485 | $body.off('click.zf.dropdown tap.zf.dropdown');
|
486 | });
|
487 | }
|
488 | |
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 | }, {
|
496 | key: "open",
|
497 | value: function open() {
|
498 |
|
499 |
|
500 | |
501 |
|
502 |
|
503 |
|
504 | this.$element.trigger('closeme.zf.dropdown', this.$element.attr('id'));
|
505 | this.$anchors.addClass('hover').attr({
|
506 | 'aria-expanded': true
|
507 | });
|
508 |
|
509 | this.$element.addClass('is-opening');
|
510 |
|
511 | this._setPosition();
|
512 |
|
513 | this.$element.removeClass('is-opening').addClass('is-open').attr({
|
514 | 'aria-hidden': false
|
515 | });
|
516 |
|
517 | if (this.options.autoFocus) {
|
518 | var $focusable = _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].findFocusable(this.$element);
|
519 |
|
520 | if ($focusable.length) {
|
521 | $focusable.eq(0).focus();
|
522 | }
|
523 | }
|
524 |
|
525 | if (this.options.closeOnClick) {
|
526 | this._addBodyHandler();
|
527 | }
|
528 |
|
529 | if (this.options.trapFocus) {
|
530 | _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].trapFocus(this.$element);
|
531 | }
|
532 | |
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 | this.$element.trigger('show.zf.dropdown', [this.$element]);
|
539 | }
|
540 | |
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 | }, {
|
547 | key: "close",
|
548 | value: function close() {
|
549 | if (!this.$element.hasClass('is-open')) {
|
550 | return false;
|
551 | }
|
552 |
|
553 | this.$element.removeClass('is-open').attr({
|
554 | 'aria-hidden': true
|
555 | });
|
556 | this.$anchors.removeClass('hover').attr('aria-expanded', false);
|
557 | |
558 |
|
559 |
|
560 |
|
561 |
|
562 | this.$element.trigger('hide.zf.dropdown', [this.$element]);
|
563 |
|
564 | if (this.options.trapFocus) {
|
565 | _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].releaseFocus(this.$element);
|
566 | }
|
567 | }
|
568 | |
569 |
|
570 |
|
571 |
|
572 |
|
573 | }, {
|
574 | key: "toggle",
|
575 | value: function toggle() {
|
576 | if (this.$element.hasClass('is-open')) {
|
577 | if (this.$anchors.data('hover')) return;
|
578 | this.close();
|
579 | } else {
|
580 | this.open();
|
581 | }
|
582 | }
|
583 | |
584 |
|
585 |
|
586 |
|
587 |
|
588 | }, {
|
589 | key: "_destroy",
|
590 | value: function _destroy() {
|
591 | this.$element.off('.zf.trigger').hide();
|
592 | this.$anchors.off('.zf.dropdown');
|
593 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).off('click.zf.dropdown tap.zf.dropdown');
|
594 | }
|
595 | }]);
|
596 |
|
597 | return Dropdown;
|
598 | }(_foundation_positionable__WEBPACK_IMPORTED_MODULE_3__["Positionable"]);
|
599 |
|
600 | Dropdown.defaults = {
|
601 | |
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 | parentClass: null,
|
608 |
|
609 | |
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 | hoverDelay: 250,
|
616 |
|
617 | |
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 | hover: false,
|
624 |
|
625 | |
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 | hoverPane: false,
|
632 |
|
633 | |
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 | vOffset: 0,
|
640 |
|
641 | |
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 | hOffset: 0,
|
648 |
|
649 | |
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 | position: 'auto',
|
656 |
|
657 | |
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 | alignment: 'auto',
|
664 |
|
665 | |
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 | allowOverlap: false,
|
672 |
|
673 | |
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 | allowBottomOverlap: true,
|
682 |
|
683 | |
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 | trapFocus: false,
|
690 |
|
691 | |
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 | autoFocus: false,
|
698 |
|
699 | |
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 | closeOnClick: false,
|
706 |
|
707 | |
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 | forceFollow: true
|
714 | };
|
715 |
|
716 |
|
717 | }),
|
718 |
|
719 | "./js/foundation.positionable.js":
|
720 |
|
721 |
|
722 |
|
723 |
|
724 | (function(module, __webpack_exports__, __webpack_require__) {
|
725 |
|
726 | "use strict";
|
727 | __webpack_require__.r(__webpack_exports__);
|
728 | __webpack_require__.d(__webpack_exports__, "Positionable", function() { return Positionable; });
|
729 | var _foundation_util_box__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./foundation.util.box");
|
730 | var _foundation_util_box__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_foundation_util_box__WEBPACK_IMPORTED_MODULE_0__);
|
731 | var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./foundation.core");
|
732 | var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__);
|
733 |
|
734 |
|
735 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
736 |
|
737 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
738 |
|
739 | 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); } }
|
740 |
|
741 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
742 |
|
743 | function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
744 |
|
745 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
746 |
|
747 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
748 |
|
749 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
750 |
|
751 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
752 |
|
753 |
|
754 |
|
755 |
|
756 | var POSITIONS = ['left', 'right', 'top', 'bottom'];
|
757 | var VERTICAL_ALIGNMENTS = ['top', 'bottom', 'center'];
|
758 | var HORIZONTAL_ALIGNMENTS = ['left', 'right', 'center'];
|
759 | var ALIGNMENTS = {
|
760 | 'left': VERTICAL_ALIGNMENTS,
|
761 | 'right': VERTICAL_ALIGNMENTS,
|
762 | 'top': HORIZONTAL_ALIGNMENTS,
|
763 | 'bottom': HORIZONTAL_ALIGNMENTS
|
764 | };
|
765 |
|
766 | function nextItem(item, array) {
|
767 | var currentIdx = array.indexOf(item);
|
768 |
|
769 | if (currentIdx === array.length - 1) {
|
770 | return array[0];
|
771 | } else {
|
772 | return array[currentIdx + 1];
|
773 | }
|
774 | }
|
775 |
|
776 | var Positionable =
|
777 |
|
778 | function (_Plugin) {
|
779 | _inherits(Positionable, _Plugin);
|
780 |
|
781 | function Positionable() {
|
782 | _classCallCheck(this, Positionable);
|
783 |
|
784 | return _possibleConstructorReturn(this, _getPrototypeOf(Positionable).apply(this, arguments));
|
785 | }
|
786 |
|
787 | _createClass(Positionable, [{
|
788 | key: "_init",
|
789 |
|
790 | |
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 | value: function _init() {
|
800 | this.triedPositions = {};
|
801 | this.position = this.options.position === 'auto' ? this._getDefaultPosition() : this.options.position;
|
802 | this.alignment = this.options.alignment === 'auto' ? this._getDefaultAlignment() : this.options.alignment;
|
803 | this.originalPosition = this.position;
|
804 | this.originalAlignment = this.alignment;
|
805 | }
|
806 | }, {
|
807 | key: "_getDefaultPosition",
|
808 | value: function _getDefaultPosition() {
|
809 | return 'bottom';
|
810 | }
|
811 | }, {
|
812 | key: "_getDefaultAlignment",
|
813 | value: function _getDefaultAlignment() {
|
814 | switch (this.position) {
|
815 | case 'bottom':
|
816 | case 'top':
|
817 | return Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["rtl"])() ? 'right' : 'left';
|
818 |
|
819 | case 'left':
|
820 | case 'right':
|
821 | return 'bottom';
|
822 | }
|
823 | }
|
824 | |
825 |
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 | }, {
|
832 | key: "_reposition",
|
833 | value: function _reposition() {
|
834 | if (this._alignmentsExhausted(this.position)) {
|
835 | this.position = nextItem(this.position, POSITIONS);
|
836 | this.alignment = ALIGNMENTS[this.position][0];
|
837 | } else {
|
838 | this._realign();
|
839 | }
|
840 | }
|
841 | |
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 | }, {
|
849 | key: "_realign",
|
850 | value: function _realign() {
|
851 | this._addTriedPosition(this.position, this.alignment);
|
852 |
|
853 | this.alignment = nextItem(this.alignment, ALIGNMENTS[this.position]);
|
854 | }
|
855 | }, {
|
856 | key: "_addTriedPosition",
|
857 | value: function _addTriedPosition(position, alignment) {
|
858 | this.triedPositions[position] = this.triedPositions[position] || [];
|
859 | this.triedPositions[position].push(alignment);
|
860 | }
|
861 | }, {
|
862 | key: "_positionsExhausted",
|
863 | value: function _positionsExhausted() {
|
864 | var isExhausted = true;
|
865 |
|
866 | for (var i = 0; i < POSITIONS.length; i++) {
|
867 | isExhausted = isExhausted && this._alignmentsExhausted(POSITIONS[i]);
|
868 | }
|
869 |
|
870 | return isExhausted;
|
871 | }
|
872 | }, {
|
873 | key: "_alignmentsExhausted",
|
874 | value: function _alignmentsExhausted(position) {
|
875 | return this.triedPositions[position] && this.triedPositions[position].length == ALIGNMENTS[position].length;
|
876 | }
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 | }, {
|
884 | key: "_getVOffset",
|
885 | value: function _getVOffset() {
|
886 | return this.options.vOffset;
|
887 | }
|
888 | }, {
|
889 | key: "_getHOffset",
|
890 | value: function _getHOffset() {
|
891 | return this.options.hOffset;
|
892 | }
|
893 | }, {
|
894 | key: "_setPosition",
|
895 | value: function _setPosition($anchor, $element, $parent) {
|
896 | if ($anchor.attr('aria-expanded') === 'false') {
|
897 | return false;
|
898 | }
|
899 |
|
900 | if (!this.options.allowOverlap) {
|
901 |
|
902 | this.position = this.originalPosition;
|
903 | this.alignment = this.originalAlignment;
|
904 | }
|
905 |
|
906 | $element.offset(_foundation_util_box__WEBPACK_IMPORTED_MODULE_0__["Box"].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
|
907 |
|
908 | if (!this.options.allowOverlap) {
|
909 | var minOverlap = 100000000;
|
910 |
|
911 | var minCoordinates = {
|
912 | position: this.position,
|
913 | alignment: this.alignment
|
914 | };
|
915 |
|
916 | while (!this._positionsExhausted()) {
|
917 | var overlap = _foundation_util_box__WEBPACK_IMPORTED_MODULE_0__["Box"].OverlapArea($element, $parent, false, false, this.options.allowBottomOverlap);
|
918 |
|
919 | if (overlap === 0) {
|
920 | return;
|
921 | }
|
922 |
|
923 | if (overlap < minOverlap) {
|
924 | minOverlap = overlap;
|
925 | minCoordinates = {
|
926 | position: this.position,
|
927 | alignment: this.alignment
|
928 | };
|
929 | }
|
930 |
|
931 | this._reposition();
|
932 |
|
933 | $element.offset(_foundation_util_box__WEBPACK_IMPORTED_MODULE_0__["Box"].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
|
934 | }
|
935 |
|
936 |
|
937 |
|
938 | this.position = minCoordinates.position;
|
939 | this.alignment = minCoordinates.alignment;
|
940 | $element.offset(_foundation_util_box__WEBPACK_IMPORTED_MODULE_0__["Box"].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
|
941 | }
|
942 | }
|
943 | }]);
|
944 |
|
945 | return Positionable;
|
946 | }(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["Plugin"]);
|
947 |
|
948 | Positionable.defaults = {
|
949 | |
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 | position: 'auto',
|
956 |
|
957 | |
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 | alignment: 'auto',
|
964 |
|
965 | |
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 | allowOverlap: false,
|
974 |
|
975 | |
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 | allowBottomOverlap: true,
|
984 |
|
985 | |
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 | vOffset: 0,
|
992 |
|
993 | |
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 | hOffset: 0
|
1000 | };
|
1001 |
|
1002 |
|
1003 | }),
|
1004 |
|
1005 | "./js/foundation.util.triggers.js":
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 | (function(module, __webpack_exports__, __webpack_require__) {
|
1011 |
|
1012 | "use strict";
|
1013 | __webpack_require__.r(__webpack_exports__);
|
1014 | __webpack_require__.d(__webpack_exports__, "Triggers", function() { return Triggers; });
|
1015 | var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "jquery");
|
1016 | var jquery__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
|
1017 | var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./foundation.core");
|
1018 | var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__);
|
1019 | var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./foundation.util.motion");
|
1020 | var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(_foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__);
|
1021 |
|
1022 |
|
1023 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 | var MutationObserver = function () {
|
1030 | var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
|
1031 |
|
1032 | for (var i = 0; i < prefixes.length; i++) {
|
1033 | if ("".concat(prefixes[i], "MutationObserver") in window) {
|
1034 | return window["".concat(prefixes[i], "MutationObserver")];
|
1035 | }
|
1036 | }
|
1037 |
|
1038 | return false;
|
1039 | }();
|
1040 |
|
1041 | var triggers = function triggers(el, type) {
|
1042 | el.data(type).split(' ').forEach(function (id) {
|
1043 | jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(id))[type === 'close' ? 'trigger' : 'triggerHandler']("".concat(type, ".zf.trigger"), [el]);
|
1044 | });
|
1045 | };
|
1046 |
|
1047 | var Triggers = {
|
1048 | Listeners: {
|
1049 | Basic: {},
|
1050 | Global: {}
|
1051 | },
|
1052 | Initializers: {}
|
1053 | };
|
1054 | Triggers.Listeners.Basic = {
|
1055 | openListener: function openListener() {
|
1056 | triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'open');
|
1057 | },
|
1058 | closeListener: function closeListener() {
|
1059 | var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('close');
|
1060 |
|
1061 | if (id) {
|
1062 | triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'close');
|
1063 | } else {
|
1064 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('close.zf.trigger');
|
1065 | }
|
1066 | },
|
1067 | toggleListener: function toggleListener() {
|
1068 | var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('toggle');
|
1069 |
|
1070 | if (id) {
|
1071 | triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'toggle');
|
1072 | } else {
|
1073 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('toggle.zf.trigger');
|
1074 | }
|
1075 | },
|
1076 | closeableListener: function closeableListener(e) {
|
1077 | var animation = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('closable');
|
1078 |
|
1079 | e.stopPropagation();
|
1080 |
|
1081 | if (animation !== '') {
|
1082 | _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__["Motion"].animateOut(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), animation, function () {
|
1083 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('closed.zf');
|
1084 | });
|
1085 | } else {
|
1086 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).fadeOut().trigger('closed.zf');
|
1087 | }
|
1088 | },
|
1089 | toggleFocusListener: function toggleFocusListener() {
|
1090 | var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('toggle-focus');
|
1091 | jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(id)).triggerHandler('toggle.zf.trigger', [jquery__WEBPACK_IMPORTED_MODULE_0___default()(this)]);
|
1092 | }
|
1093 | };
|
1094 |
|
1095 | Triggers.Initializers.addOpenListener = function ($elem) {
|
1096 | $elem.off('click.zf.trigger', Triggers.Listeners.Basic.openListener);
|
1097 | $elem.on('click.zf.trigger', '[data-open]', Triggers.Listeners.Basic.openListener);
|
1098 | };
|
1099 |
|
1100 |
|
1101 |
|
1102 | Triggers.Initializers.addCloseListener = function ($elem) {
|
1103 | $elem.off('click.zf.trigger', Triggers.Listeners.Basic.closeListener);
|
1104 | $elem.on('click.zf.trigger', '[data-close]', Triggers.Listeners.Basic.closeListener);
|
1105 | };
|
1106 |
|
1107 |
|
1108 | Triggers.Initializers.addToggleListener = function ($elem) {
|
1109 | $elem.off('click.zf.trigger', Triggers.Listeners.Basic.toggleListener);
|
1110 | $elem.on('click.zf.trigger', '[data-toggle]', Triggers.Listeners.Basic.toggleListener);
|
1111 | };
|
1112 |
|
1113 |
|
1114 | Triggers.Initializers.addCloseableListener = function ($elem) {
|
1115 | $elem.off('close.zf.trigger', Triggers.Listeners.Basic.closeableListener);
|
1116 | $elem.on('close.zf.trigger', '[data-closeable], [data-closable]', Triggers.Listeners.Basic.closeableListener);
|
1117 | };
|
1118 |
|
1119 |
|
1120 | Triggers.Initializers.addToggleFocusListener = function ($elem) {
|
1121 | $elem.off('focus.zf.trigger blur.zf.trigger', Triggers.Listeners.Basic.toggleFocusListener);
|
1122 | $elem.on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', Triggers.Listeners.Basic.toggleFocusListener);
|
1123 | };
|
1124 |
|
1125 |
|
1126 | Triggers.Listeners.Global = {
|
1127 | resizeListener: function resizeListener($nodes) {
|
1128 | if (!MutationObserver) {
|
1129 |
|
1130 | $nodes.each(function () {
|
1131 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).triggerHandler('resizeme.zf.trigger');
|
1132 | });
|
1133 | }
|
1134 |
|
1135 |
|
1136 | $nodes.attr('data-events', "resize");
|
1137 | },
|
1138 | scrollListener: function scrollListener($nodes) {
|
1139 | if (!MutationObserver) {
|
1140 |
|
1141 | $nodes.each(function () {
|
1142 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).triggerHandler('scrollme.zf.trigger');
|
1143 | });
|
1144 | }
|
1145 |
|
1146 |
|
1147 | $nodes.attr('data-events', "scroll");
|
1148 | },
|
1149 | closeMeListener: function closeMeListener(e, pluginId) {
|
1150 | var plugin = e.namespace.split('.')[0];
|
1151 | var plugins = jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-".concat(plugin, "]")).not("[data-yeti-box=\"".concat(pluginId, "\"]"));
|
1152 | plugins.each(function () {
|
1153 | var _this = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
|
1154 |
|
1155 | _this.triggerHandler('close.zf.trigger', [_this]);
|
1156 | });
|
1157 | }
|
1158 |
|
1159 | };
|
1160 |
|
1161 | Triggers.Initializers.addClosemeListener = function (pluginName) {
|
1162 | var yetiBoxes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-yeti-box]'),
|
1163 | plugNames = ['dropdown', 'tooltip', 'reveal'];
|
1164 |
|
1165 | if (pluginName) {
|
1166 | if (typeof pluginName === 'string') {
|
1167 | plugNames.push(pluginName);
|
1168 | } else if (_typeof(pluginName) === 'object' && typeof pluginName[0] === 'string') {
|
1169 | plugNames = plugNames.concat(pluginName);
|
1170 | } else {
|
1171 | console.error('Plugin names must be strings');
|
1172 | }
|
1173 | }
|
1174 |
|
1175 | if (yetiBoxes.length) {
|
1176 | var listeners = plugNames.map(function (name) {
|
1177 | return "closeme.zf.".concat(name);
|
1178 | }).join(' ');
|
1179 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(listeners).on(listeners, Triggers.Listeners.Global.closeMeListener);
|
1180 | }
|
1181 | };
|
1182 |
|
1183 | function debounceGlobalListener(debounce, trigger, listener) {
|
1184 | var timer,
|
1185 | args = Array.prototype.slice.call(arguments, 3);
|
1186 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(trigger).on(trigger, function (e) {
|
1187 | if (timer) {
|
1188 | clearTimeout(timer);
|
1189 | }
|
1190 |
|
1191 | timer = setTimeout(function () {
|
1192 | listener.apply(null, args);
|
1193 | }, debounce || 10);
|
1194 | });
|
1195 | }
|
1196 |
|
1197 | Triggers.Initializers.addResizeListener = function (debounce) {
|
1198 | var $nodes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-resize]');
|
1199 |
|
1200 | if ($nodes.length) {
|
1201 | debounceGlobalListener(debounce, 'resize.zf.trigger', Triggers.Listeners.Global.resizeListener, $nodes);
|
1202 | }
|
1203 | };
|
1204 |
|
1205 | Triggers.Initializers.addScrollListener = function (debounce) {
|
1206 | var $nodes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-scroll]');
|
1207 |
|
1208 | if ($nodes.length) {
|
1209 | debounceGlobalListener(debounce, 'scroll.zf.trigger', Triggers.Listeners.Global.scrollListener, $nodes);
|
1210 | }
|
1211 | };
|
1212 |
|
1213 | Triggers.Initializers.addMutationEventsListener = function ($elem) {
|
1214 | if (!MutationObserver) {
|
1215 | return false;
|
1216 | }
|
1217 |
|
1218 | var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]');
|
1219 |
|
1220 | var listeningElementsMutation = function listeningElementsMutation(mutationRecordsList) {
|
1221 | var $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mutationRecordsList[0].target);
|
1222 |
|
1223 | switch (mutationRecordsList[0].type) {
|
1224 | case "attributes":
|
1225 | if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") {
|
1226 | $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]);
|
1227 | }
|
1228 |
|
1229 | if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") {
|
1230 | $target.triggerHandler('resizeme.zf.trigger', [$target]);
|
1231 | }
|
1232 |
|
1233 | if (mutationRecordsList[0].attributeName === "style") {
|
1234 | $target.closest("[data-mutate]").attr("data-events", "mutate");
|
1235 | $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
|
1236 | }
|
1237 |
|
1238 | break;
|
1239 |
|
1240 | case "childList":
|
1241 | $target.closest("[data-mutate]").attr("data-events", "mutate");
|
1242 | $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
|
1243 | break;
|
1244 |
|
1245 | default:
|
1246 | return false;
|
1247 |
|
1248 | }
|
1249 | };
|
1250 |
|
1251 | if ($nodes.length) {
|
1252 |
|
1253 | for (var i = 0; i <= $nodes.length - 1; i++) {
|
1254 | var elementObserver = new MutationObserver(listeningElementsMutation);
|
1255 | elementObserver.observe($nodes[i], {
|
1256 | attributes: true,
|
1257 | childList: true,
|
1258 | characterData: false,
|
1259 | subtree: true,
|
1260 | attributeFilter: ["data-events", "style"]
|
1261 | });
|
1262 | }
|
1263 | }
|
1264 | };
|
1265 |
|
1266 | Triggers.Initializers.addSimpleListeners = function () {
|
1267 | var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document);
|
1268 | Triggers.Initializers.addOpenListener($document);
|
1269 | Triggers.Initializers.addCloseListener($document);
|
1270 | Triggers.Initializers.addToggleListener($document);
|
1271 | Triggers.Initializers.addCloseableListener($document);
|
1272 | Triggers.Initializers.addToggleFocusListener($document);
|
1273 | };
|
1274 |
|
1275 | Triggers.Initializers.addGlobalListeners = function () {
|
1276 | var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document);
|
1277 | Triggers.Initializers.addMutationEventsListener($document);
|
1278 | Triggers.Initializers.addResizeListener();
|
1279 | Triggers.Initializers.addScrollListener();
|
1280 | Triggers.Initializers.addClosemeListener();
|
1281 | };
|
1282 |
|
1283 | Triggers.init = function ($, Foundation) {
|
1284 | Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["onLoad"])($(window), function () {
|
1285 | if ($.triggersInitialized !== true) {
|
1286 | Triggers.Initializers.addSimpleListeners();
|
1287 | Triggers.Initializers.addGlobalListeners();
|
1288 | $.triggersInitialized = true;
|
1289 | }
|
1290 | });
|
1291 |
|
1292 | if (Foundation) {
|
1293 | Foundation.Triggers = Triggers;
|
1294 |
|
1295 | Foundation.IHearYou = Triggers.Initializers.addGlobalListeners;
|
1296 | }
|
1297 | };
|
1298 |
|
1299 |
|
1300 |
|
1301 | }),
|
1302 |
|
1303 | 4:
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 | (function(module, exports, __webpack_require__) {
|
1309 |
|
1310 | module.exports = __webpack_require__("./js/entries/plugins/foundation.dropdown.js");
|
1311 |
|
1312 |
|
1313 | }),
|
1314 |
|
1315 | "jquery":
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 | (function(module, exports) {
|
1321 |
|
1322 | module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
|
1323 |
|
1324 | })
|
1325 |
|
1326 | });
|
1327 | });
|
1328 |
|
\ | No newline at end of file |