UNPKG

52.3 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory(require("./foundation.core"), require("./foundation.util.box"), require("./foundation.util.mediaQuery"), require("./foundation.util.motion"), require("jquery"));
4 else if(typeof define === 'function' && define.amd)
5 define(["./foundation.core", "./foundation.util.box", "./foundation.util.mediaQuery", "./foundation.util.motion", "jquery"], factory);
6 else if(typeof exports === 'object')
7 exports["foundation.tooltip"] = factory(require("./foundation.core"), require("./foundation.util.box"), require("./foundation.util.mediaQuery"), require("./foundation.util.motion"), require("jquery"));
8 else
9 root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.tooltip"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.box"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.mediaQuery"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.motion"], root["jQuery"]);
10})(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_box__, __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__, __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
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/******/ // define __esModule on exports
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/******/ // create a fake namespace object
62/******/ // mode & 1: value is a module id, require it
63/******/ // mode & 2: merge all properties of value into the ns
64/******/ // mode & 4: return value when already ns object
65/******/ // mode & 8|1: behave like require
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/******/ // getDefaultExport function for compatibility with non-harmony modules
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/******/ // Object.prototype.hasOwnProperty.call
87/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ // __webpack_public_path__
90/******/ __webpack_require__.p = "";
91/******/
92/******/
93/******/ // Load entry module and return exports
94/******/ return __webpack_require__(__webpack_require__.s = 20);
95/******/ })
96/************************************************************************/
97/******/ ({
98
99/***/ "./foundation.core":
100/*!****************************************************************************************************************************************************************!*\
101 !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***!
102 \****************************************************************************************************************************************************************/
103/*! no static exports found */
104/***/ (function(module, exports) {
105
106module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
107
108/***/ }),
109
110/***/ "./foundation.util.box":
111/*!********************************************************************************************************************************************************************************!*\
112 !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.box"],"amd":"./foundation.util.box","commonjs":"./foundation.util.box","commonjs2":"./foundation.util.box"} ***!
113 \********************************************************************************************************************************************************************************/
114/*! no static exports found */
115/***/ (function(module, exports) {
116
117module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_box__;
118
119/***/ }),
120
121/***/ "./foundation.util.mediaQuery":
122/*!************************************************************************************************************************************************************************************************************!*\
123 !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.mediaQuery"],"amd":"./foundation.util.mediaQuery","commonjs":"./foundation.util.mediaQuery","commonjs2":"./foundation.util.mediaQuery"} ***!
124 \************************************************************************************************************************************************************************************************************/
125/*! no static exports found */
126/***/ (function(module, exports) {
127
128module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__;
129
130/***/ }),
131
132/***/ "./foundation.util.motion":
133/*!********************************************************************************************************************************************************************************************!*\
134 !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.motion"],"amd":"./foundation.util.motion","commonjs":"./foundation.util.motion","commonjs2":"./foundation.util.motion"} ***!
135 \********************************************************************************************************************************************************************************************/
136/*! no static exports found */
137/***/ (function(module, exports) {
138
139module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__;
140
141/***/ }),
142
143/***/ "./js/entries/plugins/foundation.tooltip.js":
144/*!**************************************************!*\
145 !*** ./js/entries/plugins/foundation.tooltip.js ***!
146 \**************************************************/
147/*! exports provided: Foundation, Tooltip */
148/***/ (function(module, __webpack_exports__, __webpack_require__) {
149
150"use strict";
151__webpack_require__.r(__webpack_exports__);
152/* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core");
153/* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
154/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
155
156/* harmony import */ var _foundation_tooltip__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.tooltip */ "./js/foundation.tooltip.js");
157/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Tooltip", function() { return _foundation_tooltip__WEBPACK_IMPORTED_MODULE_1__["Tooltip"]; });
158
159
160
161_foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_tooltip__WEBPACK_IMPORTED_MODULE_1__["Tooltip"], 'Tooltip');
162
163
164/***/ }),
165
166/***/ "./js/foundation.positionable.js":
167/*!***************************************!*\
168 !*** ./js/foundation.positionable.js ***!
169 \***************************************/
170/*! exports provided: Positionable */
171/***/ (function(module, __webpack_exports__, __webpack_require__) {
172
173"use strict";
174__webpack_require__.r(__webpack_exports__);
175/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Positionable", function() { return Positionable; });
176/* harmony import */ var _foundation_util_box__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.util.box */ "./foundation.util.box");
177/* harmony import */ var _foundation_util_box__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_box__WEBPACK_IMPORTED_MODULE_0__);
178/* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.plugin */ "./foundation.core");
179/* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__);
180
181
182function _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); }
183
184function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
185
186function _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); } }
187
188function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
189
190function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
191
192function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
193
194function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
195
196function _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); }
197
198function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
199
200
201
202
203var POSITIONS = ['left', 'right', 'top', 'bottom'];
204var VERTICAL_ALIGNMENTS = ['top', 'bottom', 'center'];
205var HORIZONTAL_ALIGNMENTS = ['left', 'right', 'center'];
206var ALIGNMENTS = {
207 'left': VERTICAL_ALIGNMENTS,
208 'right': VERTICAL_ALIGNMENTS,
209 'top': HORIZONTAL_ALIGNMENTS,
210 'bottom': HORIZONTAL_ALIGNMENTS
211};
212
213function nextItem(item, array) {
214 var currentIdx = array.indexOf(item);
215
216 if (currentIdx === array.length - 1) {
217 return array[0];
218 } else {
219 return array[currentIdx + 1];
220 }
221}
222
223var Positionable =
224/*#__PURE__*/
225function (_Plugin) {
226 _inherits(Positionable, _Plugin);
227
228 function Positionable() {
229 _classCallCheck(this, Positionable);
230
231 return _possibleConstructorReturn(this, _getPrototypeOf(Positionable).apply(this, arguments));
232 }
233
234 _createClass(Positionable, [{
235 key: "_init",
236
237 /**
238 * Abstract class encapsulating the tether-like explicit positioning logic
239 * including repositioning based on overlap.
240 * Expects classes to define defaults for vOffset, hOffset, position,
241 * alignment, allowOverlap, and allowBottomOverlap. They can do this by
242 * extending the defaults, or (for now recommended due to the way docs are
243 * generated) by explicitly declaring them.
244 *
245 **/
246 value: function _init() {
247 this.triedPositions = {};
248 this.position = this.options.position === 'auto' ? this._getDefaultPosition() : this.options.position;
249 this.alignment = this.options.alignment === 'auto' ? this._getDefaultAlignment() : this.options.alignment;
250 this.originalPosition = this.position;
251 this.originalAlignment = this.alignment;
252 }
253 }, {
254 key: "_getDefaultPosition",
255 value: function _getDefaultPosition() {
256 return 'bottom';
257 }
258 }, {
259 key: "_getDefaultAlignment",
260 value: function _getDefaultAlignment() {
261 switch (this.position) {
262 case 'bottom':
263 case 'top':
264 return Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["rtl"])() ? 'right' : 'left';
265
266 case 'left':
267 case 'right':
268 return 'bottom';
269 }
270 }
271 /**
272 * Adjusts the positionable possible positions by iterating through alignments
273 * and positions.
274 * @function
275 * @private
276 */
277
278 }, {
279 key: "_reposition",
280 value: function _reposition() {
281 if (this._alignmentsExhausted(this.position)) {
282 this.position = nextItem(this.position, POSITIONS);
283 this.alignment = ALIGNMENTS[this.position][0];
284 } else {
285 this._realign();
286 }
287 }
288 /**
289 * Adjusts the dropdown pane possible positions by iterating through alignments
290 * on the current position.
291 * @function
292 * @private
293 */
294
295 }, {
296 key: "_realign",
297 value: function _realign() {
298 this._addTriedPosition(this.position, this.alignment);
299
300 this.alignment = nextItem(this.alignment, ALIGNMENTS[this.position]);
301 }
302 }, {
303 key: "_addTriedPosition",
304 value: function _addTriedPosition(position, alignment) {
305 this.triedPositions[position] = this.triedPositions[position] || [];
306 this.triedPositions[position].push(alignment);
307 }
308 }, {
309 key: "_positionsExhausted",
310 value: function _positionsExhausted() {
311 var isExhausted = true;
312
313 for (var i = 0; i < POSITIONS.length; i++) {
314 isExhausted = isExhausted && this._alignmentsExhausted(POSITIONS[i]);
315 }
316
317 return isExhausted;
318 }
319 }, {
320 key: "_alignmentsExhausted",
321 value: function _alignmentsExhausted(position) {
322 return this.triedPositions[position] && this.triedPositions[position].length == ALIGNMENTS[position].length;
323 } // When we're trying to center, we don't want to apply offset that's going to
324 // take us just off center, so wrap around to return 0 for the appropriate
325 // offset in those alignments. TODO: Figure out if we want to make this
326 // configurable behavior... it feels more intuitive, especially for tooltips, but
327 // it's possible someone might actually want to start from center and then nudge
328 // slightly off.
329
330 }, {
331 key: "_getVOffset",
332 value: function _getVOffset() {
333 return this.options.vOffset;
334 }
335 }, {
336 key: "_getHOffset",
337 value: function _getHOffset() {
338 return this.options.hOffset;
339 }
340 }, {
341 key: "_setPosition",
342 value: function _setPosition($anchor, $element, $parent) {
343 if ($anchor.attr('aria-expanded') === 'false') {
344 return false;
345 }
346
347 if (!this.options.allowOverlap) {
348 // restore original position & alignment before checking overlap
349 this.position = this.originalPosition;
350 this.alignment = this.originalAlignment;
351 }
352
353 $element.offset(_foundation_util_box__WEBPACK_IMPORTED_MODULE_0__["Box"].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
354
355 if (!this.options.allowOverlap) {
356 var minOverlap = 100000000; // default coordinates to how we start, in case we can't figure out better
357
358 var minCoordinates = {
359 position: this.position,
360 alignment: this.alignment
361 };
362
363 while (!this._positionsExhausted()) {
364 var overlap = _foundation_util_box__WEBPACK_IMPORTED_MODULE_0__["Box"].OverlapArea($element, $parent, false, false, this.options.allowBottomOverlap);
365
366 if (overlap === 0) {
367 return;
368 }
369
370 if (overlap < minOverlap) {
371 minOverlap = overlap;
372 minCoordinates = {
373 position: this.position,
374 alignment: this.alignment
375 };
376 }
377
378 this._reposition();
379
380 $element.offset(_foundation_util_box__WEBPACK_IMPORTED_MODULE_0__["Box"].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
381 } // If we get through the entire loop, there was no non-overlapping
382 // position available. Pick the version with least overlap.
383
384
385 this.position = minCoordinates.position;
386 this.alignment = minCoordinates.alignment;
387 $element.offset(_foundation_util_box__WEBPACK_IMPORTED_MODULE_0__["Box"].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
388 }
389 }
390 }]);
391
392 return Positionable;
393}(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["Plugin"]);
394
395Positionable.defaults = {
396 /**
397 * Position of positionable relative to anchor. Can be left, right, bottom, top, or auto.
398 * @option
399 * @type {string}
400 * @default 'auto'
401 */
402 position: 'auto',
403
404 /**
405 * Alignment of positionable relative to anchor. Can be left, right, bottom, top, center, or auto.
406 * @option
407 * @type {string}
408 * @default 'auto'
409 */
410 alignment: 'auto',
411
412 /**
413 * Allow overlap of container/window. If false, dropdown positionable first
414 * try to position as defined by data-position and data-alignment, but
415 * reposition if it would cause an overflow.
416 * @option
417 * @type {boolean}
418 * @default false
419 */
420 allowOverlap: false,
421
422 /**
423 * Allow overlap of only the bottom of the container. This is the most common
424 * behavior for dropdowns, allowing the dropdown to extend the bottom of the
425 * screen but not otherwise influence or break out of the container.
426 * @option
427 * @type {boolean}
428 * @default true
429 */
430 allowBottomOverlap: true,
431
432 /**
433 * Number of pixels the positionable should be separated vertically from anchor
434 * @option
435 * @type {number}
436 * @default 0
437 */
438 vOffset: 0,
439
440 /**
441 * Number of pixels the positionable should be separated horizontally from anchor
442 * @option
443 * @type {number}
444 * @default 0
445 */
446 hOffset: 0
447};
448
449
450/***/ }),
451
452/***/ "./js/foundation.tooltip.js":
453/*!**********************************!*\
454 !*** ./js/foundation.tooltip.js ***!
455 \**********************************/
456/*! exports provided: Tooltip */
457/***/ (function(module, __webpack_exports__, __webpack_require__) {
458
459"use strict";
460__webpack_require__.r(__webpack_exports__);
461/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Tooltip", function() { return Tooltip; });
462/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
463/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
464/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./foundation.core");
465/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__);
466/* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.mediaQuery */ "./foundation.util.mediaQuery");
467/* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__);
468/* harmony import */ var _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation.util.triggers */ "./js/foundation.util.triggers.js");
469/* harmony import */ var _foundation_positionable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./foundation.positionable */ "./js/foundation.positionable.js");
470
471
472function _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); }
473
474function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
475
476function _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); } }
477
478function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
479
480function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
481
482function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
483
484function _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); }
485
486function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
487
488function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
489
490function _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); }
491
492function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
493
494
495
496
497
498
499/**
500 * Tooltip module.
501 * @module foundation.tooltip
502 * @requires foundation.util.box
503 * @requires foundation.util.mediaQuery
504 * @requires foundation.util.triggers
505 */
506
507var Tooltip =
508/*#__PURE__*/
509function (_Positionable) {
510 _inherits(Tooltip, _Positionable);
511
512 function Tooltip() {
513 _classCallCheck(this, Tooltip);
514
515 return _possibleConstructorReturn(this, _getPrototypeOf(Tooltip).apply(this, arguments));
516 }
517
518 _createClass(Tooltip, [{
519 key: "_setup",
520
521 /**
522 * Creates a new instance of a Tooltip.
523 * @class
524 * @name Tooltip
525 * @fires Tooltip#init
526 * @param {jQuery} element - jQuery object to attach a tooltip to.
527 * @param {Object} options - object to extend the default configuration.
528 */
529 value: function _setup(element, options) {
530 this.$element = element;
531 this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Tooltip.defaults, this.$element.data(), options);
532 this.className = 'Tooltip'; // ie9 back compat
533
534 this.isActive = false;
535 this.isClick = false; // Triggers init is idempotent, just need to make sure it is initialized
536
537 _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_3__["Triggers"].init(jquery__WEBPACK_IMPORTED_MODULE_0___default.a);
538
539 this._init();
540 }
541 /**
542 * Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anchor.
543 * @private
544 */
545
546 }, {
547 key: "_init",
548 value: function _init() {
549 _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__["MediaQuery"]._init();
550
551 var elemId = this.$element.attr('aria-describedby') || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["GetYoDigits"])(6, 'tooltip');
552 this.options.tipText = this.options.tipText || this.$element.attr('title');
553 this.template = this.options.template ? jquery__WEBPACK_IMPORTED_MODULE_0___default()(this.options.template) : this._buildTemplate(elemId);
554
555 if (this.options.allowHtml) {
556 this.template.appendTo(document.body).html(this.options.tipText).hide();
557 } else {
558 this.template.appendTo(document.body).text(this.options.tipText).hide();
559 }
560
561 this.$element.attr({
562 'title': '',
563 'aria-describedby': elemId,
564 'data-yeti-box': elemId,
565 'data-toggle': elemId,
566 'data-resize': elemId
567 }).addClass(this.options.triggerClass);
568
569 _get(_getPrototypeOf(Tooltip.prototype), "_init", this).call(this);
570
571 this._events();
572 }
573 }, {
574 key: "_getDefaultPosition",
575 value: function _getDefaultPosition() {
576 // handle legacy classnames
577 var elementClassName = this.$element[0].className;
578
579 if (this.$element[0] instanceof SVGElement) {
580 elementClassName = elementClassName.baseVal;
581 }
582
583 var position = elementClassName.match(/\b(top|left|right|bottom)\b/g);
584 return position ? position[0] : 'top';
585 }
586 }, {
587 key: "_getDefaultAlignment",
588 value: function _getDefaultAlignment() {
589 return 'center';
590 }
591 }, {
592 key: "_getHOffset",
593 value: function _getHOffset() {
594 if (this.position === 'left' || this.position === 'right') {
595 return this.options.hOffset + this.options.tooltipWidth;
596 } else {
597 return this.options.hOffset;
598 }
599 }
600 }, {
601 key: "_getVOffset",
602 value: function _getVOffset() {
603 if (this.position === 'top' || this.position === 'bottom') {
604 return this.options.vOffset + this.options.tooltipHeight;
605 } else {
606 return this.options.vOffset;
607 }
608 }
609 /**
610 * builds the tooltip element, adds attributes, and returns the template.
611 * @private
612 */
613
614 }, {
615 key: "_buildTemplate",
616 value: function _buildTemplate(id) {
617 var templateClasses = "".concat(this.options.tooltipClass, " ").concat(this.options.templateClasses).trim();
618 var $template = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div></div>').addClass(templateClasses).attr({
619 'role': 'tooltip',
620 'aria-hidden': true,
621 'data-is-active': false,
622 'data-is-focus': false,
623 'id': id
624 });
625 return $template;
626 }
627 /**
628 * sets the position class of an element and recursively calls itself until there are no more possible positions to attempt, or the tooltip element is no longer colliding.
629 * if the tooltip is larger than the screen width, default to full width - any user selected margin
630 * @private
631 */
632
633 }, {
634 key: "_setPosition",
635 value: function _setPosition() {
636 _get(_getPrototypeOf(Tooltip.prototype), "_setPosition", this).call(this, this.$element, this.template);
637 }
638 /**
639 * reveals the tooltip, and fires an event to close any other open tooltips on the page
640 * @fires Tooltip#closeme
641 * @fires Tooltip#show
642 * @function
643 */
644
645 }, {
646 key: "show",
647 value: function show() {
648 if (this.options.showOn !== 'all' && !_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__["MediaQuery"].is(this.options.showOn)) {
649 // console.error('The screen is too small to display this tooltip');
650 return false;
651 }
652
653 var _this = this;
654
655 this.template.css('visibility', 'hidden').show();
656
657 this._setPosition();
658
659 this.template.removeClass('top bottom left right').addClass(this.position);
660 this.template.removeClass('align-top align-bottom align-left align-right align-center').addClass('align-' + this.alignment);
661 /**
662 * Fires to close all other open tooltips on the page
663 * @event Closeme#tooltip
664 */
665
666 this.$element.trigger('closeme.zf.tooltip', this.template.attr('id'));
667 this.template.attr({
668 'data-is-active': true,
669 'aria-hidden': false
670 });
671 _this.isActive = true; // console.log(this.template);
672
673 this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function () {//maybe do stuff?
674 });
675 /**
676 * Fires when the tooltip is shown
677 * @event Tooltip#show
678 */
679
680 this.$element.trigger('show.zf.tooltip');
681 }
682 /**
683 * Hides the current tooltip, and resets the positioning class if it was changed due to collision
684 * @fires Tooltip#hide
685 * @function
686 */
687
688 }, {
689 key: "hide",
690 value: function hide() {
691 // console.log('hiding', this.$element.data('yeti-box'));
692 var _this = this;
693
694 this.template.stop().attr({
695 'aria-hidden': true,
696 'data-is-active': false
697 }).fadeOut(this.options.fadeOutDuration, function () {
698 _this.isActive = false;
699 _this.isClick = false;
700 });
701 /**
702 * fires when the tooltip is hidden
703 * @event Tooltip#hide
704 */
705
706 this.$element.trigger('hide.zf.tooltip');
707 }
708 /**
709 * adds event listeners for the tooltip and its anchor
710 * TODO combine some of the listeners like focus and mouseenter, etc.
711 * @private
712 */
713
714 }, {
715 key: "_events",
716 value: function _events() {
717 var _this = this;
718
719 var hasTouch = 'ontouchstart' in window || typeof window.ontouchstart !== 'undefined';
720 var $template = this.template;
721 var isFocus = false; // `disableForTouch: Fully disable the tooltip on touch devices
722
723 if (hasTouch && this.options.disableForTouch) return;
724
725 if (!this.options.disableHover) {
726 this.$element.on('mouseenter.zf.tooltip', function (e) {
727 if (!_this.isActive) {
728 _this.timeout = setTimeout(function () {
729 _this.show();
730 }, _this.options.hoverDelay);
731 }
732 }).on('mouseleave.zf.tooltip', Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["ignoreMousedisappear"])(function (e) {
733 clearTimeout(_this.timeout);
734
735 if (!isFocus || _this.isClick && !_this.options.clickOpen) {
736 _this.hide();
737 }
738 }));
739 }
740
741 if (hasTouch) {
742 this.$element.on('tap.zf.tooltip touchend.zf.tooltip', function (e) {
743 _this.isActive ? _this.hide() : _this.show();
744 });
745 }
746
747 if (this.options.clickOpen) {
748 this.$element.on('mousedown.zf.tooltip', function (e) {
749 if (_this.isClick) {//_this.hide();
750 // _this.isClick = false;
751 } else {
752 _this.isClick = true;
753
754 if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) {
755 _this.show();
756 }
757 }
758 });
759 } else {
760 this.$element.on('mousedown.zf.tooltip', function (e) {
761 _this.isClick = true;
762 });
763 }
764
765 this.$element.on({
766 // 'toggle.zf.trigger': this.toggle.bind(this),
767 // 'close.zf.trigger': this.hide.bind(this)
768 'close.zf.trigger': this.hide.bind(this)
769 });
770 this.$element.on('focus.zf.tooltip', function (e) {
771 isFocus = true;
772
773 if (_this.isClick) {
774 // If we're not showing open on clicks, we need to pretend a click-launched focus isn't
775 // a real focus, otherwise on hover and come back we get bad behavior
776 if (!_this.options.clickOpen) {
777 isFocus = false;
778 }
779
780 return false;
781 } else {
782 _this.show();
783 }
784 }).on('focusout.zf.tooltip', function (e) {
785 isFocus = false;
786 _this.isClick = false;
787
788 _this.hide();
789 }).on('resizeme.zf.trigger', function () {
790 if (_this.isActive) {
791 _this._setPosition();
792 }
793 });
794 }
795 /**
796 * adds a toggle method, in addition to the static show() & hide() functions
797 * @function
798 */
799
800 }, {
801 key: "toggle",
802 value: function toggle() {
803 if (this.isActive) {
804 this.hide();
805 } else {
806 this.show();
807 }
808 }
809 /**
810 * Destroys an instance of tooltip, removes template element from the view.
811 * @function
812 */
813
814 }, {
815 key: "_destroy",
816 value: function _destroy() {
817 this.$element.attr('title', this.template.text()).off('.zf.trigger .zf.tooltip').removeClass(this.options.triggerClass).removeClass('top right left bottom').removeAttr('aria-describedby data-disable-hover data-resize data-toggle data-tooltip data-yeti-box');
818 this.template.remove();
819 }
820 }]);
821
822 return Tooltip;
823}(_foundation_positionable__WEBPACK_IMPORTED_MODULE_4__["Positionable"]);
824
825Tooltip.defaults = {
826 /**
827 * Time, in ms, before a tooltip should open on hover.
828 * @option
829 * @type {number}
830 * @default 200
831 */
832 hoverDelay: 200,
833
834 /**
835 * Time, in ms, a tooltip should take to fade into view.
836 * @option
837 * @type {number}
838 * @default 150
839 */
840 fadeInDuration: 150,
841
842 /**
843 * Time, in ms, a tooltip should take to fade out of view.
844 * @option
845 * @type {number}
846 * @default 150
847 */
848 fadeOutDuration: 150,
849
850 /**
851 * Disables hover events from opening the tooltip if set to true
852 * @option
853 * @type {boolean}
854 * @default false
855 */
856 disableHover: false,
857
858 /**
859 * Disable the tooltip for touch devices.
860 * This can be useful to make elements with a tooltip on it trigger their
861 * action on the first tap instead of displaying the tooltip.
862 * @option
863 * @type {booelan}
864 * @default false
865 */
866 disableForTouch: false,
867
868 /**
869 * Optional addtional classes to apply to the tooltip template on init.
870 * @option
871 * @type {string}
872 * @default ''
873 */
874 templateClasses: '',
875
876 /**
877 * Non-optional class added to tooltip templates. Foundation default is 'tooltip'.
878 * @option
879 * @type {string}
880 * @default 'tooltip'
881 */
882 tooltipClass: 'tooltip',
883
884 /**
885 * Class applied to the tooltip anchor element.
886 * @option
887 * @type {string}
888 * @default 'has-tip'
889 */
890 triggerClass: 'has-tip',
891
892 /**
893 * Minimum breakpoint size at which to open the tooltip.
894 * @option
895 * @type {string}
896 * @default 'small'
897 */
898 showOn: 'small',
899
900 /**
901 * Custom template to be used to generate markup for tooltip.
902 * @option
903 * @type {string}
904 * @default ''
905 */
906 template: '',
907
908 /**
909 * Text displayed in the tooltip template on open.
910 * @option
911 * @type {string}
912 * @default ''
913 */
914 tipText: '',
915 touchCloseText: 'Tap to close.',
916
917 /**
918 * Allows the tooltip to remain open if triggered with a click or touch event.
919 * @option
920 * @type {boolean}
921 * @default true
922 */
923 clickOpen: true,
924
925 /**
926 * Position of tooltip. Can be left, right, bottom, top, or auto.
927 * @option
928 * @type {string}
929 * @default 'auto'
930 */
931 position: 'auto',
932
933 /**
934 * Alignment of tooltip relative to anchor. Can be left, right, bottom, top, center, or auto.
935 * @option
936 * @type {string}
937 * @default 'auto'
938 */
939 alignment: 'auto',
940
941 /**
942 * Allow overlap of container/window. If false, tooltip will first try to
943 * position as defined by data-position and data-alignment, but reposition if
944 * it would cause an overflow. @option
945 * @type {boolean}
946 * @default false
947 */
948 allowOverlap: false,
949
950 /**
951 * Allow overlap of only the bottom of the container. This is the most common
952 * behavior for dropdowns, allowing the dropdown to extend the bottom of the
953 * screen but not otherwise influence or break out of the container.
954 * Less common for tooltips.
955 * @option
956 * @type {boolean}
957 * @default false
958 */
959 allowBottomOverlap: false,
960
961 /**
962 * Distance, in pixels, the template should push away from the anchor on the Y axis.
963 * @option
964 * @type {number}
965 * @default 0
966 */
967 vOffset: 0,
968
969 /**
970 * Distance, in pixels, the template should push away from the anchor on the X axis
971 * @option
972 * @type {number}
973 * @default 0
974 */
975 hOffset: 0,
976
977 /**
978 * Distance, in pixels, the template spacing auto-adjust for a vertical tooltip
979 * @option
980 * @type {number}
981 * @default 14
982 */
983 tooltipHeight: 14,
984
985 /**
986 * Distance, in pixels, the template spacing auto-adjust for a horizontal tooltip
987 * @option
988 * @type {number}
989 * @default 12
990 */
991 tooltipWidth: 12,
992
993 /**
994 * Allow HTML in tooltip. Warning: If you are loading user-generated content into tooltips,
995 * allowing HTML may open yourself up to XSS attacks.
996 * @option
997 * @type {boolean}
998 * @default false
999 */
1000 allowHtml: false
1001};
1002/**
1003 * TODO utilize resize event trigger
1004 */
1005
1006
1007
1008/***/ }),
1009
1010/***/ "./js/foundation.util.triggers.js":
1011/*!****************************************!*\
1012 !*** ./js/foundation.util.triggers.js ***!
1013 \****************************************/
1014/*! exports provided: Triggers */
1015/***/ (function(module, __webpack_exports__, __webpack_require__) {
1016
1017"use strict";
1018__webpack_require__.r(__webpack_exports__);
1019/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Triggers", function() { return Triggers; });
1020/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
1021/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
1022/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./foundation.core");
1023/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__);
1024/* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.motion */ "./foundation.util.motion");
1025/* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__);
1026
1027
1028function _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); }
1029
1030
1031
1032
1033
1034var MutationObserver = function () {
1035 var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
1036
1037 for (var i = 0; i < prefixes.length; i++) {
1038 if ("".concat(prefixes[i], "MutationObserver") in window) {
1039 return window["".concat(prefixes[i], "MutationObserver")];
1040 }
1041 }
1042
1043 return false;
1044}();
1045
1046var triggers = function triggers(el, type) {
1047 el.data(type).split(' ').forEach(function (id) {
1048 jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(id))[type === 'close' ? 'trigger' : 'triggerHandler']("".concat(type, ".zf.trigger"), [el]);
1049 });
1050};
1051
1052var Triggers = {
1053 Listeners: {
1054 Basic: {},
1055 Global: {}
1056 },
1057 Initializers: {}
1058};
1059Triggers.Listeners.Basic = {
1060 openListener: function openListener() {
1061 triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'open');
1062 },
1063 closeListener: function closeListener() {
1064 var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('close');
1065
1066 if (id) {
1067 triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'close');
1068 } else {
1069 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('close.zf.trigger');
1070 }
1071 },
1072 toggleListener: function toggleListener() {
1073 var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('toggle');
1074
1075 if (id) {
1076 triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'toggle');
1077 } else {
1078 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('toggle.zf.trigger');
1079 }
1080 },
1081 closeableListener: function closeableListener(e) {
1082 var animation = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('closable'); // Only close the first closable element. See https://git.io/zf-7833
1083
1084 e.stopPropagation();
1085
1086 if (animation !== '') {
1087 _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__["Motion"].animateOut(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), animation, function () {
1088 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('closed.zf');
1089 });
1090 } else {
1091 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).fadeOut().trigger('closed.zf');
1092 }
1093 },
1094 toggleFocusListener: function toggleFocusListener() {
1095 var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('toggle-focus');
1096 jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(id)).triggerHandler('toggle.zf.trigger', [jquery__WEBPACK_IMPORTED_MODULE_0___default()(this)]);
1097 }
1098}; // Elements with [data-open] will reveal a plugin that supports it when clicked.
1099
1100Triggers.Initializers.addOpenListener = function ($elem) {
1101 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.openListener);
1102 $elem.on('click.zf.trigger', '[data-open]', Triggers.Listeners.Basic.openListener);
1103}; // Elements with [data-close] will close a plugin that supports it when clicked.
1104// If used without a value on [data-close], the event will bubble, allowing it to close a parent component.
1105
1106
1107Triggers.Initializers.addCloseListener = function ($elem) {
1108 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.closeListener);
1109 $elem.on('click.zf.trigger', '[data-close]', Triggers.Listeners.Basic.closeListener);
1110}; // Elements with [data-toggle] will toggle a plugin that supports it when clicked.
1111
1112
1113Triggers.Initializers.addToggleListener = function ($elem) {
1114 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.toggleListener);
1115 $elem.on('click.zf.trigger', '[data-toggle]', Triggers.Listeners.Basic.toggleListener);
1116}; // Elements with [data-closable] will respond to close.zf.trigger events.
1117
1118
1119Triggers.Initializers.addCloseableListener = function ($elem) {
1120 $elem.off('close.zf.trigger', Triggers.Listeners.Basic.closeableListener);
1121 $elem.on('close.zf.trigger', '[data-closeable], [data-closable]', Triggers.Listeners.Basic.closeableListener);
1122}; // Elements with [data-toggle-focus] will respond to coming in and out of focus
1123
1124
1125Triggers.Initializers.addToggleFocusListener = function ($elem) {
1126 $elem.off('focus.zf.trigger blur.zf.trigger', Triggers.Listeners.Basic.toggleFocusListener);
1127 $elem.on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', Triggers.Listeners.Basic.toggleFocusListener);
1128}; // More Global/complex listeners and triggers
1129
1130
1131Triggers.Listeners.Global = {
1132 resizeListener: function resizeListener($nodes) {
1133 if (!MutationObserver) {
1134 //fallback for IE 9
1135 $nodes.each(function () {
1136 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).triggerHandler('resizeme.zf.trigger');
1137 });
1138 } //trigger all listening elements and signal a resize event
1139
1140
1141 $nodes.attr('data-events', "resize");
1142 },
1143 scrollListener: function scrollListener($nodes) {
1144 if (!MutationObserver) {
1145 //fallback for IE 9
1146 $nodes.each(function () {
1147 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).triggerHandler('scrollme.zf.trigger');
1148 });
1149 } //trigger all listening elements and signal a scroll event
1150
1151
1152 $nodes.attr('data-events', "scroll");
1153 },
1154 closeMeListener: function closeMeListener(e, pluginId) {
1155 var plugin = e.namespace.split('.')[0];
1156 var plugins = jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-".concat(plugin, "]")).not("[data-yeti-box=\"".concat(pluginId, "\"]"));
1157 plugins.each(function () {
1158 var _this = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
1159
1160 _this.triggerHandler('close.zf.trigger', [_this]);
1161 });
1162 } // Global, parses whole document.
1163
1164};
1165
1166Triggers.Initializers.addClosemeListener = function (pluginName) {
1167 var yetiBoxes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-yeti-box]'),
1168 plugNames = ['dropdown', 'tooltip', 'reveal'];
1169
1170 if (pluginName) {
1171 if (typeof pluginName === 'string') {
1172 plugNames.push(pluginName);
1173 } else if (_typeof(pluginName) === 'object' && typeof pluginName[0] === 'string') {
1174 plugNames = plugNames.concat(pluginName);
1175 } else {
1176 console.error('Plugin names must be strings');
1177 }
1178 }
1179
1180 if (yetiBoxes.length) {
1181 var listeners = plugNames.map(function (name) {
1182 return "closeme.zf.".concat(name);
1183 }).join(' ');
1184 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(listeners).on(listeners, Triggers.Listeners.Global.closeMeListener);
1185 }
1186};
1187
1188function debounceGlobalListener(debounce, trigger, listener) {
1189 var timer,
1190 args = Array.prototype.slice.call(arguments, 3);
1191 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(trigger).on(trigger, function (e) {
1192 if (timer) {
1193 clearTimeout(timer);
1194 }
1195
1196 timer = setTimeout(function () {
1197 listener.apply(null, args);
1198 }, debounce || 10); //default time to emit scroll event
1199 });
1200}
1201
1202Triggers.Initializers.addResizeListener = function (debounce) {
1203 var $nodes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-resize]');
1204
1205 if ($nodes.length) {
1206 debounceGlobalListener(debounce, 'resize.zf.trigger', Triggers.Listeners.Global.resizeListener, $nodes);
1207 }
1208};
1209
1210Triggers.Initializers.addScrollListener = function (debounce) {
1211 var $nodes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-scroll]');
1212
1213 if ($nodes.length) {
1214 debounceGlobalListener(debounce, 'scroll.zf.trigger', Triggers.Listeners.Global.scrollListener, $nodes);
1215 }
1216};
1217
1218Triggers.Initializers.addMutationEventsListener = function ($elem) {
1219 if (!MutationObserver) {
1220 return false;
1221 }
1222
1223 var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]'); //element callback
1224
1225 var listeningElementsMutation = function listeningElementsMutation(mutationRecordsList) {
1226 var $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mutationRecordsList[0].target); //trigger the event handler for the element depending on type
1227
1228 switch (mutationRecordsList[0].type) {
1229 case "attributes":
1230 if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") {
1231 $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]);
1232 }
1233
1234 if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") {
1235 $target.triggerHandler('resizeme.zf.trigger', [$target]);
1236 }
1237
1238 if (mutationRecordsList[0].attributeName === "style") {
1239 $target.closest("[data-mutate]").attr("data-events", "mutate");
1240 $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
1241 }
1242
1243 break;
1244
1245 case "childList":
1246 $target.closest("[data-mutate]").attr("data-events", "mutate");
1247 $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
1248 break;
1249
1250 default:
1251 return false;
1252 //nothing
1253 }
1254 };
1255
1256 if ($nodes.length) {
1257 //for each element that needs to listen for resizing, scrolling, or mutation add a single observer
1258 for (var i = 0; i <= $nodes.length - 1; i++) {
1259 var elementObserver = new MutationObserver(listeningElementsMutation);
1260 elementObserver.observe($nodes[i], {
1261 attributes: true,
1262 childList: true,
1263 characterData: false,
1264 subtree: true,
1265 attributeFilter: ["data-events", "style"]
1266 });
1267 }
1268 }
1269};
1270
1271Triggers.Initializers.addSimpleListeners = function () {
1272 var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document);
1273 Triggers.Initializers.addOpenListener($document);
1274 Triggers.Initializers.addCloseListener($document);
1275 Triggers.Initializers.addToggleListener($document);
1276 Triggers.Initializers.addCloseableListener($document);
1277 Triggers.Initializers.addToggleFocusListener($document);
1278};
1279
1280Triggers.Initializers.addGlobalListeners = function () {
1281 var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document);
1282 Triggers.Initializers.addMutationEventsListener($document);
1283 Triggers.Initializers.addResizeListener();
1284 Triggers.Initializers.addScrollListener();
1285 Triggers.Initializers.addClosemeListener();
1286};
1287
1288Triggers.init = function ($, Foundation) {
1289 Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["onLoad"])($(window), function () {
1290 if ($.triggersInitialized !== true) {
1291 Triggers.Initializers.addSimpleListeners();
1292 Triggers.Initializers.addGlobalListeners();
1293 $.triggersInitialized = true;
1294 }
1295 });
1296
1297 if (Foundation) {
1298 Foundation.Triggers = Triggers; // Legacy included to be backwards compatible for now.
1299
1300 Foundation.IHearYou = Triggers.Initializers.addGlobalListeners;
1301 }
1302};
1303
1304
1305
1306/***/ }),
1307
1308/***/ 20:
1309/*!********************************************************!*\
1310 !*** multi ./js/entries/plugins/foundation.tooltip.js ***!
1311 \********************************************************/
1312/*! no static exports found */
1313/***/ (function(module, exports, __webpack_require__) {
1314
1315module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.tooltip.js */"./js/entries/plugins/foundation.tooltip.js");
1316
1317
1318/***/ }),
1319
1320/***/ "jquery":
1321/*!********************************************************************************************!*\
1322 !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
1323 \********************************************************************************************/
1324/*! no static exports found */
1325/***/ (function(module, exports) {
1326
1327module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
1328
1329/***/ })
1330
1331/******/ });
1332});
1333//# sourceMappingURL=foundation.tooltip.js.map
\No newline at end of file