1/* Include Foundation 6 */ 2/** 3 * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). 4 * @version v4.2.0 5 * @link https://github.com/ten1seven/what-input 6 * @license MIT 7 */ 8(function webpackUniversalModuleDefinition(root, factory) { 9 if(typeof exports === 'object' && typeof module === 'object') 10 module.exports = factory(); 11 else if(typeof define === 'function' && define.amd) 12 define("whatInput", [], factory); 13 else if(typeof exports === 'object') 14 exports["whatInput"] = factory(); 15 else 16 root["whatInput"] = factory(); 17})(this, function() { 18return /******/ (function(modules) { // webpackBootstrap 19/******/ // The module cache 20/******/ var installedModules = {}; 21 22/******/ // The require function 23/******/ function __webpack_require__(moduleId) { 24 25/******/ // Check if module is in cache 26/******/ if(installedModules[moduleId]) 27/******/ return installedModules[moduleId].exports; 28 29/******/ // Create a new module (and put it into the cache) 30/******/ var module = installedModules[moduleId] = { 31/******/ exports: {}, 32/******/ id: moduleId, 33/******/ loaded: false 34/******/ }; 35 36/******/ // Execute the module function 37/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 38 39/******/ // Flag the module as loaded 40/******/ module.loaded = true; 41 42/******/ // Return the exports of the module 43/******/ return module.exports; 44/******/ } 45 46 47/******/ // expose the modules object (__webpack_modules__) 48/******/ __webpack_require__.m = modules; 49 50/******/ // expose the module cache 51/******/ __webpack_require__.c = installedModules; 52 53/******/ // __webpack_public_path__ 54/******/ __webpack_require__.p = ""; 55 56/******/ // Load entry module and return exports 57/******/ return __webpack_require__(0); 58/******/ }) 59/************************************************************************/ 60/******/ ([ 61/* 0 */ 62/***/ (function(module, exports) { 63 64 'use strict'; 65 66 module.exports = function () { 67 /* 68 * variables 69 */ 70 71 // last used input type 72 var currentInput = 'initial'; 73 74 // last used input intent 75 var currentIntent = null; 76 77 // cache document.documentElement 78 var doc = document.documentElement; 79 80 // form input types 81 var formInputs = ['input', 'select', 'textarea']; 82 83 var functionList = []; 84 85 // list of modifier keys commonly used with the mouse and 86 // can be safely ignored to prevent false keyboard detection 87 var ignoreMap = [16, // shift 88 17, // control 89 18, // alt 90 91, // Windows key / left Apple cmd 91 93 // Windows menu / right Apple cmd 92 ]; 93 94 // list of keys for which we change intent even for form inputs 95 var changeIntentMap = [9 // tab 96 ]; 97 98 // mapping of events to input types 99 var inputMap = { 100 keydown: 'keyboard', 101 mousedown: 'mouse', 102 mousemove: 'mouse', 103 MSPointerDown: 'pointer', 104 MSPointerMove: 'pointer', 105 pointerdown: 'pointer', 106 pointermove: 'pointer', 107 touchstart: 'touch' 108 }; 109 110 // array of all used input types 111 var inputTypes = []; 112 113 // boolean: true if touch buffer is active 114 var isBuffering = false; 115 116 // boolean: true if the page is being scrolled 117 var isScrolling = false; 118 119 // store current mouse position 120 var mousePos = { 121 x: null, 122 y: null 123 }; 124 125 // map of IE 10 pointer events 126 var pointerMap = { 127 2: 'touch', 128 3: 'touch', // treat pen like touch 129 4: 'mouse' 130 }; 131 132 var supportsPassive = false; 133 134 try { 135 var opts = Object.defineProperty({}, 'passive', { 136 get: function get() { 137 supportsPassive = true; 138 } 139 }); 140 141 window.addEventListener('test', null, opts); 142 } catch (e) {} 143 144 /* 145 * set up 146 */ 147 148 var setUp = function setUp() { 149 // add correct mouse wheel event mapping to `inputMap` 150 inputMap[detectWheel()] = 'mouse'; 151 152 addListeners(); 153 setInput(); 154 }; 155 156 /* 157 * events 158 */ 159 160 var addListeners = function addListeners() { 161 // `pointermove`, `MSPointerMove`, `mousemove` and mouse wheel event binding 162 // can only demonstrate potential, but not actual, interaction 163 // and are treated separately 164 165 // pointer events (mouse, pen, touch) 166 if (window.PointerEvent) { 167 doc.addEventListener('pointerdown', updateInput); 168 doc.addEventListener('pointermove', setIntent); 169 } else if (window.MSPointerEvent) { 170 doc.addEventListener('MSPointerDown', updateInput); 171 doc.addEventListener('MSPointerMove', setIntent); 172 } else { 173 // mouse events 174 doc.addEventListener('mousedown', updateInput); 175 doc.addEventListener('mousemove', setIntent); 176 177 // touch events 178 if ('ontouchstart' in window) { 179 doc.addEventListener('touchstart', touchBuffer); 180 doc.addEventListener('touchend', touchBuffer); 181 } 182 } 183 184 // mouse wheel 185 doc.addEventListener(detectWheel(), setIntent, supportsPassive ? { passive: true } : false); 186 187 // keyboard events 188 doc.addEventListener('keydown', updateInput); 189 }; 190 191 // checks conditions before updating new input 192 var updateInput = function updateInput(event) { 193 // only execute if the touch buffer timer isn't running 194 if (!isBuffering) { 195 var eventKey = event.which; 196 var value = inputMap[event.type]; 197 if (value === 'pointer') value = pointerType(event); 198 199 if (currentInput !== value || currentIntent !== value) { 200 var activeElem = document.activeElement; 201 var activeInput = false;
202 var notFormInput = activeElem && activeElem.nodeName && formInputs.indexOf(activeElem.nodeName.toLowerCase()) === -1; 203 204 if (notFormInput || changeIntentMap.indexOf(eventKey) !== -1) { 205 activeInput = true; 206 } 207 208 if (value === 'touch' || 209 // ignore mouse modifier keys 210 value === 'mouse' || 211 // don't switch if the current element is a form input 212 value === 'keyboard' && eventKey && activeInput && ignoreMap.indexOf(eventKey) === -1) { 213 // set the current and catch-all variable 214 currentInput = currentIntent = value; 215 216 setInput(); 217 } 218 } 219 } 220 }; 221 222 // updates the doc and `inputTypes` array with new input 223 var setInput = function setInput() { 224 doc.setAttribute('data-whatinput', currentInput); 225 doc.setAttribute('data-whatintent', currentInput); 226 227 if (inputTypes.indexOf(currentInput) === -1) { 228 inputTypes.push(currentInput); 229 doc.className += ' whatinput-types-' + currentInput; 230 } 231 232 fireFunctions('input'); 233 }; 234 235 // updates input intent for `mousemove` and `pointermove` 236 var setIntent = function setIntent(event) { 237 // test to see if `mousemove` happened relative to the screen 238 // to detect scrolling versus mousemove 239 if (mousePos['x'] !== event.screenX || mousePos['y'] !== event.screenY) { 240 isScrolling = false; 241 242 mousePos['x'] = event.screenX; 243 mousePos['y'] = event.screenY; 244 } else { 245 isScrolling = true; 246 } 247 248 // only execute if the touch buffer timer isn't running 249 // or scrolling isn't happening 250 if (!isBuffering && !isScrolling) { 251 var value = inputMap[event.type]; 252 if (value === 'pointer') value = pointerType(event); 253 254 if (currentIntent !== value) { 255 currentIntent = value; 256 257 doc.setAttribute('data-whatintent', currentIntent); 258 259 fireFunctions('intent'); 260 } 261 } 262 }; 263 264 // buffers touch events because they frequently also fire mouse events 265 var touchBuffer = function touchBuffer(event) { 266 if (event.type === 'touchstart') { 267 isBuffering = false; 268 269 // set the current input 270 updateInput(event); 271 } else { 272 isBuffering = true; 273 } 274 }; 275 276 var fireFunctions = function fireFunctions(type) { 277 for (var i = 0, len = functionList.length; i < len; i++) { 278 if (functionList[i].type === type) { 279 functionList[i].function.call(undefined, currentIntent); 280 } 281 } 282 }; 283 284 /* 285 * utilities 286 */ 287 288 var pointerType = function pointerType(event) { 289 if (typeof event.pointerType === 'number') { 290 return pointerMap[event.pointerType]; 291 } else { 292 // treat pen like touch 293 return event.pointerType === 'pen' ? 'touch' : event.pointerType; 294 } 295 }; 296 297 // detect version of mouse wheel event to use 298 // via https://developer.mozilla.org/en-US/docs/Web/Events/wheel 299 var detectWheel = function detectWheel() { 300 var wheelType = void 0; 301 302 // Modern browsers support "wheel" 303 if ('onwheel' in document.createElement('div')) { 304 wheelType = 'wheel'; 305 } else { 306 // Webkit and IE support at least "mousewheel" 307 // or assume that remaining browsers are older Firefox 308 wheelType = document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll'; 309 } 310 311 return wheelType; 312 }; 313 314 /* 315 * init 316 */ 317 318 // don't start script unless browser cuts the mustard 319 // (also passes if polyfills are used) 320 if ('addEventListener' in window && Array.prototype.indexOf) { 321 setUp(); 322 } 323 324 /* 325 * api 326 */ 327 328 return { 329 // returns string: the current input type 330 // opt: 'loose'|'strict' 331 // 'strict' (default): returns the same value as the `data-whatinput` attribute 332 // 'loose': includes `data-whatintent` value if it's more current than `data-whatinput` 333 ask: function ask(opt) { 334 return opt === 'loose' ? currentIntent : currentInput; 335 }, 336 337 // returns array: all the detected input types 338 types: function types() { 339 return inputTypes; 340 }, 341 342 // overwrites ignored keys with provided array 343 ignoreKeys: function ignoreKeys(arr) { 344 ignoreMap = arr; 345 }, 346 347 // attach functions to input and intent "events" 348 // funct: function to fire on change 349 // eventType: 'input'|'intent' 350 onChange: function onChange(funct, eventType) { 351 functionList.push({ 352 function: funct, 353 type: eventType 354 }); 355 } 356 }; 357 }(); 358 359/***/ }) 360/******/ ]) 361}); 362; 363/******/ (function(modules) { // webpackBootstrap 364/******/ // The module cache 365/******/ var installedModules = {}; 366/******/ 367/******/ // The require function 368/******/ function __webpack_require__(moduleId) { 369/******/ 370/******/ // Check if module is in cache 371/******/ if(installedModules[moduleId]) { 372/******/ return installedModules[moduleId].exports; 373/******/ } 374/******/ // Create a new module (and put it into the cache) 375/******/ var module = installedModules[moduleId] = { 376/******/ i: moduleId, 377/******/ l: false, 378/******/ exports: {} 379/******/ }; 380/******/ 381/******/ // Execute the module function 382/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 383/******/ 384/******/ // Flag the module as loaded
385/******/ module.l = true; 386/******/ 387/******/ // Return the exports of the module 388/******/ return module.exports; 389/******/ } 390/******/ 391/******/ 392/******/ // expose the modules object (__webpack_modules__) 393/******/ __webpack_require__.m = modules; 394/******/ 395/******/ // expose the module cache 396/******/ __webpack_require__.c = installedModules; 397/******/ 398/******/ // identity function for calling harmony imports with the correct context 399/******/ __webpack_require__.i = function(value) { return value; }; 400/******/ 401/******/ // define getter function for harmony exports 402/******/ __webpack_require__.d = function(exports, name, getter) { 403/******/ if(!__webpack_require__.o(exports, name)) { 404/******/ Object.defineProperty(exports, name, { 405/******/ configurable: false, 406/******/ enumerable: true, 407/******/ get: getter 408/******/ }); 409/******/ } 410/******/ }; 411/******/ 412/******/ // getDefaultExport function for compatibility with non-harmony modules 413/******/ __webpack_require__.n = function(module) { 414/******/ var getter = module && module.__esModule ? 415/******/ function getDefault() { return module['default']; } : 416/******/ function getModuleExports() { return module; }; 417/******/ __webpack_require__.d(getter, 'a', getter); 418/******/ return getter; 419/******/ }; 420/******/ 421/******/ // Object.prototype.hasOwnProperty.call 422/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 423/******/ 424/******/ // __webpack_public_path__ 425/******/ __webpack_require__.p = ""; 426/******/ 427/******/ // Load entry module and return exports 428/******/ return __webpack_require__(__webpack_require__.s = 35); 429/******/ }) 430/************************************************************************/ 431/******/ ([ 432/* 0 */ 433/***/ (function(module, exports) { 434 435module.exports = jQuery; 436 437/***/ }), 438/* 1 */ 439/***/ (function(module, __webpack_exports__, __webpack_require__) { 440 441"use strict"; 442/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return rtl; }); 443/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GetYoDigits; }); 444/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return transitionend; }); 445/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 446/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 447 448 449 450 451// Core Foundation Utilities, utilized in a number of places. 452 453/** 454 * Returns a boolean for RTL support 455 */ 456function rtl() { 457 return __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html').attr('dir') === 'rtl'; 458} 459 460/** 461 * returns a random base-36 uid with namespacing 462 * @function 463 * @param {Number} length - number of random base-36 digits desired. Increase for more random strings. 464 * @param {String} namespace - name of plugin to be incorporated in uid, optional. 465 * @default {String} '' - if no plugin name is provided, nothing is appended to the uid. 466 * @returns {String} - unique id 467 */ 468function GetYoDigits(length, namespace) { 469 length = length || 6; 470 return Math.round(Math.pow(36, length + 1) - Math.random() * Math.pow(36, length)).toString(36).slice(1) + (namespace ? '-' + namespace : ''); 471} 472 473function transitionend($elem) { 474 var transitions = { 475 'transition': 'transitionend', 476 'WebkitTransition': 'webkitTransitionEnd', 477 'MozTransition': 'transitionend', 478 'OTransition': 'otransitionend' 479 }; 480 var elem = document.createElement('div'), 481 end; 482 483 for (var t in transitions) { 484 if (typeof elem.style[t] !== 'undefined') { 485 end = transitions[t]; 486 } 487 } 488 if (end) { 489 return end; 490 } else { 491 end = setTimeout(function () { 492 $elem.triggerHandler('transitionend', [$elem]); 493 }, 1); 494 return 'transitionend'; 495 } 496} 497 498 499 500/***/ }), 501/* 2 */ 502/***/ (function(module, __webpack_exports__, __webpack_require__) { 503 504"use strict"; 505/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Plugin; }); 506/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 507/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 508/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_core__ = __webpack_require__(1); 509 510 511var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 512 513function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 514 515 516 517 518// Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST 519// {function} _setup (replaces previous constructor),
520// {function} _destroy (replaces previous destroy) 521 522var Plugin = function () { 523 function Plugin(element, options) { 524 _classCallCheck(this, Plugin); 525 526 this._setup(element, options); 527 var pluginName = getPluginName(this); 528 this.uuid = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__foundation_util_core__["a" /* GetYoDigits */])(6, pluginName); 529 530 if (!this.$element.attr('data-' + pluginName)) { 531 this.$element.attr('data-' + pluginName, this.uuid); 532 } 533 if (!this.$element.data('zfPlugin')) { 534 this.$element.data('zfPlugin', this); 535 } 536 /** 537 * Fires when the plugin has initialized. 538 * @event Plugin#init 539 */ 540 this.$element.trigger('init.zf.' + pluginName); 541 } 542 543 _createClass(Plugin, [{ 544 key: 'destroy', 545 value: function destroy() { 546 this._destroy(); 547 var pluginName = getPluginName(this); 548 this.$element.removeAttr('data-' + pluginName).removeData('zfPlugin') 549 /** 550 * Fires when the plugin has been destroyed. 551 * @event Plugin#destroyed 552 */ 553 .trigger('destroyed.zf.' + pluginName); 554 for (var prop in this) { 555 this[prop] = null; //clean up script to prep for garbage collection. 556 } 557 } 558 }]); 559 560 return Plugin; 561}(); 562 563// Convert PascalCase to kebab-case 564// Thank you: http://stackoverflow.com/a/8955580 565 566 567function hyphenate(str) { 568 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 569} 570 571function getPluginName(obj) { 572 if (typeof obj.constructor.name !== 'undefined') { 573 return hyphenate(obj.constructor.name); 574 } else { 575 return hyphenate(obj.className); 576 } 577} 578 579 580 581/***/ }), 582/* 3 */ 583/***/ (function(module, __webpack_exports__, __webpack_require__) { 584 585"use strict"; 586/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MediaQuery; }); 587/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 588/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 589 590 591 592 593// Default set of media queries 594var defaultQueries = { 595 'default': 'only screen', 596 landscape: 'only screen and (orientation: landscape)', 597 portrait: 'only screen and (orientation: portrait)', 598 retina: 'only screen and (-webkit-min-device-pixel-ratio: 2),' + 'only screen and (min--moz-device-pixel-ratio: 2),' + 'only screen and (-o-min-device-pixel-ratio: 2/1),' + 'only screen and (min-device-pixel-ratio: 2),' + 'only screen and (min-resolution: 192dpi),' + 'only screen and (min-resolution: 2dppx)' 599}; 600 601// matchMedia() polyfill - Test a CSS media type/query in JS. 602// Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license 603var matchMedia = window.matchMedia || function () { 604 'use strict'; 605 606 // For browsers that support matchMedium api such as IE 9 and webkit 607 608 var styleMedia = window.styleMedia || window.media; 609 610 // For those that don't support matchMedium 611 if (!styleMedia) { 612 var style = document.createElement('style'), 613 script = document.getElementsByTagName('script')[0], 614 info = null; 615 616 style.type = 'text/css'; 617 style.id = 'matchmediajs-test'; 618 619 script && script.parentNode && script.parentNode.insertBefore(style, script); 620 621 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 622 info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle; 623 624 styleMedia = { 625 matchMedium: function (media) { 626 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 627 628 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 629 if (style.styleSheet) { 630 style.styleSheet.cssText = text; 631 } else { 632 style.textContent = text; 633 } 634 635 // Test if media query is true or false 636 return info.width === '1px'; 637 } 638 }; 639 } 640 641 return function (media) { 642 return { 643 matches: styleMedia.matchMedium(media || 'all'), 644 media: media || 'all' 645 }; 646 }; 647}(); 648 649var MediaQuery = { 650 queries: [], 651 652 current: '', 653 654 /** 655 * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher. 656 * @function 657 * @private 658 */ 659 _init: function () { 660 var self = this; 661 var $meta = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('meta.foundation-mq'); 662 if (!$meta.length) { 663 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('<meta class="foundation-mq">').appendTo(document.head); 664 } 665 666 var extractedStyles = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('.foundation-mq').css('font-family'); 667 var namedQueries; 668 669 namedQueries = parseStyleToObject(extractedStyles); 670
671 for (var key in namedQueries) { 672 if (namedQueries.hasOwnProperty(key)) { 673 self.queries.push({ 674 name: key, 675 value: 'only screen and (min-width: ' + namedQueries[key] + ')' 676 }); 677 } 678 } 679 680 this.current = this._getCurrentSize(); 681 682 this._watcher(); 683 }, 684 685 686 /** 687 * Checks if the screen is at least as wide as a breakpoint. 688 * @function 689 * @param {String} size - Name of the breakpoint to check. 690 * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller. 691 */ 692 atLeast: function (size) { 693 var query = this.get(size); 694 695 if (query) { 696 return matchMedia(query).matches; 697 } 698 699 return false; 700 }, 701 702 703 /** 704 * Checks if the screen matches to a breakpoint. 705 * @function 706 * @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method. 707 * @returns {Boolean} `true` if the breakpoint matches, `false` if it does not. 708 */ 709 is: function (size) { 710 size = size.trim().split(' '); 711 if (size.length > 1 && size[1] === 'only') { 712 if (size[0] === this._getCurrentSize()) return true; 713 } else { 714 return this.atLeast(size[0]); 715 } 716 return false; 717 }, 718 719 720 /** 721 * Gets the media query of a breakpoint. 722 * @function 723 * @param {String} size - Name of the breakpoint to get. 724 * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist. 725 */ 726 get: function (size) { 727 for (var i in this.queries) { 728 if (this.queries.hasOwnProperty(i)) { 729 var query = this.queries[i]; 730 if (size === query.name) return query.value; 731 } 732 } 733 734 return null; 735 }, 736 737 738 /** 739 * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one). 740 * @function 741 * @private 742 * @returns {String} Name of the current breakpoint. 743 */ 744 _getCurrentSize: function () { 745 var matched; 746 747 for (var i = 0; i < this.queries.length; i++) { 748 var query = this.queries[i]; 749 750 if (matchMedia(query.value).matches) { 751 matched = query; 752 } 753 } 754 755 if (typeof matched === 'object') { 756 return matched.name; 757 } else { 758 return matched; 759 } 760 }, 761 762 763 /** 764 * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes. 765 * @function 766 * @private 767 */ 768 _watcher: function () { 769 var _this = this; 770 771 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () { 772 var newSize = _this._getCurrentSize(), 773 currentSize = _this.current; 774 775 if (newSize !== currentSize) { 776 // Change the current media query 777 _this.current = newSize; 778 779 // Broadcast the media query change on the window 780 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).trigger('changed.zf.mediaquery', [newSize, currentSize]); 781 } 782 }); 783 } 784}; 785 786// Thank you: https://github.com/sindresorhus/query-string 787function parseStyleToObject(str) { 788 var styleObject = {}; 789 790 if (typeof str !== 'string') { 791 return styleObject; 792 } 793 794 str = str.trim().slice(1, -1); // browsers re-quote string style values 795 796 if (!str) { 797 return styleObject; 798 } 799 800 styleObject = str.split('&').reduce(function (ret, param) { 801 var parts = param.replace(/\+/g, ' ').split('='); 802 var key = parts[0]; 803 var val = parts[1]; 804 key = decodeURIComponent(key); 805 806 // missing `=` should be `null`: 807 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters 808 val = val === undefined ? null : decodeURIComponent(val); 809 810 if (!ret.hasOwnProperty(key)) { 811 ret[key] = val; 812 } else if (Array.isArray(ret[key])) { 813 ret[key].push(val); 814 } else { 815 ret[key] = [ret[key], val]; 816 } 817 return ret; 818 }, {}); 819 820 return styleObject; 821} 822 823 824 825/***/ }), 826/* 4 */ 827/***/ (function(module, __webpack_exports__, __webpack_require__) { 828 829"use strict"; 830/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Keyboard; }); 831/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 832/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 833/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_core__ = __webpack_require__(1); 834/******************************************* 835 * * 836 * This util was created by Marius Olbertz * 837 * Please thank Marius on GitHub /owlbertz * 838 * or the web http://www.mariusolbertz.de/ * 839 * * 840 ******************************************/ 841 842 843 844 845 846 847var keyCodes = { 848 9: 'TAB', 849 13: 'ENTER', 850 27: 'ESCAPE', 851 32: 'SPACE', 852 35: 'END', 853 36: 'HOME', 854 37: 'ARROW_LEFT', 855 38: 'ARROW_UP', 856 39: 'ARROW_RIGHT', 857 40: 'ARROW_DOWN' 858}; 859
860var commands = {}; 861 862// Functions pulled out to be referenceable from internals 863function findFocusable($element) { 864 if (!$element) { 865 return false; 866 } 867 return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function () { 868 if (!__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is(':visible') || __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).attr('tabindex') < 0) { 869 return false; 870 } //only have visible elements and those that have a tabindex greater or equal 0 871 return true; 872 }); 873} 874 875function parseKey(event) { 876 var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase(); 877 878 // Remove un-printable characters, e.g. for `fromCharCode` calls for CTRL only events 879 key = key.replace(/\W+/, ''); 880 881 if (event.shiftKey) key = 'SHIFT_' + key; 882 if (event.ctrlKey) key = 'CTRL_' + key; 883 if (event.altKey) key = 'ALT_' + key; 884 885 // Remove trailing underscore, in case only modifiers were used (e.g. only `CTRL_ALT`) 886 key = key.replace(/_$/, ''); 887 888 return key; 889} 890 891var Keyboard = { 892 keys: getKeyCodes(keyCodes), 893 894 /** 895 * Parses the (keyboard) event and returns a String that represents its key 896 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 897 * @param {Event} event - the event generated by the event handler 898 * @return String key - String that represents the key pressed 899 */ 900 parseKey: parseKey, 901 902 /** 903 * Handles the given (keyboard) event 904 * @param {Event} event - the event generated by the event handler 905 * @param {String} component - Foundation component's name, e.g. Slider or Reveal 906 * @param {Objects} functions - collection of functions that are to be executed 907 */ 908 handleKey: function (event, component, functions) { 909 var commandList = commands[component], 910 keyCode = this.parseKey(event), 911 cmds, 912 command, 913 fn; 914 915 if (!commandList) return console.warn('Component not defined!'); 916 917 if (typeof commandList.ltr === 'undefined') { 918 // this component does not differentiate between ltr and rtl 919 cmds = commandList; // use plain list 920 } else { 921 // merge ltr and rtl: if document is rtl, rtl overwrites ltr and vice versa 922 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__foundation_util_core__["b" /* rtl */])()) cmds = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, commandList.ltr, commandList.rtl);else cmds = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, commandList.rtl, commandList.ltr); 923 } 924 command = cmds[keyCode]; 925 926 fn = functions[command]; 927 if (fn && typeof fn === 'function') { 928 // execute function if exists 929 var returnValue = fn.apply(); 930 if (functions.handled || typeof functions.handled === 'function') { 931 // execute function when event was handled 932 functions.handled(returnValue); 933 } 934 } else { 935 if (functions.unhandled || typeof functions.unhandled === 'function') { 936 // execute function when event was not handled 937 functions.unhandled(); 938 } 939 } 940 }, 941 942 943 /** 944 * Finds all focusable elements within the given `$element` 945 * @param {jQuery} $element - jQuery object to search within 946 * @return {jQuery} $focusable - all focusable elements within `$element` 947 */ 948 949 findFocusable: findFocusable, 950 951 /** 952 * Returns the component name name 953 * @param {Object} component - Foundation component, e.g. Slider or Reveal 954 * @return String componentName 955 */ 956 957 register: function (componentName, cmds) { 958 commands[componentName] = cmds; 959 }, 960 961 962 // TODO9438: These references to Keyboard need to not require global. Will 'this' work in this context? 963 // 964 /** 965 * Traps the focus in the given element. 966 * @param {jQuery} $element jQuery object to trap the foucs into. 967 */ 968 trapFocus: function ($element) { 969 var $focusable = findFocusable($element), 970 $firstFocusable = $focusable.eq(0), 971 $lastFocusable = $focusable.eq(-1); 972 973 $element.on('keydown.zf.trapfocus', function (event) { 974 if (event.target === $lastFocusable[0] && parseKey(event) === 'TAB') { 975 event.preventDefault(); 976 $firstFocusable.focus(); 977 } else if (event.target === $firstFocusable[0] && parseKey(event) === 'SHIFT_TAB') { 978 event.preventDefault(); 979 $lastFocusable.focus(); 980 } 981 }); 982 }, 983 984 /** 985 * Releases the trapped focus from the given element. 986 * @param {jQuery} $element jQuery object to release the focus for. 987 */ 988 releaseFocus: function ($element) { 989 $element.off('keydown.zf.trapfocus'); 990 } 991}; 992 993/* 994 * Constants for easier comparing. 995 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 996 */ 997function getKeyCodes(kcs) { 998 var k = {}; 999 for (var kc in kcs) { 1000 k[kcs[kc]] = kcs[kc]; 1001 }return k; 1002} 1003 1004 1005 1006/***/ }), 1007/* 5 */ 1008/***/ (function(module, __webpack_exports__, __webpack_require__) { 1009 1010"use strict"; 1011/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Triggers; }); 1012/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 1013/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 1014/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_motion__ = __webpack_require__(6); 1015 1016 1017 1018 1019 1020var MutationObserver = function () { 1021 var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']; 1022 for (var i = 0; i < prefixes.length; i++) { 1023 if (prefixes[i] + 'MutationObserver' in window) { 1024 return window[prefixes[i] + 'MutationObserver']; 1025 } 1026 } 1027 return false;
1028}(); 1029 1030var triggers = function (el, type) { 1031 el.data(type).split(' ').forEach(function (id) { 1032 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + id)[type === 'close' ? 'trigger' : 'triggerHandler'](type + '.zf.trigger', [el]); 1033 }); 1034}; 1035 1036var Triggers = { 1037 Listeners: { 1038 Basic: {}, 1039 Global: {} 1040 }, 1041 Initializers: {} 1042}; 1043 1044Triggers.Listeners.Basic = { 1045 openListener: function () { 1046 triggers(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 'open'); 1047 }, 1048 closeListener: function () { 1049 var id = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('close'); 1050 if (id) { 1051 triggers(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 'close'); 1052 } else { 1053 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).trigger('close.zf.trigger'); 1054 } 1055 }, 1056 toggleListener: function () { 1057 var id = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('toggle'); 1058 if (id) { 1059 triggers(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 'toggle'); 1060 } else { 1061 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).trigger('toggle.zf.trigger'); 1062 } 1063 }, 1064 closeableListener: function (e) { 1065 e.stopPropagation(); 1066 var animation = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('closable'); 1067 1068 if (animation !== '') { 1069 __WEBPACK_IMPORTED_MODULE_1__foundation_util_motion__["a" /* Motion */].animateOut(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), animation, function () { 1070 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).trigger('closed.zf'); 1071 }); 1072 } else { 1073 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).fadeOut().trigger('closed.zf'); 1074 } 1075 }, 1076 toggleFocusListener: function () { 1077 var id = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('toggle-focus'); 1078 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + id).triggerHandler('toggle.zf.trigger', [__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)]); 1079 } 1080}; 1081 1082// Elements with [data-open] will reveal a plugin that supports it when clicked. 1083Triggers.Initializers.addOpenListener = function ($elem) { 1084 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.openListener); 1085 $elem.on('click.zf.trigger', '[data-open]', Triggers.Listeners.Basic.openListener); 1086}; 1087 1088// Elements with [data-close] will close a plugin that supports it when clicked. 1089// If used without a value on [data-close], the event will bubble, allowing it to close a parent component. 1090Triggers.Initializers.addCloseListener = function ($elem) { 1091 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.closeListener); 1092 $elem.on('click.zf.trigger', '[data-close]', Triggers.Listeners.Basic.closeListener); 1093}; 1094 1095// Elements with [data-toggle] will toggle a plugin that supports it when clicked. 1096Triggers.Initializers.addToggleListener = function ($elem) { 1097 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.toggleListener); 1098 $elem.on('click.zf.trigger', '[data-toggle]', Triggers.Listeners.Basic.toggleListener); 1099}; 1100 1101// Elements with [data-closable] will respond to close.zf.trigger events. 1102Triggers.Initializers.addCloseableListener = function ($elem) { 1103 $elem.off('close.zf.trigger', Triggers.Listeners.Basic.closeableListener); 1104 $elem.on('close.zf.trigger', '[data-closeable], [data-closable]', Triggers.Listeners.Basic.closeableListener); 1105}; 1106 1107// Elements with [data-toggle-focus] will respond to coming in and out of focus 1108Triggers.Initializers.addToggleFocusListener = function ($elem) { 1109 $elem.off('focus.zf.trigger blur.zf.trigger', Triggers.Listeners.Basic.toggleFocusListener); 1110 $elem.on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', Triggers.Listeners.Basic.toggleFocusListener); 1111}; 1112 1113// More Global/complex listeners and triggers 1114Triggers.Listeners.Global = { 1115 resizeListener: function ($nodes) { 1116 if (!MutationObserver) { 1117 //fallback for IE 9 1118 $nodes.each(function () { 1119 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).triggerHandler('resizeme.zf.trigger'); 1120 }); 1121 } 1122 //trigger all listening elements and signal a resize event 1123 $nodes.attr('data-events', "resize"); 1124 }, 1125 scrollListener: function ($nodes) { 1126 if (!MutationObserver) { 1127 //fallback for IE 9 1128 $nodes.each(function () { 1129 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).triggerHandler('scrollme.zf.trigger'); 1130 }); 1131 } 1132 //trigger all listening elements and signal a scroll event 1133 $nodes.attr('data-events', "scroll"); 1134 }, 1135 closeMeListener: function (e, pluginId) { 1136 var plugin = e.namespace.split('.')[0]; 1137 var plugins = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-' + plugin + ']').not('[data-yeti-box="' + pluginId + '"]'); 1138 1139 plugins.each(function () { 1140 var _this = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this); 1141 _this.triggerHandler('close.zf.trigger', [_this]); 1142 }); 1143 } 1144}; 1145 1146// Global, parses whole document.
vendor: 4,101 bytes, lines 1147-1250
1147Triggers.Initializers.addClosemeListener = function (pluginName) { 1148 var yetiBoxes = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-yeti-box]'), 1149 plugNames = ['dropdown', 'tooltip', 'reveal']; 1150 1151 if (pluginName) { 1152 if (typeof pluginName === 'string') { 1153 plugNames.push(pluginName); 1154 } else if (typeof pluginName === 'object' && typeof pluginName[0] === 'string') { 1155 plugNames.concat(pluginName); 1156 } else { 1157 console.error('Plugin names must be strings'); 1158 } 1159 } 1160 if (yetiBoxes.length) { 1161 var listeners = plugNames.map(function (name) { 1162 return 'closeme.zf.' + name; 1163 }).join(' '); 1164 1165 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off(listeners).on(listeners, Triggers.Listeners.Global.closeMeListener); 1166 } 1167}; 1168 1169function debounceGlobalListener(debounce, trigger, listener) { 1170 var timer = void 0, 1171 args = Array.prototype.slice.call(arguments, 3); 1172 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off(trigger).on(trigger, function (e) { 1173 if (timer) { 1174 clearTimeout(timer); 1175 } 1176 timer = setTimeout(function () { 1177 listener.apply(null, args); 1178 }, debounce || 10); //default time to emit scroll event 1179 }); 1180} 1181 1182Triggers.Initializers.addResizeListener = function (debounce) { 1183 var $nodes = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-resize]'); 1184 if ($nodes.length) { 1185 debounceGlobalListener(debounce, 'resize.zf.trigger', Triggers.Listeners.Global.resizeListener, $nodes); 1186 } 1187}; 1188 1189Triggers.Initializers.addScrollListener = function (debounce) { 1190 var $nodes = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-scroll]'); 1191 if ($nodes.length) { 1192 debounceGlobalListener(debounce, 'scroll.zf.trigger', Triggers.Listeners.Global.scrollListener, $nodes); 1193 } 1194}; 1195 1196Triggers.Initializers.addMutationEventsListener = function ($elem) { 1197 if (!MutationObserver) { 1198 return false; 1199 } 1200 var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]'); 1201 1202 //element callback 1203 var listeningElementsMutation = function (mutationRecordsList) { 1204 var $target = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(mutationRecordsList[0].target); 1205 1206 //trigger the event handler for the element depending on type 1207 switch (mutationRecordsList[0].type) { 1208 case "attributes": 1209 if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") { 1210 $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]); 1211 } 1212 if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") { 1213 $target.triggerHandler('resizeme.zf.trigger', [$target]); 1214 } 1215 if (mutationRecordsList[0].attributeName === "style") { 1216 $target.closest("[data-mutate]").attr("data-events", "mutate"); 1217 $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]); 1218 } 1219 break; 1220 1221 case "childList": 1222 $target.closest("[data-mutate]").attr("data-events", "mutate"); 1223 $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]); 1224 break; 1225 1226 default: 1227 return false; 1228 //nothing 1229 } 1230 }; 1231 1232 if ($nodes.length) { 1233 //for each element that needs to listen for resizing, scrolling, or mutation add a single observer 1234 for (var i = 0; i <= $nodes.length - 1; i++) { 1235 var elementObserver = new MutationObserver(listeningElementsMutation); 1236 elementObserver.observe($nodes[i], { attributes: true, childList: true, characterData: false, subtree: true, attributeFilter: ["data-events", "style"] }); 1237 } 1238 } 1239}; 1240 1241Triggers.Initializers.addSimpleListeners = function () { 1242 var $document = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document); 1243 1244 Triggers.Initializers.addOpenListener($document); 1245 Triggers.Initializers.addCloseListener($document); 1246 Triggers.Initializers.addToggleListener($document); 1247 Triggers.Initializers.addCloseableListener($document); 1248 Triggers.Initializers.addToggleFocusListener($document); 1249}; 1250
1251Triggers.Initializers.addGlobalListeners = function () { 1252 var $document = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document); 1253 Triggers.Initializers.addMutationEventsListener($document); 1254 Triggers.Initializers.addResizeListener(); 1255 Triggers.Initializers.addScrollListener(); 1256 Triggers.Initializers.addClosemeListener(); 1257}; 1258 1259Triggers.init = function ($, Foundation) { 1260 if (typeof $.triggersInitialized === 'undefined') { 1261 var $document = $(document); 1262 1263 if (document.readyState === "complete") { 1264 Triggers.Initializers.addSimpleListeners(); 1265 Triggers.Initializers.addGlobalListeners(); 1266 } else { 1267 $(window).on('load', function () { 1268 Triggers.Initializers.addSimpleListeners(); 1269 Triggers.Initializers.addGlobalListeners(); 1270 }); 1271 } 1272 1273 $.triggersInitialized = true; 1274 } 1275 1276 if (Foundation) { 1277 Foundation.Triggers = Triggers; 1278 // Legacy included to be backwards compatible for now. 1279 Foundation.IHearYou = Triggers.Initializers.addGlobalListeners; 1280 } 1281}; 1282 1283 1284 1285/***/ }), 1286/* 6 */ 1287/***/ (function(module, __webpack_exports__, __webpack_require__) { 1288 1289"use strict"; 1290/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Move; }); 1291/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Motion; }); 1292/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 1293/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 1294/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_core__ = __webpack_require__(1); 1295 1296 1297 1298 1299 1300/** 1301 * Motion module. 1302 * @module foundation.motion 1303 */ 1304 1305var initClasses = ['mui-enter', 'mui-leave']; 1306var activeClasses = ['mui-enter-active', 'mui-leave-active']; 1307 1308var Motion = { 1309 animateIn: function (element, animation, cb) { 1310 animate(true, element, animation, cb); 1311 }, 1312 1313 animateOut: function (element, animation, cb) { 1314 animate(false, element, animation, cb); 1315 } 1316}; 1317 1318function Move(duration, elem, fn) { 1319 var anim, 1320 prog, 1321 start = null; 1322 // console.log('called'); 1323 1324 if (duration === 0) { 1325 fn.apply(elem); 1326 elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]); 1327 return; 1328 } 1329 1330 function move(ts) { 1331 if (!start) start = ts; 1332 // console.log(start, ts); 1333 prog = ts - start; 1334 fn.apply(elem); 1335 1336 if (prog < duration) { 1337 anim = window.requestAnimationFrame(move, elem); 1338 } else { 1339 window.cancelAnimationFrame(anim); 1340 elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]); 1341 } 1342 } 1343 anim = window.requestAnimationFrame(move); 1344} 1345 1346/** 1347 * Animates an element in or out using a CSS transition class. 1348 * @function 1349 * @private 1350 * @param {Boolean} isIn - Defines if the animation is in or out. 1351 * @param {Object} element - jQuery or HTML object to animate. 1352 * @param {String} animation - CSS class to use. 1353 * @param {Function} cb - Callback to run when animation is finished. 1354 */ 1355function animate(isIn, element, animation, cb) { 1356 element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(element).eq(0); 1357 1358 if (!element.length) return; 1359 1360 var initClass = isIn ? initClasses[0] : initClasses[1]; 1361 var activeClass = isIn ? activeClasses[0] : activeClasses[1]; 1362 1363 // Set up the animation 1364 reset(); 1365 1366 element.addClass(animation).css('transition', 'none'); 1367 1368 requestAnimationFrame(function () { 1369 element.addClass(initClass); 1370 if (isIn) element.show(); 1371 }); 1372 1373 // Start the animation 1374 requestAnimationFrame(function () { 1375 element[0].offsetWidth; 1376 element.css('transition', '').addClass(activeClass); 1377 }); 1378 1379 // Clean up the animation when it finishes 1380 element.one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__foundation_util_core__["c" /* transitionend */])(element), finish); 1381 1382 // Hides the element (for out animations), resets the element, and runs a callback 1383 function finish() { 1384 if (!isIn) element.hide(); 1385 reset(); 1386 if (cb) cb.apply(element); 1387 } 1388 1389 // Resets transitions and removes motion-specific classes 1390 function reset() { 1391 element[0].style.transitionDuration = 0; 1392 element.removeClass(initClass + ' ' + activeClass + ' ' + animation); 1393 } 1394} 1395 1396 1397 1398/***/ }), 1399/* 7 */ 1400/***/ (function(module, __webpack_exports__, __webpack_require__) { 1401 1402"use strict"; 1403/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Box; }); 1404/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation_util_core__ = __webpack_require__(1); 1405 1406 1407 1408 1409var Box = { 1410 ImNotTouchingYou: ImNotTouchingYou, 1411 OverlapArea: OverlapArea, 1412 GetDimensions: GetDimensions, 1413 GetOffsets: GetOffsets, 1414 GetExplicitOffsets: GetExplicitOffsets 1415}; 1416 1417/** 1418 * Compares the dimensions of an element to a container and determines collision events with container. 1419 * @function 1420 * @param {jQuery} element - jQuery object to test for collisions. 1421 * @param {jQuery}
1421 parent - jQuery object to use as bounding container. 1422 * @param {Boolean} lrOnly - set to true to check left and right values only. 1423 * @param {Boolean} tbOnly - set to true to check top and bottom values only. 1424 * @default if no parent object passed, detects collisions with `window`. 1425 * @returns {Boolean} - true if collision free, false if a collision in any direction. 1426 */ 1427function ImNotTouchingYou(element, parent, lrOnly, tbOnly, ignoreBottom) { 1428 return OverlapArea(element, parent, lrOnly, tbOnly, ignoreBottom) === 0; 1429}; 1430 1431function OverlapArea(element, parent, lrOnly, tbOnly, ignoreBottom) { 1432 var eleDims = GetDimensions(element), 1433 topOver, 1434 bottomOver, 1435 leftOver, 1436 rightOver; 1437 if (parent) { 1438 var parDims = GetDimensions(parent); 1439 1440 bottomOver = parDims.height + parDims.offset.top - (eleDims.offset.top + eleDims.height); 1441 topOver = eleDims.offset.top - parDims.offset.top; 1442 leftOver = eleDims.offset.left - parDims.offset.left; 1443 rightOver = parDims.width + parDims.offset.left - (eleDims.offset.left + eleDims.width); 1444 } else { 1445 bottomOver = eleDims.windowDims.height + eleDims.windowDims.offset.top - (eleDims.offset.top + eleDims.height); 1446 topOver = eleDims.offset.top - eleDims.windowDims.offset.top; 1447 leftOver = eleDims.offset.left - eleDims.windowDims.offset.left; 1448 rightOver = eleDims.windowDims.width - (eleDims.offset.left + eleDims.width); 1449 } 1450 1451 bottomOver = ignoreBottom ? 0 : Math.min(bottomOver, 0); 1452 topOver = Math.min(topOver, 0); 1453 leftOver = Math.min(leftOver, 0); 1454 rightOver = Math.min(rightOver, 0); 1455 1456 if (lrOnly) { 1457 return leftOver + rightOver; 1458 } 1459 if (tbOnly) { 1460 return topOver + bottomOver; 1461 } 1462 1463 // use sum of squares b/c we care about overlap area. 1464 return Math.sqrt(topOver * topOver + bottomOver * bottomOver + leftOver * leftOver + rightOver * rightOver); 1465} 1466 1467/** 1468 * Uses native methods to return an object of dimension values. 1469 * @function 1470 * @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window. 1471 * @returns {Object} - nested object of integer pixel values 1472 * TODO - if element is window, return only those values. 1473 */ 1474function GetDimensions(elem) { 1475 elem = elem.length ? elem[0] : elem; 1476 1477 if (elem === window || elem === document) { 1478 throw new Error("I'm sorry, Dave. I'm afraid I can't do that."); 1479 } 1480 1481 var rect = elem.getBoundingClientRect(), 1482 parRect = elem.parentNode.getBoundingClientRect(), 1483 winRect = document.body.getBoundingClientRect(), 1484 winY = window.pageYOffset, 1485 winX = window.pageXOffset; 1486 1487 return { 1488 width: rect.width, 1489 height: rect.height, 1490 offset: { 1491 top: rect.top + winY, 1492 left: rect.left + winX 1493 }, 1494 parentDims: { 1495 width: parRect.width, 1496 height: parRect.height, 1497 offset: { 1498 top: parRect.top + winY, 1499 left: parRect.left + winX 1500 } 1501 }, 1502 windowDims: { 1503 width: winRect.width, 1504 height: winRect.height, 1505 offset: { 1506 top: winY, 1507 left: winX 1508 } 1509 } 1510 }; 1511} 1512 1513/** 1514 * Returns an object of top and left integer pixel values for dynamically rendered elements, 1515 * such as: Tooltip, Reveal, and Dropdown. Maintained for backwards compatibility, and where 1516 * you don't know alignment, but generally from 1517 * 6.4 forward you should use GetExplicitOffsets, as GetOffsets conflates position and alignment. 1518 * @function 1519 * @param {jQuery} element - jQuery object for the element being positioned. 1520 * @param {jQuery} anchor - jQuery object for the element's anchor point. 1521 * @param {String} position - a string relating to the desired position of the element, relative to it's anchor 1522 * @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element. 1523 * @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element. 1524 * @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset. 1525 * TODO alter/rewrite to work with `em` values as well/instead of pixels 1526 */
1527function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) { 1528 console.log("NOTE: GetOffsets is deprecated in favor of GetExplicitOffsets and will be removed in 6.5"); 1529 switch (position) { 1530 case 'top': 1531 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__foundation_util_core__["b" /* rtl */])() ? GetExplicitOffsets(element, anchor, 'top', 'left', vOffset, hOffset, isOverflow) : GetExplicitOffsets(element, anchor, 'top', 'right', vOffset, hOffset, isOverflow); 1532 case 'bottom': 1533 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__foundation_util_core__["b" /* rtl */])() ? GetExplicitOffsets(element, anchor, 'bottom', 'left', vOffset, hOffset, isOverflow) : GetExplicitOffsets(element, anchor, 'bottom', 'right', vOffset, hOffset, isOverflow); 1534 case 'center top': 1535 return GetExplicitOffsets(element, anchor, 'top', 'center', vOffset, hOffset, isOverflow); 1536 case 'center bottom': 1537 return GetExplicitOffsets(element, anchor, 'bottom', 'center', vOffset, hOffset, isOverflow); 1538 case 'center left': 1539 return GetExplicitOffsets(element, anchor, 'left', 'center', vOffset, hOffset, isOverflow); 1540 case 'center right': 1541 return GetExplicitOffsets(element, anchor, 'right', 'center', vOffset, hOffset, isOverflow); 1542 case 'left bottom': 1543 return GetExplicitOffsets(element, anchor, 'bottom', 'left', vOffset, hOffset, isOverflow); 1544 case 'right bottom': 1545 return GetExplicitOffsets(element, anchor, 'bottom', 'right', vOffset, hOffset, isOverflow); 1546 // Backwards compatibility... this along with the reveal and reveal full 1547 // classes are the only ones that didn't reference anchor 1548 case 'center': 1549 return { 1550 left: $eleDims.windowDims.offset.left + $eleDims.windowDims.width / 2 - $eleDims.width / 2 + hOffset, 1551 top: $eleDims.windowDims.offset.top + $eleDims.windowDims.height / 2 - ($eleDims.height / 2 + vOffset) 1552 }; 1553 case 'reveal': 1554 return { 1555 left: ($eleDims.windowDims.width - $eleDims.width) / 2 + hOffset, 1556 top: $eleDims.windowDims.offset.top + vOffset 1557 }; 1558 case 'reveal full': 1559 return { 1560 left: $eleDims.windowDims.offset.left, 1561 top: $eleDims.windowDims.offset.top 1562 }; 1563 break; 1564 default: 1565 return { 1566 left: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__foundation_util_core__["b" /* rtl */])() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset : $anchorDims.offset.left + hOffset, 1567 top: $anchorDims.offset.top + $anchorDims.height + vOffset 1568 }; 1569 1570 } 1571} 1572 1573function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffset, isOverflow) { 1574 var $eleDims = GetDimensions(element), 1575 $anchorDims = anchor ? GetDimensions(anchor) : null; 1576 1577 var topVal, leftVal; 1578 1579 // set position related attribute 1580 1581 switch (position) { 1582 case 'top': 1583 topVal = $anchorDims.offset.top - ($eleDims.height + vOffset); 1584 break; 1585 case 'bottom': 1586 topVal = $anchorDims.offset.top + $anchorDims.height + vOffset; 1587 break; 1588 case 'left': 1589 leftVal = $anchorDims.offset.left - ($eleDims.width + hOffset); 1590 break; 1591 case 'right': 1592 leftVal = $anchorDims.offset.left + $anchorDims.width + hOffset; 1593 break; 1594 } 1595 1596 // set alignment related attribute 1597 switch (position) { 1598 case 'top': 1599 case 'bottom': 1600 switch (alignment) { 1601 case 'left': 1602 leftVal = $anchorDims.offset.left + hOffset; 1603 break; 1604 case 'right': 1605 leftVal = $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset; 1606 break; 1607 case 'center': 1608 leftVal = isOverflow ? hOffset : $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2 + hOffset; 1609 break; 1610 } 1611 break; 1612 case 'right': 1613 case 'left': 1614 switch (alignment) { 1615 case 'bottom': 1616 topVal = $anchorDims.offset.top - vOffset + $anchorDims.height - $eleDims.height; 1617 break; 1618 case 'top': 1619 topVal = $anchorDims.offset.top + vOffset; 1620 break; 1621 case 'center': 1622 topVal = $anchorDims.offset.top + vOffset + $anchorDims.height / 2 - $eleDims.height / 2; 1623 break; 1624 } 1625 break; 1626 } 1627 return { top: topVal, left: leftVal }; 1628} 1629 1630 1631 1632/***/ }), 1633/* 8 */ 1634/***/ (function(module, __webpack_exports__, __webpack_require__) { 1635 1636"use strict"; 1637/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return onImagesLoaded; }); 1638/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 1639/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 1640 1641 1642 1643 1644/** 1645 * Runs a callback function when images are fully loaded. 1646 * @param {Object} images - Image(s) to check if loaded. 1647 * @param {Func} callback - Function to execute when image is fully loaded. 1648 */ 1649function onImagesLoaded(images, callback) { 1650 var self = this, 1651 unloaded = images.length; 1652 1653 if (unloaded === 0) { 1654 callback(); 1655 } 1656 1657 images.each(function () { 1658 // Check if image is loaded
1659 if (this.complete && this.naturalWidth !== undefined) { 1660 singleImageLoaded(); 1661 } else { 1662 // If the above check failed, simulate loading on detached element. 1663 var image = new Image(); 1664 // Still count image as loaded if it finalizes with an error. 1665 var events = "load.zf.images error.zf.images"; 1666 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(image).one(events, function me(event) { 1667 // Unbind the event listeners. We're using 'one' but only one of the two events will have fired. 1668 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).off(events, me); 1669 singleImageLoaded(); 1670 }); 1671 image.src = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).attr('src'); 1672 } 1673 }); 1674 1675 function singleImageLoaded() { 1676 unloaded--; 1677 if (unloaded === 0) { 1678 callback(); 1679 } 1680 } 1681} 1682 1683 1684 1685/***/ }), 1686/* 9 */ 1687/***/ (function(module, __webpack_exports__, __webpack_require__) { 1688 1689"use strict"; 1690/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Nest; }); 1691/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 1692/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 1693 1694 1695 1696 1697var Nest = { 1698 Feather: function (menu) { 1699 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'zf'; 1700 1701 menu.attr('role', 'menubar'); 1702 1703 var items = menu.find('li').attr({ 'role': 'menuitem' }), 1704 subMenuClass = 'is-' + type + '-submenu', 1705 subItemClass = subMenuClass + '-item', 1706 hasSubClass = 'is-' + type + '-submenu-parent', 1707 applyAria = type !== 'accordion'; // Accordions handle their own ARIA attriutes. 1708 1709 items.each(function () { 1710 var $item = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 1711 $sub = $item.children('ul'); 1712 1713 if ($sub.length) { 1714 $item.addClass(hasSubClass); 1715 $sub.addClass('submenu ' + subMenuClass).attr({ 'data-submenu': '' }); 1716 if (applyAria) { 1717 $item.attr({ 1718 'aria-haspopup': true, 1719 'aria-label': $item.children('a:first').text() 1720 }); 1721 // Note: Drilldowns behave differently in how they hide, and so need 1722 // additional attributes. We should look if this possibly over-generalized 1723 // utility (Nest) is appropriate when we rework menus in 6.4 1724 if (type === 'drilldown') { 1725 $item.attr({ 'aria-expanded': false }); 1726 } 1727 } 1728 $sub.addClass('submenu ' + subMenuClass).attr({ 1729 'data-submenu': '', 1730 'role': 'menu' 1731 }); 1732 if (type === 'drilldown') { 1733 $sub.attr({ 'aria-hidden': true }); 1734 } 1735 } 1736 1737 if ($item.parent('[data-submenu]').length) { 1738 $item.addClass('is-submenu-item ' + subItemClass); 1739 } 1740 }); 1741 1742 return; 1743 }, 1744 Burn: function (menu, type) { 1745 var //items = menu.find('li'), 1746 subMenuClass = 'is-' + type + '-submenu', 1747 subItemClass = subMenuClass + '-item', 1748 hasSubClass = 'is-' + type + '-submenu-parent'; 1749 1750 menu.find('>li, .menu, .menu > li').removeClass(subMenuClass + ' ' + subItemClass + ' ' + hasSubClass + ' is-submenu-item submenu is-active').removeAttr('data-submenu').css('display', ''); 1751 } 1752}; 1753 1754 1755 1756/***/ }), 1757/* 10 */ 1758/***/ (function(module, __webpack_exports__, __webpack_require__) { 1759 1760"use strict"; 1761/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Accordion; }); 1762/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 1763/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 1764/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 1765/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_core__ = __webpack_require__(1); 1766/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_plugin__ = __webpack_require__(2); 1767 1768 1769var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 1770 1771function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1772 1773function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 1774 1775function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
1775onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 1776 1777 1778 1779 1780 1781 1782/** 1783 * Accordion module. 1784 * @module foundation.accordion 1785 * @requires foundation.util.keyboard 1786 */ 1787 1788var Accordion = function (_Plugin) { 1789 _inherits(Accordion, _Plugin); 1790 1791 function Accordion() { 1792 _classCallCheck(this, Accordion); 1793 1794 return _possibleConstructorReturn(this, (Accordion.__proto__ || Object.getPrototypeOf(Accordion)).apply(this, arguments)); 1795 } 1796 1797 _createClass(Accordion, [{ 1798 key: '_setup', 1799 1800 /** 1801 * Creates a new instance of an accordion. 1802 * @class 1803 * @name Accordion 1804 * @fires Accordion#init 1805 * @param {jQuery} element - jQuery object to make into an accordion. 1806 * @param {Object} options - a plain object with settings to override the default options. 1807 */ 1808 value: function _setup(element, options) { 1809 this.$element = element; 1810 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Accordion.defaults, this.$element.data(), options); 1811 1812 this.className = 'Accordion'; // ie9 back compat 1813 this._init(); 1814 1815 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('Accordion', { 1816 'ENTER': 'toggle', 1817 'SPACE': 'toggle', 1818 'ARROW_DOWN': 'next', 1819 'ARROW_UP': 'previous' 1820 }); 1821 } 1822 1823 /** 1824 * Initializes the accordion by animating the preset active pane(s). 1825 * @private 1826 */ 1827 1828 }, { 1829 key: '_init', 1830 value: function _init() { 1831 var _this3 = this; 1832 1833 this.$element.attr('role', 'tablist'); 1834 this.$tabs = this.$element.children('[data-accordion-item]'); 1835 1836 this.$tabs.each(function (idx, el) { 1837 var $el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(el), 1838 $content = $el.children('[data-tab-content]'), 1839 id = $content[0].id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_core__["a" /* GetYoDigits */])(6, 'accordion'), 1840 linkId = el.id || id + '-label'; 1841 1842 $el.find('a:first').attr({ 1843 'aria-controls': id, 1844 'role': 'tab', 1845 'id': linkId, 1846 'aria-expanded': false, 1847 'aria-selected': false 1848 }); 1849 1850 $content.attr({ 'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id }); 1851 }); 1852 var $initActive = this.$element.find('.is-active').children('[data-tab-content]'); 1853 this.firstTimeInit = true; 1854 if ($initActive.length) { 1855 this.down($initActive, this.firstTimeInit); 1856 this.firstTimeInit = false; 1857 } 1858 1859 this._checkDeepLink = function () { 1860 var anchor = window.location.hash; 1861 //need a hash and a relevant anchor in this tabset 1862 if (anchor.length) { 1863 var $link = _this3.$element.find('[href$="' + anchor + '"]'), 1864 $anchor = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(anchor); 1865 1866 if ($link.length && $anchor) { 1867 if (!$link.parent('[data-accordion-item]').hasClass('is-active')) { 1868 _this3.down($anchor, _this3.firstTimeInit); 1869 _this3.firstTimeInit = false; 1870 }; 1871 1872 //roll up a little to show the titles 1873 if (_this3.options.deepLinkSmudge) { 1874 var _this = _this3; 1875 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).load(function () { 1876 var offset = _this.$element.offset(); 1877 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html, body').animate({ scrollTop: offset.top }, _this.options.deepLinkSmudgeDelay); 1878 }); 1879 } 1880 1881 /** 1882 * Fires when the zplugin has deeplinked at pageload 1883 * @event Accordion#deeplink 1884 */ 1885 _this3.$element.trigger('deeplink.zf.accordion', [$link, $anchor]); 1886 } 1887 } 1888 }; 1889 1890 //use browser to open a tab, if it exists in this tabset 1891 if (this.options.deepLink) { 1892 this._checkDeepLink(); 1893 } 1894 1895 this._events(); 1896 } 1897 1898 /** 1899 * Adds event handlers for items within the accordion. 1900 * @private 1901 */ 1902 1903 }, { 1904 key: '_events', 1905 value: function _events() { 1906 var _this = this; 1907 1908 this.$tabs.each(function () { 1909 var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this); 1910 var $tabContent = $elem.children('[data-tab-content]'); 1911 if ($tabContent.length) { 1912 $elem.children('a').off('click.zf.accordion keydown.zf.accordion').on('click.zf.accordion', function (e) { 1913 e.preventDefault(); 1914 _this.toggle($tabContent); 1915 }).on('keydown.zf.accordion', function (e) { 1916 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'Accordion', { 1917 toggle: function () { 1918 _this.toggle($tabContent); 1919 }, 1920 next: function () { 1921 var $a = $elem.next().find('a').focus(); 1922 if (!_this.options.multiExpand) { 1923 $a.trigger('click.zf.accordion'); 1924 } 1925 }, 1926 previous: function () { 1927 var $a = $elem.prev().find('a').focus(); 1928 if (!_this.options.multiExpand) { 1929 $a.trigger('click.zf.accordion'); 1930 } 1931 }, 1932 handled: function () { 1933 e.preventDefault(); 1934 e.stopPropagation(); 1935 } 1936 }); 1937 }); 1938 } 1939 }); 1940 if (this.options.deepLink) { 1941 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('popstate', this._checkDeepLink); 1942 } 1943 } 1944 1945 /** 1946 * Toggles the selected content pane's open/close state. 1947 * @param {jQuery} $target - jQuery object of the pane to toggle (`.accordion-content`). 1948 * @function 1949 */ 1950 1951 }, { 1952 key: 'toggle', 1953 value: function toggle($target) { 1954 if ($target.closest('[data-accordion]').is('[disabled]')) { 1955 console.info('Cannot toggle an accordion that is disabled.'); 1956 return; 1957 } 1958 if ($target.parent().hasClass('is-active')) { 1959 this.up($target); 1960 } else { 1961 this.down($target); 1962 } 1963 //either replace or update browser history 1964 if (this.options.deepLink) { 1965 var anchor = $target.prev('a').attr('href'); 1966 1967 if (this.options.updateHistory) { 1968 history.pushState({}, '', anchor); 1969 } else { 1970 history.replaceState({}, '', anchor); 1971 } 1972 } 1973 } 1974 1975 /** 1976 * Opens the accordion tab defined by `$target`. 1977 * @param {jQuery} $target - Accordion pane to open (`.accordion-content`). 1978 * @param {Boolean} firstTime - flag to determine if reflow should happen. 1979 * @fires Accordion#down 1980 * @function 1981 */ 1982 1983 }, { 1984 key: 'down', 1985 value: function down($target, firstTime) { 1986 var _this4 = this; 1987 1988 /** 1989 * checking firstTime allows for initial render of the accordion 1990 * to render preset is-active panes. 1991 */ 1992 if ($target.closest('[data-accordion]').is('[disabled]') && !firstTime) { 1993 console.info('Cannot call down on an accordion that is disabled.'); 1994 return; 1995 } 1996 $target.attr('aria-hidden', false).parent('[data-tab-content]').addBack().parent().addClass('is-active'); 1997 1998 if (!this.options.multiExpand && !firstTime) { 1999 var $currentActive = this.$element.children('.is-active').children('[data-tab-content]'); 2000 if ($currentActive.length) { 2001 this.up($currentActive.not($target)); 2002 } 2003 } 2004 2005 $target.slideDown(this.options.slideSpeed, function () { 2006 /** 2007 * Fires when the tab is done opening. 2008 * @event Accordion#down 2009 */ 2010 _this4.$element.trigger('down.zf.accordion', [$target]); 2011 }); 2012 2013 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + $target.attr('aria-labelledby')).attr({ 2014 'aria-expanded': true, 2015 'aria-selected': true 2016 }); 2017 } 2018 2019 /** 2020 * Closes the tab defined by `$target`. 2021 * @param {jQuery} $target - Accordion tab to close (`.accordion-content`). 2022 * @fires Accordion#up 2023 * @function 2024 */ 2025 2026 }, { 2027 key: 'up', 2028 value: function up($target) { 2029 if ($target.closest('[data-accordion]').is('[disabled]')) { 2030 console.info('Cannot call up on an accordion that is disabled.'); 2031 return; 2032 } 2033 2034 var $aunts = $target.parent().siblings(), 2035 _this = this; 2036 2037 if (!this.options.allowAllClosed && !$aunts.hasClass('is-active') || !$target.parent().hasClass('is-active')) { 2038 return; 2039 } 2040 2041 $target.slideUp(_this.options.slideSpeed, function () { 2042 /** 2043 * Fires when the tab is done collapsing up. 2044 * @event Accordion#up 2045 */ 2046 _this.$element.trigger('up.zf.accordion', [$target]); 2047 }); 2048 2049 $target.attr('aria-hidden', true).parent().removeClass('is-active'); 2050 2051 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + $target.attr('aria-labelledby')).attr({ 2052 'aria-expanded': false, 2053 'aria-selected': false 2054 }); 2055 } 2056 2057 /** 2058 * Destroys an instance of an accordion. 2059 * @fires Accordion#destroyed 2060 * @function 2061 */ 2062 2063 }, { 2064 key: '_destroy', 2065 value: function _destroy() {
2066 this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', ''); 2067 this.$element.find('a').off('.zf.accordion'); 2068 if (this.options.deepLink) { 2069 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('popstate', this._checkDeepLink); 2070 } 2071 } 2072 }]); 2073 2074 return Accordion; 2075}(__WEBPACK_IMPORTED_MODULE_3__foundation_plugin__["a" /* Plugin */]); 2076 2077Accordion.defaults = { 2078 /** 2079 * Amount of time to animate the opening of an accordion pane. 2080 * @option 2081 * @type {number} 2082 * @default 250 2083 */ 2084 slideSpeed: 250, 2085 /** 2086 * Allow the accordion to have multiple open panes. 2087 * @option 2088 * @type {boolean} 2089 * @default false 2090 */ 2091 multiExpand: false, 2092 /** 2093 * Allow the accordion to close all panes. 2094 * @option 2095 * @type {boolean} 2096 * @default false 2097 */ 2098 allowAllClosed: false, 2099 /** 2100 * Allows the window to scroll to content of pane specified by hash anchor 2101 * @option 2102 * @type {boolean} 2103 * @default false 2104 */ 2105 deepLink: false, 2106 2107 /** 2108 * Adjust the deep link scroll to make sure the top of the accordion panel is visible 2109 * @option 2110 * @type {boolean} 2111 * @default false 2112 */ 2113 deepLinkSmudge: false, 2114 2115 /** 2116 * Animation time (ms) for the deep link adjustment 2117 * @option 2118 * @type {number} 2119 * @default 300 2120 */ 2121 deepLinkSmudgeDelay: 300, 2122 2123 /** 2124 * Update the browser history with the open accordion 2125 * @option 2126 * @type {boolean} 2127 * @default false 2128 */ 2129 updateHistory: false 2130}; 2131 2132 2133 2134/***/ }), 2135/* 11 */ 2136/***/ (function(module, __webpack_exports__, __webpack_require__) { 2137 2138"use strict"; 2139/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AccordionMenu; }); 2140/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 2141/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 2142/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 2143/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__ = __webpack_require__(9); 2144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_core__ = __webpack_require__(1); 2145/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_plugin__ = __webpack_require__(2); 2146 2147 2148var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 2149 2150function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2151 2152function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 2153 2154function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 2155 2156 2157 2158 2159 2160 2161 2162/** 2163 * AccordionMenu module. 2164 * @module foundation.accordionMenu 2165 * @requires foundation.util.keyboard 2166 * @requires foundation.util.nest 2167 */ 2168 2169var AccordionMenu = function (_Plugin) { 2170 _inherits(AccordionMenu, _Plugin); 2171 2172 function AccordionMenu() { 2173 _classCallCheck(this, AccordionMenu); 2174 2175 return _possibleConstructorReturn(this, (AccordionMenu.__proto__ || Object.getPrototypeOf(AccordionMenu)).apply(this, arguments)); 2176 } 2177 2178 _createClass(AccordionMenu, [{ 2179 key: '_setup', 2180 2181 /** 2182 * Creates a new instance of an accordion menu. 2183 * @class 2184 * @name AccordionMenu 2185 * @fires AccordionMenu#init 2186 * @param {jQuery} element - jQuery object to make into an accordion menu. 2187 * @param {Object} options - Overrides to the default plugin settings. 2188 */ 2189 value: function _setup(element, options) { 2190 this.$element = element; 2191 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, AccordionMenu.defaults, this.$element.data(), options); 2192 this.className = 'AccordionMenu'; // ie9 back compat 2193 2194 this._init(); 2195 2196 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('AccordionMenu', { 2197 'ENTER': 'toggle', 2198 'SPACE': 'toggle', 2199 'ARROW_RIGHT': 'open', 2200 'ARROW_UP': 'up', 2201 'ARROW_DOWN': 'down', 2202 'ARROW_LEFT': 'close', 2203 'ESCAPE': 'closeAll' 2204 }); 2205 } 2206 2207 /** 2208 * Initializes the accordion menu by hiding all nested menus. 2209 * @private 2210 */ 2211 2212 }, { 2213 key: '_init', 2214 value: function _init() { 2215 __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__["a" /* Nest */].Feather(this.$element, 'accordion'); 2216 2217 var _this = this; 2218 2219 this.$element.find('[data-submenu]').not('.is-active').slideUp(0); //.find('a').css('padding-left', '1rem'); 2220 this.$element.attr({ 2221 'role': 'tree',
vendor: 5,308 bytes, lines 2222-2347
2222 'aria-multiselectable': this.options.multiOpen 2223 }); 2224 2225 this.$menuLinks = this.$element.find('.is-accordion-submenu-parent'); 2226 this.$menuLinks.each(function () { 2227 var linkId = this.id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["a" /* GetYoDigits */])(6, 'acc-menu-link'), 2228 $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 2229 $sub = $elem.children('[data-submenu]'), 2230 subId = $sub[0].id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["a" /* GetYoDigits */])(6, 'acc-menu'), 2231 isActive = $sub.hasClass('is-active'); 2232 2233 if (_this.options.submenuToggle) { 2234 $elem.addClass('has-submenu-toggle'); 2235 $elem.children('a').after('<button id="' + linkId + '" class="submenu-toggle" aria-controls="' + subId + '" aria-expanded="' + isActive + '" title="' + _this.options.submenuToggleText + '"><span class="submenu-toggle-text">' + _this.options.submenuToggleText + '</span></button>'); 2236 } else { 2237 $elem.attr({ 2238 'aria-controls': subId, 2239 'aria-expanded': isActive, 2240 'id': linkId 2241 }); 2242 } 2243 $sub.attr({ 2244 'aria-labelledby': linkId, 2245 'aria-hidden': !isActive, 2246 'role': 'group', 2247 'id': subId 2248 }); 2249 }); 2250 this.$element.find('li').attr({ 2251 'role': 'treeitem' 2252 }); 2253 var initPanes = this.$element.find('.is-active'); 2254 if (initPanes.length) { 2255 var _this = this; 2256 initPanes.each(function () { 2257 _this.down(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)); 2258 }); 2259 } 2260 this._events(); 2261 } 2262 2263 /** 2264 * Adds event handlers for items within the menu. 2265 * @private 2266 */ 2267 2268 }, { 2269 key: '_events', 2270 value: function _events() { 2271 var _this = this; 2272 2273 this.$element.find('li').each(function () { 2274 var $submenu = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).children('[data-submenu]'); 2275 2276 if ($submenu.length) { 2277 if (_this.options.submenuToggle) { 2278 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).children('.submenu-toggle').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) { 2279 _this.toggle($submenu); 2280 }); 2281 } else { 2282 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).children('a').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) { 2283 e.preventDefault(); 2284 _this.toggle($submenu); 2285 }); 2286 } 2287 } 2288 }).on('keydown.zf.accordionmenu', function (e) { 2289 var $element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 2290 $elements = $element.parent('ul').children('li'), 2291 $prevElement, 2292 $nextElement, 2293 $target = $element.children('[data-submenu]'); 2294 2295 $elements.each(function (i) { 2296 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is($element)) { 2297 $prevElement = $elements.eq(Math.max(0, i - 1)).find('a').first(); 2298 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)).find('a').first(); 2299 2300 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).children('[data-submenu]:visible').length) { 2301 // has open sub menu 2302 $nextElement = $element.find('li:first-child').find('a').first(); 2303 } 2304 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is(':first-child')) { 2305 // is first element of sub menu 2306 $prevElement = $element.parents('li').first().find('a').first(); 2307 } else if ($prevElement.parents('li').first().children('[data-submenu]:visible').length) { 2308 // if previous element has open sub menu 2309 $prevElement = $prevElement.parents('li').find('li:last-child').find('a').first(); 2310 } 2311 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is(':last-child')) { 2312 // is last element of sub menu 2313 $nextElement = $element.parents('li').first().next('li').find('a').first(); 2314 } 2315 2316 return; 2317 } 2318 }); 2319 2320 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'AccordionMenu', { 2321 open: function () { 2322 if ($target.is(':hidden')) { 2323 _this.down($target); 2324 $target.find('li').first().find('a').first().focus(); 2325 } 2326 }, 2327 close: function () { 2328 if ($target.length && !$target.is(':hidden')) { 2329 // close active sub of this item 2330 _this.up($target); 2331 } else if ($element.parent('[data-submenu]').length) { 2332 // close currently open sub 2333 _this.up($element.parent('[data-submenu]')); 2334 $element.parents('li').first().find('a').first().focus(); 2335 } 2336 }, 2337 up: function () { 2338 $prevElement.focus(); 2339 return true; 2340 }, 2341 down: function () { 2342 $nextElement.focus(); 2343 return true; 2344 }, 2345 toggle: function () { 2346 if (_this.options.submenuToggle) { 2347 return false;
2348 } 2349 if ($element.children('[data-submenu]').length) { 2350 _this.toggle($element.children('[data-submenu]')); 2351 return true; 2352 } 2353 }, 2354 closeAll: function () { 2355 _this.hideAll(); 2356 }, 2357 handled: function (preventDefault) { 2358 if (preventDefault) { 2359 e.preventDefault(); 2360 } 2361 e.stopImmediatePropagation(); 2362 } 2363 }); 2364 }); //.attr('tabindex', 0); 2365 } 2366 2367 /** 2368 * Closes all panes of the menu. 2369 * @function 2370 */ 2371 2372 }, { 2373 key: 'hideAll', 2374 value: function hideAll() { 2375 this.up(this.$element.find('[data-submenu]')); 2376 } 2377 2378 /** 2379 * Opens all panes of the menu. 2380 * @function 2381 */ 2382 2383 }, { 2384 key: 'showAll', 2385 value: function showAll() { 2386 this.down(this.$element.find('[data-submenu]')); 2387 } 2388 2389 /** 2390 * Toggles the open/close state of a submenu. 2391 * @function 2392 * @param {jQuery} $target - the submenu to toggle 2393 */ 2394 2395 }, { 2396 key: 'toggle', 2397 value: function toggle($target) { 2398 if (!$target.is(':animated')) { 2399 if (!$target.is(':hidden')) { 2400 this.up($target); 2401 } else { 2402 this.down($target); 2403 } 2404 } 2405 } 2406 2407 /** 2408 * Opens the sub-menu defined by `$target`. 2409 * @param {jQuery} $target - Sub-menu to open. 2410 * @fires AccordionMenu#down 2411 */ 2412 2413 }, { 2414 key: 'down', 2415 value: function down($target) { 2416 var _this = this; 2417 2418 if (!this.options.multiOpen) { 2419 this.up(this.$element.find('.is-active').not($target.parentsUntil(this.$element).add($target))); 2420 } 2421 2422 $target.addClass('is-active').attr({ 'aria-hidden': false }); 2423 2424 if (this.options.submenuToggle) { 2425 $target.prev('.submenu-toggle').attr({ 'aria-expanded': true }); 2426 } else { 2427 $target.parent('.is-accordion-submenu-parent').attr({ 'aria-expanded': true }); 2428 } 2429 2430 $target.slideDown(_this.options.slideSpeed, function () { 2431 /** 2432 * Fires when the menu is done opening. 2433 * @event AccordionMenu#down 2434 */ 2435 _this.$element.trigger('down.zf.accordionMenu', [$target]); 2436 }); 2437 } 2438 2439 /** 2440 * Closes the sub-menu defined by `$target`. All sub-menus inside the target will be closed as well. 2441 * @param {jQuery} $target - Sub-menu to close. 2442 * @fires AccordionMenu#up 2443 */ 2444 2445 }, { 2446 key: 'up', 2447 value: function up($target) { 2448 var _this = this; 2449 $target.slideUp(_this.options.slideSpeed, function () { 2450 /** 2451 * Fires when the menu is done collapsing up. 2452 * @event AccordionMenu#up 2453 */ 2454 _this.$element.trigger('up.zf.accordionMenu', [$target]); 2455 }); 2456 2457 var $menus = $target.find('[data-submenu]').slideUp(0).addBack().attr('aria-hidden', true); 2458 2459 if (this.options.submenuToggle) { 2460 $menus.prev('.submenu-toggle').attr('aria-expanded', false); 2461 } else { 2462 $menus.parent('.is-accordion-submenu-parent').attr('aria-expanded', false); 2463 } 2464 } 2465 2466 /** 2467 * Destroys an instance of accordion menu. 2468 * @fires AccordionMenu#destroyed 2469 */ 2470 2471 }, { 2472 key: '_destroy', 2473 value: function _destroy() { 2474 this.$element.find('[data-submenu]').slideDown(0).css('display', ''); 2475 this.$element.find('a').off('click.zf.accordionMenu'); 2476 2477 if (this.options.submenuToggle) { 2478 this.$element.find('.has-submenu-toggle').removeClass('has-submenu-toggle'); 2479 this.$element.find('.submenu-toggle').remove(); 2480 } 2481 2482 __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__["a" /* Nest */].Burn(this.$element, 'accordion'); 2483 } 2484 }]); 2485 2486 return AccordionMenu; 2487}(__WEBPACK_IMPORTED_MODULE_4__foundation_plugin__["a" /* Plugin */]); 2488 2489AccordionMenu.defaults = { 2490 /** 2491 * Amount of time to animate the opening of a submenu in ms. 2492 * @option 2493 * @type {number} 2494 * @default 250 2495 */ 2496 slideSpeed: 250, 2497 /** 2498 * Adds a separate submenu toggle button. This allows the parent item to have a link. 2499 * @option 2500 * @example true 2501 */ 2502 submenuToggle: false, 2503 /** 2504 * The text used for the submenu toggle if enabled. This is used for screen readers only. 2505 * @option 2506 * @example true 2507 */ 2508 submenuToggleText: 'Toggle menu', 2509 /** 2510 * Allow the menu to have multiple open panes. 2511 * @option 2512 * @type {boolean} 2513 * @default true 2514 */
2515 multiOpen: true 2516}; 2517 2518 2519 2520/***/ }), 2521/* 12 */ 2522/***/ (function(module, __webpack_exports__, __webpack_require__) { 2523 2524"use strict"; 2525/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Drilldown; }); 2526/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 2527/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 2528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 2529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__ = __webpack_require__(9); 2530/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_core__ = __webpack_require__(1); 2531/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_util_box__ = __webpack_require__(7); 2532/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_plugin__ = __webpack_require__(2); 2533 2534 2535var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 2536 2537function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2538 2539function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 2540 2541function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 2542 2543 2544 2545 2546 2547 2548 2549 2550/** 2551 * Drilldown module. 2552 * @module foundation.drilldown 2553 * @requires foundation.util.keyboard 2554 * @requires foundation.util.nest 2555 * @requires foundation.util.box 2556 */ 2557 2558var Drilldown = function (_Plugin) { 2559 _inherits(Drilldown, _Plugin); 2560 2561 function Drilldown() { 2562 _classCallCheck(this, Drilldown); 2563 2564 return _possibleConstructorReturn(this, (Drilldown.__proto__ || Object.getPrototypeOf(Drilldown)).apply(this, arguments)); 2565 } 2566 2567 _createClass(Drilldown, [{ 2568 key: '_setup', 2569 2570 /** 2571 * Creates a new instance of a drilldown menu. 2572 * @class 2573 * @name Drilldown 2574 * @param {jQuery} element - jQuery object to make into an accordion menu. 2575 * @param {Object} options - Overrides to the default plugin settings. 2576 */ 2577 value: function _setup(element, options) { 2578 this.$element = element; 2579 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Drilldown.defaults, this.$element.data(), options); 2580 this.className = 'Drilldown'; // ie9 back compat 2581 2582 this._init(); 2583 2584 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('Drilldown', { 2585 'ENTER': 'open', 2586 'SPACE': 'open', 2587 'ARROW_RIGHT': 'next', 2588 'ARROW_UP': 'up', 2589 'ARROW_DOWN': 'down', 2590 'ARROW_LEFT': 'previous', 2591 'ESCAPE': 'close', 2592 'TAB': 'down', 2593 'SHIFT_TAB': 'up' 2594 }); 2595 } 2596 2597 /** 2598 * Initializes the drilldown by creating jQuery collections of elements 2599 * @private 2600 */ 2601 2602 }, { 2603 key: '_init', 2604 value: function _init() { 2605 __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__["a" /* Nest */].Feather(this.$element, 'drilldown'); 2606 2607 if (this.options.autoApplyClass) { 2608 this.$element.addClass('drilldown'); 2609 } 2610 2611 this.$element.attr({ 2612 'role': 'tree', 2613 'aria-multiselectable': false 2614 }); 2615 this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a'); 2616 this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]').attr('role', 'group'); 2617 this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'treeitem').find('a'); 2618 this.$element.attr('data-mutate', this.$element.attr('data-drilldown') || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["a" /* GetYoDigits */])(6, 'drilldown')); 2619 2620 this._prepareMenu(); 2621 this._registerEvents(); 2622 2623 this._keyboardEvents(); 2624 } 2625 2626 /** 2627 * prepares drilldown menu by setting attributes to links and elements 2628 * sets a min height to prevent content jumping 2629 * wraps the element if not already wrapped 2630 * @private 2631 * @function 2632 */ 2633 2634 }, { 2635 key: '_prepareMenu', 2636 value: function _prepareMenu() { 2637 var _this = this; 2638 // if(!this.options.holdOpen){ 2639 // this._menuLinkEvents(); 2640 // } 2641 this.$submenuAnchors.each(function () { 2642 var $link = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this); 2643 var $sub = $link.parent(); 2644 if (_this.options.parentLink) { 2645 $link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="menuitem"></li>'); 2646 } 2647 $link.data('savedHref', $link.attr('href')).removeAttr('href').attr('tabindex', 0); 2648 $link.children('[data-submenu]').attr({ 2649 'aria-hidden': true, 2650 'tabindex': 0, 2651 'role': 'group' 2652 }); 2653 _this._events($link); 2654 }); 2655 this.$submenus.each(function () { 2656 var $menu = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 2657 $back = $menu.find('.js-drilldown-back'); 2658 if (!$back.length) { 2659 switch (_this.options.backButtonPosition) { 2660 case "bottom": 2661 $menu.append(_this.options.backButton); 2662 break; 2663 case "top": 2664 $menu.prepend(_this.options.backButton); 2665 break; 2666 default: 2667 console.error("Unsupported backButtonPosition value '" + _this.options.backButtonPosition + "'"); 2668 } 2669 } 2670 _this._back($menu); 2671 }); 2672 2673 this.$submenus.addClass('invisible'); 2674 if (!this.options.autoHeight) { 2675 this.$submenus.addClass('drilldown-submenu-cover-previous'); 2676 } 2677 2678 // create a wrapper on element if it doesn't exist. 2679 if (!this.$element.parent().hasClass('is-drilldown')) { 2680 this.$wrapper = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.options.wrapper).addClass('is-drilldown'); 2681 if (this.options.animateHeight) this.$wrapper.addClass('animate-height'); 2682 this.$element.wrap(this.$wrapper); 2683 } 2684 // set wrapper 2685 this.$wrapper = this.$element.parent(); 2686 this.$wrapper.css(this._getMaxDims()); 2687 } 2688 }, { 2689 key: '_resize', 2690 value: function _resize() { 2691 this.$wrapper.css({ 'max-width': 'none', 'min-height': 'none' }); 2692 // _getMaxDims has side effects (boo) but calling it should update all other necessary heights & widths 2693 this.$wrapper.css(this._getMaxDims()); 2694 } 2695 2696 /** 2697 * Adds event handlers to elements in the menu. 2698 * @function 2699 * @private 2700 * @param {jQuery} $elem - the current menu item to add handlers to. 2701 */ 2702 2703 }, { 2704 key: '_events', 2705 value: function _events($elem) { 2706 var _this = this; 2707 2708 $elem.off('click.zf.drilldown').on('click.zf.drilldown', function (e) { 2709 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target).parentsUntil('ul', 'li').hasClass('is-drilldown-submenu-parent')) { 2710 e.stopImmediatePropagation(); 2711 e.preventDefault(); 2712 } 2713 2714 // if(e.target !== e.currentTarget.firstElementChild){ 2715 // return false;
vendor: 16,384 bytes, lines 2716-3149
2716 // } 2717 _this._show($elem.parent('li')); 2718 2719 if (_this.options.closeOnClick) { 2720 var $body = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body'); 2721 $body.off('.zf.drilldown').on('click.zf.drilldown', function (e) { 2722 if (e.target === _this.$element[0] || __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.contains(_this.$element[0], e.target)) { 2723 return; 2724 } 2725 e.preventDefault(); 2726 _this._hideAll(); 2727 $body.off('.zf.drilldown'); 2728 }); 2729 } 2730 }); 2731 } 2732 2733 /** 2734 * Adds event handlers to the menu element. 2735 * @function 2736 * @private 2737 */ 2738 2739 }, { 2740 key: '_registerEvents', 2741 value: function _registerEvents() { 2742 if (this.options.scrollTop) { 2743 this._bindHandler = this._scrollTop.bind(this); 2744 this.$element.on('open.zf.drilldown hide.zf.drilldown closed.zf.drilldown', this._bindHandler); 2745 } 2746 this.$element.on('mutateme.zf.trigger', this._resize.bind(this)); 2747 } 2748 2749 /** 2750 * Scroll to Top of Element or data-scroll-top-element 2751 * @function 2752 * @fires Drilldown#scrollme 2753 */ 2754 2755 }, { 2756 key: '_scrollTop', 2757 value: function _scrollTop() { 2758 var _this = this; 2759 var $scrollTopElement = _this.options.scrollTopElement != '' ? __WEBPACK_IMPORTED_MODULE_0_jquery___default()(_this.options.scrollTopElement) : _this.$element, 2760 scrollPos = parseInt($scrollTopElement.offset().top + _this.options.scrollTopOffset, 10); 2761 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html, body').stop(true).animate({ scrollTop: scrollPos }, _this.options.animationDuration, _this.options.animationEasing, function () { 2762 /** 2763 * Fires after the menu has scrolled 2764 * @event Drilldown#scrollme 2765 */ 2766 if (this === __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html')[0]) _this.$element.trigger('scrollme.zf.drilldown'); 2767 }); 2768 } 2769 2770 /** 2771 * Adds keydown event listener to `li`'s in the menu. 2772 * @private 2773 */ 2774 2775 }, { 2776 key: '_keyboardEvents', 2777 value: function _keyboardEvents() { 2778 var _this = this; 2779 2780 this.$menuItems.add(this.$element.find('.js-drilldown-back > a, .is-submenu-parent-item > a')).on('keydown.zf.drilldown', function (e) { 2781 var $element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 2782 $elements = $element.parent('li').parent('ul').children('li').children('a'), 2783 $prevElement, 2784 $nextElement; 2785 2786 $elements.each(function (i) { 2787 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is($element)) { 2788 $prevElement = $elements.eq(Math.max(0, i - 1)); 2789 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 2790 return; 2791 } 2792 }); 2793 2794 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'Drilldown', { 2795 next: function () { 2796 if ($element.is(_this.$submenuAnchors)) { 2797 _this._show($element.parent('li')); 2798 $element.parent('li').one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["c" /* transitionend */])($element), function () { 2799 $element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus(); 2800 }); 2801 return true; 2802 } 2803 }, 2804 previous: function () { 2805 _this._hide($element.parent('li').parent('ul')); 2806 $element.parent('li').parent('ul').one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["c" /* transitionend */])($element), function () { 2807 setTimeout(function () { 2808 $element.parent('li').parent('ul').parent('li').children('a').first().focus(); 2809 }, 1); 2810 }); 2811 return true; 2812 }, 2813 up: function () { 2814 $prevElement.focus(); 2815 // Don't tap focus on first element in root ul 2816 return !$element.is(_this.$element.find('> li:first-child > a')); 2817 }, 2818 down: function () { 2819 $nextElement.focus(); 2820 // Don't tap focus on last element in root ul 2821 return !$element.is(_this.$element.find('> li:last-child > a')); 2822 }, 2823 close: function () { 2824 // Don't close on element in root ul 2825 if (!$element.is(_this.$element.find('> li > a'))) { 2826 _this._hide($element.parent().parent()); 2827 $element.parent().parent().siblings('a').focus(); 2828 } 2829 }, 2830 open: function () { 2831 if (!$element.is(_this.$menuItems)) { 2832 // not menu item means back button 2833 _this._hide($element.parent('li').parent('ul')); 2834 $element.parent('li').parent('ul').one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["c" /* transitionend */])($element), function () { 2835 setTimeout(function () { 2836 $element.parent('li').parent('ul').parent('li').children('a').first().focus(); 2837 }, 1); 2838 }); 2839 return true; 2840 } else if ($element.is(_this.$submenuAnchors)) { 2841 _this._show($element.parent('li')); 2842 $element.parent('li').one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["c" /* transitionend */])($element), function () { 2843 $element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus(); 2844 }); 2845 return true; 2846 } 2847 }, 2848 handled: function (preventDefault) { 2849 if (preventDefault) { 2850 e.preventDefault(); 2851 } 2852 e.stopImmediatePropagation(); 2853 } 2854 }); 2855 }); // end keyboardAccess 2856 } 2857 2858 /** 2859 * Closes all open elements, and returns to root menu. 2860 * @function 2861 * @fires Drilldown#closed 2862 */ 2863 2864 }, { 2865 key: '_hideAll', 2866 value: function _hideAll() { 2867 var $elem = this.$element.find('.is-drilldown-submenu.is-active').addClass('is-closing'); 2868 if (this.options.autoHeight) this.$wrapper.css({ height: $elem.parent().closest('ul').data('calcHeight') }); 2869 $elem.one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["c" /* transitionend */])($elem), function (e) { 2870 $elem.removeClass('is-active is-closing'); 2871 }); 2872 /** 2873 * Fires when the menu is fully closed. 2874 * @event Drilldown#closed 2875 */ 2876 this.$element.trigger('closed.zf.drilldown'); 2877 } 2878 2879 /** 2880 * Adds event listener for each `back` button, and closes open menus. 2881 * @function 2882 * @fires Drilldown#back 2883 * @param {jQuery} $elem - the current sub-menu to add `back` event. 2884 */ 2885 2886 }, { 2887 key: '_back', 2888 value: function _back($elem) { 2889 var _this = this; 2890 $elem.off('click.zf.drilldown'); 2891 $elem.children('.js-drilldown-back').on('click.zf.drilldown', function (e) { 2892 e.stopImmediatePropagation(); 2893 // console.log('mouseup on back'); 2894 _this._hide($elem); 2895 2896 // If there is a parent submenu, call show 2897 var parentSubMenu = $elem.parent('li').parent('ul').parent('li'); 2898 if (parentSubMenu.length) { 2899 _this._show(parentSubMenu); 2900 } 2901 }); 2902 } 2903 2904 /** 2905 * Adds event listener to menu items w/o submenus to close open menus on click. 2906 * @function 2907 * @private 2908 */ 2909 2910 }, { 2911 key: '_menuLinkEvents', 2912 value: function _menuLinkEvents() { 2913 var _this = this; 2914 this.$menuItems.not('.is-drilldown-submenu-parent').off('click.zf.drilldown').on('click.zf.drilldown', function (e) { 2915 // e.stopImmediatePropagation(); 2916 setTimeout(function () { 2917 _this._hideAll(); 2918 }, 0); 2919 }); 2920 } 2921 2922 /** 2923 * Opens a submenu. 2924 * @function 2925 * @fires Drilldown#open 2926 * @param {jQuery} $elem - the current element with a submenu to open, i.e. the `li` tag. 2927 */ 2928 2929 }, { 2930 key: '_show', 2931 value: function _show($elem) { 2932 if (this.options.autoHeight) this.$wrapper.css({ height: $elem.children('[data-submenu]').data('calcHeight') }); 2933 $elem.attr('aria-expanded', true); 2934 $elem.children('[data-submenu]').addClass('is-active').removeClass('invisible').attr('aria-hidden', false); 2935 /** 2936 * Fires when the submenu has opened. 2937 * @event Drilldown#open 2938 */ 2939 this.$element.trigger('open.zf.drilldown', [$elem]); 2940 } 2941 }, { 2942 key: '_hide', 2943 2944 2945 /** 2946 * Hides a submenu 2947 * @function 2948 * @fires Drilldown#hide 2949 * @param {jQuery} $elem - the current sub-menu to hide, i.e. the `ul` tag. 2950 */ 2951 value: function _hide($elem) { 2952 if (this.options.autoHeight) this.$wrapper.css({ height: $elem.parent().closest('ul').data('calcHeight') }); 2953 var _this = this; 2954 $elem.parent('li').attr('aria-expanded', false); 2955 $elem.attr('aria-hidden', true).addClass('is-closing'); 2956 $elem.addClass('is-closing').one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["c" /* transitionend */])($elem), function () { 2957 $elem.removeClass('is-active is-closing'); 2958 $elem.blur().addClass('invisible'); 2959 }); 2960 /** 2961 * Fires when the submenu has closed. 2962 * @event Drilldown#hide 2963 */ 2964 $elem.trigger('hide.zf.drilldown', [$elem]); 2965 } 2966 2967 /** 2968 * Iterates through the nested menus to calculate the min-height, and max-width for the menu. 2969 * Prevents content jumping. 2970 * @function 2971 * @private 2972 */ 2973 2974 }, { 2975 key: '_getMaxDims', 2976 value: function _getMaxDims() { 2977 var maxHeight = 0, 2978 result = {}, 2979 _this = this; 2980 this.$submenus.add(this.$element).each(function () { 2981 var numOfElems = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).children('li').length; 2982 var height = __WEBPACK_IMPORTED_MODULE_4__foundation_util_box__["a" /* Box */].GetDimensions(this).height; 2983 maxHeight = height > maxHeight ? height : maxHeight; 2984 if (_this.options.autoHeight) { 2985 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('calcHeight', height); 2986 if (!__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).hasClass('is-drilldown-submenu')) result['height'] = height; 2987 } 2988 }); 2989 2990 if (!this.options.autoHeight) result['min-height'] = maxHeight + 'px'; 2991 2992 result['max-width'] = this.$element[0].getBoundingClientRect().width + 'px'; 2993 2994 return result; 2995 } 2996 2997 /** 2998 * Destroys the Drilldown Menu 2999 * @function 3000 */ 3001 3002 }, { 3003 key: '_destroy', 3004 value: function _destroy() { 3005 if (this.options.scrollTop) this.$element.off('.zf.drilldown', this._bindHandler); 3006 this._hideAll(); 3007 this.$element.off('mutateme.zf.trigger'); 3008 __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__["a" /* Nest */].Burn(this.$element, 'drilldown'); 3009 this.$element.unwrap().find('.js-drilldown-back, .is-submenu-parent-item').remove().end().find('.is-active, .is-closing, .is-drilldown-submenu').removeClass('is-active is-closing is-drilldown-submenu').end().find('[data-submenu]').removeAttr('aria-hidden tabindex role'); 3010 this.$submenuAnchors.each(function () { 3011 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).off('.zf.drilldown'); 3012 }); 3013 3014 this.$submenus.removeClass('drilldown-submenu-cover-previous invisible'); 3015 3016 this.$element.find('a').each(function () { 3017 var $link = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this); 3018 $link.removeAttr('tabindex'); 3019 if ($link.data('savedHref')) { 3020 $link.attr('href', $link.data('savedHref')).removeData('savedHref'); 3021 } else { 3022 return; 3023 } 3024 }); 3025 } 3026 }]); 3027 3028 return Drilldown; 3029}(__WEBPACK_IMPORTED_MODULE_5__foundation_plugin__["a" /* Plugin */]); 3030 3031Drilldown.defaults = { 3032 /** 3033 * Drilldowns depend on styles in order to function properly; in the default build of Foundation these are 3034 * on the `drilldown` class. This option auto-applies this class to the drilldown upon initialization. 3035 * @option 3036 * @type {boolian} 3037 * @default true 3038 */ 3039 autoApplyClass: true, 3040 /** 3041 * Markup used for JS generated back button. Prepended or appended (see backButtonPosition) to submenu lists and deleted on `destroy` method, 'js-drilldown-back' class required. Remove the backslash (`\`) if copy and pasting. 3042 * @option 3043 * @type {string} 3044 * @default '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>' 3045 */ 3046 backButton: '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>', 3047 /** 3048 * Position the back button either at the top or bottom of drilldown submenus. Can be `'left'` or `'bottom'`. 3049 * @option 3050 * @type {string} 3051 * @default top 3052 */ 3053 backButtonPosition: 'top', 3054 /** 3055 * Markup used to wrap drilldown menu. Use a class name for independent styling; the JS applied class: `is-drilldown` is required. Remove the backslash (`\`) if copy and pasting. 3056 * @option 3057 * @type {string} 3058 * @default '<div></div>' 3059 */ 3060 wrapper: '<div></div>', 3061 /** 3062 * Adds the parent link to the submenu. 3063 * @option 3064 * @type {boolean} 3065 * @default false 3066 */ 3067 parentLink: false, 3068 /** 3069 * Allow the menu to return to root list on body click. 3070 * @option 3071 * @type {boolean} 3072 * @default false 3073 */ 3074 closeOnClick: false, 3075 /** 3076 * Allow the menu to auto adjust height. 3077 * @option 3078 * @type {boolean} 3079 * @default false 3080 */ 3081 autoHeight: false, 3082 /** 3083 * Animate the auto adjust height. 3084 * @option 3085 * @type {boolean} 3086 * @default false 3087 */ 3088 animateHeight: false, 3089 /** 3090 * Scroll to the top of the menu after opening a submenu or navigating back using the menu back button 3091 * @option 3092 * @type {boolean} 3093 * @default false 3094 */ 3095 scrollTop: false, 3096 /** 3097 * String jquery selector (for example 'body') of element to take offset().top from, if empty string the drilldown menu offset().top is taken 3098 * @option 3099 * @type {string} 3100 * @default '' 3101 */ 3102 scrollTopElement: '', 3103 /** 3104 * ScrollTop offset 3105 * @option 3106 * @type {number} 3107 * @default 0 3108 */ 3109 scrollTopOffset: 0, 3110 /** 3111 * Scroll animation duration 3112 * @option 3113 * @type {number} 3114 * @default 500 3115 */ 3116 animationDuration: 500, 3117 /** 3118 * Scroll animation easing. Can be `'swing'` or `'linear'`. 3119 * @option 3120 * @type {string} 3121 * @see {@link https://api.jquery.com/animate|JQuery animate} 3122 * @default 'swing' 3123 */ 3124 animationEasing: 'swing' 3125 // holdOpen: false 3126}; 3127 3128 3129 3130/***/ }), 3131/* 13 */ 3132/***/ (function(module, __webpack_exports__, __webpack_require__) { 3133 3134"use strict"; 3135/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DropdownMenu; }); 3136/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 3137/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 3138/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 3139/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__ = __webpack_require__(9); 3140/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_box__ = __webpack_require__(7); 3141/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_util_core__ = __webpack_require__(1); 3142/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_plugin__ = __webpack_require__(2); 3143 3144 3145var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3146 3147function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3148 3149function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call &&
3149 (typeof call === "object" || typeof call === "function") ? call : self; } 3150 3151function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 3152 3153 3154 3155 3156 3157 3158 3159 3160/** 3161 * DropdownMenu module. 3162 * @module foundation.dropdown-menu 3163 * @requires foundation.util.keyboard 3164 * @requires foundation.util.box 3165 * @requires foundation.util.nest 3166 */ 3167 3168var DropdownMenu = function (_Plugin) { 3169 _inherits(DropdownMenu, _Plugin); 3170 3171 function DropdownMenu() { 3172 _classCallCheck(this, DropdownMenu); 3173 3174 return _possibleConstructorReturn(this, (DropdownMenu.__proto__ || Object.getPrototypeOf(DropdownMenu)).apply(this, arguments)); 3175 } 3176 3177 _createClass(DropdownMenu, [{ 3178 key: '_setup', 3179 3180 /** 3181 * Creates a new instance of DropdownMenu. 3182 * @class 3183 * @name DropdownMenu 3184 * @fires DropdownMenu#init 3185 * @param {jQuery} element - jQuery object to make into a dropdown menu. 3186 * @param {Object} options - Overrides to the default plugin settings. 3187 */ 3188 value: function _setup(element, options) { 3189 this.$element = element; 3190 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, DropdownMenu.defaults, this.$element.data(), options); 3191 this.className = 'DropdownMenu'; // ie9 back compat 3192 3193 this._init(); 3194 3195 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('DropdownMenu', { 3196 'ENTER': 'open', 3197 'SPACE': 'open', 3198 'ARROW_RIGHT': 'next', 3199 'ARROW_UP': 'up', 3200 'ARROW_DOWN': 'down', 3201 'ARROW_LEFT': 'previous', 3202 'ESCAPE': 'close' 3203 }); 3204 } 3205 3206 /** 3207 * Initializes the plugin, and calls _prepareMenu 3208 * @private 3209 * @function 3210 */ 3211 3212 }, { 3213 key: '_init', 3214 value: function _init() { 3215 __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__["a" /* Nest */].Feather(this.$element, 'dropdown'); 3216 3217 var subs = this.$element.find('li.is-dropdown-submenu-parent'); 3218 this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub'); 3219 3220 this.$menuItems = this.$element.find('[role="menuitem"]'); 3221 this.$tabs = this.$element.children('[role="menuitem"]'); 3222 this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass); 3223 3224 if (this.options.alignment === 'auto') { 3225 if (this.$element.hasClass(this.options.rightClass) || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__foundation_util_core__["b" /* rtl */])() || this.$element.parents('.top-bar-right').is('*')) { 3226 this.options.alignment = 'right'; 3227 subs.addClass('opens-left'); 3228 } else { 3229 this.options.alignment = 'left'; 3230 subs.addClass('opens-right'); 3231 } 3232 } else { 3233 if (this.options.alignment === 'right') { 3234 subs.addClass('opens-left'); 3235 } else { 3236 subs.addClass('opens-right'); 3237 } 3238 } 3239 this.changed = false; 3240 this._events(); 3241 } 3242 }, { 3243 key: '_isVertical', 3244 value: function _isVertical() { 3245 return this.$tabs.css('display') === 'block' || this.$element.css('flex-direction') === 'column'; 3246 } 3247 }, { 3248 key: '_isRtl', 3249 value: function _isRtl() { 3250 return this.$element.hasClass('align-right') || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__foundation_util_core__["b" /* rtl */])() && !this.$element.hasClass('align-left'); 3251 } 3252 3253 /** 3254 * Adds event listeners to elements within the menu 3255 * @private 3256 * @function 3257 */ 3258 3259 }, { 3260 key: '_events', 3261 value: function _events() { 3262 var _this = this, 3263 hasTouch = 'ontouchstart' in window || typeof window.ontouchstart !== 'undefined', 3264 parClass = 'is-dropdown-submenu-parent'; 3265 3266 // used for onClick and in the keyboard handlers
3267 var handleClickFn = function (e) { 3268 var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target).parentsUntil('ul', '.' + parClass), 3269 hasSub = $elem.hasClass(parClass), 3270 hasClicked = $elem.attr('data-is-click') === 'true', 3271 $sub = $elem.children('.is-dropdown-submenu'); 3272 3273 if (hasSub) { 3274 if (hasClicked) { 3275 if (!_this.options.closeOnClick || !_this.options.clickOpen && !hasTouch || _this.options.forceFollow && hasTouch) { 3276 return; 3277 } else { 3278 e.stopImmediatePropagation(); 3279 e.preventDefault(); 3280 _this._hide($elem); 3281 } 3282 } else { 3283 e.preventDefault(); 3284 e.stopImmediatePropagation(); 3285 _this._show($sub); 3286 $elem.add($elem.parentsUntil(_this.$element, '.' + parClass)).attr('data-is-click', true); 3287 } 3288 } 3289 }; 3290 3291 if (this.options.clickOpen || hasTouch) { 3292 this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', handleClickFn); 3293 } 3294 3295 // Handle Leaf element Clicks 3296 if (_this.options.closeOnClickInside) { 3297 this.$menuItems.on('click.zf.dropdownmenu', function (e) { 3298 var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 3299 hasSub = $elem.hasClass(parClass); 3300 if (!hasSub) { 3301 _this._hide(); 3302 } 3303 }); 3304 } 3305 3306 if (!this.options.disableHover) { 3307 this.$menuItems.on('mouseenter.zf.dropdownmenu', function (e) { 3308 var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 3309 hasSub = $elem.hasClass(parClass); 3310 3311 if (hasSub) { 3312 clearTimeout($elem.data('_delay')); 3313 $elem.data('_delay', setTimeout(function () { 3314 _this._show($elem.children('.is-dropdown-submenu')); 3315 }, _this.options.hoverDelay)); 3316 } 3317 }).on('mouseleave.zf.dropdownmenu', function (e) { 3318 var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 3319 hasSub = $elem.hasClass(parClass); 3320 if (hasSub && _this.options.autoclose) { 3321 if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) { 3322 return false; 3323 } 3324 3325 clearTimeout($elem.data('_delay')); 3326 $elem.data('_delay', setTimeout(function () { 3327 _this._hide($elem); 3328 }, _this.options.closingTime)); 3329 } 3330 }); 3331 } 3332 this.$menuItems.on('keydown.zf.dropdownmenu', function (e) { 3333 var $element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target).parentsUntil('ul', '[role="menuitem"]'), 3334 isTab = _this.$tabs.index($element) > -1, 3335 $elements = isTab ? _this.$tabs : $element.siblings('li').add($element), 3336 $prevElement, 3337 $nextElement; 3338 3339 $elements.each(function (i) { 3340 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is($element)) { 3341 $prevElement = $elements.eq(i - 1); 3342 $nextElement = $elements.eq(i + 1); 3343 return; 3344 } 3345 }); 3346 3347 var nextSibling = function () { 3348 $nextElement.children('a:first').focus(); 3349 e.preventDefault(); 3350 }, 3351 prevSibling = function () { 3352 $prevElement.children('a:first').focus(); 3353 e.preventDefault(); 3354 }, 3355 openSub = function () { 3356 var $sub = $element.children('ul.is-dropdown-submenu'); 3357 if ($sub.length) { 3358 _this._show($sub); 3359 $element.find('li > a:first').focus(); 3360 e.preventDefault(); 3361 } else { 3362 return; 3363 } 3364 }, 3365 closeSub = function () { 3366 //if ($element.is(':first-child')) { 3367 var close = $element.parent('ul').parent('li'); 3368 close.children('a:first').focus(); 3369 _this._hide(close); 3370 e.preventDefault(); 3371 //} 3372 }; 3373 var functions = { 3374 open: openSub, 3375 close: function () { 3376 _this._hide(_this.$element); 3377 _this.$menuItems.eq(0).children('a').focus(); // focus to first element 3378 e.preventDefault(); 3379 }, 3380 handled: function () { 3381 e.stopImmediatePropagation(); 3382 } 3383 }; 3384 3385 if (isTab) { 3386 if (_this._isVertical()) { 3387 // vertical menu 3388 if (_this._isRtl()) { 3389 // right aligned 3390 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, { 3391 down: nextSibling, 3392 up: prevSibling, 3393 next: closeSub, 3394 previous: openSub 3395 }); 3396 } else { 3397 // left aligned 3398 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, { 3399 down: nextSibling, 3400 up: prevSibling, 3401 next: openSub, 3402 previous: closeSub 3403 }); 3404 } 3405 } else { 3406 // horizontal menu 3407 if (_this._isRtl()) { 3408 // right aligned 3409 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, { 3410 next: prevSibling, 3411 previous: nextSibling, 3412 down: openSub, 3413 up: closeSub 3414 }); 3415 } else { 3416 // left aligned 3417 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, { 3418 next: nextSibling, 3419 previous: prevSibling, 3420 down: openSub, 3421 up: closeSub 3422 }); 3423 } 3424 } 3425 } else { 3426 // not tabs -> one sub 3427 if (_this._isRtl()) { 3428 // right aligned 3429 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, { 3430 next: closeSub, 3431 previous: openSub, 3432 down: nextSibling, 3433 up: prevSibling 3434 }); 3435 } else { 3436 // left aligned 3437 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(functions, { 3438 next: openSub, 3439 previous: closeSub, 3440 down: nextSibling, 3441 up: prevSibling 3442 }); 3443 } 3444 } 3445 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'DropdownMenu', functions); 3446 }); 3447 } 3448 3449 /** 3450 * Adds an event handler to the body to close any dropdowns on a click. 3451 * @function 3452 * @private 3453 */ 3454 3455 }, { 3456 key: '_addBodyHandler', 3457 value: function _addBodyHandler() { 3458 var $body = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document.body), 3459 _this = this; 3460 $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu').on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function (e) { 3461 var $link = _this.$element.find(e.target); 3462 if ($link.length) { 3463 return; 3464 } 3465 3466 _this._hide(); 3467 $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu'); 3468 }); 3469 } 3470 3471 /**
3472 * Opens a dropdown pane, and checks for collisions first. 3473 * @param {jQuery} $sub - ul element that is a submenu to show 3474 * @function 3475 * @private 3476 * @fires DropdownMenu#show 3477 */ 3478 3479 }, { 3480 key: '_show', 3481 value: function _show($sub) { 3482 var idx = this.$tabs.index(this.$tabs.filter(function (i, el) { 3483 return __WEBPACK_IMPORTED_MODULE_0_jquery___default()(el).find($sub).length > 0; 3484 })); 3485 var $sibs = $sub.parent('li.is-dropdown-submenu-parent').siblings('li.is-dropdown-submenu-parent'); 3486 this._hide($sibs, idx); 3487 $sub.css('visibility', 'hidden').addClass('js-dropdown-active').parent('li.is-dropdown-submenu-parent').addClass('is-active'); 3488 var clear = __WEBPACK_IMPORTED_MODULE_3__foundation_util_box__["a" /* Box */].ImNotTouchingYou($sub, null, true); 3489 if (!clear) { 3490 var oldClass = this.options.alignment === 'left' ? '-right' : '-left', 3491 $parentLi = $sub.parent('.is-dropdown-submenu-parent'); 3492 $parentLi.removeClass('opens' + oldClass).addClass('opens-' + this.options.alignment); 3493 clear = __WEBPACK_IMPORTED_MODULE_3__foundation_util_box__["a" /* Box */].ImNotTouchingYou($sub, null, true); 3494 if (!clear) { 3495 $parentLi.removeClass('opens-' + this.options.alignment).addClass('opens-inner'); 3496 } 3497 this.changed = true; 3498 } 3499 $sub.css('visibility', ''); 3500 if (this.options.closeOnClick) { 3501 this._addBodyHandler(); 3502 } 3503 /** 3504 * Fires when the new dropdown pane is visible. 3505 * @event DropdownMenu#show 3506 */ 3507 this.$element.trigger('show.zf.dropdownmenu', [$sub]); 3508 } 3509 3510 /** 3511 * Hides a single, currently open dropdown pane, if passed a parameter, otherwise, hides everything. 3512 * @function 3513 * @param {jQuery} $elem - element with a submenu to hide 3514 * @param {Number} idx - index of the $tabs collection to hide 3515 * @private 3516 */ 3517 3518 }, { 3519 key: '_hide', 3520 value: function _hide($elem, idx) { 3521 var $toClose; 3522 if ($elem && $elem.length) { 3523 $toClose = $elem; 3524 } else if (idx !== undefined) { 3525 $toClose = this.$tabs.not(function (i, el) { 3526 return i === idx; 3527 }); 3528 } else { 3529 $toClose = this.$element; 3530 } 3531 var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0; 3532 3533 if (somethingToClose) { 3534 $toClose.find('li.is-active').add($toClose).attr({ 3535 'data-is-click': false 3536 }).removeClass('is-active'); 3537 3538 $toClose.find('ul.js-dropdown-active').removeClass('js-dropdown-active'); 3539 3540 if (this.changed || $toClose.find('opens-inner').length) { 3541 var oldClass = this.options.alignment === 'left' ? 'right' : 'left'; 3542 $toClose.find('li.is-dropdown-submenu-parent').add($toClose).removeClass('opens-inner opens-' + this.options.alignment).addClass('opens-' + oldClass); 3543 this.changed = false; 3544 } 3545 /** 3546 * Fires when the open menus are closed. 3547 * @event DropdownMenu#hide 3548 */ 3549 this.$element.trigger('hide.zf.dropdownmenu', [$toClose]); 3550 } 3551 } 3552 3553 /** 3554 * Destroys the plugin. 3555 * @function 3556 */ 3557 3558 }, { 3559 key: '_destroy', 3560 value: function _destroy() { 3561 this.$menuItems.off('.zf.dropdownmenu').removeAttr('data-is-click').removeClass('is-right-arrow is-left-arrow is-down-arrow opens-right opens-left opens-inner'); 3562 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document.body).off('.zf.dropdownmenu'); 3563 __WEBPACK_IMPORTED_MODULE_2__foundation_util_nest__["a" /* Nest */].Burn(this.$element, 'dropdown'); 3564 } 3565 }]); 3566 3567 return DropdownMenu; 3568}(__WEBPACK_IMPORTED_MODULE_5__foundation_plugin__["a" /* Plugin */]); 3569 3570/** 3571 * Default settings for plugin 3572 */ 3573 3574 3575DropdownMenu.defaults = { 3576 /** 3577 * Disallows hover events from opening submenus 3578 * @option 3579 * @type {boolean} 3580 * @default false 3581 */ 3582 disableHover: false, 3583 /** 3584 * Allow a submenu to automatically close on a mouseleave event, if not clicked open. 3585 * @option 3586 * @type {boolean} 3587 * @default true 3588 */ 3589 autoclose: true, 3590 /** 3591 * Amount of time to delay opening a submenu on hover event. 3592 * @option 3593 * @type {number} 3594 * @default 50 3595 */ 3596 hoverDelay: 50, 3597 /** 3598 * Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu. 3599 * @option 3600 * @type {boolean} 3601 * @default false 3602 */ 3603 clickOpen: false, 3604 /** 3605 * Amount of time to delay closing a submenu on a mouseleave event. 3606 * @option 3607 * @type {number} 3608 * @default 500 3609 */ 3610 3611 closingTime: 500, 3612 /** 3613 * Position of the menu relative to what direction the submenus should open. Handled by JS. Can be `'auto'`, `'left'` or `'right'`. 3614 * @option 3615 * @type {string} 3616 * @default 'auto' 3617 */ 3618 alignment: 'auto', 3619 /** 3620 * Allow clicks on the body to close any open submenus. 3621 * @option 3622 * @type {boolean} 3623 * @default true 3624 */ 3625 closeOnClick: true, 3626 /** 3627 * Allow clicks on leaf anchor links to close any open submenus. 3628 * @option 3629 * @type {boolean} 3630 * @default true 3631 */ 3632 closeOnClickInside: true, 3633 /** 3634 * Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class. 3635 * @option 3636 * @type {string} 3637 * @default 'vertical' 3638 */ 3639 verticalClass: 'vertical', 3640 /** 3641 * Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class. 3642 * @option 3643 * @type {string} 3644 * @default 'align-right' 3645 */
3646 rightClass: 'align-right', 3647 /** 3648 * Boolean to force overide the clicking of links to perform default action, on second touch event for mobile. 3649 * @option 3650 * @type {boolean} 3651 * @default true 3652 */ 3653 forceFollow: true 3654}; 3655 3656 3657 3658/***/ }), 3659/* 14 */ 3660/***/ (function(module, __webpack_exports__, __webpack_require__) { 3661 3662"use strict"; 3663/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Tabs; }); 3664/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 3665/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 3666/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 3667/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_imageLoader__ = __webpack_require__(8); 3668/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_plugin__ = __webpack_require__(2); 3669 3670 3671var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3672 3673function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3674 3675function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 3676 3677function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 3678 3679 3680 3681 3682 3683/** 3684 * Tabs module. 3685 * @module foundation.tabs 3686 * @requires foundation.util.keyboard 3687 * @requires foundation.util.imageLoader if tabs contain images 3688 */ 3689 3690var Tabs = function (_Plugin) { 3691 _inherits(Tabs, _Plugin); 3692 3693 function Tabs() { 3694 _classCallCheck(this, Tabs); 3695 3696 return _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).apply(this, arguments)); 3697 } 3698 3699 _createClass(Tabs, [{ 3700 key: '_setup', 3701 3702 /** 3703 * Creates a new instance of tabs. 3704 * @class 3705 * @name Tabs 3706 * @fires Tabs#init 3707 * @param {jQuery} element - jQuery object to make into tabs. 3708 * @param {Object} options - Overrides to the default plugin settings. 3709 */ 3710 value: function _setup(element, options) { 3711 this.$element = element; 3712 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Tabs.defaults, this.$element.data(), options); 3713 this.className = 'Tabs'; // ie9 back compat 3714 3715 this._init(); 3716 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('Tabs', { 3717 'ENTER': 'open', 3718 'SPACE': 'open', 3719 'ARROW_RIGHT': 'next', 3720 'ARROW_UP': 'previous', 3721 'ARROW_DOWN': 'next', 3722 'ARROW_LEFT': 'previous' 3723 // 'TAB': 'next', 3724 // 'SHIFT_TAB': 'previous' 3725 }); 3726 } 3727 3728 /** 3729 * Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab. 3730 * @private 3731 */ 3732 3733 }, { 3734 key: '_init', 3735 value: function _init() { 3736 var _this3 = this; 3737 3738 var _this = this; 3739 3740 this.$element.attr({ 'role': 'tablist' }); 3741 this.$tabTitles = this.$element.find('.' + this.options.linkClass); 3742 this.$tabContent = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-tabs-content="' + this.$element[0].id + '"]'); 3743 3744 this.$tabTitles.each(function () { 3745 var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 3746 $link = $elem.find('a'), 3747 isActive = $elem.hasClass('' + _this.options.linkActiveClass), 3748 hash = $link.attr('data-tabs-target') || $link[0].hash.slice(1), 3749 linkId = $link[0].id ? $link[0].id : hash + '-label', 3750 $tabContent = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + hash); 3751 3752 $elem.attr({ 'role': 'presentation' }); 3753 3754 $link.attr({ 3755 'role': 'tab', 3756 'aria-controls': hash, 3757 'aria-selected': isActive, 3758 'id': linkId, 3759 'tabindex': isActive ? '0' : '-1' 3760 }); 3761 3762 $tabContent.attr({ 3763 'role': 'tabpanel', 3764 'aria-labelledby': linkId 3765 }); 3766 3767 if (!isActive) { 3768 $tabContent.attr('aria-hidden', 'true'); 3769 } 3770 3771 if (isActive && _this.options.autoFocus) { 3772 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).load(function () { 3773 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html, body').animate({ scrollTop: $elem.offset().top }, _this.options.deepLinkSmudgeDelay, function () { 3774 $link.focus(); 3775 }); 3776 }); 3777 } 3778 }); 3779 if (this.options.matchHeight) { 3780 var $images = this.$tabContent.find('img'); 3781 3782 if ($images.length) { 3783 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_imageLoader__["a" /* onImagesLoaded */])($images, this._setHeight.bind(this)); 3784 } else { 3785 this._setHeight(); 3786 } 3787 } 3788 3789 //current context-bound function to open tabs on page load or history popstate 3790 this._checkDeepLink = function () { 3791 var anchor = window.location.hash; 3792 //need a hash and a relevant anchor in this tabset 3793 if (anchor.length) { 3794 var $link = _this3.$element.find('[href$="' + anchor + '"]'); 3795 if ($link.length) { 3796 _this3.selectTab(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(anchor), true); 3797 3798 //roll up a little to show the titles 3799 if (_this3.options.deepLinkSmudge) { 3800 var offset = _this3.$element.offset(); 3801 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html, body').animate({ scrollTop: offset.top }, _this3.options.deepLinkSmudgeDelay); 3802 } 3803 3804 /** 3805 * Fires when the zplugin has deeplinked at pageload 3806 * @event Tabs#deeplink 3807 */ 3808 _this3.$element.trigger('deeplink.zf.tabs', [$link, __WEBPACK_IMPORTED_MODULE_0_jquery___default()(anchor)]); 3809 } 3810 } 3811 }; 3812 3813 //use browser to open a tab, if it exists in this tabset 3814 if (this.options.deepLink) { 3815 this._checkDeepLink(); 3816 } 3817 3818 this._events(); 3819 } 3820 3821 /** 3822 * Adds event handlers for items within the tabs. 3823 * @private 3824 */ 3825 3826 }, { 3827 key: '_events', 3828 value: function _events() { 3829 this._addKeyHandler(); 3830 this._addClickHandler(); 3831 this._setHeightMqHandler = null; 3832 3833 if (this.options.matchHeight) { 3834 this._setHeightMqHandler = this._setHeight.bind(this); 3835 3836 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('changed.zf.mediaquery', this._setHeightMqHandler); 3837 } 3838 3839 if (this.options.deepLink) { 3840 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('popstate', this._checkDeepLink); 3841 } 3842 } 3843 3844 /** 3845 * Adds click handlers for items within the tabs. 3846 * @private 3847 */ 3848 3849 }, { 3850 key: '_addClickHandler', 3851 value: function _addClickHandler() { 3852 var _this = this; 3853 3854 this.$element.off('click.zf.tabs').on('click.zf.tabs', '.' + this.options.linkClass, function (e) { 3855 e.preventDefault(); 3856 e.stopPropagation(); 3857 _this._handleTabChange(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)); 3858 }); 3859 } 3860 3861 /** 3862 * Adds keyboard event handlers for items within the tabs. 3863 * @private 3864 */ 3865 3866 }, { 3867 key: '_addKeyHandler', 3868 value: function _addKeyHandler() { 3869 var _this = this; 3870 3871 this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function (e) { 3872 if (e.which === 9) return; 3873 3874 var $element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 3875 $elements = $element.parent('ul').children('li'), 3876 $prevElement, 3877 $nextElement; 3878 3879 $elements.each(function (i) { 3880 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is($element)) { 3881 if (_this.options.wrapOnKeys) {
3882 $prevElement = i === 0 ? $elements.last() : $elements.eq(i - 1); 3883 $nextElement = i === $elements.length - 1 ? $elements.first() : $elements.eq(i + 1); 3884 } else { 3885 $prevElement = $elements.eq(Math.max(0, i - 1)); 3886 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 3887 } 3888 return; 3889 } 3890 }); 3891 3892 // handle keyboard event with keyboard util 3893 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'Tabs', { 3894 open: function () { 3895 $element.find('[role="tab"]').focus(); 3896 _this._handleTabChange($element); 3897 }, 3898 previous: function () { 3899 $prevElement.find('[role="tab"]').focus(); 3900 _this._handleTabChange($prevElement); 3901 }, 3902 next: function () { 3903 $nextElement.find('[role="tab"]').focus(); 3904 _this._handleTabChange($nextElement); 3905 }, 3906 handled: function () { 3907 e.stopPropagation(); 3908 e.preventDefault(); 3909 } 3910 }); 3911 }); 3912 } 3913 3914 /** 3915 * Opens the tab `$targetContent` defined by `$target`. Collapses active tab. 3916 * @param {jQuery} $target - Tab to open. 3917 * @param {boolean} historyHandled - browser has already handled a history update 3918 * @fires Tabs#change 3919 * @function 3920 */ 3921 3922 }, { 3923 key: '_handleTabChange', 3924 value: function _handleTabChange($target, historyHandled) { 3925 3926 /** 3927 * Check for active class on target. Collapse if exists. 3928 */ 3929 if ($target.hasClass('' + this.options.linkActiveClass)) { 3930 if (this.options.activeCollapse) { 3931 this._collapseTab($target); 3932 3933 /** 3934 * Fires when the zplugin has successfully collapsed tabs. 3935 * @event Tabs#collapse 3936 */ 3937 this.$element.trigger('collapse.zf.tabs', [$target]); 3938 } 3939 return; 3940 } 3941 3942 var $oldTab = this.$element.find('.' + this.options.linkClass + '.' + this.options.linkActiveClass), 3943 $tabLink = $target.find('[role="tab"]'), 3944 hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1), 3945 $targetContent = this.$tabContent.find('#' + hash); 3946 3947 //close old tab 3948 this._collapseTab($oldTab); 3949 3950 //open new tab 3951 this._openTab($target); 3952 3953 //either replace or update browser history 3954 if (this.options.deepLink && !historyHandled) { 3955 var anchor = $target.find('a').attr('href'); 3956 3957 if (this.options.updateHistory) { 3958 history.pushState({}, '', anchor); 3959 } else { 3960 history.replaceState({}, '', anchor); 3961 } 3962 } 3963 3964 /** 3965 * Fires when the plugin has successfully changed tabs. 3966 * @event Tabs#change 3967 */ 3968 this.$element.trigger('change.zf.tabs', [$target, $targetContent]); 3969 3970 //fire to children a mutation event 3971 $targetContent.find("[data-mutate]").trigger("mutateme.zf.trigger"); 3972 } 3973 3974 /** 3975 * Opens the tab `$targetContent` defined by `$target`. 3976 * @param {jQuery} $target - Tab to Open. 3977 * @function 3978 */ 3979 3980 }, { 3981 key: '_openTab', 3982 value: function _openTab($target) { 3983 var $tabLink = $target.find('[role="tab"]'), 3984 hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1), 3985 $targetContent = this.$tabContent.find('#' + hash); 3986 3987 $target.addClass('' + this.options.linkActiveClass); 3988 3989 $tabLink.attr({ 3990 'aria-selected': 'true', 3991 'tabindex': '0' 3992 }); 3993 3994 $targetContent.addClass('' + this.options.panelActiveClass).removeAttr('aria-hidden'); 3995 } 3996 3997 /** 3998 * Collapses `$targetContent` defined by `$target`. 3999 * @param {jQuery} $target - Tab to Open. 4000 * @function 4001 */ 4002 4003 }, { 4004 key: '_collapseTab', 4005 value: function _collapseTab($target) { 4006 var $target_anchor = $target.removeClass('' + this.options.linkActiveClass).find('[role="tab"]').attr({ 4007 'aria-selected': 'false', 4008 'tabindex': -1 4009 }); 4010 4011 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + $target_anchor.attr('aria-controls')).removeClass('' + this.options.panelActiveClass).attr({ 'aria-hidden': 'true' }); 4012 } 4013 4014 /** 4015 * Public method for selecting a content pane to display. 4016 * @param {jQuery | String} elem - jQuery object or string of the id of the pane to display. 4017 * @param {boolean} historyHandled - browser has already handled a history update 4018 * @function 4019 */ 4020 4021 }, { 4022 key: 'selectTab', 4023 value: function selectTab(elem, historyHandled) { 4024 var idStr; 4025 4026 if (typeof elem === 'object') { 4027 idStr = elem[0].id; 4028 } else { 4029 idStr = elem; 4030 } 4031 4032 if (idStr.indexOf('#') < 0) { 4033 idStr = '#' + idStr; 4034 } 4035 4036 var $target = this.$tabTitles.find('[href$="' + idStr + '"]').parent('.' + this.options.linkClass); 4037 4038 this._handleTabChange($target, historyHandled); 4039 } 4040 }, { 4041 key: '_setHeight', 4042 4043 /** 4044 * Sets the height of each panel to the height of the tallest panel. 4045 * If enabled in options, gets called on media query change. 4046 * If loading content via external source, can be called directly or with _reflow. 4047 * If enabled with `data-match-height="true"`, tabs sets to equal height 4048 * @function 4049 * @private 4050 */ 4051 value: function _setHeight() { 4052 var max = 0, 4053 _this = this; // Lock down the `this` value for the root tabs object 4054 4055 this.$tabContent.find('.' + this.options.panelClass).css('height', '').each(function () { 4056 4057 var panel = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 4058 isActive = panel.hasClass('' + _this.options.panelActiveClass); // get the options from the parent instead of trying to get them from the child 4059 4060 if (!isActive) { 4061 panel.css({ 'visibility': 'hidden', 'display': 'block' }); 4062 } 4063 4064 var temp = this.getBoundingClientRect().height; 4065 4066 if (!isActive) { 4067 panel.css({ 4068 'visibility': '', 4069 'display': '' 4070 }); 4071 } 4072 4073 max = temp > max ? temp : max; 4074 }).css('height', max + 'px'); 4075 } 4076 4077 /** 4078 * Destroys an instance of an tabs. 4079 * @fires Tabs#destroyed 4080 */ 4081 4082 }, { 4083 key: '_destroy', 4084 value: function _destroy() { 4085 this.$element.find('.' + this.options.linkClass).off('.zf.tabs').hide().end().find('.' + this.options.panelClass).hide(); 4086 4087 if (this.options.matchHeight) { 4088 if (this._setHeightMqHandler != null) { 4089 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('changed.zf.mediaquery', this._setHeightMqHandler); 4090 } 4091 } 4092 4093 if (this.options.deepLink) { 4094 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('popstate', this._checkDeepLink); 4095 } 4096 } 4097 }]); 4098 4099 return Tabs; 4100}(__WEBPACK_IMPORTED_MODULE_3__foundation_plugin__["a" /* Plugin */]); 4101 4102Tabs.defaults = { 4103 /** 4104 * Allows the window to scroll to content of pane specified by hash anchor 4105 * @option 4106 * @type {boolean} 4107 * @default false 4108 */ 4109 deepLink: false, 4110 4111 /** 4112 * Adjust the deep link scroll to make sure the top of the tab panel is visible 4113 * @option 4114 * @type {boolean} 4115 * @default false 4116 */ 4117 deepLinkSmudge: false, 4118 4119 /** 4120 * Animation time (ms) for the deep link adjustment 4121 * @option 4122 * @type {number} 4123 * @default 300 4124 */ 4125 deepLinkSmudgeDelay: 300, 4126 4127 /** 4128 * Update the browser history with the open tab 4129 * @option 4130 * @type {boolean} 4131 * @default false 4132 */ 4133 updateHistory: false, 4134 4135 /** 4136 * Allows the window to scroll to content of active pane on load if set to true. 4137 * Not recommended if more than one tab panel per page. 4138 * @option 4139 * @type {boolean} 4140 * @default false 4141 */ 4142 autoFocus: false, 4143 4144 /** 4145 * Allows keyboard input to 'wrap' around the tab links. 4146 * @option 4147 * @type {boolean} 4148 * @default true 4149 */ 4150 wrapOnKeys: true, 4151 4152 /**
4153 * Allows the tab content panes to match heights if set to true. 4154 * @option 4155 * @type {boolean} 4156 * @default false 4157 */ 4158 matchHeight: false, 4159 4160 /** 4161 * Allows active tabs to collapse when clicked. 4162 * @option 4163 * @type {boolean} 4164 * @default false 4165 */ 4166 activeCollapse: false, 4167 4168 /** 4169 * Class applied to `li`'s in tab link list. 4170 * @option 4171 * @type {string} 4172 * @default 'tabs-title' 4173 */ 4174 linkClass: 'tabs-title', 4175 4176 /** 4177 * Class applied to the active `li` in tab link list. 4178 * @option 4179 * @type {string} 4180 * @default 'is-active' 4181 */ 4182 linkActiveClass: 'is-active', 4183 4184 /** 4185 * Class applied to the content containers. 4186 * @option 4187 * @type {string} 4188 * @default 'tabs-panel' 4189 */ 4190 panelClass: 'tabs-panel', 4191 4192 /** 4193 * Class applied to the active content container. 4194 * @option 4195 * @type {string} 4196 * @default 'is-active' 4197 */ 4198 panelActiveClass: 'is-active' 4199}; 4200 4201 4202 4203/***/ }), 4204/* 15 */ 4205/***/ (function(module, __webpack_exports__, __webpack_require__) { 4206 4207"use strict"; 4208/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Positionable; }); 4209/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation_util_box__ = __webpack_require__(7); 4210/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_plugin__ = __webpack_require__(2); 4211/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_core__ = __webpack_require__(1); 4212 4213 4214var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4215 4216function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4217 4218function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 4219 4220function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 4221 4222 4223 4224 4225 4226var POSITIONS = ['left', 'right', 'top', 'bottom']; 4227var VERTICAL_ALIGNMENTS = ['top', 'bottom', 'center']; 4228var HORIZONTAL_ALIGNMENTS = ['left', 'right', 'center']; 4229 4230var ALIGNMENTS = { 4231 'left': VERTICAL_ALIGNMENTS, 4232 'right': VERTICAL_ALIGNMENTS, 4233 'top': HORIZONTAL_ALIGNMENTS, 4234 'bottom': HORIZONTAL_ALIGNMENTS 4235}; 4236 4237function nextItem(item, array) { 4238 var currentIdx = array.indexOf(item); 4239 if (currentIdx === array.length - 1) { 4240 return array[0]; 4241 } else { 4242 return array[currentIdx + 1]; 4243 } 4244} 4245 4246var Positionable = function (_Plugin) { 4247 _inherits(Positionable, _Plugin); 4248 4249 function Positionable() { 4250 _classCallCheck(this, Positionable); 4251 4252 return _possibleConstructorReturn(this, (Positionable.__proto__ || Object.getPrototypeOf(Positionable)).apply(this, arguments)); 4253 } 4254 4255 _createClass(Positionable, [{ 4256 key: '_init', 4257 4258 /** 4259 * Abstract class encapsulating the tether-like explicit positioning logic 4260 * including repositioning based on overlap. 4261 * Expects classes to define defaults for vOffset, hOffset, position, 4262 * alignment, allowOverlap, and allowBottomOverlap. They can do this by 4263 * extending the defaults, or (for now recommended due to the way docs are 4264 * generated) by explicitly declaring them. 4265 * 4266 **/ 4267 4268 value: function _init() { 4269 this.triedPositions = {}; 4270 this.position = this.options.position === 'auto' ? this._getDefaultPosition() : this.options.position; 4271 this.alignment = this.options.alignment === 'auto' ? this._getDefaultAlignment() : this.options.alignment; 4272 } 4273 }, { 4274 key: '_getDefaultPosition', 4275 value: function _getDefaultPosition() { 4276 return 'bottom'; 4277 } 4278 }, { 4279 key: '_getDefaultAlignment', 4280 value: function _getDefaultAlignment() { 4281 switch (this.position) { 4282 case 'bottom': 4283 case 'top': 4284 return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_core__["b" /* rtl */])() ? 'right' : 'left'; 4285 case 'left': 4286 case 'right': 4287 return 'bottom'; 4288 } 4289 } 4290 4291 /** 4292 * Adjusts the positionable possible positions by iterating through alignments 4293 * and positions. 4294 * @function 4295 * @private 4296 */ 4297 4298 }, { 4299 key: '_reposition', 4300 value: function _reposition() { 4301 if (this._alignmentsExhausted(this.position)) { 4302 this.position = nextItem(this.position, POSITIONS); 4303 this.alignment = ALIGNMENTS[this.position][0]; 4304 } else { 4305 this._realign(); 4306 } 4307 } 4308 4309 /** 4310 * Adjusts the dropdown pane possible positions by iterating through alignments 4311 * on the current position. 4312 * @function 4313 * @private 4314 */ 4315 4316 }, { 4317 key: '_realign', 4318 value: function _realign() { 4319 this._addTriedPosition(this.position, this.alignment); 4320 this.alignment = nextItem(this.alignment, ALIGNMENTS[this.position]); 4321 } 4322 }, { 4323 key: '_addTriedPosition', 4324 value: function _addTriedPosition(position, alignment) { 4325 this.triedPositions[position] = this.triedPositions[position] || []; 4326 this.triedPositions[position].push(alignment); 4327 } 4328 }, { 4329 key: '_positionsExhausted', 4330 value: function _positionsExhausted() { 4331 var isExhausted = true; 4332 for (var i = 0; i < POSITIONS.length; i++) { 4333 isExhausted = isExhausted && this._alignmentsExhausted(POSITIONS[i]); 4334 } 4335 return isExhausted; 4336 } 4337 }, { 4338 key: '_alignmentsExhausted', 4339 value: function _alignmentsExhausted(position) { 4340 return this.triedPositions[position] && this.triedPositions[position].length == ALIGNMENTS[position].length; 4341 } 4342 4343 // When we're trying to center, we don't want to apply offset that's going to 4344 // take us just off center, so wrap around to return 0 for the appropriate 4345 // offset in those alignments. TODO: Figure out if we want to make this 4346 // configurable behavior... it feels more intuitive, especially for tooltips, but 4347 // it's possible someone might actually want to start from center and then nudge 4348 // slightly off. 4349 4350 }, { 4351 key: '_getVOffset', 4352 value: function _getVOffset() { 4353 return this.options.vOffset; 4354 } 4355 }, { 4356 key: '_getHOffset', 4357 value: function _getHOffset() { 4358 return this.options.hOffset; 4359 } 4360 }, { 4361 key: '_setPosition', 4362 value: function _setPosition($anchor, $element, $parent) { 4363 if ($anchor.attr('aria-expanded') === 'false') { 4364 return false;
4365 } 4366 var $eleDims = __WEBPACK_IMPORTED_MODULE_0__foundation_util_box__["a" /* Box */].GetDimensions($element), 4367 $anchorDims = __WEBPACK_IMPORTED_MODULE_0__foundation_util_box__["a" /* Box */].GetDimensions($anchor); 4368 4369 $element.offset(__WEBPACK_IMPORTED_MODULE_0__foundation_util_box__["a" /* Box */].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset())); 4370 4371 if (!this.options.allowOverlap) { 4372 var overlaps = {}; 4373 var minOverlap = 100000000; 4374 // default coordinates to how we start, in case we can't figure out better 4375 var minCoordinates = { position: this.position, alignment: this.alignment }; 4376 while (!this._positionsExhausted()) { 4377 var overlap = __WEBPACK_IMPORTED_MODULE_0__foundation_util_box__["a" /* Box */].OverlapArea($element, $parent, false, false, this.options.allowBottomOverlap); 4378 if (overlap === 0) { 4379 return; 4380 } 4381 4382 if (overlap < minOverlap) { 4383 minOverlap = overlap; 4384 minCoordinates = { position: this.position, alignment: this.alignment }; 4385 } 4386 4387 this._reposition(); 4388 4389 $element.offset(__WEBPACK_IMPORTED_MODULE_0__foundation_util_box__["a" /* Box */].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset())); 4390 } 4391 // If we get through the entire loop, there was no non-overlapping 4392 // position available. Pick the version with least overlap. 4393 this.position = minCoordinates.position; 4394 this.alignment = minCoordinates.alignment; 4395 $element.offset(__WEBPACK_IMPORTED_MODULE_0__foundation_util_box__["a" /* Box */].GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset())); 4396 } 4397 } 4398 }]); 4399 4400 return Positionable; 4401}(__WEBPACK_IMPORTED_MODULE_1__foundation_plugin__["a" /* Plugin */]); 4402 4403Positionable.defaults = { 4404 /** 4405 * Position of positionable relative to anchor. Can be left, right, bottom, top, or auto. 4406 * @option 4407 * @type {string} 4408 * @default 'auto' 4409 */ 4410 position: 'auto', 4411 /** 4412 * Alignment of positionable relative to anchor. Can be left, right, bottom, top, center, or auto. 4413 * @option 4414 * @type {string} 4415 * @default 'auto' 4416 */ 4417 alignment: 'auto', 4418 /** 4419 * Allow overlap of container/window. If false, dropdown positionable first 4420 * try to position as defined by data-position and data-alignment, but 4421 * reposition if it would cause an overflow. 4422 * @option 4423 * @type {boolean} 4424 * @default false 4425 */ 4426 allowOverlap: false, 4427 /** 4428 * Allow overlap of only the bottom of the container. This is the most common 4429 * behavior for dropdowns, allowing the dropdown to extend the bottom of the 4430 * screen but not otherwise influence or break out of the container. 4431 * @option 4432 * @type {boolean} 4433 * @default true 4434 */ 4435 allowBottomOverlap: true, 4436 /** 4437 * Number of pixels the positionable should be separated vertically from anchor 4438 * @option 4439 * @type {number} 4440 * @default 0 4441 */ 4442 vOffset: 0, 4443 /** 4444 * Number of pixels the positionable should be separated horizontally from anchor 4445 * @option 4446 * @type {number} 4447 * @default 0 4448 */ 4449 hOffset: 0 4450}; 4451 4452 4453 4454/***/ }), 4455/* 16 */ 4456/***/ (function(module, __webpack_exports__, __webpack_require__) { 4457 4458"use strict"; 4459/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Touch; }); 4460/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 4461/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 4462var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4463 4464function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4465 4466//************************************************** 4467//**Work inspired by multiple jquery swipe plugins** 4468//**Done by Yohai Ararat *************************** 4469//************************************************** 4470 4471 4472 4473var Touch = {}; 4474 4475var startPosX, 4476 startPosY, 4477 startTime, 4478 elapsedTime, 4479 isMoving = false;
4480 4481function onTouchEnd() { 4482 // alert(this); 4483 this.removeEventListener('touchmove', onTouchMove); 4484 this.removeEventListener('touchend', onTouchEnd); 4485 isMoving = false; 4486} 4487 4488function onTouchMove(e) { 4489 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.spotSwipe.preventDefault) { 4490 e.preventDefault(); 4491 } 4492 if (isMoving) { 4493 var x = e.touches[0].pageX; 4494 var y = e.touches[0].pageY; 4495 var dx = startPosX - x; 4496 var dy = startPosY - y; 4497 var dir; 4498 elapsedTime = new Date().getTime() - startTime; 4499 if (Math.abs(dx) >= __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.spotSwipe.moveThreshold && elapsedTime <= __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.spotSwipe.timeThreshold) { 4500 dir = dx > 0 ? 'left' : 'right'; 4501 } 4502 // else if(Math.abs(dy) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) { 4503 // dir = dy > 0 ? 'down' : 'up'; 4504 // } 4505 if (dir) { 4506 e.preventDefault(); 4507 onTouchEnd.call(this); 4508 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).trigger('swipe', dir).trigger('swipe' + dir); 4509 } 4510 } 4511} 4512 4513function onTouchStart(e) { 4514 if (e.touches.length == 1) { 4515 startPosX = e.touches[0].pageX; 4516 startPosY = e.touches[0].pageY; 4517 isMoving = true; 4518 startTime = new Date().getTime(); 4519 this.addEventListener('touchmove', onTouchMove, false); 4520 this.addEventListener('touchend', onTouchEnd, false); 4521 } 4522} 4523 4524function init() { 4525 this.addEventListener && this.addEventListener('touchstart', onTouchStart, false); 4526} 4527 4528function teardown() { 4529 this.removeEventListener('touchstart', onTouchStart); 4530} 4531 4532var SpotSwipe = function () { 4533 function SpotSwipe($) { 4534 _classCallCheck(this, SpotSwipe); 4535 4536 this.version = '1.0.0'; 4537 this.enabled = 'ontouchstart' in document.documentElement; 4538 this.preventDefault = false;
4539 this.moveThreshold = 75; 4540 this.timeThreshold = 200; 4541 this.$ = $; 4542 this._init(); 4543 } 4544 4545 _createClass(SpotSwipe, [{ 4546 key: '_init', 4547 value: function _init() { 4548 var $ = this.$; 4549 $.event.special.swipe = { setup: init }; 4550 4551 $.each(['left', 'up', 'down', 'right'], function () { 4552 $.event.special['swipe' + this] = { setup: function () { 4553 $(this).on('swipe', $.noop); 4554 } }; 4555 }); 4556 } 4557 }]); 4558 4559 return SpotSwipe; 4560}(); 4561 4562/**************************************************** 4563 * As far as I can tell, both setupSpotSwipe and * 4564 * setupTouchHandler should be idempotent, * 4565 * because they directly replace functions & * 4566 * values, and do not add event handlers directly. * 4567 ****************************************************/ 4568 4569Touch.setupSpotSwipe = function ($) { 4570 $.spotSwipe = new SpotSwipe($); 4571}; 4572 4573/**************************************************** 4574 * Method for adding pseudo drag events to elements * 4575 ***************************************************/ 4576Touch.setupTouchHandler = function ($) { 4577 $.fn.addTouch = function () { 4578 this.each(function (i, el) { 4579 $(el).bind('touchstart touchmove touchend touchcancel', function () { 4580 //we pass the original event object because the jQuery event 4581 //object is normalized to w3c specs and does not provide the TouchList 4582 handleTouch(event); 4583 }); 4584 }); 4585 4586 var handleTouch = function (event) { 4587 var touches = event.changedTouches, 4588 first = touches[0], 4589 eventTypes = { 4590 touchstart: 'mousedown', 4591 touchmove: 'mousemove', 4592 touchend: 'mouseup' 4593 }, 4594 type = eventTypes[event.type], 4595 simulatedEvent; 4596 4597 if ('MouseEvent' in window && typeof window.MouseEvent === 'function') { 4598 simulatedEvent = new window.MouseEvent(type, { 4599 'bubbles': true, 4600 'cancelable': true, 4601 'screenX': first.screenX, 4602 'screenY': first.screenY, 4603 'clientX': first.clientX, 4604 'clientY': first.clientY 4605 }); 4606 } else { 4607 simulatedEvent = document.createEvent('MouseEvent'); 4608 simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0 /*left*/, null); 4609 } 4610 first.target.dispatchEvent(simulatedEvent); 4611 }; 4612 }; 4613}; 4614 4615Touch.init = function ($) { 4616 if (typeof $.spotSwipe === 'undefined') { 4617 Touch.setupSpotSwipe($); 4618 Touch.setupTouchHandler($); 4619 } 4620}; 4621 4622 4623 4624/***/ }), 4625/* 17 */ 4626/***/ (function(module, __webpack_exports__, __webpack_require__) { 4627 4628"use strict"; 4629/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Abide; }); 4630/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 4631/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 4632/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_plugin__ = __webpack_require__(2); 4633 4634 4635var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4636 4637function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4638 4639function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 4640 4641function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
4641onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 4642 4643 4644 4645 4646/** 4647 * Abide module. 4648 * @module foundation.abide 4649 */ 4650 4651var Abide = function (_Plugin) { 4652 _inherits(Abide, _Plugin); 4653 4654 function Abide() { 4655 _classCallCheck(this, Abide); 4656 4657 return _possibleConstructorReturn(this, (Abide.__proto__ || Object.getPrototypeOf(Abide)).apply(this, arguments)); 4658 } 4659 4660 _createClass(Abide, [{ 4661 key: '_setup', 4662 4663 /** 4664 * Creates a new instance of Abide. 4665 * @class 4666 * @name Abide 4667 * @fires Abide#init 4668 * @param {Object} element - jQuery object to add the trigger to. 4669 * @param {Object} options - Overrides to the default plugin settings. 4670 */ 4671 value: function _setup(element) { 4672 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4673 4674 this.$element = element; 4675 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend(true, {}, Abide.defaults, this.$element.data(), options); 4676 4677 this.className = 'Abide'; // ie9 back compat 4678 this._init(); 4679 } 4680 4681 /** 4682 * Initializes the Abide plugin and calls functions to get Abide functioning on load. 4683 * @private 4684 */ 4685 4686 }, { 4687 key: '_init', 4688 value: function _init() { 4689 this.$inputs = this.$element.find('input, textarea, select'); 4690 4691 this._events(); 4692 } 4693 4694 /** 4695 * Initializes events for Abide. 4696 * @private 4697 */ 4698 4699 }, { 4700 key: '_events', 4701 value: function _events() { 4702 var _this3 = this; 4703 4704 this.$element.off('.abide').on('reset.zf.abide', function () { 4705 _this3.resetForm(); 4706 }).on('submit.zf.abide', function () { 4707 return _this3.validateForm(); 4708 }); 4709 4710 if (this.options.validateOn === 'fieldChange') { 4711 this.$inputs.off('change.zf.abide').on('change.zf.abide', function (e) { 4712 _this3.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target)); 4713 }); 4714 } 4715 4716 if (this.options.liveValidate) { 4717 this.$inputs.off('input.zf.abide').on('input.zf.abide', function (e) { 4718 _this3.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target)); 4719 }); 4720 } 4721 4722 if (this.options.validateOnBlur) { 4723 this.$inputs.off('blur.zf.abide').on('blur.zf.abide', function (e) { 4724 _this3.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target)); 4725 }); 4726 } 4727 } 4728 4729 /** 4730 * Calls necessary functions to update Abide upon DOM change 4731 * @private 4732 */ 4733 4734 }, { 4735 key: '_reflow', 4736 value: function _reflow() { 4737 this._init(); 4738 } 4739 4740 /** 4741 * Checks whether or not a form element has the required attribute and if it's checked or not 4742 * @param {Object} element - jQuery object to check for required attribute 4743 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 4744 */ 4745 4746 }, { 4747 key: 'requiredCheck', 4748 value: function requiredCheck($el) { 4749 if (!$el.attr('required')) return true; 4750 4751 var isGood = true; 4752 4753 switch ($el[0].type) { 4754 case 'checkbox': 4755 isGood = $el[0].checked; 4756 break; 4757 4758 case 'select': 4759 case 'select-one': 4760 case 'select-multiple': 4761 var opt = $el.find('option:selected'); 4762 if (!opt.length || !opt.val()) isGood = false; 4763 break; 4764 4765 default: 4766 if (!$el.val() || !$el.val().length) isGood = false; 4767 } 4768 4769 return isGood; 4770 } 4771 4772 /** 4773 * Get: 4774 * - Based on $el, the first element(s) corresponding to `formErrorSelector` in this order: 4775 * 1. The element's direct sibling('s). 4776 * 2. The element's parent's children. 4777 * - Element(s) with the attribute `[data-form-error-for]` set with the element's id. 4778 * 4779 * This allows for multiple form errors per input, though if none are found, no form errors will be shown. 4780 * 4781 * @param {Object} $el - jQuery object to use as reference to find the form error selector. 4782 * @returns {Object} jQuery object with the selector. 4783 */ 4784 4785 }, { 4786 key: 'findFormError', 4787 value: function findFormError($el) { 4788 var id = $el[0].id; 4789 var $error = $el.siblings(this.options.formErrorSelector); 4790 4791 if (!$error.length) { 4792 $error = $el.parent().find(this.options.formErrorSelector); 4793 } 4794 4795 $error = $error.add(this.$element.find('[data-form-error-for="' + id + '"]')); 4796 4797 return $error; 4798 } 4799 4800 /** 4801 * Get the first element in this order: 4802 * 2. The <label> with the attribute `[for="someInputId"]` 4803 * 3. The `.closest()` <label> 4804 * 4805 * @param {Object} $el - jQuery object to check for required attribute 4806 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 4807 */ 4808 4809 }, { 4810 key: 'findLabel', 4811 value: function findLabel($el) { 4812 var id = $el[0].id; 4813 var $label = this.$element.find('label[for="' + id + '"]'); 4814 4815 if (!$label.length) { 4816 return $el.closest('label'); 4817 } 4818 4819 return $label; 4820 } 4821 4822 /** 4823 * Get the set of labels associated with a set of radio els in this order 4824 * 2. The <label> with the attribute `[for="someInputId"]` 4825 * 3. The `.closest()` <label> 4826 * 4827 * @param {Object} $el - jQuery object to check for required attribute 4828 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 4829 */ 4830 4831 }, { 4832 key: 'findRadioLabels', 4833 value: function findRadioLabels($els) { 4834 var _this4 = this; 4835 4836 var labels = $els.map(function (i, el) { 4837 var id = el.id; 4838 var $label = _this4.$element.find('label[for="' + id + '"]'); 4839 4840 if (!$label.length) { 4841 $label = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(el).closest('label'); 4842 } 4843 return $label[0]; 4844 }); 4845 4846 return __WEBPACK_IMPORTED_MODULE_0_jquery___default()(labels); 4847 } 4848 4849 /** 4850 * Adds the CSS error class as specified by the Abide settings to the label, input, and the form 4851 * @param {Object} $el - jQuery object to add the class to 4852 */ 4853 4854 }, { 4855 key: 'addErrorClasses', 4856 value: function addErrorClasses($el) { 4857 var $label = this.findLabel($el); 4858 var $formError = this.findFormError($el); 4859 4860 if ($label.length) { 4861 $label.addClass(this.options.labelErrorClass); 4862 } 4863 4864 if ($formError.length) { 4865 $formError.addClass(this.options.formErrorClass); 4866 } 4867 4868 $el.addClass(this.options.inputErrorClass).attr('data-invalid', ''); 4869 } 4870 4871 /** 4872 * Remove CSS error classes etc from an entire radio button group 4873 * @param {String} groupName - A string that specifies the name of a radio button group 4874 * 4875 */ 4876 4877 }, { 4878 key: 'removeRadioErrorClasses', 4879 value: function removeRadioErrorClasses(groupName) { 4880 var $els = this.$element.find(':radio[name="' + groupName + '"]'); 4881 var $labels = this.findRadioLabels($els); 4882 var $formErrors = this.findFormError($els); 4883 4884 if ($labels.length) { 4885 $labels.removeClass(this.options.labelErrorClass); 4886 } 4887 4888 if ($formErrors.length) { 4889 $formErrors.removeClass(this.options.formErrorClass); 4890 } 4891 4892 $els.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 4893 } 4894 4895 /** 4896 * Removes CSS error class as specified by the Abide settings from the label, input, and the form 4897 * @param {Object} $el - jQuery object to remove the class from 4898 */ 4899 4900 }, { 4901 key: 'removeErrorClasses', 4902 value: function removeErrorClasses($el) { 4903 // radios need to clear all of the els 4904 if ($el[0].type == 'radio') { 4905 return this.removeRadioErrorClasses($el.attr('name')); 4906 } 4907 4908 var $label = this.findLabel($el); 4909 var $formError = this.findFormError($el); 4910 4911 if ($label.length) { 4912 $label.removeClass(this.options.labelErrorClass); 4913 } 4914 4915 if ($formError.length) { 4916 $formError.removeClass(this.options.formErrorClass); 4917 } 4918 4919 $el.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 4920 } 4921 4922 /** 4923 * Goes through a form to find inputs and proceeds to validate them in ways specific to their type. 4924 * Ignores inputs with data-abide-ignore, type="hidden" or disabled attributes set 4925 * @fires Abide#invalid 4926 * @fires Abide#valid 4927 * @param {Object} element - jQuery object to validate, should be an HTML input 4928 * @returns {Boolean} goodToGo - If the input is valid or not. 4929 */ 4930 4931 }, { 4932 key: 'validateInput', 4933 value: function validateInput($el) { 4934 var _this5 = this; 4935 4936 var clearRequire = this.requiredCheck($el), 4937 validated = false, 4938 customValidator = true, 4939 validator = $el.attr('data-validator'), 4940 equalTo = true; 4941
4942 // don't validate ignored inputs or hidden inputs or disabled inputs 4943 if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]') || $el.is('[disabled]')) { 4944 return true; 4945 } 4946 4947 switch ($el[0].type) { 4948 case 'radio': 4949 validated = this.validateRadio($el.attr('name')); 4950 break; 4951 4952 case 'checkbox': 4953 validated = clearRequire; 4954 break; 4955 4956 case 'select': 4957 case 'select-one': 4958 case 'select-multiple': 4959 validated = clearRequire; 4960 break; 4961 4962 default: 4963 validated = this.validateText($el); 4964 } 4965 4966 if (validator) { 4967 customValidator = this.matchValidation($el, validator, $el.attr('required')); 4968 } 4969 4970 if ($el.attr('data-equalto')) { 4971 equalTo = this.options.validators.equalTo($el); 4972 } 4973 4974 var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1; 4975 var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide'; 4976 4977 if (goodToGo) { 4978 // Re-validate inputs that depend on this one with equalto 4979 var dependentElements = this.$element.find('[data-equalto="' + $el.attr('id') + '"]'); 4980 if (dependentElements.length) { 4981 (function () { 4982 var _this = _this5; 4983 dependentElements.each(function () { 4984 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).val()) { 4985 _this.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)); 4986 } 4987 }); 4988 })(); 4989 } 4990 } 4991 4992 this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el); 4993 4994 /** 4995 * Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide` 4996 * Trigger includes the DOM element of the input. 4997 * @event Abide#valid 4998 * @event Abide#invalid 4999 */ 5000 $el.trigger(message, [$el]); 5001 5002 return goodToGo; 5003 } 5004 5005 /** 5006 * Goes through a form and if there are any invalid inputs, it will display the form error element 5007 * @returns {Boolean} noError - true if no errors were detected... 5008 * @fires Abide#formvalid 5009 * @fires Abide#forminvalid 5010 */ 5011 5012 }, { 5013 key: 'validateForm', 5014 value: function validateForm() { 5015 var acc = []; 5016 var _this = this; 5017 5018 this.$inputs.each(function () { 5019 acc.push(_this.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this))); 5020 }); 5021 5022 var noError = acc.indexOf(false) === -1; 5023 5024 this.$element.find('[data-abide-error]').css('display', noError ? 'none' : 'block'); 5025 5026 /** 5027 * Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`. 5028 * Trigger includes the element of the form. 5029 * @event Abide#formvalid 5030 * @event Abide#forminvalid 5031 */ 5032 this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]); 5033 5034 return noError; 5035 } 5036 5037 /** 5038 * Determines whether or a not a text input is valid based on the pattern specified in the attribute. If no matching pattern is found, returns true. 5039 * @param {Object} $el - jQuery object to validate, should be a text input HTML element 5040 * @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns 5041 * @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified 5042 */ 5043 5044 }, { 5045 key: 'validateText', 5046 value: function validateText($el, pattern) { 5047 // A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute 5048 pattern = pattern || $el.attr('pattern') || $el.attr('type'); 5049 var inputText = $el.val(); 5050 var valid = false; 5051 5052 if (inputText.length) { 5053 // If the pattern attribute on the element is in Abide's list of patterns, then test that regexp 5054 if (this.options.patterns.hasOwnProperty(pattern)) { 5055 valid = this.options.patterns[pattern].test(inputText); 5056 } 5057 // If the pattern name isn't also the type attribute of the field, then test it as a regexp 5058 else if (pattern !== $el.attr('type')) { 5059 valid = new RegExp(pattern).test(inputText); 5060 } else { 5061 valid = true; 5062 } 5063 } 5064 // An empty field is valid if it's not required 5065 else if (!$el.prop('required')) { 5066 valid = true; 5067 } 5068 5069 return valid; 5070 } 5071 5072 /** 5073 * Determines whether or a not a radio input is valid based on whether or not it is required and selected. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all radio buttons in its group. 5074 * @param {String} groupName - A string that specifies the name of a radio button group 5075 * @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required) 5076 */ 5077 5078 }, { 5079 key: 'validateRadio', 5080 value: function validateRadio(groupName) { 5081 // If at least one radio in the group has the `required` attribute, the group is considered required 5082 // Per W3C spec, all radio buttons in a group should have `required`, but we're being nice 5083 var $group = this.$element.find(':radio[name="' + groupName + '"]');
5084 var valid = false, 5085 required = false; 5086 5087 // For the group to be required, at least one radio needs to be required 5088 $group.each(function (i, e) { 5089 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e).attr('required')) { 5090 required = true; 5091 } 5092 }); 5093 if (!required) valid = true; 5094 5095 if (!valid) { 5096 // For the group to be valid, at least one radio needs to be checked 5097 $group.each(function (i, e) { 5098 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e).prop('checked')) { 5099 valid = true; 5100 } 5101 }); 5102 }; 5103 5104 return valid; 5105 } 5106 5107 /** 5108 * Determines if a selected input passes a custom validation function. Multiple validations can be used, if passed to the element with `data-validator="foo bar baz"` in a space separated listed. 5109 * @param {Object} $el - jQuery input element. 5110 * @param {String} validators - a string of function names matching functions in the Abide.options.validators object. 5111 * @param {Boolean} required - self explanatory? 5112 * @returns {Boolean} - true if validations passed. 5113 */ 5114 5115 }, { 5116 key: 'matchValidation', 5117 value: function matchValidation($el, validators, required) { 5118 var _this6 = this; 5119 5120 required = required ? true : false; 5121 5122 var clear = validators.split(' ').map(function (v) { 5123 return _this6.options.validators[v]($el, required, $el.parent()); 5124 }); 5125 return clear.indexOf(false) === -1; 5126 } 5127 5128 /** 5129 * Resets form inputs and styles 5130 * @fires Abide#formreset 5131 */ 5132 5133 }, { 5134 key: 'resetForm', 5135 value: function resetForm() { 5136 var $form = this.$element, 5137 opts = this.options; 5138 5139 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('.' + opts.labelErrorClass, $form).not('small').removeClass(opts.labelErrorClass); 5140 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('.' + opts.inputErrorClass, $form).not('small').removeClass(opts.inputErrorClass); 5141 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(opts.formErrorSelector + '.' + opts.formErrorClass).removeClass(opts.formErrorClass); 5142 $form.find('[data-abide-error]').css('display', 'none'); 5143 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(':input', $form).not(':button, :submit, :reset, :hidden, :radio, :checkbox, [data-abide-ignore]').val('').removeAttr('data-invalid'); 5144 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(':input:radio', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid'); 5145 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(':input:checkbox', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid'); 5146 /** 5147 * Fires when the form has been reset. 5148 * @event Abide#formreset 5149 */ 5150 $form.trigger('formreset.zf.abide', [$form]); 5151 } 5152 5153 /** 5154 * Destroys an instance of Abide. 5155 * Removes error styles and classes from elements, without resetting their values. 5156 */ 5157 5158 }, { 5159 key: '_destroy', 5160 value: function _destroy() { 5161 var _this = this; 5162 this.$element.off('.abide').find('[data-abide-error]').css('display', 'none'); 5163 5164 this.$inputs.off('.abide').each(function () { 5165 _this.removeErrorClasses(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)); 5166 }); 5167 } 5168 }]); 5169 5170 return Abide; 5171}(__WEBPACK_IMPORTED_MODULE_1__foundation_plugin__["a" /* Plugin */]); 5172 5173/** 5174 * Default settings for plugin 5175 */ 5176 5177 5178Abide.defaults = { 5179 /** 5180 * The default event to validate inputs. Checkboxes and radios validate immediately. 5181 * Remove or change this value for manual validation. 5182 * @option 5183 * @type {?string} 5184 * @default 'fieldChange' 5185 */ 5186 validateOn: 'fieldChange', 5187 5188 /** 5189 * Class to be applied to input labels on failed validation. 5190 * @option 5191 * @type {string} 5192 * @default 'is-invalid-label' 5193 */ 5194 labelErrorClass: 'is-invalid-label', 5195 5196 /** 5197 * Class to be applied to inputs on failed validation. 5198 * @option 5199 * @type {string} 5200 * @default 'is-invalid-input' 5201 */ 5202 inputErrorClass: 'is-invalid-input', 5203 5204 /** 5205 * Class selector to use to target Form Errors for show/hide. 5206 * @option 5207 * @type {string} 5208 * @default '.form-error' 5209 */ 5210 formErrorSelector: '.form-error', 5211 5212 /** 5213 * Class added to Form Errors on failed validation. 5214 * @option 5215 * @type {string} 5216 * @default 'is-visible' 5217 */ 5218 formErrorClass: 'is-visible', 5219 5220 /** 5221 * Set to true to validate text inputs on any value change. 5222 * @option 5223 * @type {boolean} 5224 * @default false 5225 */ 5226 liveValidate: false, 5227 5228 /** 5229 * Set to true to validate inputs on blur. 5230 * @option 5231 * @type {boolean} 5232 * @default false 5233 */ 5234 validateOnBlur: false, 5235 5236 patterns: {
5237 alpha: /^[a-zA-Z]+$/, 5238 alpha_numeric: /^[a-zA-Z0-9]+$/, 5239 integer: /^[-+]?\d+$/, 5240 number: /^[-+]?\d*(?:[\.\,]\d+)?$/, 5241 5242 // amex, visa, diners 5243 card: /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(?:222[1-9]|2[3-6][0-9]{2}|27[0-1][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/, 5244 cvv: /^([0-9]){3,4}$/, 5245 5246 // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address 5247 email: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/, 5248 5249 url: /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, 5250 // abc.de 5251 domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/, 5252 5253 datetime: /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/, 5254 // YYYY-MM-DD 5255 date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/, 5256 // HH:MM:SS 5257 time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/, 5258 dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, 5259 // MM/DD/YYYY 5260 month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/, 5261 // DD/MM/YYYY 5262 day_month_year: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/, 5263 5264 // #FFF or #FFFFFF 5265 color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/, 5266 5267 // Domain || URL 5268 website: { 5269 test: function (text) { 5270 return Abide.defaults.patterns['domain'].test(text) || Abide.defaults.patterns['url'].test(text); 5271 } 5272 } 5273 }, 5274 5275 /** 5276 * Optional validation functions to be used. `equalTo` being the only default included function. 5277 * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments: 5278 * el : The jQuery element to validate. 5279 * required : Boolean value of the required attribute be present or not. 5280 * parent : The direct parent of the input. 5281 * @option 5282 */ 5283 validators: { 5284 equalTo: function (el, required, parent) { 5285 return __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + el.attr('data-equalto')).val() === el.val(); 5286 } 5287 } 5288}; 5289 5290 5291 5292/***/ }), 5293/* 18 */ 5294/***/ (function(module, __webpack_exports__, __webpack_require__) { 5295 5296"use strict"; 5297/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Foundation; }); 5298/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 5299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 5300/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_core__ = __webpack_require__(1); 5301/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__ = __webpack_require__(3); 5302 5303 5304 5305 5306 5307 5308var FOUNDATION_VERSION = '6.4.2'; 5309 5310// Global Foundation object 5311// This is attached to the window, or used as a module for AMD/Browserify 5312var Foundation = { 5313 version: FOUNDATION_VERSION, 5314 5315 /** 5316 * Stores initialized plugins. 5317 */ 5318 _plugins: {}, 5319 5320 /** 5321 * Stores generated unique ids for plugin instances 5322 */ 5323 _uuids: [], 5324 5325 /** 5326 * Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing. 5327 * @param {Object} plugin - The constructor of the plugin. 5328 */ 5329 plugin: function (plugin, name) { 5330 // Object key to use when adding to global Foundation object 5331 // Examples: Foundation.Reveal, Foundation.OffCanvas 5332 var className = name || functionName(plugin); 5333 // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin 5334 // Examples: data-reveal, data-off-canvas 5335 var attrName = hyphenate(className); 5336 5337 // Add to the Foundation object and the plugins list (for reflowing) 5338 this._plugins[attrName] = this[className] = plugin; 5339 }, 5340 /** 5341 * @function 5342 * Populates the _uuids array with pointers to each individual plugin instance. 5343 * Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls. 5344 * Also fires the initialization event for each plugin, consolidating repetitive code. 5345 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 5346 * @param {String} name - the name of the plugin, passed as a camelCased string. 5347 * @fires Plugin#init 5348 */ 5349 registerPlugin: function (plugin, name) { 5350 var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase(); 5351 plugin.uuid = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__foundation_util_core__["a" /* GetYoDigits */])(6, pluginName); 5352 5353 if (!plugin.$element.attr('data-' + pluginName)) { 5354 plugin.$element.attr('data-' + pluginName, plugin.uuid); 5355 } 5356 if (!plugin.$element.data('zfPlugin')) { 5357 plugin.$element.data('zfPlugin', plugin); 5358 } 5359 /** 5360 * Fires when the plugin has initialized. 5361 * @event Plugin#init 5362 */ 5363 plugin.$element.trigger('init.zf.' + pluginName); 5364 5365 this._uuids.push(plugin.uuid); 5366 5367 return; 5368 }, 5369 /** 5370 * @function 5371 * Removes the plugins uuid from the _uuids array.
5372 * Removes the zfPlugin data attribute, as well as the data-plugin-name attribute. 5373 * Also fires the destroyed event for the plugin, consolidating repetitive code. 5374 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 5375 * @fires Plugin#destroyed 5376 */ 5377 unregisterPlugin: function (plugin) { 5378 var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor)); 5379 5380 this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1); 5381 plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin') 5382 /** 5383 * Fires when the plugin has been destroyed. 5384 * @event Plugin#destroyed 5385 */ 5386 .trigger('destroyed.zf.' + pluginName); 5387 for (var prop in plugin) { 5388 plugin[prop] = null; //clean up script to prep for garbage collection. 5389 } 5390 return; 5391 }, 5392 5393 /** 5394 * @function 5395 * Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc. 5396 * @param {String} plugins - optional string of an individual plugin key, attained by calling `$(element).data('pluginName')`, or string of a plugin class i.e. `'dropdown'` 5397 * @default If no argument is passed, reflow all currently active plugins. 5398 */ 5399 reInit: function (plugins) { 5400 var isJQ = plugins instanceof __WEBPACK_IMPORTED_MODULE_0_jquery___default.a; 5401 try { 5402 if (isJQ) { 5403 plugins.each(function () { 5404 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('zfPlugin')._init(); 5405 }); 5406 } else { 5407 var type = typeof plugins, 5408 _this = this, 5409 fns = { 5410 'object': function (plgs) { 5411 plgs.forEach(function (p) { 5412 p = hyphenate(p); 5413 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-' + p + ']').foundation('_init'); 5414 }); 5415 }, 5416 'string': function () { 5417 plugins = hyphenate(plugins); 5418 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-' + plugins + ']').foundation('_init'); 5419 }, 5420 'undefined': function () { 5421 this['object'](Object.keys(_this._plugins)); 5422 } 5423 }; 5424 fns[type](plugins); 5425 } 5426 } catch (err) { 5427 console.error(err); 5428 } finally { 5429 return plugins; 5430 } 5431 }, 5432 5433 /** 5434 * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized. 5435 * @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object. 5436 * @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything. 5437 */ 5438 reflow: function (elem, plugins) { 5439 5440 // If plugins is undefined, just grab everything 5441 if (typeof plugins === 'undefined') { 5442 plugins = Object.keys(this._plugins); 5443 } 5444 // If plugins is a string, convert it to an array with one item 5445 else if (typeof plugins === 'string') { 5446 plugins = [plugins]; 5447 } 5448 5449 var _this = this; 5450 5451 // Iterate through each plugin 5452 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.each(plugins, function (i, name) { 5453 // Get the current plugin 5454 var plugin = _this._plugins[name]; 5455 5456 // Localize the search to all elements inside elem, as well as elem itself, unless elem === document 5457 var $elem = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(elem).find('[data-' + name + ']').addBack('[data-' + name + ']'); 5458 5459 // For each plugin found, initialize it 5460 $elem.each(function () { 5461 var $el = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 5462 opts = {}; 5463 // Don't double-dip on plugins 5464 if ($el.data('zfPlugin')) { 5465 console.warn("Tried to initialize " + name + " on an element that already has a Foundation plugin."); 5466 return; 5467 } 5468 5469 if ($el.attr('data-options')) { 5470 var thing = $el.attr('data-options').split(';').forEach(function (e, i) { 5471 var opt = e.split(':').map(function (el) { 5472 return el.trim(); 5473 }); 5474 if (opt[0]) opts[opt[0]] = parseValue(opt[1]); 5475 }); 5476 } 5477 try { 5478 $el.data('zfPlugin', new plugin(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), opts)); 5479 } catch (er) { 5480 console.error(er); 5481 } finally { 5482 return; 5483 } 5484 }); 5485 }); 5486 }, 5487 getFnName: functionName, 5488 5489 addToJquery: function ($) { 5490 // TODO: consider not making this a jQuery function 5491 // TODO: need way to reflow vs. re-initialize 5492 /** 5493 * The Foundation jQuery method. 5494 * @param {String|Array} method - An action to perform on the current jQuery object. 5495 */ 5496 var foundation = function (method) { 5497 var type = typeof method, 5498 $noJS = $('.no-js'); 5499 5500 if ($noJS.length) { 5501 $noJS.removeClass('no-js'); 5502 } 5503 5504 if (type === 'undefined') { 5505 //needs to initialize the Foundation object, or an individual plugin. 5506 __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 5507 Foundation.reflow(this); 5508 } else if (type === 'string') { 5509 //an individual method to invoke on a plugin or group of plugins 5510 var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary 5511 var plugClass = this.data('zfPlugin'); //determine the class of plugin 5512 5513 if (plugClass !== undefined && plugClass[method] !== undefined) { 5514 //make sure both the class and method exist 5515 if (this.length === 1) { 5516 //if there's only one, call it directly.
5517 plugClass[method].apply(plugClass, args); 5518 } else { 5519 this.each(function (i, el) { 5520 //otherwise loop through the jQuery collection and invoke the method on each 5521 plugClass[method].apply($(el).data('zfPlugin'), args); 5522 }); 5523 } 5524 } else { 5525 //error for no class or no method 5526 throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.'); 5527 } 5528 } else { 5529 //error for invalid argument type 5530 throw new TypeError('We\'re sorry, ' + type + ' is not a valid parameter. You must use a string representing the method you wish to invoke.'); 5531 } 5532 return this; 5533 }; 5534 $.fn.foundation = foundation; 5535 return $; 5536 } 5537}; 5538 5539Foundation.util = { 5540 /** 5541 * Function for applying a debounce effect to a function call. 5542 * @function 5543 * @param {Function} func - Function to be called at end of timeout. 5544 * @param {Number} delay - Time in ms to delay the call of `func`. 5545 * @returns function 5546 */ 5547 throttle: function (func, delay) { 5548 var timer = null; 5549 5550 return function () { 5551 var context = this, 5552 args = arguments; 5553 5554 if (timer === null) { 5555 timer = setTimeout(function () { 5556 func.apply(context, args); 5557 timer = null; 5558 }, delay); 5559 } 5560 }; 5561 } 5562}; 5563 5564window.Foundation = Foundation; 5565 5566// Polyfill for requestAnimationFrame 5567(function () { 5568 if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () { 5569 return new Date().getTime(); 5570 }; 5571 5572 var vendors = ['webkit', 'moz']; 5573 for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { 5574 var vp = vendors[i]; 5575 window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; 5576 window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame']; 5577 } 5578 if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) { 5579 var lastTime = 0; 5580 window.requestAnimationFrame = function (callback) { 5581 var now = Date.now(); 5582 var nextTime = Math.max(lastTime + 16, now); 5583 return setTimeout(function () { 5584 callback(lastTime = nextTime); 5585 }, nextTime - now); 5586 }; 5587 window.cancelAnimationFrame = clearTimeout; 5588 } 5589 /** 5590 * Polyfill for performance.now, required by rAF 5591 */ 5592 if (!window.performance || !window.performance.now) { 5593 window.performance = { 5594 start: Date.now(), 5595 now: function () { 5596 return Date.now() - this.start; 5597 } 5598 }; 5599 } 5600})(); 5601if (!Function.prototype.bind) { 5602 Function.prototype.bind = function (oThis) { 5603 if (typeof this !== 'function') { 5604 // closest thing possible to the ECMAScript 5 5605 // internal IsCallable function 5606 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 5607 } 5608 5609 var aArgs = Array.prototype.slice.call(arguments, 1), 5610 fToBind = this, 5611 fNOP = function () {}, 5612 fBound = function () { 5613 return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); 5614 }; 5615 5616 if (this.prototype) { 5617 // native functions don't have a prototype 5618 fNOP.prototype = this.prototype; 5619 } 5620 fBound.prototype = new fNOP(); 5621 5622 return fBound; 5623 }; 5624} 5625// Polyfill to get the name of a function in IE9 5626function functionName(fn) { 5627 if (Function.prototype.name === undefined) { 5628 var funcNameRegex = /function\s([^(]{1,})\(/; 5629 var results = funcNameRegex.exec(fn.toString()); 5630 return results && results.length > 1 ? results[1].trim() : ""; 5631 } else if (fn.prototype === undefined) { 5632 return fn.constructor.name; 5633 } else { 5634 return fn.prototype.constructor.name; 5635 } 5636} 5637function parseValue(str) { 5638 if ('true' === str) return true;else if ('false' === str) return false;else if (!isNaN(str * 1)) return parseFloat(str); 5639 return str; 5640} 5641// Convert PascalCase to kebab-case 5642// Thank you: http://stackoverflow.com/a/8955580 5643function hyphenate(str) { 5644 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 5645} 5646 5647 5648 5649/***/ }), 5650/* 19 */ 5651/***/ (function(module, __webpack_exports__, __webpack_require__) { 5652 5653"use strict"; 5654/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Dropdown; }); 5655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 5656/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 5657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 5658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_core__ = __webpack_require__(1); 5659/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_positionable__ = __webpack_require__(15); 5660/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_util_triggers__ = __webpack_require__(5); 5661 5662 5663var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 5664 5665var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; 5666 5667function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5668 5669function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 5670 5671function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
5671onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 5672 5673 5674 5675 5676 5677 5678 5679 5680/** 5681 * Dropdown module. 5682 * @module foundation.dropdown 5683 * @requires foundation.util.keyboard 5684 * @requires foundation.util.box 5685 * @requires foundation.util.triggers 5686 */ 5687 5688var Dropdown = function (_Positionable) { 5689 _inherits(Dropdown, _Positionable); 5690 5691 function Dropdown() { 5692 _classCallCheck(this, Dropdown); 5693 5694 return _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).apply(this, arguments)); 5695 } 5696 5697 _createClass(Dropdown, [{ 5698 key: '_setup', 5699 5700 /** 5701 * Creates a new instance of a dropdown. 5702 * @class 5703 * @name Dropdown 5704 * @param {jQuery} element - jQuery object to make into a dropdown. 5705 * Object should be of the dropdown panel, rather than its anchor. 5706 * @param {Object} options - Overrides to the default plugin settings. 5707 */ 5708 value: function _setup(element, options) { 5709 this.$element = element; 5710 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Dropdown.defaults, this.$element.data(), options); 5711 this.className = 'Dropdown'; // ie9 back compat 5712 5713 // Triggers init is idempotent, just need to make sure it is initialized 5714 __WEBPACK_IMPORTED_MODULE_4__foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 5715 5716 this._init(); 5717 5718 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('Dropdown', { 5719 'ENTER': 'open', 5720 'SPACE': 'open', 5721 'ESCAPE': 'close' 5722 }); 5723 } 5724 5725 /** 5726 * Initializes the plugin by setting/checking options and attributes, adding helper variables, and saving the anchor. 5727 * @function 5728 * @private 5729 */ 5730 5731 }, { 5732 key: '_init', 5733 value: function _init() { 5734 var $id = this.$element.attr('id'); 5735 5736 this.$anchors = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-toggle="' + $id + '"]').length ? __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-toggle="' + $id + '"]') : __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-open="' + $id + '"]'); 5737 this.$anchors.attr({ 5738 'aria-controls': $id, 5739 'data-is-focus': false, 5740 'data-yeti-box': $id, 5741 'aria-haspopup': true, 5742 'aria-expanded': false 5743 }); 5744 5745 this._setCurrentAnchor(this.$anchors.first()); 5746 5747 if (this.options.parentClass) { 5748 this.$parent = this.$element.parents('.' + this.options.parentClass); 5749 } else { 5750 this.$parent = null; 5751 } 5752 5753 this.$element.attr({ 5754 'aria-hidden': 'true', 5755 'data-yeti-box': $id, 5756 'data-resize': $id, 5757 'aria-labelledby': this.$currentAnchor.id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_core__["a" /* GetYoDigits */])(6, 'dd-anchor') 5758 }); 5759 _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_init', this).call(this); 5760 this._events(); 5761 } 5762 }, { 5763 key: '_getDefaultPosition', 5764 value: function _getDefaultPosition() { 5765 // handle legacy classnames 5766 var position = this.$element[0].className.match(/(top|left|right|bottom)/g); 5767 if (position) { 5768 return position[0]; 5769 } else { 5770 return 'bottom'; 5771 } 5772 } 5773 }, { 5774 key: '_getDefaultAlignment', 5775 value: function _getDefaultAlignment() { 5776 // handle legacy float approach 5777 var horizontalPosition = /float-(\S+)/.exec(this.$currentAnchor.className); 5778 if (horizontalPosition) { 5779 return horizontalPosition[1]; 5780 } 5781 5782 return _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_getDefaultAlignment', this).call(this); 5783 } 5784 5785 /** 5786 * Sets the position and orientation of the dropdown pane, checks for collisions if allow-overlap is not true. 5787 * Recursively calls itself if a collision is detected, with a new position class. 5788 * @function 5789 * @private 5790 */ 5791 5792 }, { 5793 key: '_setPosition', 5794 value: function _setPosition() { 5795 _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_setPosition', this).call(this, this.$currentAnchor, this.$element, this.$parent); 5796 } 5797 5798 /** 5799 * Make it a current anchor. 5800 * Current anchor as the reference for the position of Dropdown panes. 5801 * @param {HTML}
vendor: 4,442 bytes, lines 5801-5931
5801 el - DOM element of the anchor. 5802 * @function 5803 * @private 5804 */ 5805 5806 }, { 5807 key: '_setCurrentAnchor', 5808 value: function _setCurrentAnchor(el) { 5809 this.$currentAnchor = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(el); 5810 } 5811 5812 /** 5813 * Adds event listeners to the element utilizing the triggers utility library. 5814 * @function 5815 * @private 5816 */ 5817 5818 }, { 5819 key: '_events', 5820 value: function _events() { 5821 var _this = this; 5822 this.$element.on({ 5823 'open.zf.trigger': this.open.bind(this), 5824 'close.zf.trigger': this.close.bind(this), 5825 'toggle.zf.trigger': this.toggle.bind(this), 5826 'resizeme.zf.trigger': this._setPosition.bind(this) 5827 }); 5828 5829 this.$anchors.off('click.zf.trigger').on('click.zf.trigger', function () { 5830 _this._setCurrentAnchor(this); 5831 }); 5832 5833 if (this.options.hover) { 5834 this.$anchors.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 5835 _this._setCurrentAnchor(this); 5836 5837 var bodyData = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').data(); 5838 if (typeof bodyData.whatinput === 'undefined' || bodyData.whatinput === 'mouse') { 5839 clearTimeout(_this.timeout); 5840 _this.timeout = setTimeout(function () { 5841 _this.open(); 5842 _this.$anchors.data('hover', true); 5843 }, _this.options.hoverDelay); 5844 } 5845 }).on('mouseleave.zf.dropdown', function () { 5846 clearTimeout(_this.timeout); 5847 _this.timeout = setTimeout(function () { 5848 _this.close(); 5849 _this.$anchors.data('hover', false); 5850 }, _this.options.hoverDelay); 5851 }); 5852 if (this.options.hoverPane) { 5853 this.$element.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 5854 clearTimeout(_this.timeout); 5855 }).on('mouseleave.zf.dropdown', function () { 5856 clearTimeout(_this.timeout); 5857 _this.timeout = setTimeout(function () { 5858 _this.close(); 5859 _this.$anchors.data('hover', false); 5860 }, _this.options.hoverDelay); 5861 }); 5862 } 5863 } 5864 this.$anchors.add(this.$element).on('keydown.zf.dropdown', function (e) { 5865 5866 var $target = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 5867 visibleFocusableElements = __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].findFocusable(_this.$element); 5868 5869 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'Dropdown', { 5870 open: function () { 5871 if ($target.is(_this.$anchors)) { 5872 _this.open(); 5873 _this.$element.attr('tabindex', -1).focus(); 5874 e.preventDefault(); 5875 } 5876 }, 5877 close: function () { 5878 _this.close(); 5879 _this.$anchors.focus(); 5880 } 5881 }); 5882 }); 5883 } 5884 5885 /** 5886 * Adds an event handler to the body to close any dropdowns on a click. 5887 * @function 5888 * @private 5889 */ 5890 5891 }, { 5892 key: '_addBodyHandler', 5893 value: function _addBodyHandler() { 5894 var $body = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document.body).not(this.$element), 5895 _this = this; 5896 $body.off('click.zf.dropdown').on('click.zf.dropdown', function (e) { 5897 if (_this.$anchors.is(e.target) || _this.$anchors.find(e.target).length) { 5898 return; 5899 } 5900 if (_this.$element.find(e.target).length) { 5901 return; 5902 } 5903 _this.close(); 5904 $body.off('click.zf.dropdown'); 5905 }); 5906 } 5907 5908 /** 5909 * Opens the dropdown pane, and fires a bubbling event to close other dropdowns. 5910 * @function 5911 * @fires Dropdown#closeme 5912 * @fires Dropdown#show 5913 */ 5914 5915 }, { 5916 key: 'open', 5917 value: function open() { 5918 // var _this = this; 5919 /** 5920 * Fires to close other open dropdowns, typically when dropdown is opening 5921 * @event Dropdown#closeme 5922 */ 5923 this.$element.trigger('closeme.zf.dropdown', this.$element.attr('id')); 5924 this.$anchors.addClass('hover').attr({ 'aria-expanded': true }); 5925 // this.$element/*.show()*/; 5926 5927 this.$element.addClass('is-opening'); 5928 this._setPosition(); 5929 this.$element.removeClass('is-opening').addClass('is-open').attr({ 'aria-hidden': false }); 5930 5931 if (this.options.autoFocus) {
5932 var $focusable = __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].findFocusable(this.$element); 5933 if ($focusable.length) { 5934 $focusable.eq(0).focus(); 5935 } 5936 } 5937 5938 if (this.options.closeOnClick) { 5939 this._addBodyHandler(); 5940 } 5941 5942 if (this.options.trapFocus) { 5943 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].trapFocus(this.$element); 5944 } 5945 5946 /** 5947 * Fires once the dropdown is visible. 5948 * @event Dropdown#show 5949 */ 5950 this.$element.trigger('show.zf.dropdown', [this.$element]); 5951 } 5952 5953 /** 5954 * Closes the open dropdown pane. 5955 * @function 5956 * @fires Dropdown#hide 5957 */ 5958 5959 }, { 5960 key: 'close', 5961 value: function close() { 5962 if (!this.$element.hasClass('is-open')) { 5963 return false; 5964 } 5965 this.$element.removeClass('is-open').attr({ 'aria-hidden': true }); 5966 5967 this.$anchors.removeClass('hover').attr('aria-expanded', false); 5968 5969 /** 5970 * Fires once the dropdown is no longer visible. 5971 * @event Dropdown#hide 5972 */ 5973 this.$element.trigger('hide.zf.dropdown', [this.$element]); 5974 5975 if (this.options.trapFocus) { 5976 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].releaseFocus(this.$element); 5977 } 5978 } 5979 5980 /** 5981 * Toggles the dropdown pane's visibility. 5982 * @function 5983 */ 5984 5985 }, { 5986 key: 'toggle', 5987 value: function toggle() { 5988 if (this.$element.hasClass('is-open')) { 5989 if (this.$anchors.data('hover')) return; 5990 this.close(); 5991 } else { 5992 this.open(); 5993 } 5994 } 5995 5996 /** 5997 * Destroys the dropdown. 5998 * @function 5999 */ 6000 6001 }, { 6002 key: '_destroy', 6003 value: function _destroy() { 6004 this.$element.off('.zf.trigger').hide(); 6005 this.$anchors.off('.zf.dropdown'); 6006 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document.body).off('click.zf.dropdown'); 6007 } 6008 }]); 6009 6010 return Dropdown; 6011}(__WEBPACK_IMPORTED_MODULE_3__foundation_positionable__["a" /* Positionable */]); 6012 6013Dropdown.defaults = { 6014 /** 6015 * Class that designates bounding container of Dropdown (default: window) 6016 * @option 6017 * @type {?string} 6018 * @default null 6019 */ 6020 parentClass: null, 6021 /** 6022 * Amount of time to delay opening a submenu on hover event. 6023 * @option 6024 * @type {number} 6025 * @default 250 6026 */ 6027 hoverDelay: 250, 6028 /** 6029 * Allow submenus to open on hover events 6030 * @option 6031 * @type {boolean} 6032 * @default false 6033 */ 6034 hover: false, 6035 /** 6036 * Don't close dropdown when hovering over dropdown pane 6037 * @option 6038 * @type {boolean} 6039 * @default false 6040 */ 6041 hoverPane: false, 6042 /** 6043 * Number of pixels between the dropdown pane and the triggering element on open. 6044 * @option 6045 * @type {number} 6046 * @default 0 6047 */ 6048 vOffset: 0, 6049 /** 6050 * Number of pixels between the dropdown pane and the triggering element on open. 6051 * @option 6052 * @type {number} 6053 * @default 0 6054 */ 6055 hOffset: 0, 6056 /** 6057 * DEPRECATED: Class applied to adjust open position. 6058 * @option 6059 * @type {string} 6060 * @default '' 6061 */ 6062 positionClass: '', 6063 6064 /** 6065 * Position of dropdown. Can be left, right, bottom, top, or auto. 6066 * @option 6067 * @type {string} 6068 * @default 'auto' 6069 */ 6070 position: 'auto', 6071 /** 6072 * Alignment of dropdown relative to anchor. Can be left, right, bottom, top, center, or auto. 6073 * @option 6074 * @type {string} 6075 * @default 'auto' 6076 */ 6077 alignment: 'auto', 6078 /** 6079 * Allow overlap of container/window. If false, dropdown will first try to position as defined by data-position and data-alignment, but reposition if it would cause an overflow. 6080 * @option 6081 * @type {boolean} 6082 * @default false 6083 */ 6084 allowOverlap: false, 6085 /** 6086 * Allow overlap of only the bottom of the container. This is the most common 6087 * behavior for dropdowns, allowing the dropdown to extend the bottom of the 6088 * screen but not otherwise influence or break out of the container. 6089 * @option 6090 * @type {boolean} 6091 * @default true 6092 */ 6093 allowBottomOverlap: true, 6094 /** 6095 * Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands. 6096 * @option 6097 * @type {boolean} 6098 * @default false 6099 */ 6100 trapFocus: false, 6101 /** 6102 * Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening. 6103 * @option 6104 * @type {boolean} 6105 * @default false 6106 */ 6107 autoFocus: false, 6108 /** 6109 * Allows a click on the body to close the dropdown. 6110 * @option 6111 * @type {boolean} 6112 * @default false 6113 */ 6114 closeOnClick: false 6115}; 6116 6117 6118 6119/***/ }), 6120/* 20 */ 6121/***/ (function(module, __webpack_exports__, __webpack_require__) { 6122 6123"use strict"; 6124/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Equalizer; }); 6125/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 6126/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 6127/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__ = __webpack_require__(3); 6128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_imageLoader__ = __webpack_require__(8); 6129/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_core__ = __webpack_require__(1); 6130/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_plugin__ = __webpack_require__(2); 6131 6132 6133var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6134 6135function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6136 6137function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 6138 6139function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
6139onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 6140 6141 6142 6143 6144 6145 6146 6147/** 6148 * Equalizer module. 6149 * @module foundation.equalizer 6150 * @requires foundation.util.mediaQuery 6151 * @requires foundation.util.imageLoader if equalizer contains images 6152 */ 6153 6154var Equalizer = function (_Plugin) { 6155 _inherits(Equalizer, _Plugin); 6156 6157 function Equalizer() { 6158 _classCallCheck(this, Equalizer); 6159 6160 return _possibleConstructorReturn(this, (Equalizer.__proto__ || Object.getPrototypeOf(Equalizer)).apply(this, arguments)); 6161 } 6162 6163 _createClass(Equalizer, [{ 6164 key: '_setup', 6165 6166 /** 6167 * Creates a new instance of Equalizer. 6168 * @class 6169 * @name Equalizer 6170 * @fires Equalizer#init 6171 * @param {Object} element - jQuery object to add the trigger to. 6172 * @param {Object} options - Overrides to the default plugin settings. 6173 */ 6174 value: function _setup(element, options) { 6175 this.$element = element; 6176 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Equalizer.defaults, this.$element.data(), options); 6177 this.className = 'Equalizer'; // ie9 back compat 6178 6179 this._init(); 6180 } 6181 6182 /** 6183 * Initializes the Equalizer plugin and calls functions to get equalizer functioning on load. 6184 * @private 6185 */ 6186 6187 }, { 6188 key: '_init', 6189 value: function _init() { 6190 var eqId = this.$element.attr('data-equalizer') || ''; 6191 var $watched = this.$element.find('[data-equalizer-watch="' + eqId + '"]'); 6192 6193 __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 6194 6195 this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]'); 6196 this.$element.attr('data-resize', eqId || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["a" /* GetYoDigits */])(6, 'eq')); 6197 this.$element.attr('data-mutate', eqId || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["a" /* GetYoDigits */])(6, 'eq')); 6198 6199 this.hasNested = this.$element.find('[data-equalizer]').length > 0; 6200 this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0; 6201 this.isOn = false; 6202 this._bindHandler = { 6203 onResizeMeBound: this._onResizeMe.bind(this), 6204 onPostEqualizedBound: this._onPostEqualized.bind(this) 6205 }; 6206 6207 var imgs = this.$element.find('img'); 6208 var tooSmall; 6209 if (this.options.equalizeOn) { 6210 tooSmall = this._checkMQ(); 6211 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('changed.zf.mediaquery', this._checkMQ.bind(this)); 6212 } else { 6213 this._events(); 6214 } 6215 if (tooSmall !== undefined && tooSmall === false || tooSmall === undefined) { 6216 if (imgs.length) { 6217 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_imageLoader__["a" /* onImagesLoaded */])(imgs, this._reflow.bind(this)); 6218 } else { 6219 this._reflow(); 6220 } 6221 } 6222 } 6223 6224 /** 6225 * Removes event listeners if the breakpoint is too small. 6226 * @private 6227 */ 6228 6229 }, { 6230 key: '_pauseEvents', 6231 value: function _pauseEvents() { 6232 this.isOn = false; 6233 this.$element.off({ 6234 '.zf.equalizer': this._bindHandler.onPostEqualizedBound, 6235 'resizeme.zf.trigger': this._bindHandler.onResizeMeBound, 6236 'mutateme.zf.trigger': this._bindHandler.onResizeMeBound 6237 }); 6238 } 6239 6240 /** 6241 * function to handle $elements resizeme.zf.trigger, with bound this on _bindHandler.onResizeMeBound 6242 * @private 6243 */ 6244 6245 }, { 6246 key: '_onResizeMe', 6247 value: function _onResizeMe(e) { 6248 this._reflow(); 6249 } 6250 6251 /** 6252 * function to handle $elements postequalized.zf.equalizer, with bound this on _bindHandler.onPostEqualizedBound 6253 * @private 6254 */ 6255 6256 }, { 6257 key: '_onPostEqualized', 6258 value: function _onPostEqualized(e) { 6259 if (e.target !== this.$element[0]) { 6260 this._reflow(); 6261 } 6262 } 6263 6264 /** 6265 * Initializes events for Equalizer. 6266 * @private 6267 */ 6268 6269 }, { 6270 key: '_events', 6271 value: function _events() { 6272 var _this = this; 6273 this._pauseEvents(); 6274 if (this.hasNested) {
vendor: 4,435 bytes, lines 6275-6418
6275 this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound); 6276 } else { 6277 this.$element.on('resizeme.zf.trigger', this._bindHandler.onResizeMeBound); 6278 this.$element.on('mutateme.zf.trigger', this._bindHandler.onResizeMeBound); 6279 } 6280 this.isOn = true; 6281 } 6282 6283 /** 6284 * Checks the current breakpoint to the minimum required size. 6285 * @private 6286 */ 6287 6288 }, { 6289 key: '_checkMQ', 6290 value: function _checkMQ() { 6291 var tooSmall = !__WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */].is(this.options.equalizeOn); 6292 if (tooSmall) { 6293 if (this.isOn) { 6294 this._pauseEvents(); 6295 this.$watched.css('height', 'auto'); 6296 } 6297 } else { 6298 if (!this.isOn) { 6299 this._events(); 6300 } 6301 } 6302 return tooSmall; 6303 } 6304 6305 /** 6306 * A noop version for the plugin 6307 * @private 6308 */ 6309 6310 }, { 6311 key: '_killswitch', 6312 value: function _killswitch() { 6313 return; 6314 } 6315 6316 /** 6317 * Calls necessary functions to update Equalizer upon DOM change 6318 * @private 6319 */ 6320 6321 }, { 6322 key: '_reflow', 6323 value: function _reflow() { 6324 if (!this.options.equalizeOnStack) { 6325 if (this._isStacked()) { 6326 this.$watched.css('height', 'auto'); 6327 return false; 6328 } 6329 } 6330 if (this.options.equalizeByRow) { 6331 this.getHeightsByRow(this.applyHeightByRow.bind(this)); 6332 } else { 6333 this.getHeights(this.applyHeight.bind(this)); 6334 } 6335 } 6336 6337 /** 6338 * Manually determines if the first 2 elements are *NOT* stacked. 6339 * @private 6340 */ 6341 6342 }, { 6343 key: '_isStacked', 6344 value: function _isStacked() { 6345 if (!this.$watched[0] || !this.$watched[1]) { 6346 return true; 6347 } 6348 return this.$watched[0].getBoundingClientRect().top !== this.$watched[1].getBoundingClientRect().top; 6349 } 6350 6351 /** 6352 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 6353 * @param {Function} cb - A non-optional callback to return the heights array to. 6354 * @returns {Array} heights - An array of heights of children within Equalizer container 6355 */ 6356 6357 }, { 6358 key: 'getHeights', 6359 value: function getHeights(cb) { 6360 var heights = []; 6361 for (var i = 0, len = this.$watched.length; i < len; i++) { 6362 this.$watched[i].style.height = 'auto'; 6363 heights.push(this.$watched[i].offsetHeight); 6364 } 6365 cb(heights); 6366 } 6367 6368 /** 6369 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 6370 * @param {Function} cb - A non-optional callback to return the heights array to. 6371 * @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 6372 */ 6373 6374 }, { 6375 key: 'getHeightsByRow', 6376 value: function getHeightsByRow(cb) { 6377 var lastElTopOffset = this.$watched.length ? this.$watched.first().offset().top : 0, 6378 groups = [], 6379 group = 0; 6380 //group by Row 6381 groups[group] = []; 6382 for (var i = 0, len = this.$watched.length; i < len; i++) { 6383 this.$watched[i].style.height = 'auto'; 6384 //maybe could use this.$watched[i].offsetTop 6385 var elOffsetTop = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.$watched[i]).offset().top; 6386 if (elOffsetTop != lastElTopOffset) { 6387 group++; 6388 groups[group] = []; 6389 lastElTopOffset = elOffsetTop; 6390 } 6391 groups[group].push([this.$watched[i], this.$watched[i].offsetHeight]); 6392 } 6393 6394 for (var j = 0, ln = groups.length; j < ln; j++) { 6395 var heights = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(groups[j]).map(function () { 6396 return this[1]; 6397 }).get(); 6398 var max = Math.max.apply(null, heights); 6399 groups[j].push(max); 6400 } 6401 cb(groups); 6402 } 6403 6404 /** 6405 * Changes the CSS height property of each child in an Equalizer parent to match the tallest 6406 * @param {array} heights - An array of heights of children within Equalizer container 6407 * @fires Equalizer#preequalized 6408 * @fires Equalizer#postequalized 6409 */ 6410 6411 }, { 6412 key: 'applyHeight', 6413 value: function applyHeight(heights) { 6414 var max = Math.max.apply(null, heights); 6415 /** 6416 * Fires before the heights are applied 6417 * @event Equalizer#preequalized 6418 */
6419 this.$element.trigger('preequalized.zf.equalizer'); 6420 6421 this.$watched.css('height', max); 6422 6423 /** 6424 * Fires when the heights have been applied 6425 * @event Equalizer#postequalized 6426 */ 6427 this.$element.trigger('postequalized.zf.equalizer'); 6428 } 6429 6430 /** 6431 * Changes the CSS height property of each child in an Equalizer parent to match the tallest by row 6432 * @param {array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 6433 * @fires Equalizer#preequalized 6434 * @fires Equalizer#preequalizedrow 6435 * @fires Equalizer#postequalizedrow 6436 * @fires Equalizer#postequalized 6437 */ 6438 6439 }, { 6440 key: 'applyHeightByRow', 6441 value: function applyHeightByRow(groups) { 6442 /** 6443 * Fires before the heights are applied 6444 */ 6445 this.$element.trigger('preequalized.zf.equalizer'); 6446 for (var i = 0, len = groups.length; i < len; i++) { 6447 var groupsILength = groups[i].length, 6448 max = groups[i][groupsILength - 1]; 6449 if (groupsILength <= 2) { 6450 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(groups[i][0][0]).css({ 'height': 'auto' }); 6451 continue; 6452 } 6453 /** 6454 * Fires before the heights per row are applied 6455 * @event Equalizer#preequalizedrow 6456 */ 6457 this.$element.trigger('preequalizedrow.zf.equalizer'); 6458 for (var j = 0, lenJ = groupsILength - 1; j < lenJ; j++) { 6459 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(groups[i][j][0]).css({ 'height': max }); 6460 } 6461 /** 6462 * Fires when the heights per row have been applied 6463 * @event Equalizer#postequalizedrow 6464 */ 6465 this.$element.trigger('postequalizedrow.zf.equalizer'); 6466 } 6467 /** 6468 * Fires when the heights have been applied 6469 */ 6470 this.$element.trigger('postequalized.zf.equalizer'); 6471 } 6472 6473 /** 6474 * Destroys an instance of Equalizer. 6475 * @function 6476 */ 6477 6478 }, { 6479 key: '_destroy', 6480 value: function _destroy() { 6481 this._pauseEvents(); 6482 this.$watched.css('height', 'auto'); 6483 } 6484 }]); 6485 6486 return Equalizer; 6487}(__WEBPACK_IMPORTED_MODULE_4__foundation_plugin__["a" /* Plugin */]); 6488 6489/** 6490 * Default settings for plugin 6491 */ 6492 6493 6494Equalizer.defaults = { 6495 /** 6496 * Enable height equalization when stacked on smaller screens. 6497 * @option 6498 * @type {boolean} 6499 * @default false 6500 */ 6501 equalizeOnStack: false, 6502 /** 6503 * Enable height equalization row by row. 6504 * @option 6505 * @type {boolean} 6506 * @default false 6507 */ 6508 equalizeByRow: false, 6509 /** 6510 * String representing the minimum breakpoint size the plugin should equalize heights on. 6511 * @option 6512 * @type {string} 6513 * @default '' 6514 */ 6515 equalizeOn: '' 6516}; 6517 6518 6519 6520/***/ }), 6521/* 21 */ 6522/***/ (function(module, __webpack_exports__, __webpack_require__) { 6523 6524"use strict"; 6525/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Interchange; }); 6526/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 6527/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 6528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__ = __webpack_require__(3); 6529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_plugin__ = __webpack_require__(2); 6530/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_core__ = __webpack_require__(1); 6531 6532 6533var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6534 6535function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6536 6537function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 6538 6539function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
6539onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 6540 6541 6542 6543 6544 6545 6546/** 6547 * Interchange module. 6548 * @module foundation.interchange 6549 * @requires foundation.util.mediaQuery 6550 */ 6551 6552var Interchange = function (_Plugin) { 6553 _inherits(Interchange, _Plugin); 6554 6555 function Interchange() { 6556 _classCallCheck(this, Interchange); 6557 6558 return _possibleConstructorReturn(this, (Interchange.__proto__ || Object.getPrototypeOf(Interchange)).apply(this, arguments)); 6559 } 6560 6561 _createClass(Interchange, [{ 6562 key: '_setup', 6563 6564 /** 6565 * Creates a new instance of Interchange. 6566 * @class 6567 * @name Interchange 6568 * @fires Interchange#init 6569 * @param {Object} element - jQuery object to add the trigger to. 6570 * @param {Object} options - Overrides to the default plugin settings. 6571 */ 6572 value: function _setup(element, options) { 6573 this.$element = element; 6574 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Interchange.defaults, options); 6575 this.rules = []; 6576 this.currentPath = ''; 6577 this.className = 'Interchange'; // ie9 back compat 6578 6579 this._init(); 6580 this._events(); 6581 } 6582 6583 /** 6584 * Initializes the Interchange plugin and calls functions to get interchange functioning on load. 6585 * @function 6586 * @private 6587 */ 6588 6589 }, { 6590 key: '_init', 6591 value: function _init() { 6592 __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 6593 6594 var id = this.$element[0].id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["a" /* GetYoDigits */])(6, 'interchange'); 6595 this.$element.attr({ 6596 'data-resize': id, 6597 'id': id 6598 }); 6599 6600 this._addBreakpoints(); 6601 this._generateRules(); 6602 this._reflow(); 6603 } 6604 6605 /** 6606 * Initializes events for Interchange. 6607 * @function 6608 * @private 6609 */ 6610 6611 }, { 6612 key: '_events', 6613 value: function _events() { 6614 var _this3 = this; 6615 6616 this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function () { 6617 return _this3._reflow(); 6618 }); 6619 } 6620 6621 /** 6622 * Calls necessary functions to update Interchange upon DOM change 6623 * @function 6624 * @private 6625 */ 6626 6627 }, { 6628 key: '_reflow', 6629 value: function _reflow() { 6630 var match; 6631 6632 // Iterate through each rule, but only save the last match 6633 for (var i in this.rules) { 6634 if (this.rules.hasOwnProperty(i)) { 6635 var rule = this.rules[i]; 6636 if (window.matchMedia(rule.query).matches) { 6637 match = rule; 6638 } 6639 } 6640 } 6641 6642 if (match) { 6643 this.replace(match.path); 6644 } 6645 } 6646 6647 /** 6648 * Gets the Foundation breakpoints and adds them to the Interchange.SPECIAL_QUERIES object. 6649 * @function 6650 * @private 6651 */ 6652 6653 }, { 6654 key: '_addBreakpoints', 6655 value: function _addBreakpoints() { 6656 for (var i in __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */].queries) { 6657 if (__WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */].queries.hasOwnProperty(i)) { 6658 var query = __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */].queries[i]; 6659 Interchange.SPECIAL_QUERIES[query.name] = query.value; 6660 } 6661 } 6662 } 6663 6664 /** 6665 * Checks the Interchange element for the provided media query + content pairings 6666 * @function 6667 * @private 6668 * @param {Object} element - jQuery object that is an Interchange instance 6669 * @returns {Array} scenarios - Array of objects that have 'mq' and 'path' keys with corresponding keys 6670 */ 6671 6672 }, { 6673 key: '_generateRules', 6674 value: function _generateRules(element) { 6675 var rulesList = []; 6676 var rules; 6677 6678 if (this.options.rules) { 6679 rules = this.options.rules; 6680 } else { 6681 rules = this.$element.data('interchange'); 6682 } 6683 6684 rules = typeof rules === 'string' ? rules.match(/\[.*?\]/g) : rules; 6685 6686 for (var i in rules) { 6687 if (rules.hasOwnProperty(i)) { 6688 var rule = rules[i].slice(1, -1).split(', '); 6689 var path = rule.slice(0, -1).join(''); 6690 var query = rule[rule.length - 1]; 6691 6692 if (Interchange.SPECIAL_QUERIES[query]) { 6693 query = Interchange.SPECIAL_QUERIES[query]; 6694 } 6695 6696 rulesList.push({ 6697 path: path, 6698 query: query 6699 }); 6700 } 6701 } 6702 6703 this.rules = rulesList; 6704 } 6705 6706 /** 6707 * Update the `src` property of an image, or change the HTML of a container, to the specified path. 6708 * @function 6709 * @param {String} path - Path to the image or HTML partial. 6710 * @fires Interchange#replaced 6711 */ 6712 6713 }, { 6714 key: 'replace', 6715 value: function replace(path) { 6716 if (this.currentPath === path) return; 6717 6718 var _this = this, 6719 trigger = 'replaced.zf.interchange'; 6720 6721 // Replacing images 6722 if (this.$element[0].nodeName === 'IMG') { 6723 this.$element.attr('src', path).on('load', function () { 6724 _this.currentPath = path; 6725 }).trigger(trigger); 6726 } 6727 // Replacing background images 6728 else if (path.match(/\.(gif|jpg|jpeg|png|svg|tiff)([?#].*)?/i)) { 6729 path = path.replace(/\(/g, '%28').replace(/\)/g, '%29'); 6730 this.$element.css({ 'background-image': 'url(' + path + ')' }).trigger(trigger); 6731 } 6732 // Replacing HTML 6733 else { 6734 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.get(path, function (response) { 6735 _this.$element.html(response).trigger(trigger); 6736 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(response).foundation(); 6737 _this.currentPath = path; 6738 }); 6739 } 6740 6741 /** 6742 * Fires when content in an Interchange element is done being loaded. 6743 * @event Interchange#replaced 6744 */ 6745 // this.$element.trigger('replaced.zf.interchange'); 6746 } 6747 6748 /** 6749 * Destroys an instance of interchange. 6750 * @function 6751 */ 6752 6753 }, { 6754 key: '_destroy', 6755 value: function _destroy() { 6756 this.$element.off('resizeme.zf.trigger'); 6757 } 6758 }]); 6759 6760 return Interchange; 6761}(__WEBPACK_IMPORTED_MODULE_2__foundation_plugin__["a" /* Plugin */]); 6762 6763/** 6764 * Default settings for plugin 6765 */ 6766 6767 6768Interchange.defaults = { 6769 /** 6770 * Rules to be applied to Interchange elements. Set with the `data-interchange` array notation. 6771 * @option 6772 * @type {?array} 6773 * @default null 6774 */ 6775 rules: null 6776}; 6777 6778Interchange.SPECIAL_QUERIES = { 6779 'landscape': 'screen and (orientation: landscape)', 6780 'portrait': 'screen and (orientation: portrait)', 6781 'retina': 'only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)' 6782}; 6783 6784 6785 6786/***/ }), 6787/* 22 */ 6788/***/ (function(module, __webpack_exports__, __webpack_require__) { 6789 6790"use strict"; 6791/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Magellan; }); 6792/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 6793/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 6794/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_core__ = __webpack_require__(1); 6795/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_plugin__ = __webpack_require__(2); 6796/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_smoothScroll__ = __webpack_require__(33); 6797 6798 6799var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6800 6801function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6802 6803function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 6804 6805function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
6805onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 6806 6807 6808 6809 6810 6811 6812/** 6813 * Magellan module. 6814 * @module foundation.magellan 6815 * @requires foundation.smoothScroll 6816 */ 6817 6818var Magellan = function (_Plugin) { 6819 _inherits(Magellan, _Plugin); 6820 6821 function Magellan() { 6822 _classCallCheck(this, Magellan); 6823 6824 return _possibleConstructorReturn(this, (Magellan.__proto__ || Object.getPrototypeOf(Magellan)).apply(this, arguments)); 6825 } 6826 6827 _createClass(Magellan, [{ 6828 key: '_setup', 6829 6830 /** 6831 * Creates a new instance of Magellan. 6832 * @class 6833 * @name Magellan 6834 * @fires Magellan#init 6835 * @param {Object} element - jQuery object to add the trigger to. 6836 * @param {Object} options - Overrides to the default plugin settings. 6837 */ 6838 value: function _setup(element, options) { 6839 this.$element = element; 6840 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Magellan.defaults, this.$element.data(), options); 6841 this.className = 'Magellan'; // ie9 back compat 6842 6843 this._init(); 6844 this.calcPoints(); 6845 } 6846 6847 /** 6848 * Initializes the Magellan plugin and calls functions to get equalizer functioning on load. 6849 * @private 6850 */ 6851 6852 }, { 6853 key: '_init', 6854 value: function _init() { 6855 var id = this.$element[0].id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__foundation_util_core__["a" /* GetYoDigits */])(6, 'magellan'); 6856 var _this = this; 6857 this.$targets = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-magellan-target]'); 6858 this.$links = this.$element.find('a'); 6859 this.$element.attr({ 6860 'data-resize': id, 6861 'data-scroll': id, 6862 'id': id 6863 }); 6864 this.$active = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(); 6865 this.scrollPos = parseInt(window.pageYOffset, 10); 6866 6867 this._events(); 6868 } 6869 6870 /** 6871 * Calculates an array of pixel values that are the demarcation lines between locations on the page. 6872 * Can be invoked if new elements are added or the size of a location changes. 6873 * @function 6874 */ 6875 6876 }, { 6877 key: 'calcPoints', 6878 value: function calcPoints() { 6879 var _this = this, 6880 body = document.body, 6881 html = document.documentElement; 6882 6883 this.points = []; 6884 this.winHeight = Math.round(Math.max(window.innerHeight, html.clientHeight)); 6885 this.docHeight = Math.round(Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight)); 6886 6887 this.$targets.each(function () { 6888 var $tar = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 6889 pt = Math.round($tar.offset().top - _this.options.threshold); 6890 $tar.targetPoint = pt; 6891 _this.points.push(pt); 6892 }); 6893 } 6894 6895 /** 6896 * Initializes events for Magellan. 6897 * @private 6898 */ 6899 6900 }, { 6901 key: '_events', 6902 value: function _events() { 6903 var _this = this, 6904 $body = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html, body'), 6905 opts = { 6906 duration: _this.options.animationDuration, 6907 easing: _this.options.animationEasing 6908 }; 6909 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).one('load', function () { 6910 if (_this.options.deepLinking) { 6911 if (location.hash) { 6912 _this.scrollToLoc(location.hash); 6913 } 6914 } 6915 _this.calcPoints(); 6916 _this._updateActive(); 6917 }); 6918 6919 this.$element.on({ 6920 'resizeme.zf.trigger': this.reflow.bind(this), 6921 'scrollme.zf.trigger': this._updateActive.bind(this) 6922 }).on('click.zf.magellan', 'a[href^="#"]', function (e) { 6923 e.preventDefault(); 6924 var arrival = this.getAttribute('href'); 6925 _this.scrollToLoc(arrival); 6926 }); 6927 6928 this._deepLinkScroll = function (e) { 6929 if (_this.options.deepLinking) { 6930 _this.scrollToLoc(window.location.hash); 6931 } 6932 }; 6933 6934 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('popstate', this._deepLinkScroll); 6935 } 6936 6937 /** 6938 * Function to scroll to a given location on the page. 6939 * @param {String} loc - a properly formatted jQuery id selector. Example: '#foo' 6940 * @function 6941 */ 6942 6943 }, { 6944 key: 'scrollToLoc', 6945 value: function scrollToLoc(loc) { 6946 this._inTransition = true; 6947 var _this = this; 6948 6949 var options = { 6950 animationEasing: this.options.animationEasing, 6951 animationDuration: this.options.animationDuration, 6952 threshold: this.options.threshold, 6953 offset: this.options.offset 6954 }; 6955 6956 __WEBPACK_IMPORTED_MODULE_3__foundation_smoothScroll__["a" /* SmoothScroll */].scrollToLoc(loc, options, function () { 6957 _this._inTransition = false;
6958 _this._updateActive(); 6959 }); 6960 } 6961 6962 /** 6963 * Calls necessary functions to update Magellan upon DOM change 6964 * @function 6965 */ 6966 6967 }, { 6968 key: 'reflow', 6969 value: function reflow() { 6970 this.calcPoints(); 6971 this._updateActive(); 6972 } 6973 6974 /** 6975 * Updates the visibility of an active location link, and updates the url hash for the page, if deepLinking enabled. 6976 * @private 6977 * @function 6978 * @fires Magellan#update 6979 */ 6980 6981 }, { 6982 key: '_updateActive', 6983 value: function _updateActive() /*evt, elem, scrollPos*/{ 6984 if (this._inTransition) { 6985 return; 6986 } 6987 var winPos = /*scrollPos ||*/parseInt(window.pageYOffset, 10), 6988 curIdx; 6989 6990 if (winPos + this.winHeight === this.docHeight) { 6991 curIdx = this.points.length - 1; 6992 } else if (winPos < this.points[0]) { 6993 curIdx = undefined; 6994 } else { 6995 var isDown = this.scrollPos < winPos, 6996 _this = this, 6997 curVisible = this.points.filter(function (p, i) { 6998 return isDown ? p - _this.options.offset <= winPos : p - _this.options.offset - _this.options.threshold <= winPos; 6999 }); 7000 curIdx = curVisible.length ? curVisible.length - 1 : 0; 7001 } 7002 7003 this.$active.removeClass(this.options.activeClass); 7004 this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass); 7005 7006 if (this.options.deepLinking) { 7007 var hash = ""; 7008 if (curIdx != undefined) { 7009 hash = this.$active[0].getAttribute('href'); 7010 } 7011 if (hash !== window.location.hash) { 7012 if (window.history.pushState) { 7013 window.history.pushState(null, null, hash); 7014 } else { 7015 window.location.hash = hash; 7016 } 7017 } 7018 } 7019 7020 this.scrollPos = winPos; 7021 /** 7022 * Fires when magellan is finished updating to the new active element. 7023 * @event Magellan#update 7024 */ 7025 this.$element.trigger('update.zf.magellan', [this.$active]); 7026 } 7027 7028 /** 7029 * Destroys an instance of Magellan and resets the url of the window. 7030 * @function 7031 */ 7032 7033 }, { 7034 key: '_destroy', 7035 value: function _destroy() { 7036 this.$element.off('.zf.trigger .zf.magellan').find('.' + this.options.activeClass).removeClass(this.options.activeClass); 7037 7038 if (this.options.deepLinking) { 7039 var hash = this.$active[0].getAttribute('href'); 7040 window.location.hash.replace(hash, ''); 7041 } 7042 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('popstate', this._deepLinkScroll); 7043 } 7044 }]); 7045 7046 return Magellan; 7047}(__WEBPACK_IMPORTED_MODULE_2__foundation_plugin__["a" /* Plugin */]); 7048 7049/** 7050 * Default settings for plugin 7051 */ 7052 7053 7054Magellan.defaults = { 7055 /** 7056 * Amount of time, in ms, the animated scrolling should take between locations. 7057 * @option 7058 * @type {number} 7059 * @default 500 7060 */ 7061 animationDuration: 500, 7062 /** 7063 * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`. 7064 * @option 7065 * @type {string} 7066 * @default 'linear' 7067 * @see {@link https://api.jquery.com/animate|Jquery animate} 7068 */ 7069 animationEasing: 'linear', 7070 /** 7071 * Number of pixels to use as a marker for location changes. 7072 * @option 7073 * @type {number} 7074 * @default 50 7075 */ 7076 threshold: 50, 7077 /** 7078 * Class applied to the active locations link on the magellan container. 7079 * @option 7080 * @type {string} 7081 * @default 'is-active' 7082 */ 7083 activeClass: 'is-active', 7084 /** 7085 * Allows the script to manipulate the url of the current page, and if supported, alter the history. 7086 * @option 7087 * @type {boolean} 7088 * @default false 7089 */ 7090 deepLinking: false, 7091 /** 7092 * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar. 7093 * @option 7094 * @type {number} 7095 * @default 0 7096 */ 7097 offset: 0 7098}; 7099 7100 7101 7102/***/ }), 7103/* 23 */ 7104/***/ (function(module, __webpack_exports__, __webpack_require__) { 7105 7106"use strict"; 7107/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OffCanvas; }); 7108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 7109/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 7110/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 7111/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__ = __webpack_require__(3); 7112/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_core__ = __webpack_require__(1); 7113/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_plugin__ = __webpack_require__(2); 7114/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_util_triggers__ = __webpack_require__(5); 7115 7116 7117var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 7118 7119function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7120 7121function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 7122 7123function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
7123onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133/** 7134 * OffCanvas module. 7135 * @module foundation.offcanvas 7136 * @requires foundation.util.keyboard 7137 * @requires foundation.util.mediaQuery 7138 * @requires foundation.util.triggers 7139 */ 7140 7141var OffCanvas = function (_Plugin) { 7142 _inherits(OffCanvas, _Plugin); 7143 7144 function OffCanvas() { 7145 _classCallCheck(this, OffCanvas); 7146 7147 return _possibleConstructorReturn(this, (OffCanvas.__proto__ || Object.getPrototypeOf(OffCanvas)).apply(this, arguments)); 7148 } 7149 7150 _createClass(OffCanvas, [{ 7151 key: '_setup', 7152 7153 /** 7154 * Creates a new instance of an off-canvas wrapper. 7155 * @class 7156 * @name OffCanvas 7157 * @fires OffCanvas#init 7158 * @param {Object} element - jQuery object to initialize. 7159 * @param {Object} options - Overrides to the default plugin settings. 7160 */ 7161 value: function _setup(element, options) { 7162 var _this3 = this; 7163 7164 this.className = 'OffCanvas'; // ie9 back compat 7165 this.$element = element; 7166 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, OffCanvas.defaults, this.$element.data(), options); 7167 this.contentClasses = { base: [], reveal: [] }; 7168 this.$lastTrigger = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(); 7169 this.$triggers = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(); 7170 this.position = 'left'; 7171 this.$content = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(); 7172 this.nested = !!this.options.nested; 7173 7174 // Defines the CSS transition/position classes of the off-canvas content container. 7175 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(['push', 'overlap']).each(function (index, val) { 7176 _this3.contentClasses.base.push('has-transition-' + val); 7177 }); 7178 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(['left', 'right', 'top', 'bottom']).each(function (index, val) { 7179 _this3.contentClasses.base.push('has-position-' + val); 7180 _this3.contentClasses.reveal.push('has-reveal-' + val); 7181 }); 7182 7183 // Triggers init is idempotent, just need to make sure it is initialized 7184 __WEBPACK_IMPORTED_MODULE_5__foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 7185 __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 7186 7187 this._init(); 7188 this._events(); 7189 7190 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('OffCanvas', { 7191 'ESCAPE': 'close' 7192 }); 7193 } 7194 7195 /** 7196 * Initializes the off-canvas wrapper by adding the exit overlay (if needed). 7197 * @function 7198 * @private 7199 */ 7200 7201 }, { 7202 key: '_init', 7203 value: function _init() { 7204 var id = this.$element.attr('id'); 7205 7206 this.$element.attr('aria-hidden', 'true'); 7207 7208 // Find off-canvas content, either by ID (if specified), by siblings or by closest selector (fallback) 7209 if (this.options.contentId) { 7210 this.$content = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + this.options.contentId); 7211 } else if (this.$element.siblings('[data-off-canvas-content]').length) { 7212 this.$content = this.$element.siblings('[data-off-canvas-content]').first(); 7213 } else { 7214 this.$content = this.$element.closest('[data-off-canvas-content]').first(); 7215 } 7216 7217 if (!this.options.contentId) { 7218 // Assume that the off-canvas element is nested if it isn't a sibling of the content 7219 this.nested = this.$element.siblings('[data-off-canvas-content]').length === 0; 7220 } else if (this.options.contentId && this.options.nested === null) { 7221 // Warning if using content ID without setting the nested option 7222 // Once the element is nested it is required to work properly in this case 7223 console.warn('Remember to use the nested option if using the content ID option!'); 7224 } 7225 7226 if (this.nested === true) { 7227 // Force transition overlap if nested 7228 this.options.transition = 'overlap'; 7229 // Remove appropriate classes if already assigned in markup 7230 this.$element.removeClass('is-transition-push'); 7231 } 7232 7233 this.$element.addClass('is-transition-' + this.options.transition + ' is-closed'); 7234 7235 // Find triggers that affect this element and add aria-expanded to them 7236 this.$triggers = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(document).find('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-expanded', 'false').attr('aria-controls', id); 7237 7238 // Get position by checking for related CSS class 7239 this.position = this.$element.is('.position-left, .position-top, .position-right, .position-bottom') ? this.$element.attr('class').match(/position\-(left|top|right|bottom)/)[1] : this.position; 7240 7241 // Add an overlay over the content if necessary 7242 if (this.options.contentOverlay === true) {
7243 var overlay = document.createElement('div'); 7244 var overlayPosition = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.$element).css("position") === 'fixed' ? 'is-overlay-fixed' : 'is-overlay-absolute'; 7245 overlay.setAttribute('class', 'js-off-canvas-overlay ' + overlayPosition); 7246 this.$overlay = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(overlay); 7247 if (overlayPosition === 'is-overlay-fixed') { 7248 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.$overlay).insertAfter(this.$element); 7249 } else { 7250 this.$content.append(this.$overlay); 7251 } 7252 } 7253 7254 this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className); 7255 7256 if (this.options.isRevealed === true) { 7257 this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2]; 7258 this._setMQChecker(); 7259 } 7260 7261 if (this.options.transitionTime) { 7262 this.$element.css('transition-duration', this.options.transitionTime); 7263 } 7264 7265 // Initally remove all transition/position CSS classes from off-canvas content container. 7266 this._removeContentClasses(); 7267 } 7268 7269 /** 7270 * Adds event handlers to the off-canvas wrapper and the exit overlay. 7271 * @function 7272 * @private 7273 */ 7274 7275 }, { 7276 key: '_events', 7277 value: function _events() { 7278 this.$element.off('.zf.trigger .zf.offcanvas').on({ 7279 'open.zf.trigger': this.open.bind(this), 7280 'close.zf.trigger': this.close.bind(this), 7281 'toggle.zf.trigger': this.toggle.bind(this), 7282 'keydown.zf.offcanvas': this._handleKeyboard.bind(this) 7283 }); 7284 7285 if (this.options.closeOnClick === true) { 7286 var $target = this.options.contentOverlay ? this.$overlay : this.$content; 7287 $target.on({ 'click.zf.offcanvas': this.close.bind(this) }); 7288 } 7289 } 7290 7291 /** 7292 * Applies event listener for elements that will reveal at certain breakpoints. 7293 * @private 7294 */ 7295 7296 }, { 7297 key: '_setMQChecker', 7298 value: function _setMQChecker() { 7299 var _this = this; 7300 7301 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('changed.zf.mediaquery', function () { 7302 if (__WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */].atLeast(_this.options.revealOn)) { 7303 _this.reveal(true); 7304 } else { 7305 _this.reveal(false); 7306 } 7307 }).one('load.zf.offcanvas', function () { 7308 if (__WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */].atLeast(_this.options.revealOn)) { 7309 _this.reveal(true); 7310 } 7311 }); 7312 } 7313 7314 /** 7315 * Removes the CSS transition/position classes of the off-canvas content container. 7316 * Removing the classes is important when another off-canvas gets opened that uses the same content container. 7317 * @param {Boolean} hasReveal - true if related off-canvas element is revealed. 7318 * @private 7319 */ 7320 7321 }, { 7322 key: '_removeContentClasses', 7323 value: function _removeContentClasses(hasReveal) { 7324 if (typeof hasReveal !== 'boolean') { 7325 this.$content.removeClass(this.contentClasses.base.join(' ')); 7326 } else if (hasReveal === false) { 7327 this.$content.removeClass('has-reveal-' + this.position); 7328 } 7329 } 7330 7331 /** 7332 * Adds the CSS transition/position classes of the off-canvas content container, based on the opening off-canvas element. 7333 * Beforehand any transition/position class gets removed. 7334 * @param {Boolean} hasReveal - true if related off-canvas element is revealed. 7335 * @private 7336 */ 7337 7338 }, { 7339 key: '_addContentClasses', 7340 value: function _addContentClasses(hasReveal) { 7341 this._removeContentClasses(hasReveal); 7342 if (typeof hasReveal !== 'boolean') { 7343 this.$content.addClass('has-transition-' + this.options.transition + ' has-position-' + this.position); 7344 } else if (hasReveal === true) { 7345 this.$content.addClass('has-reveal-' + this.position); 7346 } 7347 } 7348 7349 /**
7350 * Handles the revealing/hiding the off-canvas at breakpoints, not the same as open. 7351 * @param {Boolean} isRevealed - true if element should be revealed. 7352 * @function 7353 */ 7354 7355 }, { 7356 key: 'reveal', 7357 value: function reveal(isRevealed) { 7358 if (isRevealed) { 7359 this.close(); 7360 this.isRevealed = true; 7361 this.$element.attr('aria-hidden', 'false'); 7362 this.$element.off('open.zf.trigger toggle.zf.trigger'); 7363 this.$element.removeClass('is-closed'); 7364 } else { 7365 this.isRevealed = false; 7366 this.$element.attr('aria-hidden', 'true'); 7367 this.$element.off('open.zf.trigger toggle.zf.trigger').on({ 7368 'open.zf.trigger': this.open.bind(this), 7369 'toggle.zf.trigger': this.toggle.bind(this) 7370 }); 7371 this.$element.addClass('is-closed'); 7372 } 7373 this._addContentClasses(isRevealed); 7374 } 7375 7376 /** 7377 * Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers. 7378 * @private 7379 */ 7380 7381 }, { 7382 key: '_stopScrolling', 7383 value: function _stopScrolling(event) { 7384 return false; 7385 } 7386 7387 // Taken and adapted from http://stackoverflow.com/questions/16889447/prevent-full-page-scrolling-ios 7388 // Only really works for y, not sure how to extend to x or if we need to. 7389 7390 }, { 7391 key: '_recordScrollable', 7392 value: function _recordScrollable(event) { 7393 var elem = this; // called from event handler context with this as elem 7394 7395 // If the element is scrollable (content overflows), then... 7396 if (elem.scrollHeight !== elem.clientHeight) { 7397 // If we're at the top, scroll down one pixel to allow scrolling up 7398 if (elem.scrollTop === 0) { 7399 elem.scrollTop = 1; 7400 } 7401 // If we're at the bottom, scroll up one pixel to allow scrolling down 7402 if (elem.scrollTop === elem.scrollHeight - elem.clientHeight) { 7403 elem.scrollTop = elem.scrollHeight - elem.clientHeight - 1; 7404 } 7405 } 7406 elem.allowUp = elem.scrollTop > 0; 7407 elem.allowDown = elem.scrollTop < elem.scrollHeight - elem.clientHeight; 7408 elem.lastY = event.originalEvent.pageY; 7409 } 7410 }, { 7411 key: '_stopScrollPropagation', 7412 value: function _stopScrollPropagation(event) { 7413 var elem = this; // called from event handler context with this as elem 7414 var up = event.pageY < elem.lastY; 7415 var down = !up; 7416 elem.lastY = event.pageY; 7417 7418 if (up && elem.allowUp || down && elem.allowDown) { 7419 event.stopPropagation(); 7420 } else { 7421 event.preventDefault(); 7422 } 7423 } 7424 7425 /** 7426 * Opens the off-canvas menu. 7427 * @function 7428 * @param {Object} event - Event object passed from listener. 7429 * @param {jQuery} trigger - element that triggered the off-canvas to open. 7430 * @fires OffCanvas#opened 7431 */ 7432 7433 }, { 7434 key: 'open', 7435 value: function open(event, trigger) { 7436 if (this.$element.hasClass('is-open') || this.isRevealed) { 7437 return; 7438 } 7439 var _this = this; 7440 7441 if (trigger) { 7442 this.$lastTrigger = trigger; 7443 } 7444 7445 if (this.options.forceTo === 'top') { 7446 window.scrollTo(0, 0); 7447 } else if (this.options.forceTo === 'bottom') { 7448 window.scrollTo(0, document.body.scrollHeight); 7449 } 7450 7451 if (this.options.transitionTime && this.options.transition !== 'overlap') { 7452 this.$element.siblings('[data-off-canvas-content]').css('transition-duration', this.options.transitionTime); 7453 } else { 7454 this.$element.siblings('[data-off-canvas-content]').css('transition-duration', ''); 7455 } 7456 7457 /** 7458 * Fires when the off-canvas menu opens. 7459 * @event OffCanvas#opened 7460 */ 7461 this.$element.addClass('is-open').removeClass('is-closed'); 7462 7463 this.$triggers.attr('aria-expanded', 'true'); 7464 this.$element.attr('aria-hidden', 'false').trigger('opened.zf.offcanvas'); 7465 7466 this.$content.addClass('is-open-' + this.position); 7467 7468 // If `contentScroll` is set to false, add class and disable scrolling on touch devices. 7469 if (this.options.contentScroll === false) { 7470 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').addClass('is-off-canvas-open').on('touchmove', this._stopScrolling); 7471 this.$element.on('touchstart', this._recordScrollable); 7472 this.$element.on('touchmove', this._stopScrollPropagation); 7473 } 7474 7475 if (this.options.contentOverlay === true) { 7476 this.$overlay.addClass('is-visible'); 7477 } 7478 7479 if (this.options.closeOnClick === true && this.options.contentOverlay === true) { 7480 this.$overlay.addClass('is-closable'); 7481 } 7482 7483 if (this.options.autoFocus === true) { 7484 this.$element.one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["c" /* transitionend */])(this.$element), function () { 7485 if (!_this.$element.hasClass('is-open')) { 7486 return; // exit if prematurely closed 7487 } 7488 var canvasFocus = _this.$element.find('[data-autofocus]'); 7489 if (canvasFocus.length) { 7490 canvasFocus.eq(0).focus(); 7491 } else { 7492 _this.$element.find('a, button').eq(0).focus(); 7493 } 7494 }); 7495 } 7496 7497 if (this.options.trapFocus === true) { 7498 this.$content.attr('tabindex', '-1'); 7499 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].trapFocus(this.$element); 7500 } 7501 7502 this._addContentClasses(); 7503 } 7504 7505 /** 7506 * Closes the off-canvas menu. 7507 * @function 7508 * @param {Function} cb - optional cb to fire after closure. 7509 * @fires OffCanvas#closed 7510 */ 7511 7512 }, { 7513 key: 'close', 7514 value: function close(cb) { 7515 if (!this.$element.hasClass('is-open') || this.isRevealed) { 7516 return; 7517 } 7518 7519 var _this = this; 7520 7521 this.$element.removeClass('is-open'); 7522 7523 this.$element.attr('aria-hidden', 'true') 7524 /** 7525 * Fires when the off-canvas menu opens. 7526 * @event OffCanvas#closed 7527 */ 7528 .trigger('closed.zf.offcanvas'); 7529 7530 this.$content.removeClass('is-open-left is-open-top is-open-right is-open-bottom'); 7531 7532 // If `contentScroll` is set to false, remove class and re-enable scrolling on touch devices. 7533 if (this.options.contentScroll === false) { 7534 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').removeClass('is-off-canvas-open').off('touchmove', this._stopScrolling); 7535 this.$element.off('touchstart', this._recordScrollable); 7536 this.$element.off('touchmove', this._stopScrollPropagation); 7537 } 7538 7539 if (this.options.contentOverlay === true) { 7540 this.$overlay.removeClass('is-visible'); 7541 } 7542 7543 if (this.options.closeOnClick === true && this.options.contentOverlay === true) { 7544 this.$overlay.removeClass('is-closable'); 7545 } 7546 7547 this.$triggers.attr('aria-expanded', 'false'); 7548 7549 if (this.options.trapFocus === true) { 7550 this.$content.removeAttr('tabindex'); 7551 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].releaseFocus(this.$element); 7552 } 7553 7554 // Listen to transitionEnd and add class when done. 7555 this.$element.one(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["c" /* transitionend */])(this.$element), function (e) { 7556 _this.$element.addClass('is-closed'); 7557 _this._removeContentClasses(); 7558 }); 7559 } 7560 7561 /** 7562 * Toggles the off-canvas menu open or closed. 7563 * @function 7564 * @param {Object} event - Event object passed from listener. 7565 * @param {jQuery} trigger - element that triggered the off-canvas to open. 7566 */ 7567 7568 }, { 7569 key: 'toggle', 7570 value: function toggle(event, trigger) { 7571 if (this.$element.hasClass('is-open')) { 7572 this.close(event, trigger); 7573 } else { 7574 this.open(event, trigger); 7575 } 7576 } 7577 7578 /** 7579 * Handles keyboard input when detected. When the escape key is pressed, the off-canvas menu closes, and focus is restored to the element that opened the menu. 7580 * @function 7581 * @private 7582 */ 7583 7584 }, { 7585 key: '_handleKeyboard', 7586 value: function _handleKeyboard(e) { 7587 var _this4 = this; 7588 7589 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'OffCanvas', { 7590 close: function () { 7591 _this4.close(); 7592 _this4.$lastTrigger.focus(); 7593 return true; 7594 }, 7595 handled: function () { 7596 e.stopPropagation(); 7597 e.preventDefault(); 7598 } 7599 }); 7600 } 7601 7602 /** 7603 * Destroys the offcanvas plugin. 7604 * @function 7605 */ 7606 7607 }, { 7608 key: '_destroy', 7609 value: function _destroy() { 7610 this.close(); 7611 this.$element.off('.zf.trigger .zf.offcanvas'); 7612 this.$overlay.off('.zf.offcanvas'); 7613 } 7614 }]); 7615 7616 return OffCanvas; 7617}(__WEBPACK_IMPORTED_MODULE_4__foundation_plugin__["a" /* Plugin */]); 7618 7619OffCanvas.defaults = { 7620 /** 7621 * Allow the user to click outside of the menu to close it. 7622 * @option 7623 * @type {boolean} 7624 * @default true 7625 */ 7626 closeOnClick: true, 7627 7628 /** 7629 * Adds an overlay on top of `[data-off-canvas-content]`. 7630 * @option 7631 * @type {boolean} 7632 * @default true 7633 */ 7634 contentOverlay: true, 7635 7636 /** 7637 * Target an off-canvas content container by ID that may be placed anywhere. If null the closest content container will be taken. 7638 * @option 7639 * @type {?string} 7640 * @default null 7641 */ 7642 contentId: null, 7643 7644 /** 7645 * Define the off-canvas element is nested in an off-canvas content. This is required when using the contentId option for a nested element. 7646 * @option 7647 * @type {boolean} 7648 * @default null 7649 */ 7650 nested: null, 7651 7652 /** 7653 * Enable/disable scrolling of the main content when an off canvas panel is open. 7654 * @option 7655 * @type {boolean} 7656 * @default true 7657 */ 7658 contentScroll: true, 7659 7660 /** 7661 * Amount of time in ms the open and close transition requires. If none selected, pulls from body style. 7662 * @option 7663 * @type {number} 7664 * @default null 7665 */ 7666 transitionTime: null, 7667 7668 /**
7669 * Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'. 7670 * @option 7671 * @type {string} 7672 * @default push 7673 */ 7674 transition: 'push', 7675 7676 /** 7677 * Force the page to scroll to top or bottom on open. 7678 * @option 7679 * @type {?string} 7680 * @default null 7681 */ 7682 forceTo: null, 7683 7684 /** 7685 * Allow the offcanvas to remain open for certain breakpoints. 7686 * @option 7687 * @type {boolean} 7688 * @default false 7689 */ 7690 isRevealed: false, 7691 7692 /** 7693 * Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option. 7694 * @option 7695 * @type {?string} 7696 * @default null 7697 */ 7698 revealOn: null, 7699 7700 /** 7701 * Force focus to the offcanvas on open. If true, will focus the opening trigger on close. 7702 * @option 7703 * @type {boolean} 7704 * @default true 7705 */ 7706 autoFocus: true, 7707 7708 /** 7709 * Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`. 7710 * @option 7711 * @type {string} 7712 * @default reveal-for- 7713 * @todo improve the regex testing for this. 7714 */ 7715 revealClass: 'reveal-for-', 7716 7717 /** 7718 * Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes. 7719 * @option 7720 * @type {boolean} 7721 * @default false 7722 */ 7723 trapFocus: false 7724}; 7725 7726 7727 7728/***/ }), 7729/* 24 */ 7730/***/ (function(module, __webpack_exports__, __webpack_require__) { 7731 7732"use strict"; 7733/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Orbit; }); 7734/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 7735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 7736/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 7737/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_motion__ = __webpack_require__(6); 7738/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_timer__ = __webpack_require__(34); 7739/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_util_imageLoader__ = __webpack_require__(8); 7740/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_util_core__ = __webpack_require__(1); 7741/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__foundation_plugin__ = __webpack_require__(2); 7742/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__foundation_util_touch__ = __webpack_require__(16); 7743 7744 7745var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 7746 7747function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7748 7749function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 7750 7751function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762/** 7763 * Orbit module. 7764 * @module foundation.orbit 7765 * @requires foundation.util.keyboard 7766 * @requires foundation.util.motion 7767 * @requires foundation.util.timer 7768 * @requires foundation.util.imageLoader 7769 * @requires foundation.util.touch 7770 */ 7771 7772var Orbit = function (_Plugin) { 7773 _inherits(Orbit, _Plugin); 7774 7775 function Orbit() { 7776 _classCallCheck(this, Orbit); 7777 7778 return _possibleConstructorReturn(this, (Orbit.__proto__ || Object.getPrototypeOf(Orbit)).apply(this, arguments)); 7779 } 7780 7781 _createClass(Orbit, [{ 7782 key: '_setup', 7783 7784 /** 7785 * Creates a new instance of an orbit carousel. 7786 * @class 7787 * @name Orbit 7788 * @param {jQuery} element - jQuery object to make into an Orbit Carousel. 7789 * @param {Object} options - Overrides to the default plugin settings. 7790 */ 7791 value: function _setup(element, options) { 7792 this.$element = element; 7793 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Orbit.defaults, this.$element.data(), options); 7794 this.className = 'Orbit'; // ie9 back compat 7795 7796 __WEBPACK_IMPORTED_MODULE_7__foundation_util_touch__["a" /* Touch */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); // Touch init is idempotent, we just need to make sure it's initialied.
vendor: 9,820 bytes, lines 7797-8110
7797 7798 this._init(); 7799 7800 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('Orbit', { 7801 'ltr': { 7802 'ARROW_RIGHT': 'next', 7803 'ARROW_LEFT': 'previous' 7804 }, 7805 'rtl': { 7806 'ARROW_LEFT': 'next', 7807 'ARROW_RIGHT': 'previous' 7808 } 7809 }); 7810 } 7811 7812 /** 7813 * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation. 7814 * @function 7815 * @private 7816 */ 7817 7818 }, { 7819 key: '_init', 7820 value: function _init() { 7821 // @TODO: consider discussion on PR #9278 about DOM pollution by changeSlide 7822 this._reset(); 7823 7824 this.$wrapper = this.$element.find('.' + this.options.containerClass); 7825 this.$slides = this.$element.find('.' + this.options.slideClass); 7826 7827 var $images = this.$element.find('img'), 7828 initActive = this.$slides.filter('.is-active'), 7829 id = this.$element[0].id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__foundation_util_core__["a" /* GetYoDigits */])(6, 'orbit'); 7830 7831 this.$element.attr({ 7832 'data-resize': id, 7833 'id': id 7834 }); 7835 7836 if (!initActive.length) { 7837 this.$slides.eq(0).addClass('is-active'); 7838 } 7839 7840 if (!this.options.useMUI) { 7841 this.$slides.addClass('no-motionui'); 7842 } 7843 7844 if ($images.length) { 7845 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__foundation_util_imageLoader__["a" /* onImagesLoaded */])($images, this._prepareForOrbit.bind(this)); 7846 } else { 7847 this._prepareForOrbit(); //hehe 7848 } 7849 7850 if (this.options.bullets) { 7851 this._loadBullets(); 7852 } 7853 7854 this._events(); 7855 7856 if (this.options.autoPlay && this.$slides.length > 1) { 7857 this.geoSync(); 7858 } 7859 7860 if (this.options.accessible) { 7861 // allow wrapper to be focusable to enable arrow navigation 7862 this.$wrapper.attr('tabindex', 0); 7863 } 7864 } 7865 7866 /** 7867 * Creates a jQuery collection of bullets, if they are being used. 7868 * @function 7869 * @private 7870 */ 7871 7872 }, { 7873 key: '_loadBullets', 7874 value: function _loadBullets() { 7875 this.$bullets = this.$element.find('.' + this.options.boxOfBullets).find('button'); 7876 } 7877 7878 /** 7879 * Sets a `timer` object on the orbit, and starts the counter for the next slide. 7880 * @function 7881 */ 7882 7883 }, { 7884 key: 'geoSync', 7885 value: function geoSync() { 7886 var _this = this; 7887 this.timer = new __WEBPACK_IMPORTED_MODULE_3__foundation_util_timer__["a" /* Timer */](this.$element, { 7888 duration: this.options.timerDelay, 7889 infinite: false 7890 }, function () { 7891 _this.changeSlide(true); 7892 }); 7893 this.timer.start(); 7894 } 7895 7896 /** 7897 * Sets wrapper and slide heights for the orbit. 7898 * @function 7899 * @private 7900 */ 7901 7902 }, { 7903 key: '_prepareForOrbit', 7904 value: function _prepareForOrbit() { 7905 var _this = this; 7906 this._setWrapperHeight(); 7907 } 7908 7909 /** 7910 * Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height. 7911 * @function 7912 * @private 7913 * @param {Function} cb - a callback function to fire when complete. 7914 */ 7915 7916 }, { 7917 key: '_setWrapperHeight', 7918 value: function _setWrapperHeight(cb) { 7919 //rewrite this to `for` loop 7920 var max = 0, 7921 temp, 7922 counter = 0, 7923 _this = this; 7924 7925 this.$slides.each(function () { 7926 temp = this.getBoundingClientRect().height; 7927 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).attr('data-slide', counter); 7928 7929 if (!/mui/g.test(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)[0].className) && _this.$slides.filter('.is-active')[0] !== _this.$slides.eq(counter)[0]) { 7930 //if not the active slide, set css position and display property 7931 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).css({ 'position': 'relative', 'display': 'none' }); 7932 } 7933 max = temp > max ? temp : max; 7934 counter++; 7935 }); 7936 7937 if (counter === this.$slides.length) { 7938 this.$wrapper.css({ 'height': max }); //only change the wrapper height property once. 7939 if (cb) { 7940 cb(max); 7941 } //fire callback with max height dimension. 7942 } 7943 } 7944 7945 /** 7946 * Sets the max-height of each slide. 7947 * @function 7948 * @private 7949 */ 7950 7951 }, { 7952 key: '_setSlideHeight', 7953 value: function _setSlideHeight(height) { 7954 this.$slides.each(function () { 7955 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).css('max-height', height); 7956 }); 7957 } 7958 7959 /** 7960 * Adds event listeners to basically everything within the element. 7961 * @function 7962 * @private 7963 */ 7964 7965 }, { 7966 key: '_events', 7967 value: function _events() { 7968 var _this = this; 7969 7970 //*************************************** 7971 //**Now using custom event - thanks to:** 7972 //** Yohai Ararat of Toronto ** 7973 //*************************************** 7974 // 7975 this.$element.off('.resizeme.zf.trigger').on({ 7976 'resizeme.zf.trigger': this._prepareForOrbit.bind(this) 7977 }); 7978 if (this.$slides.length > 1) { 7979 7980 if (this.options.swipe) { 7981 this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit').on('swipeleft.zf.orbit', function (e) { 7982 e.preventDefault(); 7983 _this.changeSlide(true); 7984 }).on('swiperight.zf.orbit', function (e) { 7985 e.preventDefault(); 7986 _this.changeSlide(false); 7987 }); 7988 } 7989 //*************************************** 7990 7991 if (this.options.autoPlay) { 7992 this.$slides.on('click.zf.orbit', function () { 7993 _this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true); 7994 _this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start'](); 7995 }); 7996 7997 if (this.options.pauseOnHover) { 7998 this.$element.on('mouseenter.zf.orbit', function () { 7999 _this.timer.pause(); 8000 }).on('mouseleave.zf.orbit', function () { 8001 if (!_this.$element.data('clickedOn')) { 8002 _this.timer.start(); 8003 } 8004 }); 8005 } 8006 } 8007 8008 if (this.options.navButtons) { 8009 var $controls = this.$element.find('.' + this.options.nextClass + ', .' + this.options.prevClass); 8010 $controls.attr('tabindex', 0) 8011 //also need to handle enter/return and spacebar key presses 8012 .on('click.zf.orbit touchend.zf.orbit', function (e) { 8013 e.preventDefault(); 8014 _this.changeSlide(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).hasClass(_this.options.nextClass)); 8015 }); 8016 } 8017 8018 if (this.options.bullets) { 8019 this.$bullets.on('click.zf.orbit touchend.zf.orbit', function () { 8020 if (/is-active/g.test(this.className)) { 8021 return false; 8022 } //if this is active, kick out of function. 8023 var idx = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('slide'), 8024 ltr = idx > _this.$slides.filter('.is-active').data('slide'), 8025 $slide = _this.$slides.eq(idx); 8026 8027 _this.changeSlide(ltr, $slide, idx); 8028 }); 8029 } 8030 8031 if (this.options.accessible) { 8032 this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function (e) { 8033 // handle keyboard event with keyboard util 8034 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'Orbit', { 8035 next: function () { 8036 _this.changeSlide(true); 8037 }, 8038 previous: function () { 8039 _this.changeSlide(false); 8040 }, 8041 handled: function () { 8042 // if bullet is focused, make sure focus moves 8043 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target).is(_this.$bullets)) { 8044 _this.$bullets.filter('.is-active').focus(); 8045 } 8046 } 8047 }); 8048 }); 8049 } 8050 } 8051 } 8052 8053 /** 8054 * Resets Orbit so it can be reinitialized 8055 */ 8056 8057 }, { 8058 key: '_reset', 8059 value: function _reset() { 8060 // Don't do anything if there are no slides (first run) 8061 if (typeof this.$slides == 'undefined') { 8062 return; 8063 } 8064 8065 if (this.$slides.length > 1) { 8066 // Remove old events 8067 this.$element.off('.zf.orbit').find('*').off('.zf.orbit'); 8068 8069 // Restart timer if autoPlay is enabled 8070 if (this.options.autoPlay) { 8071 this.timer.restart(); 8072 } 8073 8074 // Reset all sliddes 8075 this.$slides.each(function (el) { 8076 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(el).removeClass('is-active is-active is-in').removeAttr('aria-live').hide(); 8077 }); 8078 8079 // Show the first slide 8080 this.$slides.first().addClass('is-active').show(); 8081 8082 // Triggers when the slide has finished animating 8083 this.$element.trigger('slidechange.zf.orbit', [this.$slides.first()]); 8084 8085 // Select first bullet if bullets are present 8086 if (this.options.bullets) { 8087 this._updateBullets(0); 8088 } 8089 } 8090 } 8091 8092 /** 8093 * Changes the current slide to a new one. 8094 * @function 8095 * @param {Boolean} isLTR - flag if the slide should move left to right. 8096 * @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected. 8097 * @param {Number} idx - the index of the new slide in its collection, if one chosen. 8098 * @fires Orbit#slidechange 8099 */ 8100 8101 }, { 8102 key: 'changeSlide', 8103 value: function changeSlide(isLTR, chosenSlide, idx) { 8104 if (!this.$slides) { 8105 return; 8106 } // Don't freak out if we're in the middle of cleanup 8107 var $curSlide = this.$slides.filter('.is-active').eq(0); 8108 8109 if (/mui/g.test($curSlide[0].className)) { 8110 return false;
8111 } //if the slide is currently animating, kick out of the function 8112 8113 var $firstSlide = this.$slides.first(), 8114 $lastSlide = this.$slides.last(), 8115 dirIn = isLTR ? 'Right' : 'Left', 8116 dirOut = isLTR ? 'Left' : 'Right', 8117 _this = this, 8118 $newSlide; 8119 8120 if (!chosenSlide) { 8121 //most of the time, this will be auto played or clicked from the navButtons. 8122 $newSlide = isLTR ? //if wrapping enabled, check to see if there is a `next` or `prev` sibling, if not, select the first or last slide to fill in. if wrapping not enabled, attempt to select `next` or `prev`, if there's nothing there, the function will kick out on next step. CRAZY NESTED TERNARIES!!!!! 8123 this.options.infiniteWrap ? $curSlide.next('.' + this.options.slideClass).length ? $curSlide.next('.' + this.options.slideClass) : $firstSlide : $curSlide.next('.' + this.options.slideClass) : //pick next slide if moving left to right 8124 this.options.infiniteWrap ? $curSlide.prev('.' + this.options.slideClass).length ? $curSlide.prev('.' + this.options.slideClass) : $lastSlide : $curSlide.prev('.' + this.options.slideClass); //pick prev slide if moving right to left 8125 } else { 8126 $newSlide = chosenSlide; 8127 } 8128 8129 if ($newSlide.length) { 8130 /** 8131 * Triggers before the next slide starts animating in and only if a next slide has been found. 8132 * @event Orbit#beforeslidechange 8133 */ 8134 this.$element.trigger('beforeslidechange.zf.orbit', [$curSlide, $newSlide]); 8135 8136 if (this.options.bullets) { 8137 idx = idx || this.$slides.index($newSlide); //grab index to update bullets 8138 this._updateBullets(idx); 8139 } 8140 8141 if (this.options.useMUI && !this.$element.is(':hidden')) { 8142 __WEBPACK_IMPORTED_MODULE_2__foundation_util_motion__["a" /* Motion */].animateIn($newSlide.addClass('is-active').css({ 'position': 'absolute', 'top': 0 }), this.options['animInFrom' + dirIn], function () { 8143 $newSlide.css({ 'position': 'relative', 'display': 'block' }).attr('aria-live', 'polite'); 8144 }); 8145 8146 __WEBPACK_IMPORTED_MODULE_2__foundation_util_motion__["a" /* Motion */].animateOut($curSlide.removeClass('is-active'), this.options['animOutTo' + dirOut], function () { 8147 $curSlide.removeAttr('aria-live'); 8148 if (_this.options.autoPlay && !_this.timer.isPaused) { 8149 _this.timer.restart(); 8150 } 8151 //do stuff? 8152 }); 8153 } else { 8154 $curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide(); 8155 $newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show(); 8156 if (this.options.autoPlay && !this.timer.isPaused) { 8157 this.timer.restart(); 8158 } 8159 } 8160 /** 8161 * Triggers when the slide has finished animating in. 8162 * @event Orbit#slidechange 8163 */ 8164 this.$element.trigger('slidechange.zf.orbit', [$newSlide]); 8165 } 8166 } 8167 8168 /** 8169 * Updates the active state of the bullets, if displayed. 8170 * @function 8171 * @private 8172 * @param {Number} idx - the index of the current slide. 8173 */ 8174 8175 }, { 8176 key: '_updateBullets', 8177 value: function _updateBullets(idx) { 8178 var $oldBullet = this.$element.find('.' + this.options.boxOfBullets).find('.is-active').removeClass('is-active').blur(), 8179 span = $oldBullet.find('span:last').detach(), 8180 $newBullet = this.$bullets.eq(idx).addClass('is-active').append(span); 8181 } 8182 8183 /** 8184 * Destroys the carousel and hides the element. 8185 * @function 8186 */ 8187 8188 }, { 8189 key: '_destroy', 8190 value: function _destroy() { 8191 this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide(); 8192 } 8193 }]); 8194 8195 return Orbit; 8196}(__WEBPACK_IMPORTED_MODULE_6__foundation_plugin__["a" /* Plugin */]); 8197 8198Orbit.defaults = { 8199 /** 8200 * Tells the JS to look for and loadBullets. 8201 * @option 8202 * @type {boolean} 8203 * @default true 8204 */ 8205 bullets: true, 8206 /** 8207 * Tells the JS to apply event listeners to nav buttons 8208 * @option 8209 * @type {boolean} 8210 * @default true 8211 */ 8212 navButtons: true, 8213 /** 8214 * motion-ui animation class to apply 8215 * @option 8216 * @type {string} 8217 * @default 'slide-in-right' 8218 */ 8219 animInFromRight: 'slide-in-right', 8220 /** 8221 * motion-ui animation class to apply 8222 * @option 8223 * @type {string} 8224 * @default 'slide-out-right' 8225 */ 8226 animOutToRight: 'slide-out-right', 8227 /** 8228 * motion-ui animation class to apply 8229 * @option 8230 * @type {string} 8231 * @default 'slide-in-left' 8232 * 8233 */ 8234 animInFromLeft: 'slide-in-left', 8235 /** 8236 * motion-ui animation class to apply 8237 * @option 8238 * @type {string} 8239 * @default 'slide-out-left' 8240 */ 8241 animOutToLeft: 'slide-out-left', 8242 /** 8243 * Allows Orbit to automatically animate on page load. 8244 * @option 8245 * @type {boolean} 8246 * @default true 8247 */ 8248 autoPlay: true, 8249 /** 8250 * Amount of time, in ms, between slide transitions 8251 * @option 8252 * @type {number} 8253 * @default 5000 8254 */ 8255 timerDelay: 5000, 8256 /** 8257 * Allows Orbit to infinitely loop through the slides 8258 * @option 8259 * @type {boolean} 8260 * @default true 8261 */ 8262 infiniteWrap: true, 8263 /** 8264 * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library 8265 * @option 8266 * @type {boolean} 8267 * @default true 8268 */ 8269 swipe: true, 8270 /** 8271 * Allows the timing function to pause animation on hover. 8272 * @option 8273 * @type {boolean} 8274 * @default true 8275 */ 8276 pauseOnHover: true, 8277 /** 8278 * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys 8279 * @option 8280 * @type {boolean} 8281 * @default true 8282 */ 8283 accessible: true, 8284 /** 8285 * Class applied to the container of Orbit 8286 * @option 8287 * @type {string} 8288 * @default 'orbit-container' 8289 */ 8290 containerClass: 'orbit-container', 8291 /** 8292 * Class applied to individual slides. 8293 * @option 8294 * @type {string} 8295 * @default 'orbit-slide' 8296 */ 8297 slideClass: 'orbit-slide', 8298 /** 8299 * Class applied to the bullet container. You're welcome. 8300 * @option 8301 * @type {string} 8302 * @default 'orbit-bullets' 8303 */ 8304 boxOfBullets: 'orbit-bullets', 8305 /** 8306 * Class applied to the `next` navigation button. 8307 * @option 8308 * @type {string} 8309 * @default 'orbit-next' 8310 */ 8311 nextClass: 'orbit-next', 8312 /** 8313 * Class applied to the `previous` navigation button. 8314 * @option 8315 * @type {string} 8316 * @default 'orbit-previous' 8317 */ 8318 prevClass: 'orbit-previous', 8319 /** 8320 * Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatability. 8321 * @option 8322 * @type {boolean} 8323 * @default true 8324 */ 8325 useMUI: true 8326}; 8327 8328 8329 8330/***/ }), 8331/* 25 */ 8332/***/ (function(module, __webpack_exports__, __webpack_require__) { 8333 8334"use strict"; 8335/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ResponsiveAccordionTabs; }); 8336/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 8337/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 8338/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__ = __webpack_require__(3); 8339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_core__ = __webpack_require__(1); 8340/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_plugin__ = __webpack_require__(2); 8341/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_accordion__ = __webpack_require__(10); 8342/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_tabs__ = __webpack_require__(14); 8343 8344 8345var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8346 8347function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8348 8349function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8350 8351function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
8351onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361// The plugin matches the plugin classes with these plugin instances. 8362var MenuPlugins = { 8363 tabs: { 8364 cssClass: 'tabs', 8365 plugin: __WEBPACK_IMPORTED_MODULE_5__foundation_tabs__["a" /* Tabs */] 8366 }, 8367 accordion: { 8368 cssClass: 'accordion', 8369 plugin: __WEBPACK_IMPORTED_MODULE_4__foundation_accordion__["a" /* Accordion */] 8370 } 8371}; 8372 8373/** 8374 * ResponsiveAccordionTabs module. 8375 * @module foundation.responsiveAccordionTabs 8376 * @requires foundation.util.motion 8377 * @requires foundation.accordion 8378 * @requires foundation.tabs 8379 */ 8380 8381var ResponsiveAccordionTabs = function (_Plugin) { 8382 _inherits(ResponsiveAccordionTabs, _Plugin); 8383 8384 function ResponsiveAccordionTabs() { 8385 _classCallCheck(this, ResponsiveAccordionTabs); 8386 8387 return _possibleConstructorReturn(this, (ResponsiveAccordionTabs.__proto__ || Object.getPrototypeOf(ResponsiveAccordionTabs)).apply(this, arguments)); 8388 } 8389 8390 _createClass(ResponsiveAccordionTabs, [{ 8391 key: '_setup', 8392 8393 /** 8394 * Creates a new instance of a responsive accordion tabs. 8395 * @class 8396 * @name ResponsiveAccordionTabs 8397 * @fires ResponsiveAccordionTabs#init 8398 * @param {jQuery} element - jQuery object to make into Responsive Accordion Tabs. 8399 * @param {Object} options - Overrides to the default plugin settings. 8400 */ 8401 value: function _setup(element, options) { 8402 this.$element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(element); 8403 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, this.$element.data(), options); 8404 this.rules = this.$element.data('responsive-accordion-tabs'); 8405 this.currentMq = null; 8406 this.currentPlugin = null; 8407 this.className = 'ResponsiveAccordionTabs'; // ie9 back compat 8408 if (!this.$element.attr('id')) { 8409 this.$element.attr('id', __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_core__["a" /* GetYoDigits */])(6, 'responsiveaccordiontabs')); 8410 }; 8411 8412 this._init(); 8413 this._events(); 8414 } 8415 8416 /** 8417 * Initializes the Menu by parsing the classes from the 'data-responsive-accordion-tabs' attribute on the element. 8418 * @function 8419 * @private 8420 */ 8421 8422 }, { 8423 key: '_init', 8424 value: function _init() { 8425 __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 8426 8427 // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules 8428 if (typeof this.rules === 'string') { 8429 var rulesTree = {}; 8430 8431 // Parse rules from "classes" pulled from data attribute 8432 var rules = this.rules.split(' '); 8433 8434 // Iterate through every rule found 8435 for (var i = 0; i < rules.length; i++) { 8436 var rule = rules[i].split('-'); 8437 var ruleSize = rule.length > 1 ? rule[0] : 'small'; 8438 var rulePlugin = rule.length > 1 ? rule[1] : rule[0]; 8439 8440 if (MenuPlugins[rulePlugin] !== null) { 8441 rulesTree[ruleSize] = MenuPlugins[rulePlugin]; 8442 } 8443 } 8444 8445 this.rules = rulesTree; 8446 } 8447 8448 this._getAllOptions(); 8449 8450 if (!__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.isEmptyObject(this.rules)) { 8451 this._checkMediaQueries(); 8452 } 8453 } 8454 }, { 8455 key: '_getAllOptions', 8456 value: function _getAllOptions() { 8457 //get all defaults and options 8458 var _this = this; 8459 _this.allOptions = {}; 8460 for (var key in MenuPlugins) { 8461 if (MenuPlugins.hasOwnProperty(key)) { 8462 var obj = MenuPlugins[key]; 8463 try { 8464 var dummyPlugin = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('<ul></ul>'); 8465 var tmpPlugin = new obj.plugin(dummyPlugin, _this.options); 8466 for (var keyKey in tmpPlugin.options) { 8467 if (tmpPlugin.options.hasOwnProperty(keyKey) && keyKey !== 'zfPlugin') { 8468 var objObj = tmpPlugin.options[keyKey]; 8469 _this.allOptions[keyKey] = objObj; 8470 } 8471 } 8472 tmpPlugin.destroy(); 8473 } catch (e) {} 8474 } 8475 } 8476 } 8477 8478 /** 8479 * Initializes events for the Menu. 8480 * @function 8481 * @private 8482 */ 8483 8484 }, { 8485 key: '_events', 8486 value: function _events() { 8487 var _this = this; 8488 8489 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('changed.zf.mediaquery', function () { 8490 _this._checkMediaQueries(); 8491 }); 8492 } 8493 8494 /** 8495 * Checks the current screen width against available media queries. If the media query has changed, and the plugin needed has changed, the plugins will swap out. 8496 * @function 8497 * @private 8498 */ 8499 8500 }, { 8501 key: '_checkMediaQueries', 8502 value: function _checkMediaQueries() { 8503 var matchedMq, 8504 _this = this; 8505 // Iterate through each rule and find the last matching rule 8506 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.each(this.rules, function (key) { 8507 if (__WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */].atLeast(key)) { 8508 matchedMq = key; 8509 } 8510 }); 8511 8512 // No match? No dice 8513 if (!matchedMq) return; 8514 8515 // Plugin already initialized? We good 8516 if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; 8517 8518 // Remove existing plugin-specific CSS classes 8519 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.each(MenuPlugins, function (key, value) { 8520 _this.$element.removeClass(value.cssClass); 8521 }); 8522 8523 // Add the CSS class for the new plugin 8524 this.$element.addClass(this.rules[matchedMq].cssClass); 8525 8526 // Create an instance of the new plugin 8527 if (this.currentPlugin) {
8528 //don't know why but on nested elements data zfPlugin get's lost 8529 if (!this.currentPlugin.$element.data('zfPlugin') && this.storezfData) this.currentPlugin.$element.data('zfPlugin', this.storezfData); 8530 this.currentPlugin.destroy(); 8531 } 8532 this._handleMarkup(this.rules[matchedMq].cssClass); 8533 this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {}); 8534 this.storezfData = this.currentPlugin.$element.data('zfPlugin'); 8535 } 8536 }, { 8537 key: '_handleMarkup', 8538 value: function _handleMarkup(toSet) { 8539 var _this = this, 8540 fromString = 'accordion'; 8541 var $panels = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-tabs-content=' + this.$element.attr('id') + ']'); 8542 if ($panels.length) fromString = 'tabs'; 8543 if (fromString === toSet) { 8544 return; 8545 }; 8546 8547 var tabsTitle = _this.allOptions.linkClass ? _this.allOptions.linkClass : 'tabs-title'; 8548 var tabsPanel = _this.allOptions.panelClass ? _this.allOptions.panelClass : 'tabs-panel'; 8549 8550 this.$element.removeAttr('role'); 8551 var $liHeads = this.$element.children('.' + tabsTitle + ',[data-accordion-item]').removeClass(tabsTitle).removeClass('accordion-item').removeAttr('data-accordion-item'); 8552 var $liHeadsA = $liHeads.children('a').removeClass('accordion-title'); 8553 8554 if (fromString === 'tabs') { 8555 $panels = $panels.children('.' + tabsPanel).removeClass(tabsPanel).removeAttr('role').removeAttr('aria-hidden').removeAttr('aria-labelledby'); 8556 $panels.children('a').removeAttr('role').removeAttr('aria-controls').removeAttr('aria-selected'); 8557 } else { 8558 $panels = $liHeads.children('[data-tab-content]').removeClass('accordion-content'); 8559 }; 8560 8561 $panels.css({ display: '', visibility: '' }); 8562 $liHeads.css({ display: '', visibility: '' }); 8563 if (toSet === 'accordion') { 8564 $panels.each(function (key, value) { 8565 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(value).appendTo($liHeads.get(key)).addClass('accordion-content').attr('data-tab-content', '').removeClass('is-active').css({ height: '' }); 8566 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-tabs-content=' + _this.$element.attr('id') + ']').after('<div id="tabs-placeholder-' + _this.$element.attr('id') + '"></div>').detach(); 8567 $liHeads.addClass('accordion-item').attr('data-accordion-item', ''); 8568 $liHeadsA.addClass('accordion-title'); 8569 }); 8570 } else if (toSet === 'tabs') { 8571 var $tabsContent = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-tabs-content=' + _this.$element.attr('id') + ']'); 8572 var $placeholder = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#tabs-placeholder-' + _this.$element.attr('id')); 8573 if ($placeholder.length) { 8574 $tabsContent = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('<div class="tabs-content"></div>').insertAfter($placeholder).attr('data-tabs-content', _this.$element.attr('id')); 8575 $placeholder.remove(); 8576 } else { 8577 $tabsContent = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('<div class="tabs-content"></div>').insertAfter(_this.$element).attr('data-tabs-content', _this.$element.attr('id')); 8578 }; 8579 $panels.each(function (key, value) { 8580 var tempValue = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(value).appendTo($tabsContent).addClass(tabsPanel); 8581 var hash = $liHeadsA.get(key).hash.slice(1); 8582 var id = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(value).attr('id') || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_core__["a" /* GetYoDigits */])(6, 'accordion'); 8583 if (hash !== id) { 8584 if (hash !== '') { 8585 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(value).attr('id', hash); 8586 } else { 8587 hash = id; 8588 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(value).attr('id', hash); 8589 __WEBPACK_IMPORTED_MODULE_0_jquery___default()($liHeadsA.get(key)).attr('href', __WEBPACK_IMPORTED_MODULE_0_jquery___default()($liHeadsA.get(key)).attr('href').replace('#', '') + '#' + hash); 8590 }; 8591 }; 8592 var isActive = __WEBPACK_IMPORTED_MODULE_0_jquery___default()($liHeads.get(key)).hasClass('is-active'); 8593 if (isActive) { 8594 tempValue.addClass('is-active'); 8595 }; 8596 }); 8597 $liHeads.addClass(tabsTitle); 8598 }; 8599 } 8600 8601 /** 8602 * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out. 8603 * @function 8604 */ 8605 8606 }, { 8607 key: '_destroy', 8608 value: function _destroy() { 8609 if (this.currentPlugin) this.currentPlugin.destroy(); 8610 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('.zf.ResponsiveAccordionTabs'); 8611 } 8612 }]); 8613 8614 return ResponsiveAccordionTabs; 8615}(__WEBPACK_IMPORTED_MODULE_3__foundation_plugin__["a" /* Plugin */]); 8616 8617ResponsiveAccordionTabs.defaults = {}; 8618 8619 8620 8621/***/ }), 8622/* 26 */ 8623/***/ (function(module, __webpack_exports__, __webpack_require__) { 8624 8625"use strict"; 8626/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ResponsiveMenu; }); 8627/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 8628/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 8629/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__ = __webpack_require__(3); 8630/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_core__ = __webpack_require__(1); 8631/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_plugin__ = __webpack_require__(2); 8632/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_dropdownMenu__ = __webpack_require__(13); 8633/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_drilldown__ = __webpack_require__(12); 8634/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__foundation_accordionMenu__ = __webpack_require__(11); 8635 8636 8637var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8638 8639function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8640 8641function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8642 8643function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
8643onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655var MenuPlugins = { 8656 dropdown: { 8657 cssClass: 'dropdown', 8658 plugin: __WEBPACK_IMPORTED_MODULE_4__foundation_dropdownMenu__["a" /* DropdownMenu */] 8659 }, 8660 drilldown: { 8661 cssClass: 'drilldown', 8662 plugin: __WEBPACK_IMPORTED_MODULE_5__foundation_drilldown__["a" /* Drilldown */] 8663 }, 8664 accordion: { 8665 cssClass: 'accordion-menu', 8666 plugin: __WEBPACK_IMPORTED_MODULE_6__foundation_accordionMenu__["a" /* AccordionMenu */] 8667 } 8668}; 8669 8670// import "foundation.util.triggers.js"; 8671 8672 8673/** 8674 * ResponsiveMenu module. 8675 * @module foundation.responsiveMenu 8676 * @requires foundation.util.triggers 8677 * @requires foundation.util.mediaQuery 8678 */ 8679 8680var ResponsiveMenu = function (_Plugin) { 8681 _inherits(ResponsiveMenu, _Plugin); 8682 8683 function ResponsiveMenu() { 8684 _classCallCheck(this, ResponsiveMenu); 8685 8686 return _possibleConstructorReturn(this, (ResponsiveMenu.__proto__ || Object.getPrototypeOf(ResponsiveMenu)).apply(this, arguments)); 8687 } 8688 8689 _createClass(ResponsiveMenu, [{ 8690 key: '_setup', 8691 8692 /** 8693 * Creates a new instance of a responsive menu. 8694 * @class 8695 * @name ResponsiveMenu 8696 * @fires ResponsiveMenu#init 8697 * @param {jQuery} element - jQuery object to make into a dropdown menu. 8698 * @param {Object} options - Overrides to the default plugin settings. 8699 */ 8700 value: function _setup(element, options) { 8701 this.$element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(element); 8702 this.rules = this.$element.data('responsive-menu'); 8703 this.currentMq = null; 8704 this.currentPlugin = null; 8705 this.className = 'ResponsiveMenu'; // ie9 back compat 8706 8707 this._init(); 8708 this._events(); 8709 } 8710 8711 /** 8712 * Initializes the Menu by parsing the classes from the 'data-ResponsiveMenu' attribute on the element. 8713 * @function 8714 * @private 8715 */ 8716 8717 }, { 8718 key: '_init', 8719 value: function _init() { 8720 8721 __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 8722 // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules 8723 if (typeof this.rules === 'string') { 8724 var rulesTree = {}; 8725 8726 // Parse rules from "classes" pulled from data attribute 8727 var rules = this.rules.split(' '); 8728 8729 // Iterate through every rule found 8730 for (var i = 0; i < rules.length; i++) { 8731 var rule = rules[i].split('-'); 8732 var ruleSize = rule.length > 1 ? rule[0] : 'small'; 8733 var rulePlugin = rule.length > 1 ? rule[1] : rule[0]; 8734 8735 if (MenuPlugins[rulePlugin] !== null) { 8736 rulesTree[ruleSize] = MenuPlugins[rulePlugin]; 8737 } 8738 } 8739 8740 this.rules = rulesTree; 8741 } 8742 8743 if (!__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.isEmptyObject(this.rules)) { 8744 this._checkMediaQueries(); 8745 } 8746 // Add data-mutate since children may need it. 8747 this.$element.attr('data-mutate', this.$element.attr('data-mutate') || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_core__["a" /* GetYoDigits */])(6, 'responsive-menu')); 8748 } 8749 8750 /** 8751 * Initializes events for the Menu. 8752 * @function 8753 * @private 8754 */ 8755 8756 }, { 8757 key: '_events', 8758 value: function _events() { 8759 var _this = this; 8760 8761 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('changed.zf.mediaquery', function () { 8762 _this._checkMediaQueries(); 8763 }); 8764 // $(window).on('resize.zf.ResponsiveMenu', function() { 8765 // _this._checkMediaQueries(); 8766 // }); 8767 } 8768 8769 /** 8770 * Checks the current screen width against available media queries. If the media query has changed, and the plugin needed has changed, the plugins will swap out. 8771 * @function 8772 * @private 8773 */ 8774 8775 }, { 8776 key: '_checkMediaQueries', 8777 value: function _checkMediaQueries() { 8778 var matchedMq, 8779 _this = this; 8780 // Iterate through each rule and find the last matching rule 8781 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.each(this.rules, function (key) { 8782 if (__WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */].atLeast(key)) { 8783 matchedMq = key; 8784 } 8785 }); 8786 8787 // No match? No dice 8788 if (!matchedMq) return; 8789 8790 // Plugin already initialized? We good 8791 if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; 8792 8793 // Remove existing plugin-specific CSS classes 8794 __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.each(MenuPlugins, function (key, value) { 8795 _this.$element.removeClass(value.cssClass); 8796 }); 8797 8798 // Add the CSS class for the new plugin 8799 this.$element.addClass(this.rules[matchedMq].cssClass); 8800 8801 // Create an instance of the new plugin 8802 if (this.currentPlugin) this.currentPlugin.destroy(); 8803 this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {}); 8804 } 8805 8806 /** 8807 * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out. 8808 * @function 8809 */ 8810 8811 }, { 8812 key: '_destroy', 8813 value: function _destroy() { 8814 this.currentPlugin.destroy(); 8815 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('.zf.ResponsiveMenu'); 8816 } 8817 }]); 8818 8819 return ResponsiveMenu; 8820}(__WEBPACK_IMPORTED_MODULE_3__foundation_plugin__["a" /* Plugin */]); 8821 8822ResponsiveMenu.defaults = {}; 8823 8824 8825 8826/***/ }), 8827/* 27 */ 8828/***/ (function(module, __webpack_exports__, __webpack_require__) { 8829 8830"use strict"; 8831/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ResponsiveToggle; }); 8832/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 8833/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 8834/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__ = __webpack_require__(3); 8835/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_motion__ = __webpack_require__(6); 8836/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_plugin__ = __webpack_require__(2); 8837 8838 8839var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8840 8841function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8842 8843function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8844 8845function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
8845onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8846 8847 8848 8849 8850 8851 8852 8853/** 8854 * ResponsiveToggle module. 8855 * @module foundation.responsiveToggle 8856 * @requires foundation.util.mediaQuery 8857 * @requires foundation.util.motion 8858 */ 8859 8860var ResponsiveToggle = function (_Plugin) { 8861 _inherits(ResponsiveToggle, _Plugin); 8862 8863 function ResponsiveToggle() { 8864 _classCallCheck(this, ResponsiveToggle); 8865 8866 return _possibleConstructorReturn(this, (ResponsiveToggle.__proto__ || Object.getPrototypeOf(ResponsiveToggle)).apply(this, arguments)); 8867 } 8868 8869 _createClass(ResponsiveToggle, [{ 8870 key: '_setup', 8871 8872 /** 8873 * Creates a new instance of Tab Bar. 8874 * @class 8875 * @name ResponsiveToggle 8876 * @fires ResponsiveToggle#init 8877 * @param {jQuery} element - jQuery object to attach tab bar functionality to. 8878 * @param {Object} options - Overrides to the default plugin settings. 8879 */ 8880 value: function _setup(element, options) { 8881 this.$element = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(element); 8882 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, ResponsiveToggle.defaults, this.$element.data(), options); 8883 this.className = 'ResponsiveToggle'; // ie9 back compat 8884 8885 this._init(); 8886 this._events(); 8887 } 8888 8889 /** 8890 * Initializes the tab bar by finding the target element, toggling element, and running update(). 8891 * @function 8892 * @private 8893 */ 8894 8895 }, { 8896 key: '_init', 8897 value: function _init() { 8898 __WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 8899 var targetID = this.$element.data('responsive-toggle'); 8900 if (!targetID) { 8901 console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.'); 8902 } 8903 8904 this.$targetMenu = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + targetID); 8905 this.$toggler = this.$element.find('[data-toggle]').filter(function () { 8906 var target = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).data('toggle'); 8907 return target === targetID || target === ""; 8908 }); 8909 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, this.options, this.$targetMenu.data()); 8910 8911 // If they were set, parse the animation classes 8912 if (this.options.animate) { 8913 var input = this.options.animate.split(' '); 8914 8915 this.animationIn = input[0]; 8916 this.animationOut = input[1] || null; 8917 } 8918 8919 this._update(); 8920 } 8921 8922 /** 8923 * Adds necessary event handlers for the tab bar to work. 8924 * @function 8925 * @private 8926 */ 8927 8928 }, { 8929 key: '_events', 8930 value: function _events() { 8931 var _this = this; 8932 8933 this._updateMqHandler = this._update.bind(this); 8934 8935 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('changed.zf.mediaquery', this._updateMqHandler); 8936 8937 this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this)); 8938 } 8939 8940 /** 8941 * Checks the current media query to determine if the tab bar should be visible or hidden. 8942 * @function 8943 * @private 8944 */ 8945 8946 }, { 8947 key: '_update', 8948 value: function _update() { 8949 // Mobile 8950 if (!__WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */].atLeast(this.options.hideFor)) { 8951 this.$element.show(); 8952 this.$targetMenu.hide(); 8953 } 8954 8955 // Desktop 8956 else { 8957 this.$element.hide(); 8958 this.$targetMenu.show(); 8959 } 8960 } 8961 8962 /** 8963 * Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it. 8964 * @function 8965 * @fires ResponsiveToggle#toggled 8966 */ 8967 8968 }, { 8969 key: 'toggleMenu', 8970 value: function toggleMenu() { 8971 var _this3 = this; 8972 8973 if (!__WEBPACK_IMPORTED_MODULE_1__foundation_util_mediaQuery__["a" /* MediaQuery */].atLeast(this.options.hideFor)) { 8974 /** 8975 * Fires when the element attached to the tab bar toggles. 8976 * @event ResponsiveToggle#toggled 8977 */ 8978 if (this.options.animate) { 8979 if (this.$targetMenu.is(':hidden')) { 8980 __WEBPACK_IMPORTED_MODULE_2__foundation_util_motion__["a" /* Motion */].animateIn(this.$targetMenu, this.animationIn, function () { 8981 _this3.$element.trigger('toggled.zf.responsiveToggle'); 8982 _this3.$targetMenu.find('[data-mutate]').triggerHandler('mutateme.zf.trigger'); 8983 }); 8984 } else { 8985 __WEBPACK_IMPORTED_MODULE_2__foundation_util_motion__["a" /* Motion */].animateOut(this.$targetMenu, this.animationOut, function () { 8986 _this3.$element.trigger('toggled.zf.responsiveToggle'); 8987 }); 8988 } 8989 } else { 8990 this.$targetMenu.toggle(0); 8991 this.$targetMenu.find('[data-mutate]').trigger('mutateme.zf.trigger'); 8992 this.$element.trigger('toggled.zf.responsiveToggle'); 8993 } 8994 } 8995 } 8996 }, { 8997 key: '_destroy', 8998 value: function _destroy() { 8999 this.$element.off('.zf.responsiveToggle'); 9000 this.$toggler.off('.zf.responsiveToggle'); 9001 9002 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('changed.zf.mediaquery', this._updateMqHandler); 9003 } 9004 }]); 9005 9006 return ResponsiveToggle; 9007}(__WEBPACK_IMPORTED_MODULE_3__foundation_plugin__["a" /* Plugin */]); 9008 9009ResponsiveToggle.defaults = { 9010 /** 9011 * The breakpoint after which the menu is always shown, and the tab bar is hidden. 9012 * @option 9013 * @type {string} 9014 * @default 'medium' 9015 */ 9016 hideFor: 'medium', 9017 9018 /** 9019 * To decide if the toggle should be animated or not. 9020 * @option 9021 * @type {boolean} 9022 * @default false 9023 */ 9024 animate: false 9025}; 9026 9027 9028 9029/***/ }), 9030/* 28 */ 9031/***/ (function(module, __webpack_exports__, __webpack_require__) { 9032 9033"use strict"; 9034/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Reveal; }); 9035/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 9036/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 9037/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 9038/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__ = __webpack_require__(3); 9039/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_motion__ = __webpack_require__(6); 9040/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_plugin__ = __webpack_require__(2); 9041/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_util_triggers__ = __webpack_require__(5); 9042 9043 9044var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9045 9046function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9047 9048function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 9049 9050function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
9050onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 9051 9052 9053 9054 9055 9056 9057 9058 9059/** 9060 * Reveal module. 9061 * @module foundation.reveal 9062 * @requires foundation.util.keyboard 9063 * @requires foundation.util.triggers 9064 * @requires foundation.util.mediaQuery 9065 * @requires foundation.util.motion if using animations 9066 */ 9067 9068var Reveal = function (_Plugin) { 9069 _inherits(Reveal, _Plugin); 9070 9071 function Reveal() { 9072 _classCallCheck(this, Reveal); 9073 9074 return _possibleConstructorReturn(this, (Reveal.__proto__ || Object.getPrototypeOf(Reveal)).apply(this, arguments)); 9075 } 9076 9077 _createClass(Reveal, [{ 9078 key: '_setup', 9079 9080 /** 9081 * Creates a new instance of Reveal. 9082 * @class 9083 * @name Reveal 9084 * @param {jQuery} element - jQuery object to use for the modal. 9085 * @param {Object} options - optional parameters. 9086 */ 9087 value: function _setup(element, options) { 9088 this.$element = element; 9089 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Reveal.defaults, this.$element.data(), options); 9090 this.className = 'Reveal'; // ie9 back compat 9091 this._init(); 9092 9093 // Triggers init is idempotent, just need to make sure it is initialized 9094 __WEBPACK_IMPORTED_MODULE_5__foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 9095 9096 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('Reveal', { 9097 'ESCAPE': 'close' 9098 }); 9099 } 9100 9101 /** 9102 * Initializes the modal by adding the overlay and close buttons, (if selected). 9103 * @private 9104 */ 9105 9106 }, { 9107 key: '_init', 9108 value: function _init() { 9109 __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 9110 this.id = this.$element.attr('id'); 9111 this.isActive = false; 9112 this.cached = { mq: __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */].current }; 9113 this.isMobile = mobileSniff(); 9114 9115 this.$anchor = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-open="' + this.id + '"]').length ? __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-open="' + this.id + '"]') : __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-toggle="' + this.id + '"]'); 9116 this.$anchor.attr({ 9117 'aria-controls': this.id, 9118 'aria-haspopup': true, 9119 'tabindex': 0 9120 }); 9121 9122 if (this.options.fullScreen || this.$element.hasClass('full')) { 9123 this.options.fullScreen = true; 9124 this.options.overlay = false; 9125 } 9126 if (this.options.overlay && !this.$overlay) { 9127 this.$overlay = this._makeOverlay(this.id); 9128 } 9129 9130 this.$element.attr({ 9131 'role': 'dialog', 9132 'aria-hidden': true, 9133 'data-yeti-box': this.id, 9134 'data-resize': this.id 9135 }); 9136 9137 if (this.$overlay) { 9138 this.$element.detach().appendTo(this.$overlay); 9139 } else { 9140 this.$element.detach().appendTo(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.options.appendTo)); 9141 this.$element.addClass('without-overlay'); 9142 } 9143 this._events(); 9144 if (this.options.deepLink && window.location.hash === '#' + this.id) { 9145 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).one('load.zf.reveal', this.open.bind(this)); 9146 } 9147 } 9148 9149 /** 9150 * Creates an overlay div to display behind the modal. 9151 * @private 9152 */ 9153 9154 }, { 9155 key: '_makeOverlay', 9156 value: function _makeOverlay() { 9157 var additionalOverlayClasses = ''; 9158 9159 if (this.options.additionalOverlayClasses) { 9160 additionalOverlayClasses = ' ' + this.options.additionalOverlayClasses; 9161 } 9162 9163 return __WEBPACK_IMPORTED_MODULE_0_jquery___default()('<div></div>').addClass('reveal-overlay' + additionalOverlayClasses).appendTo(this.options.appendTo); 9164 } 9165 9166 /** 9167 * Updates position of modal 9168 * TODO: Figure out if we actually need to cache these values or if it doesn't matter 9169 * @private 9170 */ 9171 9172 }, { 9173 key: '_updatePosition', 9174 value: function _updatePosition() { 9175 var width = this.$element.outerWidth(); 9176 var outerWidth = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).width(); 9177 var height = this.$element.outerHeight(); 9178 var outerHeight = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).height(); 9179 var left, top; 9180 if (this.options.hOffset === 'auto') { 9181 left = parseInt((outerWidth - width) / 2, 10); 9182 } else { 9183 left = parseInt(this.options.hOffset, 10); 9184 } 9185 if (this.options.vOffset === 'auto') { 9186 if (height > outerHeight) { 9187 top = parseInt(Math.min(100, outerHeight / 10), 10); 9188 } else { 9189 top = parseInt((outerHeight - height) / 4, 10); 9190 } 9191 } else { 9192 top = parseInt(this.options.vOffset, 10); 9193 } 9194 this.$element.css({ top: top + 'px' });
9195 // only worry about left if we don't have an overlay or we havea horizontal offset, 9196 // otherwise we're perfectly in the middle 9197 if (!this.$overlay || this.options.hOffset !== 'auto') { 9198 this.$element.css({ left: left + 'px' }); 9199 this.$element.css({ margin: '0px' }); 9200 } 9201 } 9202 9203 /** 9204 * Adds event handlers for the modal. 9205 * @private 9206 */ 9207 9208 }, { 9209 key: '_events', 9210 value: function _events() { 9211 var _this3 = this; 9212 9213 var _this = this; 9214 9215 this.$element.on({ 9216 'open.zf.trigger': this.open.bind(this), 9217 'close.zf.trigger': function (event, $element) { 9218 if (event.target === _this.$element[0] || __WEBPACK_IMPORTED_MODULE_0_jquery___default()(event.target).parents('[data-closable]')[0] === $element) { 9219 // only close reveal when it's explicitly called 9220 return _this3.close.apply(_this3); 9221 } 9222 }, 9223 'toggle.zf.trigger': this.toggle.bind(this), 9224 'resizeme.zf.trigger': function () { 9225 _this._updatePosition(); 9226 } 9227 }); 9228 9229 if (this.options.closeOnClick && this.options.overlay) { 9230 this.$overlay.off('.zf.reveal').on('click.zf.reveal', function (e) { 9231 if (e.target === _this.$element[0] || __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.contains(_this.$element[0], e.target) || !__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.contains(document, e.target)) { 9232 return; 9233 } 9234 _this.close(); 9235 }); 9236 } 9237 if (this.options.deepLink) { 9238 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('popstate.zf.reveal:' + this.id, this._handleState.bind(this)); 9239 } 9240 } 9241 9242 /** 9243 * Handles modal methods on back/forward button clicks or any other event that triggers popstate. 9244 * @private 9245 */ 9246 9247 }, { 9248 key: '_handleState', 9249 value: function _handleState(e) { 9250 if (window.location.hash === '#' + this.id && !this.isActive) { 9251 this.open(); 9252 } else { 9253 this.close(); 9254 } 9255 } 9256 9257 /** 9258 * Opens the modal controlled by `this.$anchor`, and closes all others by default. 9259 * @function 9260 * @fires Reveal#closeme 9261 * @fires Reveal#open 9262 */ 9263 9264 }, { 9265 key: 'open', 9266 value: function open() { 9267 var _this4 = this; 9268 9269 // either update or replace browser history 9270 if (this.options.deepLink) { 9271 var hash = '#' + this.id; 9272 9273 if (window.history.pushState) { 9274 if (this.options.updateHistory) { 9275 window.history.pushState({}, '', hash); 9276 } else { 9277 window.history.replaceState({}, '', hash); 9278 } 9279 } else { 9280 window.location.hash = hash; 9281 } 9282 } 9283 9284 this.isActive = true; 9285 9286 // Make elements invisible, but remove display: none so we can get size and positioning 9287 this.$element.css({ 'visibility': 'hidden' }).show().scrollTop(0); 9288 if (this.options.overlay) { 9289 this.$overlay.css({ 'visibility': 'hidden' }).show(); 9290 } 9291 9292 this._updatePosition(); 9293 9294 this.$element.hide().css({ 'visibility': '' }); 9295 9296 if (this.$overlay) { 9297 this.$overlay.css({ 'visibility': '' }).hide(); 9298 if (this.$element.hasClass('fast')) { 9299 this.$overlay.addClass('fast'); 9300 } else if (this.$element.hasClass('slow')) { 9301 this.$overlay.addClass('slow'); 9302 } 9303 } 9304 9305 if (!this.options.multipleOpened) { 9306 /** 9307 * Fires immediately before the modal opens. 9308 * Closes any other modals that are currently open 9309 * @event Reveal#closeme 9310 */ 9311 this.$element.trigger('closeme.zf.reveal', this.id); 9312 } 9313 9314 var _this = this; 9315 9316 function addRevealOpenClasses() { 9317 if (_this.isMobile) { 9318 if (!_this.originalScrollPos) { 9319 _this.originalScrollPos = window.pageYOffset; 9320 } 9321 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html, body').addClass('is-reveal-open'); 9322 } else { 9323 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').addClass('is-reveal-open'); 9324 } 9325 } 9326 // Motion UI method of reveal 9327 if (this.options.animationIn) { 9328 (function () { 9329 var afterAnimation = function () { 9330 _this.$element.attr({ 9331 'aria-hidden': false, 9332 'tabindex': -1 9333 }).focus(); 9334 addRevealOpenClasses(); 9335 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].trapFocus(_this.$element); 9336 }; 9337 9338 if (_this4.options.overlay) { 9339 __WEBPACK_IMPORTED_MODULE_3__foundation_util_motion__["a" /* Motion */].animateIn(_this4.$overlay, 'fade-in'); 9340 } 9341 __WEBPACK_IMPORTED_MODULE_3__foundation_util_motion__["a" /* Motion */].animateIn(_this4.$element, _this4.options.animationIn, function () { 9342 if (_this4.$element) { 9343 // protect against object having been removed 9344 _this4.focusableElements = __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].findFocusable(_this4.$element); 9345 afterAnimation(); 9346 } 9347 }); 9348 })(); 9349 } 9350 // jQuery method of reveal 9351 else { 9352 if (this.options.overlay) { 9353 this.$overlay.show(0); 9354 } 9355 this.$element.show(this.options.showDelay); 9356 } 9357 9358 // handle accessibility 9359 this.$element.attr({ 9360 'aria-hidden': false, 9361 'tabindex': -1 9362 }).focus(); 9363 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].trapFocus(this.$element); 9364 9365 addRevealOpenClasses(); 9366 9367 this._extraHandlers(); 9368 9369 /** 9370 * Fires when the modal has successfully opened. 9371 * @event Reveal#open 9372 */ 9373 this.$element.trigger('open.zf.reveal'); 9374 } 9375 9376 /** 9377 * Adds extra event handlers for the body and window if necessary. 9378 * @private 9379 */ 9380 9381 }, { 9382 key: '_extraHandlers', 9383 value: function _extraHandlers() { 9384 var _this = this; 9385 if (!this.$element) { 9386 return; 9387 } // If we're in the middle of cleanup, don't freak out 9388 this.focusableElements = __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].findFocusable(this.$element); 9389 9390 if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) { 9391 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').on('click.zf.reveal', function (e) { 9392 if (e.target === _this.$element[0] || __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.contains(_this.$element[0], e.target) || !__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.contains(document, e.target)) { 9393 return; 9394 } 9395 _this.close(); 9396 }); 9397 } 9398 9399 if (this.options.closeOnEsc) { 9400 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).on('keydown.zf.reveal', function (e) { 9401 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'Reveal', { 9402 close: function () { 9403 if (_this.options.closeOnEsc) { 9404 _this.close(); 9405 } 9406 } 9407 }); 9408 }); 9409 } 9410 } 9411 9412 /** 9413 * Closes the modal. 9414 * @function 9415 * @fires Reveal#closed 9416 */ 9417 9418 }, { 9419 key: 'close', 9420 value: function close() { 9421 if (!this.isActive || !this.$element.is(':visible')) { 9422 return false;
9423 } 9424 var _this = this; 9425 9426 // Motion UI method of hiding 9427 if (this.options.animationOut) { 9428 if (this.options.overlay) { 9429 __WEBPACK_IMPORTED_MODULE_3__foundation_util_motion__["a" /* Motion */].animateOut(this.$overlay, 'fade-out'); 9430 } 9431 9432 __WEBPACK_IMPORTED_MODULE_3__foundation_util_motion__["a" /* Motion */].animateOut(this.$element, this.options.animationOut, finishUp); 9433 } 9434 // jQuery method of hiding 9435 else { 9436 this.$element.hide(this.options.hideDelay); 9437 9438 if (this.options.overlay) { 9439 this.$overlay.hide(0, finishUp); 9440 } else { 9441 finishUp(); 9442 } 9443 } 9444 9445 // Conditionals to remove extra event listeners added on open 9446 if (this.options.closeOnEsc) { 9447 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('keydown.zf.reveal'); 9448 } 9449 9450 if (!this.options.overlay && this.options.closeOnClick) { 9451 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').off('click.zf.reveal'); 9452 } 9453 9454 this.$element.off('keydown.zf.reveal'); 9455 9456 function finishUp() { 9457 if (_this.isMobile) { 9458 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()('.reveal:visible').length === 0) { 9459 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html, body').removeClass('is-reveal-open'); 9460 } 9461 if (_this.originalScrollPos) { 9462 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').scrollTop(_this.originalScrollPos); 9463 _this.originalScrollPos = null; 9464 } 9465 } else { 9466 if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()('.reveal:visible').length === 0) { 9467 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body').removeClass('is-reveal-open'); 9468 } 9469 } 9470 9471 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].releaseFocus(_this.$element); 9472 9473 _this.$element.attr('aria-hidden', true); 9474 9475 /** 9476 * Fires when the modal is done closing. 9477 * @event Reveal#closed 9478 */ 9479 _this.$element.trigger('closed.zf.reveal'); 9480 } 9481 9482 /** 9483 * Resets the modal content 9484 * This prevents a running video to keep going in the background 9485 */ 9486 if (this.options.resetOnClose) { 9487 this.$element.html(this.$element.html()); 9488 } 9489 9490 this.isActive = false; 9491 if (_this.options.deepLink) { 9492 if (window.history.replaceState) { 9493 window.history.replaceState('', document.title, window.location.href.replace('#' + this.id, '')); 9494 } else { 9495 window.location.hash = ''; 9496 } 9497 } 9498 9499 this.$anchor.focus(); 9500 } 9501 9502 /** 9503 * Toggles the open/closed state of a modal. 9504 * @function 9505 */ 9506 9507 }, { 9508 key: 'toggle', 9509 value: function toggle() { 9510 if (this.isActive) { 9511 this.close(); 9512 } else { 9513 this.open(); 9514 } 9515 } 9516 }, { 9517 key: '_destroy', 9518 9519 9520 /** 9521 * Destroys an instance of a modal. 9522 * @function 9523 */ 9524 value: function _destroy() { 9525 if (this.options.overlay) { 9526 this.$element.appendTo(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.options.appendTo)); // move $element outside of $overlay to prevent error unregisterPlugin() 9527 this.$overlay.hide().off().remove(); 9528 } 9529 this.$element.hide().off(); 9530 this.$anchor.off('.zf'); 9531 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off('.zf.reveal:' + this.id); 9532 } 9533 }]); 9534 9535 return Reveal; 9536}(__WEBPACK_IMPORTED_MODULE_4__foundation_plugin__["a" /* Plugin */]); 9537 9538Reveal.defaults = { 9539 /** 9540 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 9541 * @option 9542 * @type {string} 9543 * @default '' 9544 */ 9545 animationIn: '', 9546 /** 9547 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 9548 * @option 9549 * @type {string} 9550 * @default '' 9551 */ 9552 animationOut: '', 9553 /** 9554 * Time, in ms, to delay the opening of a modal after a click if no animation used. 9555 * @option 9556 * @type {number} 9557 * @default 0 9558 */ 9559 showDelay: 0, 9560 /** 9561 * Time, in ms, to delay the closing of a modal after a click if no animation used. 9562 * @option 9563 * @type {number} 9564 * @default 0 9565 */ 9566 hideDelay: 0, 9567 /** 9568 * Allows a click on the body/overlay to close the modal. 9569 * @option 9570 * @type {boolean} 9571 * @default true 9572 */ 9573 closeOnClick: true, 9574 /** 9575 * Allows the modal to close if the user presses the `ESCAPE` key. 9576 * @option 9577 * @type {boolean} 9578 * @default true 9579 */ 9580 closeOnEsc: true, 9581 /** 9582 * If true, allows multiple modals to be displayed at once. 9583 * @option 9584 * @type {boolean} 9585 * @default false 9586 */ 9587 multipleOpened: false, 9588 /** 9589 * Distance, in pixels, the modal should push down from the top of the screen. 9590 * @option 9591 * @type {number|string} 9592 * @default auto 9593 */ 9594 vOffset: 'auto', 9595 /** 9596 * Distance, in pixels, the modal should push in from the side of the screen. 9597 * @option 9598 * @type {number|string} 9599 * @default auto 9600 */ 9601 hOffset: 'auto', 9602 /** 9603 * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well. 9604 * @option 9605 * @type {boolean} 9606 * @default false 9607 */ 9608 fullScreen: false, 9609 /** 9610 * Percentage of screen height the modal should push up from the bottom of the view. 9611 * @option 9612 * @type {number} 9613 * @default 10 9614 */ 9615 btmOffsetPct: 10, 9616 /** 9617 * Allows the modal to generate an overlay div, which will cover the view when modal opens. 9618 * @option 9619 * @type {boolean} 9620 * @default true 9621 */ 9622 overlay: true, 9623 /** 9624 * Allows the modal to remove and reinject markup on close. Should be true if using video elements w/o using provider's api, otherwise, videos will continue to play in the background. 9625 * @option 9626 * @type {boolean} 9627 * @default false 9628 */ 9629 resetOnClose: false, 9630 /** 9631 * Allows the modal to alter the url on open/close, and allows the use of the `back` button to close modals. ALSO, allows a modal to auto-maniacally open on page load IF the hash === the modal'
9631s user-set id. 9632 * @option 9633 * @type {boolean} 9634 * @default false 9635 */ 9636 deepLink: false, 9637 /** 9638 * Update the browser history with the open modal 9639 * @option 9640 * @default false 9641 */ 9642 updateHistory: false, 9643 /** 9644 * Allows the modal to append to custom div. 9645 * @option 9646 * @type {string} 9647 * @default "body" 9648 */ 9649 appendTo: "body", 9650 /** 9651 * Allows adding additional class names to the reveal overlay. 9652 * @option 9653 * @type {string} 9654 * @default '' 9655 */ 9656 additionalOverlayClasses: '' 9657}; 9658 9659function iPhoneSniff() { 9660 return (/iP(ad|hone|od).*OS/.test(window.navigator.userAgent) 9661 ); 9662} 9663 9664function androidSniff() { 9665 return (/Android/.test(window.navigator.userAgent) 9666 ); 9667} 9668 9669function mobileSniff() { 9670 return iPhoneSniff() || androidSniff(); 9671} 9672 9673 9674 9675/***/ }), 9676/* 29 */ 9677/***/ (function(module, __webpack_exports__, __webpack_require__) { 9678 9679"use strict"; 9680/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Slider; }); 9681/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 9682/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 9683/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__ = __webpack_require__(4); 9684/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_motion__ = __webpack_require__(6); 9685/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_core__ = __webpack_require__(1); 9686/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_plugin__ = __webpack_require__(2); 9687/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__foundation_util_touch__ = __webpack_require__(16); 9688/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__foundation_util_triggers__ = __webpack_require__(5); 9689 9690 9691var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9692 9693function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9694 9695function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 9696 9697function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709/** 9710 * Slider module. 9711 * @module foundation.slider 9712 * @requires foundation.util.motion 9713 * @requires foundation.util.triggers 9714 * @requires foundation.util.keyboard 9715 * @requires foundation.util.touch 9716 */ 9717 9718var Slider = function (_Plugin) { 9719 _inherits(Slider, _Plugin); 9720 9721 function Slider() { 9722 _classCallCheck(this, Slider); 9723 9724 return _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).apply(this, arguments)); 9725 } 9726 9727 _createClass(Slider, [{ 9728 key: '_setup', 9729 9730 /** 9731 * Creates a new instance of a slider control. 9732 * @class 9733 * @name Slider 9734 * @param {jQuery} element - jQuery object to make into a slider control. 9735 * @param {Object} options - Overrides to the default plugin settings. 9736 */ 9737 value: function _setup(element, options) { 9738 this.$element = element; 9739 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Slider.defaults, this.$element.data(), options); 9740 this.className = 'Slider'; // ie9 back compat 9741 9742 // Touch and Triggers inits are idempotent, we just need to make sure it's initialied.
9743 __WEBPACK_IMPORTED_MODULE_5__foundation_util_touch__["a" /* Touch */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 9744 __WEBPACK_IMPORTED_MODULE_6__foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 9745 9746 this._init(); 9747 9748 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].register('Slider', { 9749 'ltr': { 9750 'ARROW_RIGHT': 'increase', 9751 'ARROW_UP': 'increase', 9752 'ARROW_DOWN': 'decrease', 9753 'ARROW_LEFT': 'decrease', 9754 'SHIFT_ARROW_RIGHT': 'increase_fast', 9755 'SHIFT_ARROW_UP': 'increase_fast', 9756 'SHIFT_ARROW_DOWN': 'decrease_fast', 9757 'SHIFT_ARROW_LEFT': 'decrease_fast', 9758 'HOME': 'min', 9759 'END': 'max' 9760 }, 9761 'rtl': { 9762 'ARROW_LEFT': 'increase', 9763 'ARROW_RIGHT': 'decrease', 9764 'SHIFT_ARROW_LEFT': 'increase_fast', 9765 'SHIFT_ARROW_RIGHT': 'decrease_fast' 9766 } 9767 }); 9768 } 9769 9770 /** 9771 * Initilizes the plugin by reading/setting attributes, creating collections and setting the initial position of the handle(s). 9772 * @function 9773 * @private 9774 */ 9775 9776 }, { 9777 key: '_init', 9778 value: function _init() { 9779 this.inputs = this.$element.find('input'); 9780 this.handles = this.$element.find('[data-slider-handle]'); 9781 9782 this.$handle = this.handles.eq(0); 9783 this.$input = this.inputs.length ? this.inputs.eq(0) : __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + this.$handle.attr('aria-controls')); 9784 this.$fill = this.$element.find('[data-slider-fill]').css(this.options.vertical ? 'height' : 'width', 0); 9785 9786 var isDbl = false, 9787 _this = this; 9788 if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) { 9789 this.options.disabled = true; 9790 this.$element.addClass(this.options.disabledClass); 9791 } 9792 if (!this.inputs.length) { 9793 this.inputs = __WEBPACK_IMPORTED_MODULE_0_jquery___default()().add(this.$input); 9794 this.options.binding = true; 9795 } 9796 9797 this._setInitAttr(0); 9798 9799 if (this.handles[1]) { 9800 this.options.doubleSided = true; 9801 this.$handle2 = this.handles.eq(1); 9802 this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + this.$handle2.attr('aria-controls')); 9803 9804 if (!this.inputs[1]) { 9805 this.inputs = this.inputs.add(this.$input2); 9806 } 9807 isDbl = true; 9808 9809 // this.$handle.triggerHandler('click.zf.slider'); 9810 this._setInitAttr(1); 9811 } 9812 9813 // Set handle positions 9814 this.setHandles(); 9815 9816 this._events(); 9817 } 9818 }, { 9819 key: 'setHandles', 9820 value: function setHandles() { 9821 var _this3 = this; 9822 9823 if (this.handles[1]) { 9824 this._setHandlePos(this.$handle, this.inputs.eq(0).val(), true, function () { 9825 _this3._setHandlePos(_this3.$handle2, _this3.inputs.eq(1).val(), true); 9826 }); 9827 } else { 9828 this._setHandlePos(this.$handle, this.inputs.eq(0).val(), true); 9829 } 9830 } 9831 }, { 9832 key: '_reflow', 9833 value: function _reflow() { 9834 this.setHandles(); 9835 } 9836 /** 9837 * @function 9838 * @private 9839 * @param {Number} value - floating point (the value) to be transformed using to a relative position on the slider (the inverse of _value) 9840 */ 9841 9842 }, { 9843 key: '_pctOfBar', 9844 value: function _pctOfBar(value) { 9845 var pctOfBar = percent(value - this.options.start, this.options.end - this.options.start); 9846 9847 switch (this.options.positionValueFunction) { 9848 case "pow": 9849 pctOfBar = this._logTransform(pctOfBar); 9850 break; 9851 case "log": 9852 pctOfBar = this._powTransform(pctOfBar); 9853 break; 9854 } 9855 9856 return pctOfBar.toFixed(2); 9857 } 9858 9859 /** 9860 * @function 9861 * @private 9862 * @param {Number} pctOfBar - floating point, the relative position of the slider (typically between 0-1) to be transformed to a value 9863 */ 9864 9865 }, { 9866 key: '_value', 9867 value: function _value(pctOfBar) { 9868 switch (this.options.positionValueFunction) { 9869 case "pow": 9870 pctOfBar = this._powTransform(pctOfBar); 9871 break; 9872 case "log": 9873 pctOfBar = this._logTransform(pctOfBar); 9874 break; 9875 } 9876 var value = (this.options.end - this.options.start) * pctOfBar + this.options.start; 9877 9878 return value; 9879 } 9880 9881 /** 9882 * @function 9883 * @private 9884 * @param {Number} value - floating point (typically between 0-1) to be transformed using the log function 9885 */ 9886 9887 }, { 9888 key: '_logTransform', 9889 value: function _logTransform(value) { 9890 return baseLog(this.options.nonLinearBase, value * (this.options.nonLinearBase - 1) + 1); 9891 } 9892 9893 /** 9894 * @function 9895 * @private 9896 * @param {Number} value - floating point (typically between 0-1) to be transformed using the power function 9897 */ 9898 9899 }, { 9900 key: '_powTransform', 9901 value: function _powTransform(value) { 9902 return (Math.pow(this.options.nonLinearBase, value) - 1) / (this.options.nonLinearBase - 1); 9903 } 9904 9905 /** 9906 * Sets the position of the selected handle and fill bar. 9907 * @function 9908 * @private 9909 * @param {jQuery} $hndl - the selected handle to move. 9910 * @param {Number} location - floating point between the start and end values of the slider bar. 9911 * @param {Function} cb - callback function to fire on completion. 9912 * @fires Slider#moved 9913 * @fires Slider#changed 9914 */ 9915 9916 }, { 9917 key: '_setHandlePos', 9918 value: function _setHandlePos($hndl, location, noInvert, cb) { 9919 // don't move if the slider has been disabled since its initialization 9920 if (this.$element.hasClass(this.options.disabledClass)) { 9921 return; 9922 } 9923 //might need to alter that slightly for bars that will have odd number selections. 9924 location = parseFloat(location); //on input change events, convert string to number...grumble. 9925 9926 // prevent slider from running out of bounds, if value exceeds the limits set through options, override the value to min/max 9927 if (location < this.options.start) { 9928 location = this.options.start; 9929 } else if (location > this.options.end) { 9930 location = this.options.end; 9931 } 9932 9933 var isDbl = this.options.doubleSided; 9934
vendor: 4,362 bytes, lines 9935-10017
9935 //this is for single-handled vertical sliders, it adjusts the value to account for the slider being "upside-down" 9936 //for click and drag events, it's weird due to the scale(-1, 1) css property 9937 if (this.options.vertical && !noInvert) { 9938 location = this.options.end - location; 9939 } 9940 9941 if (isDbl) { 9942 //this block is to prevent 2 handles from crossing eachother. Could/should be improved. 9943 if (this.handles.index($hndl) === 0) { 9944 var h2Val = parseFloat(this.$handle2.attr('aria-valuenow')); 9945 location = location >= h2Val ? h2Val - this.options.step : location; 9946 } else { 9947 var h1Val = parseFloat(this.$handle.attr('aria-valuenow')); 9948 location = location <= h1Val ? h1Val + this.options.step : location; 9949 } 9950 } 9951 9952 var _this = this, 9953 vert = this.options.vertical, 9954 hOrW = vert ? 'height' : 'width', 9955 lOrT = vert ? 'top' : 'left', 9956 handleDim = $hndl[0].getBoundingClientRect()[hOrW], 9957 elemDim = this.$element[0].getBoundingClientRect()[hOrW], 9958 9959 //percentage of bar min/max value based on click or drag point 9960 pctOfBar = this._pctOfBar(location), 9961 9962 //number of actual pixels to shift the handle, based on the percentage obtained above 9963 pxToMove = (elemDim - handleDim) * pctOfBar, 9964 9965 //percentage of bar to shift the handle 9966 movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal); 9967 //fixing the decimal value for the location number, is passed to other methods as a fixed floating-point value 9968 location = parseFloat(location.toFixed(this.options.decimal)); 9969 // declare empty object for css adjustments, only used with 2 handled-sliders 9970 var css = {}; 9971 9972 this._setValues($hndl, location); 9973 9974 // TODO update to calculate based on values set to respective inputs?? 9975 if (isDbl) { 9976 var isLeftHndl = this.handles.index($hndl) === 0, 9977 9978 //empty variable, will be used for min-height/width for fill bar 9979 dim, 9980 9981 //percentage w/h of the handle compared to the slider bar 9982 handlePct = ~~(percent(handleDim, elemDim) * 100); 9983 //if left handle, the math is slightly different than if it's the right handle, and the left/top property needs to be changed for the fill bar 9984 if (isLeftHndl) { 9985 //left or top percentage value to apply to the fill bar. 9986 css[lOrT] = movement + '%'; 9987 //calculate the new min-height/width for the fill bar. 9988 dim = parseFloat(this.$handle2[0].style[lOrT]) - movement + handlePct; 9989 //this callback is necessary to prevent errors and allow the proper placement and initialization of a 2-handled slider 9990 //plus, it means we don't care if 'dim' isNaN on init, it won't be in the future. 9991 if (cb && typeof cb === 'function') { 9992 cb(); 9993 } //this is only needed for the initialization of 2 handled sliders 9994 } else { 9995 //just caching the value of the left/bottom handle's left/top property 9996 var handlePos = parseFloat(this.$handle[0].style[lOrT]); 9997 //calculate the new min-height/width for the fill bar. Use isNaN to prevent false positives for numbers <= 0 9998 //based on the percentage of movement of the handle being manipulated, less the opposing handle's left/top position, plus the percentage w/h of the handle itself 9999 dim = movement - (isNaN(handlePos) ? (this.options.initialStart - this.options.start) / ((this.options.end - this.options.start) / 100) : handlePos) + handlePct; 10000 } 10001 // assign the min-height/width to our css object 10002 css['min-' + hOrW] = dim + '%'; 10003 } 10004 10005 this.$element.one('finished.zf.animate', function () { 10006 /** 10007 * Fires when the handle is done moving. 10008 * @event Slider#moved 10009 */ 10010 _this.$element.trigger('moved.zf.slider', [$hndl]); 10011 }); 10012 10013 //because we don't know exactly how the handle will be moved, check the amount of time it should take to move. 10014 var moveTime = this.$element.data('dragging') ? 1000 / 60 : this.options.moveTime; 10015 10016 __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__foundation_util_motion__["b" /* Move */])(moveTime, $hndl, function () { 10017 // adjusting the left/top property of the handle, based on the percentage c
vendor: 4,368 bytes, lines 10017-10134
10017alculated above 10018 // if movement isNaN, that is because the slider is hidden and we cannot determine handle width, 10019 // fall back to next best guess. 10020 if (isNaN(movement)) { 10021 $hndl.css(lOrT, pctOfBar * 100 + '%'); 10022 } else { 10023 $hndl.css(lOrT, movement + '%'); 10024 } 10025 10026 if (!_this.options.doubleSided) { 10027 //if single-handled, a simple method to expand the fill bar 10028 _this.$fill.css(hOrW, pctOfBar * 100 + '%'); 10029 } else { 10030 //otherwise, use the css object we created above 10031 _this.$fill.css(css); 10032 } 10033 }); 10034 10035 /** 10036 * Fires when the value has not been change for a given time. 10037 * @event Slider#changed 10038 */ 10039 clearTimeout(_this.timeout); 10040 _this.timeout = setTimeout(function () { 10041 _this.$element.trigger('changed.zf.slider', [$hndl]); 10042 }, _this.options.changedDelay); 10043 } 10044 10045 /** 10046 * Sets the initial attribute for the slider element. 10047 * @function 10048 * @private 10049 * @param {Number} idx - index of the current handle/input to use. 10050 */ 10051 10052 }, { 10053 key: '_setInitAttr', 10054 value: function _setInitAttr(idx) { 10055 var initVal = idx === 0 ? this.options.initialStart : this.options.initialEnd; 10056 var id = this.inputs.eq(idx).attr('id') || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["a" /* GetYoDigits */])(6, 'slider'); 10057 this.inputs.eq(idx).attr({ 10058 'id': id, 10059 'max': this.options.end, 10060 'min': this.options.start, 10061 'step': this.options.step 10062 }); 10063 this.inputs.eq(idx).val(initVal); 10064 this.handles.eq(idx).attr({ 10065 'role': 'slider', 10066 'aria-controls': id, 10067 'aria-valuemax': this.options.end, 10068 'aria-valuemin': this.options.start, 10069 'aria-valuenow': initVal, 10070 'aria-orientation': this.options.vertical ? 'vertical' : 'horizontal', 10071 'tabindex': 0 10072 }); 10073 } 10074 10075 /** 10076 * Sets the input and `aria-valuenow` values for the slider element. 10077 * @function 10078 * @private 10079 * @param {jQuery} $handle - the currently selected handle. 10080 * @param {Number} val - floating point of the new value. 10081 */ 10082 10083 }, { 10084 key: '_setValues', 10085 value: function _setValues($handle, val) { 10086 var idx = this.options.doubleSided ? this.handles.index($handle) : 0; 10087 this.inputs.eq(idx).val(val); 10088 $handle.attr('aria-valuenow', val); 10089 } 10090 10091 /** 10092 * Handles events on the slider element. 10093 * Calculates the new location of the current handle. 10094 * If there are two handles and the bar was clicked, it determines which handle to move. 10095 * @function 10096 * @private 10097 * @param {Object} e - the `event` object passed from the listener. 10098 * @param {jQuery} $handle - the current handle to calculate for, if selected. 10099 * @param {Number} val - floating point number for the new value of the slider. 10100 * TODO clean this up, there's a lot of repeated code between this and the _setHandlePos fn. 10101 */ 10102 10103 }, { 10104 key: '_handleEvent', 10105 value: function _handleEvent(e, $handle, val) { 10106 var value, hasVal; 10107 if (!val) { 10108 //click or drag events 10109 e.preventDefault(); 10110 var _this = this, 10111 vertical = this.options.vertical, 10112 param = vertical ? 'height' : 'width', 10113 direction = vertical ? 'top' : 'left', 10114 eventOffset = vertical ? e.pageY : e.pageX, 10115 halfOfHandle = this.$handle[0].getBoundingClientRect()[param] / 2, 10116 barDim = this.$element[0].getBoundingClientRect()[param], 10117 windowScroll = vertical ? __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).scrollTop() : __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).scrollLeft(); 10118 10119 var elemOffset = this.$element.offset()[direction]; 10120 10121 // touch events emulated by the touch util give position relative to screen, add window.scroll to event coordinates... 10122 // best way to guess this is simulated is if clientY == pageY 10123 if (e.clientY === e.pageY) { 10124 eventOffset = eventOffset + windowScroll; 10125 } 10126 var eventFromBar = eventOffset - elemOffset; 10127 var barXY; 10128 if (eventFromBar < 0) { 10129 barXY = 0; 10130 } else if (eventFromBar > barDim) { 10131 barXY = barDim; 10132 } else { 10133 barXY = eventFromBar; 10134 }
10135 var offsetPct = percent(barXY, barDim); 10136 10137 value = this._value(offsetPct); 10138 10139 // turn everything around for RTL, yay math! 10140 if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__foundation_util_core__["b" /* rtl */])() && !this.options.vertical) { 10141 value = this.options.end - value; 10142 } 10143 10144 value = _this._adjustValue(null, value); 10145 //boolean flag for the setHandlePos fn, specifically for vertical sliders 10146 hasVal = false; 10147 10148 if (!$handle) { 10149 //figure out which handle it is, pass it to the next function. 10150 var firstHndlPos = absPosition(this.$handle, direction, barXY, param), 10151 secndHndlPos = absPosition(this.$handle2, direction, barXY, param); 10152 $handle = firstHndlPos <= secndHndlPos ? this.$handle : this.$handle2; 10153 } 10154 } else { 10155 //change event on input 10156 value = this._adjustValue(null, val); 10157 hasVal = true; 10158 } 10159 10160 this._setHandlePos($handle, value, hasVal); 10161 } 10162 10163 /** 10164 * Adjustes value for handle in regard to step value. returns adjusted value 10165 * @function 10166 * @private 10167 * @param {jQuery} $handle - the selected handle. 10168 * @param {Number} value - value to adjust. used if $handle is falsy 10169 */ 10170 10171 }, { 10172 key: '_adjustValue', 10173 value: function _adjustValue($handle, value) { 10174 var val, 10175 step = this.options.step, 10176 div = parseFloat(step / 2), 10177 left, 10178 prev_val, 10179 next_val; 10180 if (!!$handle) { 10181 val = parseFloat($handle.attr('aria-valuenow')); 10182 } else { 10183 val = value; 10184 } 10185 left = val % step; 10186 prev_val = val - left; 10187 next_val = prev_val + step; 10188 if (left === 0) { 10189 return val; 10190 } 10191 val = val >= prev_val + div ? next_val : prev_val; 10192 return val; 10193 } 10194 10195 /** 10196 * Adds event listeners to the slider elements. 10197 * @function 10198 * @private 10199 */ 10200 10201 }, { 10202 key: '_events', 10203 value: function _events() { 10204 this._eventsForHandle(this.$handle); 10205 if (this.handles[1]) { 10206 this._eventsForHandle(this.$handle2); 10207 } 10208 } 10209 10210 /** 10211 * Adds event listeners a particular handle 10212 * @function 10213 * @private 10214 * @param {jQuery} $handle - the current handle to apply listeners to. 10215 */ 10216 10217 }, { 10218 key: '_eventsForHandle', 10219 value: function _eventsForHandle($handle) { 10220 var _this = this, 10221 curHandle, 10222 timer; 10223 10224 this.inputs.off('change.zf.slider').on('change.zf.slider', function (e) { 10225 var idx = _this.inputs.index(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)); 10226 _this._handleEvent(e, _this.handles.eq(idx), __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).val()); 10227 }); 10228 10229 if (this.options.clickSelect) { 10230 this.$element.off('click.zf.slider').on('click.zf.slider', function (e) { 10231 if (_this.$element.data('dragging')) { 10232 return false; 10233 } 10234 10235 if (!__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target).is('[data-slider-handle]')) { 10236 if (_this.options.doubleSided) { 10237 _this._handleEvent(e); 10238 } else { 10239 _this._handleEvent(e, _this.$handle); 10240 } 10241 } 10242 }); 10243 } 10244 10245 if (this.options.draggable) { 10246 this.handles.addTouch(); 10247 10248 var $body = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('body'); 10249 $handle.off('mousedown.zf.slider').on('mousedown.zf.slider', function (e) { 10250 $handle.addClass('is-dragging'); 10251 _this.$fill.addClass('is-dragging'); // 10252 _this.$element.data('dragging', true); 10253 10254 curHandle = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.currentTarget); 10255 10256 $body.on('mousemove.zf.slider', function (e) { 10257 e.preventDefault(); 10258 _this._handleEvent(e, curHandle); 10259 }).on('mouseup.zf.slider', function (e) { 10260 _this._handleEvent(e, curHandle); 10261 10262 $handle.removeClass('is-dragging'); 10263 _this.$fill.removeClass('is-dragging'); 10264 _this.$element.data('dragging', false); 10265 10266 $body.off('mousemove.zf.slider mouseup.zf.slider'); 10267 }); 10268 }) 10269 // prevent events triggered by touch 10270 .on('selectstart.zf.slider touchmove.zf.slider', function (e) { 10271 e.preventDefault(); 10272 }); 10273 } 10274 10275 $handle.off('keydown.zf.slider').on('keydown.zf.slider', function (e) { 10276 var _$handle = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this), 10277 idx = _this.options.doubleSided ? _this.handles.index(_$handle) : 0, 10278 oldValue = parseFloat(_this.inputs.eq(idx).val()), 10279 newValue; 10280 10281 // handle keyboard event with keyboard util 10282 __WEBPACK_IMPORTED_MODULE_1__foundation_util_keyboard__["a" /* Keyboard */].handleKey(e, 'Slider', { 10283 decrease: function () { 10284 newValue = oldValue - _this.options.step; 10285 }, 10286 increase: function () { 10287 newValue = oldValue + _this.options.step; 10288 }, 10289 decrease_fast: function () { 10290 newValue = oldValue - _this.options.step * 10; 10291 }, 10292 increase_fast: function () { 10293 newValue = oldValue + _this.options.step * 10; 10294 }, 10295 min: function () { 10296 newValue = _this.options.start; 10297 }, 10298 max: function () { 10299 newValue = _this.options.end; 10300 }, 10301 handled: function () { 10302 // only set handle pos when event was handled specially 10303 e.preventDefault(); 10304 _this._setHandlePos(_$handle, newValue, true); 10305 } 10306 }); 10307 /*if (newValue) { // if pressed key has special function, update value 10308 e.preventDefault(); 10309 _this._setHandlePos(_$handle, newValue); 10310 }*/ 10311 }); 10312 } 10313 10314 /** 10315 * Destroys the slider plugin. 10316 */ 10317 10318 }, { 10319 key: '_destroy', 10320 value: function _destroy() { 10321 this.handles.off('.zf.slider'); 10322 this.inputs.off('.zf.slider'); 10323 this.$element.off('.zf.slider'); 10324 10325 clearTimeout(this.timeout); 10326 } 10327 }]); 10328 10329 return Slider; 10330}(__WEBPACK_IMPORTED_MODULE_4__foundation_plugin__["a" /* Plugin */]); 10331 10332Slider.defaults = { 10333 /** 10334 * Minimum value for the slider scale. 10335 * @option 10336 * @type {number} 10337 * @default 0 10338 */ 10339 start: 0, 10340 /** 10341 * Maximum value for the slider scale. 10342 * @option 10343 * @type {number} 10344 * @default 100 10345 */ 10346 end: 100,
10347 /** 10348 * Minimum value change per change event. 10349 * @option 10350 * @type {number} 10351 * @default 1 10352 */ 10353 step: 1, 10354 /** 10355 * Value at which the handle/input *(left handle/first input)* should be set to on initialization. 10356 * @option 10357 * @type {number} 10358 * @default 0 10359 */ 10360 initialStart: 0, 10361 /** 10362 * Value at which the right handle/second input should be set to on initialization. 10363 * @option 10364 * @type {number} 10365 * @default 100 10366 */ 10367 initialEnd: 100, 10368 /** 10369 * Allows the input to be located outside the container and visible. Set to by the JS 10370 * @option 10371 * @type {boolean} 10372 * @default false 10373 */ 10374 binding: false, 10375 /** 10376 * Allows the user to click/tap on the slider bar to select a value. 10377 * @option 10378 * @type {boolean} 10379 * @default true 10380 */ 10381 clickSelect: true, 10382 /** 10383 * Set to true and use the `vertical` class to change alignment to vertical. 10384 * @option 10385 * @type {boolean} 10386 * @default false 10387 */ 10388 vertical: false, 10389 /** 10390 * Allows the user to drag the slider handle(s) to select a value. 10391 * @option 10392 * @type {boolean} 10393 * @default true 10394 */ 10395 draggable: true, 10396 /** 10397 * Disables the slider and prevents event listeners from being applied. Double checked by JS with `disabledClass`. 10398 * @option 10399 * @type {boolean} 10400 * @default false 10401 */ 10402 disabled: false, 10403 /** 10404 * Allows the use of two handles. Double checked by the JS. Changes some logic handling. 10405 * @option 10406 * @type {boolean} 10407 * @default false 10408 */ 10409 doubleSided: false, 10410 /** 10411 * Potential future feature. 10412 */ 10413 // steps: 100, 10414 /** 10415 * Number of decimal places the plugin should go to for floating point precision. 10416 * @option 10417 * @type {number} 10418 * @default 2 10419 */ 10420 decimal: 2, 10421 /** 10422 * Time delay for dragged elements. 10423 */ 10424 // dragDelay: 0, 10425 /** 10426 * Time, in ms, to animate the movement of a slider handle if user clicks/taps on the bar. Needs to be manually set if updating the transition time in the Sass settings. 10427 * @option 10428 * @type {number} 10429 * @default 200 10430 */ 10431 moveTime: 200, //update this if changing the transition time in the sass 10432 /** 10433 * Class applied to disabled sliders. 10434 * @option 10435 * @type {string} 10436 * @default 'disabled' 10437 */ 10438 disabledClass: 'disabled', 10439 /** 10440 * Will invert the default layout for a vertical<span data-tooltip title="who would do this???"> </span>slider. 10441 * @option 10442 * @type {boolean} 10443 * @default false 10444 */ 10445 invertVertical: false, 10446 /** 10447 * Milliseconds before the `changed.zf-slider` event is triggered after value change. 10448 * @option 10449 * @type {number} 10450 * @default 500 10451 */ 10452 changedDelay: 500, 10453 /** 10454 * Basevalue for non-linear sliders 10455 * @option 10456 * @type {number} 10457 * @default 5 10458 */ 10459 nonLinearBase: 5, 10460 /** 10461 * Basevalue for non-linear sliders, possible values are: `'linear'`, `'pow'` & `'log'`. Pow and Log use the nonLinearBase setting. 10462 * @option 10463 * @type {string} 10464 * @default 'linear' 10465 */ 10466 positionValueFunction: 'linear' 10467}; 10468 10469function percent(frac, num) { 10470 return frac / num; 10471} 10472function absPosition($handle, dir, clickPos, param) { 10473 return Math.abs($handle.position()[dir] + $handle[param]() / 2 - clickPos); 10474} 10475function baseLog(base, value) { 10476 return Math.log(value) / Math.log(base); 10477} 10478 10479 10480 10481/***/ }), 10482/* 30 */ 10483/***/ (function(module, __webpack_exports__, __webpack_require__) { 10484 10485"use strict"; 10486/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Sticky; }); 10487/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 10488/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 10489/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_core__ = __webpack_require__(1); 10490/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__ = __webpack_require__(3); 10491/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_plugin__ = __webpack_require__(2); 10492/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_util_triggers__ = __webpack_require__(5); 10493 10494 10495var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 10496 10497function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10498 10499function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 10500 10501function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
10501onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10502 10503 10504 10505 10506 10507 10508 10509/** 10510 * Sticky module. 10511 * @module foundation.sticky 10512 * @requires foundation.util.triggers 10513 * @requires foundation.util.mediaQuery 10514 */ 10515 10516var Sticky = function (_Plugin) { 10517 _inherits(Sticky, _Plugin); 10518 10519 function Sticky() { 10520 _classCallCheck(this, Sticky); 10521 10522 return _possibleConstructorReturn(this, (Sticky.__proto__ || Object.getPrototypeOf(Sticky)).apply(this, arguments)); 10523 } 10524 10525 _createClass(Sticky, [{ 10526 key: '_setup', 10527 10528 /** 10529 * Creates a new instance of a sticky thing. 10530 * @class 10531 * @name Sticky 10532 * @param {jQuery} element - jQuery object to make sticky. 10533 * @param {Object} options - options object passed when creating the element programmatically. 10534 */ 10535 value: function _setup(element, options) { 10536 this.$element = element; 10537 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Sticky.defaults, this.$element.data(), options); 10538 this.className = 'Sticky'; // ie9 back compat 10539 10540 // Triggers init is idempotent, just need to make sure it is initialized 10541 __WEBPACK_IMPORTED_MODULE_4__foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 10542 10543 this._init(); 10544 } 10545 10546 /** 10547 * Initializes the sticky element by adding classes, getting/setting dimensions, breakpoints and attributes 10548 * @function 10549 * @private 10550 */ 10551 10552 }, { 10553 key: '_init', 10554 value: function _init() { 10555 __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 10556 10557 var $parent = this.$element.parent('[data-sticky-container]'), 10558 id = this.$element[0].id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__foundation_util_core__["a" /* GetYoDigits */])(6, 'sticky'), 10559 _this = this; 10560 10561 if ($parent.length) { 10562 this.$container = $parent; 10563 } else { 10564 this.wasWrapped = true; 10565 this.$element.wrap(this.options.container); 10566 this.$container = this.$element.parent(); 10567 } 10568 this.$container.addClass(this.options.containerClass); 10569 10570 this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id, 'data-mutate': id }); 10571 if (this.options.anchor !== '') { 10572 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + _this.options.anchor).attr({ 'data-mutate': id }); 10573 } 10574 10575 this.scrollCount = this.options.checkEvery; 10576 this.isStuck = false; 10577 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).one('load.zf.sticky', function () { 10578 //We calculate the container height to have correct values for anchor points offset calculation. 10579 _this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height; 10580 _this.$container.css('height', _this.containerHeight); 10581 _this.elemHeight = _this.containerHeight; 10582 if (_this.options.anchor !== '') { 10583 _this.$anchor = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + _this.options.anchor); 10584 } else { 10585 _this._parsePoints(); 10586 } 10587 10588 _this._setSizes(function () { 10589 var scroll = window.pageYOffset; 10590 _this._calc(false, scroll); 10591 //Unstick the element will ensure that proper classes are set. 10592 if (!_this.isStuck) { 10593 _this._removeSticky(scroll >= _this.topPoint ? false : true); 10594 } 10595 }); 10596 _this._events(id.split('-').reverse().join('-')); 10597 }); 10598 } 10599 10600 /** 10601 * If using multiple elements as anchors, calculates the top and bottom pixel values the sticky thing should stick and unstick on. 10602 * @function 10603 * @private 10604 */ 10605 10606 }, { 10607 key: '_parsePoints', 10608 value: function _parsePoints() { 10609 var top = this.options.topAnchor == "" ? 1 : this.options.topAnchor, 10610 btm = this.options.btmAnchor == "" ? document.documentElement.scrollHeight : this.options.btmAnchor, 10611 pts = [top, btm], 10612 breaks = {}; 10613 for (var i = 0, len = pts.length; i < len && pts[i]; i++) { 10614 var pt; 10615 if (typeof pts[i] === 'number') { 10616 pt = pts[i]; 10617 } else { 10618 var place = pts[i].split(':'), 10619 anchor = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + place[0]); 10620 10621 pt = anchor.offset().top; 10622 if (place[1] && place[1].toLowerCase() === 'bottom') { 10623 pt += anchor[0].getBoundingClientRect().height; 10624 } 10625 } 10626 breaks[i] = pt; 10627 } 10628 10629 this.points = breaks; 10630 return; 10631 } 10632 10633 /** 10634 * Adds event handlers for the scrolling element. 10635 * @private 10636 * @param {String} id - pseudo-random id for unique scroll event listener. 10637 */ 10638 10639 }, { 10640 key: '_events', 10641 value: function _events(id) { 10642 var _this = this, 10643 scrollListener = this.scrollListener = 'scroll.zf.' + id; 10644 if (this.isOn) { 10645 return; 10646 } 10647 if (this.canStick) { 10648 this.isOn = true; 10649 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off(scrollListener).on(scrollListener, function (e) { 10650 if (_this.scrollCount === 0) { 10651 _this.scrollCount = _this.options.checkEvery; 10652 _this._setSizes(function () { 10653 _this._calc(false, window.pageYOffset); 10654 }); 10655 } else { 10656 _this.scrollCount--; 10657 _this._calc(false, window.pageYOffset); 10658 } 10659 }); 10660 } 10661 10662 this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function (e, el) { 10663 _this._eventsHandler(id); 10664 }); 10665 10666 this.$element.on('mutateme.zf.trigger', function (e, el) { 10667 _this._eventsHandler(id); 10668 }); 10669 10670 if (this.$anchor) { 10671 this.$anchor.on('mutateme.zf.trigger', function (e, el) { 10672 _this._eventsHandler(id); 10673 }); 10674 } 10675 } 10676 10677 /** 10678 * Handler for events. 10679 * @private 10680 * @param {String} id - pseudo-random id for unique scroll event listener. 10681 */ 10682 10683 }, { 10684 key: '_eventsHandler', 10685 value: function _eventsHandler(id) { 10686 var _this = this, 10687 scrollListener = this.scrollListener = 'scroll.zf.' + id; 10688 10689 _this._setSizes(function () { 10690 _this._calc(false); 10691 if (_this.canStick) { 10692 if (!_this.isOn) { 10693 _this._events(id); 10694 } 10695 } else if (_this.isOn) { 10696 _this._pauseListeners(scrollListener); 10697 } 10698 }); 10699 } 10700 10701 /** 10702 * Removes event handlers for scroll and change events on anchor. 10703 * @fires Sticky#pause 10704 * @param {String} scrollListener - unique, namespaced scroll listener attached to `window` 10705 */ 10706 10707 }, { 10708 key: '_pauseListeners', 10709 value: function _pauseListeners(scrollListener) { 10710 this.isOn = false;
10711 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off(scrollListener); 10712 10713 /** 10714 * Fires when the plugin is paused due to resize event shrinking the view. 10715 * @event Sticky#pause 10716 * @private 10717 */ 10718 this.$element.trigger('pause.zf.sticky'); 10719 } 10720 10721 /** 10722 * Called on every `scroll` event and on `_init` 10723 * fires functions based on booleans and cached values 10724 * @param {Boolean} checkSizes - true if plugin should recalculate sizes and breakpoints. 10725 * @param {Number} scroll - current scroll position passed from scroll event cb function. If not passed, defaults to `window.pageYOffset`. 10726 */ 10727 10728 }, { 10729 key: '_calc', 10730 value: function _calc(checkSizes, scroll) { 10731 if (checkSizes) { 10732 this._setSizes(); 10733 } 10734 10735 if (!this.canStick) { 10736 if (this.isStuck) { 10737 this._removeSticky(true); 10738 } 10739 return false; 10740 } 10741 10742 if (!scroll) { 10743 scroll = window.pageYOffset; 10744 } 10745 10746 if (scroll >= this.topPoint) { 10747 if (scroll <= this.bottomPoint) { 10748 if (!this.isStuck) { 10749 this._setSticky(); 10750 } 10751 } else { 10752 if (this.isStuck) { 10753 this._removeSticky(false); 10754 } 10755 } 10756 } else { 10757 if (this.isStuck) { 10758 this._removeSticky(true); 10759 } 10760 } 10761 } 10762 10763 /** 10764 * Causes the $element to become stuck. 10765 * Adds `position: fixed;`, and helper classes. 10766 * @fires Sticky#stuckto 10767 * @function 10768 * @private 10769 */ 10770 10771 }, { 10772 key: '_setSticky', 10773 value: function _setSticky() { 10774 var _this = this, 10775 stickTo = this.options.stickTo, 10776 mrgn = stickTo === 'top' ? 'marginTop' : 'marginBottom', 10777 notStuckTo = stickTo === 'top' ? 'bottom' : 'top', 10778 css = {}; 10779 10780 css[mrgn] = this.options[mrgn] + 'em'; 10781 css[stickTo] = 0; 10782 css[notStuckTo] = 'auto'; 10783 this.isStuck = true; 10784 this.$element.removeClass('is-anchored is-at-' + notStuckTo).addClass('is-stuck is-at-' + stickTo).css(css) 10785 /** 10786 * Fires when the $element has become `position: fixed;` 10787 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.stuckto:top` 10788 * @event Sticky#stuckto 10789 */ 10790 .trigger('sticky.zf.stuckto:' + stickTo); 10791 this.$element.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function () { 10792 _this._setSizes(); 10793 }); 10794 } 10795 10796 /** 10797 * Causes the $element to become unstuck. 10798 * Removes `position: fixed;`, and helper classes. 10799 * Adds other helper classes. 10800 * @param {Boolean} isTop - tells the function if the $element should anchor to the top or bottom of its $anchor element. 10801 * @fires Sticky#unstuckfrom 10802 * @private 10803 */ 10804 10805 }, { 10806 key: '_removeSticky', 10807 value: function _removeSticky(isTop) { 10808 var stickTo = this.options.stickTo, 10809 stickToTop = stickTo === 'top', 10810 css = {}, 10811 anchorPt = (this.points ? this.points[1] - this.points[0] : this.anchorHeight) - this.elemHeight, 10812 mrgn = stickToTop ? 'marginTop' : 'marginBottom', 10813 notStuckTo = stickToTop ? 'bottom' : 'top', 10814 topOrBottom = isTop ? 'top' : 'bottom'; 10815 10816 css[mrgn] = 0; 10817 10818 css['bottom'] = 'auto'; 10819 if (isTop) { 10820 css['top'] = 0; 10821 } else { 10822 css['top'] = anchorPt; 10823 } 10824 10825 this.isStuck = false; 10826 this.$element.removeClass('is-stuck is-at-' + stickTo).addClass('is-anchored is-at-' + topOrBottom).css(css) 10827 /** 10828 * Fires when the $element has become anchored. 10829 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.unstuckfrom:bottom` 10830 * @event Sticky#unstuckfrom 10831 */ 10832 .trigger('sticky.zf.unstuckfrom:' + topOrBottom); 10833 } 10834 10835 /** 10836 * Sets the $element and $container sizes for plugin. 10837 * Calls `_setBreakPoints`. 10838 * @param {Function} cb - optional callback function to fire on completion of `_setBreakPoints`. 10839 * @private 10840 */ 10841 10842 }, { 10843 key: '_setSizes', 10844 value: function _setSizes(cb) { 10845 this.canStick = __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */].is(this.options.stickyOn); 10846 if (!this.canStick) { 10847 if (cb && typeof cb === 'function') { 10848 cb(); 10849 } 10850 } 10851 var _this = this, 10852 newElemWidth = this.$container[0].getBoundingClientRect().width, 10853 comp = window.getComputedStyle(this.$container[0]), 10854 pdngl = parseInt(comp['padding-left'], 10), 10855 pdngr = parseInt(comp['padding-right'], 10); 10856 10857 if (this.$anchor && this.$anchor.length) { 10858 this.anchorHeight = this.$anchor[0].getBoundingClientRect().height; 10859 } else { 10860 this._parsePoints(); 10861 } 10862 10863 this.$element.css({ 10864 'max-width': newElemWidth - pdngl - pdngr + 'px' 10865 }); 10866 10867 var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight; 10868 if (this.$element.css("display") == "none") { 10869 newContainerHeight = 0; 10870 } 10871 this.containerHeight = newContainerHeight; 10872 this.$container.css({ 10873 height: newContainerHeight 10874 }); 10875 this.elemHeight = newContainerHeight; 10876 10877 if (!this.isStuck) { 10878 if (this.$element.hasClass('is-at-bottom')) { 10879 var anchorPt = (this.points ? this.points[1] - this.$container.offset().top : this.anchorHeight) - this.elemHeight;
10880 this.$element.css('top', anchorPt); 10881 } 10882 } 10883 10884 this._setBreakPoints(newContainerHeight, function () { 10885 if (cb && typeof cb === 'function') { 10886 cb(); 10887 } 10888 }); 10889 } 10890 10891 /** 10892 * Sets the upper and lower breakpoints for the element to become sticky/unsticky. 10893 * @param {Number} elemHeight - px value for sticky.$element height, calculated by `_setSizes`. 10894 * @param {Function} cb - optional callback function to be called on completion. 10895 * @private 10896 */ 10897 10898 }, { 10899 key: '_setBreakPoints', 10900 value: function _setBreakPoints(elemHeight, cb) { 10901 if (!this.canStick) { 10902 if (cb && typeof cb === 'function') { 10903 cb(); 10904 } else { 10905 return false; 10906 } 10907 } 10908 var mTop = emCalc(this.options.marginTop), 10909 mBtm = emCalc(this.options.marginBottom), 10910 topPoint = this.points ? this.points[0] : this.$anchor.offset().top, 10911 bottomPoint = this.points ? this.points[1] : topPoint + this.anchorHeight, 10912 10913 // topPoint = this.$anchor.offset().top || this.points[0], 10914 // bottomPoint = topPoint + this.anchorHeight || this.points[1], 10915 winHeight = window.innerHeight; 10916 10917 if (this.options.stickTo === 'top') { 10918 topPoint -= mTop; 10919 bottomPoint -= elemHeight + mTop; 10920 } else if (this.options.stickTo === 'bottom') { 10921 topPoint -= winHeight - (elemHeight + mBtm); 10922 bottomPoint -= winHeight - mBtm; 10923 } else { 10924 //this would be the stickTo: both option... tricky 10925 } 10926 10927 this.topPoint = topPoint; 10928 this.bottomPoint = bottomPoint; 10929 10930 if (cb && typeof cb === 'function') { 10931 cb(); 10932 } 10933 } 10934 10935 /** 10936 * Destroys the current sticky element. 10937 * Resets the element to the top position first. 10938 * Removes event listeners, JS-added css properties and classes, and unwraps the $element if the JS added the $container. 10939 * @function 10940 */ 10941 10942 }, { 10943 key: '_destroy', 10944 value: function _destroy() { 10945 this._removeSticky(true); 10946 10947 this.$element.removeClass(this.options.stickyClass + ' is-anchored is-at-top').css({ 10948 height: '', 10949 top: '', 10950 bottom: '', 10951 'max-width': '' 10952 }).off('resizeme.zf.trigger').off('mutateme.zf.trigger'); 10953 if (this.$anchor && this.$anchor.length) { 10954 this.$anchor.off('change.zf.sticky'); 10955 } 10956 __WEBPACK_IMPORTED_MODULE_0_jquery___default()(window).off(this.scrollListener); 10957 10958 if (this.wasWrapped) { 10959 this.$element.unwrap(); 10960 } else { 10961 this.$container.removeClass(this.options.containerClass).css({ 10962 height: '' 10963 }); 10964 } 10965 } 10966 }]); 10967 10968 return Sticky; 10969}(__WEBPACK_IMPORTED_MODULE_3__foundation_plugin__["a" /* Plugin */]); 10970 10971Sticky.defaults = { 10972 /** 10973 * Customizable container template. Add your own classes for styling and sizing. 10974 * @option 10975 * @type {string} 10976 * @default '<div data-sticky-container></div>' 10977 */ 10978 container: '<div data-sticky-container></div>', 10979 /** 10980 * Location in the view the element sticks to. Can be `'top'` or `'bottom'`. 10981 * @option 10982 * @type {string} 10983 * @default 'top' 10984 */ 10985 stickTo: 'top', 10986 /** 10987 * If anchored to a single element, the id of that element. 10988 * @option 10989 * @type {string} 10990 * @default '' 10991 */ 10992 anchor: '', 10993 /** 10994 * If using more than one element as anchor points, the id of the top anchor. 10995 * @option 10996 * @type {string} 10997 * @default '' 10998 */ 10999 topAnchor: '', 11000 /** 11001 * If using more than one element as anchor points, the id of the bottom anchor. 11002 * @option 11003 * @type {string} 11004 * @default '' 11005 */ 11006 btmAnchor: '', 11007 /** 11008 * Margin, in `em`'s to apply to the top of the element when it becomes sticky. 11009 * @option 11010 * @type {number} 11011 * @default 1 11012 */ 11013 marginTop: 1, 11014 /** 11015 * Margin, in `em`'s to apply to the bottom of the element when it becomes sticky. 11016 * @option 11017 * @type {number} 11018 * @default 1 11019 */ 11020 marginBottom: 1, 11021 /** 11022 * Breakpoint string that is the minimum screen size an element should become sticky. 11023 * @option 11024 * @type {string} 11025 * @default 'medium' 11026 */ 11027 stickyOn: 'medium', 11028 /** 11029 * Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`. 11030 * @option 11031 * @type {string} 11032 * @default 'sticky' 11033 */ 11034 stickyClass: 'sticky', 11035 /** 11036 * Class applied to sticky container. Foundation defaults to `sticky-container`. 11037 * @option 11038 * @type {string} 11039 * @default 'sticky-container' 11040 */ 11041 containerClass: 'sticky-container', 11042 /** 11043 * Number of scroll events between the plugin's recalculating sticky points. Setting it to `0` will cause it to recalc every scroll event, setting it to `-1` will prevent recalc on scroll. 11044 * @option 11045 * @type {number} 11046 * @default -1 11047 */ 11048 checkEvery: -1 11049}; 11050 11051/** 11052 * Helper function to calculate em values 11053 * @param Number {em} - number of em's to calculate into pixels 11054 */ 11055function emCalc(em) { 11056 return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em; 11057} 11058 11059 11060 11061/***/ }), 11062/* 31 */ 11063/***/ (function(module, __webpack_exports__, __webpack_require__) { 11064 11065"use strict"; 11066/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Toggler; }); 11067/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 11068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 11069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_motion__ = __webpack_require__(6); 11070/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_plugin__ = __webpack_require__(2); 11071/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_triggers__ = __webpack_require__(5); 11072 11073 11074var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 11075 11076function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11077 11078function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 11079 11080function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
11080onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 11081 11082 11083 11084 11085 11086 11087/** 11088 * Toggler module. 11089 * @module foundation.toggler 11090 * @requires foundation.util.motion 11091 * @requires foundation.util.triggers 11092 */ 11093 11094var Toggler = function (_Plugin) { 11095 _inherits(Toggler, _Plugin); 11096 11097 function Toggler() { 11098 _classCallCheck(this, Toggler); 11099 11100 return _possibleConstructorReturn(this, (Toggler.__proto__ || Object.getPrototypeOf(Toggler)).apply(this, arguments)); 11101 } 11102 11103 _createClass(Toggler, [{ 11104 key: '_setup', 11105 11106 /** 11107 * Creates a new instance of Toggler. 11108 * @class 11109 * @name Toggler 11110 * @fires Toggler#init 11111 * @param {Object} element - jQuery object to add the trigger to. 11112 * @param {Object} options - Overrides to the default plugin settings. 11113 */ 11114 value: function _setup(element, options) { 11115 this.$element = element; 11116 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Toggler.defaults, element.data(), options); 11117 this.className = ''; 11118 this.className = 'Toggler'; // ie9 back compat 11119 11120 // Triggers init is idempotent, just need to make sure it is initialized 11121 __WEBPACK_IMPORTED_MODULE_3__foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 11122 11123 this._init(); 11124 this._events(); 11125 } 11126 11127 /** 11128 * Initializes the Toggler plugin by parsing the toggle class from data-toggler, or animation classes from data-animate. 11129 * @function 11130 * @private 11131 */ 11132 11133 }, { 11134 key: '_init', 11135 value: function _init() { 11136 var input; 11137 // Parse animation classes if they were set 11138 if (this.options.animate) { 11139 input = this.options.animate.split(' '); 11140 11141 this.animationIn = input[0]; 11142 this.animationOut = input[1] || null; 11143 } 11144 // Otherwise, parse toggle class 11145 else { 11146 input = this.$element.data('toggler'); 11147 // Allow for a . at the beginning of the string 11148 this.className = input[0] === '.' ? input.slice(1) : input; 11149 } 11150 11151 // Add ARIA attributes to triggers 11152 var id = this.$element[0].id; 11153 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-controls', id); 11154 // If the target is hidden, add aria-hidden 11155 this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true); 11156 } 11157 11158 /** 11159 * Initializes events for the toggle trigger. 11160 * @function 11161 * @private 11162 */ 11163 11164 }, { 11165 key: '_events', 11166 value: function _events() { 11167 this.$element.off('toggle.zf.trigger').on('toggle.zf.trigger', this.toggle.bind(this)); 11168 } 11169 11170 /** 11171 * Toggles the target class on the target element. An event is fired from the original trigger depending on if the resultant state was "on" or "off". 11172 * @function 11173 * @fires Toggler#on 11174 * @fires Toggler#off 11175 */ 11176 11177 }, { 11178 key: 'toggle', 11179 value: function toggle() { 11180 this[this.options.animate ? '_toggleAnimate' : '_toggleClass'](); 11181 } 11182 }, { 11183 key: '_toggleClass', 11184 value: function _toggleClass() { 11185 this.$element.toggleClass(this.className); 11186 11187 var isOn = this.$element.hasClass(this.className); 11188 if (isOn) { 11189 /** 11190 * Fires if the target element has the class after a toggle. 11191 * @event Toggler#on 11192 */ 11193 this.$element.trigger('on.zf.toggler'); 11194 } else { 11195 /** 11196 * Fires if the target element does not have the class after a toggle. 11197 * @event Toggler#off 11198 */ 11199 this.$element.trigger('off.zf.toggler'); 11200 } 11201 11202 this._updateARIA(isOn); 11203 this.$element.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11204 } 11205 }, { 11206 key: '_toggleAnimate', 11207 value: function _toggleAnimate() { 11208 var _this = this; 11209 11210 if (this.$element.is(':hidden')) { 11211 __WEBPACK_IMPORTED_MODULE_1__foundation_util_motion__["a" /* Motion */].animateIn(this.$element, this.animationIn, function () { 11212 _this._updateARIA(true); 11213 this.trigger('on.zf.toggler'); 11214 this.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11215 }); 11216 } else { 11217 __WEBPACK_IMPORTED_MODULE_1__foundation_util_motion__["a" /* Motion */].animateOut(this.$element, this.animationOut, function () { 11218 _this._updateARIA(false); 11219 this.trigger('off.zf.toggler'); 11220 this.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11221 }); 11222 } 11223 } 11224 }, { 11225 key: '_updateARIA', 11226 value: function _updateARIA(isOn) { 11227 this.$element.attr('aria-expanded', isOn ? true : false); 11228 } 11229 11230 /** 11231 * Destroys the instance of Toggler on the element. 11232 * @function 11233 */ 11234 11235 }, { 11236 key: '_destroy', 11237 value: function _destroy() { 11238 this.$element.off('.zf.toggler'); 11239 } 11240 }]); 11241 11242 return Toggler; 11243}(__WEBPACK_IMPORTED_MODULE_2__foundation_plugin__["a" /* Plugin */]); 11244 11245Toggler.defaults = { 11246 /** 11247 * Tells the plugin if the element should animated when toggled. 11248 * @option 11249 * @type {boolean} 11250 * @default false 11251 */ 11252 animate: false 11253}; 11254 11255 11256 11257/***/ }), 11258/* 32 */ 11259/***/ (function(module, __webpack_exports__, __webpack_require__) { 11260 11261"use strict"; 11262/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Tooltip; }); 11263/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 11264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 11265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_core__ = __webpack_require__(1); 11266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__ = __webpack_require__(3); 11267/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation_util_triggers__ = __webpack_require__(5); 11268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__foundation_positionable__ = __webpack_require__(15); 11269 11270 11271var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 11272 11273var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; 11274 11275function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11276 11277function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 11278 11279function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
11279onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 11280 11281 11282 11283 11284 11285 11286 11287 11288/** 11289 * Tooltip module. 11290 * @module foundation.tooltip 11291 * @requires foundation.util.box 11292 * @requires foundation.util.mediaQuery 11293 * @requires foundation.util.triggers 11294 */ 11295 11296var Tooltip = function (_Positionable) { 11297 _inherits(Tooltip, _Positionable); 11298 11299 function Tooltip() { 11300 _classCallCheck(this, Tooltip); 11301 11302 return _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).apply(this, arguments)); 11303 } 11304 11305 _createClass(Tooltip, [{ 11306 key: '_setup', 11307 11308 /** 11309 * Creates a new instance of a Tooltip. 11310 * @class 11311 * @name Tooltip 11312 * @fires Tooltip#init 11313 * @param {jQuery} element - jQuery object to attach a tooltip to. 11314 * @param {Object} options - object to extend the default configuration. 11315 */ 11316 value: function _setup(element, options) { 11317 this.$element = element; 11318 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Tooltip.defaults, this.$element.data(), options); 11319 this.className = 'Tooltip'; // ie9 back compat 11320 11321 this.isActive = false; 11322 this.isClick = false; 11323 11324 // Triggers init is idempotent, just need to make sure it is initialized 11325 __WEBPACK_IMPORTED_MODULE_3__foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 11326 11327 this._init(); 11328 } 11329 11330 /** 11331 * Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anchor. 11332 * @private 11333 */ 11334 11335 }, { 11336 key: '_init', 11337 value: function _init() { 11338 __WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */]._init(); 11339 var elemId = this.$element.attr('aria-describedby') || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__foundation_util_core__["a" /* GetYoDigits */])(6, 'tooltip'); 11340 11341 this.options.tipText = this.options.tipText || this.$element.attr('title'); 11342 this.template = this.options.template ? __WEBPACK_IMPORTED_MODULE_0_jquery___default()(this.options.template) : this._buildTemplate(elemId); 11343 11344 if (this.options.allowHtml) { 11345 this.template.appendTo(document.body).html(this.options.tipText).hide(); 11346 } else { 11347 this.template.appendTo(document.body).text(this.options.tipText).hide(); 11348 } 11349 11350 this.$element.attr({ 11351 'title': '', 11352 'aria-describedby': elemId, 11353 'data-yeti-box': elemId, 11354 'data-toggle': elemId, 11355 'data-resize': elemId 11356 }).addClass(this.options.triggerClass); 11357 11358 _get(Tooltip.prototype.__proto__ || Object.getPrototypeOf(Tooltip.prototype), '_init', this).call(this); 11359 this._events(); 11360 } 11361 }, { 11362 key: '_getDefaultPosition', 11363 value: function _getDefaultPosition() { 11364 // handle legacy classnames 11365 var position = this.$element[0].className.match(/\b(top|left|right|bottom)\b/g); 11366 return position ? position[0] : 'top'; 11367 } 11368 }, { 11369 key: '_getDefaultAlignment', 11370 value: function _getDefaultAlignment() { 11371 return 'center'; 11372 } 11373 }, { 11374 key: '_getHOffset', 11375 value: function _getHOffset() { 11376 if (this.position === 'left' || this.position === 'right') { 11377 return this.options.hOffset + this.options.tooltipWidth; 11378 } else { 11379 return this.options.hOffset; 11380 } 11381 } 11382 }, { 11383 key: '_getVOffset', 11384 value: function _getVOffset() { 11385 if (this.position === 'top' || this.position === 'bottom') { 11386 return this.options.vOffset + this.options.tooltipHeight; 11387 } else { 11388 return this.options.vOffset; 11389 } 11390 } 11391 11392 /** 11393 * builds the tooltip element, adds attributes, and returns the template. 11394 * @private 11395 */ 11396 11397 }, { 11398 key: '_buildTemplate', 11399 value: function _buildTemplate(id) { 11400 var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass + ' ' + this.options.templateClasses).trim(); 11401 var $template = __WEBPACK_IMPORTED_MODULE_0_jquery___default()('<div></div>').addClass(templateClasses).attr({ 11402 'role': 'tooltip', 11403 'aria-hidden': true, 11404 'data-is-active': false, 11405 'data-is-focus': false, 11406 'id': id 11407 }); 11408 return $template; 11409 } 11410 11411 /** 11412 * 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. 11413 * if the tooltip is larger than the screen width, default to full width - any user selected margin 11414 * @private 11415 */ 11416 11417 }, { 11418 key: '_setPosition', 11419 value: function _setPosition() { 11420 _get(Tooltip.prototype.__proto__ || Object.getPrototypeOf(Tooltip.prototype), '_setPosition', this).call(this, this.$element, this.template); 11421 } 11422 11423 /** 11424 * reveals the tooltip, and fires an event to close any other open tooltips on the page 11425 * @fires Tooltip#closeme 11426 * @fires Tooltip#show 11427 * @function 11428 */ 11429 11430 }, { 11431 key: 'show', 11432 value: function show() { 11433 if (this.options.showOn !== 'all' && !__WEBPACK_IMPORTED_MODULE_2__foundation_util_mediaQuery__["a" /* MediaQuery */].is(this.options.showOn)) { 11434 // console.error('The screen is too small to display this tooltip'); 11435 return false;
vendor: 1,717 bytes, lines 11436-11492
11436 } 11437 11438 var _this = this; 11439 this.template.css('visibility', 'hidden').show(); 11440 this._setPosition(); 11441 this.template.removeClass('top bottom left right').addClass(this.position); 11442 this.template.removeClass('align-top align-bottom align-left align-right align-center').addClass('align-' + this.alignment); 11443 11444 /** 11445 * Fires to close all other open tooltips on the page 11446 * @event Closeme#tooltip 11447 */ 11448 this.$element.trigger('closeme.zf.tooltip', this.template.attr('id')); 11449 11450 this.template.attr({ 11451 'data-is-active': true, 11452 'aria-hidden': false 11453 }); 11454 _this.isActive = true; 11455 // console.log(this.template); 11456 this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function () { 11457 //maybe do stuff? 11458 }); 11459 /** 11460 * Fires when the tooltip is shown 11461 * @event Tooltip#show 11462 */ 11463 this.$element.trigger('show.zf.tooltip'); 11464 } 11465 11466 /** 11467 * Hides the current tooltip, and resets the positioning class if it was changed due to collision 11468 * @fires Tooltip#hide 11469 * @function 11470 */ 11471 11472 }, { 11473 key: 'hide', 11474 value: function hide() { 11475 // console.log('hiding', this.$element.data('yeti-box')); 11476 var _this = this; 11477 this.template.stop().attr({ 11478 'aria-hidden': true, 11479 'data-is-active': false 11480 }).fadeOut(this.options.fadeOutDuration, function () { 11481 _this.isActive = false; 11482 _this.isClick = false; 11483 }); 11484 /** 11485 * fires when the tooltip is hidden 11486 * @event Tooltip#hide 11487 */ 11488 this.$element.trigger('hide.zf.tooltip'); 11489 } 11490 11491 /** 11492 * adds event listeners for the tooltip and its anchor
11493 * TODO combine some of the listeners like focus and mouseenter, etc. 11494 * @private 11495 */ 11496 11497 }, { 11498 key: '_events', 11499 value: function _events() { 11500 var _this = this; 11501 var $template = this.template; 11502 var isFocus = false; 11503 11504 if (!this.options.disableHover) { 11505 11506 this.$element.on('mouseenter.zf.tooltip', function (e) { 11507 if (!_this.isActive) { 11508 _this.timeout = setTimeout(function () { 11509 _this.show(); 11510 }, _this.options.hoverDelay); 11511 } 11512 }).on('mouseleave.zf.tooltip', function (e) { 11513 clearTimeout(_this.timeout); 11514 if (!isFocus || _this.isClick && !_this.options.clickOpen) { 11515 _this.hide(); 11516 } 11517 }); 11518 } 11519 11520 if (this.options.clickOpen) { 11521 this.$element.on('mousedown.zf.tooltip', function (e) { 11522 e.stopImmediatePropagation(); 11523 if (_this.isClick) { 11524 //_this.hide(); 11525 // _this.isClick = false; 11526 } else { 11527 _this.isClick = true; 11528 if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) { 11529 _this.show(); 11530 } 11531 } 11532 }); 11533 } else { 11534 this.$element.on('mousedown.zf.tooltip', function (e) { 11535 e.stopImmediatePropagation(); 11536 _this.isClick = true; 11537 }); 11538 } 11539 11540 if (!this.options.disableForTouch) { 11541 this.$element.on('tap.zf.tooltip touchend.zf.tooltip', function (e) { 11542 _this.isActive ? _this.hide() : _this.show(); 11543 }); 11544 } 11545 11546 this.$element.on({ 11547 // 'toggle.zf.trigger': this.toggle.bind(this), 11548 // 'close.zf.trigger': this.hide.bind(this) 11549 'close.zf.trigger': this.hide.bind(this) 11550 }); 11551 11552 this.$element.on('focus.zf.tooltip', function (e) { 11553 isFocus = true; 11554 if (_this.isClick) { 11555 // If we're not showing open on clicks, we need to pretend a click-launched focus isn't 11556 // a real focus, otherwise on hover and come back we get bad behavior 11557 if (!_this.options.clickOpen) { 11558 isFocus = false; 11559 } 11560 return false; 11561 } else { 11562 _this.show(); 11563 } 11564 }).on('focusout.zf.tooltip', function (e) { 11565 isFocus = false; 11566 _this.isClick = false; 11567 _this.hide(); 11568 }).on('resizeme.zf.trigger', function () { 11569 if (_this.isActive) { 11570 _this._setPosition(); 11571 } 11572 }); 11573 } 11574 11575 /** 11576 * adds a toggle method, in addition to the static show() & hide() functions 11577 * @function 11578 */ 11579 11580 }, { 11581 key: 'toggle', 11582 value: function toggle() { 11583 if (this.isActive) { 11584 this.hide(); 11585 } else { 11586 this.show(); 11587 } 11588 } 11589 11590 /** 11591 * Destroys an instance of tooltip, removes template element from the view. 11592 * @function 11593 */ 11594 11595 }, { 11596 key: '_destroy', 11597 value: function _destroy() { 11598 this.$element.attr('title', this.template.text()).off('.zf.trigger .zf.tooltip').removeClass('has-tip top right left').removeAttr('aria-describedby aria-haspopup data-disable-hover data-resize data-toggle data-tooltip data-yeti-box'); 11599 11600 this.template.remove(); 11601 } 11602 }]); 11603 11604 return Tooltip; 11605}(__WEBPACK_IMPORTED_MODULE_4__foundation_positionable__["a" /* Positionable */]); 11606 11607Tooltip.defaults = { 11608 disableForTouch: false, 11609 /** 11610 * Time, in ms, before a tooltip should open on hover. 11611 * @option 11612 * @type {number} 11613 * @default 200 11614 */ 11615 hoverDelay: 200, 11616 /** 11617 * Time, in ms, a tooltip should take to fade into view. 11618 * @option 11619 * @type {number} 11620 * @default 150 11621 */ 11622 fadeInDuration: 150, 11623 /** 11624 * Time, in ms, a tooltip should take to fade out of view. 11625 * @option 11626 * @type {number} 11627 * @default 150 11628 */ 11629 fadeOutDuration: 150, 11630 /** 11631 * Disables hover events from opening the tooltip if set to true 11632 * @option 11633 * @type {boolean} 11634 * @default false 11635 */ 11636 disableHover: false, 11637 /** 11638 * Optional addtional classes to apply to the tooltip template on init. 11639 * @option 11640 * @type {string} 11641 * @default '' 11642 */ 11643 templateClasses: '', 11644 /** 11645 * Non-optional class added to tooltip templates. Foundation default is 'tooltip'. 11646 * @option 11647 * @type {string} 11648 * @default 'tooltip' 11649 */ 11650 tooltipClass: 'tooltip', 11651 /** 11652 * Class applied to the tooltip anchor element. 11653 * @option 11654 * @type {string} 11655 * @default 'has-tip' 11656 */ 11657 triggerClass: 'has-tip', 11658 /** 11659 * Minimum breakpoint size at which to open the tooltip. 11660 * @option 11661 * @type {string} 11662 * @default 'small' 11663 */ 11664 showOn: 'small', 11665 /** 11666 * Custom template to be used to generate markup for tooltip. 11667 * @option 11668 * @type {string} 11669 * @default '' 11670 */ 11671 template: '', 11672 /** 11673 * Text displayed in the tooltip template on open. 11674 * @option 11675 * @type {string} 11676 * @default '' 11677 */ 11678 tipText: '', 11679 touchCloseText: 'Tap to close.', 11680 /** 11681 * Allows the tooltip to remain open if triggered with a click or touch event. 11682 * @option 11683 * @type {boolean} 11684 * @default true 11685 */ 11686 clickOpen: true, 11687 /** 11688 * DEPRECATED Additional positioning classes, set by the JS 11689 * @option 11690 * @type {string} 11691 * @default '' 11692 */ 11693 positionClass: '', 11694 /** 11695 * Position of tooltip. Can be left, right, bottom, top, or auto. 11696 * @option 11697 * @type {string} 11698 * @default 'auto' 11699 */ 11700 position: 'auto', 11701 /** 11702 * Alignment of tooltip relative to anchor. Can be left, right, bottom, top, center, or auto. 11703 * @option 11704 * @type {string} 11705 * @default 'auto' 11706 */ 11707 alignment: 'auto', 11708 /** 11709 * Allow overlap of container/window. If false, tooltip will first try to 11710 * position as defined by data-position and data-alignment, but reposition if 11711 * it would cause an overflow. @option 11712 * @type {boolean} 11713 * @default false 11714 */ 11715 allowOverlap: false, 11716 /** 11717 * Allow overlap of only the bottom of the container. This is the most common 11718 * behavior for dropdowns, allowing the dropdown to extend the bottom of the 11719 * screen but not otherwise influence or break out of the container. 11720 * Less common for tooltips. 11721 * @option 11722 * @type {boolean} 11723 * @default false 11724 */ 11725 allowBottomOverlap: false, 11726 /** 11727 * Distance, in pixels, the template should push away from the anch
vendor: 4,136 bytes, lines 11727-11832
11727or on the Y axis. 11728 * @option 11729 * @type {number} 11730 * @default 0 11731 */ 11732 vOffset: 0, 11733 /** 11734 * Distance, in pixels, the template should push away from the anchor on the X axis 11735 * @option 11736 * @type {number} 11737 * @default 0 11738 */ 11739 hOffset: 0, 11740 /** 11741 * Distance, in pixels, the template spacing auto-adjust for a vertical tooltip 11742 * @option 11743 * @type {number} 11744 * @default 14 11745 */ 11746 tooltipHeight: 14, 11747 /** 11748 * Distance, in pixels, the template spacing auto-adjust for a horizontal tooltip 11749 * @option 11750 * @type {number} 11751 * @default 12 11752 */ 11753 tooltipWidth: 12, 11754 /** 11755 * Allow HTML in tooltip. Warning: If you are loading user-generated content into tooltips, 11756 * allowing HTML may open yourself up to XSS attacks. 11757 * @option 11758 * @type {boolean} 11759 * @default false 11760 */ 11761 allowHtml: false 11762}; 11763 11764/** 11765 * TODO utilize resize event trigger 11766 */ 11767 11768 11769 11770/***/ }), 11771/* 33 */ 11772/***/ (function(module, __webpack_exports__, __webpack_require__) { 11773 11774"use strict"; 11775/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SmoothScroll; }); 11776/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 11777/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 11778/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_util_core__ = __webpack_require__(1); 11779/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation_plugin__ = __webpack_require__(2); 11780 11781 11782var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 11783 11784function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11785 11786function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 11787 11788function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 11789 11790 11791 11792 11793 11794/** 11795 * SmoothScroll module. 11796 * @module foundation.smooth-scroll 11797 */ 11798 11799var SmoothScroll = function (_Plugin) { 11800 _inherits(SmoothScroll, _Plugin); 11801 11802 function SmoothScroll() { 11803 _classCallCheck(this, SmoothScroll); 11804 11805 return _possibleConstructorReturn(this, (SmoothScroll.__proto__ || Object.getPrototypeOf(SmoothScroll)).apply(this, arguments)); 11806 } 11807 11808 _createClass(SmoothScroll, [{ 11809 key: '_setup', 11810 11811 /** 11812 * Creates a new instance of SmoothScroll. 11813 * @class 11814 * @name SmoothScroll 11815 * @fires SmoothScroll#init 11816 * @param {Object} element - jQuery object to add the trigger to. 11817 * @param {Object} options - Overrides to the default plugin settings. 11818 */ 11819 value: function _setup(element, options) { 11820 this.$element = element; 11821 this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, SmoothScroll.defaults, this.$element.data(), options); 11822 this.className = 'SmoothScroll'; // ie9 back compat 11823 11824 this._init(); 11825 } 11826 11827 /** 11828 * Initialize the SmoothScroll plugin 11829 * @private 11830 */ 11831 11832 }, {
11833 key: '_init', 11834 value: function _init() { 11835 var id = this.$element[0].id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__foundation_util_core__["a" /* GetYoDigits */])(6, 'smooth-scroll'); 11836 var _this = this; 11837 this.$element.attr({ 11838 'id': id 11839 }); 11840 11841 this._events(); 11842 } 11843 11844 /** 11845 * Initializes events for SmoothScroll. 11846 * @private 11847 */ 11848 11849 }, { 11850 key: '_events', 11851 value: function _events() { 11852 var _this = this; 11853 11854 // click handler function. 11855 var handleLinkClick = function (e) { 11856 // exit function if the event source isn't coming from an anchor with href attribute starts with '#' 11857 if (!__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).is('a[href^="#"]')) { 11858 return false; 11859 } 11860 11861 var arrival = this.getAttribute('href'); 11862 11863 _this._inTransition = true; 11864 11865 SmoothScroll.scrollToLoc(arrival, _this.options, function () { 11866 _this._inTransition = false; 11867 }); 11868 11869 e.preventDefault(); 11870 }; 11871 11872 this.$element.on('click.zf.smoothScroll', handleLinkClick); 11873 this.$element.on('click.zf.smoothScroll', 'a[href^="#"]', handleLinkClick); 11874 } 11875 11876 /** 11877 * Function to scroll to a given location on the page. 11878 * @param {String} loc - A properly formatted jQuery id selector. Example: '#foo' 11879 * @param {Object} options - The options to use. 11880 * @param {Function} callback - The callback function. 11881 * @static 11882 * @function 11883 */ 11884 11885 }], [{ 11886 key: 'scrollToLoc', 11887 value: function scrollToLoc(loc) { 11888 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SmoothScroll.defaults; 11889 var callback = arguments[2]; 11890 11891 // Do nothing if target does not exist to prevent errors 11892 if (!__WEBPACK_IMPORTED_MODULE_0_jquery___default()(loc).length) { 11893 return false; 11894 } 11895 11896 var scrollPos = Math.round(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(loc).offset().top - options.threshold / 2 - options.offset); 11897 11898 __WEBPACK_IMPORTED_MODULE_0_jquery___default()('html, body').stop(true).animate({ scrollTop: scrollPos }, options.animationDuration, options.animationEasing, function () { 11899 if (callback && typeof callback == "function") { 11900 callback(); 11901 } 11902 }); 11903 } 11904 }]); 11905 11906 return SmoothScroll; 11907}(__WEBPACK_IMPORTED_MODULE_2__foundation_plugin__["a" /* Plugin */]); 11908 11909/** 11910 * Default settings for plugin. 11911 */ 11912 11913 11914SmoothScroll.defaults = { 11915 /** 11916 * Amount of time, in ms, the animated scrolling should take between locations. 11917 * @option 11918 * @type {number} 11919 * @default 500 11920 */ 11921 animationDuration: 500, 11922 /** 11923 * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`. 11924 * @option 11925 * @type {string} 11926 * @default 'linear' 11927 * @see {@link https://api.jquery.com/animate|Jquery animate} 11928 */ 11929 animationEasing: 'linear', 11930 /** 11931 * Number of pixels to use as a marker for location changes. 11932 * @option 11933 * @type {number} 11934 * @default 50 11935 */ 11936 threshold: 50, 11937 /** 11938 * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar. 11939 * @option 11940 * @type {number} 11941 * @default 0 11942 */ 11943 offset: 0 11944}; 11945 11946 11947 11948/***/ }), 11949/* 34 */ 11950/***/ (function(module, __webpack_exports__, __webpack_require__) { 11951 11952"use strict"; 11953/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Timer; }); 11954/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 11955/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 11956 11957 11958 11959 11960function Timer(elem, options, cb) { 11961 var _this = this, 11962 duration = options.duration, 11963 //options is an object for easily adding features later. 11964 nameSpace = Object.keys(elem.data())[0] || 'timer', 11965 remain = -1, 11966 start, 11967 timer; 11968 11969 this.isPaused = false;
11970 11971 this.restart = function () { 11972 remain = -1; 11973 clearTimeout(timer); 11974 this.start(); 11975 }; 11976 11977 this.start = function () { 11978 this.isPaused = false; 11979 // if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 11980 clearTimeout(timer); 11981 remain = remain <= 0 ? duration : remain; 11982 elem.data('paused', false); 11983 start = Date.now(); 11984 timer = setTimeout(function () { 11985 if (options.infinite) { 11986 _this.restart(); //rerun the timer. 11987 } 11988 if (cb && typeof cb === 'function') { 11989 cb(); 11990 } 11991 }, remain); 11992 elem.trigger('timerstart.zf.' + nameSpace); 11993 }; 11994 11995 this.pause = function () { 11996 this.isPaused = true; 11997 //if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 11998 clearTimeout(timer); 11999 elem.data('paused', true); 12000 var end = Date.now(); 12001 remain = remain - (end - start); 12002 elem.trigger('timerpaused.zf.' + nameSpace); 12003 }; 12004} 12005 12006 12007 12008/***/ }), 12009/* 35 */ 12010/***/ (function(module, __webpack_exports__, __webpack_require__) { 12011 12012"use strict"; 12013Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); 12014/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 12015/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 12016/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__ = __webpack_require__(18); 12017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_util_mediaQuery__ = __webpack_require__(3); 12018/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_util_triggers__ = __webpack_require__(5); 12019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_abide__ = __webpack_require__(17); 12020/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_accordion__ = __webpack_require__(10); 12021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_accordionMenu__ = __webpack_require__(11); 12022/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_drilldown__ = __webpack_require__(12); 12023/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_dropdown__ = __webpack_require__(19); 12024/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_dropdownMenu__ = __webpack_require__(13); 12025/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_equalizer__ = __webpack_require__(20); 12026/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_interchange__ = __webpack_require__(21); 12027/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_magellan__ = __webpack_require__(22); 12028/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_offcanvas__ = __webpack_require__(23); 12029/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_orbit__ = __webpack_require__(24); 12030/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_responsiveMenu__ = __webpack_require__(26); 12031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_responsiveToggle__ = __webpack_require__(27); 12032/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_reveal__ = __webpack_require__(28); 12033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_slider__ = __webpack_require__(29); 12034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_sticky__ = __webpack_require__(30); 12035/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_tabs__ = __webpack_require__(14); 12036/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_toggler__ = __webpack_require__(31); 12037/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_tooltip__ = __webpack_require__(32); 12038/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_responsiveAccordionTabs__ = __webpack_require__(25); 12039 12040 12041__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].addToJquery(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a); 12042 12043__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].MediaQuery = __WEBPACK_IMPORTED_MODULE_2__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_util_mediaQuery__["a" /* MediaQuery */]; 12044 12045__WEBPACK_IMPORTED_MODULE_3__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_util_triggers__["a" /* Triggers */].init(__WEBPACK_IMPORTED_MODULE_0_jquery___default.a, __WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */]); 12046 12047__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_4__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_abide__["a" /* Abide */], 'Abide'); 12048 12049__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_5__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_accordion__["a" /* Accordion */], 'Accordion'); 12050 12051__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_6__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_accordionMenu__["a" /* AccordionMenu */], 'AccordionMenu'); 12052 12053__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_7__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_drilldown__["a" /* Drilldown */], 'Drilldown'); 12054 12055__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_8__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_dropdown__["a" /* Dropdown */], 'Dropdown'); 12056 12057__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_9__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_dropdownMenu__["a" /* DropdownMenu */], 'DropdownMenu'); 12058 12059__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_10__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_equalizer__["a" /* Equalizer */], 'Equalizer'); 12060 12061__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_11__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_interchange__["a" /* Interchange */], 'Interchange'); 12062 12063__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_12__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_magellan__["a" /* Magellan */], 'Magellan'); 12064 12065__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_13__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_offcanvas__["a" /* OffCanvas */], 'OffCanvas'); 12066 12067__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_14__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_orbit__["a" /* Orbit */], 'Orbit'); 12068 12069__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_15__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_responsiveMenu__["a" /* ResponsiveMenu */], 'ResponsiveMenu'); 12070 12071__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_16__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_responsiveToggle__["a" /* ResponsiveToggle */], 'ResponsiveToggle'); 12072 12073__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_17__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_reveal__["a" /* Reveal */], 'Reveal'); 12074 12075__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_18__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_slider__["a" /* Slider */], 'Slider'); 12076 12077__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_19__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_sticky__["a" /* Sticky */], 'Sticky'); 12078 12079__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_20__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_tabs__["a" /* Tabs */], 'Tabs'); 12080 12081__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_21__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_toggler__["a" /* Toggler */], 'Toggler'); 12082 12083__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_22__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_tooltip__["a" /* Tooltip */], 'Tooltip'); 12084 12085__WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__["a" /* Foundation */].plugin(__WEBPACK_IMPORTED_MODULE_23__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_responsiveAccordionTabs__["a" /* ResponsiveAccordionTabs */], 'ResponsiveAccordionTabs'); 12086 12087/***/ }) 12088/******/ ]); 12089 12090$(document).foundation()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.