1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // identity function for calling harmony imports with the correct context 37/******/ __webpack_require__.i = function(value) { return value; }; 38/******/ 39/******/ // define getter function for harmony exports 40/******/ __webpack_require__.d = function(exports, name, getter) { 41/******/ if(!__webpack_require__.o(exports, name)) { 42/******/ Object.defineProperty(exports, name, { 43/******/ configurable: false, 44/******/ enumerable: true, 45/******/ get: getter 46/******/ }); 47/******/ } 48/******/ }; 49/******/ 50/******/ // getDefaultExport function for compatibility with non-harmony modules 51/******/ __webpack_require__.n = function(module) { 52/******/ var getter = module && module.__esModule ? 53/******/ function getDefault() { return module['default']; } : 54/******/ function getModuleExports() { return module; }; 55/******/ __webpack_require__.d(getter, 'a', getter); 56/******/ return getter; 57/******/ }; 58/******/ 59/******/ // Object.prototype.hasOwnProperty.call 60/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61/******/ 62/******/ // __webpack_public_path__ 63/******/ __webpack_require__.p = ""; 64/******/ 65/******/ // Load entry module and return exports 66/******/ return __webpack_require__(__webpack_require__.s = 40); 67/******/ }) 68/************************************************************************/ 69/******/ ([ 70/* 0 */ 71/***/ (function(module, exports) { 72 73module.exports = jQuery; 74 75/***/ }), 76/* 1 */ 77/***/ (function(module, exports, __webpack_require__) { 78 79"use strict"; 80 81 82Object.defineProperty(exports, "__esModule", { 83 value: true 84}); 85exports.transitionend = exports.GetYoDigits = exports.rtl = undefined; 86 87var _jquery = __webpack_require__(0); 88 89var _jquery2 = _interopRequireDefault(_jquery); 90 91function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 92 93// Core Foundation Utilities, utilized in a number of places. 94 95/** 96 * Returns a boolean for RTL support 97 */ 98function rtl() { 99 return (0, _jquery2.default)('html').attr('dir') === 'rtl'; 100} 101 102/** 103 * returns a random base-36 uid with namespacing 104 * @function 105 * @param {Number} length - number of random base-36 digits desired. Increase for more random strings. 106 * @param {String} namespace - name of plugin to be incorporated in uid, optional. 107 * @default {String} '' - if no plugin name is provided, nothing is appended to the uid. 108 * @returns {String} - unique id 109 */ 110function GetYoDigits(length, namespace) { 111 length = length || 6; 112 return Math.round(Math.pow(36, length + 1) - Math.random() * Math.pow(36, length)).toString(36).slice(1) + (namespace ? '-' + namespace : ''); 113} 114 115function transitionend($elem) { 116 var transitions = { 117 'transition': 'transitionend', 118 'WebkitTransition': 'webkitTransitionEnd', 119 'MozTransition': 'transitionend', 120 'OTransition': 'otransitionend' 121 }; 122 var elem = document.createElement('div'), 123 end; 124 125 for (var t in transitions) { 126 if (typeof elem.style[t] !== 'undefined') { 127 end = transitions[t]; 128 } 129 } 130 if (end) { 131 return end; 132 } else { 133 end = setTimeout(function () { 134 $elem.triggerHandler('transitionend', [$elem]); 135 }, 1); 136 return 'transitionend'; 137 } 138} 139 140exports.rtl = rtl; 141exports.GetYoDigits = GetYoDigits; 142exports.transitionend = transitionend; 143 144/***/ }), 145/* 2 */ 146/***/ (function(module, exports, __webpack_require__) { 147 148"use strict"; 149 150 151Object.defineProperty(exports, "__esModule", { 152 value: true 153}); 154exports.Plugin = undefined; 155 156var _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; }; }(); 157 158var _jquery = __webpack_require__(0); 159 160var _jquery2 = _interopRequireDefault(_jquery); 161 162var _foundationUtil = __webpack_require__(1); 163 164function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 165 166function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 167 168// Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST 169// {function} _setup (replaces previous constructor),
170// {function} _destroy (replaces previous destroy) 171var Plugin = function () { 172 function Plugin(element, options) { 173 _classCallCheck(this, Plugin); 174 175 this._setup(element, options); 176 var pluginName = getPluginName(this); 177 this.uuid = (0, _foundationUtil.GetYoDigits)(6, pluginName); 178 179 if (!this.$element.attr('data-' + pluginName)) { 180 this.$element.attr('data-' + pluginName, this.uuid); 181 } 182 if (!this.$element.data('zfPlugin')) { 183 this.$element.data('zfPlugin', this); 184 } 185 /** 186 * Fires when the plugin has initialized. 187 * @event Plugin#init 188 */ 189 this.$element.trigger('init.zf.' + pluginName); 190 } 191 192 _createClass(Plugin, [{ 193 key: 'destroy', 194 value: function destroy() { 195 this._destroy(); 196 var pluginName = getPluginName(this); 197 this.$element.removeAttr('data-' + pluginName).removeData('zfPlugin') 198 /** 199 * Fires when the plugin has been destroyed. 200 * @event Plugin#destroyed 201 */ 202 .trigger('destroyed.zf.' + pluginName); 203 for (var prop in this) { 204 this[prop] = null; //clean up script to prep for garbage collection. 205 } 206 } 207 }]); 208 209 return Plugin; 210}(); 211 212// Convert PascalCase to kebab-case 213// Thank you: http://stackoverflow.com/a/8955580 214 215 216function hyphenate(str) { 217 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 218} 219 220function getPluginName(obj) { 221 if (typeof obj.constructor.name !== 'undefined') { 222 return hyphenate(obj.constructor.name); 223 } else { 224 return hyphenate(obj.className); 225 } 226} 227 228exports.Plugin = Plugin; 229 230/***/ }), 231/* 3 */ 232/***/ (function(module, exports, __webpack_require__) { 233 234"use strict"; 235/******************************************* 236 * * 237 * This util was created by Marius Olbertz * 238 * Please thank Marius on GitHub /owlbertz * 239 * or the web http://www.mariusolbertz.de/ * 240 * * 241 ******************************************/ 242 243 244 245Object.defineProperty(exports, "__esModule", { 246 value: true 247}); 248exports.Keyboard = undefined; 249 250var _jquery = __webpack_require__(0); 251 252var _jquery2 = _interopRequireDefault(_jquery); 253 254var _foundationUtil = __webpack_require__(1); 255 256function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 257 258var keyCodes = { 259 9: 'TAB', 260 13: 'ENTER', 261 27: 'ESCAPE', 262 32: 'SPACE', 263 35: 'END', 264 36: 'HOME', 265 37: 'ARROW_LEFT', 266 38: 'ARROW_UP', 267 39: 'ARROW_RIGHT', 268 40: 'ARROW_DOWN' 269}; 270 271var commands = {}; 272 273// Functions pulled out to be referenceable from internals 274function findFocusable($element) { 275 if (!$element) { 276 return false; 277 } 278 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 () { 279 if (!(0, _jquery2.default)(this).is(':visible') || (0, _jquery2.default)(this).attr('tabindex') < 0) { 280 return false; 281 } //only have visible elements and those that have a tabindex greater or equal 0 282 return true; 283 }); 284} 285 286function parseKey(event) { 287 var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase(); 288 289 // Remove un-printable characters, e.g. for `fromCharCode` calls for CTRL only events 290 key = key.replace(/\W+/, ''); 291 292 if (event.shiftKey) key = 'SHIFT_' + key; 293 if (event.ctrlKey) key = 'CTRL_' + key; 294 if (event.altKey) key = 'ALT_' + key; 295 296 // Remove trailing underscore, in case only modifiers were used (e.g. only `CTRL_ALT`) 297 key = key.replace(/_$/, ''); 298 299 return key; 300} 301 302var Keyboard = { 303 keys: getKeyCodes(keyCodes), 304 305 /** 306 * Parses the (keyboard) event and returns a String that represents its key 307 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 308 * @param {Event} event - the event generated by the event handler 309 * @return String key - String that represents the key pressed 310 */ 311 parseKey: parseKey, 312 313 /** 314 * Handles the given (keyboard) event 315 * @param {Event} event - the event generated by the event handler 316 * @param {String} component - Foundation component's name, e.g. Slider or Reveal 317 * @param {Objects} functions - collection of functions that are to be executed 318 */ 319 handleKey: function handleKey(event, component, functions) { 320 var commandList = commands[component], 321 keyCode = this.parseKey(event), 322 cmds, 323 command, 324 fn; 325 326 if (!commandList) return console.warn('Component not defined!'); 327 328 if (typeof commandList.ltr === 'undefined') { 329 // this component does not differentiate between ltr and rtl 330 cmds = commandList; // use plain list 331 } else {
332 // merge ltr and rtl: if document is rtl, rtl overwrites ltr and vice versa 333 if ((0, _foundationUtil.rtl)()) cmds = _jquery2.default.extend({}, commandList.ltr, commandList.rtl);else cmds = _jquery2.default.extend({}, commandList.rtl, commandList.ltr); 334 } 335 command = cmds[keyCode]; 336 337 fn = functions[command]; 338 if (fn && typeof fn === 'function') { 339 // execute function if exists 340 var returnValue = fn.apply(); 341 if (functions.handled || typeof functions.handled === 'function') { 342 // execute function when event was handled 343 functions.handled(returnValue); 344 } 345 } else { 346 if (functions.unhandled || typeof functions.unhandled === 'function') { 347 // execute function when event was not handled 348 functions.unhandled(); 349 } 350 } 351 }, 352 353 354 /** 355 * Finds all focusable elements within the given `$element` 356 * @param {jQuery} $element - jQuery object to search within 357 * @return {jQuery} $focusable - all focusable elements within `$element` 358 */ 359 360 findFocusable: findFocusable, 361 362 /** 363 * Returns the component name name 364 * @param {Object} component - Foundation component, e.g. Slider or Reveal 365 * @return String componentName 366 */ 367 368 register: function register(componentName, cmds) { 369 commands[componentName] = cmds; 370 }, 371 372 373 // TODO9438: These references to Keyboard need to not require global. Will 'this' work in this context? 374 // 375 /** 376 * Traps the focus in the given element. 377 * @param {jQuery} $element jQuery object to trap the foucs into. 378 */ 379 trapFocus: function trapFocus($element) { 380 var $focusable = findFocusable($element), 381 $firstFocusable = $focusable.eq(0), 382 $lastFocusable = $focusable.eq(-1); 383 384 $element.on('keydown.zf.trapfocus', function (event) { 385 if (event.target === $lastFocusable[0] && parseKey(event) === 'TAB') { 386 event.preventDefault(); 387 $firstFocusable.focus(); 388 } else if (event.target === $firstFocusable[0] && parseKey(event) === 'SHIFT_TAB') { 389 event.preventDefault(); 390 $lastFocusable.focus(); 391 } 392 }); 393 }, 394 395 /** 396 * Releases the trapped focus from the given element. 397 * @param {jQuery} $element jQuery object to release the focus for. 398 */ 399 releaseFocus: function releaseFocus($element) { 400 $element.off('keydown.zf.trapfocus'); 401 } 402}; 403 404/* 405 * Constants for easier comparing. 406 * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE 407 */ 408function getKeyCodes(kcs) { 409 var k = {}; 410 for (var kc in kcs) { 411 k[kcs[kc]] = kcs[kc]; 412 }return k; 413} 414 415exports.Keyboard = Keyboard; 416 417/***/ }), 418/* 4 */ 419/***/ (function(module, exports, __webpack_require__) { 420 421"use strict"; 422 423 424Object.defineProperty(exports, "__esModule", { 425 value: true 426}); 427exports.MediaQuery = undefined; 428 429var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 430 431var _jquery = __webpack_require__(0); 432 433var _jquery2 = _interopRequireDefault(_jquery); 434 435function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 436 437// Default set of media queries 438var defaultQueries = { 439 'default': 'only screen', 440 landscape: 'only screen and (orientation: landscape)', 441 portrait: 'only screen and (orientation: portrait)', 442 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)' 443}; 444 445// matchMedia() polyfill - Test a CSS media type/query in JS. 446// Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license 447var matchMedia = window.matchMedia || function () { 448 'use strict'; 449 450 // For browsers that support matchMedium api such as IE 9 and webkit 451 452 var styleMedia = window.styleMedia || window.media; 453 454 // For those that don't support matchMedium 455 if (!styleMedia) { 456 var style = document.createElement('style'), 457 script = document.getElementsByTagName('script')[0], 458 info = null; 459 460 style.type = 'text/css'; 461 style.id = 'matchmediajs-test'; 462 463 script && script.parentNode && script.parentNode.insertBefore(style, script); 464 465 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 466 info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle; 467 468 styleMedia = { 469 matchMedium: function matchMedium(media) { 470 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 471 472 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 473 if (style.styleSheet) { 474 style.styleSheet.cssText = text; 475 } else { 476 style.textContent = text; 477 } 478 479 // Test if media query is true or false 480 return info.width === '1px'; 481 } 482 }; 483 } 484 485 return function (media) { 486 return { 487 matches: styleMedia.matchMedium(media || 'all'), 488 media: media || 'all' 489 }; 490 }; 491}(); 492 493var MediaQuery = { 494 queries: [], 495 496 current: '', 497 498 /** 499 * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher. 500 * @function 501 * @private 502 */ 503 _init: function _init() { 504 var self = this; 505 var $meta = (0, _jquery2.default)('meta.foundation-mq'); 506 if (!$meta.length) { 507 (0, _jquery2.default)('<meta class="foundation-mq">').appendTo(document.head); 508 } 509 510 var extractedStyles = (0, _jquery2.default)('.foundation-mq').css('font-family'); 511 var namedQueries; 512 513 namedQueries = parseStyleToObject(extractedStyles); 514
515 for (var key in namedQueries) { 516 if (namedQueries.hasOwnProperty(key)) { 517 self.queries.push({ 518 name: key, 519 value: 'only screen and (min-width: ' + namedQueries[key] + ')' 520 }); 521 } 522 } 523 524 this.current = this._getCurrentSize(); 525 526 this._watcher(); 527 }, 528 529 530 /** 531 * Checks if the screen is at least as wide as a breakpoint. 532 * @function 533 * @param {String} size - Name of the breakpoint to check. 534 * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller. 535 */ 536 atLeast: function atLeast(size) { 537 var query = this.get(size); 538 539 if (query) { 540 return matchMedia(query).matches; 541 } 542 543 return false; 544 }, 545 546 547 /** 548 * Checks if the screen matches to a breakpoint. 549 * @function 550 * @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method. 551 * @returns {Boolean} `true` if the breakpoint matches, `false` if it does not. 552 */ 553 is: function is(size) { 554 size = size.trim().split(' '); 555 if (size.length > 1 && size[1] === 'only') { 556 if (size[0] === this._getCurrentSize()) return true; 557 } else { 558 return this.atLeast(size[0]); 559 } 560 return false; 561 }, 562 563 564 /** 565 * Gets the media query of a breakpoint. 566 * @function 567 * @param {String} size - Name of the breakpoint to get. 568 * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist. 569 */ 570 get: function get(size) { 571 for (var i in this.queries) { 572 if (this.queries.hasOwnProperty(i)) { 573 var query = this.queries[i]; 574 if (size === query.name) return query.value; 575 } 576 } 577 578 return null; 579 }, 580 581 582 /** 583 * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one). 584 * @function 585 * @private 586 * @returns {String} Name of the current breakpoint. 587 */ 588 _getCurrentSize: function _getCurrentSize() { 589 var matched; 590 591 for (var i = 0; i < this.queries.length; i++) { 592 var query = this.queries[i]; 593 594 if (matchMedia(query.value).matches) { 595 matched = query; 596 } 597 } 598 599 if ((typeof matched === 'undefined' ? 'undefined' : _typeof(matched)) === 'object') { 600 return matched.name; 601 } else { 602 return matched; 603 } 604 }, 605 606 607 /** 608 * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes. 609 * @function 610 * @private 611 */ 612 _watcher: function _watcher() { 613 var _this = this; 614 615 (0, _jquery2.default)(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () { 616 var newSize = _this._getCurrentSize(), 617 currentSize = _this.current; 618 619 if (newSize !== currentSize) { 620 // Change the current media query 621 _this.current = newSize; 622 623 // Broadcast the media query change on the window 624 (0, _jquery2.default)(window).trigger('changed.zf.mediaquery', [newSize, currentSize]); 625 } 626 }); 627 } 628}; 629 630// Thank you: https://github.com/sindresorhus/query-string 631function parseStyleToObject(str) { 632 var styleObject = {}; 633 634 if (typeof str !== 'string') { 635 return styleObject; 636 } 637 638 str = str.trim().slice(1, -1); // browsers re-quote string style values 639 640 if (!str) { 641 return styleObject; 642 } 643 644 styleObject = str.split('&').reduce(function (ret, param) { 645 var parts = param.replace(/\+/g, ' ').split('='); 646 var key = parts[0]; 647 var val = parts[1]; 648 key = decodeURIComponent(key); 649 650 // missing `=` should be `null`: 651 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters 652 val = val === undefined ? null : decodeURIComponent(val); 653 654 if (!ret.hasOwnProperty(key)) { 655 ret[key] = val; 656 } else if (Array.isArray(ret[key])) { 657 ret[key].push(val); 658 } else { 659 ret[key] = [ret[key], val]; 660 } 661 return ret; 662 }, {}); 663 664 return styleObject; 665} 666 667exports.MediaQuery = MediaQuery; 668 669/***/ }), 670/* 5 */ 671/***/ (function(module, exports, __webpack_require__) { 672 673"use strict"; 674 675 676Object.defineProperty(exports, "__esModule", { 677 value: true 678}); 679exports.Triggers = undefined; 680 681var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 682 683var _jquery = __webpack_require__(0); 684 685var _jquery2 = _interopRequireDefault(_jquery); 686 687var _foundationUtil = __webpack_require__(6); 688 689function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 690 691var MutationObserver = function () { 692 var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']; 693 for (var i = 0; i < prefixes.length; i++) { 694 if (prefixes[i] + 'MutationObserver' in window) { 695 return window[prefixes[i] + 'MutationObserver']; 696 } 697 } 698 return false;
699}(); 700 701var triggers = function triggers(el, type) { 702 el.data(type).split(' ').forEach(function (id) { 703 (0, _jquery2.default)('#' + id)[type === 'close' ? 'trigger' : 'triggerHandler'](type + '.zf.trigger', [el]); 704 }); 705}; 706 707var Triggers = { 708 Listeners: { 709 Basic: {}, 710 Global: {} 711 }, 712 Initializers: {} 713}; 714 715Triggers.Listeners.Basic = { 716 openListener: function openListener() { 717 triggers((0, _jquery2.default)(this), 'open'); 718 }, 719 closeListener: function closeListener() { 720 var id = (0, _jquery2.default)(this).data('close'); 721 if (id) { 722 triggers((0, _jquery2.default)(this), 'close'); 723 } else { 724 (0, _jquery2.default)(this).trigger('close.zf.trigger'); 725 } 726 }, 727 toggleListener: function toggleListener() { 728 var id = (0, _jquery2.default)(this).data('toggle'); 729 if (id) { 730 triggers((0, _jquery2.default)(this), 'toggle'); 731 } else { 732 (0, _jquery2.default)(this).trigger('toggle.zf.trigger'); 733 } 734 }, 735 closeableListener: function closeableListener(e) { 736 e.stopPropagation(); 737 var animation = (0, _jquery2.default)(this).data('closable'); 738 739 if (animation !== '') { 740 _foundationUtil.Motion.animateOut((0, _jquery2.default)(this), animation, function () { 741 (0, _jquery2.default)(this).trigger('closed.zf'); 742 }); 743 } else { 744 (0, _jquery2.default)(this).fadeOut().trigger('closed.zf'); 745 } 746 }, 747 toggleFocusListener: function toggleFocusListener() { 748 var id = (0, _jquery2.default)(this).data('toggle-focus'); 749 (0, _jquery2.default)('#' + id).triggerHandler('toggle.zf.trigger', [(0, _jquery2.default)(this)]); 750 } 751}; 752 753// Elements with [data-open] will reveal a plugin that supports it when clicked. 754Triggers.Initializers.addOpenListener = function ($elem) { 755 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.openListener); 756 $elem.on('click.zf.trigger', '[data-open]', Triggers.Listeners.Basic.openListener); 757}; 758 759// Elements with [data-close] will close a plugin that supports it when clicked. 760// If used without a value on [data-close], the event will bubble, allowing it to close a parent component. 761Triggers.Initializers.addCloseListener = function ($elem) { 762 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.closeListener); 763 $elem.on('click.zf.trigger', '[data-close]', Triggers.Listeners.Basic.closeListener); 764}; 765 766// Elements with [data-toggle] will toggle a plugin that supports it when clicked. 767Triggers.Initializers.addToggleListener = function ($elem) { 768 $elem.off('click.zf.trigger', Triggers.Listeners.Basic.toggleListener); 769 $elem.on('click.zf.trigger', '[data-toggle]', Triggers.Listeners.Basic.toggleListener); 770}; 771 772// Elements with [data-closable] will respond to close.zf.trigger events. 773Triggers.Initializers.addCloseableListener = function ($elem) { 774 $elem.off('close.zf.trigger', Triggers.Listeners.Basic.closeableListener); 775 $elem.on('close.zf.trigger', '[data-closeable], [data-closable]', Triggers.Listeners.Basic.closeableListener); 776}; 777 778// Elements with [data-toggle-focus] will respond to coming in and out of focus 779Triggers.Initializers.addToggleFocusListener = function ($elem) { 780 $elem.off('focus.zf.trigger blur.zf.trigger', Triggers.Listeners.Basic.toggleFocusListener); 781 $elem.on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', Triggers.Listeners.Basic.toggleFocusListener); 782}; 783 784// More Global/complex listeners and triggers 785Triggers.Listeners.Global = { 786 resizeListener: function resizeListener($nodes) { 787 if (!MutationObserver) { 788 //fallback for IE 9 789 $nodes.each(function () { 790 (0, _jquery2.default)(this).triggerHandler('resizeme.zf.trigger'); 791 }); 792 } 793 //trigger all listening elements and signal a resize event 794 $nodes.attr('data-events', "resize"); 795 }, 796 scrollListener: function scrollListener($nodes) { 797 if (!MutationObserver) { 798 //fallback for IE 9 799 $nodes.each(function () { 800 (0, _jquery2.default)(this).triggerHandler('scrollme.zf.trigger'); 801 }); 802 } 803 //trigger all listening elements and signal a scroll event 804 $nodes.attr('data-events', "scroll"); 805 }, 806 closeMeListener: function closeMeListener(e, pluginId) { 807 var plugin = e.namespace.split('.')[0]; 808 var plugins = (0, _jquery2.default)('[data-' + plugin + ']').not('[data-yeti-box="' + pluginId + '"]'); 809 810 plugins.each(function () { 811 var _this = (0, _jquery2.default)(this); 812 _this.triggerHandler('close.zf.trigger', [_this]); 813 }); 814 } 815 816 // Global, parses whole document. 817};
817Triggers.Initializers.addClosemeListener = function (pluginName) { 818 var yetiBoxes = (0, _jquery2.default)('[data-yeti-box]'), 819 plugNames = ['dropdown', 'tooltip', 'reveal']; 820 821 if (pluginName) { 822 if (typeof pluginName === 'string') { 823 plugNames.push(pluginName); 824 } else if ((typeof pluginName === 'undefined' ? 'undefined' : _typeof(pluginName)) === 'object' && typeof pluginName[0] === 'string') { 825 plugNames.concat(pluginName); 826 } else { 827 console.error('Plugin names must be strings'); 828 } 829 } 830 if (yetiBoxes.length) { 831 var listeners = plugNames.map(function (name) { 832 return 'closeme.zf.' + name; 833 }).join(' '); 834 835 (0, _jquery2.default)(window).off(listeners).on(listeners, Triggers.Listeners.Global.closeMeListener); 836 } 837}; 838 839function debounceGlobalListener(debounce, trigger, listener) { 840 var timer = void 0, 841 args = Array.prototype.slice.call(arguments, 3); 842 (0, _jquery2.default)(window).off(trigger).on(trigger, function (e) { 843 if (timer) { 844 clearTimeout(timer); 845 } 846 timer = setTimeout(function () { 847 listener.apply(null, args); 848 }, debounce || 10); //default time to emit scroll event 849 }); 850} 851 852Triggers.Initializers.addResizeListener = function (debounce) { 853 var $nodes = (0, _jquery2.default)('[data-resize]'); 854 if ($nodes.length) { 855 debounceGlobalListener(debounce, 'resize.zf.trigger', Triggers.Listeners.Global.resizeListener, $nodes); 856 } 857}; 858 859Triggers.Initializers.addScrollListener = function (debounce) { 860 var $nodes = (0, _jquery2.default)('[data-scroll]'); 861 if ($nodes.length) { 862 debounceGlobalListener(debounce, 'scroll.zf.trigger', Triggers.Listeners.Global.scrollListener, $nodes); 863 } 864}; 865 866Triggers.Initializers.addMutationEventsListener = function ($elem) { 867 if (!MutationObserver) { 868 return false; 869 } 870 var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]'); 871 872 //element callback 873 var listeningElementsMutation = function listeningElementsMutation(mutationRecordsList) { 874 var $target = (0, _jquery2.default)(mutationRecordsList[0].target); 875 876 //trigger the event handler for the element depending on type 877 switch (mutationRecordsList[0].type) { 878 case "attributes": 879 if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") { 880 $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]); 881 } 882 if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") { 883 $target.triggerHandler('resizeme.zf.trigger', [$target]); 884 } 885 if (mutationRecordsList[0].attributeName === "style") { 886 $target.closest("[data-mutate]").attr("data-events", "mutate"); 887 $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]); 888 } 889 break; 890 891 case "childList": 892 $target.closest("[data-mutate]").attr("data-events", "mutate"); 893 $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]); 894 break; 895 896 default: 897 return false; 898 //nothing 899 } 900 }; 901 902 if ($nodes.length) { 903 //for each element that needs to listen for resizing, scrolling, or mutation add a single observer 904 for (var i = 0; i <= $nodes.length - 1; i++) { 905 var elementObserver = new MutationObserver(listeningElementsMutation); 906 elementObserver.observe($nodes[i], { attributes: true, childList: true, characterData: false, subtree: true, attributeFilter: ["data-events", "style"] }); 907 } 908 } 909}; 910 911Triggers.Initializers.addSimpleListeners = function () { 912 var $document = (0, _jquery2.default)(document); 913 914 Triggers.Initializers.addOpenListener($document); 915 Triggers.Initializers.addCloseListener($document); 916 Triggers.Initializers.addToggleListener($document); 917 Triggers.Initializers.addCloseableListener($document); 918 Triggers.Initializers.addToggleFocusListener($document); 919}; 920 921Triggers.Initializers.addGlobalListeners = function () { 922 var $document = (0, _jquery2.default)(document);
923 Triggers.Initializers.addMutationEventsListener($document); 924 Triggers.Initializers.addResizeListener(); 925 Triggers.Initializers.addScrollListener(); 926 Triggers.Initializers.addClosemeListener(); 927}; 928 929Triggers.init = function ($, Foundation) { 930 if (typeof $.triggersInitialized === 'undefined') { 931 var $document = $(document); 932 933 if (document.readyState === "complete") { 934 Triggers.Initializers.addSimpleListeners(); 935 Triggers.Initializers.addGlobalListeners(); 936 } else { 937 $(window).on('load', function () { 938 Triggers.Initializers.addSimpleListeners(); 939 Triggers.Initializers.addGlobalListeners(); 940 }); 941 } 942 943 $.triggersInitialized = true; 944 } 945 946 if (Foundation) { 947 Foundation.Triggers = Triggers; 948 // Legacy included to be backwards compatible for now. 949 Foundation.IHearYou = Triggers.Initializers.addGlobalListeners; 950 } 951}; 952 953exports.Triggers = Triggers; 954 955/***/ }), 956/* 6 */ 957/***/ (function(module, exports, __webpack_require__) { 958 959"use strict"; 960 961 962Object.defineProperty(exports, "__esModule", { 963 value: true 964}); 965exports.Motion = exports.Move = undefined; 966 967var _jquery = __webpack_require__(0); 968 969var _jquery2 = _interopRequireDefault(_jquery); 970 971var _foundationUtil = __webpack_require__(1); 972 973function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 974 975/** 976 * Motion module. 977 * @module foundation.motion 978 */ 979 980var initClasses = ['mui-enter', 'mui-leave']; 981var activeClasses = ['mui-enter-active', 'mui-leave-active']; 982 983var Motion = { 984 animateIn: function animateIn(element, animation, cb) { 985 animate(true, element, animation, cb); 986 }, 987 988 animateOut: function animateOut(element, animation, cb) { 989 animate(false, element, animation, cb); 990 } 991}; 992 993function Move(duration, elem, fn) { 994 var anim, 995 prog, 996 start = null; 997 // console.log('called'); 998 999 if (duration === 0) { 1000 fn.apply(elem); 1001 elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]); 1002 return; 1003 } 1004 1005 function move(ts) { 1006 if (!start) start = ts; 1007 // console.log(start, ts); 1008 prog = ts - start; 1009 fn.apply(elem); 1010 1011 if (prog < duration) { 1012 anim = window.requestAnimationFrame(move, elem); 1013 } else { 1014 window.cancelAnimationFrame(anim); 1015 elem.trigger('finished.zf.animate', [elem]).triggerHandler('finished.zf.animate', [elem]); 1016 } 1017 } 1018 anim = window.requestAnimationFrame(move); 1019} 1020 1021/** 1022 * Animates an element in or out using a CSS transition class. 1023 * @function 1024 * @private 1025 * @param {Boolean} isIn - Defines if the animation is in or out. 1026 * @param {Object} element - jQuery or HTML object to animate. 1027 * @param {String} animation - CSS class to use. 1028 * @param {Function} cb - Callback to run when animation is finished. 1029 */ 1030function animate(isIn, element, animation, cb) { 1031 element = (0, _jquery2.default)(element).eq(0); 1032 1033 if (!element.length) return; 1034 1035 var initClass = isIn ? initClasses[0] : initClasses[1]; 1036 var activeClass = isIn ? activeClasses[0] : activeClasses[1]; 1037 1038 // Set up the animation 1039 reset(); 1040 1041 element.addClass(animation).css('transition', 'none'); 1042 1043 requestAnimationFrame(function () { 1044 element.addClass(initClass); 1045 if (isIn) element.show(); 1046 }); 1047 1048 // Start the animation 1049 requestAnimationFrame(function () { 1050 element[0].offsetWidth; 1051 element.css('transition', '').addClass(activeClass); 1052 }); 1053 1054 // Clean up the animation when it finishes 1055 element.one((0, _foundationUtil.transitionend)(element), finish); 1056 1057 // Hides the element (for out animations), resets the element, and runs a callback 1058 function finish() { 1059 if (!isIn) element.hide(); 1060 reset(); 1061 if (cb) cb.apply(element); 1062 } 1063 1064 // Resets transitions and removes motion-specific classes 1065 function reset() { 1066 element[0].style.transitionDuration = 0; 1067 element.removeClass(initClass + ' ' + activeClass + ' ' + animation); 1068 } 1069} 1070 1071exports.Move = Move; 1072exports.Motion = Motion; 1073 1074/***/ }), 1075/* 7 */ 1076/***/ (function(module, exports, __webpack_require__) { 1077 1078"use strict"; 1079 1080 1081Object.defineProperty(exports, "__esModule", { 1082 value: true 1083}); 1084exports.Box = undefined; 1085 1086var _foundationUtil = __webpack_require__(1); 1087 1088var Box = { 1089 ImNotTouchingYou: ImNotTouchingYou, 1090 OverlapArea: OverlapArea, 1091 GetDimensions: GetDimensions, 1092 GetOffsets: GetOffsets, 1093 GetExplicitOffsets: GetExplicitOffsets 1094 1095 /** 1096 * Compares the dimensions of an element to a container and determines collision events with container. 1097 * @function 1098 * @param {jQuery} element - jQuery object to test for collisions. 1099 * @param {jQuery}
1099 parent - jQuery object to use as bounding container. 1100 * @param {Boolean} lrOnly - set to true to check left and right values only. 1101 * @param {Boolean} tbOnly - set to true to check top and bottom values only. 1102 * @default if no parent object passed, detects collisions with `window`. 1103 * @returns {Boolean} - true if collision free, false if a collision in any direction. 1104 */ 1105};function ImNotTouchingYou(element, parent, lrOnly, tbOnly, ignoreBottom) { 1106 return OverlapArea(element, parent, lrOnly, tbOnly, ignoreBottom) === 0; 1107}; 1108 1109function OverlapArea(element, parent, lrOnly, tbOnly, ignoreBottom) { 1110 var eleDims = GetDimensions(element), 1111 topOver, 1112 bottomOver, 1113 leftOver, 1114 rightOver; 1115 if (parent) { 1116 var parDims = GetDimensions(parent); 1117 1118 bottomOver = parDims.height + parDims.offset.top - (eleDims.offset.top + eleDims.height); 1119 topOver = eleDims.offset.top - parDims.offset.top; 1120 leftOver = eleDims.offset.left - parDims.offset.left; 1121 rightOver = parDims.width + parDims.offset.left - (eleDims.offset.left + eleDims.width); 1122 } else { 1123 bottomOver = eleDims.windowDims.height + eleDims.windowDims.offset.top - (eleDims.offset.top + eleDims.height); 1124 topOver = eleDims.offset.top - eleDims.windowDims.offset.top; 1125 leftOver = eleDims.offset.left - eleDims.windowDims.offset.left; 1126 rightOver = eleDims.windowDims.width - (eleDims.offset.left + eleDims.width); 1127 } 1128 1129 bottomOver = ignoreBottom ? 0 : Math.min(bottomOver, 0); 1130 topOver = Math.min(topOver, 0); 1131 leftOver = Math.min(leftOver, 0); 1132 rightOver = Math.min(rightOver, 0); 1133 1134 if (lrOnly) { 1135 return leftOver + rightOver; 1136 } 1137 if (tbOnly) { 1138 return topOver + bottomOver; 1139 } 1140 1141 // use sum of squares b/c we care about overlap area. 1142 return Math.sqrt(topOver * topOver + bottomOver * bottomOver + leftOver * leftOver + rightOver * rightOver); 1143} 1144 1145/** 1146 * Uses native methods to return an object of dimension values. 1147 * @function 1148 * @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window. 1149 * @returns {Object} - nested object of integer pixel values 1150 * TODO - if element is window, return only those values. 1151 */ 1152function GetDimensions(elem, test) { 1153 elem = elem.length ? elem[0] : elem; 1154 1155 if (elem === window || elem === document) { 1156 throw new Error("I'm sorry, Dave. I'm afraid I can't do that."); 1157 } 1158 1159 var rect = elem.getBoundingClientRect(), 1160 parRect = elem.parentNode.getBoundingClientRect(), 1161 winRect = document.body.getBoundingClientRect(), 1162 winY = window.pageYOffset, 1163 winX = window.pageXOffset; 1164 1165 return { 1166 width: rect.width, 1167 height: rect.height, 1168 offset: { 1169 top: rect.top + winY, 1170 left: rect.left + winX 1171 }, 1172 parentDims: { 1173 width: parRect.width, 1174 height: parRect.height, 1175 offset: { 1176 top: parRect.top + winY, 1177 left: parRect.left + winX 1178 } 1179 }, 1180 windowDims: { 1181 width: winRect.width, 1182 height: winRect.height, 1183 offset: { 1184 top: winY, 1185 left: winX 1186 } 1187 } 1188 }; 1189} 1190 1191/** 1192 * Returns an object of top and left integer pixel values for dynamically rendered elements, 1193 * such as: Tooltip, Reveal, and Dropdown. Maintained for backwards compatibility, and where 1194 * you don't know alignment, but generally from 1195 * 6.4 forward you should use GetExplicitOffsets, as GetOffsets conflates position and alignment. 1196 * @function 1197 * @param {jQuery} element - jQuery object for the element being positioned. 1198 * @param {jQuery} anchor - jQuery object for the element's anchor point. 1199 * @param {String} position - a string relating to the desired position of the element, relative to it's anchor 1200 * @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element. 1201 * @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element. 1202 * @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset. 1203 * TODO alter/rewrite to work with `em` values as well/instead of pixels 1204 */
1205function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) { 1206 console.log("NOTE: GetOffsets is deprecated in favor of GetExplicitOffsets and will be removed in 6.5"); 1207 switch (position) { 1208 case 'top': 1209 return (0, _foundationUtil.rtl)() ? GetExplicitOffsets(element, anchor, 'top', 'left', vOffset, hOffset, isOverflow) : GetExplicitOffsets(element, anchor, 'top', 'right', vOffset, hOffset, isOverflow); 1210 case 'bottom': 1211 return (0, _foundationUtil.rtl)() ? GetExplicitOffsets(element, anchor, 'bottom', 'left', vOffset, hOffset, isOverflow) : GetExplicitOffsets(element, anchor, 'bottom', 'right', vOffset, hOffset, isOverflow); 1212 case 'center top': 1213 return GetExplicitOffsets(element, anchor, 'top', 'center', vOffset, hOffset, isOverflow); 1214 case 'center bottom': 1215 return GetExplicitOffsets(element, anchor, 'bottom', 'center', vOffset, hOffset, isOverflow); 1216 case 'center left': 1217 return GetExplicitOffsets(element, anchor, 'left', 'center', vOffset, hOffset, isOverflow); 1218 case 'center right': 1219 return GetExplicitOffsets(element, anchor, 'right', 'center', vOffset, hOffset, isOverflow); 1220 case 'left bottom': 1221 return GetExplicitOffsets(element, anchor, 'bottom', 'left', vOffset, hOffset, isOverflow); 1222 case 'right bottom': 1223 return GetExplicitOffsets(element, anchor, 'bottom', 'right', vOffset, hOffset, isOverflow); 1224 // Backwards compatibility... this along with the reveal and reveal full 1225 // classes are the only ones that didn't reference anchor 1226 case 'center': 1227 return { 1228 left: $eleDims.windowDims.offset.left + $eleDims.windowDims.width / 2 - $eleDims.width / 2 + hOffset, 1229 top: $eleDims.windowDims.offset.top + $eleDims.windowDims.height / 2 - ($eleDims.height / 2 + vOffset) 1230 }; 1231 case 'reveal': 1232 return { 1233 left: ($eleDims.windowDims.width - $eleDims.width) / 2 + hOffset, 1234 top: $eleDims.windowDims.offset.top + vOffset 1235 }; 1236 case 'reveal full': 1237 return { 1238 left: $eleDims.windowDims.offset.left, 1239 top: $eleDims.windowDims.offset.top 1240 }; 1241 break; 1242 default: 1243 return { 1244 left: (0, _foundationUtil.rtl)() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset : $anchorDims.offset.left + hOffset, 1245 top: $anchorDims.offset.top + $anchorDims.height + vOffset 1246 }; 1247 1248 } 1249} 1250 1251function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffset, isOverflow) { 1252 var $eleDims = GetDimensions(element), 1253 $anchorDims = anchor ? GetDimensions(anchor) : null; 1254 1255 var topVal, leftVal; 1256 1257 // set position related attribute 1258 1259 switch (position) { 1260 case 'top': 1261 topVal = $anchorDims.offset.top - ($eleDims.height + vOffset); 1262 break; 1263 case 'bottom': 1264 topVal = $anchorDims.offset.top + $anchorDims.height + vOffset; 1265 break; 1266 case 'left': 1267 leftVal = $anchorDims.offset.left - ($eleDims.width + hOffset); 1268 break; 1269 case 'right': 1270 leftVal = $anchorDims.offset.left + $anchorDims.width + hOffset; 1271 break; 1272 } 1273 1274 // set alignment related attribute 1275 switch (position) { 1276 case 'top': 1277 case 'bottom': 1278 switch (alignment) { 1279 case 'left': 1280 leftVal = $anchorDims.offset.left + hOffset; 1281 break; 1282 case 'right': 1283 leftVal = $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset; 1284 break; 1285 case 'center': 1286 leftVal = isOverflow ? hOffset : $anchorDims.offset.left + $anchorDims.width / 2 - $eleDims.width / 2 + hOffset; 1287 break; 1288 } 1289 break; 1290 case 'right': 1291 case 'left': 1292 switch (alignment) { 1293 case 'bottom': 1294 topVal = $anchorDims.offset.top - vOffset + $anchorDims.height - $eleDims.height; 1295 break; 1296 case 'top': 1297 topVal = $anchorDims.offset.top + vOffset; 1298 break; 1299 case 'center': 1300 topVal = $anchorDims.offset.top + vOffset + $anchorDims.height / 2 - $eleDims.height / 2; 1301 break; 1302 } 1303 break; 1304 } 1305 return { top: topVal, left: leftVal }; 1306} 1307 1308exports.Box = Box; 1309 1310/***/ }), 1311/* 8 */ 1312/***/ (function(module, exports, __webpack_require__) { 1313 1314"use strict"; 1315 1316 1317Object.defineProperty(exports, "__esModule", { 1318 value: true 1319}); 1320exports.onImagesLoaded = undefined; 1321 1322var _jquery = __webpack_require__(0); 1323 1324var _jquery2 = _interopRequireDefault(_jquery); 1325 1326function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1327 1328/** 1329 * Runs a callback function when images are fully loaded. 1330 * @param {Object} images - Image(s) to check if loaded. 1331 * @param {Func} callback - Function to execute when image is fully loaded. 1332 */ 1333function onImagesLoaded(images, callback) { 1334 var self = this, 1335 unloaded = images.length; 1336 1337 if (unloaded === 0) { 1338 callback(); 1339 } 1340 1341 images.each(function () { 1342 // Check if image is loaded
1343 if (this.complete && this.naturalWidth !== undefined) { 1344 singleImageLoaded(); 1345 } else { 1346 // If the above check failed, simulate loading on detached element. 1347 var image = new Image(); 1348 // Still count image as loaded if it finalizes with an error. 1349 var events = "load.zf.images error.zf.images"; 1350 (0, _jquery2.default)(image).one(events, function me(event) { 1351 // Unbind the event listeners. We're using 'one' but only one of the two events will have fired. 1352 (0, _jquery2.default)(this).off(events, me); 1353 singleImageLoaded(); 1354 }); 1355 image.src = (0, _jquery2.default)(this).attr('src'); 1356 } 1357 }); 1358 1359 function singleImageLoaded() { 1360 unloaded--; 1361 if (unloaded === 0) { 1362 callback(); 1363 } 1364 } 1365} 1366 1367exports.onImagesLoaded = onImagesLoaded; 1368 1369/***/ }), 1370/* 9 */ 1371/***/ (function(module, exports, __webpack_require__) { 1372 1373"use strict"; 1374 1375 1376Object.defineProperty(exports, "__esModule", { 1377 value: true 1378}); 1379exports.Nest = undefined; 1380 1381var _jquery = __webpack_require__(0); 1382 1383var _jquery2 = _interopRequireDefault(_jquery); 1384 1385function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1386 1387var Nest = { 1388 Feather: function Feather(menu) { 1389 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'zf'; 1390 1391 menu.attr('role', 'menubar'); 1392 1393 var items = menu.find('li').attr({ 'role': 'menuitem' }), 1394 subMenuClass = 'is-' + type + '-submenu', 1395 subItemClass = subMenuClass + '-item', 1396 hasSubClass = 'is-' + type + '-submenu-parent', 1397 applyAria = type !== 'accordion'; // Accordions handle their own ARIA attriutes. 1398 1399 items.each(function () { 1400 var $item = (0, _jquery2.default)(this), 1401 $sub = $item.children('ul'); 1402 1403 if ($sub.length) { 1404 $item.addClass(hasSubClass); 1405 $sub.addClass('submenu ' + subMenuClass).attr({ 'data-submenu': '' }); 1406 if (applyAria) { 1407 $item.attr({ 1408 'aria-haspopup': true, 1409 'aria-label': $item.children('a:first').text() 1410 }); 1411 // Note: Drilldowns behave differently in how they hide, and so need 1412 // additional attributes. We should look if this possibly over-generalized 1413 // utility (Nest) is appropriate when we rework menus in 6.4 1414 if (type === 'drilldown') { 1415 $item.attr({ 'aria-expanded': false }); 1416 } 1417 } 1418 $sub.addClass('submenu ' + subMenuClass).attr({ 1419 'data-submenu': '', 1420 'role': 'menu' 1421 }); 1422 if (type === 'drilldown') { 1423 $sub.attr({ 'aria-hidden': true }); 1424 } 1425 } 1426 1427 if ($item.parent('[data-submenu]').length) { 1428 $item.addClass('is-submenu-item ' + subItemClass); 1429 } 1430 }); 1431 1432 return; 1433 }, 1434 Burn: function Burn(menu, type) { 1435 var //items = menu.find('li'), 1436 subMenuClass = 'is-' + type + '-submenu', 1437 subItemClass = subMenuClass + '-item', 1438 hasSubClass = 'is-' + type + '-submenu-parent'; 1439 1440 menu.find('>li, .menu, .menu > li').removeClass(subMenuClass + ' ' + subItemClass + ' ' + hasSubClass + ' is-submenu-item submenu is-active').removeAttr('data-submenu').css('display', ''); 1441 } 1442}; 1443 1444exports.Nest = Nest; 1445 1446/***/ }), 1447/* 10 */ 1448/***/ (function(module, exports, __webpack_require__) { 1449 1450"use strict"; 1451 1452 1453Object.defineProperty(exports, "__esModule", { 1454 value: true 1455}); 1456exports.Touch = undefined; 1457 1458var _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; }; }(); //************************************************** 1459//**Work inspired by multiple jquery swipe plugins** 1460//**Done by Yohai Ararat *************************** 1461//************************************************** 1462 1463var _jquery = __webpack_require__(0); 1464 1465var _jquery2 = _interopRequireDefault(_jquery); 1466 1467function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1468 1469function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1470 1471var Touch = {}; 1472 1473var startPosX, 1474 startPosY, 1475 startTime, 1476 elapsedTime, 1477 isMoving = false;
1478 1479function onTouchEnd() { 1480 // alert(this); 1481 this.removeEventListener('touchmove', onTouchMove); 1482 this.removeEventListener('touchend', onTouchEnd); 1483 isMoving = false; 1484} 1485 1486function onTouchMove(e) { 1487 if (_jquery2.default.spotSwipe.preventDefault) { 1488 e.preventDefault(); 1489 } 1490 if (isMoving) { 1491 var x = e.touches[0].pageX; 1492 var y = e.touches[0].pageY; 1493 var dx = startPosX - x; 1494 var dy = startPosY - y; 1495 var dir; 1496 elapsedTime = new Date().getTime() - startTime; 1497 if (Math.abs(dx) >= _jquery2.default.spotSwipe.moveThreshold && elapsedTime <= _jquery2.default.spotSwipe.timeThreshold) { 1498 dir = dx > 0 ? 'left' : 'right'; 1499 } 1500 // else if(Math.abs(dy) >= $.spotSwipe.moveThreshold && elapsedTime <= $.spotSwipe.timeThreshold) { 1501 // dir = dy > 0 ? 'down' : 'up'; 1502 // } 1503 if (dir) { 1504 e.preventDefault(); 1505 onTouchEnd.call(this); 1506 (0, _jquery2.default)(this).trigger('swipe', dir).trigger('swipe' + dir); 1507 } 1508 } 1509} 1510 1511function onTouchStart(e) { 1512 if (e.touches.length == 1) { 1513 startPosX = e.touches[0].pageX; 1514 startPosY = e.touches[0].pageY; 1515 isMoving = true; 1516 startTime = new Date().getTime(); 1517 this.addEventListener('touchmove', onTouchMove, false); 1518 this.addEventListener('touchend', onTouchEnd, false); 1519 } 1520} 1521 1522function init() { 1523 this.addEventListener && this.addEventListener('touchstart', onTouchStart, false); 1524} 1525 1526function teardown() { 1527 this.removeEventListener('touchstart', onTouchStart); 1528} 1529 1530var SpotSwipe = function () { 1531 function SpotSwipe($) { 1532 _classCallCheck(this, SpotSwipe); 1533 1534 this.version = '1.0.0'; 1535 this.enabled = 'ontouchstart' in document.documentElement; 1536 this.preventDefault = false;
1537 this.moveThreshold = 75; 1538 this.timeThreshold = 200; 1539 this.$ = $; 1540 this._init(); 1541 } 1542 1543 _createClass(SpotSwipe, [{ 1544 key: '_init', 1545 value: function _init() { 1546 var $ = this.$; 1547 $.event.special.swipe = { setup: init }; 1548 1549 $.each(['left', 'up', 'down', 'right'], function () { 1550 $.event.special['swipe' + this] = { setup: function setup() { 1551 $(this).on('swipe', $.noop); 1552 } }; 1553 }); 1554 } 1555 }]); 1556 1557 return SpotSwipe; 1558}(); 1559 1560/**************************************************** 1561 * As far as I can tell, both setupSpotSwipe and * 1562 * setupTouchHandler should be idempotent, * 1563 * because they directly replace functions & * 1564 * values, and do not add event handlers directly. * 1565 ****************************************************/ 1566 1567Touch.setupSpotSwipe = function ($) { 1568 $.spotSwipe = new SpotSwipe($); 1569}; 1570 1571/**************************************************** 1572 * Method for adding pseudo drag events to elements * 1573 ***************************************************/ 1574Touch.setupTouchHandler = function ($) { 1575 $.fn.addTouch = function () { 1576 this.each(function (i, el) { 1577 $(el).bind('touchstart touchmove touchend touchcancel', function () { 1578 //we pass the original event object because the jQuery event 1579 //object is normalized to w3c specs and does not provide the TouchList 1580 handleTouch(event); 1581 }); 1582 }); 1583 1584 var handleTouch = function handleTouch(event) { 1585 var touches = event.changedTouches, 1586 first = touches[0], 1587 eventTypes = { 1588 touchstart: 'mousedown', 1589 touchmove: 'mousemove', 1590 touchend: 'mouseup' 1591 }, 1592 type = eventTypes[event.type], 1593 simulatedEvent; 1594 1595 if ('MouseEvent' in window && typeof window.MouseEvent === 'function') { 1596 simulatedEvent = new window.MouseEvent(type, { 1597 'bubbles': true, 1598 'cancelable': true, 1599 'screenX': first.screenX, 1600 'screenY': first.screenY, 1601 'clientX': first.clientX, 1602 'clientY': first.clientY 1603 }); 1604 } else { 1605 simulatedEvent = document.createEvent('MouseEvent'); 1606 simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0 /*left*/, null); 1607 } 1608 first.target.dispatchEvent(simulatedEvent); 1609 }; 1610 }; 1611}; 1612 1613Touch.init = function ($) { 1614 if (typeof $.spotSwipe === 'undefined') { 1615 Touch.setupSpotSwipe($); 1616 Touch.setupTouchHandler($); 1617 } 1618}; 1619 1620exports.Touch = Touch; 1621 1622/***/ }), 1623/* 11 */ 1624/***/ (function(module, exports, __webpack_require__) { 1625 1626"use strict"; 1627 1628 1629Object.defineProperty(exports, "__esModule", { 1630 value: true 1631}); 1632exports.Accordion = undefined; 1633 1634var _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; }; }(); 1635 1636var _jquery = __webpack_require__(0); 1637 1638var _jquery2 = _interopRequireDefault(_jquery); 1639 1640var _foundationUtil = __webpack_require__(3); 1641 1642var _foundationUtil2 = __webpack_require__(1); 1643 1644var _foundation = __webpack_require__(2); 1645 1646function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1647 1648function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1649 1650function _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; } 1651 1652function _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
1652onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 1653 1654/** 1655 * Accordion module. 1656 * @module foundation.accordion 1657 * @requires foundation.util.keyboard 1658 */ 1659 1660var Accordion = function (_Plugin) { 1661 _inherits(Accordion, _Plugin); 1662 1663 function Accordion() { 1664 _classCallCheck(this, Accordion); 1665 1666 return _possibleConstructorReturn(this, (Accordion.__proto__ || Object.getPrototypeOf(Accordion)).apply(this, arguments)); 1667 } 1668 1669 _createClass(Accordion, [{ 1670 key: '_setup', 1671 1672 /** 1673 * Creates a new instance of an accordion. 1674 * @class 1675 * @name Accordion 1676 * @fires Accordion#init 1677 * @param {jQuery} element - jQuery object to make into an accordion. 1678 * @param {Object} options - a plain object with settings to override the default options. 1679 */ 1680 value: function _setup(element, options) { 1681 this.$element = element; 1682 this.options = _jquery2.default.extend({}, Accordion.defaults, this.$element.data(), options); 1683 1684 this.className = 'Accordion'; // ie9 back compat 1685 this._init(); 1686 1687 _foundationUtil.Keyboard.register('Accordion', { 1688 'ENTER': 'toggle', 1689 'SPACE': 'toggle', 1690 'ARROW_DOWN': 'next', 1691 'ARROW_UP': 'previous' 1692 }); 1693 } 1694 1695 /** 1696 * Initializes the accordion by animating the preset active pane(s). 1697 * @private 1698 */ 1699 1700 }, { 1701 key: '_init', 1702 value: function _init() { 1703 var _this3 = this; 1704 1705 this.$element.attr('role', 'tablist'); 1706 this.$tabs = this.$element.children('[data-accordion-item]'); 1707 1708 this.$tabs.each(function (idx, el) { 1709 var $el = (0, _jquery2.default)(el), 1710 $content = $el.children('[data-tab-content]'), 1711 id = $content[0].id || (0, _foundationUtil2.GetYoDigits)(6, 'accordion'), 1712 linkId = el.id || id + '-label'; 1713 1714 $el.find('a:first').attr({ 1715 'aria-controls': id, 1716 'role': 'tab', 1717 'id': linkId, 1718 'aria-expanded': false, 1719 'aria-selected': false 1720 }); 1721 1722 $content.attr({ 'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id }); 1723 }); 1724 var $initActive = this.$element.find('.is-active').children('[data-tab-content]'); 1725 this.firstTimeInit = true; 1726 if ($initActive.length) { 1727 this.down($initActive, this.firstTimeInit); 1728 this.firstTimeInit = false; 1729 } 1730 1731 this._checkDeepLink = function () { 1732 var anchor = window.location.hash; 1733 //need a hash and a relevant anchor in this tabset 1734 if (anchor.length) { 1735 var $link = _this3.$element.find('[href$="' + anchor + '"]'), 1736 $anchor = (0, _jquery2.default)(anchor); 1737 1738 if ($link.length && $anchor) { 1739 if (!$link.parent('[data-accordion-item]').hasClass('is-active')) { 1740 _this3.down($anchor, _this3.firstTimeInit); 1741 _this3.firstTimeInit = false; 1742 }; 1743 1744 //roll up a little to show the titles 1745 if (_this3.options.deepLinkSmudge) { 1746 var _this = _this3; 1747 (0, _jquery2.default)(window).load(function () { 1748 var offset = _this.$element.offset(); 1749 (0, _jquery2.default)('html, body').animate({ scrollTop: offset.top }, _this.options.deepLinkSmudgeDelay); 1750 }); 1751 } 1752 1753 /** 1754 * Fires when the zplugin has deeplinked at pageload 1755 * @event Accordion#deeplink 1756 */ 1757 _this3.$element.trigger('deeplink.zf.accordion', [$link, $anchor]); 1758 } 1759 } 1760 }; 1761 1762 //use browser to open a tab, if it exists in this tabset 1763 if (this.options.deepLink) { 1764 this._checkDeepLink(); 1765 } 1766 1767 this._events(); 1768 } 1769 1770 /** 1771 * Adds event handlers for items within the accordion. 1772 * @private 1773 */ 1774 1775 }, { 1776 key: '_events', 1777 value: function _events() { 1778 var _this = this; 1779 1780 this.$tabs.each(function () { 1781 var $elem = (0, _jquery2.default)(this); 1782 var $tabContent = $elem.children('[data-tab-content]'); 1783 if ($tabContent.length) { 1784 $elem.children('a').off('click.zf.accordion keydown.zf.accordion').on('click.zf.accordion', function (e) { 1785 e.preventDefault(); 1786 _this.toggle($tabContent); 1787 }).on('keydown.zf.accordion', function (e) { 1788 _foundationUtil.Keyboard.handleKey(e, 'Accordion', {
1789 toggle: function toggle() { 1790 _this.toggle($tabContent); 1791 }, 1792 next: function next() { 1793 var $a = $elem.next().find('a').focus(); 1794 if (!_this.options.multiExpand) { 1795 $a.trigger('click.zf.accordion'); 1796 } 1797 }, 1798 previous: function previous() { 1799 var $a = $elem.prev().find('a').focus(); 1800 if (!_this.options.multiExpand) { 1801 $a.trigger('click.zf.accordion'); 1802 } 1803 }, 1804 handled: function handled() { 1805 e.preventDefault(); 1806 e.stopPropagation(); 1807 } 1808 }); 1809 }); 1810 } 1811 }); 1812 if (this.options.deepLink) { 1813 (0, _jquery2.default)(window).on('popstate', this._checkDeepLink); 1814 } 1815 } 1816 1817 /** 1818 * Toggles the selected content pane's open/close state. 1819 * @param {jQuery} $target - jQuery object of the pane to toggle (`.accordion-content`). 1820 * @function 1821 */ 1822 1823 }, { 1824 key: 'toggle', 1825 value: function toggle($target) { 1826 if ($target.closest('[data-accordion]').is('[disabled]')) { 1827 console.info('Cannot toggle an accordion that is disabled.'); 1828 return; 1829 } 1830 if ($target.parent().hasClass('is-active')) { 1831 this.up($target); 1832 } else { 1833 this.down($target); 1834 } 1835 //either replace or update browser history 1836 if (this.options.deepLink) { 1837 var anchor = $target.prev('a').attr('href'); 1838 1839 if (this.options.updateHistory) { 1840 history.pushState({}, '', anchor); 1841 } else { 1842 history.replaceState({}, '', anchor); 1843 } 1844 } 1845 } 1846 1847 /** 1848 * Opens the accordion tab defined by `$target`. 1849 * @param {jQuery} $target - Accordion pane to open (`.accordion-content`). 1850 * @param {Boolean} firstTime - flag to determine if reflow should happen. 1851 * @fires Accordion#down 1852 * @function 1853 */ 1854 1855 }, { 1856 key: 'down', 1857 value: function down($target, firstTime) { 1858 var _this4 = this; 1859 1860 /** 1861 * checking firstTime allows for initial render of the accordion 1862 * to render preset is-active panes. 1863 */ 1864 if ($target.closest('[data-accordion]').is('[disabled]') && !firstTime) { 1865 console.info('Cannot call down on an accordion that is disabled.'); 1866 return; 1867 } 1868 $target.attr('aria-hidden', false).parent('[data-tab-content]').addBack().parent().addClass('is-active'); 1869 1870 if (!this.options.multiExpand && !firstTime) { 1871 var $currentActive = this.$element.children('.is-active').children('[data-tab-content]'); 1872 if ($currentActive.length) { 1873 this.up($currentActive.not($target)); 1874 } 1875 } 1876 1877 $target.slideDown(this.options.slideSpeed, function () { 1878 /** 1879 * Fires when the tab is done opening. 1880 * @event Accordion#down 1881 */ 1882 _this4.$element.trigger('down.zf.accordion', [$target]); 1883 }); 1884 1885 (0, _jquery2.default)('#' + $target.attr('aria-labelledby')).attr({ 1886 'aria-expanded': true, 1887 'aria-selected': true 1888 }); 1889 } 1890 1891 /** 1892 * Closes the tab defined by `$target`. 1893 * @param {jQuery} $target - Accordion tab to close (`.accordion-content`). 1894 * @fires Accordion#up 1895 * @function 1896 */ 1897 1898 }, { 1899 key: 'up', 1900 value: function up($target) { 1901 if ($target.closest('[data-accordion]').is('[disabled]')) { 1902 console.info('Cannot call up on an accordion that is disabled.'); 1903 return; 1904 } 1905 1906 var $aunts = $target.parent().siblings(), 1907 _this = this; 1908 1909 if (!this.options.allowAllClosed && !$aunts.hasClass('is-active') || !$target.parent().hasClass('is-active')) { 1910 return; 1911 } 1912 1913 $target.slideUp(_this.options.slideSpeed, function () { 1914 /** 1915 * Fires when the tab is done collapsing up. 1916 * @event Accordion#up 1917 */ 1918 _this.$element.trigger('up.zf.accordion', [$target]); 1919 }); 1920 1921 $target.attr('aria-hidden', true).parent().removeClass('is-active'); 1922 1923 (0, _jquery2.default)('#' + $target.attr('aria-labelledby')).attr({ 1924 'aria-expanded': false, 1925 'aria-selected': false 1926 }); 1927 } 1928 1929 /** 1930 * Destroys an instance of an accordion. 1931 * @fires Accordion#destroyed 1932 * @function 1933 */ 1934 1935 }, { 1936 key: '_destroy', 1937 value: function _destroy() {
1938 this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', ''); 1939 this.$element.find('a').off('.zf.accordion'); 1940 if (this.options.deepLink) { 1941 (0, _jquery2.default)(window).off('popstate', this._checkDeepLink); 1942 } 1943 } 1944 }]); 1945 1946 return Accordion; 1947}(_foundation.Plugin); 1948 1949Accordion.defaults = { 1950 /** 1951 * Amount of time to animate the opening of an accordion pane. 1952 * @option 1953 * @type {number} 1954 * @default 250 1955 */ 1956 slideSpeed: 250, 1957 /** 1958 * Allow the accordion to have multiple open panes. 1959 * @option 1960 * @type {boolean} 1961 * @default false 1962 */ 1963 multiExpand: false, 1964 /** 1965 * Allow the accordion to close all panes. 1966 * @option 1967 * @type {boolean} 1968 * @default false 1969 */ 1970 allowAllClosed: false, 1971 /** 1972 * Allows the window to scroll to content of pane specified by hash anchor 1973 * @option 1974 * @type {boolean} 1975 * @default false 1976 */ 1977 deepLink: false, 1978 1979 /** 1980 * Adjust the deep link scroll to make sure the top of the accordion panel is visible 1981 * @option 1982 * @type {boolean} 1983 * @default false 1984 */ 1985 deepLinkSmudge: false, 1986 1987 /** 1988 * Animation time (ms) for the deep link adjustment 1989 * @option 1990 * @type {number} 1991 * @default 300 1992 */ 1993 deepLinkSmudgeDelay: 300, 1994 1995 /** 1996 * Update the browser history with the open accordion 1997 * @option 1998 * @type {boolean} 1999 * @default false 2000 */ 2001 updateHistory: false 2002}; 2003 2004exports.Accordion = Accordion; 2005 2006/***/ }), 2007/* 12 */ 2008/***/ (function(module, exports, __webpack_require__) { 2009 2010"use strict"; 2011 2012 2013Object.defineProperty(exports, "__esModule", { 2014 value: true 2015}); 2016exports.AccordionMenu = undefined; 2017 2018var _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; }; }(); 2019 2020var _jquery = __webpack_require__(0); 2021 2022var _jquery2 = _interopRequireDefault(_jquery); 2023 2024var _foundationUtil = __webpack_require__(3); 2025 2026var _foundationUtil2 = __webpack_require__(9); 2027 2028var _foundationUtil3 = __webpack_require__(1); 2029 2030var _foundation = __webpack_require__(2); 2031 2032function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2033 2034function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2035 2036function _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; } 2037 2038function _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; } 2039 2040/** 2041 * AccordionMenu module. 2042 * @module foundation.accordionMenu 2043 * @requires foundation.util.keyboard 2044 * @requires foundation.util.nest 2045 */ 2046 2047var AccordionMenu = function (_Plugin) { 2048 _inherits(AccordionMenu, _Plugin); 2049 2050 function AccordionMenu() { 2051 _classCallCheck(this, AccordionMenu); 2052 2053 return _possibleConstructorReturn(this, (AccordionMenu.__proto__ || Object.getPrototypeOf(AccordionMenu)).apply(this, arguments)); 2054 } 2055 2056 _createClass(AccordionMenu, [{ 2057 key: '_setup', 2058 2059 /** 2060 * Creates a new instance of an accordion menu. 2061 * @class 2062 * @name AccordionMenu 2063 * @fires AccordionMenu#init 2064 * @param {jQuery} element - jQuery object to make into an accordion menu. 2065 * @param {Object} options - Overrides to the default plugin settings. 2066 */ 2067 value: function _setup(element, options) { 2068 this.$element = element; 2069 this.options = _jquery2.default.extend({}, AccordionMenu.defaults, this.$element.data(), options); 2070 this.className = 'AccordionMenu'; // ie9 back compat 2071 2072 _foundationUtil2.Nest.Feather(this.$element, 'accordion'); 2073 2074 this._init(); 2075 2076 _foundationUtil.Keyboard.register('AccordionMenu', { 2077 'ENTER': 'toggle', 2078 'SPACE': 'toggle', 2079 'ARROW_RIGHT': 'open', 2080 'ARROW_UP': 'up', 2081 'ARROW_DOWN': 'down', 2082 'ARROW_LEFT': 'close', 2083 'ESCAPE': 'closeAll' 2084 }); 2085 } 2086 2087 /** 2088 * Initializes the accordion menu by hiding all nested menus. 2089 * @private 2090 */ 2091 2092 }, { 2093 key: '_init', 2094 value: function _init() { 2095 var _this = this; 2096 2097 this.$element.find('[data-submenu]').not('.is-active').slideUp(0); //.find('a').css('padding-left', '1rem'); 2098 this.$element.attr({ 2099 'role': 'tree',
2100 'aria-multiselectable': this.options.multiOpen 2101 }); 2102 2103 this.$menuLinks = this.$element.find('.is-accordion-submenu-parent'); 2104 this.$menuLinks.each(function () { 2105 var linkId = this.id || (0, _foundationUtil3.GetYoDigits)(6, 'acc-menu-link'), 2106 $elem = (0, _jquery2.default)(this), 2107 $sub = $elem.children('[data-submenu]'), 2108 subId = $sub[0].id || (0, _foundationUtil3.GetYoDigits)(6, 'acc-menu'), 2109 isActive = $sub.hasClass('is-active'); 2110 2111 if (_this.options.submenuToggle) { 2112 $elem.addClass('has-submenu-toggle'); 2113 $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>'); 2114 } else { 2115 $elem.attr({ 2116 'aria-controls': subId, 2117 'aria-expanded': isActive, 2118 'id': linkId 2119 }); 2120 } 2121 $sub.attr({ 2122 'aria-labelledby': linkId, 2123 'aria-hidden': !isActive, 2124 'role': 'group', 2125 'id': subId 2126 }); 2127 }); 2128 this.$element.find('li').attr({ 2129 'role': 'treeitem' 2130 }); 2131 var initPanes = this.$element.find('.is-active'); 2132 if (initPanes.length) { 2133 var _this = this; 2134 initPanes.each(function () { 2135 _this.down((0, _jquery2.default)(this)); 2136 }); 2137 } 2138 this._events(); 2139 } 2140 2141 /** 2142 * Adds event handlers for items within the menu. 2143 * @private 2144 */ 2145 2146 }, { 2147 key: '_events', 2148 value: function _events() { 2149 var _this = this; 2150 2151 this.$element.find('li').each(function () { 2152 var $submenu = (0, _jquery2.default)(this).children('[data-submenu]'); 2153 2154 if ($submenu.length) { 2155 if (_this.options.submenuToggle) { 2156 (0, _jquery2.default)(this).children('.submenu-toggle').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) { 2157 _this.toggle($submenu); 2158 }); 2159 } else { 2160 (0, _jquery2.default)(this).children('a').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) { 2161 e.preventDefault(); 2162 _this.toggle($submenu); 2163 }); 2164 } 2165 } 2166 }).on('keydown.zf.accordionmenu', function (e) { 2167 var $element = (0, _jquery2.default)(this), 2168 $elements = $element.parent('ul').children('li'), 2169 $prevElement, 2170 $nextElement, 2171 $target = $element.children('[data-submenu]'); 2172 2173 $elements.each(function (i) { 2174 if ((0, _jquery2.default)(this).is($element)) { 2175 $prevElement = $elements.eq(Math.max(0, i - 1)).find('a').first(); 2176 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)).find('a').first(); 2177 2178 if ((0, _jquery2.default)(this).children('[data-submenu]:visible').length) { 2179 // has open sub menu 2180 $nextElement = $element.find('li:first-child').find('a').first(); 2181 } 2182 if ((0, _jquery2.default)(this).is(':first-child')) { 2183 // is first element of sub menu 2184 $prevElement = $element.parents('li').first().find('a').first(); 2185 } else if ($prevElement.parents('li').first().children('[data-submenu]:visible').length) { 2186 // if previous element has open sub menu 2187 $prevElement = $prevElement.parents('li').find('li:last-child').find('a').first(); 2188 } 2189 if ((0, _jquery2.default)(this).is(':last-child')) { 2190 // is last element of sub menu 2191 $nextElement = $element.parents('li').first().next('li').find('a').first(); 2192 } 2193 2194 return; 2195 } 2196 }); 2197 2198 _foundationUtil.Keyboard.handleKey(e, 'AccordionMenu', { 2199 open: function open() { 2200 if ($target.is(':hidden')) { 2201 _this.down($target); 2202 $target.find('li').first().find('a').first().focus(); 2203 } 2204 }, 2205 close: function close() { 2206 if ($target.length && !$target.is(':hidden')) { 2207 // close active sub of this item 2208 _this.up($target); 2209 } else if ($element.parent('[data-submenu]').length) { 2210 // close currently open sub 2211 _this.up($element.parent('[data-submenu]')); 2212 $element.parents('li').first().find('a').first().focus(); 2213 } 2214 }, 2215 up: function up() { 2216 $prevElement.focus(); 2217 return true; 2218 }, 2219 down: function down() { 2220 $nextElement.focus(); 2221 return true; 2222 },
vendor: 4,420 bytes, lines 2223-2392
2223 toggle: function toggle() { 2224 if (_this.options.submenuToggle) { 2225 return false; 2226 } 2227 if ($element.children('[data-submenu]').length) { 2228 _this.toggle($element.children('[data-submenu]')); 2229 return true; 2230 } 2231 }, 2232 closeAll: function closeAll() { 2233 _this.hideAll(); 2234 }, 2235 handled: function handled(preventDefault) { 2236 if (preventDefault) { 2237 e.preventDefault(); 2238 } 2239 e.stopImmediatePropagation(); 2240 } 2241 }); 2242 }); //.attr('tabindex', 0); 2243 } 2244 2245 /** 2246 * Closes all panes of the menu. 2247 * @function 2248 */ 2249 2250 }, { 2251 key: 'hideAll', 2252 value: function hideAll() { 2253 this.up(this.$element.find('[data-submenu]')); 2254 } 2255 2256 /** 2257 * Opens all panes of the menu. 2258 * @function 2259 */ 2260 2261 }, { 2262 key: 'showAll', 2263 value: function showAll() { 2264 this.down(this.$element.find('[data-submenu]')); 2265 } 2266 2267 /** 2268 * Toggles the open/close state of a submenu. 2269 * @function 2270 * @param {jQuery} $target - the submenu to toggle 2271 */ 2272 2273 }, { 2274 key: 'toggle', 2275 value: function toggle($target) { 2276 if (!$target.is(':animated')) { 2277 if (!$target.is(':hidden')) { 2278 this.up($target); 2279 } else { 2280 this.down($target); 2281 } 2282 } 2283 } 2284 2285 /** 2286 * Opens the sub-menu defined by `$target`. 2287 * @param {jQuery} $target - Sub-menu to open. 2288 * @fires AccordionMenu#down 2289 */ 2290 2291 }, { 2292 key: 'down', 2293 value: function down($target) { 2294 var _this = this; 2295 2296 if (!this.options.multiOpen) { 2297 this.up(this.$element.find('.is-active').not($target.parentsUntil(this.$element).add($target))); 2298 } 2299 2300 $target.addClass('is-active').attr({ 'aria-hidden': false }); 2301 2302 if (this.options.submenuToggle) { 2303 $target.prev('.submenu-toggle').attr({ 'aria-expanded': true }); 2304 } else { 2305 $target.parent('.is-accordion-submenu-parent').attr({ 'aria-expanded': true }); 2306 } 2307 2308 $target.slideDown(_this.options.slideSpeed, function () { 2309 /** 2310 * Fires when the menu is done opening. 2311 * @event AccordionMenu#down 2312 */ 2313 _this.$element.trigger('down.zf.accordionMenu', [$target]); 2314 }); 2315 } 2316 2317 /** 2318 * Closes the sub-menu defined by `$target`. All sub-menus inside the target will be closed as well. 2319 * @param {jQuery} $target - Sub-menu to close. 2320 * @fires AccordionMenu#up 2321 */ 2322 2323 }, { 2324 key: 'up', 2325 value: function up($target) { 2326 var _this = this; 2327 $target.slideUp(_this.options.slideSpeed, function () { 2328 /** 2329 * Fires when the menu is done collapsing up. 2330 * @event AccordionMenu#up 2331 */ 2332 _this.$element.trigger('up.zf.accordionMenu', [$target]); 2333 }); 2334 2335 var $menus = $target.find('[data-submenu]').slideUp(0).addBack().attr('aria-hidden', true); 2336 2337 if (this.options.submenuToggle) { 2338 $menus.prev('.submenu-toggle').attr('aria-expanded', false); 2339 } else { 2340 $menus.parent('.is-accordion-submenu-parent').attr('aria-expanded', false); 2341 } 2342 } 2343 2344 /** 2345 * Destroys an instance of accordion menu. 2346 * @fires AccordionMenu#destroyed 2347 */ 2348 2349 }, { 2350 key: '_destroy', 2351 value: function _destroy() { 2352 this.$element.find('[data-submenu]').slideDown(0).css('display', ''); 2353 this.$element.find('a').off('click.zf.accordionMenu'); 2354 2355 if (this.options.submenuToggle) { 2356 this.$element.find('.has-submenu-toggle').removeClass('has-submenu-toggle'); 2357 this.$element.find('.submenu-toggle').remove(); 2358 } 2359 2360 _foundationUtil2.Nest.Burn(this.$element, 'accordion'); 2361 } 2362 }]); 2363 2364 return AccordionMenu; 2365}(_foundation.Plugin); 2366 2367AccordionMenu.defaults = { 2368 /** 2369 * Amount of time to animate the opening of a submenu in ms. 2370 * @option 2371 * @type {number} 2372 * @default 250 2373 */ 2374 slideSpeed: 250, 2375 /** 2376 * Adds a separate submenu toggle button. This allows the parent item to have a link. 2377 * @option 2378 * @example true 2379 */ 2380 submenuToggle: false, 2381 /** 2382 * The text used for the submenu toggle if enabled. This is used for screen readers only. 2383 * @option 2384 * @example true 2385 */ 2386 submenuToggleText: 'Toggle menu', 2387 /** 2388 * Allow the menu to have multiple open panes. 2389 * @option 2390 * @type {boolean} 2391 * @default true 2392 */
2393 multiOpen: true 2394}; 2395 2396exports.AccordionMenu = AccordionMenu; 2397 2398/***/ }), 2399/* 13 */ 2400/***/ (function(module, exports, __webpack_require__) { 2401 2402"use strict"; 2403 2404 2405Object.defineProperty(exports, "__esModule", { 2406 value: true 2407}); 2408exports.Drilldown = undefined; 2409 2410var _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; }; }(); 2411 2412var _jquery = __webpack_require__(0); 2413 2414var _jquery2 = _interopRequireDefault(_jquery); 2415 2416var _foundationUtil = __webpack_require__(3); 2417 2418var _foundationUtil2 = __webpack_require__(9); 2419 2420var _foundationUtil3 = __webpack_require__(1); 2421 2422var _foundationUtil4 = __webpack_require__(7); 2423 2424var _foundation = __webpack_require__(2); 2425 2426function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2427 2428function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2429 2430function _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; } 2431 2432function _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; } 2433 2434/** 2435 * Drilldown module. 2436 * @module foundation.drilldown 2437 * @requires foundation.util.keyboard 2438 * @requires foundation.util.nest 2439 * @requires foundation.util.box 2440 */ 2441 2442var Drilldown = function (_Plugin) { 2443 _inherits(Drilldown, _Plugin); 2444 2445 function Drilldown() { 2446 _classCallCheck(this, Drilldown); 2447 2448 return _possibleConstructorReturn(this, (Drilldown.__proto__ || Object.getPrototypeOf(Drilldown)).apply(this, arguments)); 2449 } 2450 2451 _createClass(Drilldown, [{ 2452 key: '_setup', 2453 2454 /** 2455 * Creates a new instance of a drilldown menu. 2456 * @class 2457 * @name Drilldown 2458 * @param {jQuery} element - jQuery object to make into an accordion menu. 2459 * @param {Object} options - Overrides to the default plugin settings. 2460 */ 2461 value: function _setup(element, options) { 2462 this.$element = element; 2463 this.options = _jquery2.default.extend({}, Drilldown.defaults, this.$element.data(), options); 2464 this.className = 'Drilldown'; // ie9 back compat 2465 2466 _foundationUtil2.Nest.Feather(this.$element, 'drilldown'); 2467 2468 this._init(); 2469 2470 _foundationUtil.Keyboard.register('Drilldown', { 2471 'ENTER': 'open', 2472 'SPACE': 'open', 2473 'ARROW_RIGHT': 'next', 2474 'ARROW_UP': 'up', 2475 'ARROW_DOWN': 'down', 2476 'ARROW_LEFT': 'previous', 2477 'ESCAPE': 'close', 2478 'TAB': 'down', 2479 'SHIFT_TAB': 'up' 2480 }); 2481 } 2482 2483 /** 2484 * Initializes the drilldown by creating jQuery collections of elements 2485 * @private 2486 */ 2487 2488 }, { 2489 key: '_init', 2490 value: function _init() { 2491 if (this.options.autoApplyClass) { 2492 this.$element.addClass('drilldown'); 2493 } 2494 2495 this.$element.attr({ 2496 'role': 'tree', 2497 'aria-multiselectable': false 2498 }); 2499 this.$submenuAnchors = this.$element.find('li.is-drilldown-submenu-parent').children('a'); 2500 this.$submenus = this.$submenuAnchors.parent('li').children('[data-submenu]').attr('role', 'group'); 2501 this.$menuItems = this.$element.find('li').not('.js-drilldown-back').attr('role', 'treeitem').find('a'); 2502 this.$element.attr('data-mutate', this.$element.attr('data-drilldown') || (0, _foundationUtil3.GetYoDigits)(6, 'drilldown')); 2503 2504 this._prepareMenu(); 2505 this._registerEvents(); 2506 2507 this._keyboardEvents(); 2508 } 2509 2510 /** 2511 * prepares drilldown menu by setting attributes to links and elements 2512 * sets a min height to prevent content jumping 2513 * wraps the element if not already wrapped 2514 * @private 2515 * @function 2516 */ 2517 2518 }, { 2519 key: '_prepareMenu', 2520 value: function _prepareMenu() { 2521 var _this = this; 2522 // if(!this.options.holdOpen){ 2523 // this._menuLinkEvents(); 2524 // } 2525 this.$submenuAnchors.each(function () { 2526 var $link = (0, _jquery2.default)(this); 2527 var $sub = $link.parent(); 2528 if (_this.options.parentLink) { 2529 $link.clone().prependTo($sub.children('[data-submenu]')).wrap('<li class="is-submenu-parent-item is-submenu-item is-drilldown-submenu-item" role="menu-item"></li>'); 2530 } 2531 $link.data('savedHref', $link.attr('href')).removeAttr('href').attr('tabindex', 0); 2532 $link.children('[data-submenu]').attr({ 2533 'aria-hidden': true, 2534 'tabindex': 0, 2535 'role': 'group' 2536 }); 2537 _this._events($link); 2538 }); 2539 this.$submenus.each(function () { 2540 var $menu = (0, _jquery2.default)(this), 2541 $back = $menu.find('.js-drilldown-back'); 2542 if (!$back.length) { 2543 switch (_this.options.backButtonPosition) { 2544 case "bottom": 2545 $menu.append(_this.options.backButton); 2546 break; 2547 case "top": 2548 $menu.prepend(_this.options.backButton); 2549 break; 2550 default: 2551 console.error("Unsupported backButtonPosition value '" + _this.options.backButtonPosition + "'"); 2552 } 2553 } 2554 _this._back($menu); 2555 }); 2556 2557 this.$submenus.addClass('invisible'); 2558 if (!this.options.autoHeight) { 2559 this.$submenus.addClass('drilldown-submenu-cover-previous'); 2560 } 2561 2562 // create a wrapper on element if it doesn't exist. 2563 if (!this.$element.parent().hasClass('is-drilldown')) { 2564 this.$wrapper = (0, _jquery2.default)(this.options.wrapper).addClass('is-drilldown'); 2565 if (this.options.animateHeight) this.$wrapper.addClass('animate-height'); 2566 this.$element.wrap(this.$wrapper); 2567 } 2568 // set wrapper 2569 this.$wrapper = this.$element.parent(); 2570 this.$wrapper.css(this._getMaxDims()); 2571 } 2572 }, { 2573 key: '_resize', 2574 value: function _resize() { 2575 this.$wrapper.css({ 'max-width': 'none', 'min-height': 'none' }); 2576 // _getMaxDims has side effects (boo) but calling it should update all other necessary heights & widths 2577 this.$wrapper.css(this._getMaxDims()); 2578 } 2579 2580 /** 2581 * Adds event handlers to elements in the menu. 2582 * @function 2583 * @private 2584 * @param {jQuery} $elem - the current menu item to add handlers to. 2585 */ 2586 2587 }, { 2588 key: '_events', 2589 value: function _events($elem) { 2590 var _this = this; 2591 2592 $elem.off('click.zf.drilldown').on('click.zf.drilldown', function (e) { 2593 if ((0, _jquery2.default)(e.target).parentsUntil('ul', 'li').hasClass('is-drilldown-submenu-parent')) { 2594 e.stopImmediatePropagation(); 2595 e.preventDefault(); 2596 } 2597 2598 // if(e.target !== e.currentTarget.firstElementChild){ 2599 // return false;
2600 // } 2601 _this._show($elem.parent('li')); 2602 2603 if (_this.options.closeOnClick) { 2604 var $body = (0, _jquery2.default)('body'); 2605 $body.off('.zf.drilldown').on('click.zf.drilldown', function (e) { 2606 if (e.target === _this.$element[0] || _jquery2.default.contains(_this.$element[0], e.target)) { 2607 return; 2608 } 2609 e.preventDefault(); 2610 _this._hideAll(); 2611 $body.off('.zf.drilldown'); 2612 }); 2613 } 2614 }); 2615 } 2616 2617 /** 2618 * Adds event handlers to the menu element. 2619 * @function 2620 * @private 2621 */ 2622 2623 }, { 2624 key: '_registerEvents', 2625 value: function _registerEvents() { 2626 if (this.options.scrollTop) { 2627 this._bindHandler = this._scrollTop.bind(this); 2628 this.$element.on('open.zf.drilldown hide.zf.drilldown closed.zf.drilldown', this._bindHandler); 2629 } 2630 this.$element.on('mutateme.zf.trigger', this._resize.bind(this)); 2631 } 2632 2633 /** 2634 * Scroll to Top of Element or data-scroll-top-element 2635 * @function 2636 * @fires Drilldown#scrollme 2637 */ 2638 2639 }, { 2640 key: '_scrollTop', 2641 value: function _scrollTop() { 2642 var _this = this; 2643 var $scrollTopElement = _this.options.scrollTopElement != '' ? (0, _jquery2.default)(_this.options.scrollTopElement) : _this.$element, 2644 scrollPos = parseInt($scrollTopElement.offset().top + _this.options.scrollTopOffset, 10); 2645 (0, _jquery2.default)('html, body').stop(true).animate({ scrollTop: scrollPos }, _this.options.animationDuration, _this.options.animationEasing, function () { 2646 /** 2647 * Fires after the menu has scrolled 2648 * @event Drilldown#scrollme 2649 */ 2650 if (this === (0, _jquery2.default)('html')[0]) _this.$element.trigger('scrollme.zf.drilldown'); 2651 }); 2652 } 2653 2654 /** 2655 * Adds keydown event listener to `li`'s in the menu. 2656 * @private 2657 */ 2658 2659 }, { 2660 key: '_keyboardEvents', 2661 value: function _keyboardEvents() { 2662 var _this = this; 2663 2664 this.$menuItems.add(this.$element.find('.js-drilldown-back > a, .is-submenu-parent-item > a')).on('keydown.zf.drilldown', function (e) { 2665 var $element = (0, _jquery2.default)(this), 2666 $elements = $element.parent('li').parent('ul').children('li').children('a'), 2667 $prevElement, 2668 $nextElement; 2669 2670 $elements.each(function (i) { 2671 if ((0, _jquery2.default)(this).is($element)) { 2672 $prevElement = $elements.eq(Math.max(0, i - 1)); 2673 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 2674 return; 2675 } 2676 }); 2677 2678 _foundationUtil.Keyboard.handleKey(e, 'Drilldown', { 2679 next: function next() { 2680 if ($element.is(_this.$submenuAnchors)) { 2681 _this._show($element.parent('li')); 2682 $element.parent('li').one((0, _foundationUtil3.transitionend)($element), function () { 2683 $element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus(); 2684 }); 2685 return true; 2686 } 2687 }, 2688 previous: function previous() { 2689 _this._hide($element.parent('li').parent('ul')); 2690 $element.parent('li').parent('ul').one((0, _foundationUtil3.transitionend)($element), function () { 2691 setTimeout(function () { 2692 $element.parent('li').parent('ul').parent('li').children('a').first().focus(); 2693 }, 1); 2694 }); 2695 return true; 2696 }, 2697 up: function up() { 2698 $prevElement.focus(); 2699 // Don't tap focus on first element in root ul 2700 return !$element.is(_this.$element.find('> li:first-child > a')); 2701 }, 2702 down: function down() { 2703 $nextElement.focus(); 2704 // Don't tap focus on last element in root ul 2705 return !$element.is(_this.$element.find('> li:last-child > a')); 2706 }, 2707 close: function close() { 2708 // Don't close on element in root ul 2709 if (!$element.is(_this.$element.find('> li > a'))) { 2710 _this._hide($element.parent().parent()); 2711 $element.parent().parent().siblings('a').focus(); 2712 } 2713 }, 2714 open: function open() { 2715 if (!$element.is(_this.$menuItems)) { 2716 // not menu item means back button 2717 _this._hide($element.parent('li').parent('ul')); 2718 $element.parent('li').parent('ul').one((0, _foundationUtil3.transitionend)($element), function () { 2719 setTimeout(function () { 2720 $element.parent('li').parent('ul').parent('li').children('a').first().focus(); 2721 }, 1); 2722 }); 2723 return true; 2724 } else if ($element.is(_this.$submenuAnchors)) { 2725 _this._show($element.parent('li')); 2726 $element.parent('li').one((0, _foundationUtil3.transitionend)($element), function () { 2727 $element.parent('li').find('ul li a').filter(_this.$menuItems).first().focus(); 2728 }); 2729 return true; 2730 } 2731 }, 2732 handled: function handled(preventDefault) { 2733 if (preventDefault) { 2734 e.preventDefault(); 2735 } 2736 e.stopImmediatePropagation(); 2737 } 2738 }); 2739 }); // end keyboardAccess 2740 } 2741 2742 /** 2743 * Closes all open elements, and returns to root menu. 2744 * @function 2745 * @fires Drilldown#closed 2746 */ 2747 2748 }, { 2749 key: '_hideAll', 2750 value: function _hideAll() { 2751 var $elem = this.$element.find('.is-drilldown-submenu.is-active').addClass('is-closing'); 2752 if (this.options.autoHeight) this.$wrapper.css({ height: $elem.parent().closest('ul').data('calcHeight') }); 2753 $elem.one((0, _foundationUtil3.transitionend)($elem), function (e) { 2754 $elem.removeClass('is-active is-closing'); 2755 }); 2756 /** 2757 * Fires when the menu is fully closed. 2758 * @event Drilldown#closed 2759 */ 2760 this.$element.trigger('closed.zf.drilldown'); 2761 } 2762 2763 /** 2764 * Adds event listener for each `back` button, and closes open menus. 2765 * @function 2766 * @fires Drilldown#back 2767 * @param {jQuery} $elem - the current sub-menu to add `back` event. 2768 */ 2769 2770 }, { 2771 key: '_back', 2772 value: function _back($elem) { 2773 var _this = this; 2774 $elem.off('click.zf.drilldown'); 2775 $elem.children('.js-drilldown-back').on('click.zf.drilldown', function (e) { 2776 e.stopImmediatePropagation(); 2777 // console.log('mouseup on back'); 2778 _this._hide($elem); 2779 2780 // If there is a parent submenu, call show 2781 var parentSubMenu = $elem.parent('li').parent('ul').parent('li'); 2782 if (parentSubMenu.length) { 2783 _this._show(parentSubMenu); 2784 } 2785 }); 2786 } 2787 2788 /** 2789 * Adds event listener to menu items w/o submenus to close open menus on click. 2790 * @function 2791 * @private 2792 */ 2793 2794 }, { 2795 key: '_menuLinkEvents', 2796 value: function _menuLinkEvents() { 2797 var _this = this; 2798 this.$menuItems.not('.is-drilldown-submenu-parent').off('click.zf.drilldown').on('click.zf.drilldown', function (e) { 2799 // e.stopImmediatePropagation(); 2800 setTimeout(function () { 2801 _this._hideAll(); 2802 }, 0); 2803 }); 2804 } 2805 2806 /** 2807 * Opens a submenu. 2808 * @function 2809 * @fires Drilldown#open 2810 * @param {jQuery} $elem - the current element with a submenu to open, i.e. the `li` tag. 2811 */ 2812 2813 }, { 2814 key: '_show', 2815 value: function _show($elem) { 2816 if (this.options.autoHeight) this.$wrapper.css({ height: $elem.children('[data-submenu]').data('calcHeight') }); 2817 $elem.attr('aria-expanded', true); 2818 $elem.children('[data-submenu]').addClass('is-active').removeClass('invisible').attr('aria-hidden', false); 2819 /** 2820 * Fires when the submenu has opened. 2821 * @event Drilldown#open 2822 */ 2823 this.$element.trigger('open.zf.drilldown', [$elem]); 2824 } 2825 }, { 2826 key: '_hide', 2827 2828 2829 /** 2830 * Hides a submenu 2831 * @function 2832 * @fires Drilldown#hide 2833 * @param {jQuery} $elem - the current sub-menu to hide, i.e. the `ul` tag. 2834 */ 2835 value: function _hide($elem) { 2836 if (this.options.autoHeight) this.$wrapper.css({ height: $elem.parent().closest('ul').data('calcHeight') }); 2837 var _this = this; 2838 $elem.parent('li').attr('aria-expanded', false); 2839 $elem.attr('aria-hidden', true).addClass('is-closing'); 2840 $elem.addClass('is-closing').one((0, _foundationUtil3.transitionend)($elem), function () { 2841 $elem.removeClass('is-active is-closing'); 2842 $elem.blur().addClass('invisible'); 2843 }); 2844 /** 2845 * Fires when the submenu has closed. 2846 * @event Drilldown#hide 2847 */ 2848 $elem.trigger('hide.zf.drilldown', [$elem]); 2849 } 2850 2851 /** 2852 * Iterates through the nested menus to calculate the min-height, and max-width for the menu. 2853 * Prevents content jumping. 2854 * @function 2855 * @private 2856 */ 2857 2858 }, { 2859 key: '_getMaxDims', 2860 value: function _getMaxDims() { 2861 var maxHeight = 0, 2862 result = {}, 2863 _this = this; 2864 this.$submenus.add(this.$element).each(function () { 2865 var numOfElems = (0, _jquery2.default)(this).children('li').length; 2866 var height = _foundationUtil4.Box.GetDimensions(this).height; 2867 maxHeight = height > maxHeight ? height : maxHeight; 2868 if (_this.options.autoHeight) { 2869 (0, _jquery2.default)(this).data('calcHeight', height); 2870 if (!(0, _jquery2.default)(this).hasClass('is-drilldown-submenu')) result['height'] = height; 2871 } 2872 }); 2873 2874 if (!this.options.autoHeight) result['min-height'] = maxHeight + 'px'; 2875 2876 result['max-width'] = this.$element[0].getBoundingClientRect().width + 'px'; 2877 2878 return result; 2879 } 2880 2881 /** 2882 * Destroys the Drilldown Menu 2883 * @function 2884 */ 2885 2886 }, { 2887 key: '_destroy', 2888 value: function _destroy() { 2889 if (this.options.scrollTop) this.$element.off('.zf.drilldown', this._bindHandler); 2890 this._hideAll(); 2891 this.$element.off('mutateme.zf.trigger'); 2892 _foundationUtil2.Nest.Burn(this.$element, 'drilldown'); 2893 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'); 2894 this.$submenuAnchors.each(function () { 2895 (0, _jquery2.default)(this).off('.zf.drilldown'); 2896 }); 2897 2898 this.$submenus.removeClass('drilldown-submenu-cover-previous invisible'); 2899 2900 this.$element.find('a').each(function () { 2901 var $link = (0, _jquery2.default)(this); 2902 $link.removeAttr('tabindex'); 2903 if ($link.data('savedHref')) { 2904 $link.attr('href', $link.data('savedHref')).removeData('savedHref'); 2905 } else { 2906 return; 2907 } 2908 }); 2909 } 2910 }]); 2911 2912 return Drilldown; 2913}
vendor: 4,573 bytes, lines 2913-3048
2913(_foundation.Plugin); 2914 2915Drilldown.defaults = { 2916 /** 2917 * Drilldowns depend on styles in order to function properly; in the default build of Foundation these are 2918 * on the `drilldown` class. This option auto-applies this class to the drilldown upon initialization. 2919 * @option 2920 * @type {boolian} 2921 * @default true 2922 */ 2923 autoApplyClass: true, 2924 /** 2925 * 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. 2926 * @option 2927 * @type {string} 2928 * @default '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>' 2929 */ 2930 backButton: '<li class="js-drilldown-back"><a tabindex="0">Back</a></li>', 2931 /** 2932 * Position the back button either at the top or bottom of drilldown submenus. Can be `'left'` or `'bottom'`. 2933 * @option 2934 * @type {string} 2935 * @default top 2936 */ 2937 backButtonPosition: 'top', 2938 /** 2939 * 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. 2940 * @option 2941 * @type {string} 2942 * @default '<div></div>' 2943 */ 2944 wrapper: '<div></div>', 2945 /** 2946 * Adds the parent link to the submenu. 2947 * @option 2948 * @type {boolean} 2949 * @default false 2950 */ 2951 parentLink: false, 2952 /** 2953 * Allow the menu to return to root list on body click. 2954 * @option 2955 * @type {boolean} 2956 * @default false 2957 */ 2958 closeOnClick: false, 2959 /** 2960 * Allow the menu to auto adjust height. 2961 * @option 2962 * @type {boolean} 2963 * @default false 2964 */ 2965 autoHeight: false, 2966 /** 2967 * Animate the auto adjust height. 2968 * @option 2969 * @type {boolean} 2970 * @default false 2971 */ 2972 animateHeight: false, 2973 /** 2974 * Scroll to the top of the menu after opening a submenu or navigating back using the menu back button 2975 * @option 2976 * @type {boolean} 2977 * @default false 2978 */ 2979 scrollTop: false, 2980 /** 2981 * String jquery selector (for example 'body') of element to take offset().top from, if empty string the drilldown menu offset().top is taken 2982 * @option 2983 * @type {string} 2984 * @default '' 2985 */ 2986 scrollTopElement: '', 2987 /** 2988 * ScrollTop offset 2989 * @option 2990 * @type {number} 2991 * @default 0 2992 */ 2993 scrollTopOffset: 0, 2994 /** 2995 * Scroll animation duration 2996 * @option 2997 * @type {number} 2998 * @default 500 2999 */ 3000 animationDuration: 500, 3001 /** 3002 * Scroll animation easing. Can be `'swing'` or `'linear'`. 3003 * @option 3004 * @type {string} 3005 * @see {@link https://api.jquery.com/animate|JQuery animate} 3006 * @default 'swing' 3007 */ 3008 animationEasing: 'swing' 3009 // holdOpen: false 3010}; 3011 3012exports.Drilldown = Drilldown; 3013 3014/***/ }), 3015/* 14 */ 3016/***/ (function(module, exports, __webpack_require__) { 3017 3018"use strict"; 3019 3020 3021Object.defineProperty(exports, "__esModule", { 3022 value: true 3023}); 3024exports.DropdownMenu = undefined; 3025 3026var _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; }; }(); 3027 3028var _jquery = __webpack_require__(0); 3029 3030var _jquery2 = _interopRequireDefault(_jquery); 3031 3032var _foundationUtil = __webpack_require__(3); 3033 3034var _foundationUtil2 = __webpack_require__(9); 3035 3036var _foundationUtil3 = __webpack_require__(7); 3037 3038var _foundationUtil4 = __webpack_require__(1); 3039 3040var _foundation = __webpack_require__(2); 3041 3042function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3043 3044function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3045 3046function _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; } 3047 3048function _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
3048onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 3049 3050/** 3051 * DropdownMenu module. 3052 * @module foundation.dropdown-menu 3053 * @requires foundation.util.keyboard 3054 * @requires foundation.util.box 3055 * @requires foundation.util.nest 3056 */ 3057 3058var DropdownMenu = function (_Plugin) { 3059 _inherits(DropdownMenu, _Plugin); 3060 3061 function DropdownMenu() { 3062 _classCallCheck(this, DropdownMenu); 3063 3064 return _possibleConstructorReturn(this, (DropdownMenu.__proto__ || Object.getPrototypeOf(DropdownMenu)).apply(this, arguments)); 3065 } 3066 3067 _createClass(DropdownMenu, [{ 3068 key: '_setup', 3069 3070 /** 3071 * Creates a new instance of DropdownMenu. 3072 * @class 3073 * @name DropdownMenu 3074 * @fires DropdownMenu#init 3075 * @param {jQuery} element - jQuery object to make into a dropdown menu. 3076 * @param {Object} options - Overrides to the default plugin settings. 3077 */ 3078 value: function _setup(element, options) { 3079 this.$element = element; 3080 this.options = _jquery2.default.extend({}, DropdownMenu.defaults, this.$element.data(), options); 3081 this.className = 'DropdownMenu'; // ie9 back compat 3082 3083 _foundationUtil2.Nest.Feather(this.$element, 'dropdown'); 3084 this._init(); 3085 3086 _foundationUtil.Keyboard.register('DropdownMenu', { 3087 'ENTER': 'open', 3088 'SPACE': 'open', 3089 'ARROW_RIGHT': 'next', 3090 'ARROW_UP': 'up', 3091 'ARROW_DOWN': 'down', 3092 'ARROW_LEFT': 'previous', 3093 'ESCAPE': 'close' 3094 }); 3095 } 3096 3097 /** 3098 * Initializes the plugin, and calls _prepareMenu 3099 * @private 3100 * @function 3101 */ 3102 3103 }, { 3104 key: '_init', 3105 value: function _init() { 3106 var subs = this.$element.find('li.is-dropdown-submenu-parent'); 3107 this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub'); 3108 3109 this.$menuItems = this.$element.find('[role="menuitem"]'); 3110 this.$tabs = this.$element.children('[role="menuitem"]'); 3111 this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass); 3112 3113 if (this.options.alignment === 'auto') { 3114 if (this.$element.hasClass(this.options.rightClass) || (0, _foundationUtil4.rtl)() || this.$element.parents('.top-bar-right').is('*')) { 3115 this.options.alignment = 'right'; 3116 subs.addClass('opens-left'); 3117 } else { 3118 this.options.alignment = 'left'; 3119 subs.addClass('opens-right'); 3120 } 3121 } else { 3122 if (this.options.alignment === 'right') { 3123 subs.addClass('opens-left'); 3124 } else { 3125 subs.addClass('opens-right'); 3126 } 3127 } 3128 this.changed = false; 3129 this._events(); 3130 } 3131 }, { 3132 key: '_isVertical', 3133 value: function _isVertical() { 3134 return this.$tabs.css('display') === 'block' || this.$element.css('flex-direction') === 'column'; 3135 } 3136 }, { 3137 key: '_isRtl', 3138 value: function _isRtl() { 3139 return this.$element.hasClass('align-right') || (0, _foundationUtil4.rtl)() && !this.$element.hasClass('align-left'); 3140 } 3141 3142 /** 3143 * Adds event listeners to elements within the menu 3144 * @private 3145 * @function 3146 */ 3147 3148 }, { 3149 key: '_events', 3150 value: function _events() { 3151 var _this = this, 3152 hasTouch = 'ontouchstart' in window || typeof window.ontouchstart !== 'undefined', 3153 parClass = 'is-dropdown-submenu-parent'; 3154 3155 // used for onClick and in the keyboard handlers 3156 var handleClickFn = function handleClickFn(e) { 3157 var $elem = (0, _jquery2.default)(e.target).parentsUntil('ul', '.' + parClass), 3158 hasSub = $elem.hasClass(parClass), 3159 hasClicked = $elem.attr('data-is-click') === 'true', 3160 $sub = $elem.children('.is-dropdown-submenu'); 3161 3162 if (hasSub) { 3163 if (hasClicked) { 3164 if (!_this.options.closeOnClick || !_this.options.clickOpen && !hasTouch || _this.options.forceFollow && hasTouch) { 3165 return; 3166 } else { 3167 e.stopImmediatePropagation(); 3168 e.preventDefault(); 3169 _this._hide($elem); 3170 } 3171 } else { 3172 e.preventDefault(); 3173 e.stopImmediatePropagation(); 3174 _this._show($sub); 3175 $elem.add($elem.parentsUntil(_this.$element, '.' + parClass)).attr('data-is-click', true); 3176 } 3177 } 3178 }; 3179 3180 if (this.options.clickOpen || hasTouch) { 3181 this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', handleClick
3181Fn); 3182 } 3183 3184 // Handle Leaf element Clicks 3185 if (_this.options.closeOnClickInside) { 3186 this.$menuItems.on('click.zf.dropdownmenu', function (e) { 3187 var $elem = (0, _jquery2.default)(this), 3188 hasSub = $elem.hasClass(parClass); 3189 if (!hasSub) { 3190 _this._hide(); 3191 } 3192 }); 3193 } 3194 3195 if (!this.options.disableHover) { 3196 this.$menuItems.on('mouseenter.zf.dropdownmenu', function (e) { 3197 var $elem = (0, _jquery2.default)(this), 3198 hasSub = $elem.hasClass(parClass); 3199 3200 if (hasSub) { 3201 clearTimeout($elem.data('_delay')); 3202 $elem.data('_delay', setTimeout(function () { 3203 _this._show($elem.children('.is-dropdown-submenu')); 3204 }, _this.options.hoverDelay)); 3205 } 3206 }).on('mouseleave.zf.dropdownmenu', function (e) { 3207 var $elem = (0, _jquery2.default)(this), 3208 hasSub = $elem.hasClass(parClass); 3209 if (hasSub && _this.options.autoclose) { 3210 if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) { 3211 return false; 3212 } 3213 3214 clearTimeout($elem.data('_delay')); 3215 $elem.data('_delay', setTimeout(function () { 3216 _this._hide($elem); 3217 }, _this.options.closingTime)); 3218 } 3219 }); 3220 } 3221 this.$menuItems.on('keydown.zf.dropdownmenu', function (e) { 3222 var $element = (0, _jquery2.default)(e.target).parentsUntil('ul', '[role="menuitem"]'), 3223 isTab = _this.$tabs.index($element) > -1, 3224 $elements = isTab ? _this.$tabs : $element.siblings('li').add($element), 3225 $prevElement, 3226 $nextElement; 3227 3228 $elements.each(function (i) { 3229 if ((0, _jquery2.default)(this).is($element)) { 3230 $prevElement = $elements.eq(i - 1); 3231 $nextElement = $elements.eq(i + 1); 3232 return; 3233 } 3234 }); 3235 3236 var nextSibling = function nextSibling() { 3237 if (!$element.is(':last-child')) { 3238 $nextElement.children('a:first').focus(); 3239 e.preventDefault(); 3240 } 3241 }, 3242 prevSibling = function prevSibling() { 3243 $prevElement.children('a:first').focus(); 3244 e.preventDefault(); 3245 }, 3246 openSub = function openSub() { 3247 var $sub = $element.children('ul.is-dropdown-submenu'); 3248 if ($sub.length) { 3249 _this._show($sub); 3250 $element.find('li > a:first').focus(); 3251 e.preventDefault(); 3252 } else { 3253 return; 3254 } 3255 }, 3256 closeSub = function closeSub() { 3257 //if ($element.is(':first-child')) { 3258 var close = $element.parent('ul').parent('li'); 3259 close.children('a:first').focus(); 3260 _this._hide(close); 3261 e.preventDefault(); 3262 //} 3263 }; 3264 var functions = { 3265 open: openSub, 3266 close: function close() { 3267 _this._hide(_this.$element); 3268 _this.$menuItems.eq(0).children('a').focus(); // focus to first element 3269 e.preventDefault(); 3270 }, 3271 handled: function handled() { 3272 e.stopImmediatePropagation(); 3273 } 3274 }; 3275 3276 if (isTab) { 3277 if (_this._isVertical()) { 3278 // vertical menu 3279 if (_this._isRtl()) { 3280 // right aligned 3281 _jquery2.default.extend(functions, { 3282 down: nextSibling, 3283 up: prevSibling, 3284 next: closeSub, 3285 previous: openSub 3286 }); 3287 } else { 3288 // left aligned 3289 _jquery2.default.extend(functions, { 3290 down: nextSibling, 3291 up: prevSibling, 3292 next: openSub, 3293 previous: closeSub 3294 }); 3295 } 3296 } else { 3297 // horizontal menu 3298 if (_this._isRtl()) { 3299 // right aligned 3300 _jquery2.default.extend(functions, { 3301 next: prevSibling, 3302 previous: nextSibling, 3303 down: openSub, 3304 up: closeSub 3305 }); 3306 } else { 3307 // left aligned 3308 _jquery2.default.extend(functions, { 3309 next: nextSibling, 3310 previous: prevSibling, 3311 down: openSub, 3312 up: closeSub 3313 }); 3314 } 3315 } 3316 } else { 3317 // not tabs -> one sub 3318 if (_this._isRtl()) { 3319 // right aligned 3320 _jquery2.default.extend(functions, { 3321 next: closeSub, 3322 previous: openSub, 3323 down: nextSibling, 3324 up: prevSibling 3325 }); 3326 } else { 3327 // left aligned 3328 _jquery2.default.extend(functions, { 3329 next: openSub, 3330 previous: closeSub, 3331 down: nextSibling, 3332 up: prevSibling 3333 }); 3334 } 3335 } 3336 _foundationUtil.Keyboard.handleKey(e, 'DropdownMenu', functions); 3337 }); 3338 } 3339 3340 /** 3341 * Adds an event handler to the body to close any dropdowns on a click. 3342 * @function 3343 * @private 3344 */ 3345 3346 }, { 3347 key: '_addBodyHandler', 3348 value: function _addBodyHandler() { 3349 var $body = (0, _jquery2.default)(document.body), 3350 _this = this; 3351 $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu').on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function (e) { 3352 var $link = _this.$element.find(e.target); 3353 if ($link.length) { 3354 return; 3355 } 3356 3357 _this._hide(); 3358 $body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu'); 3359 }); 3360 } 3361 3362 /**
3363 * Opens a dropdown pane, and checks for collisions first. 3364 * @param {jQuery} $sub - ul element that is a submenu to show 3365 * @function 3366 * @private 3367 * @fires DropdownMenu#show 3368 */ 3369 3370 }, { 3371 key: '_show', 3372 value: function _show($sub) { 3373 var idx = this.$tabs.index(this.$tabs.filter(function (i, el) { 3374 return (0, _jquery2.default)(el).find($sub).length > 0; 3375 })); 3376 var $sibs = $sub.parent('li.is-dropdown-submenu-parent').siblings('li.is-dropdown-submenu-parent'); 3377 this._hide($sibs, idx); 3378 $sub.css('visibility', 'hidden').addClass('js-dropdown-active').parent('li.is-dropdown-submenu-parent').addClass('is-active'); 3379 var clear = _foundationUtil3.Box.ImNotTouchingYou($sub, null, true); 3380 if (!clear) { 3381 var oldClass = this.options.alignment === 'left' ? '-right' : '-left', 3382 $parentLi = $sub.parent('.is-dropdown-submenu-parent'); 3383 $parentLi.removeClass('opens' + oldClass).addClass('opens-' + this.options.alignment); 3384 clear = _foundationUtil3.Box.ImNotTouchingYou($sub, null, true); 3385 if (!clear) { 3386 $parentLi.removeClass('opens-' + this.options.alignment).addClass('opens-inner'); 3387 } 3388 this.changed = true; 3389 } 3390 $sub.css('visibility', ''); 3391 if (this.options.closeOnClick) { 3392 this._addBodyHandler(); 3393 } 3394 /** 3395 * Fires when the new dropdown pane is visible. 3396 * @event DropdownMenu#show 3397 */ 3398 this.$element.trigger('show.zf.dropdownmenu', [$sub]); 3399 } 3400 3401 /** 3402 * Hides a single, currently open dropdown pane, if passed a parameter, otherwise, hides everything. 3403 * @function 3404 * @param {jQuery} $elem - element with a submenu to hide 3405 * @param {Number} idx - index of the $tabs collection to hide 3406 * @private 3407 */ 3408 3409 }, { 3410 key: '_hide', 3411 value: function _hide($elem, idx) { 3412 var $toClose; 3413 if ($elem && $elem.length) { 3414 $toClose = $elem; 3415 } else if (idx !== undefined) { 3416 $toClose = this.$tabs.not(function (i, el) { 3417 return i === idx; 3418 }); 3419 } else { 3420 $toClose = this.$element; 3421 } 3422 var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0; 3423 3424 if (somethingToClose) { 3425 $toClose.find('li.is-active').add($toClose).attr({ 3426 'data-is-click': false 3427 }).removeClass('is-active'); 3428 3429 $toClose.find('ul.js-dropdown-active').removeClass('js-dropdown-active'); 3430 3431 if (this.changed || $toClose.find('opens-inner').length) { 3432 var oldClass = this.options.alignment === 'left' ? 'right' : 'left'; 3433 $toClose.find('li.is-dropdown-submenu-parent').add($toClose).removeClass('opens-inner opens-' + this.options.alignment).addClass('opens-' + oldClass); 3434 this.changed = false; 3435 } 3436 /** 3437 * Fires when the open menus are closed. 3438 * @event DropdownMenu#hide 3439 */ 3440 this.$element.trigger('hide.zf.dropdownmenu', [$toClose]); 3441 } 3442 } 3443 3444 /** 3445 * Destroys the plugin. 3446 * @function 3447 */ 3448 3449 }, { 3450 key: '_destroy', 3451 value: function _destroy() { 3452 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'); 3453 (0, _jquery2.default)(document.body).off('.zf.dropdownmenu'); 3454 _foundationUtil2.Nest.Burn(this.$element, 'dropdown'); 3455 } 3456 }]); 3457 3458 return DropdownMenu; 3459}(_foundation.Plugin); 3460 3461/** 3462 * Default settings for plugin 3463 */ 3464 3465 3466DropdownMenu.defaults = { 3467 /** 3468 * Disallows hover events from opening submenus 3469 * @option 3470 * @type {boolean} 3471 * @default false 3472 */ 3473 disableHover: false, 3474 /** 3475 * Allow a submenu to automatically close on a mouseleave event, if not clicked open. 3476 * @option 3477 * @type {boolean} 3478 * @default true 3479 */ 3480 autoclose: true, 3481 /** 3482 * Amount of time to delay opening a submenu on hover event. 3483 * @option 3484 * @type {number} 3485 * @default 50 3486 */ 3487 hoverDelay: 50, 3488 /** 3489 * Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu. 3490 * @option 3491 * @type {boolean} 3492 * @default false 3493 */ 3494 clickOpen: false, 3495 /** 3496 * Amount of time to delay closing a submenu on a mouseleave event. 3497 * @option 3498 * @type {number} 3499 * @default 500 3500 */ 3501 3502 closingTime: 500, 3503 /** 3504 * Position of the menu relative to what direction the submenus should open. Handled by JS. Can be `'auto'`, `'left'` or `'right'`. 3505 * @option 3506 * @type {string} 3507 * @default 'auto' 3508 */ 3509 alignment: 'auto', 3510 /** 3511 * Allow clicks on the body to close any open submenus. 3512 * @option 3513 * @type {boolean} 3514 * @default true 3515 */ 3516 closeOnClick: true, 3517 /** 3518 * Allow clicks on leaf anchor links to close any open submenus. 3519 * @option 3520 * @type {boolean} 3521 * @default true 3522 */ 3523 closeOnClickInside: true, 3524 /** 3525 * Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class. 3526 * @option 3527 * @type {string} 3528 * @default 'vertical' 3529 */ 3530 verticalClass: 'vertical', 3531 /** 3532 * Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class. 3533 * @option 3534 * @type {string} 3535 * @default 'align-right' 3536 */
3537 rightClass: 'align-right', 3538 /** 3539 * Boolean to force overide the clicking of links to perform default action, on second touch event for mobile. 3540 * @option 3541 * @type {boolean} 3542 * @default true 3543 */ 3544 forceFollow: true 3545}; 3546 3547exports.DropdownMenu = DropdownMenu; 3548 3549/***/ }), 3550/* 15 */ 3551/***/ (function(module, exports, __webpack_require__) { 3552 3553"use strict"; 3554 3555 3556Object.defineProperty(exports, "__esModule", { 3557 value: true 3558}); 3559exports.Positionable = undefined; 3560 3561var _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; }; }(); 3562 3563var _foundationUtil = __webpack_require__(7); 3564 3565var _foundation = __webpack_require__(2); 3566 3567var _foundationUtil2 = __webpack_require__(1); 3568 3569function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3570 3571function _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; } 3572 3573function _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; } 3574 3575var POSITIONS = ['left', 'right', 'top', 'bottom']; 3576var VERTICAL_ALIGNMENTS = ['top', 'bottom', 'center']; 3577var HORIZONTAL_ALIGNMENTS = ['left', 'right', 'center']; 3578 3579var ALIGNMENTS = { 3580 'left': VERTICAL_ALIGNMENTS, 3581 'right': VERTICAL_ALIGNMENTS, 3582 'top': HORIZONTAL_ALIGNMENTS, 3583 'bottom': HORIZONTAL_ALIGNMENTS 3584}; 3585 3586function nextItem(item, array) { 3587 var currentIdx = array.indexOf(item); 3588 if (currentIdx === array.length - 1) { 3589 return array[0]; 3590 } else { 3591 return array[currentIdx + 1]; 3592 } 3593} 3594 3595var Positionable = function (_Plugin) { 3596 _inherits(Positionable, _Plugin); 3597 3598 function Positionable() { 3599 _classCallCheck(this, Positionable); 3600 3601 return _possibleConstructorReturn(this, (Positionable.__proto__ || Object.getPrototypeOf(Positionable)).apply(this, arguments)); 3602 } 3603 3604 _createClass(Positionable, [{ 3605 key: '_init', 3606 3607 /** 3608 * Abstract class encapsulating the tether-like explicit positioning logic 3609 * including repositioning based on overlap. 3610 * Expects classes to define defaults for vOffset, hOffset, position, 3611 * alignment, allowOverlap, and allowBottomOverlap. They can do this by 3612 * extending the defaults, or (for now recommended due to the way docs are 3613 * generated) by explicitly declaring them. 3614 * 3615 **/ 3616 3617 value: function _init() { 3618 this.triedPositions = {}; 3619 this.position = this.options.position === 'auto' ? this._getDefaultPosition() : this.options.position; 3620 this.alignment = this.options.alignment === 'auto' ? this._getDefaultAlignment() : this.options.alignment; 3621 } 3622 }, { 3623 key: '_getDefaultPosition', 3624 value: function _getDefaultPosition() { 3625 return 'bottom'; 3626 } 3627 }, { 3628 key: '_getDefaultAlignment', 3629 value: function _getDefaultAlignment() { 3630 switch (this.position) { 3631 case 'bottom': 3632 case 'top': 3633 return (0, _foundationUtil2.rtl)() ? 'right' : 'left'; 3634 case 'left': 3635 case 'right': 3636 return 'bottom'; 3637 } 3638 } 3639 3640 /** 3641 * Adjusts the positionable possible positions by iterating through alignments 3642 * and positions. 3643 * @function 3644 * @private 3645 */ 3646 3647 }, { 3648 key: '_reposition', 3649 value: function _reposition() { 3650 if (this._alignmentsExhausted(this.position)) { 3651 this.position = nextItem(this.position, POSITIONS); 3652 this.alignment = ALIGNMENTS[this.position][0]; 3653 } else { 3654 this._realign(); 3655 } 3656 } 3657 3658 /** 3659 * Adjusts the dropdown pane possible positions by iterating through alignments 3660 * on the current position. 3661 * @function 3662 * @private 3663 */ 3664 3665 }, { 3666 key: '_realign', 3667 value: function _realign() { 3668 this._addTriedPosition(this.position, this.alignment); 3669 this.alignment = nextItem(this.alignment, ALIGNMENTS[this.position]); 3670 } 3671 }, { 3672 key: '_addTriedPosition', 3673 value: function _addTriedPosition(position, alignment) { 3674 this.triedPositions[position] = this.triedPositions[position] || []; 3675 this.triedPositions[position].push(alignment); 3676 } 3677 }, { 3678 key: '_positionsExhausted', 3679 value: function _positionsExhausted() { 3680 var isExhausted = true; 3681 for (var i = 0; i < POSITIONS.length; i++) { 3682 isExhausted = isExhausted && this._alignmentsExhausted(POSITIONS[i]); 3683 } 3684 return isExhausted; 3685 } 3686 }, { 3687 key: '_alignmentsExhausted', 3688 value: function _alignmentsExhausted(position) { 3689 return this.triedPositions[position] && this.triedPositions[position].length == ALIGNMENTS[position].length; 3690 } 3691 3692 // When we're trying to center, we don't want to apply offset that's going to 3693 // take us just off center, so wrap around to return 0 for the appropriate 3694 // offset in those alignments. TODO: Figure out if we want to make this 3695 // configurable behavior... it feels more intuitive, especially for tooltips, but 3696 // it's possible someone might actually want to start from center and then nudge 3697 // slightly off. 3698 3699 }, { 3700 key: '_getVOffset', 3701 value: function _getVOffset() { 3702 return this.options.vOffset; 3703 } 3704 }, { 3705 key: '_getHOffset', 3706 value: function _getHOffset() { 3707 return this.options.hOffset; 3708 } 3709 }, { 3710 key: '_setPosition', 3711 value: function _setPosition($anchor, $element, $parent) { 3712 if ($anchor.attr('aria-expanded') === 'false') { 3713 return false;
3714 } 3715 var $eleDims = _foundationUtil.Box.GetDimensions($element), 3716 $anchorDims = _foundationUtil.Box.GetDimensions($anchor); 3717 3718 $element.offset(_foundationUtil.Box.GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset())); 3719 3720 if (!this.options.allowOverlap) { 3721 var overlaps = {}; 3722 var minOverlap = 100000000; 3723 // default coordinates to how we start, in case we can't figure out better 3724 var minCoordinates = { position: this.position, alignment: this.alignment }; 3725 while (!this._positionsExhausted()) { 3726 var overlap = _foundationUtil.Box.OverlapArea($element, $parent, false, false, this.options.allowBottomOverlap); 3727 if (overlap === 0) { 3728 return; 3729 } 3730 3731 if (overlap < minOverlap) { 3732 minOverlap = overlap; 3733 minCoordinates = { position: this.position, alignment: this.alignment }; 3734 } 3735 3736 this._reposition(); 3737 3738 $element.offset(_foundationUtil.Box.GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset())); 3739 } 3740 // If we get through the entire loop, there was no non-overlapping 3741 // position available. Pick the version with least overlap. 3742 this.position = minCoordinates.position; 3743 this.alignment = minCoordinates.alignment; 3744 $element.offset(_foundationUtil.Box.GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset())); 3745 } 3746 } 3747 }]); 3748 3749 return Positionable; 3750}(_foundation.Plugin); 3751 3752Positionable.defaults = { 3753 /** 3754 * Position of positionable relative to anchor. Can be left, right, bottom, top, or auto. 3755 * @option 3756 * @type {string} 3757 * @default 'auto' 3758 */ 3759 position: 'auto', 3760 /** 3761 * Alignment of positionable relative to anchor. Can be left, right, bottom, top, center, or auto. 3762 * @option 3763 * @type {string} 3764 * @default 'auto' 3765 */ 3766 alignment: 'auto', 3767 /** 3768 * Allow overlap of container/window. If false, dropdown positionable first 3769 * try to position as defined by data-position and data-alignment, but 3770 * reposition if it would cause an overflow. 3771 * @option 3772 * @type {boolean} 3773 * @default false 3774 */ 3775 allowOverlap: false, 3776 /** 3777 * Allow overlap of only the bottom of the container. This is the most common 3778 * behavior for dropdowns, allowing the dropdown to extend the bottom of the 3779 * screen but not otherwise influence or break out of the container. 3780 * @option 3781 * @type {boolean} 3782 * @default true 3783 */ 3784 allowBottomOverlap: true, 3785 /** 3786 * Number of pixels the positionable should be separated vertically from anchor 3787 * @option 3788 * @type {number} 3789 * @default 0 3790 */ 3791 vOffset: 0, 3792 /** 3793 * Number of pixels the positionable should be separated horizontally from anchor 3794 * @option 3795 * @type {number} 3796 * @default 0 3797 */ 3798 hOffset: 0 3799}; 3800 3801exports.Positionable = Positionable; 3802 3803/***/ }), 3804/* 16 */ 3805/***/ (function(module, exports, __webpack_require__) { 3806 3807"use strict"; 3808 3809 3810Object.defineProperty(exports, "__esModule", { 3811 value: true 3812}); 3813exports.SmoothScroll = undefined; 3814 3815var _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; }; }(); 3816 3817var _jquery = __webpack_require__(0); 3818 3819var _jquery2 = _interopRequireDefault(_jquery); 3820 3821var _foundationUtil = __webpack_require__(1); 3822 3823var _foundation = __webpack_require__(2); 3824 3825function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3826 3827function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3828 3829function _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; } 3830 3831function _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
3831onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 3832 3833/** 3834 * SmoothScroll module. 3835 * @module foundation.smooth-scroll 3836 */ 3837var SmoothScroll = function (_Plugin) { 3838 _inherits(SmoothScroll, _Plugin); 3839 3840 function SmoothScroll() { 3841 _classCallCheck(this, SmoothScroll); 3842 3843 return _possibleConstructorReturn(this, (SmoothScroll.__proto__ || Object.getPrototypeOf(SmoothScroll)).apply(this, arguments)); 3844 } 3845 3846 _createClass(SmoothScroll, [{ 3847 key: '_setup', 3848 3849 /** 3850 * Creates a new instance of SmoothScroll. 3851 * @class 3852 * @name SmoothScroll 3853 * @fires SmoothScroll#init 3854 * @param {Object} element - jQuery object to add the trigger to. 3855 * @param {Object} options - Overrides to the default plugin settings. 3856 */ 3857 value: function _setup(element, options) { 3858 this.$element = element; 3859 this.options = _jquery2.default.extend({}, SmoothScroll.defaults, this.$element.data(), options); 3860 this.className = 'SmoothScroll'; // ie9 back compat 3861 3862 this._init(); 3863 } 3864 3865 /** 3866 * Initialize the SmoothScroll plugin 3867 * @private 3868 */ 3869 3870 }, { 3871 key: '_init', 3872 value: function _init() { 3873 var id = this.$element[0].id || (0, _foundationUtil.GetYoDigits)(6, 'smooth-scroll'); 3874 var _this = this; 3875 this.$element.attr({ 3876 'id': id 3877 }); 3878 3879 this._events(); 3880 } 3881 3882 /** 3883 * Initializes events for SmoothScroll. 3884 * @private 3885 */ 3886 3887 }, { 3888 key: '_events', 3889 value: function _events() { 3890 var _this = this; 3891 3892 // click handler function. 3893 var handleLinkClick = function handleLinkClick(e) { 3894 // exit function if the event source isn't coming from an anchor with href attribute starts with '#' 3895 if (!(0, _jquery2.default)(this).is('a[href^="#"]')) { 3896 return false; 3897 } 3898 3899 var arrival = this.getAttribute('href'); 3900 3901 _this._inTransition = true; 3902 3903 SmoothScroll.scrollToLoc(arrival, _this.options, function () { 3904 _this._inTransition = false; 3905 }); 3906 3907 e.preventDefault(); 3908 }; 3909 3910 this.$element.on('click.zf.smoothScroll', handleLinkClick); 3911 this.$element.on('click.zf.smoothScroll', 'a[href^="#"]', handleLinkClick); 3912 } 3913 3914 /** 3915 * Function to scroll to a given location on the page. 3916 * @param {String} loc - A properly formatted jQuery id selector. Example: '#foo' 3917 * @param {Object} options - The options to use. 3918 * @param {Function} callback - The callback function. 3919 * @static 3920 * @function 3921 */ 3922 3923 }], [{ 3924 key: 'scrollToLoc', 3925 value: function scrollToLoc(loc) { 3926 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SmoothScroll.defaults; 3927 var callback = arguments[2]; 3928 3929 // Do nothing if target does not exist to prevent errors 3930 if (!(0, _jquery2.default)(loc).length) { 3931 return false; 3932 } 3933 3934 var scrollPos = Math.round((0, _jquery2.default)(loc).offset().top - options.threshold / 2 - options.offset); 3935 3936 (0, _jquery2.default)('html, body').stop(true).animate({ scrollTop: scrollPos }, options.animationDuration, options.animationEasing, function () { 3937 if (callback && typeof callback == "function") { 3938 callback(); 3939 } 3940 }); 3941 } 3942 }]); 3943 3944 return SmoothScroll; 3945}(_foundation.Plugin); 3946 3947/** 3948 * Default settings for plugin. 3949 */ 3950 3951 3952SmoothScroll.defaults = { 3953 /** 3954 * Amount of time, in ms, the animated scrolling should take between locations. 3955 * @option 3956 * @type {number} 3957 * @default 500 3958 */ 3959 animationDuration: 500, 3960 /** 3961 * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`. 3962 * @option 3963 * @type {string} 3964 * @default 'linear' 3965 * @see {@link https://api.jquery.com/animate|Jquery animate} 3966 */ 3967 animationEasing: 'linear', 3968 /** 3969 * Number of pixels to use as a marker for location changes. 3970 * @option 3971 * @type {number} 3972 * @default 50 3973 */ 3974 threshold: 50, 3975 /** 3976 * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar. 3977 * @option 3978 * @type {number} 3979 * @default 0 3980 */ 3981 offset: 0 3982}; 3983 3984exports.SmoothScroll = SmoothScroll; 3985 3986/***/ }), 3987/* 17 */ 3988/***/ (function(module, exports, __webpack_require__) { 3989 3990"use strict"; 3991 3992 3993Object.defineProperty(exports, "__esModule", { 3994 value: true 3995}); 3996exports.Tabs = undefined; 3997 3998var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 3999 4000var _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; }; }(); 4001 4002var _jquery = __webpack_require__(0); 4003 4004var _jquery2 = _interopRequireDefault(_jquery); 4005 4006var _foundationUtil = __webpack_require__(3); 4007 4008var _foundationUtil2 = __webpack_require__(8); 4009 4010var _foundation = __webpack_require__(2); 4011 4012function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4013 4014function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4015 4016function _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; } 4017 4018function _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
4018onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 4019 4020/** 4021 * Tabs module. 4022 * @module foundation.tabs 4023 * @requires foundation.util.keyboard 4024 * @requires foundation.util.imageLoader if tabs contain images 4025 */ 4026 4027var Tabs = function (_Plugin) { 4028 _inherits(Tabs, _Plugin); 4029 4030 function Tabs() { 4031 _classCallCheck(this, Tabs); 4032 4033 return _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).apply(this, arguments)); 4034 } 4035 4036 _createClass(Tabs, [{ 4037 key: '_setup', 4038 4039 /** 4040 * Creates a new instance of tabs. 4041 * @class 4042 * @name Tabs 4043 * @fires Tabs#init 4044 * @param {jQuery} element - jQuery object to make into tabs. 4045 * @param {Object} options - Overrides to the default plugin settings. 4046 */ 4047 value: function _setup(element, options) { 4048 this.$element = element; 4049 this.options = _jquery2.default.extend({}, Tabs.defaults, this.$element.data(), options); 4050 this.className = 'Tabs'; // ie9 back compat 4051 4052 this._init(); 4053 _foundationUtil.Keyboard.register('Tabs', { 4054 'ENTER': 'open', 4055 'SPACE': 'open', 4056 'ARROW_RIGHT': 'next', 4057 'ARROW_UP': 'previous', 4058 'ARROW_DOWN': 'next', 4059 'ARROW_LEFT': 'previous' 4060 // 'TAB': 'next', 4061 // 'SHIFT_TAB': 'previous' 4062 }); 4063 } 4064 4065 /** 4066 * Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab. 4067 * @private 4068 */ 4069 4070 }, { 4071 key: '_init', 4072 value: function _init() { 4073 var _this3 = this; 4074 4075 var _this = this; 4076 4077 this.$element.attr({ 'role': 'tablist' }); 4078 this.$tabTitles = this.$element.find('.' + this.options.linkClass); 4079 this.$tabContent = (0, _jquery2.default)('[data-tabs-content="' + this.$element[0].id + '"]'); 4080 4081 this.$tabTitles.each(function () { 4082 var $elem = (0, _jquery2.default)(this), 4083 $link = $elem.find('a'), 4084 isActive = $elem.hasClass('' + _this.options.linkActiveClass), 4085 hash = $link.attr('data-tabs-target') || $link[0].hash.slice(1), 4086 linkId = $link[0].id ? $link[0].id : hash + '-label', 4087 $tabContent = (0, _jquery2.default)('#' + hash); 4088 4089 $elem.attr({ 'role': 'presentation' }); 4090 4091 $link.attr({ 4092 'role': 'tab', 4093 'aria-controls': hash, 4094 'aria-selected': isActive, 4095 'id': linkId, 4096 'tabindex': isActive ? '0' : '-1' 4097 }); 4098 4099 $tabContent.attr({ 4100 'role': 'tabpanel', 4101 'aria-labelledby': linkId 4102 }); 4103 4104 if (!isActive) { 4105 $tabContent.attr('aria-hidden', 'true'); 4106 } 4107 4108 if (isActive && _this.options.autoFocus) { 4109 (0, _jquery2.default)(window).load(function () { 4110 (0, _jquery2.default)('html, body').animate({ scrollTop: $elem.offset().top }, _this.options.deepLinkSmudgeDelay, function () { 4111 $link.focus(); 4112 }); 4113 }); 4114 } 4115 }); 4116 if (this.options.matchHeight) { 4117 var $images = this.$tabContent.find('img'); 4118 4119 if ($images.length) { 4120 (0, _foundationUtil2.onImagesLoaded)($images, this._setHeight.bind(this)); 4121 } else { 4122 this._setHeight(); 4123 } 4124 } 4125 4126 //current context-bound function to open tabs on page load or history popstate 4127 this._checkDeepLink = function () { 4128 var anchor = window.location.hash; 4129 //need a hash and a relevant anchor in this tabset 4130 if (anchor.length) { 4131 var $link = _this3.$element.find('[href$="' + anchor + '"]'); 4132 if ($link.length) { 4133 _this3.selectTab((0, _jquery2.default)(anchor), true); 4134 4135 //roll up a little to show the titles 4136 if (_this3.options.deepLinkSmudge) { 4137 var offset = _this3.$element.offset(); 4138 (0, _jquery2.default)('html, body').animate({ scrollTop: offset.top }, _this3.options.deepLinkSmudgeDelay); 4139 } 4140 4141 /** 4142 * Fires when the zplugin has deeplinked at pageload 4143 * @event Tabs#deeplink 4144 */ 4145 _this3.$element.trigger('deeplink.zf.tabs', [$link, (0, _jquery2.default)(anchor)]); 4146 } 4147 } 4148 }; 4149 4150 //use browser to open a tab, if it exists in this tabset 4151 if (this.options.deepLink) { 4152 this._checkDeepLink(); 4153 } 4154 4155 this._events(); 4156 } 4157 4158 /** 4159 * Adds event handlers for items within the tabs. 4160 * @private 4161 */ 4162 4163 }, { 4164 key: '_events', 4165 value: function _events() { 4166 this._addKeyHandler(); 4167 this._addClickHandler(); 4168 this._setHeightMqHandler = null; 4169 4170 if (this.options.matchHeight) { 4171 this._setHeightMqHandler = this._setHeight.bind(this); 4172 4173 (0, _jquery2.default)(window).on('changed.zf.mediaquery', this._setHeightMqHandler); 4174 } 4175 4176 if (this.options.deepLink) { 4177 (0, _jquery2.default)(window).on('popstate', this._checkDeepLink); 4178 } 4179 } 4180 4181 /** 4182 * Adds click handlers for items within the tabs. 4183 * @private 4184 */ 4185 4186 }, { 4187 key: '_addClickHandler', 4188 value: function _addClickHandler() { 4189 var _this = this; 4190 4191 this.$element.off('click.zf.tabs').on('click.zf.tabs', '.' + this.options.linkClass, function (e) { 4192 e.preventDefault(); 4193 e.stopPropagation(); 4194 _this._handleTabChange((0, _jquery2.default)(this)); 4195 }); 4196 } 4197 4198 /** 4199 * Adds keyboard event handlers for items within the tabs. 4200 * @private 4201 */ 4202 4203 }, { 4204 key: '_addKeyHandler', 4205 value: function _addKeyHandler() { 4206 var _this = this; 4207 4208 this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function (e) { 4209 if (e.which === 9) return; 4210 4211 var $element = (0, _jquery2.default)(this), 4212 $elements = $element.parent('ul').children('li'), 4213 $prevElement, 4214 $nextElement; 4215 4216 $elements.each(function (i) { 4217 if ((0, _jquery2.default)(this).is($element)) { 4218 if (_this.options.wrapOnKeys) {
4219 $prevElement = i === 0 ? $elements.last() : $elements.eq(i - 1); 4220 $nextElement = i === $elements.length - 1 ? $elements.first() : $elements.eq(i + 1); 4221 } else { 4222 $prevElement = $elements.eq(Math.max(0, i - 1)); 4223 $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)); 4224 } 4225 return; 4226 } 4227 }); 4228 4229 // handle keyboard event with keyboard util 4230 _foundationUtil.Keyboard.handleKey(e, 'Tabs', { 4231 open: function open() { 4232 $element.find('[role="tab"]').focus(); 4233 _this._handleTabChange($element); 4234 }, 4235 previous: function previous() { 4236 $prevElement.find('[role="tab"]').focus(); 4237 _this._handleTabChange($prevElement); 4238 }, 4239 next: function next() { 4240 $nextElement.find('[role="tab"]').focus(); 4241 _this._handleTabChange($nextElement); 4242 }, 4243 handled: function handled() { 4244 e.stopPropagation(); 4245 e.preventDefault(); 4246 } 4247 }); 4248 }); 4249 } 4250 4251 /** 4252 * Opens the tab `$targetContent` defined by `$target`. Collapses active tab. 4253 * @param {jQuery} $target - Tab to open. 4254 * @param {boolean} historyHandled - browser has already handled a history update 4255 * @fires Tabs#change 4256 * @function 4257 */ 4258 4259 }, { 4260 key: '_handleTabChange', 4261 value: function _handleTabChange($target, historyHandled) { 4262 4263 /** 4264 * Check for active class on target. Collapse if exists. 4265 */ 4266 if ($target.hasClass('' + this.options.linkActiveClass)) { 4267 if (this.options.activeCollapse) { 4268 this._collapseTab($target); 4269 4270 /** 4271 * Fires when the zplugin has successfully collapsed tabs. 4272 * @event Tabs#collapse 4273 */ 4274 this.$element.trigger('collapse.zf.tabs', [$target]); 4275 } 4276 return; 4277 } 4278 4279 var $oldTab = this.$element.find('.' + this.options.linkClass + '.' + this.options.linkActiveClass), 4280 $tabLink = $target.find('[role="tab"]'), 4281 hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1), 4282 $targetContent = this.$tabContent.find('#' + hash); 4283 4284 //close old tab 4285 this._collapseTab($oldTab); 4286 4287 //open new tab 4288 this._openTab($target); 4289 4290 //either replace or update browser history 4291 if (this.options.deepLink && !historyHandled) { 4292 var anchor = $target.find('a').attr('href'); 4293 4294 if (this.options.updateHistory) { 4295 history.pushState({}, '', anchor); 4296 } else { 4297 history.replaceState({}, '', anchor); 4298 } 4299 } 4300 4301 /** 4302 * Fires when the plugin has successfully changed tabs. 4303 * @event Tabs#change 4304 */ 4305 this.$element.trigger('change.zf.tabs', [$target, $targetContent]); 4306 4307 //fire to children a mutation event 4308 $targetContent.find("[data-mutate]").trigger("mutateme.zf.trigger"); 4309 } 4310 4311 /** 4312 * Opens the tab `$targetContent` defined by `$target`. 4313 * @param {jQuery} $target - Tab to Open. 4314 * @function 4315 */ 4316 4317 }, { 4318 key: '_openTab', 4319 value: function _openTab($target) { 4320 var $tabLink = $target.find('[role="tab"]'), 4321 hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1), 4322 $targetContent = this.$tabContent.find('#' + hash); 4323 4324 $target.addClass('' + this.options.linkActiveClass); 4325 4326 $tabLink.attr({ 4327 'aria-selected': 'true', 4328 'tabindex': '0' 4329 }); 4330 4331 $targetContent.addClass('' + this.options.panelActiveClass).removeAttr('aria-hidden'); 4332 } 4333 4334 /** 4335 * Collapses `$targetContent` defined by `$target`. 4336 * @param {jQuery} $target - Tab to Open. 4337 * @function 4338 */ 4339 4340 }, { 4341 key: '_collapseTab', 4342 value: function _collapseTab($target) { 4343 var $target_anchor = $target.removeClass('' + this.options.linkActiveClass).find('[role="tab"]').attr({ 4344 'aria-selected': 'false', 4345 'tabindex': -1 4346 }); 4347 4348 (0, _jquery2.default)('#' + $target_anchor.attr('aria-controls')).removeClass('' + this.options.panelActiveClass).attr({ 'aria-hidden': 'true' }); 4349 } 4350 4351 /** 4352 * Public method for selecting a content pane to display. 4353 * @param {jQuery | String} elem - jQuery object or string of the id of the pane to display. 4354 * @param {boolean} historyHandled - browser has already handled a history update 4355 * @function 4356 */ 4357 4358 }, { 4359 key: 'selectTab', 4360 value: function selectTab(elem, historyHandled) { 4361 var idStr; 4362 4363 if ((typeof elem === 'undefined' ? 'undefined' : _typeof(elem)) === 'object') { 4364 idStr = elem[0].id; 4365 } else { 4366 idStr = elem; 4367 } 4368 4369 if (idStr.indexOf('#') < 0) { 4370 idStr = '#' + idStr; 4371 } 4372 4373 var $target = this.$tabTitles.find('[href$="' + idStr + '"]').parent('.' + this.options.linkClass); 4374 4375 this._handleTabChange($target, historyHandled); 4376 } 4377 }, { 4378 key: '_setHeight', 4379 4380 /** 4381 * Sets the height of each panel to the height of the tallest panel. 4382 * If enabled in options, gets called on media query change. 4383 * If loading content via external source, can be called directly or with _reflow. 4384 * If enabled with `data-match-height="true"`, tabs sets to equal height 4385 * @function 4386 * @private 4387 */ 4388 value: function _setHeight() { 4389 var max = 0, 4390 _this = this; // Lock down the `this` value for the root tabs object 4391 4392 this.$tabContent.find('.' + this.options.panelClass).css('height', '').each(function () { 4393 4394 var panel = (0, _jquery2.default)(this), 4395 isActive = panel.hasClass('' + _this.options.panelActiveClass); // get the options from the parent instead of trying to get them from the child 4396 4397 if (!isActive) { 4398 panel.css({ 'visibility': 'hidden', 'display': 'block' }); 4399 } 4400 4401 var temp = this.getBoundingClientRect().height; 4402 4403 if (!isActive) { 4404 panel.css({ 4405 'visibility': '', 4406 'display': '' 4407 }); 4408 } 4409 4410 max = temp > max ? temp : max; 4411 }).css('height', max + 'px'); 4412 } 4413 4414 /** 4415 * Destroys an instance of an tabs. 4416 * @fires Tabs#destroyed 4417 */ 4418 4419 }, { 4420 key: '_destroy', 4421 value: function _destroy() { 4422 this.$element.find('.' + this.options.linkClass).off('.zf.tabs').hide().end().find('.' + this.options.panelClass).hide(); 4423 4424 if (this.options.matchHeight) { 4425 if (this._setHeightMqHandler != null) { 4426 (0, _jquery2.default)(window).off('changed.zf.mediaquery', this._setHeightMqHandler); 4427 } 4428 } 4429 4430 if (this.options.deepLink) { 4431 (0, _jquery2.default)(window).off('popstate', this._checkDeepLink); 4432 } 4433 } 4434 }]); 4435 4436 return Tabs; 4437}
4437(_foundation.Plugin); 4438 4439Tabs.defaults = { 4440 /** 4441 * Allows the window to scroll to content of pane specified by hash anchor 4442 * @option 4443 * @type {boolean} 4444 * @default false 4445 */ 4446 deepLink: false, 4447 4448 /** 4449 * Adjust the deep link scroll to make sure the top of the tab panel is visible 4450 * @option 4451 * @type {boolean} 4452 * @default false 4453 */ 4454 deepLinkSmudge: false, 4455 4456 /** 4457 * Animation time (ms) for the deep link adjustment 4458 * @option 4459 * @type {number} 4460 * @default 300 4461 */ 4462 deepLinkSmudgeDelay: 300, 4463 4464 /** 4465 * Update the browser history with the open tab 4466 * @option 4467 * @type {boolean} 4468 * @default false 4469 */ 4470 updateHistory: false, 4471 4472 /** 4473 * Allows the window to scroll to content of active pane on load if set to true. 4474 * Not recommended if more than one tab panel per page. 4475 * @option 4476 * @type {boolean} 4477 * @default false 4478 */ 4479 autoFocus: false, 4480 4481 /** 4482 * Allows keyboard input to 'wrap' around the tab links. 4483 * @option 4484 * @type {boolean} 4485 * @default true 4486 */ 4487 wrapOnKeys: true, 4488 4489 /** 4490 * Allows the tab content panes to match heights if set to true. 4491 * @option 4492 * @type {boolean} 4493 * @default false 4494 */ 4495 matchHeight: false, 4496 4497 /** 4498 * Allows active tabs to collapse when clicked. 4499 * @option 4500 * @type {boolean} 4501 * @default false 4502 */ 4503 activeCollapse: false, 4504 4505 /** 4506 * Class applied to `li`'s in tab link list. 4507 * @option 4508 * @type {string} 4509 * @default 'tabs-title' 4510 */ 4511 linkClass: 'tabs-title', 4512 4513 /** 4514 * Class applied to the active `li` in tab link list. 4515 * @option 4516 * @type {string} 4517 * @default 'is-active' 4518 */ 4519 linkActiveClass: 'is-active', 4520 4521 /** 4522 * Class applied to the content containers. 4523 * @option 4524 * @type {string} 4525 * @default 'tabs-panel' 4526 */ 4527 panelClass: 'tabs-panel', 4528 4529 /** 4530 * Class applied to the active content container. 4531 * @option 4532 * @type {string} 4533 * @default 'is-active' 4534 */ 4535 panelActiveClass: 'is-active' 4536}; 4537 4538exports.Tabs = Tabs; 4539 4540/***/ }), 4541/* 18 */ 4542/***/ (function(module, exports, __webpack_require__) { 4543 4544"use strict"; 4545 4546 4547Object.defineProperty(exports, "__esModule", { 4548 value: true 4549}); 4550exports.Timer = undefined; 4551 4552var _jquery = __webpack_require__(0); 4553 4554var _jquery2 = _interopRequireDefault(_jquery); 4555 4556function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4557 4558function Timer(elem, options, cb) { 4559 var _this = this, 4560 duration = options.duration, 4561 //options is an object for easily adding features later. 4562 nameSpace = Object.keys(elem.data())[0] || 'timer', 4563 remain = -1, 4564 start, 4565 timer; 4566 4567 this.isPaused = false; 4568 4569 this.restart = function () { 4570 remain = -1; 4571 clearTimeout(timer); 4572 this.start(); 4573 }; 4574 4575 this.start = function () { 4576 this.isPaused = false; 4577 // if(!elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 4578 clearTimeout(timer); 4579 remain = remain <= 0 ? duration : remain; 4580 elem.data('paused', false); 4581 start = Date.now(); 4582 timer = setTimeout(function () { 4583 if (options.infinite) { 4584 _this.restart(); //rerun the timer. 4585 } 4586 if (cb && typeof cb === 'function') { 4587 cb(); 4588 } 4589 }, remain); 4590 elem.trigger('timerstart.zf.' + nameSpace); 4591 }; 4592 4593 this.pause = function () { 4594 this.isPaused = true; 4595 //if(elem.data('paused')){ return false; }//maybe implement this sanity check if used for other things. 4596 clearTimeout(timer); 4597 elem.data('paused', true); 4598 var end = Date.now(); 4599 remain = remain - (end - start); 4600 elem.trigger('timerpaused.zf.' + nameSpace); 4601 }; 4602} 4603 4604exports.Timer = Timer; 4605 4606/***/ }), 4607/* 19 */ 4608/***/ (function(module, exports, __webpack_require__) { 4609 4610"use strict"; 4611 4612 4613var _jquery = __webpack_require__(0); 4614 4615var _jquery2 = _interopRequireDefault(_jquery); 4616 4617var _whatInput = __webpack_require__(38); 4618 4619var _whatInput2 = _interopRequireDefault(_whatInput); 4620 4621var _foundationSites = __webpack_require__(20); 4622 4623var _foundationSites2 = _interopRequireDefault(_foundationSites); 4624 4625__webpack_require__(39); 4626 4627function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4628 4629window.$ = _jquery2.default; 4630// If you want to pick and choose which modules to include, comment out the above and uncomment 4631// the line below
4632//import './lib/foundation-explicit-pieces'; 4633 4634(0, _jquery2.default)(document).foundation(); 4635 4636/***/ }), 4637/* 20 */ 4638/***/ (function(module, exports, __webpack_require__) { 4639 4640"use strict"; 4641 4642 4643Object.defineProperty(exports, "__esModule", { 4644 value: true 4645}); 4646 4647var _jquery = __webpack_require__(0); 4648 4649var _jquery2 = _interopRequireDefault(_jquery); 4650 4651var _foundation = __webpack_require__(22); 4652 4653var _foundationUtil = __webpack_require__(1); 4654 4655var _foundationUtil2 = __webpack_require__(7); 4656 4657var _foundationUtil3 = __webpack_require__(8); 4658 4659var _foundationUtil4 = __webpack_require__(3); 4660 4661var _foundationUtil5 = __webpack_require__(4); 4662 4663var _foundationUtil6 = __webpack_require__(6); 4664 4665var _foundationUtil7 = __webpack_require__(9); 4666 4667var _foundationUtil8 = __webpack_require__(18); 4668 4669var _foundationUtil9 = __webpack_require__(10); 4670 4671var _foundationUtil10 = __webpack_require__(5); 4672 4673var _foundation2 = __webpack_require__(21); 4674 4675var _foundation3 = __webpack_require__(11); 4676 4677var _foundation4 = __webpack_require__(12); 4678 4679var _foundation5 = __webpack_require__(13); 4680 4681var _foundation6 = __webpack_require__(23); 4682 4683var _foundation7 = __webpack_require__(14); 4684 4685var _foundation8 = __webpack_require__(24); 4686 4687var _foundation9 = __webpack_require__(25); 4688 4689var _foundation10 = __webpack_require__(26); 4690 4691var _foundation11 = __webpack_require__(27); 4692 4693var _foundation12 = __webpack_require__(28); 4694 4695var _foundation13 = __webpack_require__(30); 4696 4697var _foundation14 = __webpack_require__(31); 4698 4699var _foundation15 = __webpack_require__(32); 4700 4701var _foundation16 = __webpack_require__(33); 4702 4703var _foundation17 = __webpack_require__(16); 4704 4705var _foundation18 = __webpack_require__(34); 4706 4707var _foundation19 = __webpack_require__(17); 4708 4709var _foundation20 = __webpack_require__(35); 4710 4711var _foundation21 = __webpack_require__(36); 4712 4713var _foundation22 = __webpack_require__(29); 4714 4715function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4716 4717_foundation.Foundation.addToJquery(_jquery2.default); 4718 4719// Add Foundation Utils to Foundation global namespace for backwards 4720// compatibility. 4721 4722_foundation.Foundation.rtl = _foundationUtil.rtl; 4723_foundation.Foundation.GetYoDigits = _foundationUtil.GetYoDigits; 4724_foundation.Foundation.transitionend = _foundationUtil.transitionend; 4725 4726_foundation.Foundation.Box = _foundationUtil2.Box; 4727_foundation.Foundation.onImagesLoaded = _foundationUtil3.onImagesLoaded; 4728_foundation.Foundation.Keyboard = _foundationUtil4.Keyboard; 4729_foundation.Foundation.MediaQuery = _foundationUtil5.MediaQuery; 4730_foundation.Foundation.Motion = _foundationUtil6.Motion; 4731_foundation.Foundation.Move = _foundationUtil6.Move; 4732_foundation.Foundation.Nest = _foundationUtil7.Nest; 4733_foundation.Foundation.Timer = _foundationUtil8.Timer; 4734 4735// Touch and Triggers previously were almost purely sede effect driven, 4736// so n../../js// need to add it to Foundation, just init them. 4737
4738_foundationUtil9.Touch.init(_jquery2.default); 4739 4740_foundationUtil10.Triggers.init(_jquery2.default, _foundation.Foundation); 4741 4742_foundation.Foundation.plugin(_foundation2.Abide, 'Abide'); 4743 4744_foundation.Foundation.plugin(_foundation3.Accordion, 'Accordion'); 4745 4746_foundation.Foundation.plugin(_foundation4.AccordionMenu, 'AccordionMenu'); 4747 4748_foundation.Foundation.plugin(_foundation5.Drilldown, 'Drilldown'); 4749 4750_foundation.Foundation.plugin(_foundation6.Dropdown, 'Dropdown'); 4751 4752_foundation.Foundation.plugin(_foundation7.DropdownMenu, 'DropdownMenu'); 4753 4754_foundation.Foundation.plugin(_foundation8.Equalizer, 'Equalizer'); 4755 4756_foundation.Foundation.plugin(_foundation9.Interchange, 'Interchange'); 4757 4758_foundation.Foundation.plugin(_foundation10.Magellan, 'Magellan'); 4759 4760_foundation.Foundation.plugin(_foundation11.OffCanvas, 'OffCanvas'); 4761 4762_foundation.Foundation.plugin(_foundation12.Orbit, 'Orbit'); 4763 4764_foundation.Foundation.plugin(_foundation13.ResponsiveMenu, 'ResponsiveMenu'); 4765 4766_foundation.Foundation.plugin(_foundation14.ResponsiveToggle, 'ResponsiveToggle'); 4767 4768_foundation.Foundation.plugin(_foundation15.Reveal, 'Reveal'); 4769 4770_foundation.Foundation.plugin(_foundation16.Slider, 'Slider'); 4771 4772_foundation.Foundation.plugin(_foundation17.SmoothScroll, 'SmoothScroll'); 4773
4774_foundation.Foundation.plugin(_foundation18.Sticky, 'Sticky'); 4775 4776_foundation.Foundation.plugin(_foundation19.Tabs, 'Tabs'); 4777 4778_foundation.Foundation.plugin(_foundation20.Toggler, 'Toggler'); 4779 4780_foundation.Foundation.plugin(_foundation21.Tooltip, 'Tooltip'); 4781 4782_foundation.Foundation.plugin(_foundation22.ResponsiveAccordionTabs, 'ResponsiveAccordionTabs'); 4783 4784exports.default = _foundation.Foundation; 4785 4786/***/ }), 4787/* 21 */ 4788/***/ (function(module, exports, __webpack_require__) { 4789 4790"use strict"; 4791 4792 4793Object.defineProperty(exports, "__esModule", { 4794 value: true 4795}); 4796exports.Abide = undefined; 4797 4798var _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; }; }(); 4799 4800var _jquery = __webpack_require__(0); 4801 4802var _jquery2 = _interopRequireDefault(_jquery); 4803 4804var _foundation = __webpack_require__(2); 4805 4806function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4807 4808function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4809 4810function _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; } 4811 4812function _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; } 4813 4814/** 4815 * Abide module. 4816 * @module foundation.abide 4817 */ 4818 4819var Abide = function (_Plugin) { 4820 _inherits(Abide, _Plugin); 4821 4822 function Abide() { 4823 _classCallCheck(this, Abide); 4824 4825 return _possibleConstructorReturn(this, (Abide.__proto__ || Object.getPrototypeOf(Abide)).apply(this, arguments)); 4826 } 4827 4828 _createClass(Abide, [{ 4829 key: '_setup', 4830 4831 /** 4832 * Creates a new instance of Abide. 4833 * @class 4834 * @name Abide 4835 * @fires Abide#init 4836 * @param {Object} element - jQuery object to add the trigger to. 4837 * @param {Object} options - Overrides to the default plugin settings. 4838 */ 4839 value: function _setup(element) { 4840 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4841 4842 this.$element = element; 4843 this.options = _jquery2.default.extend({}, Abide.defaults, this.$element.data(), options); 4844 4845 this.className = 'Abide'; // ie9 back compat 4846 this._init(); 4847 } 4848 4849 /** 4850 * Initializes the Abide plugin and calls functions to get Abide functioning on load. 4851 * @private 4852 */ 4853 4854 }, { 4855 key: '_init', 4856 value: function _init() { 4857 this.$inputs = this.$element.find('input, textarea, select'); 4858 4859 this._events(); 4860 } 4861 4862 /** 4863 * Initializes events for Abide. 4864 * @private 4865 */ 4866 4867 }, { 4868 key: '_events', 4869 value: function _events() { 4870 var _this3 = this; 4871 4872 this.$element.off('.abide').on('reset.zf.abide', function () { 4873 _this3.resetForm(); 4874 }).on('submit.zf.abide', function () { 4875 return _this3.validateForm(); 4876 }); 4877 4878 if (this.options.validateOn === 'fieldChange') { 4879 this.$inputs.off('change.zf.abide').on('change.zf.abide', function (e) { 4880 _this3.validateInput((0, _jquery2.default)(e.target)); 4881 }); 4882 } 4883 4884 if (this.options.liveValidate) { 4885 this.$inputs.off('input.zf.abide').on('input.zf.abide', function (e) { 4886 _this3.validateInput((0, _jquery2.default)(e.target)); 4887 }); 4888 } 4889 4890 if (this.options.validateOnBlur) { 4891 this.$inputs.off('blur.zf.abide').on('blur.zf.abide', function (e) { 4892 _this3.validateInput((0, _jquery2.default)(e.target)); 4893 }); 4894 } 4895 } 4896 4897 /** 4898 * Calls necessary functions to update Abide upon DOM change 4899 * @private 4900 */ 4901 4902 }, { 4903 key: '_reflow', 4904 value: function _reflow() { 4905 this._init(); 4906 } 4907 4908 /** 4909 * Checks whether or not a form element has the required attribute and if it's checked or not 4910 * @param {Object} element - jQuery object to check for required attribute 4911 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 4912 */ 4913 4914 }, { 4915 key: 'requiredCheck', 4916 value: function requiredCheck($el) { 4917 if (!$el.attr('required')) return true; 4918 4919 var isGood = true; 4920 4921 switch ($el[0].type) { 4922 case 'checkbox': 4923 isGood = $el[0].checked; 4924 break; 4925 4926 case 'select': 4927 case 'select-one': 4928 case 'select-multiple': 4929 var opt = $el.find('option:selected'); 4930 if (!opt.length || !opt.val()) isGood = false;
4931 break; 4932 4933 default: 4934 if (!$el.val() || !$el.val().length) isGood = false; 4935 } 4936 4937 return isGood; 4938 } 4939 4940 /** 4941 * Get: 4942 * - Based on $el, the first element(s) corresponding to `formErrorSelector` in this order: 4943 * 1. The element's direct sibling('s). 4944 * 2. The element's parent's children. 4945 * - Element(s) with the attribute `[data-form-error-for]` set with the element's id. 4946 * 4947 * This allows for multiple form errors per input, though if none are found, no form errors will be shown. 4948 * 4949 * @param {Object} $el - jQuery object to use as reference to find the form error selector. 4950 * @returns {Object} jQuery object with the selector. 4951 */ 4952 4953 }, { 4954 key: 'findFormError', 4955 value: function findFormError($el) { 4956 var id = $el[0].id; 4957 var $error = $el.siblings(this.options.formErrorSelector); 4958 4959 if (!$error.length) { 4960 $error = $el.parent().find(this.options.formErrorSelector); 4961 } 4962 4963 $error = $error.add(this.$element.find('[data-form-error-for="' + id + '"]')); 4964 4965 return $error; 4966 } 4967 4968 /** 4969 * Get the first element in this order: 4970 * 2. The <label> with the attribute `[for="someInputId"]` 4971 * 3. The `.closest()` <label> 4972 * 4973 * @param {Object} $el - jQuery object to check for required attribute 4974 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 4975 */ 4976 4977 }, { 4978 key: 'findLabel', 4979 value: function findLabel($el) { 4980 var id = $el[0].id; 4981 var $label = this.$element.find('label[for="' + id + '"]'); 4982 4983 if (!$label.length) { 4984 return $el.closest('label'); 4985 } 4986 4987 return $label; 4988 } 4989 4990 /** 4991 * Get the set of labels associated with a set of radio els in this order 4992 * 2. The <label> with the attribute `[for="someInputId"]` 4993 * 3. The `.closest()` <label> 4994 * 4995 * @param {Object} $el - jQuery object to check for required attribute 4996 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 4997 */ 4998 4999 }, { 5000 key: 'findRadioLabels', 5001 value: function findRadioLabels($els) { 5002 var _this4 = this; 5003 5004 var labels = $els.map(function (i, el) { 5005 var id = el.id; 5006 var $label = _this4.$element.find('label[for="' + id + '"]'); 5007 5008 if (!$label.length) { 5009 $label = (0, _jquery2.default)(el).closest('label'); 5010 } 5011 return $label[0]; 5012 }); 5013 5014 return (0, _jquery2.default)(labels); 5015 } 5016 5017 /** 5018 * Adds the CSS error class as specified by the Abide settings to the label, input, and the form 5019 * @param {Object} $el - jQuery object to add the class to 5020 */ 5021 5022 }, { 5023 key: 'addErrorClasses', 5024 value: function addErrorClasses($el) { 5025 var $label = this.findLabel($el); 5026 var $formError = this.findFormError($el); 5027 5028 if ($label.length) { 5029 $label.addClass(this.options.labelErrorClass); 5030 } 5031 5032 if ($formError.length) { 5033 $formError.addClass(this.options.formErrorClass); 5034 } 5035 5036 $el.addClass(this.options.inputErrorClass).attr('data-invalid', ''); 5037 } 5038 5039 /** 5040 * Remove CSS error classes etc from an entire radio button group 5041 * @param {String} groupName - A string that specifies the name of a radio button group 5042 * 5043 */ 5044 5045 }, { 5046 key: 'removeRadioErrorClasses', 5047 value: function removeRadioErrorClasses(groupName) { 5048 var $els = this.$element.find(':radio[name="' + groupName + '"]'); 5049 var $labels = this.findRadioLabels($els); 5050 var $formErrors = this.findFormError($els); 5051 5052 if ($labels.length) { 5053 $labels.removeClass(this.options.labelErrorClass); 5054 } 5055 5056 if ($formErrors.length) { 5057 $formErrors.removeClass(this.options.formErrorClass); 5058 } 5059 5060 $els.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 5061 } 5062 5063 /** 5064 * Removes CSS error class as specified by the Abide settings from the label, input, and the form 5065 * @param {Object} $el - jQuery object to remove the class from 5066 */ 5067 5068 }, { 5069 key: 'removeErrorClasses', 5070 value: function removeErrorClasses($el) { 5071 // radios need to clear all of the els 5072 if ($el[0].type == 'radio') { 5073 return this.removeRadioErrorClasses($el.attr('name')); 5074 } 5075 5076 var $label = this.findLabel($el); 5077 var $formError = this.findFormError($el); 5078 5079 if ($label.length) { 5080 $label.removeClass(this.options.labelErrorClass); 5081 } 5082 5083 if ($formError.length) { 5084 $formError.removeClass(this.options.formErrorClass); 5085 } 5086 5087 $el.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 5088 } 5089 5090 /** 5091 * Goes through a form to find inputs and proceeds to validate them in ways specific to their type. 5092 * Ignores inputs with data-abide-ignore, type="hidden" or disabled attributes set 5093 * @fires Abide#invalid 5094 * @fires Abide#valid 5095 * @param {Object} element - jQuery object to validate, should be an HTML input 5096 * @returns {Boolean} goodToGo - If the input is valid or not. 5097 */ 5098 5099 }, { 5100 key: 'validateInput', 5101 value: function validateInput($el) { 5102 var clearRequire = this.requiredCheck($el), 5103 validated = false, 5104 customValidator = true, 5105 validator = $el.attr('data-validator'), 5106 equalTo = true; 5107
5108 // don't validate ignored inputs or hidden inputs or disabled inputs 5109 if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]') || $el.is('[disabled]')) { 5110 return true; 5111 } 5112 5113 switch ($el[0].type) { 5114 case 'radio': 5115 validated = this.validateRadio($el.attr('name')); 5116 break; 5117 5118 case 'checkbox': 5119 validated = clearRequire; 5120 break; 5121 5122 case 'select': 5123 case 'select-one': 5124 case 'select-multiple': 5125 validated = clearRequire; 5126 break; 5127 5128 default: 5129 validated = this.validateText($el); 5130 } 5131 5132 if (validator) { 5133 customValidator = this.matchValidation($el, validator, $el.attr('required')); 5134 } 5135 5136 if ($el.attr('data-equalto')) { 5137 equalTo = this.options.validators.equalTo($el); 5138 } 5139 5140 var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1; 5141 var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide'; 5142 5143 if (goodToGo) { 5144 // Re-validate inputs that depend on this one with equalto 5145 var dependentElements = this.$element.find('[data-equalto="' + $el.attr('id') + '"]'); 5146 if (dependentElements.length) { 5147 var _this = this; 5148 dependentElements.each(function () { 5149 if ((0, _jquery2.default)(this).val()) { 5150 _this.validateInput((0, _jquery2.default)(this)); 5151 } 5152 }); 5153 } 5154 } 5155 5156 this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el); 5157 5158 /** 5159 * Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide` 5160 * Trigger includes the DOM element of the input. 5161 * @event Abide#valid 5162 * @event Abide#invalid 5163 */ 5164 $el.trigger(message, [$el]); 5165 5166 return goodToGo; 5167 } 5168 5169 /** 5170 * Goes through a form and if there are any invalid inputs, it will display the form error element 5171 * @returns {Boolean} noError - true if no errors were detected... 5172 * @fires Abide#formvalid 5173 * @fires Abide#forminvalid 5174 */ 5175 5176 }, { 5177 key: 'validateForm', 5178 value: function validateForm() { 5179 var acc = []; 5180 var _this = this; 5181 5182 this.$inputs.each(function () { 5183 acc.push(_this.validateInput((0, _jquery2.default)(this))); 5184 }); 5185 5186 var noError = acc.indexOf(false) === -1; 5187 5188 this.$element.find('[data-abide-error]').css('display', noError ? 'none' : 'block'); 5189 5190 /** 5191 * Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`. 5192 * Trigger includes the element of the form. 5193 * @event Abide#formvalid 5194 * @event Abide#forminvalid 5195 */ 5196 this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]); 5197 5198 return noError; 5199 } 5200 5201 /** 5202 * 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. 5203 * @param {Object} $el - jQuery object to validate, should be a text input HTML element 5204 * @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns 5205 * @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified 5206 */ 5207 5208 }, { 5209 key: 'validateText', 5210 value: function validateText($el, pattern) { 5211 // A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute 5212 pattern = pattern || $el.attr('pattern') || $el.attr('type'); 5213 var inputText = $el.val(); 5214 var valid = false; 5215 5216 if (inputText.length) { 5217 // If the pattern attribute on the element is in Abide's list of patterns, then test that regexp 5218 if (this.options.patterns.hasOwnProperty(pattern)) { 5219 valid = this.options.patterns[pattern].test(inputText); 5220 } 5221 // If the pattern name isn't also the type attribute of the field, then test it as a regexp 5222 else if (pattern !== $el.attr('type')) { 5223 valid = new RegExp(pattern).test(inputText); 5224 } else { 5225 valid = true; 5226 } 5227 } 5228 // An empty field is valid if it's not required 5229 else if (!$el.prop('required')) { 5230 valid = true; 5231 } 5232 5233 return valid; 5234 } 5235 5236 /** 5237 * 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. 5238 * @param {String} groupName - A string that specifies the name of a radio button group 5239 * @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required) 5240 */ 5241 5242 }, { 5243 key: 'validateRadio', 5244 value: function validateRadio(groupName) { 5245 // If at least one radio in the group has the `required` attribute, the group is considered required 5246 // Per W3C spec, all radio buttons in a group should have `required`, but we're being nice 5247 var $group = this.$element.find(':radio[name="' + groupName + '"]');
5248 var valid = false, 5249 required = false; 5250 5251 // For the group to be required, at least one radio needs to be required 5252 $group.each(function (i, e) { 5253 if ((0, _jquery2.default)(e).attr('required')) { 5254 required = true; 5255 } 5256 }); 5257 if (!required) valid = true; 5258 5259 if (!valid) { 5260 // For the group to be valid, at least one radio needs to be checked 5261 $group.each(function (i, e) { 5262 if ((0, _jquery2.default)(e).prop('checked')) { 5263 valid = true; 5264 } 5265 }); 5266 }; 5267 5268 return valid; 5269 } 5270 5271 /** 5272 * 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. 5273 * @param {Object} $el - jQuery input element. 5274 * @param {String} validators - a string of function names matching functions in the Abide.options.validators object. 5275 * @param {Boolean} required - self explanatory? 5276 * @returns {Boolean} - true if validations passed. 5277 */ 5278 5279 }, { 5280 key: 'matchValidation', 5281 value: function matchValidation($el, validators, required) { 5282 var _this5 = this; 5283 5284 required = required ? true : false; 5285 5286 var clear = validators.split(' ').map(function (v) { 5287 return _this5.options.validators[v]($el, required, $el.parent()); 5288 }); 5289 return clear.indexOf(false) === -1; 5290 } 5291 5292 /** 5293 * Resets form inputs and styles 5294 * @fires Abide#formreset 5295 */ 5296 5297 }, { 5298 key: 'resetForm', 5299 value: function resetForm() { 5300 var $form = this.$element, 5301 opts = this.options; 5302 5303 (0, _jquery2.default)('.' + opts.labelErrorClass, $form).not('small').removeClass(opts.labelErrorClass); 5304 (0, _jquery2.default)('.' + opts.inputErrorClass, $form).not('small').removeClass(opts.inputErrorClass); 5305 (0, _jquery2.default)(opts.formErrorSelector + '.' + opts.formErrorClass).removeClass(opts.formErrorClass); 5306 $form.find('[data-abide-error]').css('display', 'none'); 5307 (0, _jquery2.default)(':input', $form).not(':button, :submit, :reset, :hidden, :radio, :checkbox, [data-abide-ignore]').val('').removeAttr('data-invalid'); 5308 (0, _jquery2.default)(':input:radio', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid'); 5309 (0, _jquery2.default)(':input:checkbox', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid'); 5310 /** 5311 * Fires when the form has been reset. 5312 * @event Abide#formreset 5313 */ 5314 $form.trigger('formreset.zf.abide', [$form]); 5315 } 5316 5317 /** 5318 * Destroys an instance of Abide. 5319 * Removes error styles and classes from elements, without resetting their values. 5320 */ 5321 5322 }, { 5323 key: '_destroy', 5324 value: function _destroy() { 5325 var _this = this; 5326 this.$element.off('.abide').find('[data-abide-error]').css('display', 'none'); 5327 5328 this.$inputs.off('.abide').each(function () { 5329 _this.removeErrorClasses((0, _jquery2.default)(this)); 5330 }); 5331 } 5332 }]); 5333 5334 return Abide; 5335}(_foundation.Plugin); 5336 5337/** 5338 * Default settings for plugin 5339 */ 5340 5341 5342Abide.defaults = { 5343 /** 5344 * The default event to validate inputs. Checkboxes and radios validate immediately. 5345 * Remove or change this value for manual validation. 5346 * @option 5347 * @type {?string} 5348 * @default 'fieldChange' 5349 */ 5350 validateOn: 'fieldChange', 5351 5352 /** 5353 * Class to be applied to input labels on failed validation. 5354 * @option 5355 * @type {string} 5356 * @default 'is-invalid-label' 5357 */ 5358 labelErrorClass: 'is-invalid-label', 5359 5360 /** 5361 * Class to be applied to inputs on failed validation. 5362 * @option 5363 * @type {string} 5364 * @default 'is-invalid-input' 5365 */ 5366 inputErrorClass: 'is-invalid-input', 5367 5368 /** 5369 * Class selector to use to target Form Errors for show/hide. 5370 * @option 5371 * @type {string} 5372 * @default '.form-error' 5373 */ 5374 formErrorSelector: '.form-error', 5375 5376 /** 5377 * Class added to Form Errors on failed validation. 5378 * @option 5379 * @type {string} 5380 * @default 'is-visible' 5381 */ 5382 formErrorClass: 'is-visible', 5383 5384 /** 5385 * Set to true to validate text inputs on any value change. 5386 * @option 5387 * @type {boolean} 5388 * @default false 5389 */ 5390 liveValidate: false, 5391 5392 /** 5393 * Set to true to validate inputs on blur. 5394 * @option 5395 * @type {boolean} 5396 * @default false 5397 */ 5398 validateOnBlur: false, 5399 5400 patterns: {
5401 alpha: /^[a-zA-Z]+$/, 5402 alpha_numeric: /^[a-zA-Z0-9]+$/, 5403 integer: /^[-+]?\d+$/, 5404 number: /^[-+]?\d*(?:[\.\,]\d+)?$/, 5405 5406 // amex, visa, diners 5407 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})$/, 5408 cvv: /^([0-9]){3,4}$/, 5409 5410 // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address 5411 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])?)+$/, 5412 5413 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})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, 5414 // abc.de 5415 domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/, 5416 5417 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))$/, 5418 // YYYY-MM-DD 5419 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))$/, 5420 // HH:MM:SS 5421 time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/, 5422 dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, 5423 // MM/DD/YYYY 5424 month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/, 5425 // DD/MM/YYYY 5426 day_month_year: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/, 5427 5428 // #FFF or #FFFFFF 5429 color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/, 5430 5431 // Domain || URL 5432 website: { 5433 test: function test(text) { 5434 return Abide.defaults.patterns['domain'].test(text) || Abide.defaults.patterns['url'].test(text); 5435 } 5436 } 5437 }, 5438 5439 /** 5440 * Optional validation functions to be used. `equalTo` being the only default included function. 5441 * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments: 5442 * el : The jQuery element to validate. 5443 * required : Boolean value of the required attribute be present or not. 5444 * parent : The direct parent of the input. 5445 * @option 5446 */ 5447 validators: { 5448 equalTo: function equalTo(el, required, parent) { 5449 return (0, _jquery2.default)('#' + el.attr('data-equalto')).val() === el.val(); 5450 } 5451 } 5452}; 5453 5454exports.Abide = Abide; 5455 5456/***/ }), 5457/* 22 */ 5458/***/ (function(module, exports, __webpack_require__) { 5459 5460"use strict"; 5461 5462 5463Object.defineProperty(exports, "__esModule", { 5464 value: true 5465}); 5466exports.Foundation = undefined; 5467 5468var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 5469 5470var _jquery = __webpack_require__(0); 5471 5472var _jquery2 = _interopRequireDefault(_jquery); 5473 5474var _foundationUtil = __webpack_require__(1); 5475 5476var _foundationUtil2 = __webpack_require__(4); 5477 5478function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 5479 5480var FOUNDATION_VERSION = '6.4.1'; 5481 5482// Global Foundation object 5483// This is attached to the window, or used as a module for AMD/Browserify 5484var Foundation = { 5485 version: FOUNDATION_VERSION, 5486 5487 /** 5488 * Stores initialized plugins. 5489 */ 5490 _plugins: {}, 5491 5492 /** 5493 * Stores generated unique ids for plugin instances 5494 */ 5495 _uuids: [], 5496 5497 /** 5498 * Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing. 5499 * @param {Object} plugin - The constructor of the plugin. 5500 */ 5501 plugin: function plugin(_plugin, name) { 5502 // Object key to use when adding to global Foundation object 5503 // Examples: Foundation.Reveal, Foundation.OffCanvas 5504 var className = name || functionName(_plugin); 5505 // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin 5506 // Examples: data-reveal, data-off-canvas 5507 var attrName = hyphenate(className); 5508 5509 // Add to the Foundation object and the plugins list (for reflowing) 5510 this._plugins[attrName] = this[className] = _plugin; 5511 }, 5512 /** 5513 * @function 5514 * Populates the _uuids array with pointers to each individual plugin instance. 5515 * Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls. 5516 * Also fires the initialization event for each plugin, consolidating repetitive code. 5517 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 5518 * @param {String} name - the name of the plugin, passed as a camelCased string. 5519 * @fires Plugin#init 5520 */ 5521 registerPlugin: function registerPlugin(plugin, name) { 5522 var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase(); 5523 plugin.uuid = (0, _foundationUtil.GetYoDigits)(6, pluginName); 5524 5525 if (!plugin.$element.attr('data-' + pluginName)) { 5526 plugin.$element.attr('data-' + pluginName, plugin.uuid); 5527 } 5528 if (!plugin.$element.data('zfPlugin')) { 5529 plugin.$element.data('zfPlugin', plugin); 5530 } 5531 /** 5532 * Fires when the plugin has initialized. 5533 * @event Plugin#init 5534 */ 5535 plugin.$element.trigger('init.zf.' + pluginName); 5536 5537 this._uuids.push(plugin.uuid); 5538 5539 return; 5540 }, 5541 /** 5542 * @function 5543 * Removes the plugins uuid from the _uuids array.
5544 * Removes the zfPlugin data attribute, as well as the data-plugin-name attribute. 5545 * Also fires the destroyed event for the plugin, consolidating repetitive code. 5546 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 5547 * @fires Plugin#destroyed 5548 */ 5549 unregisterPlugin: function unregisterPlugin(plugin) { 5550 var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor)); 5551 5552 this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1); 5553 plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin') 5554 /** 5555 * Fires when the plugin has been destroyed. 5556 * @event Plugin#destroyed 5557 */ 5558 .trigger('destroyed.zf.' + pluginName); 5559 for (var prop in plugin) { 5560 plugin[prop] = null; //clean up script to prep for garbage collection. 5561 } 5562 return; 5563 }, 5564 5565 /** 5566 * @function 5567 * Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc. 5568 * @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'` 5569 * @default If no argument is passed, reflow all currently active plugins. 5570 */ 5571 reInit: function reInit(plugins) { 5572 var isJQ = plugins instanceof _jquery2.default; 5573 try { 5574 if (isJQ) { 5575 plugins.each(function () { 5576 (0, _jquery2.default)(this).data('zfPlugin')._init(); 5577 }); 5578 } else { 5579 var type = typeof plugins === 'undefined' ? 'undefined' : _typeof(plugins), 5580 _this = this, 5581 fns = { 5582 'object': function object(plgs) { 5583 plgs.forEach(function (p) { 5584 p = hyphenate(p); 5585 (0, _jquery2.default)('[data-' + p + ']').foundation('_init'); 5586 }); 5587 }, 5588 'string': function string() { 5589 plugins = hyphenate(plugins); 5590 (0, _jquery2.default)('[data-' + plugins + ']').foundation('_init'); 5591 }, 5592 'undefined': function undefined() { 5593 this['object'](Object.keys(_this._plugins)); 5594 } 5595 }; 5596 fns[type](plugins); 5597 } 5598 } catch (err) { 5599 console.error(err); 5600 } finally { 5601 return plugins; 5602 } 5603 }, 5604 5605 /** 5606 * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized. 5607 * @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object. 5608 * @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything. 5609 */ 5610 reflow: function reflow(elem, plugins) { 5611 5612 // If plugins is undefined, just grab everything 5613 if (typeof plugins === 'undefined') { 5614 plugins = Object.keys(this._plugins); 5615 } 5616 // If plugins is a string, convert it to an array with one item 5617 else if (typeof plugins === 'string') { 5618 plugins = [plugins]; 5619 } 5620 5621 var _this = this; 5622 5623 // Iterate through each plugin 5624 _jquery2.default.each(plugins, function (i, name) { 5625 // Get the current plugin 5626 var plugin = _this._plugins[name]; 5627 5628 // Localize the search to all elements inside elem, as well as elem itself, unless elem === document 5629 var $elem = (0, _jquery2.default)(elem).find('[data-' + name + ']').addBack('[data-' + name + ']'); 5630 5631 // For each plugin found, initialize it 5632 $elem.each(function () { 5633 var $el = (0, _jquery2.default)(this), 5634 opts = {}; 5635 // Don't double-dip on plugins 5636 if ($el.data('zfPlugin')) { 5637 console.warn("Tried to initialize " + name + " on an element that already has a Foundation plugin."); 5638 return; 5639 } 5640 5641 if ($el.attr('data-options')) { 5642 var thing = $el.attr('data-options').split(';').forEach(function (e, i) { 5643 var opt = e.split(':').map(function (el) { 5644 return el.trim(); 5645 }); 5646 if (opt[0]) opts[opt[0]] = parseValue(opt[1]); 5647 }); 5648 } 5649 try { 5650 $el.data('zfPlugin', new plugin((0, _jquery2.default)(this), opts)); 5651 } catch (er) { 5652 console.error(er); 5653 } finally { 5654 return; 5655 } 5656 }); 5657 }); 5658 }, 5659 getFnName: functionName, 5660 5661 addToJquery: function addToJquery($) { 5662 // TODO: consider not making this a jQuery function 5663 // TODO: need way to reflow vs. re-initialize 5664 /** 5665 * The Foundation jQuery method. 5666 * @param {String|Array} method - An action to perform on the current jQuery object. 5667 */ 5668 var foundation = function foundation(method) { 5669 var type = typeof method === 'undefined' ? 'undefined' : _typeof(method), 5670 $noJS = $('.no-js'); 5671 5672 if ($noJS.length) { 5673 $noJS.removeClass('no-js'); 5674 } 5675 5676 if (type === 'undefined') { 5677 //needs to initialize the Foundation object, or an individual plugin. 5678 _foundationUtil2.MediaQuery._init(); 5679 Foundation.reflow(this); 5680 } else if (type === 'string') { 5681 //an individual method to invoke on a plugin or group of plugins 5682 var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary 5683 var plugClass = this.data('zfPlugin'); //determine the class of plugin 5684 5685 if (plugClass !== undefined && plugClass[method] !== undefined) { 5686 //make sure both the class and method exist 5687 if (this.length === 1) { 5688 //if there's only one, call it directly.
5689 plugClass[method].apply(plugClass, args); 5690 } else { 5691 this.each(function (i, el) { 5692 //otherwise loop through the jQuery collection and invoke the method on each 5693 plugClass[method].apply($(el).data('zfPlugin'), args); 5694 }); 5695 } 5696 } else { 5697 //error for no class or no method 5698 throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.'); 5699 } 5700 } else { 5701 //error for invalid argument type 5702 throw new TypeError('We\'re sorry, ' + type + ' is not a valid parameter. You must use a string representing the method you wish to invoke.'); 5703 } 5704 return this; 5705 }; 5706 $.fn.foundation = foundation; 5707 return $; 5708 } 5709}; 5710 5711Foundation.util = { 5712 /** 5713 * Function for applying a debounce effect to a function call. 5714 * @function 5715 * @param {Function} func - Function to be called at end of timeout. 5716 * @param {Number} delay - Time in ms to delay the call of `func`. 5717 * @returns function 5718 */ 5719 throttle: function throttle(func, delay) { 5720 var timer = null; 5721 5722 return function () { 5723 var context = this, 5724 args = arguments; 5725 5726 if (timer === null) { 5727 timer = setTimeout(function () { 5728 func.apply(context, args); 5729 timer = null; 5730 }, delay); 5731 } 5732 }; 5733 } 5734}; 5735 5736window.Foundation = Foundation; 5737 5738// Polyfill for requestAnimationFrame 5739(function () { 5740 if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () { 5741 return new Date().getTime(); 5742 }; 5743 5744 var vendors = ['webkit', 'moz']; 5745 for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { 5746 var vp = vendors[i]; 5747 window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; 5748 window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame']; 5749 } 5750 if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) { 5751 var lastTime = 0; 5752 window.requestAnimationFrame = function (callback) { 5753 var now = Date.now(); 5754 var nextTime = Math.max(lastTime + 16, now); 5755 return setTimeout(function () { 5756 callback(lastTime = nextTime); 5757 }, nextTime - now); 5758 }; 5759 window.cancelAnimationFrame = clearTimeout; 5760 } 5761 /** 5762 * Polyfill for performance.now, required by rAF 5763 */ 5764 if (!window.performance || !window.performance.now) { 5765 window.performance = { 5766 start: Date.now(), 5767 now: function now() { 5768 return Date.now() - this.start; 5769 } 5770 }; 5771 } 5772})(); 5773if (!Function.prototype.bind) { 5774 Function.prototype.bind = function (oThis) { 5775 if (typeof this !== 'function') { 5776 // closest thing possible to the ECMAScript 5 5777 // internal IsCallable function 5778 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 5779 } 5780 5781 var aArgs = Array.prototype.slice.call(arguments, 1), 5782 fToBind = this, 5783 fNOP = function fNOP() {}, 5784 fBound = function fBound() { 5785 return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); 5786 }; 5787 5788 if (this.prototype) { 5789 // native functions don't have a prototype 5790 fNOP.prototype = this.prototype; 5791 } 5792 fBound.prototype = new fNOP(); 5793 5794 return fBound; 5795 }; 5796} 5797// Polyfill to get the name of a function in IE9 5798function functionName(fn) { 5799 if (Function.prototype.name === undefined) { 5800 var funcNameRegex = /function\s([^(]{1,})\(/; 5801 var results = funcNameRegex.exec(fn.toString()); 5802 return results && results.length > 1 ? results[1].trim() : ""; 5803 } else if (fn.prototype === undefined) { 5804 return fn.constructor.name; 5805 } else { 5806 return fn.prototype.constructor.name; 5807 } 5808} 5809function parseValue(str) { 5810 if ('true' === str) return true;else if ('false' === str) return false;else if (!isNaN(str * 1)) return parseFloat(str); 5811 return str; 5812} 5813// Convert PascalCase to kebab-case 5814// Thank you: http://stackoverflow.com/a/8955580 5815function hyphenate(str) { 5816 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 5817} 5818 5819exports.Foundation = Foundation; 5820 5821/***/ }), 5822/* 23 */ 5823/***/ (function(module, exports, __webpack_require__) { 5824 5825"use strict"; 5826 5827 5828Object.defineProperty(exports, "__esModule", { 5829 value: true 5830}); 5831exports.Dropdown = undefined; 5832 5833var _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; }; }(); 5834 5835var _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); } }; 5836 5837var _jquery = __webpack_require__(0); 5838 5839var _jquery2 = _interopRequireDefault(_jquery); 5840 5841var _foundationUtil = __webpack_require__(3); 5842 5843var _foundationUtil2 = __webpack_require__(1); 5844 5845var _foundation = __webpack_require__(15); 5846 5847var _foundationUtil3 = __webpack_require__(5); 5848 5849function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 5850 5851function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5852 5853function _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; } 5854 5855function _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
5855onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 5856 5857/** 5858 * Dropdown module. 5859 * @module foundation.dropdown 5860 * @requires foundation.util.keyboard 5861 * @requires foundation.util.box 5862 * @requires foundation.util.triggers 5863 */ 5864var Dropdown = function (_Positionable) { 5865 _inherits(Dropdown, _Positionable); 5866 5867 function Dropdown() { 5868 _classCallCheck(this, Dropdown); 5869 5870 return _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).apply(this, arguments)); 5871 } 5872 5873 _createClass(Dropdown, [{ 5874 key: '_setup', 5875 5876 /** 5877 * Creates a new instance of a dropdown. 5878 * @class 5879 * @name Dropdown 5880 * @param {jQuery} element - jQuery object to make into a dropdown. 5881 * Object should be of the dropdown panel, rather than its anchor. 5882 * @param {Object} options - Overrides to the default plugin settings. 5883 */ 5884 value: function _setup(element, options) { 5885 this.$element = element; 5886 this.options = _jquery2.default.extend({}, Dropdown.defaults, this.$element.data(), options); 5887 this.className = 'Dropdown'; // ie9 back compat 5888 5889 // Triggers init is idempotent, just need to make sure it is initialized 5890 _foundationUtil3.Triggers.init(_jquery2.default); 5891 5892 this._init(); 5893 5894 _foundationUtil.Keyboard.register('Dropdown', { 5895 'ENTER': 'open', 5896 'SPACE': 'open', 5897 'ESCAPE': 'close' 5898 }); 5899 } 5900 5901 /** 5902 * Initializes the plugin by setting/checking options and attributes, adding helper variables, and saving the anchor. 5903 * @function 5904 * @private 5905 */ 5906 5907 }, { 5908 key: '_init', 5909 value: function _init() { 5910 var $id = this.$element.attr('id'); 5911 5912 this.$anchor = (0, _jquery2.default)('[data-toggle="' + $id + '"]').length ? (0, _jquery2.default)('[data-toggle="' + $id + '"]') : (0, _jquery2.default)('[data-open="' + $id + '"]'); 5913 this.$anchor.attr({ 5914 'aria-controls': $id, 5915 'data-is-focus': false, 5916 'data-yeti-box': $id, 5917 'aria-haspopup': true, 5918 'aria-expanded': false 5919 5920 }); 5921 5922 if (this.options.parentClass) { 5923 this.$parent = this.$element.parents('.' + this.options.parentClass); 5924 } else { 5925 this.$parent = null; 5926 } 5927 5928 this.$element.attr({ 5929 'aria-hidden': 'true', 5930 'data-yeti-box': $id, 5931 'data-resize': $id, 5932 'aria-labelledby': this.$anchor[0].id || (0, _foundationUtil2.GetYoDigits)(6, 'dd-anchor') 5933 }); 5934 _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_init', this).call(this); 5935 this._events(); 5936 } 5937 }, { 5938 key: '_getDefaultPosition', 5939 value: function _getDefaultPosition() { 5940 // handle legacy classnames 5941 var position = this.$element[0].className.match(/(top|left|right|bottom)/g); 5942 if (position) { 5943 return position[0]; 5944 } else { 5945 return 'bottom'; 5946 } 5947 } 5948 }, { 5949 key: '_getDefaultAlignment', 5950 value: function _getDefaultAlignment() { 5951 // handle legacy float approach 5952 var horizontalPosition = /float-(\S+)/.exec(this.$anchor[0].className); 5953 if (horizontalPosition) { 5954 return horizontalPosition[1]; 5955 } 5956 5957 return _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_getDefaultAlignment', this).call(this); 5958 } 5959 5960 /** 5961 * Sets the position and orientation of the dropdown pane, checks for collisions if allow-overlap is not true. 5962 * Recursively calls itself if a collision is detected, with a new position class. 5963 * @function 5964 * @private 5965 */ 5966 5967 }, { 5968 key: '_setPosition', 5969 value: function _setPosition() { 5970 _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_setPosition', this).call(this, this.$anchor, this.$element, this.$parent); 5971 } 5972 5973 /** 5974 * Adds event listeners to the element utilizing the triggers utility library. 5975 * @function 5976 * @private 5977 */ 5978 5979 }, { 5980 key: '_events', 5981 value: function _events() { 5982 var _this = this; 5983 this.$element.on({ 5984 'open.zf.trigger': this.open.bind(this), 5985 'close.zf.trigger': this.close.bind(this), 5986 'toggle.zf.trigger': this.toggle.bind(this), 5987 'resizeme.zf.trigger': this._setPosition.bind(this) 5988 }); 5989 5990 if (this.options.hover) { 5991 this.$anchor.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 5992 var bodyData = (0, _jquery2.default)('body').data(); 5993 if (typeof bodyData.whatinput === 'undefined' || bodyData.whatinput === 'mouse') { 5994 clearTimeout(_this.timeout); 5995 _this.timeout = setTimeout(function () { 5996 _this.open(); 5997 _this.$anchor.data('hover', true); 5998 }, _this.options.hoverDelay); 5999 } 6000 }).on('mouseleave.zf.dropdown', function () { 6001 clearTimeout(_this.timeout); 6002 _this.timeout = setTimeout(function () { 6003 _this.close(); 6004 _this.$anchor.data('hover', false); 6005 }, _this.options.hoverDelay); 6006 }); 6007 if (this.options.hoverPane) { 6008 this.$element.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 6009 clearTimeout(_this.timeout); 6010 }).on('mouseleave.zf.dropdown', function () { 6011 clearTimeout(_this.timeout); 6012 _this.timeout = setTimeout(function () { 6013 _this.close(); 6014 _this.$anchor.data('hover', false); 6015 }, _this.options.hoverDelay); 6016 }); 6017 } 6018 } 6019 this.$anchor.add(this.$element).on('keydown.zf.dropdown', function (e) { 6020 6021 var $target = (0, _jquery2.default)(this), 6022 visibleFocusableElements = _foundationUtil.Keyboard.findFocusable(_this.$element); 6023 6024 _foundationUtil.Keyboard.handleKey(e, 'Dropdown', { 6025 open: function open() { 6026 if ($target.is(_this.$anchor)) { 6027 _this.open(); 6028 _this.$element.attr('tabindex', -1).focus(); 6029 e.preventDefault(); 6030 } 6031 }, 6032 close: function close() { 6033 _this.close(); 6034 _this.$anchor.focus(); 6035 } 6036 }); 6037 }); 6038 } 6039 6040 /** 6041 * Adds an event handler to the body to close any dropdowns on a click. 6042 * @function 6043 * @private 6044 */ 6045 6046 }, { 6047 key: '_addBodyHandler', 6048 value: function _addBodyHandler() { 6049 var $body = (0, _jquery2.default)(document.body).not(this.$element), 6050 _this = this; 6051 $body.off('click.zf.dropdown').on('click.zf.dropdown', function (e) { 6052 if (_this.$anchor.is(e.target) || _this.$anchor.find(e.target).length) { 6053 return; 6054 } 6055 if (_this.$element.find(e.target).length) { 6056 return; 6057 } 6058 _this.close(); 6059 $body.off('click.zf.dropdown'); 6060 }); 6061 } 6062 6063 /** 6064 * Opens the dropdown pane, and fires a bubbling event to close other dropdowns. 6065 * @function 6066 * @fires Dropdown#closeme 6067 * @fires Dropdown#show 6068 */ 6069 6070 }, { 6071 key: 'open', 6072 value: function open() { 6073 // var _this = this; 6074 /** 6075 * Fires to close other open dropdowns, typically when dropdown is opening 6076 * @event Dropdown#closeme 6077 */ 6078 this.$element.trigger('closeme.zf.dropdown', this.$element.attr('id')); 6079 this.$anchor.addClass('hover').attr({ 'aria-expanded': true }); 6080 // this.$element/*.show()*/; 6081 6082 this.$element.addClass('is-opening'); 6083 this._setPosition(); 6084 this.$element.removeClass('is-opening').addClass('is-open').attr({ 'aria-hidden': false }); 6085 6086 if (this.options.autoFocus) {
6087 var $focusable = _foundationUtil.Keyboard.findFocusable(this.$element); 6088 if ($focusable.length) { 6089 $focusable.eq(0).focus(); 6090 } 6091 } 6092 6093 if (this.options.closeOnClick) { 6094 this._addBodyHandler(); 6095 } 6096 6097 if (this.options.trapFocus) { 6098 _foundationUtil.Keyboard.trapFocus(this.$element); 6099 } 6100 6101 /** 6102 * Fires once the dropdown is visible. 6103 * @event Dropdown#show 6104 */ 6105 this.$element.trigger('show.zf.dropdown', [this.$element]); 6106 } 6107 6108 /** 6109 * Closes the open dropdown pane. 6110 * @function 6111 * @fires Dropdown#hide 6112 */ 6113 6114 }, { 6115 key: 'close', 6116 value: function close() { 6117 if (!this.$element.hasClass('is-open')) { 6118 return false; 6119 } 6120 this.$element.removeClass('is-open').attr({ 'aria-hidden': true }); 6121 6122 this.$anchor.removeClass('hover').attr('aria-expanded', false); 6123 6124 /** 6125 * Fires once the dropdown is no longer visible. 6126 * @event Dropdown#hide 6127 */ 6128 this.$element.trigger('hide.zf.dropdown', [this.$element]); 6129 6130 if (this.options.trapFocus) { 6131 _foundationUtil.Keyboard.releaseFocus(this.$element); 6132 } 6133 } 6134 6135 /** 6136 * Toggles the dropdown pane's visibility. 6137 * @function 6138 */ 6139 6140 }, { 6141 key: 'toggle', 6142 value: function toggle() { 6143 if (this.$element.hasClass('is-open')) { 6144 if (this.$anchor.data('hover')) return; 6145 this.close(); 6146 } else { 6147 this.open(); 6148 } 6149 } 6150 6151 /** 6152 * Destroys the dropdown. 6153 * @function 6154 */ 6155 6156 }, { 6157 key: '_destroy', 6158 value: function _destroy() { 6159 this.$element.off('.zf.trigger').hide(); 6160 this.$anchor.off('.zf.dropdown'); 6161 (0, _jquery2.default)(document.body).off('click.zf.dropdown'); 6162 } 6163 }]); 6164 6165 return Dropdown; 6166}(_foundation.Positionable); 6167 6168Dropdown.defaults = { 6169 /** 6170 * Class that designates bounding container of Dropdown (default: window) 6171 * @option 6172 * @type {?string} 6173 * @default null 6174 */ 6175 parentClass: null, 6176 /** 6177 * Amount of time to delay opening a submenu on hover event. 6178 * @option 6179 * @type {number} 6180 * @default 250 6181 */ 6182 hoverDelay: 250, 6183 /** 6184 * Allow submenus to open on hover events 6185 * @option 6186 * @type {boolean} 6187 * @default false 6188 */ 6189 hover: false, 6190 /** 6191 * Don't close dropdown when hovering over dropdown pane 6192 * @option 6193 * @type {boolean} 6194 * @default false 6195 */ 6196 hoverPane: false, 6197 /** 6198 * Number of pixels between the dropdown pane and the triggering element on open. 6199 * @option 6200 * @type {number} 6201 * @default 0 6202 */ 6203 vOffset: 0, 6204 /** 6205 * Number of pixels between the dropdown pane and the triggering element on open. 6206 * @option 6207 * @type {number} 6208 * @default 0 6209 */ 6210 hOffset: 0, 6211 /** 6212 * DEPRECATED: Class applied to adjust open position. 6213 * @option 6214 * @type {string} 6215 * @default '' 6216 */ 6217 positionClass: '', 6218 6219 /** 6220 * Position of dropdown. Can be left, right, bottom, top, or auto. 6221 * @option 6222 * @type {string} 6223 * @default 'auto' 6224 */ 6225 position: 'auto', 6226 /** 6227 * Alignment of dropdown relative to anchor. Can be left, right, bottom, top, center, or auto. 6228 * @option 6229 * @type {string} 6230 * @default 'auto' 6231 */ 6232 alignment: 'auto', 6233 /** 6234 * 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. 6235 * @option 6236 * @type {boolean} 6237 * @default false 6238 */ 6239 allowOverlap: false, 6240 /** 6241 * Allow overlap of only the bottom of the container. This is the most common 6242 * behavior for dropdowns, allowing the dropdown to extend the bottom of the 6243 * screen but not otherwise influence or break out of the container. 6244 * @option 6245 * @type {boolean} 6246 * @default true 6247 */ 6248 allowBottomOverlap: true, 6249 /** 6250 * Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands. 6251 * @option 6252 * @type {boolean} 6253 * @default false 6254 */ 6255 trapFocus: false, 6256 /** 6257 * Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening. 6258 * @option 6259 * @type {boolean} 6260 * @default false 6261 */ 6262 autoFocus: false, 6263 /** 6264 * Allows a click on the body to close the dropdown. 6265 * @option 6266 * @type {boolean} 6267 * @default false 6268 */ 6269 closeOnClick: false 6270}; 6271 6272exports.Dropdown = Dropdown; 6273 6274/***/ }), 6275/* 24 */ 6276/***/ (function(module, exports, __webpack_require__) { 6277 6278"use strict"; 6279 6280 6281Object.defineProperty(exports, "__esModule", { 6282 value: true 6283}); 6284exports.Equalizer = undefined; 6285 6286var _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; }; }(); 6287 6288var _jquery = __webpack_require__(0); 6289 6290var _jquery2 = _interopRequireDefault(_jquery); 6291 6292var _foundationUtil = __webpack_require__(4); 6293 6294var _foundationUtil2 = __webpack_require__(8); 6295 6296var _foundationUtil3 = __webpack_require__(1); 6297 6298var _foundation = __webpack_require__(2); 6299 6300function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6301 6302function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6303 6304function _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; } 6305 6306function _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
6306onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 6307 6308/** 6309 * Equalizer module. 6310 * @module foundation.equalizer 6311 * @requires foundation.util.mediaQuery 6312 * @requires foundation.util.imageLoader if equalizer contains images 6313 */ 6314 6315var Equalizer = function (_Plugin) { 6316 _inherits(Equalizer, _Plugin); 6317 6318 function Equalizer() { 6319 _classCallCheck(this, Equalizer); 6320 6321 return _possibleConstructorReturn(this, (Equalizer.__proto__ || Object.getPrototypeOf(Equalizer)).apply(this, arguments)); 6322 } 6323 6324 _createClass(Equalizer, [{ 6325 key: '_setup', 6326 6327 /** 6328 * Creates a new instance of Equalizer. 6329 * @class 6330 * @name Equalizer 6331 * @fires Equalizer#init 6332 * @param {Object} element - jQuery object to add the trigger to. 6333 * @param {Object} options - Overrides to the default plugin settings. 6334 */ 6335 value: function _setup(element, options) { 6336 this.$element = element; 6337 this.options = _jquery2.default.extend({}, Equalizer.defaults, this.$element.data(), options); 6338 this.className = 'Equalizer'; // ie9 back compat 6339 6340 this._init(); 6341 } 6342 6343 /** 6344 * Initializes the Equalizer plugin and calls functions to get equalizer functioning on load. 6345 * @private 6346 */ 6347 6348 }, { 6349 key: '_init', 6350 value: function _init() { 6351 var eqId = this.$element.attr('data-equalizer') || ''; 6352 var $watched = this.$element.find('[data-equalizer-watch="' + eqId + '"]'); 6353 6354 _foundationUtil.MediaQuery._init(); 6355 6356 this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]'); 6357 this.$element.attr('data-resize', eqId || (0, _foundationUtil3.GetYoDigits)(6, 'eq')); 6358 this.$element.attr('data-mutate', eqId || (0, _foundationUtil3.GetYoDigits)(6, 'eq')); 6359 6360 this.hasNested = this.$element.find('[data-equalizer]').length > 0; 6361 this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0; 6362 this.isOn = false; 6363 this._bindHandler = { 6364 onResizeMeBound: this._onResizeMe.bind(this), 6365 onPostEqualizedBound: this._onPostEqualized.bind(this) 6366 }; 6367 6368 var imgs = this.$element.find('img'); 6369 var tooSmall; 6370 if (this.options.equalizeOn) { 6371 tooSmall = this._checkMQ(); 6372 (0, _jquery2.default)(window).on('changed.zf.mediaquery', this._checkMQ.bind(this)); 6373 } else { 6374 this._events(); 6375 } 6376 if (tooSmall !== undefined && tooSmall === false || tooSmall === undefined) { 6377 if (imgs.length) { 6378 (0, _foundationUtil2.onImagesLoaded)(imgs, this._reflow.bind(this)); 6379 } else { 6380 this._reflow(); 6381 } 6382 } 6383 } 6384 6385 /** 6386 * Removes event listeners if the breakpoint is too small. 6387 * @private 6388 */ 6389 6390 }, { 6391 key: '_pauseEvents', 6392 value: function _pauseEvents() { 6393 this.isOn = false; 6394 this.$element.off({ 6395 '.zf.equalizer': this._bindHandler.onPostEqualizedBound, 6396 'resizeme.zf.trigger': this._bindHandler.onResizeMeBound, 6397 'mutateme.zf.trigger': this._bindHandler.onResizeMeBound 6398 }); 6399 } 6400 6401 /** 6402 * function to handle $elements resizeme.zf.trigger, with bound this on _bindHandler.onResizeMeBound 6403 * @private 6404 */ 6405 6406 }, { 6407 key: '_onResizeMe', 6408 value: function _onResizeMe(e) { 6409 this._reflow(); 6410 } 6411 6412 /** 6413 * function to handle $elements postequalized.zf.equalizer, with bound this on _bindHandler.onPostEqualizedBound 6414 * @private 6415 */ 6416 6417 }, { 6418 key: '_onPostEqualized', 6419 value: function _onPostEqualized(e) { 6420 if (e.target !== this.$element[0]) { 6421 this._reflow(); 6422 } 6423 } 6424 6425 /** 6426 * Initializes events for Equalizer. 6427 * @private 6428 */ 6429 6430 }, { 6431 key: '_events', 6432 value: function _events() { 6433 var _this = this; 6434 this._pauseEvents(); 6435 if (this.hasNested) { 6436 this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound); 6437 } else { 6438 this.$element.on('resizeme.zf.trigger', this._bindHandler.onResizeMeBound); 6439 this.$element.on('mutateme.zf.trigger', this._bindHandler.onResizeMeBound); 6440 } 6441 this.isOn = true; 6442 } 6443 6444 /** 6445 * Checks the current breakpoint to the minimum required size. 6446 * @private 6447 */ 6448 6449 }, { 6450 key: '_checkMQ', 6451 value: function _checkMQ() { 6452 var tooSmall = !_foundationUtil.MediaQuery.is(this.options.equalizeOn); 6453 if (tooSmall) { 6454 if (this.isOn) { 6455 this._pauseEvents(); 6456 this.$watched.css('height', 'auto'); 6457 } 6458 } else { 6459 if (!this.isOn) { 6460 this._events(); 6461 } 6462 } 6463 return tooSmall; 6464 } 6465 6466 /** 6467 * A noop version for the plugin 6468 * @private 6469 */ 6470 6471 }, { 6472 key: '_killswitch', 6473 value: function _killswitch() { 6474 return; 6475 } 6476 6477 /** 6478 * Calls necessary functions to update Equalizer upon DOM change 6479 * @private 6480 */ 6481 6482 }, { 6483 key: '_reflow', 6484 value: function _reflow() { 6485 if (!this.options.equalizeOnStack) { 6486 if (this._isStacked()) { 6487 this.$watched.css('height', 'auto'); 6488 return false;
vendor: 4,386 bytes, lines 6489-6617
6489 } 6490 } 6491 if (this.options.equalizeByRow) { 6492 this.getHeightsByRow(this.applyHeightByRow.bind(this)); 6493 } else { 6494 this.getHeights(this.applyHeight.bind(this)); 6495 } 6496 } 6497 6498 /** 6499 * Manually determines if the first 2 elements are *NOT* stacked. 6500 * @private 6501 */ 6502 6503 }, { 6504 key: '_isStacked', 6505 value: function _isStacked() { 6506 if (!this.$watched[0] || !this.$watched[1]) { 6507 return true; 6508 } 6509 return this.$watched[0].getBoundingClientRect().top !== this.$watched[1].getBoundingClientRect().top; 6510 } 6511 6512 /** 6513 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 6514 * @param {Function} cb - A non-optional callback to return the heights array to. 6515 * @returns {Array} heights - An array of heights of children within Equalizer container 6516 */ 6517 6518 }, { 6519 key: 'getHeights', 6520 value: function getHeights(cb) { 6521 var heights = []; 6522 for (var i = 0, len = this.$watched.length; i < len; i++) { 6523 this.$watched[i].style.height = 'auto'; 6524 heights.push(this.$watched[i].offsetHeight); 6525 } 6526 cb(heights); 6527 } 6528 6529 /** 6530 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 6531 * @param {Function} cb - A non-optional callback to return the heights array to. 6532 * @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 6533 */ 6534 6535 }, { 6536 key: 'getHeightsByRow', 6537 value: function getHeightsByRow(cb) { 6538 var lastElTopOffset = this.$watched.length ? this.$watched.first().offset().top : 0, 6539 groups = [], 6540 group = 0; 6541 //group by Row 6542 groups[group] = []; 6543 for (var i = 0, len = this.$watched.length; i < len; i++) { 6544 this.$watched[i].style.height = 'auto'; 6545 //maybe could use this.$watched[i].offsetTop 6546 var elOffsetTop = (0, _jquery2.default)(this.$watched[i]).offset().top; 6547 if (elOffsetTop != lastElTopOffset) { 6548 group++; 6549 groups[group] = []; 6550 lastElTopOffset = elOffsetTop; 6551 } 6552 groups[group].push([this.$watched[i], this.$watched[i].offsetHeight]); 6553 } 6554 6555 for (var j = 0, ln = groups.length; j < ln; j++) { 6556 var heights = (0, _jquery2.default)(groups[j]).map(function () { 6557 return this[1]; 6558 }).get(); 6559 var max = Math.max.apply(null, heights); 6560 groups[j].push(max); 6561 } 6562 cb(groups); 6563 } 6564 6565 /** 6566 * Changes the CSS height property of each child in an Equalizer parent to match the tallest 6567 * @param {array} heights - An array of heights of children within Equalizer container 6568 * @fires Equalizer#preequalized 6569 * @fires Equalizer#postequalized 6570 */ 6571 6572 }, { 6573 key: 'applyHeight', 6574 value: function applyHeight(heights) { 6575 var max = Math.max.apply(null, heights); 6576 /** 6577 * Fires before the heights are applied 6578 * @event Equalizer#preequalized 6579 */ 6580 this.$element.trigger('preequalized.zf.equalizer'); 6581 6582 this.$watched.css('height', max); 6583 6584 /** 6585 * Fires when the heights have been applied 6586 * @event Equalizer#postequalized 6587 */ 6588 this.$element.trigger('postequalized.zf.equalizer'); 6589 } 6590 6591 /** 6592 * Changes the CSS height property of each child in an Equalizer parent to match the tallest by row 6593 * @param {array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 6594 * @fires Equalizer#preequalized 6595 * @fires Equalizer#preequalizedrow 6596 * @fires Equalizer#postequalizedrow 6597 * @fires Equalizer#postequalized 6598 */ 6599 6600 }, { 6601 key: 'applyHeightByRow', 6602 value: function applyHeightByRow(groups) { 6603 /** 6604 * Fires before the heights are applied 6605 */ 6606 this.$element.trigger('preequalized.zf.equalizer'); 6607 for (var i = 0, len = groups.length; i < len; i++) { 6608 var groupsILength = groups[i].length, 6609 max = groups[i][groupsILength - 1]; 6610 if (groupsILength <= 2) { 6611 (0, _jquery2.default)(groups[i][0][0]).css({ 'height': 'auto' }); 6612 continue; 6613 } 6614 /** 6615 * Fires before the heights per row are applied 6616 * @event Equalizer#preequalizedrow 6617 */
6618 this.$element.trigger('preequalizedrow.zf.equalizer'); 6619 for (var j = 0, lenJ = groupsILength - 1; j < lenJ; j++) { 6620 (0, _jquery2.default)(groups[i][j][0]).css({ 'height': max }); 6621 } 6622 /** 6623 * Fires when the heights per row have been applied 6624 * @event Equalizer#postequalizedrow 6625 */ 6626 this.$element.trigger('postequalizedrow.zf.equalizer'); 6627 } 6628 /** 6629 * Fires when the heights have been applied 6630 */ 6631 this.$element.trigger('postequalized.zf.equalizer'); 6632 } 6633 6634 /** 6635 * Destroys an instance of Equalizer. 6636 * @function 6637 */ 6638 6639 }, { 6640 key: '_destroy', 6641 value: function _destroy() { 6642 this._pauseEvents(); 6643 this.$watched.css('height', 'auto'); 6644 } 6645 }]); 6646 6647 return Equalizer; 6648}(_foundation.Plugin); 6649 6650/** 6651 * Default settings for plugin 6652 */ 6653 6654 6655Equalizer.defaults = { 6656 /** 6657 * Enable height equalization when stacked on smaller screens. 6658 * @option 6659 * @type {boolean} 6660 * @default false 6661 */ 6662 equalizeOnStack: false, 6663 /** 6664 * Enable height equalization row by row. 6665 * @option 6666 * @type {boolean} 6667 * @default false 6668 */ 6669 equalizeByRow: false, 6670 /** 6671 * String representing the minimum breakpoint size the plugin should equalize heights on. 6672 * @option 6673 * @type {string} 6674 * @default '' 6675 */ 6676 equalizeOn: '' 6677}; 6678 6679exports.Equalizer = Equalizer; 6680 6681/***/ }), 6682/* 25 */ 6683/***/ (function(module, exports, __webpack_require__) { 6684 6685"use strict"; 6686 6687 6688Object.defineProperty(exports, "__esModule", { 6689 value: true 6690}); 6691exports.Interchange = undefined; 6692 6693var _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; }; }(); 6694 6695var _jquery = __webpack_require__(0); 6696 6697var _jquery2 = _interopRequireDefault(_jquery); 6698 6699var _foundationUtil = __webpack_require__(4); 6700 6701var _foundation = __webpack_require__(2); 6702 6703var _foundationUtil2 = __webpack_require__(1); 6704 6705function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6706 6707function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6708 6709function _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; } 6710 6711function _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; } 6712 6713/** 6714 * Interchange module. 6715 * @module foundation.interchange 6716 * @requires foundation.util.mediaQuery 6717 */ 6718 6719var Interchange = function (_Plugin) { 6720 _inherits(Interchange, _Plugin); 6721 6722 function Interchange() { 6723 _classCallCheck(this, Interchange); 6724 6725 return _possibleConstructorReturn(this, (Interchange.__proto__ || Object.getPrototypeOf(Interchange)).apply(this, arguments)); 6726 } 6727 6728 _createClass(Interchange, [{ 6729 key: '_setup', 6730 6731 /** 6732 * Creates a new instance of Interchange. 6733 * @class 6734 * @name Interchange 6735 * @fires Interchange#init 6736 * @param {Object} element - jQuery object to add the trigger to. 6737 * @param {Object} options - Overrides to the default plugin settings. 6738 */ 6739 value: function _setup(element, options) { 6740 this.$element = element; 6741 this.options = _jquery2.default.extend({}, Interchange.defaults, options); 6742 this.rules = []; 6743 this.currentPath = ''; 6744 this.className = 'Interchange'; // ie9 back compat 6745 6746 this._init(); 6747 this._events(); 6748 } 6749 6750 /** 6751 * Initializes the Interchange plugin and calls functions to get interchange functioning on load. 6752 * @function 6753 * @private 6754 */ 6755 6756 }, { 6757 key: '_init', 6758 value: function _init() { 6759 _foundationUtil.MediaQuery._init(); 6760 6761 var id = this.$element[0].id || (0, _foundationUtil2.GetYoDigits)(6, 'interchange'); 6762 this.$element.attr({ 6763 'data-resize': id, 6764 'id': id 6765 }); 6766 6767 this._addBreakpoints(); 6768 this._generateRules(); 6769 this._reflow(); 6770 } 6771 6772 /** 6773 * Initializes events for Interchange. 6774 * @function 6775 * @private 6776 */ 6777 6778 }, { 6779 key: '_events', 6780 value: function _events() { 6781 var _this3 = this; 6782 6783 this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function () { 6784 return _this3._reflow(); 6785 }); 6786 } 6787 6788 /** 6789 * Calls necessary functions to update Interchange upon DOM change 6790 * @function 6791 * @private 6792 */ 6793 6794 }, { 6795 key: '_reflow', 6796 value: function _reflow() { 6797 var match; 6798 6799 // Iterate through each rule, but only save the last match 6800 for (var i in this.rules) { 6801 if (this.rules.hasOwnProperty(i)) { 6802 var rule = this.rules[i]; 6803 if (window.matchMedia(rule.query).matches) { 6804 match = rule; 6805 } 6806 } 6807 } 6808 6809 if (match) { 6810 this.replace(match.path); 6811 } 6812 } 6813 6814 /** 6815 * Gets the Foundation breakpoints and adds them to the Interchange.SPECIAL_QUERIES object. 6816 * @function 6817 * @private 6818 */ 6819 6820 }, { 6821 key: '_addBreakpoints', 6822 value: function _addBreakpoints() { 6823 for (var i in _foundationUtil.MediaQuery.queries) { 6824 if (_foundationUtil.MediaQuery.queries.hasOwnProperty(i)) { 6825 var query = _foundationUtil.MediaQuery.queries[i]; 6826 Interchange.SPECIAL_QUERIES[query.name] = query.value; 6827 } 6828 } 6829 } 6830 6831 /** 6832 * Checks the Interchange element for the provided media query + content pairings 6833 * @function 6834 * @private 6835 * @param {Object} element - jQuery object that is an Interchange instance 6836 * @returns {Array} scenarios - Array of objects that have 'mq' and 'path' keys with corresponding keys 6837 */ 6838 6839 }, { 6840 key: '_generateRules', 6841 value: function _generateRules(element) { 6842 var rulesList = []; 6843 var rules; 6844 6845 if (this.options.rules) { 6846 rules = this.options.rules; 6847 } else { 6848 rules = this.$element.data('interchange'); 6849 } 6850 6851 rules = typeof rules === 'string' ? rules.match(/\[.*?\]/g) : rules; 6852 6853 for (var i in rules) { 6854 if (rules.hasOwnProperty(i)) { 6855 var rule = rules[i].slice(1, -1).split(', '); 6856 var path = rule.slice(0, -1).join(''); 6857 var query = rule[rule.length - 1]; 6858 6859 if (Interchange.SPECIAL_QUERIES[query]) { 6860 query = Interchange.SPECIAL_QUERIES[query]; 6861 } 6862 6863 rulesList.push({ 6864 path: path, 6865 query: query 6866 }); 6867 } 6868 } 6869 6870 this.rules = rulesList; 6871 } 6872 6873 /** 6874 * Update the `src` property of an image, or change the HTML of a container, to the specified path. 6875 * @function 6876 * @param {String} path - Path to the image or HTML partial. 6877 * @fires Interchange#replaced 6878 */ 6879 6880 }, { 6881 key: 'replace', 6882 value: function replace(path) { 6883 if (this.currentPath === path) return; 6884 6885 var _this = this, 6886 trigger = 'replaced.zf.interchange'; 6887 6888 // Replacing images 6889 if (this.$element[0].nodeName === 'IMG') { 6890 this.$element.attr('src', path).on('load', function () { 6891 _this.currentPath = path; 6892 }).trigger(trigger); 6893 } 6894 // Replacing background images 6895 else if (path.match(/\.(gif|jpg|jpeg|png|svg|tiff)([?#].*)?/i)) { 6896 path = path.replace(/\(/g, '%28').replace(/\)/g, '%29'); 6897 this.$element.css({ 'background-image': 'url(' + path + ')' }).trigger(trigger); 6898 } 6899 // Replacing HTML 6900 else { 6901 _jquery2.default.get(path, function (response) { 6902 _this.$element.html(response).trigger(trigger); 6903 (0, _jquery2.default)(response).foundation(); 6904 _this.currentPath = path; 6905 }); 6906 } 6907 6908 /** 6909 * Fires when content in an Interchange element is done being loaded. 6910 * @event Interchange#replaced 6911 */ 6912 // this.$element.trigger('replaced.zf.interchange'); 6913 } 6914 6915 /** 6916 * Destroys an instance of interchange. 6917 * @function 6918 */ 6919 6920 }, { 6921 key: '_destroy', 6922 value: function _destroy() { 6923 this.$element.off('resizeme.zf.trigger'); 6924 } 6925 }]); 6926 6927 return Interchange; 6928}
6928(_foundation.Plugin); 6929 6930/** 6931 * Default settings for plugin 6932 */ 6933 6934 6935Interchange.defaults = { 6936 /** 6937 * Rules to be applied to Interchange elements. Set with the `data-interchange` array notation. 6938 * @option 6939 * @type {?array} 6940 * @default null 6941 */ 6942 rules: null 6943}; 6944 6945Interchange.SPECIAL_QUERIES = { 6946 'landscape': 'screen and (orientation: landscape)', 6947 'portrait': 'screen and (orientation: portrait)', 6948 '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)' 6949}; 6950 6951exports.Interchange = Interchange; 6952 6953/***/ }), 6954/* 26 */ 6955/***/ (function(module, exports, __webpack_require__) { 6956 6957"use strict"; 6958 6959 6960Object.defineProperty(exports, "__esModule", { 6961 value: true 6962}); 6963exports.Magellan = undefined; 6964 6965var _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; }; }(); 6966 6967var _jquery = __webpack_require__(0); 6968 6969var _jquery2 = _interopRequireDefault(_jquery); 6970 6971var _foundationUtil = __webpack_require__(1); 6972 6973var _foundation = __webpack_require__(2); 6974 6975var _foundation2 = __webpack_require__(16); 6976 6977function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6978 6979function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6980 6981function _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; } 6982 6983function _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; } 6984 6985/** 6986 * Magellan module. 6987 * @module foundation.magellan 6988 * @requires foundation.smoothScroll 6989 */ 6990 6991var Magellan = function (_Plugin) { 6992 _inherits(Magellan, _Plugin); 6993 6994 function Magellan() { 6995 _classCallCheck(this, Magellan); 6996 6997 return _possibleConstructorReturn(this, (Magellan.__proto__ || Object.getPrototypeOf(Magellan)).apply(this, arguments)); 6998 } 6999 7000 _createClass(Magellan, [{ 7001 key: '_setup', 7002 7003 /** 7004 * Creates a new instance of Magellan. 7005 * @class 7006 * @name Magellan 7007 * @fires Magellan#init 7008 * @param {Object} element - jQuery object to add the trigger to. 7009 * @param {Object} options - Overrides to the default plugin settings. 7010 */ 7011 value: function _setup(element, options) { 7012 this.$element = element; 7013 this.options = _jquery2.default.extend({}, Magellan.defaults, this.$element.data(), options); 7014 this.className = 'Magellan'; // ie9 back compat 7015 7016 this._init(); 7017 this.calcPoints(); 7018 } 7019 7020 /** 7021 * Initializes the Magellan plugin and calls functions to get equalizer functioning on load. 7022 * @private 7023 */ 7024 7025 }, { 7026 key: '_init', 7027 value: function _init() { 7028 var id = this.$element[0].id || (0, _foundationUtil.GetYoDigits)(6, 'magellan'); 7029 var _this = this; 7030 this.$targets = (0, _jquery2.default)('[data-magellan-target]'); 7031 this.$links = this.$element.find('a'); 7032 this.$element.attr({ 7033 'data-resize': id, 7034 'data-scroll': id, 7035 'id': id 7036 }); 7037 this.$active = (0, _jquery2.default)(); 7038 this.scrollPos = parseInt(window.pageYOffset, 10); 7039 7040 this._events(); 7041 } 7042 7043 /** 7044 * Calculates an array of pixel values that are the demarcation lines between locations on the page. 7045 * Can be invoked if new elements are added or the size of a location changes. 7046 * @function 7047 */ 7048 7049 }, { 7050 key: 'calcPoints', 7051 value: function calcPoints() { 7052 var _this = this, 7053 body = document.body, 7054 html = document.documentElement; 7055 7056 this.points = []; 7057 this.winHeight = Math.round(Math.max(window.innerHeight, html.clientHeight)); 7058 this.docHeight = Math.round(Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight)); 7059 7060 this.$targets.each(function () { 7061 var $tar = (0, _jquery2.default)(this), 7062 pt = Math.round($tar.offset().top - _this.options.threshold); 7063 $tar.targetPoint = pt; 7064 _this.points.push(pt); 7065 }); 7066 } 7067 7068 /** 7069 * Initializes events for Magellan. 7070 * @private 7071 */ 7072 7073 }, { 7074 key: '_events', 7075 value: function _events() { 7076 var _this = this, 7077 $body = (0, _jquery2.default)('html, body'), 7078 opts = { 7079 duration: _this.options.animationDuration, 7080 easing: _this.options.animationEasing 7081 }; 7082 (0, _jquery2.default)(window).one('load', function () { 7083 if (_this.options.deepLinking) { 7084 if (location.hash) { 7085 _this.scrollToLoc(location.hash); 7086 } 7087 } 7088 _this.calcPoints(); 7089 _this._updateActive(); 7090 }); 7091 7092 this.$element.on({ 7093 'resizeme.zf.trigger': this.reflow.bind(this), 7094 'scrollme.zf.trigger': this._updateActive.bind(this) 7095 }).on('click.zf.magellan', 'a[href^="#"]', function (e) { 7096 e.preventDefault(); 7097 var arrival = this.getAttribute('href'); 7098 _this.scrollToLoc(arrival); 7099 }); 7100 7101 this._deepLinkScroll = function (e) { 7102 if (_this.options.deepLinking) { 7103 _this.scrollToLoc(window.location.hash); 7104 } 7105 }; 7106 7107 (0, _jquery2.default)(window).on('popstate', this._deepLinkScroll); 7108 } 7109 7110 /** 7111 * Function to scroll to a given location on the page. 7112 * @param {String} loc - a properly formatted jQuery id selector. Example: '#foo' 7113 * @function 7114 */ 7115 7116 }, { 7117 key: 'scrollToLoc', 7118 value: function scrollToLoc(loc) { 7119 this._inTransition = true; 7120 var _this = this; 7121 7122 var options = { 7123 animationEasing: this.options.animationEasing, 7124 animationDuration: this.options.animationDuration, 7125 threshold: this.options.threshold, 7126 offset: this.options.offset 7127 }; 7128 7129 _foundation2.SmoothScroll.scrollToLoc(loc, options, function () { 7130 _this._inTransition = false;
7131 _this._updateActive(); 7132 }); 7133 } 7134 7135 /** 7136 * Calls necessary functions to update Magellan upon DOM change 7137 * @function 7138 */ 7139 7140 }, { 7141 key: 'reflow', 7142 value: function reflow() { 7143 this.calcPoints(); 7144 this._updateActive(); 7145 } 7146 7147 /** 7148 * Updates the visibility of an active location link, and updates the url hash for the page, if deepLinking enabled. 7149 * @private 7150 * @function 7151 * @fires Magellan#update 7152 */ 7153 7154 }, { 7155 key: '_updateActive', 7156 value: function _updateActive() /*evt, elem, scrollPos*/{ 7157 if (this._inTransition) { 7158 return; 7159 } 7160 var winPos = /*scrollPos ||*/parseInt(window.pageYOffset, 10), 7161 curIdx; 7162 7163 if (winPos + this.winHeight === this.docHeight) { 7164 curIdx = this.points.length - 1; 7165 } else if (winPos < this.points[0]) { 7166 curIdx = undefined; 7167 } else { 7168 var isDown = this.scrollPos < winPos, 7169 _this = this, 7170 curVisible = this.points.filter(function (p, i) { 7171 return isDown ? p - _this.options.offset <= winPos : p - _this.options.offset - _this.options.threshold <= winPos; 7172 }); 7173 curIdx = curVisible.length ? curVisible.length - 1 : 0; 7174 } 7175 7176 this.$active.removeClass(this.options.activeClass); 7177 this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass); 7178 7179 if (this.options.deepLinking) { 7180 var hash = ""; 7181 if (curIdx != undefined) { 7182 hash = this.$active[0].getAttribute('href'); 7183 } 7184 if (hash !== window.location.hash) { 7185 if (window.history.pushState) { 7186 window.history.pushState(null, null, hash); 7187 } else { 7188 window.location.hash = hash; 7189 } 7190 } 7191 } 7192 7193 this.scrollPos = winPos; 7194 /** 7195 * Fires when magellan is finished updating to the new active element. 7196 * @event Magellan#update 7197 */ 7198 this.$element.trigger('update.zf.magellan', [this.$active]); 7199 } 7200 7201 /** 7202 * Destroys an instance of Magellan and resets the url of the window. 7203 * @function 7204 */ 7205 7206 }, { 7207 key: '_destroy', 7208 value: function _destroy() { 7209 this.$element.off('.zf.trigger .zf.magellan').find('.' + this.options.activeClass).removeClass(this.options.activeClass); 7210 7211 if (this.options.deepLinking) { 7212 var hash = this.$active[0].getAttribute('href'); 7213 window.location.hash.replace(hash, ''); 7214 } 7215 (0, _jquery2.default)(window).off('popstate', this._deepLinkScroll); 7216 } 7217 }]); 7218 7219 return Magellan; 7220}(_foundation.Plugin); 7221 7222/** 7223 * Default settings for plugin 7224 */ 7225 7226 7227Magellan.defaults = { 7228 /** 7229 * Amount of time, in ms, the animated scrolling should take between locations. 7230 * @option 7231 * @type {number} 7232 * @default 500 7233 */ 7234 animationDuration: 500, 7235 /** 7236 * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`. 7237 * @option 7238 * @type {string} 7239 * @default 'linear' 7240 * @see {@link https://api.jquery.com/animate|Jquery animate} 7241 */ 7242 animationEasing: 'linear', 7243 /** 7244 * Number of pixels to use as a marker for location changes. 7245 * @option 7246 * @type {number} 7247 * @default 50 7248 */ 7249 threshold: 50, 7250 /** 7251 * Class applied to the active locations link on the magellan container. 7252 * @option 7253 * @type {string} 7254 * @default 'is-active' 7255 */ 7256 activeClass: 'is-active', 7257 /** 7258 * Allows the script to manipulate the url of the current page, and if supported, alter the history. 7259 * @option 7260 * @type {boolean} 7261 * @default false 7262 */ 7263 deepLinking: false, 7264 /** 7265 * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar. 7266 * @option 7267 * @type {number} 7268 * @default 0 7269 */ 7270 offset: 0 7271}; 7272 7273exports.Magellan = Magellan; 7274 7275/***/ }), 7276/* 27 */ 7277/***/ (function(module, exports, __webpack_require__) { 7278 7279"use strict"; 7280 7281 7282Object.defineProperty(exports, "__esModule", { 7283 value: true 7284}); 7285exports.OffCanvas = undefined; 7286 7287var _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; }; }(); 7288 7289var _jquery = __webpack_require__(0); 7290 7291var _jquery2 = _interopRequireDefault(_jquery); 7292 7293var _foundationUtil = __webpack_require__(3); 7294 7295var _foundationUtil2 = __webpack_require__(4); 7296 7297var _foundationUtil3 = __webpack_require__(1); 7298 7299var _foundation = __webpack_require__(2); 7300 7301var _foundationUtil4 = __webpack_require__(5); 7302 7303function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 7304 7305function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7306 7307function _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; } 7308 7309function _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
7309onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 7310 7311/** 7312 * OffCanvas module. 7313 * @module foundation.offcanvas 7314 * @requires foundation.util.keyboard 7315 * @requires foundation.util.mediaQuery 7316 * @requires foundation.util.triggers 7317 */ 7318 7319var OffCanvas = function (_Plugin) { 7320 _inherits(OffCanvas, _Plugin); 7321 7322 function OffCanvas() { 7323 _classCallCheck(this, OffCanvas); 7324 7325 return _possibleConstructorReturn(this, (OffCanvas.__proto__ || Object.getPrototypeOf(OffCanvas)).apply(this, arguments)); 7326 } 7327 7328 _createClass(OffCanvas, [{ 7329 key: '_setup', 7330 7331 /** 7332 * Creates a new instance of an off-canvas wrapper. 7333 * @class 7334 * @name OffCanvas 7335 * @fires OffCanvas#init 7336 * @param {Object} element - jQuery object to initialize. 7337 * @param {Object} options - Overrides to the default plugin settings. 7338 */ 7339 value: function _setup(element, options) { 7340 var _this3 = this; 7341 7342 this.className = 'OffCanvas'; // ie9 back compat 7343 this.$element = element; 7344 this.options = _jquery2.default.extend({}, OffCanvas.defaults, this.$element.data(), options); 7345 this.contentClasses = { base: [], reveal: [] }; 7346 this.$lastTrigger = (0, _jquery2.default)(); 7347 this.$triggers = (0, _jquery2.default)(); 7348 this.position = 'left'; 7349 this.$content = (0, _jquery2.default)(); 7350 this.nested = !!this.options.nested; 7351 7352 // Defines the CSS transition/position classes of the off-canvas content container. 7353 (0, _jquery2.default)(['push', 'overlap']).each(function (index, val) { 7354 _this3.contentClasses.base.push('has-transition-' + val); 7355 }); 7356 (0, _jquery2.default)(['left', 'right', 'top', 'bottom']).each(function (index, val) { 7357 _this3.contentClasses.base.push('has-position-' + val); 7358 _this3.contentClasses.reveal.push('has-reveal-' + val); 7359 }); 7360 7361 // Triggers init is idempotent, just need to make sure it is initialized 7362 _foundationUtil4.Triggers.init(_jquery2.default); 7363 _foundationUtil2.MediaQuery._init(); 7364 7365 this._init(); 7366 this._events(); 7367 7368 _foundationUtil.Keyboard.register('OffCanvas', { 7369 'ESCAPE': 'close' 7370 }); 7371 } 7372 7373 /** 7374 * Initializes the off-canvas wrapper by adding the exit overlay (if needed). 7375 * @function 7376 * @private 7377 */ 7378 7379 }, { 7380 key: '_init', 7381 value: function _init() { 7382 var id = this.$element.attr('id'); 7383 7384 this.$element.attr('aria-hidden', 'true'); 7385 7386 // Find off-canvas content, either by ID (if specified), by siblings or by closest selector (fallback) 7387 if (this.options.contentId) { 7388 this.$content = (0, _jquery2.default)('#' + this.options.contentId); 7389 } else if (this.$element.siblings('[data-off-canvas-content]').length) { 7390 this.$content = this.$element.siblings('[data-off-canvas-content]').first(); 7391 } else { 7392 this.$content = this.$element.closest('[data-off-canvas-content]').first(); 7393 } 7394 7395 if (!this.options.contentId) { 7396 // Assume that the off-canvas element is nested if it isn't a sibling of the content 7397 this.nested = this.$element.siblings('[data-off-canvas-content]').length === 0; 7398 } else if (this.options.contentId && this.options.nested === null) { 7399 // Warning if using content ID without setting the nested option 7400 // Once the element is nested it is required to work properly in this case 7401 console.warn('Remember to use the nested option if using the content ID option!'); 7402 } 7403 7404 if (this.nested === true) { 7405 // Force transition overlap if nested 7406 this.options.transition = 'overlap'; 7407 // Remove appropriate classes if already assigned in markup 7408 this.$element.removeClass('is-transition-push'); 7409 } 7410 7411 this.$element.addClass('is-transition-' + this.options.transition + ' is-closed'); 7412 7413 // Find triggers that affect this element and add aria-expanded to them 7414 this.$triggers = (0, _jquery2.default)(document).find('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-expanded', 'false').attr('aria-controls', id); 7415 7416 // Get position by checking for related CSS class 7417 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; 7418 7419 // Add an overlay over the content if necessary 7420 if (this.options.contentOverlay === true) {
7421 var overlay = document.createElement('div'); 7422 var overlayPosition = (0, _jquery2.default)(this.$element).css("position") === 'fixed' ? 'is-overlay-fixed' : 'is-overlay-absolute'; 7423 overlay.setAttribute('class', 'js-off-canvas-overlay ' + overlayPosition); 7424 this.$overlay = (0, _jquery2.default)(overlay); 7425 if (overlayPosition === 'is-overlay-fixed') { 7426 (0, _jquery2.default)(this.$overlay).insertAfter(this.$element); 7427 } else { 7428 this.$content.append(this.$overlay); 7429 } 7430 } 7431 7432 this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className); 7433 7434 if (this.options.isRevealed === true) { 7435 this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2]; 7436 this._setMQChecker(); 7437 } 7438 7439 if (this.options.transitionTime) { 7440 this.$element.css('transition-duration', this.options.transitionTime); 7441 } 7442 7443 // Initally remove all transition/position CSS classes from off-canvas content container. 7444 this._removeContentClasses(); 7445 } 7446 7447 /** 7448 * Adds event handlers to the off-canvas wrapper and the exit overlay. 7449 * @function 7450 * @private 7451 */ 7452 7453 }, { 7454 key: '_events', 7455 value: function _events() { 7456 this.$element.off('.zf.trigger .zf.offcanvas').on({ 7457 'open.zf.trigger': this.open.bind(this), 7458 'close.zf.trigger': this.close.bind(this), 7459 'toggle.zf.trigger': this.toggle.bind(this), 7460 'keydown.zf.offcanvas': this._handleKeyboard.bind(this) 7461 }); 7462 7463 if (this.options.closeOnClick === true) { 7464 var $target = this.options.contentOverlay ? this.$overlay : this.$content; 7465 $target.on({ 'click.zf.offcanvas': this.close.bind(this) }); 7466 } 7467 } 7468 7469 /** 7470 * Applies event listener for elements that will reveal at certain breakpoints. 7471 * @private 7472 */ 7473 7474 }, { 7475 key: '_setMQChecker', 7476 value: function _setMQChecker() { 7477 var _this = this; 7478 7479 (0, _jquery2.default)(window).on('changed.zf.mediaquery', function () { 7480 if (_foundationUtil2.MediaQuery.atLeast(_this.options.revealOn)) { 7481 _this.reveal(true); 7482 } else { 7483 _this.reveal(false); 7484 } 7485 }).one('load.zf.offcanvas', function () { 7486 if (_foundationUtil2.MediaQuery.atLeast(_this.options.revealOn)) { 7487 _this.reveal(true); 7488 } 7489 }); 7490 } 7491 7492 /** 7493 * Removes the CSS transition/position classes of the off-canvas content container. 7494 * Removing the classes is important when another off-canvas gets opened that uses the same content container. 7495 * @private 7496 */ 7497 7498 }, { 7499 key: '_removeContentClasses', 7500 value: function _removeContentClasses(hasReveal) { 7501 this.$content.removeClass(this.contentClasses.base.join(' ')); 7502 if (hasReveal === true) { 7503 this.$content.removeClass(this.contentClasses.reveal.join(' ')); 7504 } 7505 } 7506 7507 /** 7508 * Adds the CSS transition/position classes of the off-canvas content container, based on the opening off-canvas element. 7509 * Beforehand any transition/position class gets removed. 7510 * @param {Boolean} hasReveal - true if related off-canvas element is revealed. 7511 * @private 7512 */ 7513 7514 }, { 7515 key: '_addContentClasses', 7516 value: function _addContentClasses(hasReveal) { 7517 this._removeContentClasses(); 7518 this.$content.addClass('has-transition-' + this.options.transition + ' has-position-' + this.position); 7519 if (hasReveal === true) { 7520 this.$content.addClass('has-reveal-' + this.position); 7521 } 7522 } 7523 7524 /** 7525 * Handles the revealing/hiding the off-canvas at breakpoints, not the same as open. 7526 * @param {Boolean} isRevealed - true if element should be revealed. 7527 * @function 7528 */ 7529 7530 }, { 7531 key: 'reveal', 7532 value: function reveal(isRevealed) { 7533 if (isRevealed) { 7534 this.close(); 7535 this.isRevealed = true; 7536 this.$element.attr('aria-hidden', 'false'); 7537 this.$element.off('open.zf.trigger toggle.zf.trigger'); 7538 this.$element.removeClass('is-closed'); 7539 } else { 7540 this.isRevealed = false;
7541 this.$element.attr('aria-hidden', 'true'); 7542 this.$element.off('open.zf.trigger toggle.zf.trigger').on({ 7543 'open.zf.trigger': this.open.bind(this), 7544 'toggle.zf.trigger': this.toggle.bind(this) 7545 }); 7546 this.$element.addClass('is-closed'); 7547 } 7548 this._addContentClasses(isRevealed); 7549 } 7550 7551 /** 7552 * Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers. 7553 * @private 7554 */ 7555 7556 }, { 7557 key: '_stopScrolling', 7558 value: function _stopScrolling(event) { 7559 return false; 7560 } 7561 7562 // Taken and adapted from http://stackoverflow.com/questions/16889447/prevent-full-page-scrolling-ios 7563 // Only really works for y, not sure how to extend to x or if we need to. 7564 7565 }, { 7566 key: '_recordScrollable', 7567 value: function _recordScrollable(event) { 7568 var elem = this; // called from event handler context with this as elem 7569 7570 // If the element is scrollable (content overflows), then... 7571 if (elem.scrollHeight !== elem.clientHeight) { 7572 // If we're at the top, scroll down one pixel to allow scrolling up 7573 if (elem.scrollTop === 0) { 7574 elem.scrollTop = 1; 7575 } 7576 // If we're at the bottom, scroll up one pixel to allow scrolling down 7577 if (elem.scrollTop === elem.scrollHeight - elem.clientHeight) { 7578 elem.scrollTop = elem.scrollHeight - elem.clientHeight - 1; 7579 } 7580 } 7581 elem.allowUp = elem.scrollTop > 0; 7582 elem.allowDown = elem.scrollTop < elem.scrollHeight - elem.clientHeight; 7583 elem.lastY = event.originalEvent.pageY; 7584 } 7585 }, { 7586 key: '_stopScrollPropagation', 7587 value: function _stopScrollPropagation(event) { 7588 var elem = this; // called from event handler context with this as elem 7589 var up = event.pageY < elem.lastY; 7590 var down = !up; 7591 elem.lastY = event.pageY; 7592 7593 if (up && elem.allowUp || down && elem.allowDown) { 7594 event.stopPropagation(); 7595 } else { 7596 event.preventDefault(); 7597 } 7598 } 7599 7600 /** 7601 * Opens the off-canvas menu. 7602 * @function 7603 * @param {Object} event - Event object passed from listener. 7604 * @param {jQuery} trigger - element that triggered the off-canvas to open. 7605 * @fires OffCanvas#opened 7606 */ 7607 7608 }, { 7609 key: 'open', 7610 value: function open(event, trigger) { 7611 if (this.$element.hasClass('is-open') || this.isRevealed) { 7612 return; 7613 } 7614 var _this = this; 7615 7616 if (trigger) { 7617 this.$lastTrigger = trigger; 7618 } 7619 7620 if (this.options.forceTo === 'top') { 7621 window.scrollTo(0, 0); 7622 } else if (this.options.forceTo === 'bottom') { 7623 window.scrollTo(0, document.body.scrollHeight); 7624 } 7625 7626 if (this.options.transitionTime && this.options.transition !== 'overlap') { 7627 this.$element.siblings('[data-off-canvas-content]').css('transition-duration', this.options.transitionTime); 7628 } else { 7629 this.$element.siblings('[data-off-canvas-content]').css('transition-duration', ''); 7630 } 7631 7632 /** 7633 * Fires when the off-canvas menu opens. 7634 * @event OffCanvas#opened 7635 */ 7636 this.$element.addClass('is-open').removeClass('is-closed'); 7637 7638 this.$triggers.attr('aria-expanded', 'true'); 7639 this.$element.attr('aria-hidden', 'false').trigger('opened.zf.offcanvas'); 7640 7641 this.$content.addClass('is-open-' + this.position); 7642 7643 // If `contentScroll` is set to false, add class and disable scrolling on touch devices. 7644 if (this.options.contentScroll === false) { 7645 (0, _jquery2.default)('body').addClass('is-off-canvas-open').on('touchmove', this._stopScrolling); 7646 this.$element.on('touchstart', this._recordScrollable); 7647 this.$element.on('touchmove', this._stopScrollPropagation); 7648 } 7649 7650 if (this.options.contentOverlay === true) { 7651 this.$overlay.addClass('is-visible'); 7652 } 7653 7654 if (this.options.closeOnClick === true && this.options.contentOverlay === true) { 7655 this.$overlay.addClass('is-closable'); 7656 } 7657 7658 if (this.options.autoFocus === true) { 7659 this.$element.one((0, _foundationUtil3.transitionend)(this.$element), function () { 7660 if (!_this.$element.hasClass('is-open')) { 7661 return; // exit if prematurely closed 7662 } 7663 var canvasFocus = _this.$element.find('[data-autofocus]'); 7664 if (canvasFocus.length) { 7665 canvasFocus.eq(0).focus(); 7666 } else { 7667 _this.$element.find('a, button').eq(0).focus(); 7668 } 7669 }); 7670 } 7671 7672 if (this.options.trapFocus === true) { 7673 this.$content.attr('tabindex', '-1'); 7674 _foundationUtil.Keyboard.trapFocus(this.$element); 7675 } 7676 7677 this._addContentClasses(); 7678 } 7679 7680 /** 7681 * Closes the off-canvas menu. 7682 * @function 7683 * @param {Function} cb - optional cb to fire after closure. 7684 * @fires OffCanvas#closed 7685 */ 7686 7687 }, { 7688 key: 'close', 7689 value: function close(cb) { 7690 if (!this.$element.hasClass('is-open') || this.isRevealed) { 7691 return; 7692 } 7693 7694 var _this = this; 7695 7696 this.$element.removeClass('is-open'); 7697 7698 this.$element.attr('aria-hidden', 'true') 7699 /** 7700 * Fires when the off-canvas menu opens. 7701 * @event OffCanvas#closed 7702 */ 7703 .trigger('closed.zf.offcanvas'); 7704 7705 this.$content.removeClass('is-open-left is-open-top is-open-right is-open-bottom'); 7706 7707 // If `contentScroll` is set to false, remove class and re-enable scrolling on touch devices. 7708 if (this.options.contentScroll === false) { 7709 (0, _jquery2.default)('body').removeClass('is-off-canvas-open').off('touchmove', this._stopScrolling); 7710 this.$element.off('touchstart', this._recordScrollable); 7711 this.$element.off('touchmove', this._stopScrollPropagation); 7712 } 7713 7714 if (this.options.contentOverlay === true) { 7715 this.$overlay.removeClass('is-visible'); 7716 } 7717 7718 if (this.options.closeOnClick === true && this.options.contentOverlay === true) { 7719 this.$overlay.removeClass('is-closable'); 7720 } 7721 7722 this.$triggers.attr('aria-expanded', 'false'); 7723 7724 if (this.options.trapFocus === true) { 7725 this.$content.removeAttr('tabindex'); 7726 _foundationUtil.Keyboard.releaseFocus(this.$element); 7727 } 7728 7729 // Listen to transitionEnd and add class when done. 7730 this.$element.one((0, _foundationUtil3.transitionend)(this.$element), function (e) { 7731 _this.$element.addClass('is-closed'); 7732 _this._removeContentClasses(); 7733 }); 7734 } 7735 7736 /** 7737 * Toggles the off-canvas menu open or closed. 7738 * @function 7739 * @param {Object} event - Event object passed from listener. 7740 * @param {jQuery} trigger - element that triggered the off-canvas to open. 7741 */ 7742 7743 }, { 7744 key: 'toggle', 7745 value: function toggle(event, trigger) { 7746 if (this.$element.hasClass('is-open')) { 7747 this.close(event, trigger); 7748 } else { 7749 this.open(event, trigger); 7750 } 7751 } 7752 7753 /** 7754 * 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. 7755 * @function 7756 * @private 7757 */ 7758 7759 }, { 7760 key: '_handleKeyboard', 7761 value: function _handleKeyboard(e) { 7762 var _this4 = this; 7763 7764 _foundationUtil.Keyboard.handleKey(e, 'OffCanvas', { 7765 close: function close() { 7766 _this4.close(); 7767 _this4.$lastTrigger.focus(); 7768 return true; 7769 }, 7770 handled: function handled() { 7771 e.stopPropagation(); 7772 e.preventDefault(); 7773 } 7774 }); 7775 } 7776 7777 /** 7778 * Destroys the offcanvas plugin. 7779 * @function 7780 */ 7781 7782 }, { 7783 key: '_destroy', 7784 value: function _destroy() { 7785 this.close(); 7786 this.$element.off('.zf.trigger .zf.offcanvas'); 7787 this.$overlay.off('.zf.offcanvas'); 7788 } 7789 }]); 7790 7791 return OffCanvas; 7792}
7792(_foundation.Plugin); 7793 7794OffCanvas.defaults = { 7795 /** 7796 * Allow the user to click outside of the menu to close it. 7797 * @option 7798 * @type {boolean} 7799 * @default true 7800 */ 7801 closeOnClick: true, 7802 7803 /** 7804 * Adds an overlay on top of `[data-off-canvas-content]`. 7805 * @option 7806 * @type {boolean} 7807 * @default true 7808 */ 7809 contentOverlay: true, 7810 7811 /** 7812 * Target an off-canvas content container by ID that may be placed anywhere. If null the closest content container will be taken. 7813 * @option 7814 * @type {?string} 7815 * @default null 7816 */ 7817 contentId: null, 7818 7819 /** 7820 * Define the off-canvas element is nested in an off-canvas content. This is required when using the contentId option for a nested element. 7821 * @option 7822 * @type {boolean} 7823 * @default null 7824 */ 7825 nested: null, 7826 7827 /** 7828 * Enable/disable scrolling of the main content when an off canvas panel is open. 7829 * @option 7830 * @type {boolean} 7831 * @default true 7832 */ 7833 contentScroll: true, 7834 7835 /** 7836 * Amount of time in ms the open and close transition requires. If none selected, pulls from body style. 7837 * @option 7838 * @type {number} 7839 * @default null 7840 */ 7841 transitionTime: null, 7842 7843 /** 7844 * Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'. 7845 * @option 7846 * @type {string} 7847 * @default push 7848 */ 7849 transition: 'push', 7850 7851 /** 7852 * Force the page to scroll to top or bottom on open. 7853 * @option 7854 * @type {?string} 7855 * @default null 7856 */ 7857 forceTo: null, 7858 7859 /** 7860 * Allow the offcanvas to remain open for certain breakpoints. 7861 * @option 7862 * @type {boolean} 7863 * @default false 7864 */ 7865 isRevealed: false, 7866 7867 /** 7868 * Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option. 7869 * @option 7870 * @type {?string} 7871 * @default null 7872 */ 7873 revealOn: null, 7874 7875 /** 7876 * Force focus to the offcanvas on open. If true, will focus the opening trigger on close. 7877 * @option 7878 * @type {boolean} 7879 * @default true 7880 */ 7881 autoFocus: true, 7882 7883 /** 7884 * Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`. 7885 * @option 7886 * @type {string} 7887 * @default reveal-for- 7888 * @todo improve the regex testing for this. 7889 */ 7890 revealClass: 'reveal-for-', 7891 7892 /** 7893 * Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes. 7894 * @option 7895 * @type {boolean} 7896 * @default false 7897 */ 7898 trapFocus: false 7899}; 7900 7901exports.OffCanvas = OffCanvas; 7902 7903/***/ }), 7904/* 28 */ 7905/***/ (function(module, exports, __webpack_require__) { 7906 7907"use strict"; 7908 7909 7910Object.defineProperty(exports, "__esModule", { 7911 value: true 7912}); 7913exports.Orbit = undefined; 7914 7915var _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; }; }(); 7916 7917var _jquery = __webpack_require__(0); 7918 7919var _jquery2 = _interopRequireDefault(_jquery); 7920 7921var _foundationUtil = __webpack_require__(3); 7922 7923var _foundationUtil2 = __webpack_require__(6); 7924 7925var _foundationUtil3 = __webpack_require__(18); 7926 7927var _foundationUtil4 = __webpack_require__(8); 7928 7929var _foundationUtil5 = __webpack_require__(1); 7930 7931var _foundation = __webpack_require__(2); 7932 7933var _foundationUtil6 = __webpack_require__(10); 7934 7935function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 7936 7937function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7938 7939function _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; } 7940 7941function _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
7941onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 7942 7943/** 7944 * Orbit module. 7945 * @module foundation.orbit 7946 * @requires foundation.util.keyboard 7947 * @requires foundation.util.motion 7948 * @requires foundation.util.timer 7949 * @requires foundation.util.imageLoader 7950 * @requires foundation.util.touch 7951 */ 7952 7953var Orbit = function (_Plugin) { 7954 _inherits(Orbit, _Plugin); 7955 7956 function Orbit() { 7957 _classCallCheck(this, Orbit); 7958 7959 return _possibleConstructorReturn(this, (Orbit.__proto__ || Object.getPrototypeOf(Orbit)).apply(this, arguments)); 7960 } 7961 7962 _createClass(Orbit, [{ 7963 key: '_setup', 7964 7965 /** 7966 * Creates a new instance of an orbit carousel. 7967 * @class 7968 * @name Orbit 7969 * @param {jQuery} element - jQuery object to make into an Orbit Carousel. 7970 * @param {Object} options - Overrides to the default plugin settings. 7971 */ 7972 value: function _setup(element, options) { 7973 this.$element = element; 7974 this.options = _jquery2.default.extend({}, Orbit.defaults, this.$element.data(), options); 7975 this.className = 'Orbit'; // ie9 back compat 7976 7977 _foundationUtil6.Touch.init(_jquery2.default); // Touch init is idempotent, we just need to make sure it's initialied. 7978 7979 this._init(); 7980 7981 _foundationUtil.Keyboard.register('Orbit', { 7982 'ltr': { 7983 'ARROW_RIGHT': 'next', 7984 'ARROW_LEFT': 'previous' 7985 }, 7986 'rtl': { 7987 'ARROW_LEFT': 'next', 7988 'ARROW_RIGHT': 'previous' 7989 } 7990 }); 7991 } 7992 7993 /** 7994 * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation. 7995 * @function 7996 * @private 7997 */ 7998 7999 }, { 8000 key: '_init', 8001 value: function _init() { 8002 // @TODO: consider discussion on PR #9278 about DOM pollution by changeSlide 8003 this._reset(); 8004 8005 this.$wrapper = this.$element.find('.' + this.options.containerClass); 8006 this.$slides = this.$element.find('.' + this.options.slideClass); 8007 8008 var $images = this.$element.find('img'), 8009 initActive = this.$slides.filter('.is-active'), 8010 id = this.$element[0].id || (0, _foundationUtil5.GetYoDigits)(6, 'orbit'); 8011 8012 this.$element.attr({ 8013 'data-resize': id, 8014 'id': id 8015 }); 8016 8017 if (!initActive.length) { 8018 this.$slides.eq(0).addClass('is-active'); 8019 } 8020 8021 if (!this.options.useMUI) { 8022 this.$slides.addClass('no-motionui'); 8023 } 8024 8025 if ($images.length) { 8026 (0, _foundationUtil4.onImagesLoaded)($images, this._prepareForOrbit.bind(this)); 8027 } else { 8028 this._prepareForOrbit(); //hehe 8029 } 8030 8031 if (this.options.bullets) { 8032 this._loadBullets(); 8033 } 8034 8035 this._events(); 8036 8037 if (this.options.autoPlay && this.$slides.length > 1) { 8038 this.geoSync(); 8039 } 8040 8041 if (this.options.accessible) { 8042 // allow wrapper to be focusable to enable arrow navigation 8043 this.$wrapper.attr('tabindex', 0); 8044 } 8045 } 8046 8047 /** 8048 * Creates a jQuery collection of bullets, if they are being used. 8049 * @function 8050 * @private 8051 */ 8052 8053 }, { 8054 key: '_loadBullets', 8055 value: function _loadBullets() { 8056 this.$bullets = this.$element.find('.' + this.options.boxOfBullets).find('button'); 8057 } 8058 8059 /** 8060 * Sets a `timer` object on the orbit, and starts the counter for the next slide. 8061 * @function 8062 */ 8063 8064 }, { 8065 key: 'geoSync', 8066 value: function geoSync() { 8067 var _this = this; 8068 this.timer = new _foundationUtil3.Timer(this.$element, { 8069 duration: this.options.timerDelay, 8070 infinite: false 8071 }, function () { 8072 _this.changeSlide(true); 8073 }); 8074 this.timer.start(); 8075 } 8076 8077 /** 8078 * Sets wrapper and slide heights for the orbit. 8079 * @function 8080 * @private 8081 */ 8082 8083 }, { 8084 key: '_prepareForOrbit', 8085 value: function _prepareForOrbit() { 8086 var _this = this; 8087 this._setWrapperHeight(); 8088 } 8089 8090 /** 8091 * Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height. 8092 * @function 8093 * @private 8094 * @param {Function} cb - a callback function to fire when complete. 8095 */ 8096 8097 }, { 8098 key: '_setWrapperHeight', 8099 value: function _setWrapperHeight(cb) { 8100 //rewrite this to `for` loop 8101 var max = 0, 8102 temp, 8103 counter = 0, 8104 _this = this; 8105 8106 this.$slides.each(function () { 8107 temp = this.getBoundingClientRect().height;
vendor: 4,308 bytes, lines 8108-8234
8108 (0, _jquery2.default)(this).attr('data-slide', counter); 8109 8110 if (_this.$slides.filter('.is-active')[0] !== _this.$slides.eq(counter)[0]) { 8111 //if not the active slide, set css position and display property 8112 (0, _jquery2.default)(this).css({ 'position': 'relative', 'display': 'none' }); 8113 } 8114 max = temp > max ? temp : max; 8115 counter++; 8116 }); 8117 8118 if (counter === this.$slides.length) { 8119 this.$wrapper.css({ 'height': max }); //only change the wrapper height property once. 8120 if (cb) { 8121 cb(max); 8122 } //fire callback with max height dimension. 8123 } 8124 } 8125 8126 /** 8127 * Sets the max-height of each slide. 8128 * @function 8129 * @private 8130 */ 8131 8132 }, { 8133 key: '_setSlideHeight', 8134 value: function _setSlideHeight(height) { 8135 this.$slides.each(function () { 8136 (0, _jquery2.default)(this).css('max-height', height); 8137 }); 8138 } 8139 8140 /** 8141 * Adds event listeners to basically everything within the element. 8142 * @function 8143 * @private 8144 */ 8145 8146 }, { 8147 key: '_events', 8148 value: function _events() { 8149 var _this = this; 8150 8151 //*************************************** 8152 //**Now using custom event - thanks to:** 8153 //** Yohai Ararat of Toronto ** 8154 //*************************************** 8155 // 8156 this.$element.off('.resizeme.zf.trigger').on({ 8157 'resizeme.zf.trigger': this._prepareForOrbit.bind(this) 8158 }); 8159 if (this.$slides.length > 1) { 8160 8161 if (this.options.swipe) { 8162 this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit').on('swipeleft.zf.orbit', function (e) { 8163 e.preventDefault(); 8164 _this.changeSlide(true); 8165 }).on('swiperight.zf.orbit', function (e) { 8166 e.preventDefault(); 8167 _this.changeSlide(false); 8168 }); 8169 } 8170 //*************************************** 8171 8172 if (this.options.autoPlay) { 8173 this.$slides.on('click.zf.orbit', function () { 8174 _this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true); 8175 _this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start'](); 8176 }); 8177 8178 if (this.options.pauseOnHover) { 8179 this.$element.on('mouseenter.zf.orbit', function () { 8180 _this.timer.pause(); 8181 }).on('mouseleave.zf.orbit', function () { 8182 if (!_this.$element.data('clickedOn')) { 8183 _this.timer.start(); 8184 } 8185 }); 8186 } 8187 } 8188 8189 if (this.options.navButtons) { 8190 var $controls = this.$element.find('.' + this.options.nextClass + ', .' + this.options.prevClass); 8191 $controls.attr('tabindex', 0) 8192 //also need to handle enter/return and spacebar key presses 8193 .on('click.zf.orbit touchend.zf.orbit', function (e) { 8194 e.preventDefault(); 8195 _this.changeSlide((0, _jquery2.default)(this).hasClass(_this.options.nextClass)); 8196 }); 8197 } 8198 8199 if (this.options.bullets) { 8200 this.$bullets.on('click.zf.orbit touchend.zf.orbit', function () { 8201 if (/is-active/g.test(this.className)) { 8202 return false; 8203 } //if this is active, kick out of function. 8204 var idx = (0, _jquery2.default)(this).data('slide'), 8205 ltr = idx > _this.$slides.filter('.is-active').data('slide'), 8206 $slide = _this.$slides.eq(idx); 8207 8208 _this.changeSlide(ltr, $slide, idx); 8209 }); 8210 } 8211 8212 if (this.options.accessible) { 8213 this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function (e) { 8214 // handle keyboard event with keyboard util 8215 _foundationUtil.Keyboard.handleKey(e, 'Orbit', { 8216 next: function next() { 8217 _this.changeSlide(true); 8218 }, 8219 previous: function previous() { 8220 _this.changeSlide(false); 8221 }, 8222 handled: function handled() { 8223 // if bullet is focused, make sure focus moves 8224 if ((0, _jquery2.default)(e.target).is(_this.$bullets)) { 8225 _this.$bullets.filter('.is-active').focus(); 8226 } 8227 } 8228 }); 8229 }); 8230 } 8231 } 8232 } 8233 8234 /**
8235 * Resets Orbit so it can be reinitialized 8236 */ 8237 8238 }, { 8239 key: '_reset', 8240 value: function _reset() { 8241 // Don't do anything if there are no slides (first run) 8242 if (typeof this.$slides == 'undefined') { 8243 return; 8244 } 8245 8246 if (this.$slides.length > 1) { 8247 // Remove old events 8248 this.$element.off('.zf.orbit').find('*').off('.zf.orbit'); 8249 8250 // Restart timer if autoPlay is enabled 8251 if (this.options.autoPlay) { 8252 this.timer.restart(); 8253 } 8254 8255 // Reset all sliddes 8256 this.$slides.each(function (el) { 8257 (0, _jquery2.default)(el).removeClass('is-active is-active is-in').removeAttr('aria-live').hide(); 8258 }); 8259 8260 // Show the first slide 8261 this.$slides.first().addClass('is-active').show(); 8262 8263 // Triggers when the slide has finished animating 8264 this.$element.trigger('slidechange.zf.orbit', [this.$slides.first()]); 8265 8266 // Select first bullet if bullets are present 8267 if (this.options.bullets) { 8268 this._updateBullets(0); 8269 } 8270 } 8271 } 8272 8273 /** 8274 * Changes the current slide to a new one. 8275 * @function 8276 * @param {Boolean} isLTR - flag if the slide should move left to right. 8277 * @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected. 8278 * @param {Number} idx - the index of the new slide in its collection, if one chosen. 8279 * @fires Orbit#slidechange 8280 */ 8281 8282 }, { 8283 key: 'changeSlide', 8284 value: function changeSlide(isLTR, chosenSlide, idx) { 8285 if (!this.$slides) { 8286 return; 8287 } // Don't freak out if we're in the middle of cleanup 8288 var $curSlide = this.$slides.filter('.is-active').eq(0); 8289 8290 if (/mui/g.test($curSlide[0].className)) { 8291 return false; 8292 } //if the slide is currently animating, kick out of the function 8293 8294 var $firstSlide = this.$slides.first(), 8295 $lastSlide = this.$slides.last(), 8296 dirIn = isLTR ? 'Right' : 'Left', 8297 dirOut = isLTR ? 'Left' : 'Right', 8298 _this = this, 8299 $newSlide; 8300 8301 if (!chosenSlide) { 8302 //most of the time, this will be auto played or clicked from the navButtons. 8303 $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!!!!! 8304 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 8305 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 8306 } else { 8307 $newSlide = chosenSlide; 8308 } 8309 8310 if ($newSlide.length) { 8311 /** 8312 * Triggers before the next slide starts animating in and only if a next slide has been found. 8313 * @event Orbit#beforeslidechange 8314 */ 8315 this.$element.trigger('beforeslidechange.zf.orbit', [$curSlide, $newSlide]); 8316 8317 if (this.options.bullets) { 8318 idx = idx || this.$slides.index($newSlide); //grab index to update bullets 8319 this._updateBullets(idx); 8320 } 8321 8322 if (this.options.useMUI && !this.$element.is(':hidden')) { 8323 _foundationUtil2.Motion.animateIn($newSlide.addClass('is-active').css({ 'position': 'absolute', 'top': 0 }), this.options['animInFrom' + dirIn], function () { 8324 $newSlide.css({ 'position': 'relative', 'display': 'block' }).attr('aria-live', 'polite'); 8325 }); 8326 8327 _foundationUtil2.Motion.animateOut($curSlide.removeClass('is-active'), this.options['animOutTo' + dirOut], function () { 8328 $curSlide.removeAttr('aria-live'); 8329 if (_this.options.autoPlay && !_this.timer.isPaused) { 8330 _this.timer.restart(); 8331 } 8332 //do stuff? 8333 }); 8334 } else { 8335 $curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide(); 8336 $newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show(); 8337 if (this.options.autoPlay && !this.timer.isPaused) { 8338 this.timer.restart(); 8339 } 8340 } 8341 /** 8342 * Triggers when the slide has finished animating in. 8343 * @event Orbit#slidechange 8344 */
8345 this.$element.trigger('slidechange.zf.orbit', [$newSlide]); 8346 } 8347 } 8348 8349 /** 8350 * Updates the active state of the bullets, if displayed. 8351 * @function 8352 * @private 8353 * @param {Number} idx - the index of the current slide. 8354 */ 8355 8356 }, { 8357 key: '_updateBullets', 8358 value: function _updateBullets(idx) { 8359 var $oldBullet = this.$element.find('.' + this.options.boxOfBullets).find('.is-active').removeClass('is-active').blur(), 8360 span = $oldBullet.find('span:last').detach(), 8361 $newBullet = this.$bullets.eq(idx).addClass('is-active').append(span); 8362 } 8363 8364 /** 8365 * Destroys the carousel and hides the element. 8366 * @function 8367 */ 8368 8369 }, { 8370 key: '_destroy', 8371 value: function _destroy() { 8372 this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide(); 8373 } 8374 }]); 8375 8376 return Orbit; 8377}(_foundation.Plugin); 8378 8379Orbit.defaults = { 8380 /** 8381 * Tells the JS to look for and loadBullets. 8382 * @option 8383 * @type {boolean} 8384 * @default true 8385 */ 8386 bullets: true, 8387 /** 8388 * Tells the JS to apply event listeners to nav buttons 8389 * @option 8390 * @type {boolean} 8391 * @default true 8392 */ 8393 navButtons: true, 8394 /** 8395 * motion-ui animation class to apply 8396 * @option 8397 * @type {string} 8398 * @default 'slide-in-right' 8399 */ 8400 animInFromRight: 'slide-in-right', 8401 /** 8402 * motion-ui animation class to apply 8403 * @option 8404 * @type {string} 8405 * @default 'slide-out-right' 8406 */ 8407 animOutToRight: 'slide-out-right', 8408 /** 8409 * motion-ui animation class to apply 8410 * @option 8411 * @type {string} 8412 * @default 'slide-in-left' 8413 * 8414 */ 8415 animInFromLeft: 'slide-in-left', 8416 /** 8417 * motion-ui animation class to apply 8418 * @option 8419 * @type {string} 8420 * @default 'slide-out-left' 8421 */ 8422 animOutToLeft: 'slide-out-left', 8423 /** 8424 * Allows Orbit to automatically animate on page load. 8425 * @option 8426 * @type {boolean} 8427 * @default true 8428 */ 8429 autoPlay: true, 8430 /** 8431 * Amount of time, in ms, between slide transitions 8432 * @option 8433 * @type {number} 8434 * @default 5000 8435 */ 8436 timerDelay: 5000, 8437 /** 8438 * Allows Orbit to infinitely loop through the slides 8439 * @option 8440 * @type {boolean} 8441 * @default true 8442 */ 8443 infiniteWrap: true, 8444 /** 8445 * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library 8446 * @option 8447 * @type {boolean} 8448 * @default true 8449 */ 8450 swipe: true, 8451 /** 8452 * Allows the timing function to pause animation on hover. 8453 * @option 8454 * @type {boolean} 8455 * @default true 8456 */ 8457 pauseOnHover: true, 8458 /** 8459 * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys 8460 * @option 8461 * @type {boolean} 8462 * @default true 8463 */ 8464 accessible: true, 8465 /** 8466 * Class applied to the container of Orbit 8467 * @option 8468 * @type {string} 8469 * @default 'orbit-container' 8470 */ 8471 containerClass: 'orbit-container', 8472 /** 8473 * Class applied to individual slides. 8474 * @option 8475 * @type {string} 8476 * @default 'orbit-slide' 8477 */ 8478 slideClass: 'orbit-slide', 8479 /** 8480 * Class applied to the bullet container. You're welcome. 8481 * @option 8482 * @type {string} 8483 * @default 'orbit-bullets' 8484 */ 8485 boxOfBullets: 'orbit-bullets', 8486 /** 8487 * Class applied to the `next` navigation button. 8488 * @option 8489 * @type {string} 8490 * @default 'orbit-next' 8491 */ 8492 nextClass: 'orbit-next', 8493 /** 8494 * Class applied to the `previous` navigation button. 8495 * @option 8496 * @type {string} 8497 * @default 'orbit-previous' 8498 */ 8499 prevClass: 'orbit-previous', 8500 /** 8501 * Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatability. 8502 * @option 8503 * @type {boolean} 8504 * @default true 8505 */ 8506 useMUI: true 8507}; 8508 8509exports.Orbit = Orbit; 8510 8511/***/ }), 8512/* 29 */ 8513/***/ (function(module, exports, __webpack_require__) { 8514 8515"use strict"; 8516 8517 8518Object.defineProperty(exports, "__esModule", { 8519 value: true 8520}); 8521exports.ResponsiveAccordionTabs = undefined; 8522 8523var _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; }; }(); 8524 8525var _jquery = __webpack_require__(0); 8526 8527var _jquery2 = _interopRequireDefault(_jquery); 8528 8529var _foundationUtil = __webpack_require__(4); 8530 8531var _foundationUtil2 = __webpack_require__(1); 8532 8533var _foundation = __webpack_require__(2); 8534 8535var _foundation2 = __webpack_require__(11); 8536 8537var _foundation3 = __webpack_require__(17); 8538 8539function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8540 8541function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8542 8543function _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; } 8544 8545function _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
8545onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8546 8547// The plugin matches the plugin classes with these plugin instances. 8548var MenuPlugins = { 8549 tabs: { 8550 cssClass: 'tabs', 8551 plugin: _foundation3.Tabs 8552 }, 8553 accordion: { 8554 cssClass: 'accordion', 8555 plugin: _foundation2.Accordion 8556 } 8557}; 8558 8559/** 8560 * ResponsiveAccordionTabs module. 8561 * @module foundation.responsiveAccordionTabs 8562 * @requires foundation.util.motion 8563 * @requires foundation.accordion 8564 * @requires foundation.tabs 8565 */ 8566 8567var ResponsiveAccordionTabs = function (_Plugin) { 8568 _inherits(ResponsiveAccordionTabs, _Plugin); 8569 8570 function ResponsiveAccordionTabs() { 8571 _classCallCheck(this, ResponsiveAccordionTabs); 8572 8573 return _possibleConstructorReturn(this, (ResponsiveAccordionTabs.__proto__ || Object.getPrototypeOf(ResponsiveAccordionTabs)).apply(this, arguments)); 8574 } 8575 8576 _createClass(ResponsiveAccordionTabs, [{ 8577 key: '_setup', 8578 8579 /** 8580 * Creates a new instance of a responsive accordion tabs. 8581 * @class 8582 * @name ResponsiveAccordionTabs 8583 * @fires ResponsiveAccordionTabs#init 8584 * @param {jQuery} element - jQuery object to make into Responsive Accordion Tabs. 8585 * @param {Object} options - Overrides to the default plugin settings. 8586 */ 8587 value: function _setup(element, options) { 8588 this.$element = (0, _jquery2.default)(element); 8589 this.options = _jquery2.default.extend({}, this.$element.data(), options); 8590 this.rules = this.$element.data('responsive-accordion-tabs'); 8591 this.currentMq = null; 8592 this.currentPlugin = null; 8593 this.className = 'ResponsiveAccordionTabs'; // ie9 back compat 8594 if (!this.$element.attr('id')) { 8595 this.$element.attr('id', (0, _foundationUtil2.GetYoDigits)(6, 'responsiveaccordiontabs')); 8596 }; 8597 8598 this._init(); 8599 this._events(); 8600 } 8601 8602 /** 8603 * Initializes the Menu by parsing the classes from the 'data-responsive-accordion-tabs' attribute on the element. 8604 * @function 8605 * @private 8606 */ 8607 8608 }, { 8609 key: '_init', 8610 value: function _init() { 8611 _foundationUtil.MediaQuery._init(); 8612 8613 // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules 8614 if (typeof this.rules === 'string') { 8615 var rulesTree = {}; 8616 8617 // Parse rules from "classes" pulled from data attribute 8618 var rules = this.rules.split(' '); 8619 8620 // Iterate through every rule found 8621 for (var i = 0; i < rules.length; i++) { 8622 var rule = rules[i].split('-'); 8623 var ruleSize = rule.length > 1 ? rule[0] : 'small'; 8624 var rulePlugin = rule.length > 1 ? rule[1] : rule[0]; 8625 8626 if (MenuPlugins[rulePlugin] !== null) { 8627 rulesTree[ruleSize] = MenuPlugins[rulePlugin]; 8628 } 8629 } 8630 8631 this.rules = rulesTree; 8632 } 8633 8634 this._getAllOptions(); 8635 8636 if (!_jquery2.default.isEmptyObject(this.rules)) { 8637 this._checkMediaQueries(); 8638 } 8639 } 8640 }, { 8641 key: '_getAllOptions', 8642 value: function _getAllOptions() { 8643 //get all defaults and options 8644 var _this = this; 8645 _this.allOptions = {}; 8646 for (var key in MenuPlugins) { 8647 if (MenuPlugins.hasOwnProperty(key)) { 8648 var obj = MenuPlugins[key]; 8649 try { 8650 var dummyPlugin = (0, _jquery2.default)('<ul></ul>'); 8651 var tmpPlugin = new obj.plugin(dummyPlugin, _this.options); 8652 for (var keyKey in tmpPlugin.options) { 8653 if (tmpPlugin.options.hasOwnProperty(keyKey) && keyKey !== 'zfPlugin') { 8654 var objObj = tmpPlugin.options[keyKey]; 8655 _this.allOptions[keyKey] = objObj; 8656 } 8657 } 8658 tmpPlugin.destroy(); 8659 } catch (e) {} 8660 } 8661 } 8662 } 8663 8664 /** 8665 * Initializes events for the Menu. 8666 * @function 8667 * @private 8668 */ 8669 8670 }, { 8671 key: '_events', 8672 value: function _events() { 8673 var _this = this; 8674 8675 (0, _jquery2.default)(window).on('changed.zf.mediaquery', function () { 8676 _this._checkMediaQueries(); 8677 }); 8678 } 8679 8680 /** 8681 * 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. 8682 * @function 8683 * @private 8684 */ 8685 8686 }, { 8687 key: '_checkMediaQueries', 8688 value: function _checkMediaQueries() { 8689 var matchedMq, 8690 _this = this; 8691 // Iterate through each rule and find the last matching rule 8692 _jquery2.default.each(this.rules, function (key) { 8693 if (_foundationUtil.MediaQuery.atLeast(key)) { 8694 matchedMq = key; 8695 } 8696 }); 8697 8698 // No match? No dice 8699 if (!matchedMq) return; 8700 8701 // Plugin already initialized? We good 8702 if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; 8703 8704 // Remove existing plugin-specific CSS classes 8705 _jquery2.default.each(MenuPlugins, function (key, value) { 8706 _this.$element.removeClass(value.cssClass); 8707 }); 8708 8709 // Add the CSS class for the new plugin 8710 this.$element.addClass(this.rules[matchedMq].cssClass); 8711 8712 // Create an instance of the new plugin 8713 if (this.currentPlugin) {
8714 //don't know why but on nested elements data zfPlugin get's lost 8715 if (!this.currentPlugin.$element.data('zfPlugin') && this.storezfData) this.currentPlugin.$element.data('zfPlugin', this.storezfData); 8716 this.currentPlugin.destroy(); 8717 } 8718 this._handleMarkup(this.rules[matchedMq].cssClass); 8719 this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {}); 8720 this.storezfData = this.currentPlugin.$element.data('zfPlugin'); 8721 } 8722 }, { 8723 key: '_handleMarkup', 8724 value: function _handleMarkup(toSet) { 8725 var _this = this, 8726 fromString = 'accordion'; 8727 var $panels = (0, _jquery2.default)('[data-tabs-content=' + this.$element.attr('id') + ']'); 8728 if ($panels.length) fromString = 'tabs'; 8729 if (fromString === toSet) { 8730 return; 8731 }; 8732 8733 var tabsTitle = _this.allOptions.linkClass ? _this.allOptions.linkClass : 'tabs-title'; 8734 var tabsPanel = _this.allOptions.panelClass ? _this.allOptions.panelClass : 'tabs-panel'; 8735 8736 this.$element.removeAttr('role'); 8737 var $liHeads = this.$element.children('.' + tabsTitle + ',[data-accordion-item]').removeClass(tabsTitle).removeClass('accordion-item').removeAttr('data-accordion-item'); 8738 var $liHeadsA = $liHeads.children('a').removeClass('accordion-title'); 8739 8740 if (fromString === 'tabs') { 8741 $panels = $panels.children('.' + tabsPanel).removeClass(tabsPanel).removeAttr('role').removeAttr('aria-hidden').removeAttr('aria-labelledby'); 8742 $panels.children('a').removeAttr('role').removeAttr('aria-controls').removeAttr('aria-selected'); 8743 } else { 8744 $panels = $liHeads.children('[data-tab-content]').removeClass('accordion-content'); 8745 }; 8746 8747 $panels.css({ display: '', visibility: '' }); 8748 $liHeads.css({ display: '', visibility: '' }); 8749 if (toSet === 'accordion') { 8750 $panels.each(function (key, value) { 8751 (0, _jquery2.default)(value).appendTo($liHeads.get(key)).addClass('accordion-content').attr('data-tab-content', '').removeClass('is-active').css({ height: '' }); 8752 (0, _jquery2.default)('[data-tabs-content=' + _this.$element.attr('id') + ']').after('<div id="tabs-placeholder-' + _this.$element.attr('id') + '"></div>').detach(); 8753 $liHeads.addClass('accordion-item').attr('data-accordion-item', ''); 8754 $liHeadsA.addClass('accordion-title'); 8755 }); 8756 } else if (toSet === 'tabs') { 8757 var $tabsContent = (0, _jquery2.default)('[data-tabs-content=' + _this.$element.attr('id') + ']'); 8758 var $placeholder = (0, _jquery2.default)('#tabs-placeholder-' + _this.$element.attr('id')); 8759 if ($placeholder.length) { 8760 $tabsContent = (0, _jquery2.default)('<div class="tabs-content"></div>').insertAfter($placeholder).attr('data-tabs-content', _this.$element.attr('id')); 8761 $placeholder.remove(); 8762 } else { 8763 $tabsContent = (0, _jquery2.default)('<div class="tabs-content"></div>').insertAfter(_this.$element).attr('data-tabs-content', _this.$element.attr('id')); 8764 }; 8765 $panels.each(function (key, value) { 8766 var tempValue = (0, _jquery2.default)(value).appendTo($tabsContent).addClass(tabsPanel); 8767 var hash = $liHeadsA.get(key).hash.slice(1); 8768 var id = (0, _jquery2.default)(value).attr('id') || (0, _foundationUtil2.GetYoDigits)(6, 'accordion'); 8769 if (hash !== id) { 8770 if (hash !== '') { 8771 (0, _jquery2.default)(value).attr('id', hash); 8772 } else { 8773 hash = id; 8774 (0, _jquery2.default)(value).attr('id', hash); 8775 (0, _jquery2.default)($liHeadsA.get(key)).attr('href', (0, _jquery2.default)($liHeadsA.get(key)).attr('href').replace('#', '') + '#' + hash); 8776 }; 8777 }; 8778 var isActive = (0, _jquery2.default)($liHeads.get(key)).hasClass('is-active'); 8779 if (isActive) { 8780 tempValue.addClass('is-active'); 8781 }; 8782 }); 8783 $liHeads.addClass(tabsTitle); 8784 }; 8785 } 8786 8787 /** 8788 * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out. 8789 * @function 8790 */ 8791 8792 }, { 8793 key: '_destroy', 8794 value: function _destroy() { 8795 if (this.currentPlugin) this.currentPlugin.destroy(); 8796 (0, _jquery2.default)(window).off('.zf.ResponsiveAccordionTabs'); 8797 } 8798 }]); 8799 8800 return ResponsiveAccordionTabs; 8801}
8801(_foundation.Plugin); 8802 8803ResponsiveAccordionTabs.defaults = {}; 8804 8805exports.ResponsiveAccordionTabs = ResponsiveAccordionTabs; 8806 8807/***/ }), 8808/* 30 */ 8809/***/ (function(module, exports, __webpack_require__) { 8810 8811"use strict"; 8812 8813 8814Object.defineProperty(exports, "__esModule", { 8815 value: true 8816}); 8817exports.ResponsiveMenu = undefined; 8818 8819var _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; }; }(); 8820 8821var _jquery = __webpack_require__(0); 8822 8823var _jquery2 = _interopRequireDefault(_jquery); 8824 8825var _foundationUtil = __webpack_require__(4); 8826 8827var _foundationUtil2 = __webpack_require__(1); 8828 8829var _foundation = __webpack_require__(2); 8830 8831var _foundation2 = __webpack_require__(14); 8832 8833var _foundation3 = __webpack_require__(13); 8834 8835var _foundation4 = __webpack_require__(12); 8836 8837function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8838 8839function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8840 8841function _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; } 8842 8843function _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; } 8844 8845var MenuPlugins = { 8846 dropdown: { 8847 cssClass: 'dropdown', 8848 plugin: _foundation2.DropdownMenu 8849 }, 8850 drilldown: { 8851 cssClass: 'drilldown', 8852 plugin: _foundation3.Drilldown 8853 }, 8854 accordion: { 8855 cssClass: 'accordion-menu', 8856 plugin: _foundation4.AccordionMenu 8857 } 8858}; 8859 8860// import "foundation.util.triggers.js"; 8861 8862 8863/** 8864 * ResponsiveMenu module. 8865 * @module foundation.responsiveMenu 8866 * @requires foundation.util.triggers 8867 * @requires foundation.util.mediaQuery 8868 */ 8869 8870var ResponsiveMenu = function (_Plugin) { 8871 _inherits(ResponsiveMenu, _Plugin); 8872 8873 function ResponsiveMenu() { 8874 _classCallCheck(this, ResponsiveMenu); 8875 8876 return _possibleConstructorReturn(this, (ResponsiveMenu.__proto__ || Object.getPrototypeOf(ResponsiveMenu)).apply(this, arguments)); 8877 } 8878 8879 _createClass(ResponsiveMenu, [{ 8880 key: '_setup', 8881 8882 /** 8883 * Creates a new instance of a responsive menu. 8884 * @class 8885 * @name ResponsiveMenu 8886 * @fires ResponsiveMenu#init 8887 * @param {jQuery} element - jQuery object to make into a dropdown menu. 8888 * @param {Object} options - Overrides to the default plugin settings. 8889 */ 8890 value: function _setup(element, options) { 8891 this.$element = (0, _jquery2.default)(element); 8892 this.rules = this.$element.data('responsive-menu'); 8893 this.currentMq = null; 8894 this.currentPlugin = null; 8895 this.className = 'ResponsiveMenu'; // ie9 back compat 8896 8897 this._init(); 8898 this._events(); 8899 } 8900 8901 /** 8902 * Initializes the Menu by parsing the classes from the 'data-ResponsiveMenu' attribute on the element. 8903 * @function 8904 * @private 8905 */ 8906 8907 }, { 8908 key: '_init', 8909 value: function _init() { 8910 8911 _foundationUtil.MediaQuery._init(); 8912 // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules 8913 if (typeof this.rules === 'string') { 8914 var rulesTree = {}; 8915 8916 // Parse rules from "classes" pulled from data attribute 8917 var rules = this.rules.split(' '); 8918 8919 // Iterate through every rule found 8920 for (var i = 0; i < rules.length; i++) { 8921 var rule = rules[i].split('-'); 8922 var ruleSize = rule.length > 1 ? rule[0] : 'small'; 8923 var rulePlugin = rule.length > 1 ? rule[1] : rule[0]; 8924 8925 if (MenuPlugins[rulePlugin] !== null) { 8926 rulesTree[ruleSize] = MenuPlugins[rulePlugin]; 8927 } 8928 } 8929 8930 this.rules = rulesTree; 8931 } 8932 8933 if (!_jquery2.default.isEmptyObject(this.rules)) { 8934 this._checkMediaQueries(); 8935 } 8936 // Add data-mutate since children may need it. 8937 this.$element.attr('data-mutate', this.$element.attr('data-mutate') || (0, _foundationUtil2.GetYoDigits)(6, 'responsive-menu')); 8938 } 8939 8940 /** 8941 * Initializes events for the Menu. 8942 * @function 8943 * @private 8944 */ 8945 8946 }, { 8947 key: '_events', 8948 value: function _events() { 8949 var _this = this; 8950 8951 (0, _jquery2.default)(window).on('changed.zf.mediaquery', function () { 8952 _this._checkMediaQueries(); 8953 }); 8954 // $(window).on('resize.zf.ResponsiveMenu', function() { 8955 // _this._checkMediaQueries(); 8956 // }); 8957 } 8958 8959 /** 8960 * 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. 8961 * @function 8962 * @private 8963 */ 8964 8965 }, { 8966 key: '_checkMediaQueries', 8967 value: function _checkMediaQueries() { 8968 var matchedMq, 8969 _this = this; 8970 // Iterate through each rule and find the last matching rule 8971 _jquery2.default.each(this.rules, function (key) { 8972 if (_foundationUtil.MediaQuery.atLeast(key)) { 8973 matchedMq = key; 8974 } 8975 }); 8976 8977 // No match? No dice 8978 if (!matchedMq) return; 8979 8980 // Plugin already initialized? We good 8981 if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; 8982 8983 // Remove existing plugin-specific CSS classes 8984 _jquery2.default.each(MenuPlugins, function (key, value) { 8985 _this.$element.removeClass(value.cssClass); 8986 }); 8987 8988 // Add the CSS class for the new plugin 8989 this.$element.addClass(this.rules[matchedMq].cssClass); 8990 8991 // Create an instance of the new plugin 8992 if (this.currentPlugin) this.currentPlugin.destroy(); 8993 this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {}); 8994 } 8995 8996 /** 8997 * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out. 8998 * @function 8999 */ 9000 9001 }, { 9002 key: '_destroy', 9003 value: function _destroy() { 9004 this.currentPlugin.destroy(); 9005 (0, _jquery2.default)(window).off('.zf.ResponsiveMenu'); 9006 } 9007 }]); 9008 9009 return ResponsiveMenu; 9010}
9010(_foundation.Plugin); 9011 9012ResponsiveMenu.defaults = {}; 9013 9014exports.ResponsiveMenu = ResponsiveMenu; 9015 9016/***/ }), 9017/* 31 */ 9018/***/ (function(module, exports, __webpack_require__) { 9019 9020"use strict"; 9021 9022 9023Object.defineProperty(exports, "__esModule", { 9024 value: true 9025}); 9026exports.ResponsiveToggle = undefined; 9027 9028var _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; }; }(); 9029 9030var _jquery = __webpack_require__(0); 9031 9032var _jquery2 = _interopRequireDefault(_jquery); 9033 9034var _foundationUtil = __webpack_require__(4); 9035 9036var _foundationUtil2 = __webpack_require__(6); 9037 9038var _foundation = __webpack_require__(2); 9039 9040function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 9041 9042function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9043 9044function _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; } 9045 9046function _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; } 9047 9048/** 9049 * ResponsiveToggle module. 9050 * @module foundation.responsiveToggle 9051 * @requires foundation.util.mediaQuery 9052 * @requires foundation.util.motion 9053 */ 9054 9055var ResponsiveToggle = function (_Plugin) { 9056 _inherits(ResponsiveToggle, _Plugin); 9057 9058 function ResponsiveToggle() { 9059 _classCallCheck(this, ResponsiveToggle); 9060 9061 return _possibleConstructorReturn(this, (ResponsiveToggle.__proto__ || Object.getPrototypeOf(ResponsiveToggle)).apply(this, arguments)); 9062 } 9063 9064 _createClass(ResponsiveToggle, [{ 9065 key: '_setup', 9066 9067 /** 9068 * Creates a new instance of Tab Bar. 9069 * @class 9070 * @name ResponsiveToggle 9071 * @fires ResponsiveToggle#init 9072 * @param {jQuery} element - jQuery object to attach tab bar functionality to. 9073 * @param {Object} options - Overrides to the default plugin settings. 9074 */ 9075 value: function _setup(element, options) { 9076 this.$element = (0, _jquery2.default)(element); 9077 this.options = _jquery2.default.extend({}, ResponsiveToggle.defaults, this.$element.data(), options); 9078 this.className = 'ResponsiveToggle'; // ie9 back compat 9079 9080 this._init(); 9081 this._events(); 9082 } 9083 9084 /** 9085 * Initializes the tab bar by finding the target element, toggling element, and running update(). 9086 * @function 9087 * @private 9088 */ 9089 9090 }, { 9091 key: '_init', 9092 value: function _init() { 9093 _foundationUtil.MediaQuery._init(); 9094 var targetID = this.$element.data('responsive-toggle'); 9095 if (!targetID) { 9096 console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.'); 9097 } 9098 9099 this.$targetMenu = (0, _jquery2.default)('#' + targetID); 9100 this.$toggler = this.$element.find('[data-toggle]').filter(function () { 9101 var target = (0, _jquery2.default)(this).data('toggle'); 9102 return target === targetID || target === ""; 9103 }); 9104 this.options = _jquery2.default.extend({}, this.options, this.$targetMenu.data()); 9105 9106 // If they were set, parse the animation classes 9107 if (this.options.animate) { 9108 var input = this.options.animate.split(' '); 9109 9110 this.animationIn = input[0]; 9111 this.animationOut = input[1] || null; 9112 } 9113 9114 this._update(); 9115 } 9116 9117 /** 9118 * Adds necessary event handlers for the tab bar to work. 9119 * @function 9120 * @private 9121 */ 9122 9123 }, { 9124 key: '_events', 9125 value: function _events() { 9126 var _this = this; 9127 9128 this._updateMqHandler = this._update.bind(this); 9129 9130 (0, _jquery2.default)(window).on('changed.zf.mediaquery', this._updateMqHandler); 9131 9132 this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this)); 9133 } 9134 9135 /** 9136 * Checks the current media query to determine if the tab bar should be visible or hidden. 9137 * @function 9138 * @private 9139 */ 9140 9141 }, { 9142 key: '_update', 9143 value: function _update() { 9144 // Mobile 9145 if (!_foundationUtil.MediaQuery.atLeast(this.options.hideFor)) { 9146 this.$element.show(); 9147 this.$targetMenu.hide(); 9148 } 9149 9150 // Desktop 9151 else { 9152 this.$element.hide(); 9153 this.$targetMenu.show(); 9154 } 9155 } 9156 9157 /** 9158 * Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it. 9159 * @function 9160 * @fires ResponsiveToggle#toggled 9161 */ 9162 9163 }, { 9164 key: 'toggleMenu', 9165 value: function toggleMenu() { 9166 var _this3 = this; 9167 9168 if (!_foundationUtil.MediaQuery.atLeast(this.options.hideFor)) { 9169 /** 9170 * Fires when the element attached to the tab bar toggles. 9171 * @event ResponsiveToggle#toggled 9172 */ 9173 if (this.options.animate) { 9174 if (this.$targetMenu.is(':hidden')) { 9175 _foundationUtil2.Motion.animateIn(this.$targetMenu, this.animationIn, function () { 9176 _this3.$element.trigger('toggled.zf.responsiveToggle'); 9177 _this3.$targetMenu.find('[data-mutate]').triggerHandler('mutateme.zf.trigger'); 9178 }); 9179 } else { 9180 _foundationUtil2.Motion.animateOut(this.$targetMenu, this.animationOut, function () { 9181 _this3.$element.trigger('toggled.zf.responsiveToggle'); 9182 }); 9183 } 9184 } else { 9185 this.$targetMenu.toggle(0); 9186 this.$targetMenu.find('[data-mutate]').trigger('mutateme.zf.trigger'); 9187 this.$element.trigger('toggled.zf.responsiveToggle'); 9188 } 9189 } 9190 } 9191 }, { 9192 key: '_destroy', 9193 value: function _destroy() { 9194 this.$element.off('.zf.responsiveToggle'); 9195 this.$toggler.off('.zf.responsiveToggle'); 9196 9197 (0, _jquery2.default)(window).off('changed.zf.mediaquery', this._updateMqHandler); 9198 } 9199 }]); 9200 9201 return ResponsiveToggle; 9202}
9202(_foundation.Plugin); 9203 9204ResponsiveToggle.defaults = { 9205 /** 9206 * The breakpoint after which the menu is always shown, and the tab bar is hidden. 9207 * @option 9208 * @type {string} 9209 * @default 'medium' 9210 */ 9211 hideFor: 'medium', 9212 9213 /** 9214 * To decide if the toggle should be animated or not. 9215 * @option 9216 * @type {boolean} 9217 * @default false 9218 */ 9219 animate: false 9220}; 9221 9222exports.ResponsiveToggle = ResponsiveToggle; 9223 9224/***/ }), 9225/* 32 */ 9226/***/ (function(module, exports, __webpack_require__) { 9227 9228"use strict"; 9229 9230 9231Object.defineProperty(exports, "__esModule", { 9232 value: true 9233}); 9234exports.Reveal = undefined; 9235 9236var _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; }; }(); 9237 9238var _jquery = __webpack_require__(0); 9239 9240var _jquery2 = _interopRequireDefault(_jquery); 9241 9242var _foundationUtil = __webpack_require__(3); 9243 9244var _foundationUtil2 = __webpack_require__(4); 9245 9246var _foundationUtil3 = __webpack_require__(6); 9247 9248var _foundation = __webpack_require__(2); 9249 9250var _foundationUtil4 = __webpack_require__(5); 9251 9252function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 9253 9254function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9255 9256function _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; } 9257 9258function _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; } 9259 9260/** 9261 * Reveal module. 9262 * @module foundation.reveal 9263 * @requires foundation.util.keyboard 9264 * @requires foundation.util.triggers 9265 * @requires foundation.util.mediaQuery 9266 * @requires foundation.util.motion if using animations 9267 */ 9268 9269var Reveal = function (_Plugin) { 9270 _inherits(Reveal, _Plugin); 9271 9272 function Reveal() { 9273 _classCallCheck(this, Reveal); 9274 9275 return _possibleConstructorReturn(this, (Reveal.__proto__ || Object.getPrototypeOf(Reveal)).apply(this, arguments)); 9276 } 9277 9278 _createClass(Reveal, [{ 9279 key: '_setup', 9280 9281 /** 9282 * Creates a new instance of Reveal. 9283 * @class 9284 * @name Reveal 9285 * @param {jQuery} element - jQuery object to use for the modal. 9286 * @param {Object} options - optional parameters. 9287 */ 9288 value: function _setup(element, options) { 9289 this.$element = element; 9290 this.options = _jquery2.default.extend({}, Reveal.defaults, this.$element.data(), options); 9291 this.className = 'Reveal'; // ie9 back compat 9292 this._init(); 9293 9294 // Triggers init is idempotent, just need to make sure it is initialized 9295 _foundationUtil4.Triggers.init(_jquery2.default); 9296 9297 _foundationUtil.Keyboard.register('Reveal', { 9298 'ESCAPE': 'close' 9299 }); 9300 } 9301 9302 /** 9303 * Initializes the modal by adding the overlay and close buttons, (if selected). 9304 * @private 9305 */ 9306 9307 }, { 9308 key: '_init', 9309 value: function _init() { 9310 _foundationUtil2.MediaQuery._init(); 9311 this.id = this.$element.attr('id'); 9312 this.isActive = false; 9313 this.cached = { mq: _foundationUtil2.MediaQuery.current }; 9314 this.isMobile = mobileSniff(); 9315 9316 this.$anchor = (0, _jquery2.default)('[data-open="' + this.id + '"]').length ? (0, _jquery2.default)('[data-open="' + this.id + '"]') : (0, _jquery2.default)('[data-toggle="' + this.id + '"]'); 9317 this.$anchor.attr({ 9318 'aria-controls': this.id, 9319 'aria-haspopup': true, 9320 'tabindex': 0 9321 }); 9322 9323 if (this.options.fullScreen || this.$element.hasClass('full')) { 9324 this.options.fullScreen = true;
9325 this.options.overlay = false; 9326 } 9327 if (this.options.overlay && !this.$overlay) { 9328 this.$overlay = this._makeOverlay(this.id); 9329 } 9330 9331 this.$element.attr({ 9332 'role': 'dialog', 9333 'aria-hidden': true, 9334 'data-yeti-box': this.id, 9335 'data-resize': this.id 9336 }); 9337 9338 if (this.$overlay) { 9339 this.$element.detach().appendTo(this.$overlay); 9340 } else { 9341 this.$element.detach().appendTo((0, _jquery2.default)(this.options.appendTo)); 9342 this.$element.addClass('without-overlay'); 9343 } 9344 this._events(); 9345 if (this.options.deepLink && window.location.hash === '#' + this.id) { 9346 (0, _jquery2.default)(window).one('load.zf.reveal', this.open.bind(this)); 9347 } 9348 } 9349 9350 /** 9351 * Creates an overlay div to display behind the modal. 9352 * @private 9353 */ 9354 9355 }, { 9356 key: '_makeOverlay', 9357 value: function _makeOverlay() { 9358 var additionalOverlayClasses = ''; 9359 9360 if (this.options.additionalOverlayClasses) { 9361 additionalOverlayClasses = ' ' + this.options.additionalOverlayClasses; 9362 } 9363 9364 return (0, _jquery2.default)('<div></div>').addClass('reveal-overlay' + additionalOverlayClasses).appendTo(this.options.appendTo); 9365 } 9366 9367 /** 9368 * Updates position of modal 9369 * TODO: Figure out if we actually need to cache these values or if it doesn't matter 9370 * @private 9371 */ 9372 9373 }, { 9374 key: '_updatePosition', 9375 value: function _updatePosition() { 9376 var width = this.$element.outerWidth(); 9377 var outerWidth = (0, _jquery2.default)(window).width(); 9378 var height = this.$element.outerHeight(); 9379 var outerHeight = (0, _jquery2.default)(window).height(); 9380 var left, top; 9381 if (this.options.hOffset === 'auto') { 9382 left = parseInt((outerWidth - width) / 2, 10); 9383 } else { 9384 left = parseInt(this.options.hOffset, 10); 9385 } 9386 if (this.options.vOffset === 'auto') { 9387 if (height > outerHeight) { 9388 top = parseInt(Math.min(100, outerHeight / 10), 10); 9389 } else { 9390 top = parseInt((outerHeight - height) / 4, 10); 9391 } 9392 } else { 9393 top = parseInt(this.options.vOffset, 10); 9394 } 9395 this.$element.css({ top: top + 'px' }); 9396 // only worry about left if we don't have an overlay or we havea horizontal offset, 9397 // otherwise we're perfectly in the middle 9398 if (!this.$overlay || this.options.hOffset !== 'auto') { 9399 this.$element.css({ left: left + 'px' }); 9400 this.$element.css({ margin: '0px' }); 9401 } 9402 } 9403 9404 /** 9405 * Adds event handlers for the modal. 9406 * @private 9407 */ 9408 9409 }, { 9410 key: '_events', 9411 value: function _events() { 9412 var _this3 = this; 9413 9414 var _this = this; 9415 9416 this.$element.on({ 9417 'open.zf.trigger': this.open.bind(this), 9418 'close.zf.trigger': function closeZfTrigger(event, $element) { 9419 if (event.target === _this.$element[0] || (0, _jquery2.default)(event.target).parents('[data-closable]')[0] === $element) { 9420 // only close reveal when it's explicitly called 9421 return _this3.close.apply(_this3); 9422 } 9423 }, 9424 'toggle.zf.trigger': this.toggle.bind(this), 9425 'resizeme.zf.trigger': function resizemeZfTrigger() { 9426 _this._updatePosition(); 9427 } 9428 }); 9429 9430 if (this.options.closeOnClick && this.options.overlay) { 9431 this.$overlay.off('.zf.reveal').on('click.zf.reveal', function (e) { 9432 if (e.target === _this.$element[0] || _jquery2.default.contains(_this.$element[0], e.target) || !_jquery2.default.contains(document, e.target)) { 9433 return; 9434 } 9435 _this.close(); 9436 }); 9437 } 9438 if (this.options.deepLink) { 9439 (0, _jquery2.default)(window).on('popstate.zf.reveal:' + this.id, this._handleState.bind(this)); 9440 } 9441 } 9442 9443 /** 9444 * Handles modal methods on back/forward button clicks or any other event that triggers popstate. 9445 * @private 9446 */ 9447 9448 }, { 9449 key: '_handleState', 9450 value: function _handleState(e) { 9451 if (window.location.hash === '#' + this.id && !this.isActive) { 9452 this.open(); 9453 } else { 9454 this.close(); 9455 } 9456 } 9457 9458 /** 9459 * Opens the modal controlled by `this.$anchor`, and closes all others by default. 9460 * @function 9461 * @fires Reveal#closeme 9462 * @fires Reveal#open 9463 */ 9464 9465 }, { 9466 key: 'open', 9467 value: function open() { 9468 var _this4 = this; 9469 9470 // either update or replace browser history 9471 if (this.options.deepLink) { 9472 var hash = '#' + this.id; 9473 9474 if (window.history.pushState) { 9475 if (this.options.updateHistory) { 9476 window.history.pushState({}, '', hash); 9477 } else { 9478 window.history.replaceState({}, '', hash); 9479 } 9480 } else { 9481 window.location.hash = hash; 9482 } 9483 } 9484 9485 this.isActive = true; 9486 9487 // Make elements invisible, but remove display: none so we can get size and positioning 9488 this.$element.css({ 'visibility': 'hidden' }).show().scrollTop(0); 9489 if (this.options.overlay) { 9490 this.$overlay.css({ 'visibility': 'hidden' }).show(); 9491 } 9492 9493 this._updatePosition(); 9494 9495 this.$element.hide().css({ 'visibility': '' }); 9496 9497 if (this.$overlay) { 9498 this.$overlay.css({ 'visibility': '' }).hide(); 9499 if (this.$element.hasClass('fast')) { 9500 this.$overlay.addClass('fast'); 9501 } else if (this.$element.hasClass('slow')) { 9502 this.$overlay.addClass('slow'); 9503 } 9504 } 9505 9506 if (!this.options.multipleOpened) { 9507 /** 9508 * Fires immediately before the modal opens. 9509 * Closes any other modals that are currently open 9510 * @event Reveal#closeme 9511 */ 9512 this.$element.trigger('closeme.zf.reveal', this.id); 9513 } 9514 9515 var _this = this; 9516 9517 function addRevealOpenClasses() { 9518 if (_this.isMobile) { 9519 if (!_this.originalScrollPos) { 9520 _this.originalScrollPos = window.pageYOffset; 9521 } 9522 (0, _jquery2.default)('html, body').addClass('is-reveal-open'); 9523 } else { 9524 (0, _jquery2.default)('body').addClass('is-reveal-open'); 9525 } 9526 } 9527 // Motion UI method of reveal 9528 if (this.options.animationIn) { 9529 var afterAnimation = function afterAnimation() { 9530 _this.$element.attr({ 9531 'aria-hidden': false, 9532 'tabindex': -1 9533 }).focus(); 9534 addRevealOpenClasses(); 9535 _foundationUtil.Keyboard.trapFocus(_this.$element); 9536 }; 9537 9538 if (this.options.overlay) { 9539 _foundationUtil3.Motion.animateIn(this.$overlay, 'fade-in'); 9540 } 9541 _foundationUtil3.Motion.animateIn(this.$element, this.options.animationIn, function () { 9542 if (_this4.$element) { 9543 // protect against object having been removed 9544 _this4.focusableElements = _foundationUtil.Keyboard.findFocusable(_this4.$element); 9545 afterAnimation(); 9546 } 9547 }); 9548 } 9549 // jQuery method of reveal 9550 else { 9551 if (this.options.overlay) { 9552 this.$overlay.show(0); 9553 } 9554 this.$element.show(this.options.showDelay); 9555 } 9556 9557 // handle accessibility 9558 this.$element.attr({ 9559 'aria-hidden': false, 9560 'tabindex': -1 9561 }).focus(); 9562 _foundationUtil.Keyboard.trapFocus(this.$element); 9563 9564 addRevealOpenClasses(); 9565 9566 this._extraHandlers(); 9567 9568 /** 9569 * Fires when the modal has successfully opened. 9570 * @event Reveal#open 9571 */ 9572 this.$element.trigger('open.zf.reveal'); 9573 } 9574 9575 /** 9576 * Adds extra event handlers for the body and window if necessary. 9577 * @private 9578 */ 9579 9580 }, { 9581 key: '_extraHandlers', 9582 value: function _extraHandlers() { 9583 var _this = this; 9584 if (!this.$element) { 9585 return; 9586 } // If we're in the middle of cleanup, don't freak out 9587 this.focusableElements = _foundationUtil.Keyboard.findFocusable(this.$element); 9588 9589 if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) { 9590 (0, _jquery2.default)('body').on('click.zf.reveal', function (e) { 9591 if (e.target === _this.$element[0] || _jquery2.default.contains(_this.$element[0], e.target) || !_jquery2.default.contains(document, e.target)) { 9592 return; 9593 } 9594 _this.close(); 9595 }); 9596 } 9597 9598 if (this.options.closeOnEsc) { 9599 (0, _jquery2.default)(window).on('keydown.zf.reveal', function (e) { 9600 _foundationUtil.Keyboard.handleKey(e, 'Reveal', { 9601 close: function close() { 9602 if (_this.options.closeOnEsc) { 9603 _this.close(); 9604 } 9605 } 9606 }); 9607 }); 9608 } 9609 } 9610 9611 /** 9612 * Closes the modal. 9613 * @function 9614 * @fires Reveal#closed 9615 */ 9616 9617 }, { 9618 key: 'close', 9619 value: function close() { 9620 if (!this.isActive || !this.$element.is(':visible')) { 9621 return false;
9622 } 9623 var _this = this; 9624 9625 // Motion UI method of hiding 9626 if (this.options.animationOut) { 9627 if (this.options.overlay) { 9628 _foundationUtil3.Motion.animateOut(this.$overlay, 'fade-out'); 9629 } 9630 9631 _foundationUtil3.Motion.animateOut(this.$element, this.options.animationOut, finishUp); 9632 } 9633 // jQuery method of hiding 9634 else { 9635 this.$element.hide(this.options.hideDelay); 9636 9637 if (this.options.overlay) { 9638 this.$overlay.hide(0, finishUp); 9639 } else { 9640 finishUp(); 9641 } 9642 } 9643 9644 // Conditionals to remove extra event listeners added on open 9645 if (this.options.closeOnEsc) { 9646 (0, _jquery2.default)(window).off('keydown.zf.reveal'); 9647 } 9648 9649 if (!this.options.overlay && this.options.closeOnClick) { 9650 (0, _jquery2.default)('body').off('click.zf.reveal'); 9651 } 9652 9653 this.$element.off('keydown.zf.reveal'); 9654 9655 function finishUp() { 9656 if (_this.isMobile) { 9657 if ((0, _jquery2.default)('.reveal:visible').length === 0) { 9658 (0, _jquery2.default)('html, body').removeClass('is-reveal-open'); 9659 } 9660 if (_this.originalScrollPos) { 9661 (0, _jquery2.default)('body').scrollTop(_this.originalScrollPos); 9662 _this.originalScrollPos = null; 9663 } 9664 } else { 9665 if ((0, _jquery2.default)('.reveal:visible').length === 0) { 9666 (0, _jquery2.default)('body').removeClass('is-reveal-open'); 9667 } 9668 } 9669 9670 _foundationUtil.Keyboard.releaseFocus(_this.$element); 9671 9672 _this.$element.attr('aria-hidden', true); 9673 9674 /** 9675 * Fires when the modal is done closing. 9676 * @event Reveal#closed 9677 */ 9678 _this.$element.trigger('closed.zf.reveal'); 9679 } 9680 9681 /** 9682 * Resets the modal content 9683 * This prevents a running video to keep going in the background 9684 */ 9685 if (this.options.resetOnClose) { 9686 this.$element.html(this.$element.html()); 9687 } 9688 9689 this.isActive = false; 9690 if (_this.options.deepLink) { 9691 if (window.history.replaceState) { 9692 window.history.replaceState('', document.title, window.location.href.replace('#' + this.id, '')); 9693 } else { 9694 window.location.hash = ''; 9695 } 9696 } 9697 9698 this.$anchor.focus(); 9699 } 9700 9701 /** 9702 * Toggles the open/closed state of a modal. 9703 * @function 9704 */ 9705 9706 }, { 9707 key: 'toggle', 9708 value: function toggle() { 9709 if (this.isActive) { 9710 this.close(); 9711 } else { 9712 this.open(); 9713 } 9714 } 9715 }, { 9716 key: '_destroy', 9717 9718 9719 /** 9720 * Destroys an instance of a modal. 9721 * @function 9722 */ 9723 value: function _destroy() { 9724 if (this.options.overlay) { 9725 this.$element.appendTo((0, _jquery2.default)(this.options.appendTo)); // move $element outside of $overlay to prevent error unregisterPlugin() 9726 this.$overlay.hide().off().remove(); 9727 } 9728 this.$element.hide().off(); 9729 this.$anchor.off('.zf'); 9730 (0, _jquery2.default)(window).off('.zf.reveal:' + this.id); 9731 } 9732 }]); 9733 9734 return Reveal; 9735}(_foundation.Plugin); 9736 9737Reveal.defaults = { 9738 /** 9739 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 9740 * @option 9741 * @type {string} 9742 * @default '' 9743 */ 9744 animationIn: '', 9745 /** 9746 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 9747 * @option 9748 * @type {string} 9749 * @default '' 9750 */ 9751 animationOut: '', 9752 /** 9753 * Time, in ms, to delay the opening of a modal after a click if no animation used. 9754 * @option 9755 * @type {number} 9756 * @default 0 9757 */ 9758 showDelay: 0, 9759 /** 9760 * Time, in ms, to delay the closing of a modal after a click if no animation used. 9761 * @option 9762 * @type {number} 9763 * @default 0 9764 */ 9765 hideDelay: 0, 9766 /** 9767 * Allows a click on the body/overlay to close the modal. 9768 * @option 9769 * @type {boolean} 9770 * @default true 9771 */ 9772 closeOnClick: true, 9773 /** 9774 * Allows the modal to close if the user presses the `ESCAPE` key. 9775 * @option 9776 * @type {boolean} 9777 * @default true 9778 */ 9779 closeOnEsc: true, 9780 /** 9781 * If true, allows multiple modals to be displayed at once. 9782 * @option 9783 * @type {boolean} 9784 * @default false 9785 */ 9786 multipleOpened: false, 9787 /** 9788 * Distance, in pixels, the modal should push down from the top of the screen. 9789 * @option 9790 * @type {number|string} 9791 * @default auto 9792 */ 9793 vOffset: 'auto', 9794 /** 9795 * Distance, in pixels, the modal should push in from the side of the screen. 9796 * @option 9797 * @type {number|string} 9798 * @default auto 9799 */ 9800 hOffset: 'auto', 9801 /** 9802 * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well. 9803 * @option 9804 * @type {boolean} 9805 * @default false 9806 */ 9807 fullScreen: false, 9808 /** 9809 * Percentage of screen height the modal should push up from the bottom of the view. 9810 * @option 9811 * @type {number} 9812 * @default 10 9813 */ 9814 btmOffsetPct: 10, 9815 /** 9816 * Allows the modal to generate an overlay div, which will cover the view when modal opens. 9817 * @option 9818 * @type {boolean} 9819 * @default true 9820 */ 9821 overlay: true, 9822 /** 9823 * 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. 9824 * @option 9825 * @type {boolean} 9826 * @default false 9827 */ 9828 resetOnClose: false, 9829 /** 9830 * 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'
9830s user-set id. 9831 * @option 9832 * @type {boolean} 9833 * @default false 9834 */ 9835 deepLink: false, 9836 /** 9837 * Update the browser history with the open modal 9838 * @option 9839 * @default false 9840 */ 9841 updateHistory: false, 9842 /** 9843 * Allows the modal to append to custom div. 9844 * @option 9845 * @type {string} 9846 * @default "body" 9847 */ 9848 appendTo: "body", 9849 /** 9850 * Allows adding additional class names to the reveal overlay. 9851 * @option 9852 * @type {string} 9853 * @default '' 9854 */ 9855 additionalOverlayClasses: '' 9856}; 9857 9858function iPhoneSniff() { 9859 return (/iP(ad|hone|od).*OS/.test(window.navigator.userAgent) 9860 ); 9861} 9862 9863function androidSniff() { 9864 return (/Android/.test(window.navigator.userAgent) 9865 ); 9866} 9867 9868function mobileSniff() { 9869 return iPhoneSniff() || androidSniff(); 9870} 9871 9872exports.Reveal = Reveal; 9873 9874/***/ }), 9875/* 33 */ 9876/***/ (function(module, exports, __webpack_require__) { 9877 9878"use strict"; 9879 9880 9881Object.defineProperty(exports, "__esModule", { 9882 value: true 9883}); 9884exports.Slider = undefined; 9885 9886var _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; }; }(); 9887 9888var _jquery = __webpack_require__(0); 9889 9890var _jquery2 = _interopRequireDefault(_jquery); 9891 9892var _foundationUtil = __webpack_require__(3); 9893 9894var _foundationUtil2 = __webpack_require__(6); 9895 9896var _foundationUtil3 = __webpack_require__(1); 9897 9898var _foundation = __webpack_require__(2); 9899 9900var _foundationUtil4 = __webpack_require__(10); 9901 9902var _foundationUtil5 = __webpack_require__(5); 9903 9904function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 9905 9906function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9907 9908function _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; } 9909 9910function _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; } 9911 9912/** 9913 * Slider module. 9914 * @module foundation.slider 9915 * @requires foundation.util.motion 9916 * @requires foundation.util.triggers 9917 * @requires foundation.util.keyboard 9918 * @requires foundation.util.touch 9919 */ 9920 9921var Slider = function (_Plugin) { 9922 _inherits(Slider, _Plugin); 9923 9924 function Slider() { 9925 _classCallCheck(this, Slider); 9926 9927 return _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).apply(this, arguments)); 9928 } 9929 9930 _createClass(Slider, [{ 9931 key: '_setup', 9932 9933 /** 9934 * Creates a new instance of a slider control. 9935 * @class 9936 * @name Slider 9937 * @param {jQuery} element - jQuery object to make into a slider control. 9938 * @param {Object} options - Overrides to the default plugin settings. 9939 */ 9940 value: function _setup(element, options) { 9941 this.$element = element; 9942 this.options = _jquery2.default.extend({}, Slider.defaults, this.$element.data(), options); 9943 this.className = 'Slider'; // ie9 back compat 9944 9945 // Touch and Triggers inits are idempotent, we just need to make sure it's initialied. 9946 _foundationUtil4.Touch.init(_jquery2.default); 9947 _foundationUtil5.Triggers.init(_jquery2.default); 9948 9949 this._init(); 9950 9951 _foundationUtil.Keyboard.register('Slider', { 9952 'ltr': { 9953 'ARROW_RIGHT': 'increase', 9954 'ARROW_UP': 'increase', 9955 'ARROW_DOWN': 'decrease', 9956 'ARROW_LEFT': 'decrease', 9957 'SHIFT_ARROW_RIGHT': 'increase_fast', 9958 'SHIFT_ARROW_UP': 'increase_fast', 9959 'SHIFT_ARROW_DOWN': 'decrease_fast', 9960 'SHIFT_ARROW_LEFT': 'decrease_fast', 9961 'HOME': 'min', 9962 'END': 'max' 9963 }, 9964 'rtl': { 9965 'ARROW_LEFT': 'increase', 9966 'ARROW_RIGHT': 'decrease', 9967 'SHIFT_ARROW_LEFT': 'increase_fast', 9968 'SHIFT_ARROW_RIGHT': 'decrease_fast' 9969 } 9970 }); 9971 } 9972 9973 /** 9974 * Initilizes the plugin by reading/setting attributes, creating collections and setting the initial position of the handle(s). 9975 * @function 9976 * @private 9977 */ 9978 9979 }, { 9980 key: '_init', 9981 value: function _init() { 9982 this.inputs = this.$element.find('input');
9983 this.handles = this.$element.find('[data-slider-handle]'); 9984 9985 this.$handle = this.handles.eq(0); 9986 this.$input = this.inputs.length ? this.inputs.eq(0) : (0, _jquery2.default)('#' + this.$handle.attr('aria-controls')); 9987 this.$fill = this.$element.find('[data-slider-fill]').css(this.options.vertical ? 'height' : 'width', 0); 9988 9989 var isDbl = false, 9990 _this = this; 9991 if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) { 9992 this.options.disabled = true; 9993 this.$element.addClass(this.options.disabledClass); 9994 } 9995 if (!this.inputs.length) { 9996 this.inputs = (0, _jquery2.default)().add(this.$input); 9997 this.options.binding = true; 9998 } 9999 10000 this._setInitAttr(0); 10001 10002 if (this.handles[1]) { 10003 this.options.doubleSided = true; 10004 this.$handle2 = this.handles.eq(1); 10005 this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : (0, _jquery2.default)('#' + this.$handle2.attr('aria-controls')); 10006 10007 if (!this.inputs[1]) { 10008 this.inputs = this.inputs.add(this.$input2); 10009 } 10010 isDbl = true; 10011 10012 // this.$handle.triggerHandler('click.zf.slider'); 10013 this._setInitAttr(1); 10014 } 10015 10016 // Set handle positions 10017 this.setHandles(); 10018 10019 this._events(); 10020 } 10021 }, { 10022 key: 'setHandles', 10023 value: function setHandles() { 10024 var _this3 = this; 10025 10026 if (this.handles[1]) { 10027 this._setHandlePos(this.$handle, this.inputs.eq(0).val(), true, function () { 10028 _this3._setHandlePos(_this3.$handle2, _this3.inputs.eq(1).val(), true); 10029 }); 10030 } else { 10031 this._setHandlePos(this.$handle, this.inputs.eq(0).val(), true); 10032 } 10033 } 10034 }, { 10035 key: '_reflow', 10036 value: function _reflow() { 10037 this.setHandles(); 10038 } 10039 /** 10040 * @function 10041 * @private 10042 * @param {Number} value - floating point (the value) to be transformed using to a relative position on the slider (the inverse of _value) 10043 */ 10044 10045 }, { 10046 key: '_pctOfBar', 10047 value: function _pctOfBar(value) { 10048 var pctOfBar = percent(value - this.options.start, this.options.end - this.options.start); 10049 10050 switch (this.options.positionValueFunction) { 10051 case "pow": 10052 pctOfBar = this._logTransform(pctOfBar); 10053 break; 10054 case "log": 10055 pctOfBar = this._powTransform(pctOfBar); 10056 break; 10057 } 10058 10059 return pctOfBar.toFixed(2); 10060 } 10061 10062 /** 10063 * @function 10064 * @private 10065 * @param {Number} pctOfBar - floating point, the relative position of the slider (typically between 0-1) to be transformed to a value 10066 */ 10067 10068 }, { 10069 key: '_value', 10070 value: function _value(pctOfBar) { 10071 switch (this.options.positionValueFunction) { 10072 case "pow": 10073 pctOfBar = this._powTransform(pctOfBar); 10074 break; 10075 case "log": 10076 pctOfBar = this._logTransform(pctOfBar); 10077 break; 10078 } 10079 var value = (this.options.end - this.options.start) * pctOfBar + this.options.start; 10080 10081 return value; 10082 } 10083 10084 /** 10085 * @function 10086 * @private 10087 * @param {Number} value - floating point (typically between 0-1) to be transformed using the log function 10088 */ 10089 10090 }, { 10091 key: '_logTransform', 10092 value: function _logTransform(value) { 10093 return baseLog(this.options.nonLinearBase, value * (this.options.nonLinearBase - 1) + 1); 10094 } 10095 10096 /** 10097 * @function 10098 * @private 10099 * @param {Number} value - floating point (typically between 0-1) to be transformed using the power function 10100 */ 10101 10102 }, { 10103 key: '_powTransform', 10104 value: function _powTransform(value) { 10105 return (Math.pow(this.options.nonLinearBase, value) - 1) / (this.options.nonLinearBase - 1); 10106 } 10107 10108 /** 10109 * Sets the position of the selected handle and fill bar. 10110 * @function 10111 * @private 10112 * @param {jQuery} $hndl - the selected handle to move. 10113 * @param {Number} location - floating point between the start and end values of the slider bar. 10114 * @param {Function} cb - callback function to fire on completion. 10115 * @fires Slider#moved 10116 * @fires Slider#changed 10117 */ 10118 10119 }, { 10120 key: '_setHandlePos', 10121 value: function _setHandlePos($hndl, location, noInvert, cb) { 10122 // don't move if the slider has been disabled since its initialization 10123 if (this.$element.hasClass(this.options.disabledClass)) { 10124 return; 10125 } 10126 //might need to alter that slightly for bars that will have odd number selections. 10127 location = parseFloat(location); //on input change events, convert string to number...grumble. 10128 10129 // prevent slider from running out of bounds, if value exceeds the limits set through options, override the value to min/max 10130 if (location < this.options.start) { 10131 location = this.options.start; 10132 } else if (location > this.options.end) { 10133 location = this.options.end; 10134 } 10135 10136 var isDbl = this.options.doubleSided; 10137 10138 if (isDbl) { 10139 //this block is to prevent 2 handles from crossing eachother. Could/should be improved. 10140 if (this.handles.index($hndl) === 0) { 10141 var h2Val = parseFloat(this.$handle2.attr('aria-valuenow')); 10142 location = location >= h2Val ? h2Val - this.options.step : location; 10143 } else { 10144 var h1Val = parseFloat(this.$handle.attr('aria-valuenow')); 10145 location = location <= h1Val ? h1Val + this.options.step : location; 10146 } 10147 } 10148
vendor: 8,053 bytes, lines 10149-10337
10149 //this is for single-handled vertical sliders, it adjusts the value to account for the slider being "upside-down" 10150 //for click and drag events, it's weird due to the scale(-1, 1) css property 10151 if (this.options.vertical && !noInvert) { 10152 location = this.options.end - location; 10153 } 10154 10155 var _this = this, 10156 vert = this.options.vertical, 10157 hOrW = vert ? 'height' : 'width', 10158 lOrT = vert ? 'top' : 'left', 10159 handleDim = $hndl[0].getBoundingClientRect()[hOrW], 10160 elemDim = this.$element[0].getBoundingClientRect()[hOrW], 10161 10162 //percentage of bar min/max value based on click or drag point 10163 pctOfBar = this._pctOfBar(location), 10164 10165 //number of actual pixels to shift the handle, based on the percentage obtained above 10166 pxToMove = (elemDim - handleDim) * pctOfBar, 10167 10168 //percentage of bar to shift the handle 10169 movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal); 10170 //fixing the decimal value for the location number, is passed to other methods as a fixed floating-point value 10171 location = parseFloat(location.toFixed(this.options.decimal)); 10172 // declare empty object for css adjustments, only used with 2 handled-sliders 10173 var css = {}; 10174 10175 this._setValues($hndl, location); 10176 10177 // TODO update to calculate based on values set to respective inputs?? 10178 if (isDbl) { 10179 var isLeftHndl = this.handles.index($hndl) === 0, 10180 10181 //empty variable, will be used for min-height/width for fill bar 10182 dim, 10183 10184 //percentage w/h of the handle compared to the slider bar 10185 handlePct = ~~(percent(handleDim, elemDim) * 100); 10186 //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 10187 if (isLeftHndl) { 10188 //left or top percentage value to apply to the fill bar. 10189 css[lOrT] = movement + '%'; 10190 //calculate the new min-height/width for the fill bar. 10191 dim = parseFloat(this.$handle2[0].style[lOrT]) - movement + handlePct; 10192 //this callback is necessary to prevent errors and allow the proper placement and initialization of a 2-handled slider 10193 //plus, it means we don't care if 'dim' isNaN on init, it won't be in the future. 10194 if (cb && typeof cb === 'function') { 10195 cb(); 10196 } //this is only needed for the initialization of 2 handled sliders 10197 } else { 10198 //just caching the value of the left/bottom handle's left/top property 10199 var handlePos = parseFloat(this.$handle[0].style[lOrT]); 10200 //calculate the new min-height/width for the fill bar. Use isNaN to prevent false positives for numbers <= 0 10201 //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 10202 dim = movement - (isNaN(handlePos) ? (this.options.initialStart - this.options.start) / ((this.options.end - this.options.start) / 100) : handlePos) + handlePct; 10203 } 10204 // assign the min-height/width to our css object 10205 css['min-' + hOrW] = dim + '%'; 10206 } 10207 10208 this.$element.one('finished.zf.animate', function () { 10209 /** 10210 * Fires when the handle is done moving. 10211 * @event Slider#moved 10212 */ 10213 _this.$element.trigger('moved.zf.slider', [$hndl]); 10214 }); 10215 10216 //because we don't know exactly how the handle will be moved, check the amount of time it should take to move. 10217 var moveTime = this.$element.data('dragging') ? 1000 / 60 : this.options.moveTime; 10218 10219 (0, _foundationUtil2.Move)(moveTime, $hndl, function () { 10220 // adjusting the left/top property of the handle, based on the percentage calculated above 10221 // if movement isNaN, that is because the slider is hidden and we cannot determine handle width, 10222 // fall back to next best guess. 10223 if (isNaN(movement)) { 10224 $hndl.css(lOrT, pctOfBar * 100 + '%'); 10225 } else { 10226 $hndl.css(lOrT, movement + '%'); 10227 } 10228 10229 if (!_this.options.doubleSided) { 10230 //if single-handled, a simple method to expand the fill bar 10231 _this.$fill.css(hOrW, pctOfBar * 100 + '%'); 10232 } else { 10233 //otherwise, use the css object we created above 10234 _this.$fill.css(css); 10235 } 10236 }); 10237 10238 /** 10239 * Fires when the value has not been change for a given time. 10240 * @event Slider#changed 10241 */ 10242 clearTimeout(_this.timeout); 10243 _this.timeout = setTimeout(function () { 10244 _this.$element.trigger('changed.zf.slider', [$hndl]); 10245 }, _this.options.changedDelay); 10246 } 10247 10248 /** 10249 * Sets the initial attribute for the slider element. 10250 * @function 10251 * @private 10252 * @param {Number} idx - index of the current handle/input to use. 10253 */ 10254 10255 }, { 10256 key: '_setInitAttr', 10257 value: function _setInitAttr(idx) { 10258 var initVal = idx === 0 ? this.options.initialStart : this.options.initialEnd; 10259 var id = this.inputs.eq(idx).attr('id') || (0, _foundationUtil3.GetYoDigits)(6, 'slider'); 10260 this.inputs.eq(idx).attr({ 10261 'id': id, 10262 'max': this.options.end, 10263 'min': this.options.start, 10264 'step': this.options.step 10265 }); 10266 this.inputs.eq(idx).val(initVal); 10267 this.handles.eq(idx).attr({ 10268 'role': 'slider', 10269 'aria-controls': id, 10270 'aria-valuemax': this.options.end, 10271 'aria-valuemin': this.options.start, 10272 'aria-valuenow': initVal, 10273 'aria-orientation': this.options.vertical ? 'vertical' : 'horizontal', 10274 'tabindex': 0 10275 }); 10276 } 10277 10278 /** 10279 * Sets the input and `aria-valuenow` values for the slider element. 10280 * @function 10281 * @private 10282 * @param {jQuery} $handle - the currently selected handle. 10283 * @param {Number} val - floating point of the new value. 10284 */ 10285 10286 }, { 10287 key: '_setValues', 10288 value: function _setValues($handle, val) { 10289 var idx = this.options.doubleSided ? this.handles.index($handle) : 0; 10290 this.inputs.eq(idx).val(val); 10291 $handle.attr('aria-valuenow', val); 10292 } 10293 10294 /** 10295 * Handles events on the slider element. 10296 * Calculates the new location of the current handle. 10297 * If there are two handles and the bar was clicked, it determines which handle to move. 10298 * @function 10299 * @private 10300 * @param {Object} e - the `event` object passed from the listener. 10301 * @param {jQuery} $handle - the current handle to calculate for, if selected. 10302 * @param {Number} val - floating point number for the new value of the slider. 10303 * TODO clean this up, there's a lot of repeated code between this and the _setHandlePos fn. 10304 */ 10305 10306 }, { 10307 key: '_handleEvent', 10308 value: function _handleEvent(e, $handle, val) { 10309 var value, hasVal; 10310 if (!val) { 10311 //click or drag events 10312 e.preventDefault(); 10313 var _this = this, 10314 vertical = this.options.vertical, 10315 param = vertical ? 'height' : 'width', 10316 direction = vertical ? 'top' : 'left', 10317 eventOffset = vertical ? e.pageY : e.pageX, 10318 halfOfHandle = this.$handle[0].getBoundingClientRect()[param] / 2, 10319 barDim = this.$element[0].getBoundingClientRect()[param], 10320 windowScroll = vertical ? (0, _jquery2.default)(window).scrollTop() : (0, _jquery2.default)(window).scrollLeft(); 10321 10322 var elemOffset = this.$element.offset()[direction]; 10323 10324 // touch events emulated by the touch util give position relative to screen, add window.scroll to event coordinates... 10325 // best way to guess this is simulated is if clientY == pageY 10326 if (e.clientY === e.pageY) { 10327 eventOffset = eventOffset + windowScroll; 10328 } 10329 var eventFromBar = eventOffset - elemOffset; 10330 var barXY; 10331 if (eventFromBar < 0) { 10332 barXY = 0; 10333 } else if (eventFromBar > barDim) { 10334 barXY = barDim; 10335 } else { 10336 barXY = eventFromBar; 10337 }
10338 var offsetPct = percent(barXY, barDim); 10339 10340 value = this._value(offsetPct); 10341 10342 // turn everything around for RTL, yay math! 10343 if ((0, _foundationUtil3.rtl)() && !this.options.vertical) { 10344 value = this.options.end - value; 10345 } 10346 10347 value = _this._adjustValue(null, value); 10348 //boolean flag for the setHandlePos fn, specifically for vertical sliders 10349 hasVal = false; 10350 10351 if (!$handle) { 10352 //figure out which handle it is, pass it to the next function. 10353 var firstHndlPos = absPosition(this.$handle, direction, barXY, param), 10354 secndHndlPos = absPosition(this.$handle2, direction, barXY, param); 10355 $handle = firstHndlPos <= secndHndlPos ? this.$handle : this.$handle2; 10356 } 10357 } else { 10358 //change event on input 10359 value = this._adjustValue(null, val); 10360 hasVal = true; 10361 } 10362 10363 this._setHandlePos($handle, value, hasVal); 10364 } 10365 10366 /** 10367 * Adjustes value for handle in regard to step value. returns adjusted value 10368 * @function 10369 * @private 10370 * @param {jQuery} $handle - the selected handle. 10371 * @param {Number} value - value to adjust. used if $handle is falsy 10372 */ 10373 10374 }, { 10375 key: '_adjustValue', 10376 value: function _adjustValue($handle, value) { 10377 var val, 10378 step = this.options.step, 10379 div = parseFloat(step / 2), 10380 left, 10381 prev_val, 10382 next_val; 10383 if (!!$handle) { 10384 val = parseFloat($handle.attr('aria-valuenow')); 10385 } else { 10386 val = value; 10387 } 10388 left = val % step; 10389 prev_val = val - left; 10390 next_val = prev_val + step; 10391 if (left === 0) { 10392 return val; 10393 } 10394 val = val >= prev_val + div ? next_val : prev_val; 10395 return val; 10396 } 10397 10398 /** 10399 * Adds event listeners to the slider elements. 10400 * @function 10401 * @private 10402 */ 10403 10404 }, { 10405 key: '_events', 10406 value: function _events() { 10407 this._eventsForHandle(this.$handle); 10408 if (this.handles[1]) { 10409 this._eventsForHandle(this.$handle2); 10410 } 10411 } 10412 10413 /** 10414 * Adds event listeners a particular handle 10415 * @function 10416 * @private 10417 * @param {jQuery} $handle - the current handle to apply listeners to. 10418 */ 10419 10420 }, { 10421 key: '_eventsForHandle', 10422 value: function _eventsForHandle($handle) { 10423 var _this = this, 10424 curHandle, 10425 timer; 10426 10427 this.inputs.off('change.zf.slider').on('change.zf.slider', function (e) { 10428 var idx = _this.inputs.index((0, _jquery2.default)(this)); 10429 _this._handleEvent(e, _this.handles.eq(idx), (0, _jquery2.default)(this).val()); 10430 }); 10431 10432 if (this.options.clickSelect) { 10433 this.$element.off('click.zf.slider').on('click.zf.slider', function (e) { 10434 if (_this.$element.data('dragging')) { 10435 return false; 10436 } 10437 10438 if (!(0, _jquery2.default)(e.target).is('[data-slider-handle]')) { 10439 if (_this.options.doubleSided) { 10440 _this._handleEvent(e); 10441 } else { 10442 _this._handleEvent(e, _this.$handle); 10443 } 10444 } 10445 }); 10446 } 10447 10448 if (this.options.draggable) { 10449 this.handles.addTouch(); 10450 10451 var $body = (0, _jquery2.default)('body'); 10452 $handle.off('mousedown.zf.slider').on('mousedown.zf.slider', function (e) { 10453 $handle.addClass('is-dragging'); 10454 _this.$fill.addClass('is-dragging'); // 10455 _this.$element.data('dragging', true); 10456 10457 curHandle = (0, _jquery2.default)(e.currentTarget); 10458 10459 $body.on('mousemove.zf.slider', function (e) { 10460 e.preventDefault(); 10461 _this._handleEvent(e, curHandle); 10462 }).on('mouseup.zf.slider', function (e) { 10463 _this._handleEvent(e, curHandle); 10464 10465 $handle.removeClass('is-dragging'); 10466 _this.$fill.removeClass('is-dragging'); 10467 _this.$element.data('dragging', false); 10468 10469 $body.off('mousemove.zf.slider mouseup.zf.slider'); 10470 }); 10471 }) 10472 // prevent events triggered by touch 10473 .on('selectstart.zf.slider touchmove.zf.slider', function (e) { 10474 e.preventDefault(); 10475 }); 10476 } 10477 10478 $handle.off('keydown.zf.slider').on('keydown.zf.slider', function (e) { 10479 var _$handle = (0, _jquery2.default)(this), 10480 idx = _this.options.doubleSided ? _this.handles.index(_$handle) : 0, 10481 oldValue = parseFloat(_this.inputs.eq(idx).val()), 10482 newValue; 10483 10484 // handle keyboard event with keyboard util 10485 _foundationUtil.Keyboard.handleKey(e, 'Slider', { 10486 decrease: function decrease() { 10487 newValue = oldValue - _this.options.step; 10488 }, 10489 increase: function increase() { 10490 newValue = oldValue + _this.options.step; 10491 }, 10492 decrease_fast: function decrease_fast() { 10493 newValue = oldValue - _this.options.step * 10; 10494 }, 10495 increase_fast: function increase_fast() { 10496 newValue = oldValue + _this.options.step * 10; 10497 }, 10498 min: function min() { 10499 newValue = _this.options.start; 10500 }, 10501 max: function max() { 10502 newValue = _this.options.end; 10503 }, 10504 handled: function handled() { 10505 // only set handle pos when event was handled specially 10506 e.preventDefault(); 10507 _this._setHandlePos(_$handle, newValue, true); 10508 } 10509 }); 10510 /*if (newValue) { // if pressed key has special function, update value 10511 e.preventDefault(); 10512 _this._setHandlePos(_$handle, newValue); 10513 }*/ 10514 }); 10515 } 10516 10517 /** 10518 * Destroys the slider plugin. 10519 */ 10520 10521 }, { 10522 key: '_destroy', 10523 value: function _destroy() { 10524 this.handles.off('.zf.slider'); 10525 this.inputs.off('.zf.slider'); 10526 this.$element.off('.zf.slider'); 10527 10528 clearTimeout(this.timeout); 10529 } 10530 }]); 10531 10532 return Slider; 10533}
10533(_foundation.Plugin); 10534 10535Slider.defaults = { 10536 /** 10537 * Minimum value for the slider scale. 10538 * @option 10539 * @type {number} 10540 * @default 0 10541 */ 10542 start: 0, 10543 /** 10544 * Maximum value for the slider scale. 10545 * @option 10546 * @type {number} 10547 * @default 100 10548 */ 10549 end: 100, 10550 /** 10551 * Minimum value change per change event. 10552 * @option 10553 * @type {number} 10554 * @default 1 10555 */ 10556 step: 1, 10557 /** 10558 * Value at which the handle/input *(left handle/first input)* should be set to on initialization. 10559 * @option 10560 * @type {number} 10561 * @default 0 10562 */ 10563 initialStart: 0, 10564 /** 10565 * Value at which the right handle/second input should be set to on initialization. 10566 * @option 10567 * @type {number} 10568 * @default 100 10569 */ 10570 initialEnd: 100, 10571 /** 10572 * Allows the input to be located outside the container and visible. Set to by the JS 10573 * @option 10574 * @type {boolean} 10575 * @default false 10576 */ 10577 binding: false, 10578 /** 10579 * Allows the user to click/tap on the slider bar to select a value. 10580 * @option 10581 * @type {boolean} 10582 * @default true 10583 */ 10584 clickSelect: true, 10585 /** 10586 * Set to true and use the `vertical` class to change alignment to vertical. 10587 * @option 10588 * @type {boolean} 10589 * @default false 10590 */ 10591 vertical: false, 10592 /** 10593 * Allows the user to drag the slider handle(s) to select a value. 10594 * @option 10595 * @type {boolean} 10596 * @default true 10597 */ 10598 draggable: true, 10599 /** 10600 * Disables the slider and prevents event listeners from being applied. Double checked by JS with `disabledClass`. 10601 * @option 10602 * @type {boolean} 10603 * @default false 10604 */ 10605 disabled: false, 10606 /** 10607 * Allows the use of two handles. Double checked by the JS. Changes some logic handling. 10608 * @option 10609 * @type {boolean} 10610 * @default false 10611 */ 10612 doubleSided: false, 10613 /** 10614 * Potential future feature. 10615 */ 10616 // steps: 100, 10617 /** 10618 * Number of decimal places the plugin should go to for floating point precision. 10619 * @option 10620 * @type {number} 10621 * @default 2 10622 */ 10623 decimal: 2, 10624 /** 10625 * Time delay for dragged elements. 10626 */ 10627 // dragDelay: 0, 10628 /** 10629 * 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. 10630 * @option 10631 * @type {number} 10632 * @default 200 10633 */ 10634 moveTime: 200, //update this if changing the transition time in the sass 10635 /** 10636 * Class applied to disabled sliders. 10637 * @option 10638 * @type {string} 10639 * @default 'disabled' 10640 */ 10641 disabledClass: 'disabled', 10642 /** 10643 * Will invert the default layout for a vertical<span data-tooltip title="who would do this???"> </span>slider. 10644 * @option 10645 * @type {boolean} 10646 * @default false 10647 */ 10648 invertVertical: false, 10649 /** 10650 * Milliseconds before the `changed.zf-slider` event is triggered after value change. 10651 * @option 10652 * @type {number} 10653 * @default 500 10654 */ 10655 changedDelay: 500, 10656 /** 10657 * Basevalue for non-linear sliders 10658 * @option 10659 * @type {number} 10660 * @default 5 10661 */ 10662 nonLinearBase: 5, 10663 /** 10664 * Basevalue for non-linear sliders, possible values are: `'linear'`, `'pow'` & `'log'`. Pow and Log use the nonLinearBase setting. 10665 * @option 10666 * @type {string} 10667 * @default 'linear' 10668 */ 10669 positionValueFunction: 'linear' 10670}; 10671 10672function percent(frac, num) { 10673 return frac / num; 10674} 10675function absPosition($handle, dir, clickPos, param) { 10676 return Math.abs($handle.position()[dir] + $handle[param]() / 2 - clickPos); 10677} 10678function baseLog(base, value) { 10679 return Math.log(value) / Math.log(base); 10680} 10681 10682exports.Slider = Slider; 10683 10684/***/ }), 10685/* 34 */ 10686/***/ (function(module, exports, __webpack_require__) { 10687 10688"use strict"; 10689 10690 10691Object.defineProperty(exports, "__esModule", { 10692 value: true 10693}); 10694exports.Sticky = undefined; 10695 10696var _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; }; }(); 10697 10698var _jquery = __webpack_require__(0); 10699 10700var _jquery2 = _interopRequireDefault(_jquery); 10701 10702var _foundationUtil = __webpack_require__(1); 10703 10704var _foundationUtil2 = __webpack_require__(4); 10705 10706var _foundation = __webpack_require__(2); 10707 10708var _foundationUtil3 = __webpack_require__(5); 10709 10710function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 10711 10712function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10713 10714function _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; } 10715 10716function _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
10716onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10717 10718/** 10719 * Sticky module. 10720 * @module foundation.sticky 10721 * @requires foundation.util.triggers 10722 * @requires foundation.util.mediaQuery 10723 */ 10724 10725var Sticky = function (_Plugin) { 10726 _inherits(Sticky, _Plugin); 10727 10728 function Sticky() { 10729 _classCallCheck(this, Sticky); 10730 10731 return _possibleConstructorReturn(this, (Sticky.__proto__ || Object.getPrototypeOf(Sticky)).apply(this, arguments)); 10732 } 10733 10734 _createClass(Sticky, [{ 10735 key: '_setup', 10736 10737 /** 10738 * Creates a new instance of a sticky thing. 10739 * @class 10740 * @name Sticky 10741 * @param {jQuery} element - jQuery object to make sticky. 10742 * @param {Object} options - options object passed when creating the element programmatically. 10743 */ 10744 value: function _setup(element, options) { 10745 this.$element = element; 10746 this.options = _jquery2.default.extend({}, Sticky.defaults, this.$element.data(), options); 10747 this.className = 'Sticky'; // ie9 back compat 10748 10749 // Triggers init is idempotent, just need to make sure it is initialized 10750 _foundationUtil3.Triggers.init(_jquery2.default); 10751 10752 this._init(); 10753 } 10754 10755 /** 10756 * Initializes the sticky element by adding classes, getting/setting dimensions, breakpoints and attributes 10757 * @function 10758 * @private 10759 */ 10760 10761 }, { 10762 key: '_init', 10763 value: function _init() { 10764 _foundationUtil2.MediaQuery._init(); 10765 10766 var $parent = this.$element.parent('[data-sticky-container]'), 10767 id = this.$element[0].id || (0, _foundationUtil.GetYoDigits)(6, 'sticky'), 10768 _this = this; 10769 10770 if ($parent.length) { 10771 this.$container = $parent; 10772 } else { 10773 this.wasWrapped = true; 10774 this.$element.wrap(this.options.container); 10775 this.$container = this.$element.parent(); 10776 } 10777 this.$container.addClass(this.options.containerClass); 10778 10779 this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id, 'data-mutate': id }); 10780 if (this.options.anchor !== '') { 10781 (0, _jquery2.default)('#' + _this.options.anchor).attr({ 'data-mutate': id }); 10782 } 10783 10784 this.scrollCount = this.options.checkEvery; 10785 this.isStuck = false; 10786 (0, _jquery2.default)(window).one('load.zf.sticky', function () { 10787 //We calculate the container height to have correct values for anchor points offset calculation. 10788 _this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height; 10789 _this.$container.css('height', _this.containerHeight); 10790 _this.elemHeight = _this.containerHeight; 10791 if (_this.options.anchor !== '') { 10792 _this.$anchor = (0, _jquery2.default)('#' + _this.options.anchor); 10793 } else { 10794 _this._parsePoints(); 10795 } 10796 10797 _this._setSizes(function () { 10798 var scroll = window.pageYOffset; 10799 _this._calc(false, scroll); 10800 //Unstick the element will ensure that proper classes are set. 10801 if (!_this.isStuck) { 10802 _this._removeSticky(scroll >= _this.topPoint ? false : true); 10803 } 10804 }); 10805 _this._events(id.split('-').reverse().join('-')); 10806 }); 10807 } 10808 10809 /** 10810 * If using multiple elements as anchors, calculates the top and bottom pixel values the sticky thing should stick and unstick on. 10811 * @function 10812 * @private 10813 */ 10814 10815 }, { 10816 key: '_parsePoints', 10817 value: function _parsePoints() { 10818 var top = this.options.topAnchor == "" ? 1 : this.options.topAnchor, 10819 btm = this.options.btmAnchor == "" ? document.documentElement.scrollHeight : this.options.btmAnchor, 10820 pts = [top, btm], 10821 breaks = {}; 10822 for (var i = 0, len = pts.length; i < len && pts[i]; i++) { 10823 var pt; 10824 if (typeof pts[i] === 'number') { 10825 pt = pts[i]; 10826 } else { 10827 var place = pts[i].split(':'), 10828 anchor = (0, _jquery2.default)('#' + place[0]); 10829 10830 pt = anchor.offset().top; 10831 if (place[1] && place[1].toLowerCase() === 'bottom') { 10832 pt += anchor[0].getBoundingClientRect().height; 10833 } 10834 } 10835 breaks[i] = pt; 10836 } 10837 10838 this.points = breaks; 10839 return; 10840 } 10841 10842 /** 10843 * Adds event handlers for the scrolling element. 10844 * @private 10845 * @param {String} id - pseudo-random id for unique scroll event listener. 10846 */ 10847 10848 }, { 10849 key: '_events', 10850 value: function _events(id) { 10851 var _this = this, 10852 scrollListener = this.scrollListener = 'scroll.zf.' + id; 10853 if (this.isOn) { 10854 return; 10855 } 10856 if (this.canStick) { 10857 this.isOn = true; 10858 (0, _jquery2.default)(window).off(scrollListener).on(scrollListener, function (e) { 10859 if (_this.scrollCount === 0) { 10860 _this.scrollCount = _this.options.checkEvery; 10861 _this._setSizes(function () { 10862 _this._calc(false, window.pageYOffset); 10863 }); 10864 } else { 10865 _this.scrollCount--; 10866 _this._calc(false, window.pageYOffset); 10867 } 10868 }); 10869 } 10870 10871 this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function (e, el) { 10872 _this._eventsHandler(id); 10873 }); 10874 10875 this.$element.on('mutateme.zf.trigger', function (e, el) { 10876 _this._eventsHandler(id); 10877 }); 10878 10879 if (this.$anchor) { 10880 this.$anchor.on('mutateme.zf.trigger', function (e, el) { 10881 _this._eventsHandler(id); 10882 }); 10883 } 10884 } 10885 10886 /** 10887 * Handler for events. 10888 * @private 10889 * @param {String} id - pseudo-random id for unique scroll event listener. 10890 */ 10891 10892 }, { 10893 key: '_eventsHandler', 10894 value: function _eventsHandler(id) { 10895 var _this = this, 10896 scrollListener = this.scrollListener = 'scroll.zf.' + id; 10897 10898 _this._setSizes(function () { 10899 _this._calc(false); 10900 if (_this.canStick) { 10901 if (!_this.isOn) { 10902 _this._events(id); 10903 } 10904 } else if (_this.isOn) { 10905 _this._pauseListeners(scrollListener); 10906 } 10907 }); 10908 } 10909 10910 /** 10911 * Removes event handlers for scroll and change events on anchor. 10912 * @fires Sticky#pause 10913 * @param {String} scrollListener - unique, namespaced scroll listener attached to `window` 10914 */ 10915 10916 }, { 10917 key: '_pauseListeners', 10918 value: function _pauseListeners(scrollListener) { 10919 this.isOn = false;
10920 (0, _jquery2.default)(window).off(scrollListener); 10921 10922 /** 10923 * Fires when the plugin is paused due to resize event shrinking the view. 10924 * @event Sticky#pause 10925 * @private 10926 */ 10927 this.$element.trigger('pause.zf.sticky'); 10928 } 10929 10930 /** 10931 * Called on every `scroll` event and on `_init` 10932 * fires functions based on booleans and cached values 10933 * @param {Boolean} checkSizes - true if plugin should recalculate sizes and breakpoints. 10934 * @param {Number} scroll - current scroll position passed from scroll event cb function. If not passed, defaults to `window.pageYOffset`. 10935 */ 10936 10937 }, { 10938 key: '_calc', 10939 value: function _calc(checkSizes, scroll) { 10940 if (checkSizes) { 10941 this._setSizes(); 10942 } 10943 10944 if (!this.canStick) { 10945 if (this.isStuck) { 10946 this._removeSticky(true); 10947 } 10948 return false; 10949 } 10950 10951 if (!scroll) { 10952 scroll = window.pageYOffset; 10953 } 10954 10955 if (scroll >= this.topPoint) { 10956 if (scroll <= this.bottomPoint) { 10957 if (!this.isStuck) { 10958 this._setSticky(); 10959 } 10960 } else { 10961 if (this.isStuck) { 10962 this._removeSticky(false); 10963 } 10964 } 10965 } else { 10966 if (this.isStuck) { 10967 this._removeSticky(true); 10968 } 10969 } 10970 } 10971 10972 /** 10973 * Causes the $element to become stuck. 10974 * Adds `position: fixed;`, and helper classes. 10975 * @fires Sticky#stuckto 10976 * @function 10977 * @private 10978 */ 10979 10980 }, { 10981 key: '_setSticky', 10982 value: function _setSticky() { 10983 var _this = this, 10984 stickTo = this.options.stickTo, 10985 mrgn = stickTo === 'top' ? 'marginTop' : 'marginBottom', 10986 notStuckTo = stickTo === 'top' ? 'bottom' : 'top', 10987 css = {}; 10988 10989 css[mrgn] = this.options[mrgn] + 'em'; 10990 css[stickTo] = 0; 10991 css[notStuckTo] = 'auto'; 10992 this.isStuck = true; 10993 this.$element.removeClass('is-anchored is-at-' + notStuckTo).addClass('is-stuck is-at-' + stickTo).css(css) 10994 /** 10995 * Fires when the $element has become `position: fixed;` 10996 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.stuckto:top` 10997 * @event Sticky#stuckto 10998 */ 10999 .trigger('sticky.zf.stuckto:' + stickTo); 11000 this.$element.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function () { 11001 _this._setSizes(); 11002 }); 11003 } 11004 11005 /** 11006 * Causes the $element to become unstuck. 11007 * Removes `position: fixed;`, and helper classes. 11008 * Adds other helper classes. 11009 * @param {Boolean} isTop - tells the function if the $element should anchor to the top or bottom of its $anchor element. 11010 * @fires Sticky#unstuckfrom 11011 * @private 11012 */ 11013 11014 }, { 11015 key: '_removeSticky', 11016 value: function _removeSticky(isTop) { 11017 var stickTo = this.options.stickTo, 11018 stickToTop = stickTo === 'top', 11019 css = {}, 11020 anchorPt = (this.points ? this.points[1] - this.points[0] : this.anchorHeight) - this.elemHeight, 11021 mrgn = stickToTop ? 'marginTop' : 'marginBottom', 11022 notStuckTo = stickToTop ? 'bottom' : 'top', 11023 topOrBottom = isTop ? 'top' : 'bottom'; 11024 11025 css[mrgn] = 0; 11026 11027 css['bottom'] = 'auto'; 11028 if (isTop) { 11029 css['top'] = 0; 11030 } else { 11031 css['top'] = anchorPt; 11032 } 11033 11034 this.isStuck = false; 11035 this.$element.removeClass('is-stuck is-at-' + stickTo).addClass('is-anchored is-at-' + topOrBottom).css(css) 11036 /** 11037 * Fires when the $element has become anchored. 11038 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.unstuckfrom:bottom` 11039 * @event Sticky#unstuckfrom 11040 */ 11041 .trigger('sticky.zf.unstuckfrom:' + topOrBottom); 11042 } 11043 11044 /** 11045 * Sets the $element and $container sizes for plugin. 11046 * Calls `_setBreakPoints`. 11047 * @param {Function} cb - optional callback function to fire on completion of `_setBreakPoints`. 11048 * @private 11049 */ 11050 11051 }, { 11052 key: '_setSizes', 11053 value: function _setSizes(cb) { 11054 this.canStick = _foundationUtil2.MediaQuery.is(this.options.stickyOn); 11055 if (!this.canStick) { 11056 if (cb && typeof cb === 'function') { 11057 cb(); 11058 } 11059 } 11060 var _this = this, 11061 newElemWidth = this.$container[0].getBoundingClientRect().width, 11062 comp = window.getComputedStyle(this.$container[0]), 11063 pdngl = parseInt(comp['padding-left'], 10), 11064 pdngr = parseInt(comp['padding-right'], 10); 11065 11066 if (this.$anchor && this.$anchor.length) { 11067 this.anchorHeight = this.$anchor[0].getBoundingClientRect().height; 11068 } else { 11069 this._parsePoints(); 11070 } 11071 11072 this.$element.css({ 11073 'max-width': newElemWidth - pdngl - pdngr + 'px' 11074 }); 11075 11076 var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight; 11077 if (this.$element.css("display") == "none") { 11078 newContainerHeight = 0; 11079 } 11080 this.containerHeight = newContainerHeight; 11081 this.$container.css({ 11082 height: newContainerHeight 11083 }); 11084 this.elemHeight = newContainerHeight; 11085 11086 if (!this.isStuck) { 11087 if (this.$element.hasClass('is-at-bottom')) { 11088 var anchorPt = (this.points ? this.points[1] - this.$container.offset().top : this.anchorHeight) - this.elemHeight;
11089 this.$element.css('top', anchorPt); 11090 } 11091 } 11092 11093 this._setBreakPoints(newContainerHeight, function () { 11094 if (cb && typeof cb === 'function') { 11095 cb(); 11096 } 11097 }); 11098 } 11099 11100 /** 11101 * Sets the upper and lower breakpoints for the element to become sticky/unsticky. 11102 * @param {Number} elemHeight - px value for sticky.$element height, calculated by `_setSizes`. 11103 * @param {Function} cb - optional callback function to be called on completion. 11104 * @private 11105 */ 11106 11107 }, { 11108 key: '_setBreakPoints', 11109 value: function _setBreakPoints(elemHeight, cb) { 11110 if (!this.canStick) { 11111 if (cb && typeof cb === 'function') { 11112 cb(); 11113 } else { 11114 return false; 11115 } 11116 } 11117 var mTop = emCalc(this.options.marginTop), 11118 mBtm = emCalc(this.options.marginBottom), 11119 topPoint = this.points ? this.points[0] : this.$anchor.offset().top, 11120 bottomPoint = this.points ? this.points[1] : topPoint + this.anchorHeight, 11121 11122 // topPoint = this.$anchor.offset().top || this.points[0], 11123 // bottomPoint = topPoint + this.anchorHeight || this.points[1], 11124 winHeight = window.innerHeight; 11125 11126 if (this.options.stickTo === 'top') { 11127 topPoint -= mTop; 11128 bottomPoint -= elemHeight + mTop; 11129 } else if (this.options.stickTo === 'bottom') { 11130 topPoint -= winHeight - (elemHeight + mBtm); 11131 bottomPoint -= winHeight - mBtm; 11132 } else { 11133 //this would be the stickTo: both option... tricky 11134 } 11135 11136 this.topPoint = topPoint; 11137 this.bottomPoint = bottomPoint; 11138 11139 if (cb && typeof cb === 'function') { 11140 cb(); 11141 } 11142 } 11143 11144 /** 11145 * Destroys the current sticky element. 11146 * Resets the element to the top position first. 11147 * Removes event listeners, JS-added css properties and classes, and unwraps the $element if the JS added the $container. 11148 * @function 11149 */ 11150 11151 }, { 11152 key: '_destroy', 11153 value: function _destroy() { 11154 this._removeSticky(true); 11155 11156 this.$element.removeClass(this.options.stickyClass + ' is-anchored is-at-top').css({ 11157 height: '', 11158 top: '', 11159 bottom: '', 11160 'max-width': '' 11161 }).off('resizeme.zf.trigger').off('mutateme.zf.trigger'); 11162 if (this.$anchor && this.$anchor.length) { 11163 this.$anchor.off('change.zf.sticky'); 11164 } 11165 (0, _jquery2.default)(window).off(this.scrollListener); 11166 11167 if (this.wasWrapped) { 11168 this.$element.unwrap(); 11169 } else { 11170 this.$container.removeClass(this.options.containerClass).css({ 11171 height: '' 11172 }); 11173 } 11174 } 11175 }]); 11176 11177 return Sticky; 11178}(_foundation.Plugin); 11179 11180Sticky.defaults = { 11181 /** 11182 * Customizable container template. Add your own classes for styling and sizing. 11183 * @option 11184 * @type {string} 11185 * @default '<div data-sticky-container></div>' 11186 */ 11187 container: '<div data-sticky-container></div>', 11188 /** 11189 * Location in the view the element sticks to. Can be `'top'` or `'bottom'`. 11190 * @option 11191 * @type {string} 11192 * @default 'top' 11193 */ 11194 stickTo: 'top', 11195 /** 11196 * If anchored to a single element, the id of that element. 11197 * @option 11198 * @type {string} 11199 * @default '' 11200 */ 11201 anchor: '', 11202 /** 11203 * If using more than one element as anchor points, the id of the top anchor. 11204 * @option 11205 * @type {string} 11206 * @default '' 11207 */ 11208 topAnchor: '', 11209 /** 11210 * If using more than one element as anchor points, the id of the bottom anchor. 11211 * @option 11212 * @type {string} 11213 * @default '' 11214 */ 11215 btmAnchor: '', 11216 /** 11217 * Margin, in `em`'s to apply to the top of the element when it becomes sticky. 11218 * @option 11219 * @type {number} 11220 * @default 1 11221 */ 11222 marginTop: 1, 11223 /** 11224 * Margin, in `em`'s to apply to the bottom of the element when it becomes sticky. 11225 * @option 11226 * @type {number} 11227 * @default 1 11228 */ 11229 marginBottom: 1, 11230 /** 11231 * Breakpoint string that is the minimum screen size an element should become sticky. 11232 * @option 11233 * @type {string} 11234 * @default 'medium' 11235 */ 11236 stickyOn: 'medium', 11237 /** 11238 * Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`. 11239 * @option 11240 * @type {string} 11241 * @default 'sticky' 11242 */ 11243 stickyClass: 'sticky', 11244 /** 11245 * Class applied to sticky container. Foundation defaults to `sticky-container`. 11246 * @option 11247 * @type {string} 11248 * @default 'sticky-container' 11249 */ 11250 containerClass: 'sticky-container', 11251 /** 11252 * 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. 11253 * @option 11254 * @type {number} 11255 * @default -1 11256 */ 11257 checkEvery: -1 11258}; 11259 11260/** 11261 * Helper function to calculate em values 11262 * @param Number {em} - number of em's to calculate into pixels 11263 */ 11264function emCalc(em) { 11265 return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em; 11266} 11267 11268exports.Sticky = Sticky; 11269 11270/***/ }), 11271/* 35 */ 11272/***/ (function(module, exports, __webpack_require__) { 11273 11274"use strict"; 11275 11276 11277Object.defineProperty(exports, "__esModule", { 11278 value: true 11279}); 11280exports.Toggler = undefined; 11281 11282var _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; }; }(); 11283 11284var _jquery = __webpack_require__(0); 11285 11286var _jquery2 = _interopRequireDefault(_jquery); 11287 11288var _foundationUtil = __webpack_require__(6); 11289 11290var _foundation = __webpack_require__(2); 11291 11292var _foundationUtil2 = __webpack_require__(5); 11293 11294function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11295 11296function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11297 11298function _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; } 11299 11300function _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
11300onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 11301 11302/** 11303 * Toggler module. 11304 * @module foundation.toggler 11305 * @requires foundation.util.motion 11306 * @requires foundation.util.triggers 11307 */ 11308 11309var Toggler = function (_Plugin) { 11310 _inherits(Toggler, _Plugin); 11311 11312 function Toggler() { 11313 _classCallCheck(this, Toggler); 11314 11315 return _possibleConstructorReturn(this, (Toggler.__proto__ || Object.getPrototypeOf(Toggler)).apply(this, arguments)); 11316 } 11317 11318 _createClass(Toggler, [{ 11319 key: '_setup', 11320 11321 /** 11322 * Creates a new instance of Toggler. 11323 * @class 11324 * @name Toggler 11325 * @fires Toggler#init 11326 * @param {Object} element - jQuery object to add the trigger to. 11327 * @param {Object} options - Overrides to the default plugin settings. 11328 */ 11329 value: function _setup(element, options) { 11330 this.$element = element; 11331 this.options = _jquery2.default.extend({}, Toggler.defaults, element.data(), options); 11332 this.className = ''; 11333 this.className = 'Toggler'; // ie9 back compat 11334 11335 // Triggers init is idempotent, just need to make sure it is initialized 11336 _foundationUtil2.Triggers.init(_jquery2.default); 11337 11338 this._init(); 11339 this._events(); 11340 } 11341 11342 /** 11343 * Initializes the Toggler plugin by parsing the toggle class from data-toggler, or animation classes from data-animate. 11344 * @function 11345 * @private 11346 */ 11347 11348 }, { 11349 key: '_init', 11350 value: function _init() { 11351 var input; 11352 // Parse animation classes if they were set 11353 if (this.options.animate) { 11354 input = this.options.animate.split(' '); 11355 11356 this.animationIn = input[0]; 11357 this.animationOut = input[1] || null; 11358 } 11359 // Otherwise, parse toggle class 11360 else { 11361 input = this.$element.data('toggler'); 11362 // Allow for a . at the beginning of the string 11363 this.className = input[0] === '.' ? input.slice(1) : input; 11364 } 11365 11366 // Add ARIA attributes to triggers 11367 var id = this.$element[0].id; 11368 (0, _jquery2.default)('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-controls', id); 11369 // If the target is hidden, add aria-hidden 11370 this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true); 11371 } 11372 11373 /** 11374 * Initializes events for the toggle trigger. 11375 * @function 11376 * @private 11377 */ 11378 11379 }, { 11380 key: '_events', 11381 value: function _events() { 11382 this.$element.off('toggle.zf.trigger').on('toggle.zf.trigger', this.toggle.bind(this)); 11383 } 11384 11385 /** 11386 * 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". 11387 * @function 11388 * @fires Toggler#on 11389 * @fires Toggler#off 11390 */ 11391 11392 }, { 11393 key: 'toggle', 11394 value: function toggle() { 11395 this[this.options.animate ? '_toggleAnimate' : '_toggleClass'](); 11396 } 11397 }, { 11398 key: '_toggleClass', 11399 value: function _toggleClass() { 11400 this.$element.toggleClass(this.className); 11401 11402 var isOn = this.$element.hasClass(this.className); 11403 if (isOn) { 11404 /** 11405 * Fires if the target element has the class after a toggle. 11406 * @event Toggler#on 11407 */ 11408 this.$element.trigger('on.zf.toggler'); 11409 } else { 11410 /** 11411 * Fires if the target element does not have the class after a toggle. 11412 * @event Toggler#off 11413 */ 11414 this.$element.trigger('off.zf.toggler'); 11415 } 11416 11417 this._updateARIA(isOn); 11418 this.$element.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11419 } 11420 }, { 11421 key: '_toggleAnimate', 11422 value: function _toggleAnimate() { 11423 var _this = this; 11424 11425 if (this.$element.is(':hidden')) { 11426 _foundationUtil.Motion.animateIn(this.$element, this.animationIn, function () { 11427 _this._updateARIA(true); 11428 this.trigger('on.zf.toggler'); 11429 this.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11430 }); 11431 } else { 11432 _foundationUtil.Motion.animateOut(this.$element, this.animationOut, function () { 11433 _this._updateARIA(false); 11434 this.trigger('off.zf.toggler'); 11435 this.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11436 }); 11437 } 11438 } 11439 }, { 11440 key: '_updateARIA', 11441 value: function _updateARIA(isOn) { 11442 this.$element.attr('aria-expanded', isOn ? true : false); 11443 } 11444 11445 /** 11446 * Destroys the instance of Toggler on the element. 11447 * @function 11448 */ 11449 11450 }, { 11451 key: '_destroy', 11452 value: function _destroy() { 11453 this.$element.off('.zf.toggler'); 11454 } 11455 }]); 11456 11457 return Toggler; 11458}
vendor: 4,100 bytes, lines 11458-11551
11458(_foundation.Plugin); 11459 11460Toggler.defaults = { 11461 /** 11462 * Tells the plugin if the element should animated when toggled. 11463 * @option 11464 * @type {boolean} 11465 * @default false 11466 */ 11467 animate: false 11468}; 11469 11470exports.Toggler = Toggler; 11471 11472/***/ }), 11473/* 36 */ 11474/***/ (function(module, exports, __webpack_require__) { 11475 11476"use strict"; 11477 11478 11479Object.defineProperty(exports, "__esModule", { 11480 value: true 11481}); 11482exports.Tooltip = undefined; 11483 11484var _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; }; }(); 11485 11486var _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); } }; 11487 11488var _jquery = __webpack_require__(0); 11489 11490var _jquery2 = _interopRequireDefault(_jquery); 11491 11492var _foundationUtil = __webpack_require__(1); 11493 11494var _foundationUtil2 = __webpack_require__(4); 11495 11496var _foundationUtil3 = __webpack_require__(5); 11497 11498var _foundation = __webpack_require__(15); 11499 11500function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11501 11502function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11503 11504function _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; } 11505 11506function _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; } 11507 11508/** 11509 * Tooltip module. 11510 * @module foundation.tooltip 11511 * @requires foundation.util.box 11512 * @requires foundation.util.mediaQuery 11513 * @requires foundation.util.triggers 11514 */ 11515 11516var Tooltip = function (_Positionable) { 11517 _inherits(Tooltip, _Positionable); 11518 11519 function Tooltip() { 11520 _classCallCheck(this, Tooltip); 11521 11522 return _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).apply(this, arguments)); 11523 } 11524 11525 _createClass(Tooltip, [{ 11526 key: '_setup', 11527 11528 /** 11529 * Creates a new instance of a Tooltip. 11530 * @class 11531 * @name Tooltip 11532 * @fires Tooltip#init 11533 * @param {jQuery} element - jQuery object to attach a tooltip to. 11534 * @param {Object} options - object to extend the default configuration. 11535 */ 11536 value: function _setup(element, options) { 11537 this.$element = element; 11538 this.options = _jquery2.default.extend({}, Tooltip.defaults, this.$element.data(), options); 11539 this.className = 'Tooltip'; // ie9 back compat 11540 11541 this.isActive = false; 11542 this.isClick = false; 11543 11544 // Triggers init is idempotent, just need to make sure it is initialized 11545 _foundationUtil3.Triggers.init(_jquery2.default); 11546 11547 this._init(); 11548 } 11549 11550 /** 11551 * Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anch
11551or. 11552 * @private 11553 */ 11554 11555 }, { 11556 key: '_init', 11557 value: function _init() { 11558 _foundationUtil2.MediaQuery._init(); 11559 var elemId = this.$element.attr('aria-describedby') || (0, _foundationUtil.GetYoDigits)(6, 'tooltip'); 11560 11561 this.options.tipText = this.options.tipText || this.$element.attr('title'); 11562 this.template = this.options.template ? (0, _jquery2.default)(this.options.template) : this._buildTemplate(elemId); 11563 11564 if (this.options.allowHtml) { 11565 this.template.appendTo(document.body).html(this.options.tipText).hide(); 11566 } else { 11567 this.template.appendTo(document.body).text(this.options.tipText).hide(); 11568 } 11569 11570 this.$element.attr({ 11571 'title': '', 11572 'aria-describedby': elemId, 11573 'data-yeti-box': elemId, 11574 'data-toggle': elemId, 11575 'data-resize': elemId 11576 }).addClass(this.options.triggerClass); 11577 11578 _get(Tooltip.prototype.__proto__ || Object.getPrototypeOf(Tooltip.prototype), '_init', this).call(this); 11579 this._events(); 11580 } 11581 }, { 11582 key: '_getDefaultPosition', 11583 value: function _getDefaultPosition() { 11584 // handle legacy classnames 11585 var position = this.$element[0].className.match(/\b(top|left|right|bottom)\b/g); 11586 return position ? position[0] : 'top'; 11587 } 11588 }, { 11589 key: '_getDefaultAlignment', 11590 value: function _getDefaultAlignment() { 11591 return 'center'; 11592 } 11593 }, { 11594 key: '_getHOffset', 11595 value: function _getHOffset() { 11596 if (this.position === 'left' || this.position === 'right') { 11597 return this.options.hOffset + this.options.tooltipWidth; 11598 } else { 11599 return this.options.hOffset; 11600 } 11601 } 11602 }, { 11603 key: '_getVOffset', 11604 value: function _getVOffset() { 11605 if (this.position === 'top' || this.position === 'bottom') { 11606 return this.options.vOffset + this.options.tooltipHeight; 11607 } else { 11608 return this.options.vOffset; 11609 } 11610 } 11611 11612 /** 11613 * builds the tooltip element, adds attributes, and returns the template. 11614 * @private 11615 */ 11616 11617 }, { 11618 key: '_buildTemplate', 11619 value: function _buildTemplate(id) { 11620 var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass + ' ' + this.options.templateClasses).trim(); 11621 var $template = (0, _jquery2.default)('<div></div>').addClass(templateClasses).attr({ 11622 'role': 'tooltip', 11623 'aria-hidden': true, 11624 'data-is-active': false, 11625 'data-is-focus': false, 11626 'id': id 11627 }); 11628 return $template; 11629 } 11630 11631 /** 11632 * 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. 11633 * if the tooltip is larger than the screen width, default to full width - any user selected margin 11634 * @private 11635 */ 11636 11637 }, { 11638 key: '_setPosition', 11639 value: function _setPosition() { 11640 _get(Tooltip.prototype.__proto__ || Object.getPrototypeOf(Tooltip.prototype), '_setPosition', this).call(this, this.$element, this.template); 11641 } 11642 11643 /** 11644 * reveals the tooltip, and fires an event to close any other open tooltips on the page 11645 * @fires Tooltip#closeme 11646 * @fires Tooltip#show 11647 * @function 11648 */ 11649 11650 }, { 11651 key: 'show', 11652 value: function show() { 11653 if (this.options.showOn !== 'all' && !_foundationUtil2.MediaQuery.is(this.options.showOn)) { 11654 // console.error('The screen is too small to display this tooltip'); 11655 return false; 11656 } 11657 11658 var _this = this; 11659 this.template.css('visibility', 'hidden').show(); 11660 this._setPosition(); 11661 this.template.removeClass('top bottom left right').addClass(this.position); 11662 this.template.removeClass('align-top align-bottom align-left align-right align-center').addClass('align-' + this.alignment); 11663 11664 /** 11665 * Fires to close all other open tooltips on the page 11666 * @event Closeme#tooltip 11667 */ 11668 this.$element.trigger('closeme.zf.tooltip', this.template.attr('id')); 11669 11670 this.template.attr({ 11671 'data-is-active': true, 11672 'aria-hidden': false 11673 }); 11674 _this.isActive = true; 11675 // console.log(this.template); 11676 this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function () { 11677 //maybe do stuff? 11678 }); 11679 /** 11680 * Fires when the tooltip is shown 11681 * @event Tooltip#show 11682 */ 11683 this.$element.trigger('show.zf.tooltip'); 11684 } 11685 11686 /** 11687 * Hides the current tooltip, and resets the positioning class if it was changed due to collision 11688 * @fires Tooltip#hide 11689 * @function 11690 */ 11691 11692 }, { 11693 key: 'hide', 11694 value: function hide() { 11695 // console.log('hiding', this.$element.data('yeti-box')); 11696 var _this = this; 11697 this.template.stop().attr({ 11698 'aria-hidden': true, 11699 'data-is-active': false 11700 }).fadeOut(this.options.fadeOutDuration, function () { 11701 _this.isActive = false;
11702 _this.isClick = false; 11703 }); 11704 /** 11705 * fires when the tooltip is hidden 11706 * @event Tooltip#hide 11707 */ 11708 this.$element.trigger('hide.zf.tooltip'); 11709 } 11710 11711 /** 11712 * adds event listeners for the tooltip and its anchor 11713 * TODO combine some of the listeners like focus and mouseenter, etc. 11714 * @private 11715 */ 11716 11717 }, { 11718 key: '_events', 11719 value: function _events() { 11720 var _this = this; 11721 var $template = this.template; 11722 var isFocus = false; 11723 11724 if (!this.options.disableHover) { 11725 11726 this.$element.on('mouseenter.zf.tooltip', function (e) { 11727 if (!_this.isActive) { 11728 _this.timeout = setTimeout(function () { 11729 _this.show(); 11730 }, _this.options.hoverDelay); 11731 } 11732 }).on('mouseleave.zf.tooltip', function (e) { 11733 clearTimeout(_this.timeout); 11734 if (!isFocus || _this.isClick && !_this.options.clickOpen) { 11735 _this.hide(); 11736 } 11737 }); 11738 } 11739 11740 if (this.options.clickOpen) { 11741 this.$element.on('mousedown.zf.tooltip', function (e) { 11742 e.stopImmediatePropagation(); 11743 if (_this.isClick) { 11744 //_this.hide(); 11745 // _this.isClick = false; 11746 } else { 11747 _this.isClick = true; 11748 if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) { 11749 _this.show(); 11750 } 11751 } 11752 }); 11753 } else { 11754 this.$element.on('mousedown.zf.tooltip', function (e) { 11755 e.stopImmediatePropagation(); 11756 _this.isClick = true; 11757 }); 11758 } 11759 11760 if (!this.options.disableForTouch) { 11761 this.$element.on('tap.zf.tooltip touchend.zf.tooltip', function (e) { 11762 _this.isActive ? _this.hide() : _this.show(); 11763 }); 11764 } 11765 11766 this.$element.on({ 11767 // 'toggle.zf.trigger': this.toggle.bind(this), 11768 // 'close.zf.trigger': this.hide.bind(this) 11769 'close.zf.trigger': this.hide.bind(this) 11770 }); 11771 11772 this.$element.on('focus.zf.tooltip', function (e) { 11773 isFocus = true; 11774 if (_this.isClick) { 11775 // If we're not showing open on clicks, we need to pretend a click-launched focus isn't 11776 // a real focus, otherwise on hover and come back we get bad behavior 11777 if (!_this.options.clickOpen) { 11778 isFocus = false; 11779 } 11780 return false; 11781 } else { 11782 _this.show(); 11783 } 11784 }).on('focusout.zf.tooltip', function (e) { 11785 isFocus = false; 11786 _this.isClick = false; 11787 _this.hide(); 11788 }).on('resizeme.zf.trigger', function () { 11789 if (_this.isActive) { 11790 _this._setPosition(); 11791 } 11792 }); 11793 } 11794 11795 /** 11796 * adds a toggle method, in addition to the static show() & hide() functions 11797 * @function 11798 */ 11799 11800 }, { 11801 key: 'toggle', 11802 value: function toggle() { 11803 if (this.isActive) { 11804 this.hide(); 11805 } else { 11806 this.show(); 11807 } 11808 } 11809 11810 /** 11811 * Destroys an instance of tooltip, removes template element from the view. 11812 * @function 11813 */ 11814 11815 }, { 11816 key: '_destroy', 11817 value: function _destroy() { 11818 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'); 11819 11820 this.template.remove(); 11821 } 11822 }]); 11823 11824 return Tooltip; 11825}(_foundation.Positionable); 11826 11827Tooltip.defaults = { 11828 disableForTouch: false, 11829 /** 11830 * Time, in ms, before a tooltip should open on hover. 11831 * @option 11832 * @type {number} 11833 * @default 200 11834 */ 11835 hoverDelay: 200, 11836 /** 11837 * Time, in ms, a tooltip should take to fade into view. 11838 * @option 11839 * @type {number} 11840 * @default 150 11841 */ 11842 fadeInDuration: 150, 11843 /** 11844 * Time, in ms, a tooltip should take to fade out of view. 11845 * @option 11846 * @type {number} 11847 * @default 150 11848 */ 11849 fadeOutDuration: 150, 11850 /** 11851 * Disables hover events from opening the tooltip if set to true 11852 * @option 11853 * @type {boolean} 11854 * @default false 11855 */ 11856 disableHover: false, 11857 /** 11858 * Optional addtional classes to apply to the tooltip template on init. 11859 * @option 11860 * @type {string} 11861 * @default '' 11862 */ 11863 templateClasses: '', 11864 /** 11865 * Non-optional class added to tooltip templates. Foundation default is 'tooltip'. 11866 * @option 11867 * @type {string} 11868 * @default 'tooltip' 11869 */ 11870 tooltipClass: 'tooltip', 11871 /** 11872 * Class applied to the tooltip anchor element. 11873 * @option 11874 * @type {string} 11875 * @default 'has-tip' 11876 */ 11877 triggerClass: 'has-tip', 11878 /** 11879 * Minimum breakpoint size at which to open the tooltip. 11880 * @option 11881 * @type {string} 11882 * @default 'small' 11883 */ 11884 showOn: 'small', 11885 /** 11886 * Custom template to be used to generate markup for tooltip. 11887 * @option 11888 * @type {string} 11889 * @default '' 11890 */ 11891 template: '', 11892 /** 11893 * Text displayed in the tooltip template on open. 11894 * @option 11895 * @type {string} 11896 * @default '' 11897 */ 11898 tipText: '', 11899 touchCloseText: 'Tap to close.', 11900 /** 11901 * Allows the tooltip to remain open if triggered with a click or touch event. 11902 * @option 11903 * @type {boolean} 11904 * @default true 11905 */ 11906 clickOpen: true, 11907 /** 11908 * DEPRECATED Additional positioning classes, set by the JS 11909 * @option 11910 * @type {string} 11911 * @default '' 11912 */ 11913 positionClass: '', 11914 /** 11915 * Position of tooltip. Can be left, right, bottom, top, or auto. 11916 * @option 11917 * @type {string} 11918 * @default 'auto' 11919 */ 11920 position: 'auto', 11921 /** 11922 * Alignment of tooltip relative to anchor. Can be left, right, bottom, top, center, or auto. 11923 * @option 11924 * @type {string} 11925 * @default 'auto' 11926 */ 11927 alignment: 'auto', 11928 /** 11929 * Allow overlap of container/window. If false, tooltip will first try to 11930 * position as defined by data-position and data-alignment, but reposition if 11931 * it would cause an overflow. @option 11932 * @type {boolean} 11933 * @default false 11934 */ 11935 allowOverlap: false, 11936 /** 11937 * Allow overlap of only the bottom of the container. This is the most common 11938 * behavior for dropdowns, allowing the dropdown to extend the bottom of the 11939 * screen but not otherwise influence or break out of the container. 11940 * Less common for tooltips. 11941 * @option 11942 * @type {boolean} 11943 * @default false 11944 */ 11945 allowBottomOverlap: false, 11946 /** 11947 * Distance, in pixels, the template should push away from the anch
11947or on the Y axis. 11948 * @option 11949 * @type {number} 11950 * @default 0 11951 */ 11952 vOffset: 0, 11953 /** 11954 * Distance, in pixels, the template should push away from the anchor on the X axis 11955 * @option 11956 * @type {number} 11957 * @default 0 11958 */ 11959 hOffset: 0, 11960 /** 11961 * Distance, in pixels, the template spacing auto-adjust for a vertical tooltip 11962 * @option 11963 * @type {number} 11964 * @default 14 11965 */ 11966 tooltipHeight: 14, 11967 /** 11968 * Distance, in pixels, the template spacing auto-adjust for a horizontal tooltip 11969 * @option 11970 * @type {number} 11971 * @default 12 11972 */ 11973 tooltipWidth: 12, 11974 /** 11975 * Allow HTML in tooltip. Warning: If you are loading user-generated content into tooltips, 11976 * allowing HTML may open yourself up to XSS attacks. 11977 * @option 11978 * @type {boolean} 11979 * @default false 11980 */ 11981 allowHtml: false 11982}; 11983 11984/** 11985 * TODO utilize resize event trigger 11986 */ 11987 11988exports.Tooltip = Tooltip; 11989 11990/***/ }), 11991/* 37 */ 11992/***/ (function(module, exports, __webpack_require__) { 11993 11994"use strict"; 11995 11996 11997module.exports = function (module) { 11998 if (!module.webpackPolyfill) { 11999 module.deprecate = function () {}; 12000 module.paths = []; 12001 // module.parent = undefined by default 12002 if (!module.children) module.children = []; 12003 Object.defineProperty(module, "loaded", { 12004 enumerable: true, 12005 get: function get() { 12006 return module.l; 12007 } 12008 }); 12009 Object.defineProperty(module, "id", { 12010 enumerable: true, 12011 get: function get() { 12012 return module.i; 12013 } 12014 }); 12015 module.webpackPolyfill = 1; 12016 } 12017 return module; 12018}; 12019 12020/***/ }), 12021/* 38 */ 12022/***/ (function(module, exports, __webpack_require__) { 12023 12024"use strict"; 12025/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; 12026 12027var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 12028 12029/** 12030 * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). 12031 * @version v4.3.1 12032 * @link https://github.com/ten1seven/what-input 12033 * @license MIT 12034 */ 12035(function webpackUniversalModuleDefinition(root, factory) { 12036 if (( false ? 'undefined' : _typeof(exports)) === 'object' && ( false ? 'undefined' : _typeof(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 12037 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 12038 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 12039 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') exports["whatInput"] = factory();else root["whatInput"] = factory(); 12040})(undefined, function () { 12041 return (/******/function (modules) { 12042 // webpackBootstrap 12043 /******/ // The module cache 12044 /******/var installedModules = {}; 12045 12046 /******/ // The require function 12047 /******/function __webpack_require__(moduleId) { 12048 12049 /******/ // Check if module is in cache 12050 /******/if (installedModules[moduleId]) 12051 /******/return installedModules[moduleId].exports; 12052 12053 /******/ // Create a new module (and put it into the cache) 12054 /******/var module = installedModules[moduleId] = { 12055 /******/exports: {}, 12056 /******/id: moduleId, 12057 /******/loaded: false 12058 /******/ }; 12059 12060 /******/ // Execute the module function 12061 /******/modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 12062 12063 /******/ // Flag the module as loaded 12064 /******/module.loaded = true; 12065 12066 /******/ // Return the exports of the module 12067 /******/return module.exports; 12068 /******/ 12069 } 12070 12071 /******/ // expose the modules object (__webpack_modules__) 12072 /******/__webpack_require__.m = modules; 12073 12074 /******/ // expose the module cache 12075 /******/__webpack_require__.c = installedModules; 12076 12077 /******/ // __webpack_public_path__ 12078 /******/__webpack_require__.p = ""; 12079 12080 /******/ // Load entry module and return exports 12081 /******/return __webpack_require__(0); 12082 /******/ 12083 }( 12084 /************************************************************************/ 12085 /******/[ 12086 /* 0 */
12087 /***/function (module, exports) { 12088 12089 'use strict'; 12090 12091 module.exports = function () { 12092 /* 12093 * variables 12094 */ 12095 12096 // last used input type 12097 var currentInput = 'initial'; 12098 12099 // last used input intent 12100 var currentIntent = null; 12101 12102 // cache document.documentElement 12103 var doc = document.documentElement; 12104 12105 // form input types 12106 var formInputs = ['input', 'select', 'textarea']; 12107 12108 var functionList = []; 12109 12110 // list of modifier keys commonly used with the mouse and 12111 // can be safely ignored to prevent false keyboard detection 12112 var ignoreMap = [16, // shift 12113 17, // control 12114 18, // alt 12115 91, // Windows key / left Apple cmd 12116 93 // Windows menu / right Apple cmd 12117 ]; 12118 12119 // list of keys for which we change intent even for form inputs 12120 var changeIntentMap = [9 // tab 12121 ]; 12122 12123 // mapping of events to input types 12124 var inputMap = { 12125 keydown: 'keyboard', 12126 keyup: 'keyboard', 12127 mousedown: 'mouse', 12128 mousemove: 'mouse', 12129 MSPointerDown: 'pointer', 12130 MSPointerMove: 'pointer', 12131 pointerdown: 'pointer', 12132 pointermove: 'pointer', 12133 touchstart: 'touch' 12134 }; 12135 12136 // array of all used input types 12137 var inputTypes = []; 12138 12139 // boolean: true if touch buffer is active 12140 var isBuffering = false; 12141 12142 // boolean: true if the page is being scrolled 12143 var isScrolling = false; 12144 12145 // store current mouse position 12146 var mousePos = { 12147 x: null, 12148 y: null 12149 }; 12150 12151 // map of IE 10 pointer events 12152 var pointerMap = { 12153 2: 'touch', 12154 3: 'touch', // treat pen like touch 12155 4: 'mouse' 12156 }; 12157 12158 var supportsPassive = false; 12159 12160 try { 12161 var opts = Object.defineProperty({}, 'passive', { 12162 get: function get() { 12163 supportsPassive = true; 12164 } 12165 }); 12166 12167 window.addEventListener('test', null, opts); 12168 } catch (e) {} 12169 12170 /* 12171 * set up 12172 */ 12173 12174 var setUp = function setUp() { 12175 // add correct mouse wheel event mapping to `inputMap` 12176 inputMap[detectWheel()] = 'mouse'; 12177 12178 addListeners(); 12179 setInput(); 12180 }; 12181 12182 /* 12183 * events 12184 */ 12185 12186 var addListeners = function addListeners() { 12187 // `pointermove`, `MSPointerMove`, `mousemove` and mouse wheel event binding 12188 // can only demonstrate potential, but not actual, interaction 12189 // and are treated separately 12190 var options = supportsPassive ? { passive: true } : false; 12191 12192 // pointer events (mouse, pen, touch) 12193 if (window.PointerEvent) { 12194 doc.addEventListener('pointerdown', updateInput); 12195 doc.addEventListener('pointermove', setIntent); 12196 } else if (window.MSPointerEvent) { 12197 doc.addEventListener('MSPointerDown', updateInput); 12198 doc.addEventListener('MSPointerMove', setIntent); 12199 } else { 12200 // mouse events 12201 doc.addEventListener('mousedown', updateInput); 12202 doc.addEventListener('mousemove', setIntent); 12203 12204 // touch events 12205 if ('ontouchstart' in window) { 12206 doc.addEventListener('touchstart', touchBuffer, options); 12207 doc.addEventListener('touchend', touchBuffer); 12208 } 12209 } 12210 12211 // mouse wheel 12212 doc.addEventListener(detectWheel(), setIntent, options); 12213 12214 // keyboard events 12215 doc.addEventListener('keydown', updateInput); 12216 doc.addEventListener('keyup', updateInput); 12217 }; 12218 12219 // checks conditions before updating new input 12220 var updateInput = function updateInput(event) { 12221 // only execute if the touch buffer timer isn't running 12222 if (!isBuffering) { 12223 var eventKey = event.which; 12224 var value = inputMap[event.type]; 12225 if (value === 'pointer') value = pointerType(event); 12226 12227 if (currentInput !== value || currentIntent !== value) { 12228 var activeElem = document.activeElement; 12229 var activeInput = false; 12230 var notFormInput = activeElem && activeElem.nodeName && formInputs.indexOf(activeElem.nodeName.toLowerCase()) === -1; 12231 12232 if (notFormInput || changeIntentMap.indexOf(eventKey) !== -1) { 12233 activeInput = true; 12234 } 12235 12236 if (value === 'touch' || 12237 // ignore mouse modifier keys 12238 value === 'mouse' || 12239 // don't switch if the current element is a form input 12240 value === 'keyboard' && eventKey && activeInput && ignoreMap.indexOf(eventKey) === -1) { 12241 // set the current and catch-all variable 12242 currentInput = currentIntent = value; 12243 12244 setInput(); 12245 } 12246 } 12247 } 12248 }; 12249
12250 // updates the doc and `inputTypes` array with new input 12251 var setInput = function setInput() { 12252 doc.setAttribute('data-whatinput', currentInput); 12253 doc.setAttribute('data-whatintent', currentInput); 12254 12255 if (inputTypes.indexOf(currentInput) === -1) { 12256 inputTypes.push(currentInput); 12257 doc.className += ' whatinput-types-' + currentInput; 12258 } 12259 12260 fireFunctions('input'); 12261 }; 12262 12263 // updates input intent for `mousemove` and `pointermove` 12264 var setIntent = function setIntent(event) { 12265 // test to see if `mousemove` happened relative to the screen 12266 // to detect scrolling versus mousemove 12267 if (mousePos['x'] !== event.screenX || mousePos['y'] !== event.screenY) { 12268 isScrolling = false; 12269 12270 mousePos['x'] = event.screenX; 12271 mousePos['y'] = event.screenY; 12272 } else { 12273 isScrolling = true; 12274 } 12275 12276 // only execute if the touch buffer timer isn't running 12277 // or scrolling isn't happening 12278 if (!isBuffering && !isScrolling) { 12279 var value = inputMap[event.type]; 12280 if (value === 'pointer') value = pointerType(event); 12281 12282 if (currentIntent !== value) { 12283 currentIntent = value; 12284 12285 doc.setAttribute('data-whatintent', currentIntent); 12286 12287 fireFunctions('intent'); 12288 } 12289 } 12290 }; 12291 12292 // buffers touch events because they frequently also fire mouse events 12293 var touchBuffer = function touchBuffer(event) { 12294 if (event.type === 'touchstart') { 12295 isBuffering = false; 12296 12297 // set the current input 12298 updateInput(event); 12299 } else { 12300 isBuffering = true; 12301 } 12302 }; 12303 12304 var fireFunctions = function fireFunctions(type) { 12305 for (var i = 0, len = functionList.length; i < len; i++) { 12306 if (functionList[i].type === type) { 12307 functionList[i].fn.call(undefined, currentIntent); 12308 } 12309 } 12310 }; 12311 12312 /* 12313 * utilities 12314 */ 12315 12316 var pointerType = function pointerType(event) { 12317 if (typeof event.pointerType === 'number') { 12318 return pointerMap[event.pointerType]; 12319 } else { 12320 // treat pen like touch 12321 return event.pointerType === 'pen' ? 'touch' : event.pointerType; 12322 } 12323 }; 12324 12325 // detect version of mouse wheel event to use 12326 // via https://developer.mozilla.org/en-US/docs/Web/Events/wheel 12327 var detectWheel = function detectWheel() { 12328 var wheelType = void 0; 12329 12330 // Modern browsers support "wheel" 12331 if ('onwheel' in document.createElement('div')) { 12332 wheelType = 'wheel'; 12333 } else { 12334 // Webkit and IE support at least "mousewheel" 12335 // or assume that remaining browsers are older Firefox 12336 wheelType = document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll'; 12337 } 12338 12339 return wheelType; 12340 }; 12341 12342 var objPos = function objPos(match) { 12343 for (var i = 0, len = functionList.length; i < len; i++) { 12344 if (functionList[i].fn === match) { 12345 return i; 12346 } 12347 } 12348 }; 12349 12350 /* 12351 * init 12352 */ 12353 12354 // don't start script unless browser cuts the mustard 12355 // (also passes if polyfills are used) 12356 if ('addEventListener' in window && Array.prototype.indexOf) { 12357 setUp(); 12358 } 12359 12360 /* 12361 * api 12362 */ 12363 12364 return { 12365 // returns string: the current input type 12366 // opt: 'loose'|'strict' 12367 // 'strict' (default): returns the same value as the `data-whatinput` attribute 12368 // 'loose': includes `data-whatintent` value if it's more current than `data-whatinput` 12369 ask: function ask(opt) { 12370 return opt === 'loose' ? currentIntent : currentInput; 12371 }, 12372 12373 // returns array: all the detected input types 12374 types: function types() { 12375 return inputTypes; 12376 }, 12377 12378 // overwrites ignored keys with provided array 12379 ignoreKeys: function ignoreKeys(arr) { 12380 ignoreMap = arr; 12381 }, 12382 12383 // attach functions to input and intent "events" 12384 // funct: function to fire on change 12385 // eventType: 'input'|'intent' 12386 registerOnChange: function registerOnChange(fn, eventType) { 12387 functionList.push({ 12388 fn: fn, 12389 type: eventType || 'input' 12390 }); 12391 }, 12392 12393 unRegisterOnChange: function unRegisterOnChange(fn) { 12394 var position = objPos(fn); 12395 12396 if (position) { 12397 functionList.splice(position, 1); 12398 } 12399 } 12400 }; 12401 }(); 12402 12403 /***/ 12404 } 12405 /******/]) 12406 ); 12407}); 12408; 12409/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module))) 12410 12411/***/ }), 12412/* 39 */ 12413/***/ (function(module, exports, __webpack_require__) { 12414 12415"use strict"; 12416 12417 12418var _jquery = __webpack_require__(0); 12419 12420var _jquery2 = _interopRequireDefault(_jquery); 12421 12422function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12423 12424_jquery2.default.ajax({ 12425 dataType: 'jsonp', 12426 url: 'https://api.github.com/repos/olefredrik/foundationpress?callback=foundationpressGithub&access_token=ed6229228dbc763038dbf1e68d0d8a4a0935b38a', 12427 success: function success(response) { 12428 if (response && response.data.watchers) { 12429 var watchers = (Math.round(response.data.watchers / 100, 10) / 10).toFixed(1); 12430 (0, _jquery2.default)('#stargazers a').html(watchers + 'k stargazers'); 12431 } 12432 } 12433}); 12434 12435/***/ }), 12436/* 40 */ 12437/***/ (function(module, exports, __webpack_require__) { 12438 12439module.exports = __webpack_require__(19); 12440 12441 12442/***/ }) 12443/******/ ]);
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.