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 4636jQuery(window).on("scroll", function () { 4637 if (jQuery(window).scrollTop() > 50) { 4638 jQuery(".top-bar").addClass("active"); 4639 jQuery(".logo").addClass("active_small"); 4640 } else { 4641 jQuery(".top-bar").removeClass("active"); 4642 jQuery(".logo").removeClass("active_small"); 4643 } 4644}); 4645 4646jQuery(window).on("scroll", function () { 4647 if (jQuery(window).scrollTop() > 250) { 4648 jQuery("#main_content-transparent").addClass("main-content-opacity"); 4649 } else { 4650 jQuery("#main_content-transparent").removeClass("main-content-opacity"); 4651 } 4652}); 4653 4654(0, _jquery2.default)('[data-toggle-menu]').on("click", function () { 4655 (0, _jquery2.default)("#overlay-nav-menu").toggleClass("is-open"); 4656}); 4657 4658(0, _jquery2.default)('#overlay-nav-menu a').on("click", function () { 4659 (0, _jquery2.default)("#overlay-nav-menu").toggleClass("is-open"); 4660}); 4661 4662/***/ }), 4663/* 20 */ 4664/***/ (function(module, exports, __webpack_require__) { 4665 4666"use strict"; 4667 4668 4669Object.defineProperty(exports, "__esModule", { 4670 value: true 4671}); 4672 4673var _jquery = __webpack_require__(0); 4674 4675var _jquery2 = _interopRequireDefault(_jquery); 4676 4677var _foundation = __webpack_require__(22); 4678 4679var _foundationUtil = __webpack_require__(1); 4680 4681var _foundationUtil2 = __webpack_require__(7); 4682 4683var _foundationUtil3 = __webpack_require__(8); 4684 4685var _foundationUtil4 = __webpack_require__(3); 4686 4687var _foundationUtil5 = __webpack_require__(4); 4688 4689var _foundationUtil6 = __webpack_require__(6); 4690 4691var _foundationUtil7 = __webpack_require__(9); 4692 4693var _foundationUtil8 = __webpack_require__(18); 4694 4695var _foundationUtil9 = __webpack_require__(10); 4696 4697var _foundationUtil10 = __webpack_require__(5); 4698 4699var _foundation2 = __webpack_require__(21); 4700 4701var _foundation3 = __webpack_require__(11); 4702 4703var _foundation4 = __webpack_require__(12); 4704 4705var _foundation5 = __webpack_require__(13); 4706 4707var _foundation6 = __webpack_require__(23); 4708 4709var _foundation7 = __webpack_require__(14); 4710 4711var _foundation8 = __webpack_require__(24); 4712 4713var _foundation9 = __webpack_require__(25); 4714 4715var _foundation10 = __webpack_require__(26); 4716 4717var _foundation11 = __webpack_require__(27); 4718 4719var _foundation12 = __webpack_require__(28); 4720 4721var _foundation13 = __webpack_require__(30); 4722 4723var _foundation14 = __webpack_require__(31); 4724 4725var _foundation15 = __webpack_require__(32); 4726 4727var _foundation16 = __webpack_require__(33); 4728 4729var _foundation17 = __webpack_require__(16); 4730 4731var _foundation18 = __webpack_require__(34); 4732 4733var _foundation19 = __webpack_require__(17); 4734 4735var _foundation20 = __webpack_require__(35); 4736 4737var _foundation21 = __webpack_require__(36); 4738 4739var _foundation22 = __webpack_require__(29); 4740 4741function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4742 4743_foundation.Foundation.addToJquery(_jquery2.default); 4744 4745// Add Foundation Utils to Foundation global namespace for backwards 4746// compatibility. 4747 4748_foundation.Foundation.rtl = _foundationUtil.rtl; 4749_foundation.Foundation.GetYoDigits = _foundationUtil.GetYoDigits; 4750_foundation.Foundation.transitionend = _foundationUtil.transitionend; 4751 4752_foundation.Foundation.Box = _foundationUtil2.Box; 4753_foundation.Foundation.onImagesLoaded = _foundationUtil3.onImagesLoaded; 4754_foundation.Foundation.Keyboard = _foundationUtil4.Keyboard; 4755_foundation.Foundation.MediaQuery = _foundationUtil5.MediaQuery; 4756_foundation.Foundation.Motion = _foundationUtil6.Motion; 4757_foundation.Foundation.Move = _foundationUtil6.Move; 4758_foundation.Foundation.Nest = _foundationUtil7.Nest; 4759_foundation.Foundation.Timer = _foundationUtil8.Timer; 4760 4761// Touch and Triggers previously were almost purely sede effect driven, 4762// so n../../js// need to add it to Foundation, just init them. 4763
4764_foundationUtil9.Touch.init(_jquery2.default); 4765 4766_foundationUtil10.Triggers.init(_jquery2.default, _foundation.Foundation); 4767 4768_foundation.Foundation.plugin(_foundation2.Abide, 'Abide'); 4769 4770_foundation.Foundation.plugin(_foundation3.Accordion, 'Accordion'); 4771 4772_foundation.Foundation.plugin(_foundation4.AccordionMenu, 'AccordionMenu'); 4773 4774_foundation.Foundation.plugin(_foundation5.Drilldown, 'Drilldown'); 4775 4776_foundation.Foundation.plugin(_foundation6.Dropdown, 'Dropdown'); 4777 4778_foundation.Foundation.plugin(_foundation7.DropdownMenu, 'DropdownMenu'); 4779 4780_foundation.Foundation.plugin(_foundation8.Equalizer, 'Equalizer'); 4781 4782_foundation.Foundation.plugin(_foundation9.Interchange, 'Interchange'); 4783 4784_foundation.Foundation.plugin(_foundation10.Magellan, 'Magellan'); 4785 4786_foundation.Foundation.plugin(_foundation11.OffCanvas, 'OffCanvas'); 4787 4788_foundation.Foundation.plugin(_foundation12.Orbit, 'Orbit'); 4789 4790_foundation.Foundation.plugin(_foundation13.ResponsiveMenu, 'ResponsiveMenu'); 4791 4792_foundation.Foundation.plugin(_foundation14.ResponsiveToggle, 'ResponsiveToggle'); 4793 4794_foundation.Foundation.plugin(_foundation15.Reveal, 'Reveal'); 4795 4796_foundation.Foundation.plugin(_foundation16.Slider, 'Slider'); 4797 4798_foundation.Foundation.plugin(_foundation17.SmoothScroll, 'SmoothScroll'); 4799
4800_foundation.Foundation.plugin(_foundation18.Sticky, 'Sticky'); 4801 4802_foundation.Foundation.plugin(_foundation19.Tabs, 'Tabs'); 4803 4804_foundation.Foundation.plugin(_foundation20.Toggler, 'Toggler'); 4805 4806_foundation.Foundation.plugin(_foundation21.Tooltip, 'Tooltip'); 4807 4808_foundation.Foundation.plugin(_foundation22.ResponsiveAccordionTabs, 'ResponsiveAccordionTabs'); 4809 4810exports.default = _foundation.Foundation; 4811 4812/***/ }), 4813/* 21 */ 4814/***/ (function(module, exports, __webpack_require__) { 4815 4816"use strict"; 4817 4818 4819Object.defineProperty(exports, "__esModule", { 4820 value: true 4821}); 4822exports.Abide = undefined; 4823 4824var _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; }; }(); 4825 4826var _jquery = __webpack_require__(0); 4827 4828var _jquery2 = _interopRequireDefault(_jquery); 4829 4830var _foundation = __webpack_require__(2); 4831 4832function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4833 4834function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4835 4836function _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; } 4837 4838function _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; } 4839 4840/** 4841 * Abide module. 4842 * @module foundation.abide 4843 */ 4844 4845var Abide = function (_Plugin) { 4846 _inherits(Abide, _Plugin); 4847 4848 function Abide() { 4849 _classCallCheck(this, Abide); 4850 4851 return _possibleConstructorReturn(this, (Abide.__proto__ || Object.getPrototypeOf(Abide)).apply(this, arguments)); 4852 } 4853 4854 _createClass(Abide, [{ 4855 key: '_setup', 4856 4857 /** 4858 * Creates a new instance of Abide. 4859 * @class 4860 * @name Abide 4861 * @fires Abide#init 4862 * @param {Object} element - jQuery object to add the trigger to. 4863 * @param {Object} options - Overrides to the default plugin settings. 4864 */ 4865 value: function _setup(element) { 4866 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 4867 4868 this.$element = element; 4869 this.options = _jquery2.default.extend({}, Abide.defaults, this.$element.data(), options); 4870 4871 this.className = 'Abide'; // ie9 back compat 4872 this._init(); 4873 } 4874 4875 /** 4876 * Initializes the Abide plugin and calls functions to get Abide functioning on load. 4877 * @private 4878 */ 4879 4880 }, { 4881 key: '_init', 4882 value: function _init() { 4883 this.$inputs = this.$element.find('input, textarea, select'); 4884 4885 this._events(); 4886 } 4887 4888 /** 4889 * Initializes events for Abide. 4890 * @private 4891 */ 4892 4893 }, { 4894 key: '_events', 4895 value: function _events() { 4896 var _this3 = this; 4897 4898 this.$element.off('.abide').on('reset.zf.abide', function () { 4899 _this3.resetForm(); 4900 }).on('submit.zf.abide', function () { 4901 return _this3.validateForm(); 4902 }); 4903 4904 if (this.options.validateOn === 'fieldChange') { 4905 this.$inputs.off('change.zf.abide').on('change.zf.abide', function (e) { 4906 _this3.validateInput((0, _jquery2.default)(e.target)); 4907 }); 4908 } 4909 4910 if (this.options.liveValidate) { 4911 this.$inputs.off('input.zf.abide').on('input.zf.abide', function (e) { 4912 _this3.validateInput((0, _jquery2.default)(e.target)); 4913 }); 4914 } 4915 4916 if (this.options.validateOnBlur) { 4917 this.$inputs.off('blur.zf.abide').on('blur.zf.abide', function (e) { 4918 _this3.validateInput((0, _jquery2.default)(e.target)); 4919 }); 4920 } 4921 } 4922 4923 /** 4924 * Calls necessary functions to update Abide upon DOM change 4925 * @private 4926 */ 4927 4928 }, { 4929 key: '_reflow', 4930 value: function _reflow() { 4931 this._init(); 4932 } 4933 4934 /** 4935 * Checks whether or not a form element has the required attribute and if it's checked or not 4936 * @param {Object} element - jQuery object to check for required attribute 4937 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 4938 */ 4939 4940 }, { 4941 key: 'requiredCheck', 4942 value: function requiredCheck($el) { 4943 if (!$el.attr('required')) return true; 4944 4945 var isGood = true; 4946 4947 switch ($el[0].type) { 4948 case 'checkbox': 4949 isGood = $el[0].checked; 4950 break; 4951 4952 case 'select': 4953 case 'select-one': 4954 case 'select-multiple': 4955 var opt = $el.find('option:selected'); 4956 if (!opt.length || !opt.val()) isGood = false;
4957 break; 4958 4959 default: 4960 if (!$el.val() || !$el.val().length) isGood = false; 4961 } 4962 4963 return isGood; 4964 } 4965 4966 /** 4967 * Get: 4968 * - Based on $el, the first element(s) corresponding to `formErrorSelector` in this order: 4969 * 1. The element's direct sibling('s). 4970 * 2. The element's parent's children. 4971 * - Element(s) with the attribute `[data-form-error-for]` set with the element's id. 4972 * 4973 * This allows for multiple form errors per input, though if none are found, no form errors will be shown. 4974 * 4975 * @param {Object} $el - jQuery object to use as reference to find the form error selector. 4976 * @returns {Object} jQuery object with the selector. 4977 */ 4978 4979 }, { 4980 key: 'findFormError', 4981 value: function findFormError($el) { 4982 var id = $el[0].id; 4983 var $error = $el.siblings(this.options.formErrorSelector); 4984 4985 if (!$error.length) { 4986 $error = $el.parent().find(this.options.formErrorSelector); 4987 } 4988 4989 $error = $error.add(this.$element.find('[data-form-error-for="' + id + '"]')); 4990 4991 return $error; 4992 } 4993 4994 /** 4995 * Get the first element in this order: 4996 * 2. The <label> with the attribute `[for="someInputId"]` 4997 * 3. The `.closest()` <label> 4998 * 4999 * @param {Object} $el - jQuery object to check for required attribute 5000 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 5001 */ 5002 5003 }, { 5004 key: 'findLabel', 5005 value: function findLabel($el) { 5006 var id = $el[0].id; 5007 var $label = this.$element.find('label[for="' + id + '"]'); 5008 5009 if (!$label.length) { 5010 return $el.closest('label'); 5011 } 5012 5013 return $label; 5014 } 5015 5016 /** 5017 * Get the set of labels associated with a set of radio els in this order 5018 * 2. The <label> with the attribute `[for="someInputId"]` 5019 * 3. The `.closest()` <label> 5020 * 5021 * @param {Object} $el - jQuery object to check for required attribute 5022 * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty 5023 */ 5024 5025 }, { 5026 key: 'findRadioLabels', 5027 value: function findRadioLabels($els) { 5028 var _this4 = this; 5029 5030 var labels = $els.map(function (i, el) { 5031 var id = el.id; 5032 var $label = _this4.$element.find('label[for="' + id + '"]'); 5033 5034 if (!$label.length) { 5035 $label = (0, _jquery2.default)(el).closest('label'); 5036 } 5037 return $label[0]; 5038 }); 5039 5040 return (0, _jquery2.default)(labels); 5041 } 5042 5043 /** 5044 * Adds the CSS error class as specified by the Abide settings to the label, input, and the form 5045 * @param {Object} $el - jQuery object to add the class to 5046 */ 5047 5048 }, { 5049 key: 'addErrorClasses', 5050 value: function addErrorClasses($el) { 5051 var $label = this.findLabel($el); 5052 var $formError = this.findFormError($el); 5053 5054 if ($label.length) { 5055 $label.addClass(this.options.labelErrorClass); 5056 } 5057 5058 if ($formError.length) { 5059 $formError.addClass(this.options.formErrorClass); 5060 } 5061 5062 $el.addClass(this.options.inputErrorClass).attr('data-invalid', ''); 5063 } 5064 5065 /** 5066 * Remove CSS error classes etc from an entire radio button group 5067 * @param {String} groupName - A string that specifies the name of a radio button group 5068 * 5069 */ 5070 5071 }, { 5072 key: 'removeRadioErrorClasses', 5073 value: function removeRadioErrorClasses(groupName) { 5074 var $els = this.$element.find(':radio[name="' + groupName + '"]'); 5075 var $labels = this.findRadioLabels($els); 5076 var $formErrors = this.findFormError($els); 5077 5078 if ($labels.length) { 5079 $labels.removeClass(this.options.labelErrorClass); 5080 } 5081 5082 if ($formErrors.length) { 5083 $formErrors.removeClass(this.options.formErrorClass); 5084 } 5085 5086 $els.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 5087 } 5088 5089 /** 5090 * Removes CSS error class as specified by the Abide settings from the label, input, and the form 5091 * @param {Object} $el - jQuery object to remove the class from 5092 */ 5093 5094 }, { 5095 key: 'removeErrorClasses', 5096 value: function removeErrorClasses($el) { 5097 // radios need to clear all of the els 5098 if ($el[0].type == 'radio') { 5099 return this.removeRadioErrorClasses($el.attr('name')); 5100 } 5101 5102 var $label = this.findLabel($el); 5103 var $formError = this.findFormError($el); 5104 5105 if ($label.length) { 5106 $label.removeClass(this.options.labelErrorClass); 5107 } 5108 5109 if ($formError.length) { 5110 $formError.removeClass(this.options.formErrorClass); 5111 } 5112 5113 $el.removeClass(this.options.inputErrorClass).removeAttr('data-invalid'); 5114 } 5115 5116 /** 5117 * Goes through a form to find inputs and proceeds to validate them in ways specific to their type. 5118 * Ignores inputs with data-abide-ignore, type="hidden" or disabled attributes set 5119 * @fires Abide#invalid 5120 * @fires Abide#valid 5121 * @param {Object} element - jQuery object to validate, should be an HTML input 5122 * @returns {Boolean} goodToGo - If the input is valid or not. 5123 */ 5124 5125 }, { 5126 key: 'validateInput', 5127 value: function validateInput($el) { 5128 var clearRequire = this.requiredCheck($el), 5129 validated = false, 5130 customValidator = true, 5131 validator = $el.attr('data-validator'), 5132 equalTo = true; 5133
5134 // don't validate ignored inputs or hidden inputs or disabled inputs 5135 if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]') || $el.is('[disabled]')) { 5136 return true; 5137 } 5138 5139 switch ($el[0].type) { 5140 case 'radio': 5141 validated = this.validateRadio($el.attr('name')); 5142 break; 5143 5144 case 'checkbox': 5145 validated = clearRequire; 5146 break; 5147 5148 case 'select': 5149 case 'select-one': 5150 case 'select-multiple': 5151 validated = clearRequire; 5152 break; 5153 5154 default: 5155 validated = this.validateText($el); 5156 } 5157 5158 if (validator) { 5159 customValidator = this.matchValidation($el, validator, $el.attr('required')); 5160 } 5161 5162 if ($el.attr('data-equalto')) { 5163 equalTo = this.options.validators.equalTo($el); 5164 } 5165 5166 var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1; 5167 var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide'; 5168 5169 if (goodToGo) { 5170 // Re-validate inputs that depend on this one with equalto 5171 var dependentElements = this.$element.find('[data-equalto="' + $el.attr('id') + '"]'); 5172 if (dependentElements.length) { 5173 var _this = this; 5174 dependentElements.each(function () { 5175 if ((0, _jquery2.default)(this).val()) { 5176 _this.validateInput((0, _jquery2.default)(this)); 5177 } 5178 }); 5179 } 5180 } 5181 5182 this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el); 5183 5184 /** 5185 * Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide` 5186 * Trigger includes the DOM element of the input. 5187 * @event Abide#valid 5188 * @event Abide#invalid 5189 */ 5190 $el.trigger(message, [$el]); 5191 5192 return goodToGo; 5193 } 5194 5195 /** 5196 * Goes through a form and if there are any invalid inputs, it will display the form error element 5197 * @returns {Boolean} noError - true if no errors were detected... 5198 * @fires Abide#formvalid 5199 * @fires Abide#forminvalid 5200 */ 5201 5202 }, { 5203 key: 'validateForm', 5204 value: function validateForm() { 5205 var acc = []; 5206 var _this = this; 5207 5208 this.$inputs.each(function () { 5209 acc.push(_this.validateInput((0, _jquery2.default)(this))); 5210 }); 5211 5212 var noError = acc.indexOf(false) === -1; 5213 5214 this.$element.find('[data-abide-error]').css('display', noError ? 'none' : 'block'); 5215 5216 /** 5217 * Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`. 5218 * Trigger includes the element of the form. 5219 * @event Abide#formvalid 5220 * @event Abide#forminvalid 5221 */ 5222 this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]); 5223 5224 return noError; 5225 } 5226 5227 /** 5228 * 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. 5229 * @param {Object} $el - jQuery object to validate, should be a text input HTML element 5230 * @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns 5231 * @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified 5232 */ 5233 5234 }, { 5235 key: 'validateText', 5236 value: function validateText($el, pattern) { 5237 // A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute 5238 pattern = pattern || $el.attr('pattern') || $el.attr('type'); 5239 var inputText = $el.val(); 5240 var valid = false; 5241 5242 if (inputText.length) { 5243 // If the pattern attribute on the element is in Abide's list of patterns, then test that regexp 5244 if (this.options.patterns.hasOwnProperty(pattern)) { 5245 valid = this.options.patterns[pattern].test(inputText); 5246 } 5247 // If the pattern name isn't also the type attribute of the field, then test it as a regexp 5248 else if (pattern !== $el.attr('type')) { 5249 valid = new RegExp(pattern).test(inputText); 5250 } else { 5251 valid = true; 5252 } 5253 } 5254 // An empty field is valid if it's not required 5255 else if (!$el.prop('required')) { 5256 valid = true; 5257 } 5258 5259 return valid; 5260 } 5261 5262 /** 5263 * 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. 5264 * @param {String} groupName - A string that specifies the name of a radio button group 5265 * @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required) 5266 */ 5267 5268 }, { 5269 key: 'validateRadio', 5270 value: function validateRadio(groupName) { 5271 // If at least one radio in the group has the `required` attribute, the group is considered required 5272 // Per W3C spec, all radio buttons in a group should have `required`, but we're being nice 5273 var $group = this.$element.find(':radio[name="' + groupName + '"]');
5274 var valid = false, 5275 required = false; 5276 5277 // For the group to be required, at least one radio needs to be required 5278 $group.each(function (i, e) { 5279 if ((0, _jquery2.default)(e).attr('required')) { 5280 required = true; 5281 } 5282 }); 5283 if (!required) valid = true; 5284 5285 if (!valid) { 5286 // For the group to be valid, at least one radio needs to be checked 5287 $group.each(function (i, e) { 5288 if ((0, _jquery2.default)(e).prop('checked')) { 5289 valid = true; 5290 } 5291 }); 5292 }; 5293 5294 return valid; 5295 } 5296 5297 /** 5298 * 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. 5299 * @param {Object} $el - jQuery input element. 5300 * @param {String} validators - a string of function names matching functions in the Abide.options.validators object. 5301 * @param {Boolean} required - self explanatory? 5302 * @returns {Boolean} - true if validations passed. 5303 */ 5304 5305 }, { 5306 key: 'matchValidation', 5307 value: function matchValidation($el, validators, required) { 5308 var _this5 = this; 5309 5310 required = required ? true : false; 5311 5312 var clear = validators.split(' ').map(function (v) { 5313 return _this5.options.validators[v]($el, required, $el.parent()); 5314 }); 5315 return clear.indexOf(false) === -1; 5316 } 5317 5318 /** 5319 * Resets form inputs and styles 5320 * @fires Abide#formreset 5321 */ 5322 5323 }, { 5324 key: 'resetForm', 5325 value: function resetForm() { 5326 var $form = this.$element, 5327 opts = this.options; 5328 5329 (0, _jquery2.default)('.' + opts.labelErrorClass, $form).not('small').removeClass(opts.labelErrorClass); 5330 (0, _jquery2.default)('.' + opts.inputErrorClass, $form).not('small').removeClass(opts.inputErrorClass); 5331 (0, _jquery2.default)(opts.formErrorSelector + '.' + opts.formErrorClass).removeClass(opts.formErrorClass); 5332 $form.find('[data-abide-error]').css('display', 'none'); 5333 (0, _jquery2.default)(':input', $form).not(':button, :submit, :reset, :hidden, :radio, :checkbox, [data-abide-ignore]').val('').removeAttr('data-invalid'); 5334 (0, _jquery2.default)(':input:radio', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid'); 5335 (0, _jquery2.default)(':input:checkbox', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid'); 5336 /** 5337 * Fires when the form has been reset. 5338 * @event Abide#formreset 5339 */ 5340 $form.trigger('formreset.zf.abide', [$form]); 5341 } 5342 5343 /** 5344 * Destroys an instance of Abide. 5345 * Removes error styles and classes from elements, without resetting their values. 5346 */ 5347 5348 }, { 5349 key: '_destroy', 5350 value: function _destroy() { 5351 var _this = this; 5352 this.$element.off('.abide').find('[data-abide-error]').css('display', 'none'); 5353 5354 this.$inputs.off('.abide').each(function () { 5355 _this.removeErrorClasses((0, _jquery2.default)(this)); 5356 }); 5357 } 5358 }]); 5359 5360 return Abide; 5361}(_foundation.Plugin); 5362 5363/** 5364 * Default settings for plugin 5365 */ 5366 5367 5368Abide.defaults = { 5369 /** 5370 * The default event to validate inputs. Checkboxes and radios validate immediately. 5371 * Remove or change this value for manual validation. 5372 * @option 5373 * @type {?string} 5374 * @default 'fieldChange' 5375 */ 5376 validateOn: 'fieldChange', 5377 5378 /** 5379 * Class to be applied to input labels on failed validation. 5380 * @option 5381 * @type {string} 5382 * @default 'is-invalid-label' 5383 */ 5384 labelErrorClass: 'is-invalid-label', 5385 5386 /** 5387 * Class to be applied to inputs on failed validation. 5388 * @option 5389 * @type {string} 5390 * @default 'is-invalid-input' 5391 */ 5392 inputErrorClass: 'is-invalid-input', 5393 5394 /** 5395 * Class selector to use to target Form Errors for show/hide. 5396 * @option 5397 * @type {string} 5398 * @default '.form-error' 5399 */ 5400 formErrorSelector: '.form-error', 5401 5402 /** 5403 * Class added to Form Errors on failed validation. 5404 * @option 5405 * @type {string} 5406 * @default 'is-visible' 5407 */ 5408 formErrorClass: 'is-visible', 5409 5410 /** 5411 * Set to true to validate text inputs on any value change. 5412 * @option 5413 * @type {boolean} 5414 * @default false 5415 */ 5416 liveValidate: false, 5417 5418 /** 5419 * Set to true to validate inputs on blur. 5420 * @option 5421 * @type {boolean} 5422 * @default false 5423 */ 5424 validateOnBlur: false, 5425 5426 patterns: {
5427 alpha: /^[a-zA-Z]+$/, 5428 alpha_numeric: /^[a-zA-Z0-9]+$/, 5429 integer: /^[-+]?\d+$/, 5430 number: /^[-+]?\d*(?:[\.\,]\d+)?$/, 5431 5432 // amex, visa, diners 5433 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})$/, 5434 cvv: /^([0-9]){3,4}$/, 5435 5436 // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address 5437 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])?)+$/, 5438 5439 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})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, 5440 // abc.de 5441 domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/, 5442 5443 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))$/, 5444 // YYYY-MM-DD 5445 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))$/, 5446 // HH:MM:SS 5447 time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/, 5448 dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, 5449 // MM/DD/YYYY 5450 month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/, 5451 // DD/MM/YYYY 5452 day_month_year: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/, 5453 5454 // #FFF or #FFFFFF 5455 color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/, 5456 5457 // Domain || URL 5458 website: { 5459 test: function test(text) { 5460 return Abide.defaults.patterns['domain'].test(text) || Abide.defaults.patterns['url'].test(text); 5461 } 5462 } 5463 }, 5464 5465 /** 5466 * Optional validation functions to be used. `equalTo` being the only default included function. 5467 * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments: 5468 * el : The jQuery element to validate. 5469 * required : Boolean value of the required attribute be present or not. 5470 * parent : The direct parent of the input. 5471 * @option 5472 */ 5473 validators: { 5474 equalTo: function equalTo(el, required, parent) { 5475 return (0, _jquery2.default)('#' + el.attr('data-equalto')).val() === el.val(); 5476 } 5477 } 5478}; 5479 5480exports.Abide = Abide; 5481 5482/***/ }), 5483/* 22 */ 5484/***/ (function(module, exports, __webpack_require__) { 5485 5486"use strict"; 5487 5488 5489Object.defineProperty(exports, "__esModule", { 5490 value: true 5491}); 5492exports.Foundation = undefined; 5493 5494var _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; }; 5495 5496var _jquery = __webpack_require__(0); 5497 5498var _jquery2 = _interopRequireDefault(_jquery); 5499 5500var _foundationUtil = __webpack_require__(1); 5501 5502var _foundationUtil2 = __webpack_require__(4); 5503 5504function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 5505 5506var FOUNDATION_VERSION = '6.4.1'; 5507 5508// Global Foundation object 5509// This is attached to the window, or used as a module for AMD/Browserify 5510var Foundation = { 5511 version: FOUNDATION_VERSION, 5512 5513 /** 5514 * Stores initialized plugins. 5515 */ 5516 _plugins: {}, 5517 5518 /** 5519 * Stores generated unique ids for plugin instances 5520 */ 5521 _uuids: [], 5522 5523 /** 5524 * Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing. 5525 * @param {Object} plugin - The constructor of the plugin. 5526 */ 5527 plugin: function plugin(_plugin, name) { 5528 // Object key to use when adding to global Foundation object 5529 // Examples: Foundation.Reveal, Foundation.OffCanvas 5530 var className = name || functionName(_plugin); 5531 // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin 5532 // Examples: data-reveal, data-off-canvas 5533 var attrName = hyphenate(className); 5534 5535 // Add to the Foundation object and the plugins list (for reflowing) 5536 this._plugins[attrName] = this[className] = _plugin; 5537 }, 5538 /** 5539 * @function 5540 * Populates the _uuids array with pointers to each individual plugin instance. 5541 * Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls. 5542 * Also fires the initialization event for each plugin, consolidating repetitive code. 5543 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 5544 * @param {String} name - the name of the plugin, passed as a camelCased string. 5545 * @fires Plugin#init 5546 */ 5547 registerPlugin: function registerPlugin(plugin, name) { 5548 var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase(); 5549 plugin.uuid = (0, _foundationUtil.GetYoDigits)(6, pluginName); 5550 5551 if (!plugin.$element.attr('data-' + pluginName)) { 5552 plugin.$element.attr('data-' + pluginName, plugin.uuid); 5553 } 5554 if (!plugin.$element.data('zfPlugin')) { 5555 plugin.$element.data('zfPlugin', plugin); 5556 } 5557 /** 5558 * Fires when the plugin has initialized. 5559 * @event Plugin#init 5560 */ 5561 plugin.$element.trigger('init.zf.' + pluginName); 5562 5563 this._uuids.push(plugin.uuid); 5564 5565 return; 5566 }, 5567 /** 5568 * @function 5569 * Removes the plugins uuid from the _uuids array.
5570 * Removes the zfPlugin data attribute, as well as the data-plugin-name attribute. 5571 * Also fires the destroyed event for the plugin, consolidating repetitive code. 5572 * @param {Object} plugin - an instance of a plugin, usually `this` in context. 5573 * @fires Plugin#destroyed 5574 */ 5575 unregisterPlugin: function unregisterPlugin(plugin) { 5576 var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor)); 5577 5578 this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1); 5579 plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin') 5580 /** 5581 * Fires when the plugin has been destroyed. 5582 * @event Plugin#destroyed 5583 */ 5584 .trigger('destroyed.zf.' + pluginName); 5585 for (var prop in plugin) { 5586 plugin[prop] = null; //clean up script to prep for garbage collection. 5587 } 5588 return; 5589 }, 5590 5591 /** 5592 * @function 5593 * Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc. 5594 * @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'` 5595 * @default If no argument is passed, reflow all currently active plugins. 5596 */ 5597 reInit: function reInit(plugins) { 5598 var isJQ = plugins instanceof _jquery2.default; 5599 try { 5600 if (isJQ) { 5601 plugins.each(function () { 5602 (0, _jquery2.default)(this).data('zfPlugin')._init(); 5603 }); 5604 } else { 5605 var type = typeof plugins === 'undefined' ? 'undefined' : _typeof(plugins), 5606 _this = this, 5607 fns = { 5608 'object': function object(plgs) { 5609 plgs.forEach(function (p) { 5610 p = hyphenate(p); 5611 (0, _jquery2.default)('[data-' + p + ']').foundation('_init'); 5612 }); 5613 }, 5614 'string': function string() { 5615 plugins = hyphenate(plugins); 5616 (0, _jquery2.default)('[data-' + plugins + ']').foundation('_init'); 5617 }, 5618 'undefined': function undefined() { 5619 this['object'](Object.keys(_this._plugins)); 5620 } 5621 }; 5622 fns[type](plugins); 5623 } 5624 } catch (err) { 5625 console.error(err); 5626 } finally { 5627 return plugins; 5628 } 5629 }, 5630 5631 /** 5632 * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized. 5633 * @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object. 5634 * @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything. 5635 */ 5636 reflow: function reflow(elem, plugins) { 5637 5638 // If plugins is undefined, just grab everything 5639 if (typeof plugins === 'undefined') { 5640 plugins = Object.keys(this._plugins); 5641 } 5642 // If plugins is a string, convert it to an array with one item 5643 else if (typeof plugins === 'string') { 5644 plugins = [plugins]; 5645 } 5646 5647 var _this = this; 5648 5649 // Iterate through each plugin 5650 _jquery2.default.each(plugins, function (i, name) { 5651 // Get the current plugin 5652 var plugin = _this._plugins[name]; 5653 5654 // Localize the search to all elements inside elem, as well as elem itself, unless elem === document 5655 var $elem = (0, _jquery2.default)(elem).find('[data-' + name + ']').addBack('[data-' + name + ']'); 5656 5657 // For each plugin found, initialize it 5658 $elem.each(function () { 5659 var $el = (0, _jquery2.default)(this), 5660 opts = {}; 5661 // Don't double-dip on plugins 5662 if ($el.data('zfPlugin')) { 5663 console.warn("Tried to initialize " + name + " on an element that already has a Foundation plugin."); 5664 return; 5665 } 5666 5667 if ($el.attr('data-options')) { 5668 var thing = $el.attr('data-options').split(';').forEach(function (e, i) { 5669 var opt = e.split(':').map(function (el) { 5670 return el.trim(); 5671 }); 5672 if (opt[0]) opts[opt[0]] = parseValue(opt[1]); 5673 }); 5674 } 5675 try { 5676 $el.data('zfPlugin', new plugin((0, _jquery2.default)(this), opts)); 5677 } catch (er) { 5678 console.error(er); 5679 } finally { 5680 return; 5681 } 5682 }); 5683 }); 5684 }, 5685 getFnName: functionName, 5686 5687 addToJquery: function addToJquery($) { 5688 // TODO: consider not making this a jQuery function 5689 // TODO: need way to reflow vs. re-initialize 5690 /** 5691 * The Foundation jQuery method. 5692 * @param {String|Array} method - An action to perform on the current jQuery object. 5693 */ 5694 var foundation = function foundation(method) { 5695 var type = typeof method === 'undefined' ? 'undefined' : _typeof(method), 5696 $noJS = $('.no-js'); 5697 5698 if ($noJS.length) { 5699 $noJS.removeClass('no-js'); 5700 } 5701 5702 if (type === 'undefined') { 5703 //needs to initialize the Foundation object, or an individual plugin. 5704 _foundationUtil2.MediaQuery._init(); 5705 Foundation.reflow(this); 5706 } else if (type === 'string') { 5707 //an individual method to invoke on a plugin or group of plugins 5708 var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary 5709 var plugClass = this.data('zfPlugin'); //determine the class of plugin 5710 5711 if (plugClass !== undefined && plugClass[method] !== undefined) { 5712 //make sure both the class and method exist 5713 if (this.length === 1) { 5714 //if there's only one, call it directly.
5715 plugClass[method].apply(plugClass, args); 5716 } else { 5717 this.each(function (i, el) { 5718 //otherwise loop through the jQuery collection and invoke the method on each 5719 plugClass[method].apply($(el).data('zfPlugin'), args); 5720 }); 5721 } 5722 } else { 5723 //error for no class or no method 5724 throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.'); 5725 } 5726 } else { 5727 //error for invalid argument type 5728 throw new TypeError('We\'re sorry, ' + type + ' is not a valid parameter. You must use a string representing the method you wish to invoke.'); 5729 } 5730 return this; 5731 }; 5732 $.fn.foundation = foundation; 5733 return $; 5734 } 5735}; 5736 5737Foundation.util = { 5738 /** 5739 * Function for applying a debounce effect to a function call. 5740 * @function 5741 * @param {Function} func - Function to be called at end of timeout. 5742 * @param {Number} delay - Time in ms to delay the call of `func`. 5743 * @returns function 5744 */ 5745 throttle: function throttle(func, delay) { 5746 var timer = null; 5747 5748 return function () { 5749 var context = this, 5750 args = arguments; 5751 5752 if (timer === null) { 5753 timer = setTimeout(function () { 5754 func.apply(context, args); 5755 timer = null; 5756 }, delay); 5757 } 5758 }; 5759 } 5760}; 5761 5762window.Foundation = Foundation; 5763 5764// Polyfill for requestAnimationFrame 5765(function () { 5766 if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () { 5767 return new Date().getTime(); 5768 }; 5769 5770 var vendors = ['webkit', 'moz']; 5771 for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { 5772 var vp = vendors[i]; 5773 window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; 5774 window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame']; 5775 } 5776 if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) { 5777 var lastTime = 0; 5778 window.requestAnimationFrame = function (callback) { 5779 var now = Date.now(); 5780 var nextTime = Math.max(lastTime + 16, now); 5781 return setTimeout(function () { 5782 callback(lastTime = nextTime); 5783 }, nextTime - now); 5784 }; 5785 window.cancelAnimationFrame = clearTimeout; 5786 } 5787 /** 5788 * Polyfill for performance.now, required by rAF 5789 */ 5790 if (!window.performance || !window.performance.now) { 5791 window.performance = { 5792 start: Date.now(), 5793 now: function now() { 5794 return Date.now() - this.start; 5795 } 5796 }; 5797 } 5798})(); 5799if (!Function.prototype.bind) { 5800 Function.prototype.bind = function (oThis) { 5801 if (typeof this !== 'function') { 5802 // closest thing possible to the ECMAScript 5 5803 // internal IsCallable function 5804 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 5805 } 5806 5807 var aArgs = Array.prototype.slice.call(arguments, 1), 5808 fToBind = this, 5809 fNOP = function fNOP() {}, 5810 fBound = function fBound() { 5811 return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); 5812 }; 5813 5814 if (this.prototype) { 5815 // native functions don't have a prototype 5816 fNOP.prototype = this.prototype; 5817 } 5818 fBound.prototype = new fNOP(); 5819 5820 return fBound; 5821 }; 5822} 5823// Polyfill to get the name of a function in IE9 5824function functionName(fn) { 5825 if (Function.prototype.name === undefined) { 5826 var funcNameRegex = /function\s([^(]{1,})\(/; 5827 var results = funcNameRegex.exec(fn.toString()); 5828 return results && results.length > 1 ? results[1].trim() : ""; 5829 } else if (fn.prototype === undefined) { 5830 return fn.constructor.name; 5831 } else { 5832 return fn.prototype.constructor.name; 5833 } 5834} 5835function parseValue(str) { 5836 if ('true' === str) return true;else if ('false' === str) return false;else if (!isNaN(str * 1)) return parseFloat(str); 5837 return str; 5838} 5839// Convert PascalCase to kebab-case 5840// Thank you: http://stackoverflow.com/a/8955580 5841function hyphenate(str) { 5842 return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); 5843} 5844 5845exports.Foundation = Foundation; 5846 5847/***/ }), 5848/* 23 */ 5849/***/ (function(module, exports, __webpack_require__) { 5850 5851"use strict"; 5852 5853 5854Object.defineProperty(exports, "__esModule", { 5855 value: true 5856}); 5857exports.Dropdown = undefined; 5858 5859var _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; }; }(); 5860 5861var _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); } }; 5862 5863var _jquery = __webpack_require__(0); 5864 5865var _jquery2 = _interopRequireDefault(_jquery); 5866 5867var _foundationUtil = __webpack_require__(3); 5868 5869var _foundationUtil2 = __webpack_require__(1); 5870 5871var _foundation = __webpack_require__(15); 5872 5873var _foundationUtil3 = __webpack_require__(5); 5874 5875function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 5876 5877function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5878 5879function _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; } 5880 5881function _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
5881onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 5882 5883/** 5884 * Dropdown module. 5885 * @module foundation.dropdown 5886 * @requires foundation.util.keyboard 5887 * @requires foundation.util.box 5888 * @requires foundation.util.triggers 5889 */ 5890var Dropdown = function (_Positionable) { 5891 _inherits(Dropdown, _Positionable); 5892 5893 function Dropdown() { 5894 _classCallCheck(this, Dropdown); 5895 5896 return _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).apply(this, arguments)); 5897 } 5898 5899 _createClass(Dropdown, [{ 5900 key: '_setup', 5901 5902 /** 5903 * Creates a new instance of a dropdown. 5904 * @class 5905 * @name Dropdown 5906 * @param {jQuery} element - jQuery object to make into a dropdown. 5907 * Object should be of the dropdown panel, rather than its anchor. 5908 * @param {Object} options - Overrides to the default plugin settings. 5909 */ 5910 value: function _setup(element, options) { 5911 this.$element = element; 5912 this.options = _jquery2.default.extend({}, Dropdown.defaults, this.$element.data(), options); 5913 this.className = 'Dropdown'; // ie9 back compat 5914 5915 // Triggers init is idempotent, just need to make sure it is initialized 5916 _foundationUtil3.Triggers.init(_jquery2.default); 5917 5918 this._init(); 5919 5920 _foundationUtil.Keyboard.register('Dropdown', { 5921 'ENTER': 'open', 5922 'SPACE': 'open', 5923 'ESCAPE': 'close' 5924 }); 5925 } 5926 5927 /** 5928 * Initializes the plugin by setting/checking options and attributes, adding helper variables, and saving the anchor. 5929 * @function 5930 * @private 5931 */ 5932 5933 }, { 5934 key: '_init', 5935 value: function _init() { 5936 var $id = this.$element.attr('id'); 5937 5938 this.$anchor = (0, _jquery2.default)('[data-toggle="' + $id + '"]').length ? (0, _jquery2.default)('[data-toggle="' + $id + '"]') : (0, _jquery2.default)('[data-open="' + $id + '"]'); 5939 this.$anchor.attr({ 5940 'aria-controls': $id, 5941 'data-is-focus': false, 5942 'data-yeti-box': $id, 5943 'aria-haspopup': true, 5944 'aria-expanded': false 5945 5946 }); 5947 5948 if (this.options.parentClass) { 5949 this.$parent = this.$element.parents('.' + this.options.parentClass); 5950 } else { 5951 this.$parent = null; 5952 } 5953 5954 this.$element.attr({ 5955 'aria-hidden': 'true', 5956 'data-yeti-box': $id, 5957 'data-resize': $id, 5958 'aria-labelledby': this.$anchor[0].id || (0, _foundationUtil2.GetYoDigits)(6, 'dd-anchor') 5959 }); 5960 _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_init', this).call(this); 5961 this._events(); 5962 } 5963 }, { 5964 key: '_getDefaultPosition', 5965 value: function _getDefaultPosition() { 5966 // handle legacy classnames 5967 var position = this.$element[0].className.match(/(top|left|right|bottom)/g); 5968 if (position) { 5969 return position[0]; 5970 } else { 5971 return 'bottom'; 5972 } 5973 } 5974 }, { 5975 key: '_getDefaultAlignment', 5976 value: function _getDefaultAlignment() { 5977 // handle legacy float approach 5978 var horizontalPosition = /float-(\S+)/.exec(this.$anchor[0].className); 5979 if (horizontalPosition) { 5980 return horizontalPosition[1]; 5981 } 5982 5983 return _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_getDefaultAlignment', this).call(this); 5984 } 5985 5986 /** 5987 * Sets the position and orientation of the dropdown pane, checks for collisions if allow-overlap is not true. 5988 * Recursively calls itself if a collision is detected, with a new position class. 5989 * @function 5990 * @private 5991 */ 5992 5993 }, { 5994 key: '_setPosition', 5995 value: function _setPosition() { 5996 _get(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), '_setPosition', this).call(this, this.$anchor, this.$element, this.$parent); 5997 } 5998 5999 /** 6000 * Adds event listeners to the element utilizing the triggers utility library. 6001 * @function 6002 * @private 6003 */ 6004 6005 }, { 6006 key: '_events', 6007 value: function _events() { 6008 var _this = this; 6009 this.$element.on({ 6010 'open.zf.trigger': this.open.bind(this), 6011 'close.zf.trigger': this.close.bind(this), 6012 'toggle.zf.trigger': this.toggle.bind(this), 6013 'resizeme.zf.trigger': this._setPosition.bind(this) 6014 }); 6015 6016 if (this.options.hover) { 6017 this.$anchor.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 6018 var bodyData = (0, _jquery2.default)('body').data(); 6019 if (typeof bodyData.whatinput === 'undefined' || bodyData.whatinput === 'mouse') { 6020 clearTimeout(_this.timeout); 6021 _this.timeout = setTimeout(function () { 6022 _this.open(); 6023 _this.$anchor.data('hover', true); 6024 }, _this.options.hoverDelay); 6025 } 6026 }).on('mouseleave.zf.dropdown', function () { 6027 clearTimeout(_this.timeout); 6028 _this.timeout = setTimeout(function () { 6029 _this.close(); 6030 _this.$anchor.data('hover', false); 6031 }, _this.options.hoverDelay); 6032 }); 6033 if (this.options.hoverPane) { 6034 this.$element.off('mouseenter.zf.dropdown mouseleave.zf.dropdown').on('mouseenter.zf.dropdown', function () { 6035 clearTimeout(_this.timeout); 6036 }).on('mouseleave.zf.dropdown', function () { 6037 clearTimeout(_this.timeout); 6038 _this.timeout = setTimeout(function () { 6039 _this.close(); 6040 _this.$anchor.data('hover', false); 6041 }, _this.options.hoverDelay); 6042 }); 6043 } 6044 } 6045 this.$anchor.add(this.$element).on('keydown.zf.dropdown', function (e) { 6046 6047 var $target = (0, _jquery2.default)(this), 6048 visibleFocusableElements = _foundationUtil.Keyboard.findFocusable(_this.$element); 6049 6050 _foundationUtil.Keyboard.handleKey(e, 'Dropdown', { 6051 open: function open() { 6052 if ($target.is(_this.$anchor)) { 6053 _this.open(); 6054 _this.$element.attr('tabindex', -1).focus(); 6055 e.preventDefault(); 6056 } 6057 }, 6058 close: function close() { 6059 _this.close(); 6060 _this.$anchor.focus(); 6061 } 6062 }); 6063 }); 6064 } 6065 6066 /** 6067 * Adds an event handler to the body to close any dropdowns on a click. 6068 * @function 6069 * @private 6070 */ 6071 6072 }, { 6073 key: '_addBodyHandler', 6074 value: function _addBodyHandler() { 6075 var $body = (0, _jquery2.default)(document.body).not(this.$element), 6076 _this = this; 6077 $body.off('click.zf.dropdown').on('click.zf.dropdown', function (e) { 6078 if (_this.$anchor.is(e.target) || _this.$anchor.find(e.target).length) { 6079 return; 6080 } 6081 if (_this.$element.find(e.target).length) { 6082 return; 6083 } 6084 _this.close(); 6085 $body.off('click.zf.dropdown'); 6086 }); 6087 } 6088 6089 /** 6090 * Opens the dropdown pane, and fires a bubbling event to close other dropdowns. 6091 * @function 6092 * @fires Dropdown#closeme 6093 * @fires Dropdown#show 6094 */ 6095 6096 }, { 6097 key: 'open', 6098 value: function open() { 6099 // var _this = this; 6100 /** 6101 * Fires to close other open dropdowns, typically when dropdown is opening 6102 * @event Dropdown#closeme 6103 */ 6104 this.$element.trigger('closeme.zf.dropdown', this.$element.attr('id')); 6105 this.$anchor.addClass('hover').attr({ 'aria-expanded': true }); 6106 // this.$element/*.show()*/; 6107 6108 this.$element.addClass('is-opening'); 6109 this._setPosition(); 6110 this.$element.removeClass('is-opening').addClass('is-open').attr({ 'aria-hidden': false }); 6111 6112 if (this.options.autoFocus) {
6113 var $focusable = _foundationUtil.Keyboard.findFocusable(this.$element); 6114 if ($focusable.length) { 6115 $focusable.eq(0).focus(); 6116 } 6117 } 6118 6119 if (this.options.closeOnClick) { 6120 this._addBodyHandler(); 6121 } 6122 6123 if (this.options.trapFocus) { 6124 _foundationUtil.Keyboard.trapFocus(this.$element); 6125 } 6126 6127 /** 6128 * Fires once the dropdown is visible. 6129 * @event Dropdown#show 6130 */ 6131 this.$element.trigger('show.zf.dropdown', [this.$element]); 6132 } 6133 6134 /** 6135 * Closes the open dropdown pane. 6136 * @function 6137 * @fires Dropdown#hide 6138 */ 6139 6140 }, { 6141 key: 'close', 6142 value: function close() { 6143 if (!this.$element.hasClass('is-open')) { 6144 return false; 6145 } 6146 this.$element.removeClass('is-open').attr({ 'aria-hidden': true }); 6147 6148 this.$anchor.removeClass('hover').attr('aria-expanded', false); 6149 6150 /** 6151 * Fires once the dropdown is no longer visible. 6152 * @event Dropdown#hide 6153 */ 6154 this.$element.trigger('hide.zf.dropdown', [this.$element]); 6155 6156 if (this.options.trapFocus) { 6157 _foundationUtil.Keyboard.releaseFocus(this.$element); 6158 } 6159 } 6160 6161 /** 6162 * Toggles the dropdown pane's visibility. 6163 * @function 6164 */ 6165 6166 }, { 6167 key: 'toggle', 6168 value: function toggle() { 6169 if (this.$element.hasClass('is-open')) { 6170 if (this.$anchor.data('hover')) return; 6171 this.close(); 6172 } else { 6173 this.open(); 6174 } 6175 } 6176 6177 /** 6178 * Destroys the dropdown. 6179 * @function 6180 */ 6181 6182 }, { 6183 key: '_destroy', 6184 value: function _destroy() { 6185 this.$element.off('.zf.trigger').hide(); 6186 this.$anchor.off('.zf.dropdown'); 6187 (0, _jquery2.default)(document.body).off('click.zf.dropdown'); 6188 } 6189 }]); 6190 6191 return Dropdown; 6192}(_foundation.Positionable); 6193 6194Dropdown.defaults = { 6195 /** 6196 * Class that designates bounding container of Dropdown (default: window) 6197 * @option 6198 * @type {?string} 6199 * @default null 6200 */ 6201 parentClass: null, 6202 /** 6203 * Amount of time to delay opening a submenu on hover event. 6204 * @option 6205 * @type {number} 6206 * @default 250 6207 */ 6208 hoverDelay: 250, 6209 /** 6210 * Allow submenus to open on hover events 6211 * @option 6212 * @type {boolean} 6213 * @default false 6214 */ 6215 hover: false, 6216 /** 6217 * Don't close dropdown when hovering over dropdown pane 6218 * @option 6219 * @type {boolean} 6220 * @default false 6221 */ 6222 hoverPane: false, 6223 /** 6224 * Number of pixels between the dropdown pane and the triggering element on open. 6225 * @option 6226 * @type {number} 6227 * @default 0 6228 */ 6229 vOffset: 0, 6230 /** 6231 * Number of pixels between the dropdown pane and the triggering element on open. 6232 * @option 6233 * @type {number} 6234 * @default 0 6235 */ 6236 hOffset: 0, 6237 /** 6238 * DEPRECATED: Class applied to adjust open position. 6239 * @option 6240 * @type {string} 6241 * @default '' 6242 */ 6243 positionClass: '', 6244 6245 /** 6246 * Position of dropdown. Can be left, right, bottom, top, or auto. 6247 * @option 6248 * @type {string} 6249 * @default 'auto' 6250 */ 6251 position: 'auto', 6252 /** 6253 * Alignment of dropdown relative to anchor. Can be left, right, bottom, top, center, or auto. 6254 * @option 6255 * @type {string} 6256 * @default 'auto' 6257 */ 6258 alignment: 'auto', 6259 /** 6260 * 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. 6261 * @option 6262 * @type {boolean} 6263 * @default false 6264 */ 6265 allowOverlap: false, 6266 /** 6267 * Allow overlap of only the bottom of the container. This is the most common 6268 * behavior for dropdowns, allowing the dropdown to extend the bottom of the 6269 * screen but not otherwise influence or break out of the container. 6270 * @option 6271 * @type {boolean} 6272 * @default true 6273 */ 6274 allowBottomOverlap: true, 6275 /** 6276 * Allow the plugin to trap focus to the dropdown pane if opened with keyboard commands. 6277 * @option 6278 * @type {boolean} 6279 * @default false 6280 */ 6281 trapFocus: false, 6282 /** 6283 * Allow the plugin to set focus to the first focusable element within the pane, regardless of method of opening. 6284 * @option 6285 * @type {boolean} 6286 * @default false 6287 */ 6288 autoFocus: false, 6289 /** 6290 * Allows a click on the body to close the dropdown. 6291 * @option 6292 * @type {boolean} 6293 * @default false 6294 */ 6295 closeOnClick: false 6296}; 6297 6298exports.Dropdown = Dropdown; 6299 6300/***/ }), 6301/* 24 */ 6302/***/ (function(module, exports, __webpack_require__) { 6303 6304"use strict"; 6305 6306 6307Object.defineProperty(exports, "__esModule", { 6308 value: true 6309}); 6310exports.Equalizer = undefined; 6311 6312var _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; }; }(); 6313 6314var _jquery = __webpack_require__(0); 6315 6316var _jquery2 = _interopRequireDefault(_jquery); 6317 6318var _foundationUtil = __webpack_require__(4); 6319 6320var _foundationUtil2 = __webpack_require__(8); 6321 6322var _foundationUtil3 = __webpack_require__(1); 6323 6324var _foundation = __webpack_require__(2); 6325 6326function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6327 6328function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6329 6330function _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; } 6331 6332function _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
6332onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 6333 6334/** 6335 * Equalizer module. 6336 * @module foundation.equalizer 6337 * @requires foundation.util.mediaQuery 6338 * @requires foundation.util.imageLoader if equalizer contains images 6339 */ 6340 6341var Equalizer = function (_Plugin) { 6342 _inherits(Equalizer, _Plugin); 6343 6344 function Equalizer() { 6345 _classCallCheck(this, Equalizer); 6346 6347 return _possibleConstructorReturn(this, (Equalizer.__proto__ || Object.getPrototypeOf(Equalizer)).apply(this, arguments)); 6348 } 6349 6350 _createClass(Equalizer, [{ 6351 key: '_setup', 6352 6353 /** 6354 * Creates a new instance of Equalizer. 6355 * @class 6356 * @name Equalizer 6357 * @fires Equalizer#init 6358 * @param {Object} element - jQuery object to add the trigger to. 6359 * @param {Object} options - Overrides to the default plugin settings. 6360 */ 6361 value: function _setup(element, options) { 6362 this.$element = element; 6363 this.options = _jquery2.default.extend({}, Equalizer.defaults, this.$element.data(), options); 6364 this.className = 'Equalizer'; // ie9 back compat 6365 6366 this._init(); 6367 } 6368 6369 /** 6370 * Initializes the Equalizer plugin and calls functions to get equalizer functioning on load. 6371 * @private 6372 */ 6373 6374 }, { 6375 key: '_init', 6376 value: function _init() { 6377 var eqId = this.$element.attr('data-equalizer') || ''; 6378 var $watched = this.$element.find('[data-equalizer-watch="' + eqId + '"]'); 6379 6380 _foundationUtil.MediaQuery._init(); 6381 6382 this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]'); 6383 this.$element.attr('data-resize', eqId || (0, _foundationUtil3.GetYoDigits)(6, 'eq')); 6384 this.$element.attr('data-mutate', eqId || (0, _foundationUtil3.GetYoDigits)(6, 'eq')); 6385 6386 this.hasNested = this.$element.find('[data-equalizer]').length > 0; 6387 this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0; 6388 this.isOn = false; 6389 this._bindHandler = { 6390 onResizeMeBound: this._onResizeMe.bind(this), 6391 onPostEqualizedBound: this._onPostEqualized.bind(this) 6392 }; 6393 6394 var imgs = this.$element.find('img'); 6395 var tooSmall; 6396 if (this.options.equalizeOn) { 6397 tooSmall = this._checkMQ(); 6398 (0, _jquery2.default)(window).on('changed.zf.mediaquery', this._checkMQ.bind(this)); 6399 } else { 6400 this._events(); 6401 } 6402 if (tooSmall !== undefined && tooSmall === false || tooSmall === undefined) { 6403 if (imgs.length) { 6404 (0, _foundationUtil2.onImagesLoaded)(imgs, this._reflow.bind(this)); 6405 } else { 6406 this._reflow(); 6407 } 6408 } 6409 } 6410 6411 /** 6412 * Removes event listeners if the breakpoint is too small. 6413 * @private 6414 */ 6415 6416 }, { 6417 key: '_pauseEvents', 6418 value: function _pauseEvents() { 6419 this.isOn = false; 6420 this.$element.off({ 6421 '.zf.equalizer': this._bindHandler.onPostEqualizedBound, 6422 'resizeme.zf.trigger': this._bindHandler.onResizeMeBound, 6423 'mutateme.zf.trigger': this._bindHandler.onResizeMeBound 6424 }); 6425 } 6426 6427 /** 6428 * function to handle $elements resizeme.zf.trigger, with bound this on _bindHandler.onResizeMeBound 6429 * @private 6430 */ 6431 6432 }, { 6433 key: '_onResizeMe', 6434 value: function _onResizeMe(e) { 6435 this._reflow(); 6436 } 6437 6438 /** 6439 * function to handle $elements postequalized.zf.equalizer, with bound this on _bindHandler.onPostEqualizedBound 6440 * @private 6441 */ 6442 6443 }, { 6444 key: '_onPostEqualized', 6445 value: function _onPostEqualized(e) { 6446 if (e.target !== this.$element[0]) { 6447 this._reflow(); 6448 } 6449 } 6450 6451 /** 6452 * Initializes events for Equalizer. 6453 * @private 6454 */ 6455 6456 }, { 6457 key: '_events', 6458 value: function _events() { 6459 var _this = this; 6460 this._pauseEvents(); 6461 if (this.hasNested) { 6462 this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound); 6463 } else { 6464 this.$element.on('resizeme.zf.trigger', this._bindHandler.onResizeMeBound); 6465 this.$element.on('mutateme.zf.trigger', this._bindHandler.onResizeMeBound); 6466 } 6467 this.isOn = true; 6468 } 6469 6470 /** 6471 * Checks the current breakpoint to the minimum required size. 6472 * @private 6473 */ 6474 6475 }, { 6476 key: '_checkMQ', 6477 value: function _checkMQ() { 6478 var tooSmall = !_foundationUtil.MediaQuery.is(this.options.equalizeOn); 6479 if (tooSmall) { 6480 if (this.isOn) { 6481 this._pauseEvents(); 6482 this.$watched.css('height', 'auto'); 6483 } 6484 } else { 6485 if (!this.isOn) { 6486 this._events(); 6487 } 6488 } 6489 return tooSmall; 6490 } 6491 6492 /** 6493 * A noop version for the plugin 6494 * @private 6495 */ 6496 6497 }, { 6498 key: '_killswitch', 6499 value: function _killswitch() { 6500 return; 6501 } 6502 6503 /** 6504 * Calls necessary functions to update Equalizer upon DOM change 6505 * @private 6506 */ 6507 6508 }, { 6509 key: '_reflow', 6510 value: function _reflow() { 6511 if (!this.options.equalizeOnStack) { 6512 if (this._isStacked()) { 6513 this.$watched.css('height', 'auto'); 6514 return false;
vendor: 4,386 bytes, lines 6515-6643
6515 } 6516 } 6517 if (this.options.equalizeByRow) { 6518 this.getHeightsByRow(this.applyHeightByRow.bind(this)); 6519 } else { 6520 this.getHeights(this.applyHeight.bind(this)); 6521 } 6522 } 6523 6524 /** 6525 * Manually determines if the first 2 elements are *NOT* stacked. 6526 * @private 6527 */ 6528 6529 }, { 6530 key: '_isStacked', 6531 value: function _isStacked() { 6532 if (!this.$watched[0] || !this.$watched[1]) { 6533 return true; 6534 } 6535 return this.$watched[0].getBoundingClientRect().top !== this.$watched[1].getBoundingClientRect().top; 6536 } 6537 6538 /** 6539 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 6540 * @param {Function} cb - A non-optional callback to return the heights array to. 6541 * @returns {Array} heights - An array of heights of children within Equalizer container 6542 */ 6543 6544 }, { 6545 key: 'getHeights', 6546 value: function getHeights(cb) { 6547 var heights = []; 6548 for (var i = 0, len = this.$watched.length; i < len; i++) { 6549 this.$watched[i].style.height = 'auto'; 6550 heights.push(this.$watched[i].offsetHeight); 6551 } 6552 cb(heights); 6553 } 6554 6555 /** 6556 * Finds the outer heights of children contained within an Equalizer parent and returns them in an array 6557 * @param {Function} cb - A non-optional callback to return the heights array to. 6558 * @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 6559 */ 6560 6561 }, { 6562 key: 'getHeightsByRow', 6563 value: function getHeightsByRow(cb) { 6564 var lastElTopOffset = this.$watched.length ? this.$watched.first().offset().top : 0, 6565 groups = [], 6566 group = 0; 6567 //group by Row 6568 groups[group] = []; 6569 for (var i = 0, len = this.$watched.length; i < len; i++) { 6570 this.$watched[i].style.height = 'auto'; 6571 //maybe could use this.$watched[i].offsetTop 6572 var elOffsetTop = (0, _jquery2.default)(this.$watched[i]).offset().top; 6573 if (elOffsetTop != lastElTopOffset) { 6574 group++; 6575 groups[group] = []; 6576 lastElTopOffset = elOffsetTop; 6577 } 6578 groups[group].push([this.$watched[i], this.$watched[i].offsetHeight]); 6579 } 6580 6581 for (var j = 0, ln = groups.length; j < ln; j++) { 6582 var heights = (0, _jquery2.default)(groups[j]).map(function () { 6583 return this[1]; 6584 }).get(); 6585 var max = Math.max.apply(null, heights); 6586 groups[j].push(max); 6587 } 6588 cb(groups); 6589 } 6590 6591 /** 6592 * Changes the CSS height property of each child in an Equalizer parent to match the tallest 6593 * @param {array} heights - An array of heights of children within Equalizer container 6594 * @fires Equalizer#preequalized 6595 * @fires Equalizer#postequalized 6596 */ 6597 6598 }, { 6599 key: 'applyHeight', 6600 value: function applyHeight(heights) { 6601 var max = Math.max.apply(null, heights); 6602 /** 6603 * Fires before the heights are applied 6604 * @event Equalizer#preequalized 6605 */ 6606 this.$element.trigger('preequalized.zf.equalizer'); 6607 6608 this.$watched.css('height', max); 6609 6610 /** 6611 * Fires when the heights have been applied 6612 * @event Equalizer#postequalized 6613 */ 6614 this.$element.trigger('postequalized.zf.equalizer'); 6615 } 6616 6617 /** 6618 * Changes the CSS height property of each child in an Equalizer parent to match the tallest by row 6619 * @param {array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child 6620 * @fires Equalizer#preequalized 6621 * @fires Equalizer#preequalizedrow 6622 * @fires Equalizer#postequalizedrow 6623 * @fires Equalizer#postequalized 6624 */ 6625 6626 }, { 6627 key: 'applyHeightByRow', 6628 value: function applyHeightByRow(groups) { 6629 /** 6630 * Fires before the heights are applied 6631 */ 6632 this.$element.trigger('preequalized.zf.equalizer'); 6633 for (var i = 0, len = groups.length; i < len; i++) { 6634 var groupsILength = groups[i].length, 6635 max = groups[i][groupsILength - 1]; 6636 if (groupsILength <= 2) { 6637 (0, _jquery2.default)(groups[i][0][0]).css({ 'height': 'auto' }); 6638 continue; 6639 } 6640 /** 6641 * Fires before the heights per row are applied 6642 * @event Equalizer#preequalizedrow 6643 */
6644 this.$element.trigger('preequalizedrow.zf.equalizer'); 6645 for (var j = 0, lenJ = groupsILength - 1; j < lenJ; j++) { 6646 (0, _jquery2.default)(groups[i][j][0]).css({ 'height': max }); 6647 } 6648 /** 6649 * Fires when the heights per row have been applied 6650 * @event Equalizer#postequalizedrow 6651 */ 6652 this.$element.trigger('postequalizedrow.zf.equalizer'); 6653 } 6654 /** 6655 * Fires when the heights have been applied 6656 */ 6657 this.$element.trigger('postequalized.zf.equalizer'); 6658 } 6659 6660 /** 6661 * Destroys an instance of Equalizer. 6662 * @function 6663 */ 6664 6665 }, { 6666 key: '_destroy', 6667 value: function _destroy() { 6668 this._pauseEvents(); 6669 this.$watched.css('height', 'auto'); 6670 } 6671 }]); 6672 6673 return Equalizer; 6674}(_foundation.Plugin); 6675 6676/** 6677 * Default settings for plugin 6678 */ 6679 6680 6681Equalizer.defaults = { 6682 /** 6683 * Enable height equalization when stacked on smaller screens. 6684 * @option 6685 * @type {boolean} 6686 * @default false 6687 */ 6688 equalizeOnStack: false, 6689 /** 6690 * Enable height equalization row by row. 6691 * @option 6692 * @type {boolean} 6693 * @default false 6694 */ 6695 equalizeByRow: false, 6696 /** 6697 * String representing the minimum breakpoint size the plugin should equalize heights on. 6698 * @option 6699 * @type {string} 6700 * @default '' 6701 */ 6702 equalizeOn: '' 6703}; 6704 6705exports.Equalizer = Equalizer; 6706 6707/***/ }), 6708/* 25 */ 6709/***/ (function(module, exports, __webpack_require__) { 6710 6711"use strict"; 6712 6713 6714Object.defineProperty(exports, "__esModule", { 6715 value: true 6716}); 6717exports.Interchange = undefined; 6718 6719var _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; }; }(); 6720 6721var _jquery = __webpack_require__(0); 6722 6723var _jquery2 = _interopRequireDefault(_jquery); 6724 6725var _foundationUtil = __webpack_require__(4); 6726 6727var _foundation = __webpack_require__(2); 6728 6729var _foundationUtil2 = __webpack_require__(1); 6730 6731function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6732 6733function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6734 6735function _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; } 6736 6737function _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; } 6738 6739/** 6740 * Interchange module. 6741 * @module foundation.interchange 6742 * @requires foundation.util.mediaQuery 6743 */ 6744 6745var Interchange = function (_Plugin) { 6746 _inherits(Interchange, _Plugin); 6747 6748 function Interchange() { 6749 _classCallCheck(this, Interchange); 6750 6751 return _possibleConstructorReturn(this, (Interchange.__proto__ || Object.getPrototypeOf(Interchange)).apply(this, arguments)); 6752 } 6753 6754 _createClass(Interchange, [{ 6755 key: '_setup', 6756 6757 /** 6758 * Creates a new instance of Interchange. 6759 * @class 6760 * @name Interchange 6761 * @fires Interchange#init 6762 * @param {Object} element - jQuery object to add the trigger to. 6763 * @param {Object} options - Overrides to the default plugin settings. 6764 */ 6765 value: function _setup(element, options) { 6766 this.$element = element; 6767 this.options = _jquery2.default.extend({}, Interchange.defaults, options); 6768 this.rules = []; 6769 this.currentPath = ''; 6770 this.className = 'Interchange'; // ie9 back compat 6771 6772 this._init(); 6773 this._events(); 6774 } 6775 6776 /** 6777 * Initializes the Interchange plugin and calls functions to get interchange functioning on load. 6778 * @function 6779 * @private 6780 */ 6781 6782 }, { 6783 key: '_init', 6784 value: function _init() { 6785 _foundationUtil.MediaQuery._init(); 6786 6787 var id = this.$element[0].id || (0, _foundationUtil2.GetYoDigits)(6, 'interchange'); 6788 this.$element.attr({ 6789 'data-resize': id, 6790 'id': id 6791 }); 6792 6793 this._addBreakpoints(); 6794 this._generateRules(); 6795 this._reflow(); 6796 } 6797 6798 /** 6799 * Initializes events for Interchange. 6800 * @function 6801 * @private 6802 */ 6803 6804 }, { 6805 key: '_events', 6806 value: function _events() { 6807 var _this3 = this; 6808 6809 this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function () { 6810 return _this3._reflow(); 6811 }); 6812 } 6813 6814 /** 6815 * Calls necessary functions to update Interchange upon DOM change 6816 * @function 6817 * @private 6818 */ 6819 6820 }, { 6821 key: '_reflow', 6822 value: function _reflow() { 6823 var match; 6824 6825 // Iterate through each rule, but only save the last match 6826 for (var i in this.rules) { 6827 if (this.rules.hasOwnProperty(i)) { 6828 var rule = this.rules[i]; 6829 if (window.matchMedia(rule.query).matches) { 6830 match = rule; 6831 } 6832 } 6833 } 6834 6835 if (match) { 6836 this.replace(match.path); 6837 } 6838 } 6839 6840 /** 6841 * Gets the Foundation breakpoints and adds them to the Interchange.SPECIAL_QUERIES object. 6842 * @function 6843 * @private 6844 */ 6845 6846 }, { 6847 key: '_addBreakpoints', 6848 value: function _addBreakpoints() { 6849 for (var i in _foundationUtil.MediaQuery.queries) { 6850 if (_foundationUtil.MediaQuery.queries.hasOwnProperty(i)) { 6851 var query = _foundationUtil.MediaQuery.queries[i]; 6852 Interchange.SPECIAL_QUERIES[query.name] = query.value; 6853 } 6854 } 6855 } 6856 6857 /** 6858 * Checks the Interchange element for the provided media query + content pairings 6859 * @function 6860 * @private 6861 * @param {Object} element - jQuery object that is an Interchange instance 6862 * @returns {Array} scenarios - Array of objects that have 'mq' and 'path' keys with corresponding keys 6863 */ 6864 6865 }, { 6866 key: '_generateRules', 6867 value: function _generateRules(element) { 6868 var rulesList = []; 6869 var rules; 6870 6871 if (this.options.rules) { 6872 rules = this.options.rules; 6873 } else { 6874 rules = this.$element.data('interchange'); 6875 } 6876 6877 rules = typeof rules === 'string' ? rules.match(/\[.*?\]/g) : rules; 6878 6879 for (var i in rules) { 6880 if (rules.hasOwnProperty(i)) { 6881 var rule = rules[i].slice(1, -1).split(', '); 6882 var path = rule.slice(0, -1).join(''); 6883 var query = rule[rule.length - 1]; 6884 6885 if (Interchange.SPECIAL_QUERIES[query]) { 6886 query = Interchange.SPECIAL_QUERIES[query]; 6887 } 6888 6889 rulesList.push({ 6890 path: path, 6891 query: query 6892 }); 6893 } 6894 } 6895 6896 this.rules = rulesList; 6897 } 6898 6899 /** 6900 * Update the `src` property of an image, or change the HTML of a container, to the specified path. 6901 * @function 6902 * @param {String} path - Path to the image or HTML partial. 6903 * @fires Interchange#replaced 6904 */ 6905 6906 }, { 6907 key: 'replace', 6908 value: function replace(path) { 6909 if (this.currentPath === path) return; 6910 6911 var _this = this, 6912 trigger = 'replaced.zf.interchange'; 6913 6914 // Replacing images 6915 if (this.$element[0].nodeName === 'IMG') { 6916 this.$element.attr('src', path).on('load', function () { 6917 _this.currentPath = path; 6918 }).trigger(trigger); 6919 } 6920 // Replacing background images 6921 else if (path.match(/\.(gif|jpg|jpeg|png|svg|tiff)([?#].*)?/i)) { 6922 path = path.replace(/\(/g, '%28').replace(/\)/g, '%29'); 6923 this.$element.css({ 'background-image': 'url(' + path + ')' }).trigger(trigger); 6924 } 6925 // Replacing HTML 6926 else { 6927 _jquery2.default.get(path, function (response) { 6928 _this.$element.html(response).trigger(trigger); 6929 (0, _jquery2.default)(response).foundation(); 6930 _this.currentPath = path; 6931 }); 6932 } 6933 6934 /** 6935 * Fires when content in an Interchange element is done being loaded. 6936 * @event Interchange#replaced 6937 */ 6938 // this.$element.trigger('replaced.zf.interchange'); 6939 } 6940 6941 /** 6942 * Destroys an instance of interchange. 6943 * @function 6944 */ 6945 6946 }, { 6947 key: '_destroy', 6948 value: function _destroy() { 6949 this.$element.off('resizeme.zf.trigger'); 6950 } 6951 }]); 6952 6953 return Interchange; 6954}
6954(_foundation.Plugin); 6955 6956/** 6957 * Default settings for plugin 6958 */ 6959 6960 6961Interchange.defaults = { 6962 /** 6963 * Rules to be applied to Interchange elements. Set with the `data-interchange` array notation. 6964 * @option 6965 * @type {?array} 6966 * @default null 6967 */ 6968 rules: null 6969}; 6970 6971Interchange.SPECIAL_QUERIES = { 6972 'landscape': 'screen and (orientation: landscape)', 6973 'portrait': 'screen and (orientation: portrait)', 6974 '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)' 6975}; 6976 6977exports.Interchange = Interchange; 6978 6979/***/ }), 6980/* 26 */ 6981/***/ (function(module, exports, __webpack_require__) { 6982 6983"use strict"; 6984 6985 6986Object.defineProperty(exports, "__esModule", { 6987 value: true 6988}); 6989exports.Magellan = undefined; 6990 6991var _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; }; }(); 6992 6993var _jquery = __webpack_require__(0); 6994 6995var _jquery2 = _interopRequireDefault(_jquery); 6996 6997var _foundationUtil = __webpack_require__(1); 6998 6999var _foundation = __webpack_require__(2); 7000 7001var _foundation2 = __webpack_require__(16); 7002 7003function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 7004 7005function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7006 7007function _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; } 7008 7009function _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; } 7010 7011/** 7012 * Magellan module. 7013 * @module foundation.magellan 7014 * @requires foundation.smoothScroll 7015 */ 7016 7017var Magellan = function (_Plugin) { 7018 _inherits(Magellan, _Plugin); 7019 7020 function Magellan() { 7021 _classCallCheck(this, Magellan); 7022 7023 return _possibleConstructorReturn(this, (Magellan.__proto__ || Object.getPrototypeOf(Magellan)).apply(this, arguments)); 7024 } 7025 7026 _createClass(Magellan, [{ 7027 key: '_setup', 7028 7029 /** 7030 * Creates a new instance of Magellan. 7031 * @class 7032 * @name Magellan 7033 * @fires Magellan#init 7034 * @param {Object} element - jQuery object to add the trigger to. 7035 * @param {Object} options - Overrides to the default plugin settings. 7036 */ 7037 value: function _setup(element, options) { 7038 this.$element = element; 7039 this.options = _jquery2.default.extend({}, Magellan.defaults, this.$element.data(), options); 7040 this.className = 'Magellan'; // ie9 back compat 7041 7042 this._init(); 7043 this.calcPoints(); 7044 } 7045 7046 /** 7047 * Initializes the Magellan plugin and calls functions to get equalizer functioning on load. 7048 * @private 7049 */ 7050 7051 }, { 7052 key: '_init', 7053 value: function _init() { 7054 var id = this.$element[0].id || (0, _foundationUtil.GetYoDigits)(6, 'magellan'); 7055 var _this = this; 7056 this.$targets = (0, _jquery2.default)('[data-magellan-target]'); 7057 this.$links = this.$element.find('a'); 7058 this.$element.attr({ 7059 'data-resize': id, 7060 'data-scroll': id, 7061 'id': id 7062 }); 7063 this.$active = (0, _jquery2.default)(); 7064 this.scrollPos = parseInt(window.pageYOffset, 10); 7065 7066 this._events(); 7067 } 7068 7069 /** 7070 * Calculates an array of pixel values that are the demarcation lines between locations on the page. 7071 * Can be invoked if new elements are added or the size of a location changes. 7072 * @function 7073 */ 7074 7075 }, { 7076 key: 'calcPoints', 7077 value: function calcPoints() { 7078 var _this = this, 7079 body = document.body, 7080 html = document.documentElement; 7081 7082 this.points = []; 7083 this.winHeight = Math.round(Math.max(window.innerHeight, html.clientHeight)); 7084 this.docHeight = Math.round(Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight)); 7085 7086 this.$targets.each(function () { 7087 var $tar = (0, _jquery2.default)(this), 7088 pt = Math.round($tar.offset().top - _this.options.threshold); 7089 $tar.targetPoint = pt; 7090 _this.points.push(pt); 7091 }); 7092 } 7093 7094 /** 7095 * Initializes events for Magellan. 7096 * @private 7097 */ 7098 7099 }, { 7100 key: '_events', 7101 value: function _events() { 7102 var _this = this, 7103 $body = (0, _jquery2.default)('html, body'), 7104 opts = { 7105 duration: _this.options.animationDuration, 7106 easing: _this.options.animationEasing 7107 }; 7108 (0, _jquery2.default)(window).one('load', function () { 7109 if (_this.options.deepLinking) { 7110 if (location.hash) { 7111 _this.scrollToLoc(location.hash); 7112 } 7113 } 7114 _this.calcPoints(); 7115 _this._updateActive(); 7116 }); 7117 7118 this.$element.on({ 7119 'resizeme.zf.trigger': this.reflow.bind(this), 7120 'scrollme.zf.trigger': this._updateActive.bind(this) 7121 }).on('click.zf.magellan', 'a[href^="#"]', function (e) { 7122 e.preventDefault(); 7123 var arrival = this.getAttribute('href'); 7124 _this.scrollToLoc(arrival); 7125 }); 7126 7127 this._deepLinkScroll = function (e) { 7128 if (_this.options.deepLinking) { 7129 _this.scrollToLoc(window.location.hash); 7130 } 7131 }; 7132 7133 (0, _jquery2.default)(window).on('popstate', this._deepLinkScroll); 7134 } 7135 7136 /** 7137 * Function to scroll to a given location on the page. 7138 * @param {String} loc - a properly formatted jQuery id selector. Example: '#foo' 7139 * @function 7140 */ 7141 7142 }, { 7143 key: 'scrollToLoc', 7144 value: function scrollToLoc(loc) { 7145 this._inTransition = true; 7146 var _this = this; 7147 7148 var options = { 7149 animationEasing: this.options.animationEasing, 7150 animationDuration: this.options.animationDuration, 7151 threshold: this.options.threshold, 7152 offset: this.options.offset 7153 }; 7154 7155 _foundation2.SmoothScroll.scrollToLoc(loc, options, function () { 7156 _this._inTransition = false;
7157 _this._updateActive(); 7158 }); 7159 } 7160 7161 /** 7162 * Calls necessary functions to update Magellan upon DOM change 7163 * @function 7164 */ 7165 7166 }, { 7167 key: 'reflow', 7168 value: function reflow() { 7169 this.calcPoints(); 7170 this._updateActive(); 7171 } 7172 7173 /** 7174 * Updates the visibility of an active location link, and updates the url hash for the page, if deepLinking enabled. 7175 * @private 7176 * @function 7177 * @fires Magellan#update 7178 */ 7179 7180 }, { 7181 key: '_updateActive', 7182 value: function _updateActive() /*evt, elem, scrollPos*/{ 7183 if (this._inTransition) { 7184 return; 7185 } 7186 var winPos = /*scrollPos ||*/parseInt(window.pageYOffset, 10), 7187 curIdx; 7188 7189 if (winPos + this.winHeight === this.docHeight) { 7190 curIdx = this.points.length - 1; 7191 } else if (winPos < this.points[0]) { 7192 curIdx = undefined; 7193 } else { 7194 var isDown = this.scrollPos < winPos, 7195 _this = this, 7196 curVisible = this.points.filter(function (p, i) { 7197 return isDown ? p - _this.options.offset <= winPos : p - _this.options.offset - _this.options.threshold <= winPos; 7198 }); 7199 curIdx = curVisible.length ? curVisible.length - 1 : 0; 7200 } 7201 7202 this.$active.removeClass(this.options.activeClass); 7203 this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass); 7204 7205 if (this.options.deepLinking) { 7206 var hash = ""; 7207 if (curIdx != undefined) { 7208 hash = this.$active[0].getAttribute('href'); 7209 } 7210 if (hash !== window.location.hash) { 7211 if (window.history.pushState) { 7212 window.history.pushState(null, null, hash); 7213 } else { 7214 window.location.hash = hash; 7215 } 7216 } 7217 } 7218 7219 this.scrollPos = winPos; 7220 /** 7221 * Fires when magellan is finished updating to the new active element. 7222 * @event Magellan#update 7223 */ 7224 this.$element.trigger('update.zf.magellan', [this.$active]); 7225 } 7226 7227 /** 7228 * Destroys an instance of Magellan and resets the url of the window. 7229 * @function 7230 */ 7231 7232 }, { 7233 key: '_destroy', 7234 value: function _destroy() { 7235 this.$element.off('.zf.trigger .zf.magellan').find('.' + this.options.activeClass).removeClass(this.options.activeClass); 7236 7237 if (this.options.deepLinking) { 7238 var hash = this.$active[0].getAttribute('href'); 7239 window.location.hash.replace(hash, ''); 7240 } 7241 (0, _jquery2.default)(window).off('popstate', this._deepLinkScroll); 7242 } 7243 }]); 7244 7245 return Magellan; 7246}(_foundation.Plugin); 7247 7248/** 7249 * Default settings for plugin 7250 */ 7251 7252 7253Magellan.defaults = { 7254 /** 7255 * Amount of time, in ms, the animated scrolling should take between locations. 7256 * @option 7257 * @type {number} 7258 * @default 500 7259 */ 7260 animationDuration: 500, 7261 /** 7262 * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`. 7263 * @option 7264 * @type {string} 7265 * @default 'linear' 7266 * @see {@link https://api.jquery.com/animate|Jquery animate} 7267 */ 7268 animationEasing: 'linear', 7269 /** 7270 * Number of pixels to use as a marker for location changes. 7271 * @option 7272 * @type {number} 7273 * @default 50 7274 */ 7275 threshold: 50, 7276 /** 7277 * Class applied to the active locations link on the magellan container. 7278 * @option 7279 * @type {string} 7280 * @default 'is-active' 7281 */ 7282 activeClass: 'is-active', 7283 /** 7284 * Allows the script to manipulate the url of the current page, and if supported, alter the history. 7285 * @option 7286 * @type {boolean} 7287 * @default false 7288 */ 7289 deepLinking: false, 7290 /** 7291 * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar. 7292 * @option 7293 * @type {number} 7294 * @default 0 7295 */ 7296 offset: 0 7297}; 7298 7299exports.Magellan = Magellan; 7300 7301/***/ }), 7302/* 27 */ 7303/***/ (function(module, exports, __webpack_require__) { 7304 7305"use strict"; 7306 7307 7308Object.defineProperty(exports, "__esModule", { 7309 value: true 7310}); 7311exports.OffCanvas = undefined; 7312 7313var _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; }; }(); 7314 7315var _jquery = __webpack_require__(0); 7316 7317var _jquery2 = _interopRequireDefault(_jquery); 7318 7319var _foundationUtil = __webpack_require__(3); 7320 7321var _foundationUtil2 = __webpack_require__(4); 7322 7323var _foundationUtil3 = __webpack_require__(1); 7324 7325var _foundation = __webpack_require__(2); 7326 7327var _foundationUtil4 = __webpack_require__(5); 7328 7329function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 7330 7331function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7332 7333function _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; } 7334 7335function _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
7335onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 7336 7337/** 7338 * OffCanvas module. 7339 * @module foundation.offcanvas 7340 * @requires foundation.util.keyboard 7341 * @requires foundation.util.mediaQuery 7342 * @requires foundation.util.triggers 7343 */ 7344 7345var OffCanvas = function (_Plugin) { 7346 _inherits(OffCanvas, _Plugin); 7347 7348 function OffCanvas() { 7349 _classCallCheck(this, OffCanvas); 7350 7351 return _possibleConstructorReturn(this, (OffCanvas.__proto__ || Object.getPrototypeOf(OffCanvas)).apply(this, arguments)); 7352 } 7353 7354 _createClass(OffCanvas, [{ 7355 key: '_setup', 7356 7357 /** 7358 * Creates a new instance of an off-canvas wrapper. 7359 * @class 7360 * @name OffCanvas 7361 * @fires OffCanvas#init 7362 * @param {Object} element - jQuery object to initialize. 7363 * @param {Object} options - Overrides to the default plugin settings. 7364 */ 7365 value: function _setup(element, options) { 7366 var _this3 = this; 7367 7368 this.className = 'OffCanvas'; // ie9 back compat 7369 this.$element = element; 7370 this.options = _jquery2.default.extend({}, OffCanvas.defaults, this.$element.data(), options); 7371 this.contentClasses = { base: [], reveal: [] }; 7372 this.$lastTrigger = (0, _jquery2.default)(); 7373 this.$triggers = (0, _jquery2.default)(); 7374 this.position = 'left'; 7375 this.$content = (0, _jquery2.default)(); 7376 this.nested = !!this.options.nested; 7377 7378 // Defines the CSS transition/position classes of the off-canvas content container. 7379 (0, _jquery2.default)(['push', 'overlap']).each(function (index, val) { 7380 _this3.contentClasses.base.push('has-transition-' + val); 7381 }); 7382 (0, _jquery2.default)(['left', 'right', 'top', 'bottom']).each(function (index, val) { 7383 _this3.contentClasses.base.push('has-position-' + val); 7384 _this3.contentClasses.reveal.push('has-reveal-' + val); 7385 }); 7386 7387 // Triggers init is idempotent, just need to make sure it is initialized 7388 _foundationUtil4.Triggers.init(_jquery2.default); 7389 _foundationUtil2.MediaQuery._init(); 7390 7391 this._init(); 7392 this._events(); 7393 7394 _foundationUtil.Keyboard.register('OffCanvas', { 7395 'ESCAPE': 'close' 7396 }); 7397 } 7398 7399 /** 7400 * Initializes the off-canvas wrapper by adding the exit overlay (if needed). 7401 * @function 7402 * @private 7403 */ 7404 7405 }, { 7406 key: '_init', 7407 value: function _init() { 7408 var id = this.$element.attr('id'); 7409 7410 this.$element.attr('aria-hidden', 'true'); 7411 7412 // Find off-canvas content, either by ID (if specified), by siblings or by closest selector (fallback) 7413 if (this.options.contentId) { 7414 this.$content = (0, _jquery2.default)('#' + this.options.contentId); 7415 } else if (this.$element.siblings('[data-off-canvas-content]').length) { 7416 this.$content = this.$element.siblings('[data-off-canvas-content]').first(); 7417 } else { 7418 this.$content = this.$element.closest('[data-off-canvas-content]').first(); 7419 } 7420 7421 if (!this.options.contentId) { 7422 // Assume that the off-canvas element is nested if it isn't a sibling of the content 7423 this.nested = this.$element.siblings('[data-off-canvas-content]').length === 0; 7424 } else if (this.options.contentId && this.options.nested === null) { 7425 // Warning if using content ID without setting the nested option 7426 // Once the element is nested it is required to work properly in this case 7427 console.warn('Remember to use the nested option if using the content ID option!'); 7428 } 7429 7430 if (this.nested === true) { 7431 // Force transition overlap if nested 7432 this.options.transition = 'overlap'; 7433 // Remove appropriate classes if already assigned in markup 7434 this.$element.removeClass('is-transition-push'); 7435 } 7436 7437 this.$element.addClass('is-transition-' + this.options.transition + ' is-closed'); 7438 7439 // Find triggers that affect this element and add aria-expanded to them 7440 this.$triggers = (0, _jquery2.default)(document).find('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-expanded', 'false').attr('aria-controls', id); 7441 7442 // Get position by checking for related CSS class 7443 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; 7444 7445 // Add an overlay over the content if necessary 7446 if (this.options.contentOverlay === true) {
7447 var overlay = document.createElement('div'); 7448 var overlayPosition = (0, _jquery2.default)(this.$element).css("position") === 'fixed' ? 'is-overlay-fixed' : 'is-overlay-absolute'; 7449 overlay.setAttribute('class', 'js-off-canvas-overlay ' + overlayPosition); 7450 this.$overlay = (0, _jquery2.default)(overlay); 7451 if (overlayPosition === 'is-overlay-fixed') { 7452 (0, _jquery2.default)(this.$overlay).insertAfter(this.$element); 7453 } else { 7454 this.$content.append(this.$overlay); 7455 } 7456 } 7457 7458 this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className); 7459 7460 if (this.options.isRevealed === true) { 7461 this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2]; 7462 this._setMQChecker(); 7463 } 7464 7465 if (this.options.transitionTime) { 7466 this.$element.css('transition-duration', this.options.transitionTime); 7467 } 7468 7469 // Initally remove all transition/position CSS classes from off-canvas content container. 7470 this._removeContentClasses(); 7471 } 7472 7473 /** 7474 * Adds event handlers to the off-canvas wrapper and the exit overlay. 7475 * @function 7476 * @private 7477 */ 7478 7479 }, { 7480 key: '_events', 7481 value: function _events() { 7482 this.$element.off('.zf.trigger .zf.offcanvas').on({ 7483 'open.zf.trigger': this.open.bind(this), 7484 'close.zf.trigger': this.close.bind(this), 7485 'toggle.zf.trigger': this.toggle.bind(this), 7486 'keydown.zf.offcanvas': this._handleKeyboard.bind(this) 7487 }); 7488 7489 if (this.options.closeOnClick === true) { 7490 var $target = this.options.contentOverlay ? this.$overlay : this.$content; 7491 $target.on({ 'click.zf.offcanvas': this.close.bind(this) }); 7492 } 7493 } 7494 7495 /** 7496 * Applies event listener for elements that will reveal at certain breakpoints. 7497 * @private 7498 */ 7499 7500 }, { 7501 key: '_setMQChecker', 7502 value: function _setMQChecker() { 7503 var _this = this; 7504 7505 (0, _jquery2.default)(window).on('changed.zf.mediaquery', function () { 7506 if (_foundationUtil2.MediaQuery.atLeast(_this.options.revealOn)) { 7507 _this.reveal(true); 7508 } else { 7509 _this.reveal(false); 7510 } 7511 }).one('load.zf.offcanvas', function () { 7512 if (_foundationUtil2.MediaQuery.atLeast(_this.options.revealOn)) { 7513 _this.reveal(true); 7514 } 7515 }); 7516 } 7517 7518 /** 7519 * Removes the CSS transition/position classes of the off-canvas content container. 7520 * Removing the classes is important when another off-canvas gets opened that uses the same content container. 7521 * @private 7522 */ 7523 7524 }, { 7525 key: '_removeContentClasses', 7526 value: function _removeContentClasses(hasReveal) { 7527 this.$content.removeClass(this.contentClasses.base.join(' ')); 7528 if (hasReveal === true) { 7529 this.$content.removeClass(this.contentClasses.reveal.join(' ')); 7530 } 7531 } 7532 7533 /** 7534 * Adds the CSS transition/position classes of the off-canvas content container, based on the opening off-canvas element. 7535 * Beforehand any transition/position class gets removed. 7536 * @param {Boolean} hasReveal - true if related off-canvas element is revealed. 7537 * @private 7538 */ 7539 7540 }, { 7541 key: '_addContentClasses', 7542 value: function _addContentClasses(hasReveal) { 7543 this._removeContentClasses(); 7544 this.$content.addClass('has-transition-' + this.options.transition + ' has-position-' + this.position); 7545 if (hasReveal === true) { 7546 this.$content.addClass('has-reveal-' + this.position); 7547 } 7548 } 7549 7550 /** 7551 * Handles the revealing/hiding the off-canvas at breakpoints, not the same as open. 7552 * @param {Boolean} isRevealed - true if element should be revealed. 7553 * @function 7554 */ 7555 7556 }, { 7557 key: 'reveal', 7558 value: function reveal(isRevealed) { 7559 if (isRevealed) { 7560 this.close(); 7561 this.isRevealed = true; 7562 this.$element.attr('aria-hidden', 'false'); 7563 this.$element.off('open.zf.trigger toggle.zf.trigger'); 7564 this.$element.removeClass('is-closed'); 7565 } else { 7566 this.isRevealed = false;
7567 this.$element.attr('aria-hidden', 'true'); 7568 this.$element.off('open.zf.trigger toggle.zf.trigger').on({ 7569 'open.zf.trigger': this.open.bind(this), 7570 'toggle.zf.trigger': this.toggle.bind(this) 7571 }); 7572 this.$element.addClass('is-closed'); 7573 } 7574 this._addContentClasses(isRevealed); 7575 } 7576 7577 /** 7578 * Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers. 7579 * @private 7580 */ 7581 7582 }, { 7583 key: '_stopScrolling', 7584 value: function _stopScrolling(event) { 7585 return false; 7586 } 7587 7588 // Taken and adapted from http://stackoverflow.com/questions/16889447/prevent-full-page-scrolling-ios 7589 // Only really works for y, not sure how to extend to x or if we need to. 7590 7591 }, { 7592 key: '_recordScrollable', 7593 value: function _recordScrollable(event) { 7594 var elem = this; // called from event handler context with this as elem 7595 7596 // If the element is scrollable (content overflows), then... 7597 if (elem.scrollHeight !== elem.clientHeight) { 7598 // If we're at the top, scroll down one pixel to allow scrolling up 7599 if (elem.scrollTop === 0) { 7600 elem.scrollTop = 1; 7601 } 7602 // If we're at the bottom, scroll up one pixel to allow scrolling down 7603 if (elem.scrollTop === elem.scrollHeight - elem.clientHeight) { 7604 elem.scrollTop = elem.scrollHeight - elem.clientHeight - 1; 7605 } 7606 } 7607 elem.allowUp = elem.scrollTop > 0; 7608 elem.allowDown = elem.scrollTop < elem.scrollHeight - elem.clientHeight; 7609 elem.lastY = event.originalEvent.pageY; 7610 } 7611 }, { 7612 key: '_stopScrollPropagation', 7613 value: function _stopScrollPropagation(event) { 7614 var elem = this; // called from event handler context with this as elem 7615 var up = event.pageY < elem.lastY; 7616 var down = !up; 7617 elem.lastY = event.pageY; 7618 7619 if (up && elem.allowUp || down && elem.allowDown) { 7620 event.stopPropagation(); 7621 } else { 7622 event.preventDefault(); 7623 } 7624 } 7625 7626 /** 7627 * Opens the off-canvas menu. 7628 * @function 7629 * @param {Object} event - Event object passed from listener. 7630 * @param {jQuery} trigger - element that triggered the off-canvas to open. 7631 * @fires OffCanvas#opened 7632 */ 7633 7634 }, { 7635 key: 'open', 7636 value: function open(event, trigger) { 7637 if (this.$element.hasClass('is-open') || this.isRevealed) { 7638 return; 7639 } 7640 var _this = this; 7641 7642 if (trigger) { 7643 this.$lastTrigger = trigger; 7644 } 7645 7646 if (this.options.forceTo === 'top') { 7647 window.scrollTo(0, 0); 7648 } else if (this.options.forceTo === 'bottom') { 7649 window.scrollTo(0, document.body.scrollHeight); 7650 } 7651 7652 if (this.options.transitionTime && this.options.transition !== 'overlap') { 7653 this.$element.siblings('[data-off-canvas-content]').css('transition-duration', this.options.transitionTime); 7654 } else { 7655 this.$element.siblings('[data-off-canvas-content]').css('transition-duration', ''); 7656 } 7657 7658 /** 7659 * Fires when the off-canvas menu opens. 7660 * @event OffCanvas#opened 7661 */ 7662 this.$element.addClass('is-open').removeClass('is-closed'); 7663 7664 this.$triggers.attr('aria-expanded', 'true'); 7665 this.$element.attr('aria-hidden', 'false').trigger('opened.zf.offcanvas'); 7666 7667 this.$content.addClass('is-open-' + this.position); 7668 7669 // If `contentScroll` is set to false, add class and disable scrolling on touch devices. 7670 if (this.options.contentScroll === false) { 7671 (0, _jquery2.default)('body').addClass('is-off-canvas-open').on('touchmove', this._stopScrolling); 7672 this.$element.on('touchstart', this._recordScrollable); 7673 this.$element.on('touchmove', this._stopScrollPropagation); 7674 } 7675 7676 if (this.options.contentOverlay === true) { 7677 this.$overlay.addClass('is-visible'); 7678 } 7679 7680 if (this.options.closeOnClick === true && this.options.contentOverlay === true) { 7681 this.$overlay.addClass('is-closable'); 7682 } 7683 7684 if (this.options.autoFocus === true) { 7685 this.$element.one((0, _foundationUtil3.transitionend)(this.$element), function () { 7686 if (!_this.$element.hasClass('is-open')) { 7687 return; // exit if prematurely closed 7688 } 7689 var canvasFocus = _this.$element.find('[data-autofocus]'); 7690 if (canvasFocus.length) { 7691 canvasFocus.eq(0).focus(); 7692 } else { 7693 _this.$element.find('a, button').eq(0).focus(); 7694 } 7695 }); 7696 } 7697 7698 if (this.options.trapFocus === true) { 7699 this.$content.attr('tabindex', '-1'); 7700 _foundationUtil.Keyboard.trapFocus(this.$element); 7701 } 7702 7703 this._addContentClasses(); 7704 } 7705 7706 /** 7707 * Closes the off-canvas menu. 7708 * @function 7709 * @param {Function} cb - optional cb to fire after closure. 7710 * @fires OffCanvas#closed 7711 */ 7712 7713 }, { 7714 key: 'close', 7715 value: function close(cb) { 7716 if (!this.$element.hasClass('is-open') || this.isRevealed) { 7717 return; 7718 } 7719 7720 var _this = this; 7721 7722 this.$element.removeClass('is-open'); 7723 7724 this.$element.attr('aria-hidden', 'true') 7725 /** 7726 * Fires when the off-canvas menu opens. 7727 * @event OffCanvas#closed 7728 */ 7729 .trigger('closed.zf.offcanvas'); 7730 7731 this.$content.removeClass('is-open-left is-open-top is-open-right is-open-bottom'); 7732 7733 // If `contentScroll` is set to false, remove class and re-enable scrolling on touch devices. 7734 if (this.options.contentScroll === false) { 7735 (0, _jquery2.default)('body').removeClass('is-off-canvas-open').off('touchmove', this._stopScrolling); 7736 this.$element.off('touchstart', this._recordScrollable); 7737 this.$element.off('touchmove', this._stopScrollPropagation); 7738 } 7739 7740 if (this.options.contentOverlay === true) { 7741 this.$overlay.removeClass('is-visible'); 7742 } 7743 7744 if (this.options.closeOnClick === true && this.options.contentOverlay === true) { 7745 this.$overlay.removeClass('is-closable'); 7746 } 7747 7748 this.$triggers.attr('aria-expanded', 'false'); 7749 7750 if (this.options.trapFocus === true) { 7751 this.$content.removeAttr('tabindex'); 7752 _foundationUtil.Keyboard.releaseFocus(this.$element); 7753 } 7754 7755 // Listen to transitionEnd and add class when done. 7756 this.$element.one((0, _foundationUtil3.transitionend)(this.$element), function (e) { 7757 _this.$element.addClass('is-closed'); 7758 _this._removeContentClasses(); 7759 }); 7760 } 7761 7762 /** 7763 * Toggles the off-canvas menu open or closed. 7764 * @function 7765 * @param {Object} event - Event object passed from listener. 7766 * @param {jQuery} trigger - element that triggered the off-canvas to open. 7767 */ 7768 7769 }, { 7770 key: 'toggle', 7771 value: function toggle(event, trigger) { 7772 if (this.$element.hasClass('is-open')) { 7773 this.close(event, trigger); 7774 } else { 7775 this.open(event, trigger); 7776 } 7777 } 7778 7779 /** 7780 * 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. 7781 * @function 7782 * @private 7783 */ 7784 7785 }, { 7786 key: '_handleKeyboard', 7787 value: function _handleKeyboard(e) { 7788 var _this4 = this; 7789 7790 _foundationUtil.Keyboard.handleKey(e, 'OffCanvas', { 7791 close: function close() { 7792 _this4.close(); 7793 _this4.$lastTrigger.focus(); 7794 return true; 7795 }, 7796 handled: function handled() { 7797 e.stopPropagation(); 7798 e.preventDefault(); 7799 } 7800 }); 7801 } 7802 7803 /** 7804 * Destroys the offcanvas plugin. 7805 * @function 7806 */ 7807 7808 }, { 7809 key: '_destroy', 7810 value: function _destroy() { 7811 this.close(); 7812 this.$element.off('.zf.trigger .zf.offcanvas'); 7813 this.$overlay.off('.zf.offcanvas'); 7814 } 7815 }]); 7816 7817 return OffCanvas; 7818}
7818(_foundation.Plugin); 7819 7820OffCanvas.defaults = { 7821 /** 7822 * Allow the user to click outside of the menu to close it. 7823 * @option 7824 * @type {boolean} 7825 * @default true 7826 */ 7827 closeOnClick: true, 7828 7829 /** 7830 * Adds an overlay on top of `[data-off-canvas-content]`. 7831 * @option 7832 * @type {boolean} 7833 * @default true 7834 */ 7835 contentOverlay: true, 7836 7837 /** 7838 * Target an off-canvas content container by ID that may be placed anywhere. If null the closest content container will be taken. 7839 * @option 7840 * @type {?string} 7841 * @default null 7842 */ 7843 contentId: null, 7844 7845 /** 7846 * Define the off-canvas element is nested in an off-canvas content. This is required when using the contentId option for a nested element. 7847 * @option 7848 * @type {boolean} 7849 * @default null 7850 */ 7851 nested: null, 7852 7853 /** 7854 * Enable/disable scrolling of the main content when an off canvas panel is open. 7855 * @option 7856 * @type {boolean} 7857 * @default true 7858 */ 7859 contentScroll: true, 7860 7861 /** 7862 * Amount of time in ms the open and close transition requires. If none selected, pulls from body style. 7863 * @option 7864 * @type {number} 7865 * @default null 7866 */ 7867 transitionTime: null, 7868 7869 /** 7870 * Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'. 7871 * @option 7872 * @type {string} 7873 * @default push 7874 */ 7875 transition: 'push', 7876 7877 /** 7878 * Force the page to scroll to top or bottom on open. 7879 * @option 7880 * @type {?string} 7881 * @default null 7882 */ 7883 forceTo: null, 7884 7885 /** 7886 * Allow the offcanvas to remain open for certain breakpoints. 7887 * @option 7888 * @type {boolean} 7889 * @default false 7890 */ 7891 isRevealed: false, 7892 7893 /** 7894 * Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option. 7895 * @option 7896 * @type {?string} 7897 * @default null 7898 */ 7899 revealOn: null, 7900 7901 /** 7902 * Force focus to the offcanvas on open. If true, will focus the opening trigger on close. 7903 * @option 7904 * @type {boolean} 7905 * @default true 7906 */ 7907 autoFocus: true, 7908 7909 /** 7910 * Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`. 7911 * @option 7912 * @type {string} 7913 * @default reveal-for- 7914 * @todo improve the regex testing for this. 7915 */ 7916 revealClass: 'reveal-for-', 7917 7918 /** 7919 * Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes. 7920 * @option 7921 * @type {boolean} 7922 * @default false 7923 */ 7924 trapFocus: false 7925}; 7926 7927exports.OffCanvas = OffCanvas; 7928 7929/***/ }), 7930/* 28 */ 7931/***/ (function(module, exports, __webpack_require__) { 7932 7933"use strict"; 7934 7935 7936Object.defineProperty(exports, "__esModule", { 7937 value: true 7938}); 7939exports.Orbit = undefined; 7940 7941var _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; }; }(); 7942 7943var _jquery = __webpack_require__(0); 7944 7945var _jquery2 = _interopRequireDefault(_jquery); 7946 7947var _foundationUtil = __webpack_require__(3); 7948 7949var _foundationUtil2 = __webpack_require__(6); 7950 7951var _foundationUtil3 = __webpack_require__(18); 7952 7953var _foundationUtil4 = __webpack_require__(8); 7954 7955var _foundationUtil5 = __webpack_require__(1); 7956 7957var _foundation = __webpack_require__(2); 7958 7959var _foundationUtil6 = __webpack_require__(10); 7960 7961function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 7962 7963function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7964 7965function _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; } 7966 7967function _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
7967onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 7968 7969/** 7970 * Orbit module. 7971 * @module foundation.orbit 7972 * @requires foundation.util.keyboard 7973 * @requires foundation.util.motion 7974 * @requires foundation.util.timer 7975 * @requires foundation.util.imageLoader 7976 * @requires foundation.util.touch 7977 */ 7978 7979var Orbit = function (_Plugin) { 7980 _inherits(Orbit, _Plugin); 7981 7982 function Orbit() { 7983 _classCallCheck(this, Orbit); 7984 7985 return _possibleConstructorReturn(this, (Orbit.__proto__ || Object.getPrototypeOf(Orbit)).apply(this, arguments)); 7986 } 7987 7988 _createClass(Orbit, [{ 7989 key: '_setup', 7990 7991 /** 7992 * Creates a new instance of an orbit carousel. 7993 * @class 7994 * @name Orbit 7995 * @param {jQuery} element - jQuery object to make into an Orbit Carousel. 7996 * @param {Object} options - Overrides to the default plugin settings. 7997 */ 7998 value: function _setup(element, options) { 7999 this.$element = element; 8000 this.options = _jquery2.default.extend({}, Orbit.defaults, this.$element.data(), options); 8001 this.className = 'Orbit'; // ie9 back compat 8002 8003 _foundationUtil6.Touch.init(_jquery2.default); // Touch init is idempotent, we just need to make sure it's initialied. 8004 8005 this._init(); 8006 8007 _foundationUtil.Keyboard.register('Orbit', { 8008 'ltr': { 8009 'ARROW_RIGHT': 'next', 8010 'ARROW_LEFT': 'previous' 8011 }, 8012 'rtl': { 8013 'ARROW_LEFT': 'next', 8014 'ARROW_RIGHT': 'previous' 8015 } 8016 }); 8017 } 8018 8019 /** 8020 * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation. 8021 * @function 8022 * @private 8023 */ 8024 8025 }, { 8026 key: '_init', 8027 value: function _init() { 8028 // @TODO: consider discussion on PR #9278 about DOM pollution by changeSlide 8029 this._reset(); 8030 8031 this.$wrapper = this.$element.find('.' + this.options.containerClass); 8032 this.$slides = this.$element.find('.' + this.options.slideClass); 8033 8034 var $images = this.$element.find('img'), 8035 initActive = this.$slides.filter('.is-active'), 8036 id = this.$element[0].id || (0, _foundationUtil5.GetYoDigits)(6, 'orbit'); 8037 8038 this.$element.attr({ 8039 'data-resize': id, 8040 'id': id 8041 }); 8042 8043 if (!initActive.length) { 8044 this.$slides.eq(0).addClass('is-active'); 8045 } 8046 8047 if (!this.options.useMUI) { 8048 this.$slides.addClass('no-motionui'); 8049 } 8050 8051 if ($images.length) { 8052 (0, _foundationUtil4.onImagesLoaded)($images, this._prepareForOrbit.bind(this)); 8053 } else { 8054 this._prepareForOrbit(); //hehe 8055 } 8056 8057 if (this.options.bullets) { 8058 this._loadBullets(); 8059 } 8060 8061 this._events(); 8062 8063 if (this.options.autoPlay && this.$slides.length > 1) { 8064 this.geoSync(); 8065 } 8066 8067 if (this.options.accessible) { 8068 // allow wrapper to be focusable to enable arrow navigation 8069 this.$wrapper.attr('tabindex', 0); 8070 } 8071 } 8072 8073 /** 8074 * Creates a jQuery collection of bullets, if they are being used. 8075 * @function 8076 * @private 8077 */ 8078 8079 }, { 8080 key: '_loadBullets', 8081 value: function _loadBullets() { 8082 this.$bullets = this.$element.find('.' + this.options.boxOfBullets).find('button'); 8083 } 8084 8085 /** 8086 * Sets a `timer` object on the orbit, and starts the counter for the next slide. 8087 * @function 8088 */ 8089 8090 }, { 8091 key: 'geoSync', 8092 value: function geoSync() { 8093 var _this = this; 8094 this.timer = new _foundationUtil3.Timer(this.$element, { 8095 duration: this.options.timerDelay, 8096 infinite: false 8097 }, function () { 8098 _this.changeSlide(true); 8099 }); 8100 this.timer.start(); 8101 } 8102 8103 /** 8104 * Sets wrapper and slide heights for the orbit. 8105 * @function 8106 * @private 8107 */ 8108 8109 }, { 8110 key: '_prepareForOrbit', 8111 value: function _prepareForOrbit() { 8112 var _this = this; 8113 this._setWrapperHeight(); 8114 } 8115 8116 /** 8117 * Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height. 8118 * @function 8119 * @private 8120 * @param {Function} cb - a callback function to fire when complete. 8121 */ 8122 8123 }, { 8124 key: '_setWrapperHeight', 8125 value: function _setWrapperHeight(cb) { 8126 //rewrite this to `for` loop 8127 var max = 0, 8128 temp, 8129 counter = 0, 8130 _this = this; 8131 8132 this.$slides.each(function () { 8133 temp = this.getBoundingClientRect().height;
vendor: 4,308 bytes, lines 8134-8260
8134 (0, _jquery2.default)(this).attr('data-slide', counter); 8135 8136 if (_this.$slides.filter('.is-active')[0] !== _this.$slides.eq(counter)[0]) { 8137 //if not the active slide, set css position and display property 8138 (0, _jquery2.default)(this).css({ 'position': 'relative', 'display': 'none' }); 8139 } 8140 max = temp > max ? temp : max; 8141 counter++; 8142 }); 8143 8144 if (counter === this.$slides.length) { 8145 this.$wrapper.css({ 'height': max }); //only change the wrapper height property once. 8146 if (cb) { 8147 cb(max); 8148 } //fire callback with max height dimension. 8149 } 8150 } 8151 8152 /** 8153 * Sets the max-height of each slide. 8154 * @function 8155 * @private 8156 */ 8157 8158 }, { 8159 key: '_setSlideHeight', 8160 value: function _setSlideHeight(height) { 8161 this.$slides.each(function () { 8162 (0, _jquery2.default)(this).css('max-height', height); 8163 }); 8164 } 8165 8166 /** 8167 * Adds event listeners to basically everything within the element. 8168 * @function 8169 * @private 8170 */ 8171 8172 }, { 8173 key: '_events', 8174 value: function _events() { 8175 var _this = this; 8176 8177 //*************************************** 8178 //**Now using custom event - thanks to:** 8179 //** Yohai Ararat of Toronto ** 8180 //*************************************** 8181 // 8182 this.$element.off('.resizeme.zf.trigger').on({ 8183 'resizeme.zf.trigger': this._prepareForOrbit.bind(this) 8184 }); 8185 if (this.$slides.length > 1) { 8186 8187 if (this.options.swipe) { 8188 this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit').on('swipeleft.zf.orbit', function (e) { 8189 e.preventDefault(); 8190 _this.changeSlide(true); 8191 }).on('swiperight.zf.orbit', function (e) { 8192 e.preventDefault(); 8193 _this.changeSlide(false); 8194 }); 8195 } 8196 //*************************************** 8197 8198 if (this.options.autoPlay) { 8199 this.$slides.on('click.zf.orbit', function () { 8200 _this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true); 8201 _this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start'](); 8202 }); 8203 8204 if (this.options.pauseOnHover) { 8205 this.$element.on('mouseenter.zf.orbit', function () { 8206 _this.timer.pause(); 8207 }).on('mouseleave.zf.orbit', function () { 8208 if (!_this.$element.data('clickedOn')) { 8209 _this.timer.start(); 8210 } 8211 }); 8212 } 8213 } 8214 8215 if (this.options.navButtons) { 8216 var $controls = this.$element.find('.' + this.options.nextClass + ', .' + this.options.prevClass); 8217 $controls.attr('tabindex', 0) 8218 //also need to handle enter/return and spacebar key presses 8219 .on('click.zf.orbit touchend.zf.orbit', function (e) { 8220 e.preventDefault(); 8221 _this.changeSlide((0, _jquery2.default)(this).hasClass(_this.options.nextClass)); 8222 }); 8223 } 8224 8225 if (this.options.bullets) { 8226 this.$bullets.on('click.zf.orbit touchend.zf.orbit', function () { 8227 if (/is-active/g.test(this.className)) { 8228 return false; 8229 } //if this is active, kick out of function. 8230 var idx = (0, _jquery2.default)(this).data('slide'), 8231 ltr = idx > _this.$slides.filter('.is-active').data('slide'), 8232 $slide = _this.$slides.eq(idx); 8233 8234 _this.changeSlide(ltr, $slide, idx); 8235 }); 8236 } 8237 8238 if (this.options.accessible) { 8239 this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function (e) { 8240 // handle keyboard event with keyboard util 8241 _foundationUtil.Keyboard.handleKey(e, 'Orbit', { 8242 next: function next() { 8243 _this.changeSlide(true); 8244 }, 8245 previous: function previous() { 8246 _this.changeSlide(false); 8247 }, 8248 handled: function handled() { 8249 // if bullet is focused, make sure focus moves 8250 if ((0, _jquery2.default)(e.target).is(_this.$bullets)) { 8251 _this.$bullets.filter('.is-active').focus(); 8252 } 8253 } 8254 }); 8255 }); 8256 } 8257 } 8258 } 8259 8260 /**
8261 * Resets Orbit so it can be reinitialized 8262 */ 8263 8264 }, { 8265 key: '_reset', 8266 value: function _reset() { 8267 // Don't do anything if there are no slides (first run) 8268 if (typeof this.$slides == 'undefined') { 8269 return; 8270 } 8271 8272 if (this.$slides.length > 1) { 8273 // Remove old events 8274 this.$element.off('.zf.orbit').find('*').off('.zf.orbit'); 8275 8276 // Restart timer if autoPlay is enabled 8277 if (this.options.autoPlay) { 8278 this.timer.restart(); 8279 } 8280 8281 // Reset all sliddes 8282 this.$slides.each(function (el) { 8283 (0, _jquery2.default)(el).removeClass('is-active is-active is-in').removeAttr('aria-live').hide(); 8284 }); 8285 8286 // Show the first slide 8287 this.$slides.first().addClass('is-active').show(); 8288 8289 // Triggers when the slide has finished animating 8290 this.$element.trigger('slidechange.zf.orbit', [this.$slides.first()]); 8291 8292 // Select first bullet if bullets are present 8293 if (this.options.bullets) { 8294 this._updateBullets(0); 8295 } 8296 } 8297 } 8298 8299 /** 8300 * Changes the current slide to a new one. 8301 * @function 8302 * @param {Boolean} isLTR - flag if the slide should move left to right. 8303 * @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected. 8304 * @param {Number} idx - the index of the new slide in its collection, if one chosen. 8305 * @fires Orbit#slidechange 8306 */ 8307 8308 }, { 8309 key: 'changeSlide', 8310 value: function changeSlide(isLTR, chosenSlide, idx) { 8311 if (!this.$slides) { 8312 return; 8313 } // Don't freak out if we're in the middle of cleanup 8314 var $curSlide = this.$slides.filter('.is-active').eq(0); 8315 8316 if (/mui/g.test($curSlide[0].className)) { 8317 return false; 8318 } //if the slide is currently animating, kick out of the function 8319 8320 var $firstSlide = this.$slides.first(), 8321 $lastSlide = this.$slides.last(), 8322 dirIn = isLTR ? 'Right' : 'Left', 8323 dirOut = isLTR ? 'Left' : 'Right', 8324 _this = this, 8325 $newSlide; 8326 8327 if (!chosenSlide) { 8328 //most of the time, this will be auto played or clicked from the navButtons. 8329 $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!!!!! 8330 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 8331 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 8332 } else { 8333 $newSlide = chosenSlide; 8334 } 8335 8336 if ($newSlide.length) { 8337 /** 8338 * Triggers before the next slide starts animating in and only if a next slide has been found. 8339 * @event Orbit#beforeslidechange 8340 */ 8341 this.$element.trigger('beforeslidechange.zf.orbit', [$curSlide, $newSlide]); 8342 8343 if (this.options.bullets) { 8344 idx = idx || this.$slides.index($newSlide); //grab index to update bullets 8345 this._updateBullets(idx); 8346 } 8347 8348 if (this.options.useMUI && !this.$element.is(':hidden')) { 8349 _foundationUtil2.Motion.animateIn($newSlide.addClass('is-active').css({ 'position': 'absolute', 'top': 0 }), this.options['animInFrom' + dirIn], function () { 8350 $newSlide.css({ 'position': 'relative', 'display': 'block' }).attr('aria-live', 'polite'); 8351 }); 8352 8353 _foundationUtil2.Motion.animateOut($curSlide.removeClass('is-active'), this.options['animOutTo' + dirOut], function () { 8354 $curSlide.removeAttr('aria-live'); 8355 if (_this.options.autoPlay && !_this.timer.isPaused) { 8356 _this.timer.restart(); 8357 } 8358 //do stuff? 8359 }); 8360 } else { 8361 $curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide(); 8362 $newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show(); 8363 if (this.options.autoPlay && !this.timer.isPaused) { 8364 this.timer.restart(); 8365 } 8366 } 8367 /** 8368 * Triggers when the slide has finished animating in. 8369 * @event Orbit#slidechange 8370 */
8371 this.$element.trigger('slidechange.zf.orbit', [$newSlide]); 8372 } 8373 } 8374 8375 /** 8376 * Updates the active state of the bullets, if displayed. 8377 * @function 8378 * @private 8379 * @param {Number} idx - the index of the current slide. 8380 */ 8381 8382 }, { 8383 key: '_updateBullets', 8384 value: function _updateBullets(idx) { 8385 var $oldBullet = this.$element.find('.' + this.options.boxOfBullets).find('.is-active').removeClass('is-active').blur(), 8386 span = $oldBullet.find('span:last').detach(), 8387 $newBullet = this.$bullets.eq(idx).addClass('is-active').append(span); 8388 } 8389 8390 /** 8391 * Destroys the carousel and hides the element. 8392 * @function 8393 */ 8394 8395 }, { 8396 key: '_destroy', 8397 value: function _destroy() { 8398 this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide(); 8399 } 8400 }]); 8401 8402 return Orbit; 8403}(_foundation.Plugin); 8404 8405Orbit.defaults = { 8406 /** 8407 * Tells the JS to look for and loadBullets. 8408 * @option 8409 * @type {boolean} 8410 * @default true 8411 */ 8412 bullets: true, 8413 /** 8414 * Tells the JS to apply event listeners to nav buttons 8415 * @option 8416 * @type {boolean} 8417 * @default true 8418 */ 8419 navButtons: true, 8420 /** 8421 * motion-ui animation class to apply 8422 * @option 8423 * @type {string} 8424 * @default 'slide-in-right' 8425 */ 8426 animInFromRight: 'slide-in-right', 8427 /** 8428 * motion-ui animation class to apply 8429 * @option 8430 * @type {string} 8431 * @default 'slide-out-right' 8432 */ 8433 animOutToRight: 'slide-out-right', 8434 /** 8435 * motion-ui animation class to apply 8436 * @option 8437 * @type {string} 8438 * @default 'slide-in-left' 8439 * 8440 */ 8441 animInFromLeft: 'slide-in-left', 8442 /** 8443 * motion-ui animation class to apply 8444 * @option 8445 * @type {string} 8446 * @default 'slide-out-left' 8447 */ 8448 animOutToLeft: 'slide-out-left', 8449 /** 8450 * Allows Orbit to automatically animate on page load. 8451 * @option 8452 * @type {boolean} 8453 * @default true 8454 */ 8455 autoPlay: true, 8456 /** 8457 * Amount of time, in ms, between slide transitions 8458 * @option 8459 * @type {number} 8460 * @default 5000 8461 */ 8462 timerDelay: 5000, 8463 /** 8464 * Allows Orbit to infinitely loop through the slides 8465 * @option 8466 * @type {boolean} 8467 * @default true 8468 */ 8469 infiniteWrap: true, 8470 /** 8471 * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library 8472 * @option 8473 * @type {boolean} 8474 * @default true 8475 */ 8476 swipe: true, 8477 /** 8478 * Allows the timing function to pause animation on hover. 8479 * @option 8480 * @type {boolean} 8481 * @default true 8482 */ 8483 pauseOnHover: true, 8484 /** 8485 * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys 8486 * @option 8487 * @type {boolean} 8488 * @default true 8489 */ 8490 accessible: true, 8491 /** 8492 * Class applied to the container of Orbit 8493 * @option 8494 * @type {string} 8495 * @default 'orbit-container' 8496 */ 8497 containerClass: 'orbit-container', 8498 /** 8499 * Class applied to individual slides. 8500 * @option 8501 * @type {string} 8502 * @default 'orbit-slide' 8503 */ 8504 slideClass: 'orbit-slide', 8505 /** 8506 * Class applied to the bullet container. You're welcome. 8507 * @option 8508 * @type {string} 8509 * @default 'orbit-bullets' 8510 */ 8511 boxOfBullets: 'orbit-bullets', 8512 /** 8513 * Class applied to the `next` navigation button. 8514 * @option 8515 * @type {string} 8516 * @default 'orbit-next' 8517 */ 8518 nextClass: 'orbit-next', 8519 /** 8520 * Class applied to the `previous` navigation button. 8521 * @option 8522 * @type {string} 8523 * @default 'orbit-previous' 8524 */ 8525 prevClass: 'orbit-previous', 8526 /** 8527 * Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatability. 8528 * @option 8529 * @type {boolean} 8530 * @default true 8531 */ 8532 useMUI: true 8533}; 8534 8535exports.Orbit = Orbit; 8536 8537/***/ }), 8538/* 29 */ 8539/***/ (function(module, exports, __webpack_require__) { 8540 8541"use strict"; 8542 8543 8544Object.defineProperty(exports, "__esModule", { 8545 value: true 8546}); 8547exports.ResponsiveAccordionTabs = undefined; 8548 8549var _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; }; }(); 8550 8551var _jquery = __webpack_require__(0); 8552 8553var _jquery2 = _interopRequireDefault(_jquery); 8554 8555var _foundationUtil = __webpack_require__(4); 8556 8557var _foundationUtil2 = __webpack_require__(1); 8558 8559var _foundation = __webpack_require__(2); 8560 8561var _foundation2 = __webpack_require__(11); 8562 8563var _foundation3 = __webpack_require__(17); 8564 8565function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8566 8567function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8568 8569function _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; } 8570 8571function _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
8571onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8572 8573// The plugin matches the plugin classes with these plugin instances. 8574var MenuPlugins = { 8575 tabs: { 8576 cssClass: 'tabs', 8577 plugin: _foundation3.Tabs 8578 }, 8579 accordion: { 8580 cssClass: 'accordion', 8581 plugin: _foundation2.Accordion 8582 } 8583}; 8584 8585/** 8586 * ResponsiveAccordionTabs module. 8587 * @module foundation.responsiveAccordionTabs 8588 * @requires foundation.util.motion 8589 * @requires foundation.accordion 8590 * @requires foundation.tabs 8591 */ 8592 8593var ResponsiveAccordionTabs = function (_Plugin) { 8594 _inherits(ResponsiveAccordionTabs, _Plugin); 8595 8596 function ResponsiveAccordionTabs() { 8597 _classCallCheck(this, ResponsiveAccordionTabs); 8598 8599 return _possibleConstructorReturn(this, (ResponsiveAccordionTabs.__proto__ || Object.getPrototypeOf(ResponsiveAccordionTabs)).apply(this, arguments)); 8600 } 8601 8602 _createClass(ResponsiveAccordionTabs, [{ 8603 key: '_setup', 8604 8605 /** 8606 * Creates a new instance of a responsive accordion tabs. 8607 * @class 8608 * @name ResponsiveAccordionTabs 8609 * @fires ResponsiveAccordionTabs#init 8610 * @param {jQuery} element - jQuery object to make into Responsive Accordion Tabs. 8611 * @param {Object} options - Overrides to the default plugin settings. 8612 */ 8613 value: function _setup(element, options) { 8614 this.$element = (0, _jquery2.default)(element); 8615 this.options = _jquery2.default.extend({}, this.$element.data(), options); 8616 this.rules = this.$element.data('responsive-accordion-tabs'); 8617 this.currentMq = null; 8618 this.currentPlugin = null; 8619 this.className = 'ResponsiveAccordionTabs'; // ie9 back compat 8620 if (!this.$element.attr('id')) { 8621 this.$element.attr('id', (0, _foundationUtil2.GetYoDigits)(6, 'responsiveaccordiontabs')); 8622 }; 8623 8624 this._init(); 8625 this._events(); 8626 } 8627 8628 /** 8629 * Initializes the Menu by parsing the classes from the 'data-responsive-accordion-tabs' attribute on the element. 8630 * @function 8631 * @private 8632 */ 8633 8634 }, { 8635 key: '_init', 8636 value: function _init() { 8637 _foundationUtil.MediaQuery._init(); 8638 8639 // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules 8640 if (typeof this.rules === 'string') { 8641 var rulesTree = {}; 8642 8643 // Parse rules from "classes" pulled from data attribute 8644 var rules = this.rules.split(' '); 8645 8646 // Iterate through every rule found 8647 for (var i = 0; i < rules.length; i++) { 8648 var rule = rules[i].split('-'); 8649 var ruleSize = rule.length > 1 ? rule[0] : 'small'; 8650 var rulePlugin = rule.length > 1 ? rule[1] : rule[0]; 8651 8652 if (MenuPlugins[rulePlugin] !== null) { 8653 rulesTree[ruleSize] = MenuPlugins[rulePlugin]; 8654 } 8655 } 8656 8657 this.rules = rulesTree; 8658 } 8659 8660 this._getAllOptions(); 8661 8662 if (!_jquery2.default.isEmptyObject(this.rules)) { 8663 this._checkMediaQueries(); 8664 } 8665 } 8666 }, { 8667 key: '_getAllOptions', 8668 value: function _getAllOptions() { 8669 //get all defaults and options 8670 var _this = this; 8671 _this.allOptions = {}; 8672 for (var key in MenuPlugins) { 8673 if (MenuPlugins.hasOwnProperty(key)) { 8674 var obj = MenuPlugins[key]; 8675 try { 8676 var dummyPlugin = (0, _jquery2.default)('<ul></ul>'); 8677 var tmpPlugin = new obj.plugin(dummyPlugin, _this.options); 8678 for (var keyKey in tmpPlugin.options) { 8679 if (tmpPlugin.options.hasOwnProperty(keyKey) && keyKey !== 'zfPlugin') { 8680 var objObj = tmpPlugin.options[keyKey]; 8681 _this.allOptions[keyKey] = objObj; 8682 } 8683 } 8684 tmpPlugin.destroy(); 8685 } catch (e) {} 8686 } 8687 } 8688 } 8689 8690 /** 8691 * Initializes events for the Menu. 8692 * @function 8693 * @private 8694 */ 8695 8696 }, { 8697 key: '_events', 8698 value: function _events() { 8699 var _this = this; 8700 8701 (0, _jquery2.default)(window).on('changed.zf.mediaquery', function () { 8702 _this._checkMediaQueries(); 8703 }); 8704 } 8705 8706 /** 8707 * 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. 8708 * @function 8709 * @private 8710 */ 8711 8712 }, { 8713 key: '_checkMediaQueries', 8714 value: function _checkMediaQueries() { 8715 var matchedMq, 8716 _this = this; 8717 // Iterate through each rule and find the last matching rule 8718 _jquery2.default.each(this.rules, function (key) { 8719 if (_foundationUtil.MediaQuery.atLeast(key)) { 8720 matchedMq = key; 8721 } 8722 }); 8723 8724 // No match? No dice 8725 if (!matchedMq) return; 8726 8727 // Plugin already initialized? We good 8728 if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; 8729 8730 // Remove existing plugin-specific CSS classes 8731 _jquery2.default.each(MenuPlugins, function (key, value) { 8732 _this.$element.removeClass(value.cssClass); 8733 }); 8734 8735 // Add the CSS class for the new plugin 8736 this.$element.addClass(this.rules[matchedMq].cssClass); 8737 8738 // Create an instance of the new plugin 8739 if (this.currentPlugin) {
8740 //don't know why but on nested elements data zfPlugin get's lost 8741 if (!this.currentPlugin.$element.data('zfPlugin') && this.storezfData) this.currentPlugin.$element.data('zfPlugin', this.storezfData); 8742 this.currentPlugin.destroy(); 8743 } 8744 this._handleMarkup(this.rules[matchedMq].cssClass); 8745 this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {}); 8746 this.storezfData = this.currentPlugin.$element.data('zfPlugin'); 8747 } 8748 }, { 8749 key: '_handleMarkup', 8750 value: function _handleMarkup(toSet) { 8751 var _this = this, 8752 fromString = 'accordion'; 8753 var $panels = (0, _jquery2.default)('[data-tabs-content=' + this.$element.attr('id') + ']'); 8754 if ($panels.length) fromString = 'tabs'; 8755 if (fromString === toSet) { 8756 return; 8757 }; 8758 8759 var tabsTitle = _this.allOptions.linkClass ? _this.allOptions.linkClass : 'tabs-title'; 8760 var tabsPanel = _this.allOptions.panelClass ? _this.allOptions.panelClass : 'tabs-panel'; 8761 8762 this.$element.removeAttr('role'); 8763 var $liHeads = this.$element.children('.' + tabsTitle + ',[data-accordion-item]').removeClass(tabsTitle).removeClass('accordion-item').removeAttr('data-accordion-item'); 8764 var $liHeadsA = $liHeads.children('a').removeClass('accordion-title'); 8765 8766 if (fromString === 'tabs') { 8767 $panels = $panels.children('.' + tabsPanel).removeClass(tabsPanel).removeAttr('role').removeAttr('aria-hidden').removeAttr('aria-labelledby'); 8768 $panels.children('a').removeAttr('role').removeAttr('aria-controls').removeAttr('aria-selected'); 8769 } else { 8770 $panels = $liHeads.children('[data-tab-content]').removeClass('accordion-content'); 8771 }; 8772 8773 $panels.css({ display: '', visibility: '' }); 8774 $liHeads.css({ display: '', visibility: '' }); 8775 if (toSet === 'accordion') { 8776 $panels.each(function (key, value) { 8777 (0, _jquery2.default)(value).appendTo($liHeads.get(key)).addClass('accordion-content').attr('data-tab-content', '').removeClass('is-active').css({ height: '' }); 8778 (0, _jquery2.default)('[data-tabs-content=' + _this.$element.attr('id') + ']').after('<div id="tabs-placeholder-' + _this.$element.attr('id') + '"></div>').detach(); 8779 $liHeads.addClass('accordion-item').attr('data-accordion-item', ''); 8780 $liHeadsA.addClass('accordion-title'); 8781 }); 8782 } else if (toSet === 'tabs') { 8783 var $tabsContent = (0, _jquery2.default)('[data-tabs-content=' + _this.$element.attr('id') + ']'); 8784 var $placeholder = (0, _jquery2.default)('#tabs-placeholder-' + _this.$element.attr('id')); 8785 if ($placeholder.length) { 8786 $tabsContent = (0, _jquery2.default)('<div class="tabs-content"></div>').insertAfter($placeholder).attr('data-tabs-content', _this.$element.attr('id')); 8787 $placeholder.remove(); 8788 } else { 8789 $tabsContent = (0, _jquery2.default)('<div class="tabs-content"></div>').insertAfter(_this.$element).attr('data-tabs-content', _this.$element.attr('id')); 8790 }; 8791 $panels.each(function (key, value) { 8792 var tempValue = (0, _jquery2.default)(value).appendTo($tabsContent).addClass(tabsPanel); 8793 var hash = $liHeadsA.get(key).hash.slice(1); 8794 var id = (0, _jquery2.default)(value).attr('id') || (0, _foundationUtil2.GetYoDigits)(6, 'accordion'); 8795 if (hash !== id) { 8796 if (hash !== '') { 8797 (0, _jquery2.default)(value).attr('id', hash); 8798 } else { 8799 hash = id; 8800 (0, _jquery2.default)(value).attr('id', hash); 8801 (0, _jquery2.default)($liHeadsA.get(key)).attr('href', (0, _jquery2.default)($liHeadsA.get(key)).attr('href').replace('#', '') + '#' + hash); 8802 }; 8803 }; 8804 var isActive = (0, _jquery2.default)($liHeads.get(key)).hasClass('is-active'); 8805 if (isActive) { 8806 tempValue.addClass('is-active'); 8807 }; 8808 }); 8809 $liHeads.addClass(tabsTitle); 8810 }; 8811 } 8812 8813 /** 8814 * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out. 8815 * @function 8816 */ 8817 8818 }, { 8819 key: '_destroy', 8820 value: function _destroy() { 8821 if (this.currentPlugin) this.currentPlugin.destroy(); 8822 (0, _jquery2.default)(window).off('.zf.ResponsiveAccordionTabs'); 8823 } 8824 }]); 8825 8826 return ResponsiveAccordionTabs; 8827}
8827(_foundation.Plugin); 8828 8829ResponsiveAccordionTabs.defaults = {}; 8830 8831exports.ResponsiveAccordionTabs = ResponsiveAccordionTabs; 8832 8833/***/ }), 8834/* 30 */ 8835/***/ (function(module, exports, __webpack_require__) { 8836 8837"use strict"; 8838 8839 8840Object.defineProperty(exports, "__esModule", { 8841 value: true 8842}); 8843exports.ResponsiveMenu = undefined; 8844 8845var _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; }; }(); 8846 8847var _jquery = __webpack_require__(0); 8848 8849var _jquery2 = _interopRequireDefault(_jquery); 8850 8851var _foundationUtil = __webpack_require__(4); 8852 8853var _foundationUtil2 = __webpack_require__(1); 8854 8855var _foundation = __webpack_require__(2); 8856 8857var _foundation2 = __webpack_require__(14); 8858 8859var _foundation3 = __webpack_require__(13); 8860 8861var _foundation4 = __webpack_require__(12); 8862 8863function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 8864 8865function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8866 8867function _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; } 8868 8869function _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; } 8870 8871var MenuPlugins = { 8872 dropdown: { 8873 cssClass: 'dropdown', 8874 plugin: _foundation2.DropdownMenu 8875 }, 8876 drilldown: { 8877 cssClass: 'drilldown', 8878 plugin: _foundation3.Drilldown 8879 }, 8880 accordion: { 8881 cssClass: 'accordion-menu', 8882 plugin: _foundation4.AccordionMenu 8883 } 8884}; 8885 8886// import "foundation.util.triggers.js"; 8887 8888 8889/** 8890 * ResponsiveMenu module. 8891 * @module foundation.responsiveMenu 8892 * @requires foundation.util.triggers 8893 * @requires foundation.util.mediaQuery 8894 */ 8895 8896var ResponsiveMenu = function (_Plugin) { 8897 _inherits(ResponsiveMenu, _Plugin); 8898 8899 function ResponsiveMenu() { 8900 _classCallCheck(this, ResponsiveMenu); 8901 8902 return _possibleConstructorReturn(this, (ResponsiveMenu.__proto__ || Object.getPrototypeOf(ResponsiveMenu)).apply(this, arguments)); 8903 } 8904 8905 _createClass(ResponsiveMenu, [{ 8906 key: '_setup', 8907 8908 /** 8909 * Creates a new instance of a responsive menu. 8910 * @class 8911 * @name ResponsiveMenu 8912 * @fires ResponsiveMenu#init 8913 * @param {jQuery} element - jQuery object to make into a dropdown menu. 8914 * @param {Object} options - Overrides to the default plugin settings. 8915 */ 8916 value: function _setup(element, options) { 8917 this.$element = (0, _jquery2.default)(element); 8918 this.rules = this.$element.data('responsive-menu'); 8919 this.currentMq = null; 8920 this.currentPlugin = null; 8921 this.className = 'ResponsiveMenu'; // ie9 back compat 8922 8923 this._init(); 8924 this._events(); 8925 } 8926 8927 /** 8928 * Initializes the Menu by parsing the classes from the 'data-ResponsiveMenu' attribute on the element. 8929 * @function 8930 * @private 8931 */ 8932 8933 }, { 8934 key: '_init', 8935 value: function _init() { 8936 8937 _foundationUtil.MediaQuery._init(); 8938 // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules 8939 if (typeof this.rules === 'string') { 8940 var rulesTree = {}; 8941 8942 // Parse rules from "classes" pulled from data attribute 8943 var rules = this.rules.split(' '); 8944 8945 // Iterate through every rule found 8946 for (var i = 0; i < rules.length; i++) { 8947 var rule = rules[i].split('-'); 8948 var ruleSize = rule.length > 1 ? rule[0] : 'small'; 8949 var rulePlugin = rule.length > 1 ? rule[1] : rule[0]; 8950 8951 if (MenuPlugins[rulePlugin] !== null) { 8952 rulesTree[ruleSize] = MenuPlugins[rulePlugin]; 8953 } 8954 } 8955 8956 this.rules = rulesTree; 8957 } 8958 8959 if (!_jquery2.default.isEmptyObject(this.rules)) { 8960 this._checkMediaQueries(); 8961 } 8962 // Add data-mutate since children may need it. 8963 this.$element.attr('data-mutate', this.$element.attr('data-mutate') || (0, _foundationUtil2.GetYoDigits)(6, 'responsive-menu')); 8964 } 8965 8966 /** 8967 * Initializes events for the Menu. 8968 * @function 8969 * @private 8970 */ 8971 8972 }, { 8973 key: '_events', 8974 value: function _events() { 8975 var _this = this; 8976 8977 (0, _jquery2.default)(window).on('changed.zf.mediaquery', function () { 8978 _this._checkMediaQueries(); 8979 }); 8980 // $(window).on('resize.zf.ResponsiveMenu', function() { 8981 // _this._checkMediaQueries(); 8982 // }); 8983 } 8984 8985 /** 8986 * 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. 8987 * @function 8988 * @private 8989 */ 8990 8991 }, { 8992 key: '_checkMediaQueries', 8993 value: function _checkMediaQueries() { 8994 var matchedMq, 8995 _this = this; 8996 // Iterate through each rule and find the last matching rule 8997 _jquery2.default.each(this.rules, function (key) { 8998 if (_foundationUtil.MediaQuery.atLeast(key)) { 8999 matchedMq = key; 9000 } 9001 }); 9002 9003 // No match? No dice 9004 if (!matchedMq) return; 9005 9006 // Plugin already initialized? We good 9007 if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; 9008 9009 // Remove existing plugin-specific CSS classes 9010 _jquery2.default.each(MenuPlugins, function (key, value) { 9011 _this.$element.removeClass(value.cssClass); 9012 }); 9013 9014 // Add the CSS class for the new plugin 9015 this.$element.addClass(this.rules[matchedMq].cssClass); 9016 9017 // Create an instance of the new plugin 9018 if (this.currentPlugin) this.currentPlugin.destroy(); 9019 this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {}); 9020 } 9021 9022 /** 9023 * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out. 9024 * @function 9025 */ 9026 9027 }, { 9028 key: '_destroy', 9029 value: function _destroy() { 9030 this.currentPlugin.destroy(); 9031 (0, _jquery2.default)(window).off('.zf.ResponsiveMenu'); 9032 } 9033 }]); 9034 9035 return ResponsiveMenu; 9036}
9036(_foundation.Plugin); 9037 9038ResponsiveMenu.defaults = {}; 9039 9040exports.ResponsiveMenu = ResponsiveMenu; 9041 9042/***/ }), 9043/* 31 */ 9044/***/ (function(module, exports, __webpack_require__) { 9045 9046"use strict"; 9047 9048 9049Object.defineProperty(exports, "__esModule", { 9050 value: true 9051}); 9052exports.ResponsiveToggle = undefined; 9053 9054var _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; }; }(); 9055 9056var _jquery = __webpack_require__(0); 9057 9058var _jquery2 = _interopRequireDefault(_jquery); 9059 9060var _foundationUtil = __webpack_require__(4); 9061 9062var _foundationUtil2 = __webpack_require__(6); 9063 9064var _foundation = __webpack_require__(2); 9065 9066function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 9067 9068function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9069 9070function _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; } 9071 9072function _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; } 9073 9074/** 9075 * ResponsiveToggle module. 9076 * @module foundation.responsiveToggle 9077 * @requires foundation.util.mediaQuery 9078 * @requires foundation.util.motion 9079 */ 9080 9081var ResponsiveToggle = function (_Plugin) { 9082 _inherits(ResponsiveToggle, _Plugin); 9083 9084 function ResponsiveToggle() { 9085 _classCallCheck(this, ResponsiveToggle); 9086 9087 return _possibleConstructorReturn(this, (ResponsiveToggle.__proto__ || Object.getPrototypeOf(ResponsiveToggle)).apply(this, arguments)); 9088 } 9089 9090 _createClass(ResponsiveToggle, [{ 9091 key: '_setup', 9092 9093 /** 9094 * Creates a new instance of Tab Bar. 9095 * @class 9096 * @name ResponsiveToggle 9097 * @fires ResponsiveToggle#init 9098 * @param {jQuery} element - jQuery object to attach tab bar functionality to. 9099 * @param {Object} options - Overrides to the default plugin settings. 9100 */ 9101 value: function _setup(element, options) { 9102 this.$element = (0, _jquery2.default)(element); 9103 this.options = _jquery2.default.extend({}, ResponsiveToggle.defaults, this.$element.data(), options); 9104 this.className = 'ResponsiveToggle'; // ie9 back compat 9105 9106 this._init(); 9107 this._events(); 9108 } 9109 9110 /** 9111 * Initializes the tab bar by finding the target element, toggling element, and running update(). 9112 * @function 9113 * @private 9114 */ 9115 9116 }, { 9117 key: '_init', 9118 value: function _init() { 9119 _foundationUtil.MediaQuery._init(); 9120 var targetID = this.$element.data('responsive-toggle'); 9121 if (!targetID) { 9122 console.error('Your tab bar needs an ID of a Menu as the value of data-tab-bar.'); 9123 } 9124 9125 this.$targetMenu = (0, _jquery2.default)('#' + targetID); 9126 this.$toggler = this.$element.find('[data-toggle]').filter(function () { 9127 var target = (0, _jquery2.default)(this).data('toggle'); 9128 return target === targetID || target === ""; 9129 }); 9130 this.options = _jquery2.default.extend({}, this.options, this.$targetMenu.data()); 9131 9132 // If they were set, parse the animation classes 9133 if (this.options.animate) { 9134 var input = this.options.animate.split(' '); 9135 9136 this.animationIn = input[0]; 9137 this.animationOut = input[1] || null; 9138 } 9139 9140 this._update(); 9141 } 9142 9143 /** 9144 * Adds necessary event handlers for the tab bar to work. 9145 * @function 9146 * @private 9147 */ 9148 9149 }, { 9150 key: '_events', 9151 value: function _events() { 9152 var _this = this; 9153 9154 this._updateMqHandler = this._update.bind(this); 9155 9156 (0, _jquery2.default)(window).on('changed.zf.mediaquery', this._updateMqHandler); 9157 9158 this.$toggler.on('click.zf.responsiveToggle', this.toggleMenu.bind(this)); 9159 } 9160 9161 /** 9162 * Checks the current media query to determine if the tab bar should be visible or hidden. 9163 * @function 9164 * @private 9165 */ 9166 9167 }, { 9168 key: '_update', 9169 value: function _update() { 9170 // Mobile 9171 if (!_foundationUtil.MediaQuery.atLeast(this.options.hideFor)) { 9172 this.$element.show(); 9173 this.$targetMenu.hide(); 9174 } 9175 9176 // Desktop 9177 else { 9178 this.$element.hide(); 9179 this.$targetMenu.show(); 9180 } 9181 } 9182 9183 /** 9184 * Toggles the element attached to the tab bar. The toggle only happens if the screen is small enough to allow it. 9185 * @function 9186 * @fires ResponsiveToggle#toggled 9187 */ 9188 9189 }, { 9190 key: 'toggleMenu', 9191 value: function toggleMenu() { 9192 var _this3 = this; 9193 9194 if (!_foundationUtil.MediaQuery.atLeast(this.options.hideFor)) { 9195 /** 9196 * Fires when the element attached to the tab bar toggles. 9197 * @event ResponsiveToggle#toggled 9198 */ 9199 if (this.options.animate) { 9200 if (this.$targetMenu.is(':hidden')) { 9201 _foundationUtil2.Motion.animateIn(this.$targetMenu, this.animationIn, function () { 9202 _this3.$element.trigger('toggled.zf.responsiveToggle'); 9203 _this3.$targetMenu.find('[data-mutate]').triggerHandler('mutateme.zf.trigger'); 9204 }); 9205 } else { 9206 _foundationUtil2.Motion.animateOut(this.$targetMenu, this.animationOut, function () { 9207 _this3.$element.trigger('toggled.zf.responsiveToggle'); 9208 }); 9209 } 9210 } else { 9211 this.$targetMenu.toggle(0); 9212 this.$targetMenu.find('[data-mutate]').trigger('mutateme.zf.trigger'); 9213 this.$element.trigger('toggled.zf.responsiveToggle'); 9214 } 9215 } 9216 } 9217 }, { 9218 key: '_destroy', 9219 value: function _destroy() { 9220 this.$element.off('.zf.responsiveToggle'); 9221 this.$toggler.off('.zf.responsiveToggle'); 9222 9223 (0, _jquery2.default)(window).off('changed.zf.mediaquery', this._updateMqHandler); 9224 } 9225 }]); 9226 9227 return ResponsiveToggle; 9228}
9228(_foundation.Plugin); 9229 9230ResponsiveToggle.defaults = { 9231 /** 9232 * The breakpoint after which the menu is always shown, and the tab bar is hidden. 9233 * @option 9234 * @type {string} 9235 * @default 'medium' 9236 */ 9237 hideFor: 'medium', 9238 9239 /** 9240 * To decide if the toggle should be animated or not. 9241 * @option 9242 * @type {boolean} 9243 * @default false 9244 */ 9245 animate: false 9246}; 9247 9248exports.ResponsiveToggle = ResponsiveToggle; 9249 9250/***/ }), 9251/* 32 */ 9252/***/ (function(module, exports, __webpack_require__) { 9253 9254"use strict"; 9255 9256 9257Object.defineProperty(exports, "__esModule", { 9258 value: true 9259}); 9260exports.Reveal = undefined; 9261 9262var _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; }; }(); 9263 9264var _jquery = __webpack_require__(0); 9265 9266var _jquery2 = _interopRequireDefault(_jquery); 9267 9268var _foundationUtil = __webpack_require__(3); 9269 9270var _foundationUtil2 = __webpack_require__(4); 9271 9272var _foundationUtil3 = __webpack_require__(6); 9273 9274var _foundation = __webpack_require__(2); 9275 9276var _foundationUtil4 = __webpack_require__(5); 9277 9278function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 9279 9280function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9281 9282function _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; } 9283 9284function _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; } 9285 9286/** 9287 * Reveal module. 9288 * @module foundation.reveal 9289 * @requires foundation.util.keyboard 9290 * @requires foundation.util.triggers 9291 * @requires foundation.util.mediaQuery 9292 * @requires foundation.util.motion if using animations 9293 */ 9294 9295var Reveal = function (_Plugin) { 9296 _inherits(Reveal, _Plugin); 9297 9298 function Reveal() { 9299 _classCallCheck(this, Reveal); 9300 9301 return _possibleConstructorReturn(this, (Reveal.__proto__ || Object.getPrototypeOf(Reveal)).apply(this, arguments)); 9302 } 9303 9304 _createClass(Reveal, [{ 9305 key: '_setup', 9306 9307 /** 9308 * Creates a new instance of Reveal. 9309 * @class 9310 * @name Reveal 9311 * @param {jQuery} element - jQuery object to use for the modal. 9312 * @param {Object} options - optional parameters. 9313 */ 9314 value: function _setup(element, options) { 9315 this.$element = element; 9316 this.options = _jquery2.default.extend({}, Reveal.defaults, this.$element.data(), options); 9317 this.className = 'Reveal'; // ie9 back compat 9318 this._init(); 9319 9320 // Triggers init is idempotent, just need to make sure it is initialized 9321 _foundationUtil4.Triggers.init(_jquery2.default); 9322 9323 _foundationUtil.Keyboard.register('Reveal', { 9324 'ESCAPE': 'close' 9325 }); 9326 } 9327 9328 /** 9329 * Initializes the modal by adding the overlay and close buttons, (if selected). 9330 * @private 9331 */ 9332 9333 }, { 9334 key: '_init', 9335 value: function _init() { 9336 _foundationUtil2.MediaQuery._init(); 9337 this.id = this.$element.attr('id'); 9338 this.isActive = false; 9339 this.cached = { mq: _foundationUtil2.MediaQuery.current }; 9340 this.isMobile = mobileSniff(); 9341 9342 this.$anchor = (0, _jquery2.default)('[data-open="' + this.id + '"]').length ? (0, _jquery2.default)('[data-open="' + this.id + '"]') : (0, _jquery2.default)('[data-toggle="' + this.id + '"]'); 9343 this.$anchor.attr({ 9344 'aria-controls': this.id, 9345 'aria-haspopup': true, 9346 'tabindex': 0 9347 }); 9348 9349 if (this.options.fullScreen || this.$element.hasClass('full')) { 9350 this.options.fullScreen = true;
9351 this.options.overlay = false; 9352 } 9353 if (this.options.overlay && !this.$overlay) { 9354 this.$overlay = this._makeOverlay(this.id); 9355 } 9356 9357 this.$element.attr({ 9358 'role': 'dialog', 9359 'aria-hidden': true, 9360 'data-yeti-box': this.id, 9361 'data-resize': this.id 9362 }); 9363 9364 if (this.$overlay) { 9365 this.$element.detach().appendTo(this.$overlay); 9366 } else { 9367 this.$element.detach().appendTo((0, _jquery2.default)(this.options.appendTo)); 9368 this.$element.addClass('without-overlay'); 9369 } 9370 this._events(); 9371 if (this.options.deepLink && window.location.hash === '#' + this.id) { 9372 (0, _jquery2.default)(window).one('load.zf.reveal', this.open.bind(this)); 9373 } 9374 } 9375 9376 /** 9377 * Creates an overlay div to display behind the modal. 9378 * @private 9379 */ 9380 9381 }, { 9382 key: '_makeOverlay', 9383 value: function _makeOverlay() { 9384 var additionalOverlayClasses = ''; 9385 9386 if (this.options.additionalOverlayClasses) { 9387 additionalOverlayClasses = ' ' + this.options.additionalOverlayClasses; 9388 } 9389 9390 return (0, _jquery2.default)('<div></div>').addClass('reveal-overlay' + additionalOverlayClasses).appendTo(this.options.appendTo); 9391 } 9392 9393 /** 9394 * Updates position of modal 9395 * TODO: Figure out if we actually need to cache these values or if it doesn't matter 9396 * @private 9397 */ 9398 9399 }, { 9400 key: '_updatePosition', 9401 value: function _updatePosition() { 9402 var width = this.$element.outerWidth(); 9403 var outerWidth = (0, _jquery2.default)(window).width(); 9404 var height = this.$element.outerHeight(); 9405 var outerHeight = (0, _jquery2.default)(window).height(); 9406 var left, top; 9407 if (this.options.hOffset === 'auto') { 9408 left = parseInt((outerWidth - width) / 2, 10); 9409 } else { 9410 left = parseInt(this.options.hOffset, 10); 9411 } 9412 if (this.options.vOffset === 'auto') { 9413 if (height > outerHeight) { 9414 top = parseInt(Math.min(100, outerHeight / 10), 10); 9415 } else { 9416 top = parseInt((outerHeight - height) / 4, 10); 9417 } 9418 } else { 9419 top = parseInt(this.options.vOffset, 10); 9420 } 9421 this.$element.css({ top: top + 'px' }); 9422 // only worry about left if we don't have an overlay or we havea horizontal offset, 9423 // otherwise we're perfectly in the middle 9424 if (!this.$overlay || this.options.hOffset !== 'auto') { 9425 this.$element.css({ left: left + 'px' }); 9426 this.$element.css({ margin: '0px' }); 9427 } 9428 } 9429 9430 /** 9431 * Adds event handlers for the modal. 9432 * @private 9433 */ 9434 9435 }, { 9436 key: '_events', 9437 value: function _events() { 9438 var _this3 = this; 9439 9440 var _this = this; 9441 9442 this.$element.on({ 9443 'open.zf.trigger': this.open.bind(this), 9444 'close.zf.trigger': function closeZfTrigger(event, $element) { 9445 if (event.target === _this.$element[0] || (0, _jquery2.default)(event.target).parents('[data-closable]')[0] === $element) { 9446 // only close reveal when it's explicitly called 9447 return _this3.close.apply(_this3); 9448 } 9449 }, 9450 'toggle.zf.trigger': this.toggle.bind(this), 9451 'resizeme.zf.trigger': function resizemeZfTrigger() { 9452 _this._updatePosition(); 9453 } 9454 }); 9455 9456 if (this.options.closeOnClick && this.options.overlay) { 9457 this.$overlay.off('.zf.reveal').on('click.zf.reveal', function (e) { 9458 if (e.target === _this.$element[0] || _jquery2.default.contains(_this.$element[0], e.target) || !_jquery2.default.contains(document, e.target)) { 9459 return; 9460 } 9461 _this.close(); 9462 }); 9463 } 9464 if (this.options.deepLink) { 9465 (0, _jquery2.default)(window).on('popstate.zf.reveal:' + this.id, this._handleState.bind(this)); 9466 } 9467 } 9468 9469 /** 9470 * Handles modal methods on back/forward button clicks or any other event that triggers popstate. 9471 * @private 9472 */ 9473 9474 }, { 9475 key: '_handleState', 9476 value: function _handleState(e) { 9477 if (window.location.hash === '#' + this.id && !this.isActive) { 9478 this.open(); 9479 } else { 9480 this.close(); 9481 } 9482 } 9483 9484 /** 9485 * Opens the modal controlled by `this.$anchor`, and closes all others by default. 9486 * @function 9487 * @fires Reveal#closeme 9488 * @fires Reveal#open 9489 */ 9490 9491 }, { 9492 key: 'open', 9493 value: function open() { 9494 var _this4 = this; 9495 9496 // either update or replace browser history 9497 if (this.options.deepLink) { 9498 var hash = '#' + this.id; 9499 9500 if (window.history.pushState) { 9501 if (this.options.updateHistory) { 9502 window.history.pushState({}, '', hash); 9503 } else { 9504 window.history.replaceState({}, '', hash); 9505 } 9506 } else { 9507 window.location.hash = hash; 9508 } 9509 } 9510 9511 this.isActive = true; 9512 9513 // Make elements invisible, but remove display: none so we can get size and positioning 9514 this.$element.css({ 'visibility': 'hidden' }).show().scrollTop(0); 9515 if (this.options.overlay) { 9516 this.$overlay.css({ 'visibility': 'hidden' }).show(); 9517 } 9518 9519 this._updatePosition(); 9520 9521 this.$element.hide().css({ 'visibility': '' }); 9522 9523 if (this.$overlay) { 9524 this.$overlay.css({ 'visibility': '' }).hide(); 9525 if (this.$element.hasClass('fast')) { 9526 this.$overlay.addClass('fast'); 9527 } else if (this.$element.hasClass('slow')) { 9528 this.$overlay.addClass('slow'); 9529 } 9530 } 9531 9532 if (!this.options.multipleOpened) { 9533 /** 9534 * Fires immediately before the modal opens. 9535 * Closes any other modals that are currently open 9536 * @event Reveal#closeme 9537 */ 9538 this.$element.trigger('closeme.zf.reveal', this.id); 9539 } 9540 9541 var _this = this; 9542 9543 function addRevealOpenClasses() { 9544 if (_this.isMobile) { 9545 if (!_this.originalScrollPos) { 9546 _this.originalScrollPos = window.pageYOffset; 9547 } 9548 (0, _jquery2.default)('html, body').addClass('is-reveal-open'); 9549 } else { 9550 (0, _jquery2.default)('body').addClass('is-reveal-open'); 9551 } 9552 } 9553 // Motion UI method of reveal 9554 if (this.options.animationIn) { 9555 var afterAnimation = function afterAnimation() { 9556 _this.$element.attr({ 9557 'aria-hidden': false, 9558 'tabindex': -1 9559 }).focus(); 9560 addRevealOpenClasses(); 9561 _foundationUtil.Keyboard.trapFocus(_this.$element); 9562 }; 9563 9564 if (this.options.overlay) { 9565 _foundationUtil3.Motion.animateIn(this.$overlay, 'fade-in'); 9566 } 9567 _foundationUtil3.Motion.animateIn(this.$element, this.options.animationIn, function () { 9568 if (_this4.$element) { 9569 // protect against object having been removed 9570 _this4.focusableElements = _foundationUtil.Keyboard.findFocusable(_this4.$element); 9571 afterAnimation(); 9572 } 9573 }); 9574 } 9575 // jQuery method of reveal 9576 else { 9577 if (this.options.overlay) { 9578 this.$overlay.show(0); 9579 } 9580 this.$element.show(this.options.showDelay); 9581 } 9582 9583 // handle accessibility 9584 this.$element.attr({ 9585 'aria-hidden': false, 9586 'tabindex': -1 9587 }).focus(); 9588 _foundationUtil.Keyboard.trapFocus(this.$element); 9589 9590 addRevealOpenClasses(); 9591 9592 this._extraHandlers(); 9593 9594 /** 9595 * Fires when the modal has successfully opened. 9596 * @event Reveal#open 9597 */ 9598 this.$element.trigger('open.zf.reveal'); 9599 } 9600 9601 /** 9602 * Adds extra event handlers for the body and window if necessary. 9603 * @private 9604 */ 9605 9606 }, { 9607 key: '_extraHandlers', 9608 value: function _extraHandlers() { 9609 var _this = this; 9610 if (!this.$element) { 9611 return; 9612 } // If we're in the middle of cleanup, don't freak out 9613 this.focusableElements = _foundationUtil.Keyboard.findFocusable(this.$element); 9614 9615 if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) { 9616 (0, _jquery2.default)('body').on('click.zf.reveal', function (e) { 9617 if (e.target === _this.$element[0] || _jquery2.default.contains(_this.$element[0], e.target) || !_jquery2.default.contains(document, e.target)) { 9618 return; 9619 } 9620 _this.close(); 9621 }); 9622 } 9623 9624 if (this.options.closeOnEsc) { 9625 (0, _jquery2.default)(window).on('keydown.zf.reveal', function (e) { 9626 _foundationUtil.Keyboard.handleKey(e, 'Reveal', { 9627 close: function close() { 9628 if (_this.options.closeOnEsc) { 9629 _this.close(); 9630 } 9631 } 9632 }); 9633 }); 9634 } 9635 } 9636 9637 /** 9638 * Closes the modal. 9639 * @function 9640 * @fires Reveal#closed 9641 */ 9642 9643 }, { 9644 key: 'close', 9645 value: function close() { 9646 if (!this.isActive || !this.$element.is(':visible')) { 9647 return false;
9648 } 9649 var _this = this; 9650 9651 // Motion UI method of hiding 9652 if (this.options.animationOut) { 9653 if (this.options.overlay) { 9654 _foundationUtil3.Motion.animateOut(this.$overlay, 'fade-out'); 9655 } 9656 9657 _foundationUtil3.Motion.animateOut(this.$element, this.options.animationOut, finishUp); 9658 } 9659 // jQuery method of hiding 9660 else { 9661 this.$element.hide(this.options.hideDelay); 9662 9663 if (this.options.overlay) { 9664 this.$overlay.hide(0, finishUp); 9665 } else { 9666 finishUp(); 9667 } 9668 } 9669 9670 // Conditionals to remove extra event listeners added on open 9671 if (this.options.closeOnEsc) { 9672 (0, _jquery2.default)(window).off('keydown.zf.reveal'); 9673 } 9674 9675 if (!this.options.overlay && this.options.closeOnClick) { 9676 (0, _jquery2.default)('body').off('click.zf.reveal'); 9677 } 9678 9679 this.$element.off('keydown.zf.reveal'); 9680 9681 function finishUp() { 9682 if (_this.isMobile) { 9683 if ((0, _jquery2.default)('.reveal:visible').length === 0) { 9684 (0, _jquery2.default)('html, body').removeClass('is-reveal-open'); 9685 } 9686 if (_this.originalScrollPos) { 9687 (0, _jquery2.default)('body').scrollTop(_this.originalScrollPos); 9688 _this.originalScrollPos = null; 9689 } 9690 } else { 9691 if ((0, _jquery2.default)('.reveal:visible').length === 0) { 9692 (0, _jquery2.default)('body').removeClass('is-reveal-open'); 9693 } 9694 } 9695 9696 _foundationUtil.Keyboard.releaseFocus(_this.$element); 9697 9698 _this.$element.attr('aria-hidden', true); 9699 9700 /** 9701 * Fires when the modal is done closing. 9702 * @event Reveal#closed 9703 */ 9704 _this.$element.trigger('closed.zf.reveal'); 9705 } 9706 9707 /** 9708 * Resets the modal content 9709 * This prevents a running video to keep going in the background 9710 */ 9711 if (this.options.resetOnClose) { 9712 this.$element.html(this.$element.html()); 9713 } 9714 9715 this.isActive = false; 9716 if (_this.options.deepLink) { 9717 if (window.history.replaceState) { 9718 window.history.replaceState('', document.title, window.location.href.replace('#' + this.id, '')); 9719 } else { 9720 window.location.hash = ''; 9721 } 9722 } 9723 9724 this.$anchor.focus(); 9725 } 9726 9727 /** 9728 * Toggles the open/closed state of a modal. 9729 * @function 9730 */ 9731 9732 }, { 9733 key: 'toggle', 9734 value: function toggle() { 9735 if (this.isActive) { 9736 this.close(); 9737 } else { 9738 this.open(); 9739 } 9740 } 9741 }, { 9742 key: '_destroy', 9743 9744 9745 /** 9746 * Destroys an instance of a modal. 9747 * @function 9748 */ 9749 value: function _destroy() { 9750 if (this.options.overlay) { 9751 this.$element.appendTo((0, _jquery2.default)(this.options.appendTo)); // move $element outside of $overlay to prevent error unregisterPlugin() 9752 this.$overlay.hide().off().remove(); 9753 } 9754 this.$element.hide().off(); 9755 this.$anchor.off('.zf'); 9756 (0, _jquery2.default)(window).off('.zf.reveal:' + this.id); 9757 } 9758 }]); 9759 9760 return Reveal; 9761}(_foundation.Plugin); 9762 9763Reveal.defaults = { 9764 /** 9765 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 9766 * @option 9767 * @type {string} 9768 * @default '' 9769 */ 9770 animationIn: '', 9771 /** 9772 * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide. 9773 * @option 9774 * @type {string} 9775 * @default '' 9776 */ 9777 animationOut: '', 9778 /** 9779 * Time, in ms, to delay the opening of a modal after a click if no animation used. 9780 * @option 9781 * @type {number} 9782 * @default 0 9783 */ 9784 showDelay: 0, 9785 /** 9786 * Time, in ms, to delay the closing of a modal after a click if no animation used. 9787 * @option 9788 * @type {number} 9789 * @default 0 9790 */ 9791 hideDelay: 0, 9792 /** 9793 * Allows a click on the body/overlay to close the modal. 9794 * @option 9795 * @type {boolean} 9796 * @default true 9797 */ 9798 closeOnClick: true, 9799 /** 9800 * Allows the modal to close if the user presses the `ESCAPE` key. 9801 * @option 9802 * @type {boolean} 9803 * @default true 9804 */ 9805 closeOnEsc: true, 9806 /** 9807 * If true, allows multiple modals to be displayed at once. 9808 * @option 9809 * @type {boolean} 9810 * @default false 9811 */ 9812 multipleOpened: false, 9813 /** 9814 * Distance, in pixels, the modal should push down from the top of the screen. 9815 * @option 9816 * @type {number|string} 9817 * @default auto 9818 */ 9819 vOffset: 'auto', 9820 /** 9821 * Distance, in pixels, the modal should push in from the side of the screen. 9822 * @option 9823 * @type {number|string} 9824 * @default auto 9825 */ 9826 hOffset: 'auto', 9827 /** 9828 * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well. 9829 * @option 9830 * @type {boolean} 9831 * @default false 9832 */ 9833 fullScreen: false, 9834 /** 9835 * Percentage of screen height the modal should push up from the bottom of the view. 9836 * @option 9837 * @type {number} 9838 * @default 10 9839 */ 9840 btmOffsetPct: 10, 9841 /** 9842 * Allows the modal to generate an overlay div, which will cover the view when modal opens. 9843 * @option 9844 * @type {boolean} 9845 * @default true 9846 */ 9847 overlay: true, 9848 /** 9849 * 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. 9850 * @option 9851 * @type {boolean} 9852 * @default false 9853 */ 9854 resetOnClose: false, 9855 /** 9856 * 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'
9856s user-set id. 9857 * @option 9858 * @type {boolean} 9859 * @default false 9860 */ 9861 deepLink: false, 9862 /** 9863 * Update the browser history with the open modal 9864 * @option 9865 * @default false 9866 */ 9867 updateHistory: false, 9868 /** 9869 * Allows the modal to append to custom div. 9870 * @option 9871 * @type {string} 9872 * @default "body" 9873 */ 9874 appendTo: "body", 9875 /** 9876 * Allows adding additional class names to the reveal overlay. 9877 * @option 9878 * @type {string} 9879 * @default '' 9880 */ 9881 additionalOverlayClasses: '' 9882}; 9883 9884function iPhoneSniff() { 9885 return (/iP(ad|hone|od).*OS/.test(window.navigator.userAgent) 9886 ); 9887} 9888 9889function androidSniff() { 9890 return (/Android/.test(window.navigator.userAgent) 9891 ); 9892} 9893 9894function mobileSniff() { 9895 return iPhoneSniff() || androidSniff(); 9896} 9897 9898exports.Reveal = Reveal; 9899 9900/***/ }), 9901/* 33 */ 9902/***/ (function(module, exports, __webpack_require__) { 9903 9904"use strict"; 9905 9906 9907Object.defineProperty(exports, "__esModule", { 9908 value: true 9909}); 9910exports.Slider = undefined; 9911 9912var _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; }; }(); 9913 9914var _jquery = __webpack_require__(0); 9915 9916var _jquery2 = _interopRequireDefault(_jquery); 9917 9918var _foundationUtil = __webpack_require__(3); 9919 9920var _foundationUtil2 = __webpack_require__(6); 9921 9922var _foundationUtil3 = __webpack_require__(1); 9923 9924var _foundation = __webpack_require__(2); 9925 9926var _foundationUtil4 = __webpack_require__(10); 9927 9928var _foundationUtil5 = __webpack_require__(5); 9929 9930function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 9931 9932function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9933 9934function _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; } 9935 9936function _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; } 9937 9938/** 9939 * Slider module. 9940 * @module foundation.slider 9941 * @requires foundation.util.motion 9942 * @requires foundation.util.triggers 9943 * @requires foundation.util.keyboard 9944 * @requires foundation.util.touch 9945 */ 9946 9947var Slider = function (_Plugin) { 9948 _inherits(Slider, _Plugin); 9949 9950 function Slider() { 9951 _classCallCheck(this, Slider); 9952 9953 return _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).apply(this, arguments)); 9954 } 9955 9956 _createClass(Slider, [{ 9957 key: '_setup', 9958 9959 /** 9960 * Creates a new instance of a slider control. 9961 * @class 9962 * @name Slider 9963 * @param {jQuery} element - jQuery object to make into a slider control. 9964 * @param {Object} options - Overrides to the default plugin settings. 9965 */ 9966 value: function _setup(element, options) { 9967 this.$element = element; 9968 this.options = _jquery2.default.extend({}, Slider.defaults, this.$element.data(), options); 9969 this.className = 'Slider'; // ie9 back compat 9970 9971 // Touch and Triggers inits are idempotent, we just need to make sure it's initialied. 9972 _foundationUtil4.Touch.init(_jquery2.default); 9973 _foundationUtil5.Triggers.init(_jquery2.default); 9974 9975 this._init(); 9976 9977 _foundationUtil.Keyboard.register('Slider', { 9978 'ltr': { 9979 'ARROW_RIGHT': 'increase', 9980 'ARROW_UP': 'increase', 9981 'ARROW_DOWN': 'decrease', 9982 'ARROW_LEFT': 'decrease', 9983 'SHIFT_ARROW_RIGHT': 'increase_fast', 9984 'SHIFT_ARROW_UP': 'increase_fast', 9985 'SHIFT_ARROW_DOWN': 'decrease_fast', 9986 'SHIFT_ARROW_LEFT': 'decrease_fast', 9987 'HOME': 'min', 9988 'END': 'max' 9989 }, 9990 'rtl': { 9991 'ARROW_LEFT': 'increase', 9992 'ARROW_RIGHT': 'decrease', 9993 'SHIFT_ARROW_LEFT': 'increase_fast', 9994 'SHIFT_ARROW_RIGHT': 'decrease_fast' 9995 } 9996 }); 9997 } 9998 9999 /** 10000 * Initilizes the plugin by reading/setting attributes, creating collections and setting the initial position of the handle(s). 10001 * @function 10002 * @private 10003 */ 10004 10005 }, { 10006 key: '_init', 10007 value: function _init() { 10008 this.inputs = this.$element.find('input');
10009 this.handles = this.$element.find('[data-slider-handle]'); 10010 10011 this.$handle = this.handles.eq(0); 10012 this.$input = this.inputs.length ? this.inputs.eq(0) : (0, _jquery2.default)('#' + this.$handle.attr('aria-controls')); 10013 this.$fill = this.$element.find('[data-slider-fill]').css(this.options.vertical ? 'height' : 'width', 0); 10014 10015 var isDbl = false, 10016 _this = this; 10017 if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) { 10018 this.options.disabled = true; 10019 this.$element.addClass(this.options.disabledClass); 10020 } 10021 if (!this.inputs.length) { 10022 this.inputs = (0, _jquery2.default)().add(this.$input); 10023 this.options.binding = true; 10024 } 10025 10026 this._setInitAttr(0); 10027 10028 if (this.handles[1]) { 10029 this.options.doubleSided = true; 10030 this.$handle2 = this.handles.eq(1); 10031 this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : (0, _jquery2.default)('#' + this.$handle2.attr('aria-controls')); 10032 10033 if (!this.inputs[1]) { 10034 this.inputs = this.inputs.add(this.$input2); 10035 } 10036 isDbl = true; 10037 10038 // this.$handle.triggerHandler('click.zf.slider'); 10039 this._setInitAttr(1); 10040 } 10041 10042 // Set handle positions 10043 this.setHandles(); 10044 10045 this._events(); 10046 } 10047 }, { 10048 key: 'setHandles', 10049 value: function setHandles() { 10050 var _this3 = this; 10051 10052 if (this.handles[1]) { 10053 this._setHandlePos(this.$handle, this.inputs.eq(0).val(), true, function () { 10054 _this3._setHandlePos(_this3.$handle2, _this3.inputs.eq(1).val(), true); 10055 }); 10056 } else { 10057 this._setHandlePos(this.$handle, this.inputs.eq(0).val(), true); 10058 } 10059 } 10060 }, { 10061 key: '_reflow', 10062 value: function _reflow() { 10063 this.setHandles(); 10064 } 10065 /** 10066 * @function 10067 * @private 10068 * @param {Number} value - floating point (the value) to be transformed using to a relative position on the slider (the inverse of _value) 10069 */ 10070 10071 }, { 10072 key: '_pctOfBar', 10073 value: function _pctOfBar(value) { 10074 var pctOfBar = percent(value - this.options.start, this.options.end - this.options.start); 10075 10076 switch (this.options.positionValueFunction) { 10077 case "pow": 10078 pctOfBar = this._logTransform(pctOfBar); 10079 break; 10080 case "log": 10081 pctOfBar = this._powTransform(pctOfBar); 10082 break; 10083 } 10084 10085 return pctOfBar.toFixed(2); 10086 } 10087 10088 /** 10089 * @function 10090 * @private 10091 * @param {Number} pctOfBar - floating point, the relative position of the slider (typically between 0-1) to be transformed to a value 10092 */ 10093 10094 }, { 10095 key: '_value', 10096 value: function _value(pctOfBar) { 10097 switch (this.options.positionValueFunction) { 10098 case "pow": 10099 pctOfBar = this._powTransform(pctOfBar); 10100 break; 10101 case "log": 10102 pctOfBar = this._logTransform(pctOfBar); 10103 break; 10104 } 10105 var value = (this.options.end - this.options.start) * pctOfBar + this.options.start; 10106 10107 return value; 10108 } 10109 10110 /** 10111 * @function 10112 * @private 10113 * @param {Number} value - floating point (typically between 0-1) to be transformed using the log function 10114 */ 10115 10116 }, { 10117 key: '_logTransform', 10118 value: function _logTransform(value) { 10119 return baseLog(this.options.nonLinearBase, value * (this.options.nonLinearBase - 1) + 1); 10120 } 10121 10122 /** 10123 * @function 10124 * @private 10125 * @param {Number} value - floating point (typically between 0-1) to be transformed using the power function 10126 */ 10127 10128 }, { 10129 key: '_powTransform', 10130 value: function _powTransform(value) { 10131 return (Math.pow(this.options.nonLinearBase, value) - 1) / (this.options.nonLinearBase - 1); 10132 } 10133 10134 /** 10135 * Sets the position of the selected handle and fill bar. 10136 * @function 10137 * @private 10138 * @param {jQuery} $hndl - the selected handle to move. 10139 * @param {Number} location - floating point between the start and end values of the slider bar. 10140 * @param {Function} cb - callback function to fire on completion. 10141 * @fires Slider#moved 10142 * @fires Slider#changed 10143 */ 10144 10145 }, { 10146 key: '_setHandlePos', 10147 value: function _setHandlePos($hndl, location, noInvert, cb) { 10148 // don't move if the slider has been disabled since its initialization 10149 if (this.$element.hasClass(this.options.disabledClass)) { 10150 return; 10151 } 10152 //might need to alter that slightly for bars that will have odd number selections. 10153 location = parseFloat(location); //on input change events, convert string to number...grumble. 10154 10155 // prevent slider from running out of bounds, if value exceeds the limits set through options, override the value to min/max 10156 if (location < this.options.start) { 10157 location = this.options.start; 10158 } else if (location > this.options.end) { 10159 location = this.options.end; 10160 } 10161 10162 var isDbl = this.options.doubleSided; 10163 10164 if (isDbl) { 10165 //this block is to prevent 2 handles from crossing eachother. Could/should be improved. 10166 if (this.handles.index($hndl) === 0) { 10167 var h2Val = parseFloat(this.$handle2.attr('aria-valuenow')); 10168 location = location >= h2Val ? h2Val - this.options.step : location; 10169 } else { 10170 var h1Val = parseFloat(this.$handle.attr('aria-valuenow')); 10171 location = location <= h1Val ? h1Val + this.options.step : location; 10172 } 10173 } 10174
vendor: 8,053 bytes, lines 10175-10363
10175 //this is for single-handled vertical sliders, it adjusts the value to account for the slider being "upside-down" 10176 //for click and drag events, it's weird due to the scale(-1, 1) css property 10177 if (this.options.vertical && !noInvert) { 10178 location = this.options.end - location; 10179 } 10180 10181 var _this = this, 10182 vert = this.options.vertical, 10183 hOrW = vert ? 'height' : 'width', 10184 lOrT = vert ? 'top' : 'left', 10185 handleDim = $hndl[0].getBoundingClientRect()[hOrW], 10186 elemDim = this.$element[0].getBoundingClientRect()[hOrW], 10187 10188 //percentage of bar min/max value based on click or drag point 10189 pctOfBar = this._pctOfBar(location), 10190 10191 //number of actual pixels to shift the handle, based on the percentage obtained above 10192 pxToMove = (elemDim - handleDim) * pctOfBar, 10193 10194 //percentage of bar to shift the handle 10195 movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal); 10196 //fixing the decimal value for the location number, is passed to other methods as a fixed floating-point value 10197 location = parseFloat(location.toFixed(this.options.decimal)); 10198 // declare empty object for css adjustments, only used with 2 handled-sliders 10199 var css = {}; 10200 10201 this._setValues($hndl, location); 10202 10203 // TODO update to calculate based on values set to respective inputs?? 10204 if (isDbl) { 10205 var isLeftHndl = this.handles.index($hndl) === 0, 10206 10207 //empty variable, will be used for min-height/width for fill bar 10208 dim, 10209 10210 //percentage w/h of the handle compared to the slider bar 10211 handlePct = ~~(percent(handleDim, elemDim) * 100); 10212 //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 10213 if (isLeftHndl) { 10214 //left or top percentage value to apply to the fill bar. 10215 css[lOrT] = movement + '%'; 10216 //calculate the new min-height/width for the fill bar. 10217 dim = parseFloat(this.$handle2[0].style[lOrT]) - movement + handlePct; 10218 //this callback is necessary to prevent errors and allow the proper placement and initialization of a 2-handled slider 10219 //plus, it means we don't care if 'dim' isNaN on init, it won't be in the future. 10220 if (cb && typeof cb === 'function') { 10221 cb(); 10222 } //this is only needed for the initialization of 2 handled sliders 10223 } else { 10224 //just caching the value of the left/bottom handle's left/top property 10225 var handlePos = parseFloat(this.$handle[0].style[lOrT]); 10226 //calculate the new min-height/width for the fill bar. Use isNaN to prevent false positives for numbers <= 0 10227 //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 10228 dim = movement - (isNaN(handlePos) ? (this.options.initialStart - this.options.start) / ((this.options.end - this.options.start) / 100) : handlePos) + handlePct; 10229 } 10230 // assign the min-height/width to our css object 10231 css['min-' + hOrW] = dim + '%'; 10232 } 10233 10234 this.$element.one('finished.zf.animate', function () { 10235 /** 10236 * Fires when the handle is done moving. 10237 * @event Slider#moved 10238 */ 10239 _this.$element.trigger('moved.zf.slider', [$hndl]); 10240 }); 10241 10242 //because we don't know exactly how the handle will be moved, check the amount of time it should take to move. 10243 var moveTime = this.$element.data('dragging') ? 1000 / 60 : this.options.moveTime; 10244 10245 (0, _foundationUtil2.Move)(moveTime, $hndl, function () { 10246 // adjusting the left/top property of the handle, based on the percentage calculated above 10247 // if movement isNaN, that is because the slider is hidden and we cannot determine handle width, 10248 // fall back to next best guess. 10249 if (isNaN(movement)) { 10250 $hndl.css(lOrT, pctOfBar * 100 + '%'); 10251 } else { 10252 $hndl.css(lOrT, movement + '%'); 10253 } 10254 10255 if (!_this.options.doubleSided) { 10256 //if single-handled, a simple method to expand the fill bar 10257 _this.$fill.css(hOrW, pctOfBar * 100 + '%'); 10258 } else { 10259 //otherwise, use the css object we created above 10260 _this.$fill.css(css); 10261 } 10262 }); 10263 10264 /** 10265 * Fires when the value has not been change for a given time. 10266 * @event Slider#changed 10267 */ 10268 clearTimeout(_this.timeout); 10269 _this.timeout = setTimeout(function () { 10270 _this.$element.trigger('changed.zf.slider', [$hndl]); 10271 }, _this.options.changedDelay); 10272 } 10273 10274 /** 10275 * Sets the initial attribute for the slider element. 10276 * @function 10277 * @private 10278 * @param {Number} idx - index of the current handle/input to use. 10279 */ 10280 10281 }, { 10282 key: '_setInitAttr', 10283 value: function _setInitAttr(idx) { 10284 var initVal = idx === 0 ? this.options.initialStart : this.options.initialEnd; 10285 var id = this.inputs.eq(idx).attr('id') || (0, _foundationUtil3.GetYoDigits)(6, 'slider'); 10286 this.inputs.eq(idx).attr({ 10287 'id': id, 10288 'max': this.options.end, 10289 'min': this.options.start, 10290 'step': this.options.step 10291 }); 10292 this.inputs.eq(idx).val(initVal); 10293 this.handles.eq(idx).attr({ 10294 'role': 'slider', 10295 'aria-controls': id, 10296 'aria-valuemax': this.options.end, 10297 'aria-valuemin': this.options.start, 10298 'aria-valuenow': initVal, 10299 'aria-orientation': this.options.vertical ? 'vertical' : 'horizontal', 10300 'tabindex': 0 10301 }); 10302 } 10303 10304 /** 10305 * Sets the input and `aria-valuenow` values for the slider element. 10306 * @function 10307 * @private 10308 * @param {jQuery} $handle - the currently selected handle. 10309 * @param {Number} val - floating point of the new value. 10310 */ 10311 10312 }, { 10313 key: '_setValues', 10314 value: function _setValues($handle, val) { 10315 var idx = this.options.doubleSided ? this.handles.index($handle) : 0; 10316 this.inputs.eq(idx).val(val); 10317 $handle.attr('aria-valuenow', val); 10318 } 10319 10320 /** 10321 * Handles events on the slider element. 10322 * Calculates the new location of the current handle. 10323 * If there are two handles and the bar was clicked, it determines which handle to move. 10324 * @function 10325 * @private 10326 * @param {Object} e - the `event` object passed from the listener. 10327 * @param {jQuery} $handle - the current handle to calculate for, if selected. 10328 * @param {Number} val - floating point number for the new value of the slider. 10329 * TODO clean this up, there's a lot of repeated code between this and the _setHandlePos fn. 10330 */ 10331 10332 }, { 10333 key: '_handleEvent', 10334 value: function _handleEvent(e, $handle, val) { 10335 var value, hasVal; 10336 if (!val) { 10337 //click or drag events 10338 e.preventDefault(); 10339 var _this = this, 10340 vertical = this.options.vertical, 10341 param = vertical ? 'height' : 'width', 10342 direction = vertical ? 'top' : 'left', 10343 eventOffset = vertical ? e.pageY : e.pageX, 10344 halfOfHandle = this.$handle[0].getBoundingClientRect()[param] / 2, 10345 barDim = this.$element[0].getBoundingClientRect()[param], 10346 windowScroll = vertical ? (0, _jquery2.default)(window).scrollTop() : (0, _jquery2.default)(window).scrollLeft(); 10347 10348 var elemOffset = this.$element.offset()[direction]; 10349 10350 // touch events emulated by the touch util give position relative to screen, add window.scroll to event coordinates... 10351 // best way to guess this is simulated is if clientY == pageY 10352 if (e.clientY === e.pageY) { 10353 eventOffset = eventOffset + windowScroll; 10354 } 10355 var eventFromBar = eventOffset - elemOffset; 10356 var barXY; 10357 if (eventFromBar < 0) { 10358 barXY = 0; 10359 } else if (eventFromBar > barDim) { 10360 barXY = barDim; 10361 } else { 10362 barXY = eventFromBar; 10363 }
10364 var offsetPct = percent(barXY, barDim); 10365 10366 value = this._value(offsetPct); 10367 10368 // turn everything around for RTL, yay math! 10369 if ((0, _foundationUtil3.rtl)() && !this.options.vertical) { 10370 value = this.options.end - value; 10371 } 10372 10373 value = _this._adjustValue(null, value); 10374 //boolean flag for the setHandlePos fn, specifically for vertical sliders 10375 hasVal = false; 10376 10377 if (!$handle) { 10378 //figure out which handle it is, pass it to the next function. 10379 var firstHndlPos = absPosition(this.$handle, direction, barXY, param), 10380 secndHndlPos = absPosition(this.$handle2, direction, barXY, param); 10381 $handle = firstHndlPos <= secndHndlPos ? this.$handle : this.$handle2; 10382 } 10383 } else { 10384 //change event on input 10385 value = this._adjustValue(null, val); 10386 hasVal = true; 10387 } 10388 10389 this._setHandlePos($handle, value, hasVal); 10390 } 10391 10392 /** 10393 * Adjustes value for handle in regard to step value. returns adjusted value 10394 * @function 10395 * @private 10396 * @param {jQuery} $handle - the selected handle. 10397 * @param {Number} value - value to adjust. used if $handle is falsy 10398 */ 10399 10400 }, { 10401 key: '_adjustValue', 10402 value: function _adjustValue($handle, value) { 10403 var val, 10404 step = this.options.step, 10405 div = parseFloat(step / 2), 10406 left, 10407 prev_val, 10408 next_val; 10409 if (!!$handle) { 10410 val = parseFloat($handle.attr('aria-valuenow')); 10411 } else { 10412 val = value; 10413 } 10414 left = val % step; 10415 prev_val = val - left; 10416 next_val = prev_val + step; 10417 if (left === 0) { 10418 return val; 10419 } 10420 val = val >= prev_val + div ? next_val : prev_val; 10421 return val; 10422 } 10423 10424 /** 10425 * Adds event listeners to the slider elements. 10426 * @function 10427 * @private 10428 */ 10429 10430 }, { 10431 key: '_events', 10432 value: function _events() { 10433 this._eventsForHandle(this.$handle); 10434 if (this.handles[1]) { 10435 this._eventsForHandle(this.$handle2); 10436 } 10437 } 10438 10439 /** 10440 * Adds event listeners a particular handle 10441 * @function 10442 * @private 10443 * @param {jQuery} $handle - the current handle to apply listeners to. 10444 */ 10445 10446 }, { 10447 key: '_eventsForHandle', 10448 value: function _eventsForHandle($handle) { 10449 var _this = this, 10450 curHandle, 10451 timer; 10452 10453 this.inputs.off('change.zf.slider').on('change.zf.slider', function (e) { 10454 var idx = _this.inputs.index((0, _jquery2.default)(this)); 10455 _this._handleEvent(e, _this.handles.eq(idx), (0, _jquery2.default)(this).val()); 10456 }); 10457 10458 if (this.options.clickSelect) { 10459 this.$element.off('click.zf.slider').on('click.zf.slider', function (e) { 10460 if (_this.$element.data('dragging')) { 10461 return false; 10462 } 10463 10464 if (!(0, _jquery2.default)(e.target).is('[data-slider-handle]')) { 10465 if (_this.options.doubleSided) { 10466 _this._handleEvent(e); 10467 } else { 10468 _this._handleEvent(e, _this.$handle); 10469 } 10470 } 10471 }); 10472 } 10473 10474 if (this.options.draggable) { 10475 this.handles.addTouch(); 10476 10477 var $body = (0, _jquery2.default)('body'); 10478 $handle.off('mousedown.zf.slider').on('mousedown.zf.slider', function (e) { 10479 $handle.addClass('is-dragging'); 10480 _this.$fill.addClass('is-dragging'); // 10481 _this.$element.data('dragging', true); 10482 10483 curHandle = (0, _jquery2.default)(e.currentTarget); 10484 10485 $body.on('mousemove.zf.slider', function (e) { 10486 e.preventDefault(); 10487 _this._handleEvent(e, curHandle); 10488 }).on('mouseup.zf.slider', function (e) { 10489 _this._handleEvent(e, curHandle); 10490 10491 $handle.removeClass('is-dragging'); 10492 _this.$fill.removeClass('is-dragging'); 10493 _this.$element.data('dragging', false); 10494 10495 $body.off('mousemove.zf.slider mouseup.zf.slider'); 10496 }); 10497 }) 10498 // prevent events triggered by touch 10499 .on('selectstart.zf.slider touchmove.zf.slider', function (e) { 10500 e.preventDefault(); 10501 }); 10502 } 10503 10504 $handle.off('keydown.zf.slider').on('keydown.zf.slider', function (e) { 10505 var _$handle = (0, _jquery2.default)(this), 10506 idx = _this.options.doubleSided ? _this.handles.index(_$handle) : 0, 10507 oldValue = parseFloat(_this.inputs.eq(idx).val()), 10508 newValue; 10509 10510 // handle keyboard event with keyboard util 10511 _foundationUtil.Keyboard.handleKey(e, 'Slider', { 10512 decrease: function decrease() { 10513 newValue = oldValue - _this.options.step; 10514 }, 10515 increase: function increase() { 10516 newValue = oldValue + _this.options.step; 10517 }, 10518 decrease_fast: function decrease_fast() { 10519 newValue = oldValue - _this.options.step * 10; 10520 }, 10521 increase_fast: function increase_fast() { 10522 newValue = oldValue + _this.options.step * 10; 10523 }, 10524 min: function min() { 10525 newValue = _this.options.start; 10526 }, 10527 max: function max() { 10528 newValue = _this.options.end; 10529 }, 10530 handled: function handled() { 10531 // only set handle pos when event was handled specially 10532 e.preventDefault(); 10533 _this._setHandlePos(_$handle, newValue, true); 10534 } 10535 }); 10536 /*if (newValue) { // if pressed key has special function, update value 10537 e.preventDefault(); 10538 _this._setHandlePos(_$handle, newValue); 10539 }*/ 10540 }); 10541 } 10542 10543 /** 10544 * Destroys the slider plugin. 10545 */ 10546 10547 }, { 10548 key: '_destroy', 10549 value: function _destroy() { 10550 this.handles.off('.zf.slider'); 10551 this.inputs.off('.zf.slider'); 10552 this.$element.off('.zf.slider'); 10553 10554 clearTimeout(this.timeout); 10555 } 10556 }]); 10557 10558 return Slider; 10559}
10559(_foundation.Plugin); 10560 10561Slider.defaults = { 10562 /** 10563 * Minimum value for the slider scale. 10564 * @option 10565 * @type {number} 10566 * @default 0 10567 */ 10568 start: 0, 10569 /** 10570 * Maximum value for the slider scale. 10571 * @option 10572 * @type {number} 10573 * @default 100 10574 */ 10575 end: 100, 10576 /** 10577 * Minimum value change per change event. 10578 * @option 10579 * @type {number} 10580 * @default 1 10581 */ 10582 step: 1, 10583 /** 10584 * Value at which the handle/input *(left handle/first input)* should be set to on initialization. 10585 * @option 10586 * @type {number} 10587 * @default 0 10588 */ 10589 initialStart: 0, 10590 /** 10591 * Value at which the right handle/second input should be set to on initialization. 10592 * @option 10593 * @type {number} 10594 * @default 100 10595 */ 10596 initialEnd: 100, 10597 /** 10598 * Allows the input to be located outside the container and visible. Set to by the JS 10599 * @option 10600 * @type {boolean} 10601 * @default false 10602 */ 10603 binding: false, 10604 /** 10605 * Allows the user to click/tap on the slider bar to select a value. 10606 * @option 10607 * @type {boolean} 10608 * @default true 10609 */ 10610 clickSelect: true, 10611 /** 10612 * Set to true and use the `vertical` class to change alignment to vertical. 10613 * @option 10614 * @type {boolean} 10615 * @default false 10616 */ 10617 vertical: false, 10618 /** 10619 * Allows the user to drag the slider handle(s) to select a value. 10620 * @option 10621 * @type {boolean} 10622 * @default true 10623 */ 10624 draggable: true, 10625 /** 10626 * Disables the slider and prevents event listeners from being applied. Double checked by JS with `disabledClass`. 10627 * @option 10628 * @type {boolean} 10629 * @default false 10630 */ 10631 disabled: false, 10632 /** 10633 * Allows the use of two handles. Double checked by the JS. Changes some logic handling. 10634 * @option 10635 * @type {boolean} 10636 * @default false 10637 */ 10638 doubleSided: false, 10639 /** 10640 * Potential future feature. 10641 */ 10642 // steps: 100, 10643 /** 10644 * Number of decimal places the plugin should go to for floating point precision. 10645 * @option 10646 * @type {number} 10647 * @default 2 10648 */ 10649 decimal: 2, 10650 /** 10651 * Time delay for dragged elements. 10652 */ 10653 // dragDelay: 0, 10654 /** 10655 * 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. 10656 * @option 10657 * @type {number} 10658 * @default 200 10659 */ 10660 moveTime: 200, //update this if changing the transition time in the sass 10661 /** 10662 * Class applied to disabled sliders. 10663 * @option 10664 * @type {string} 10665 * @default 'disabled' 10666 */ 10667 disabledClass: 'disabled', 10668 /** 10669 * Will invert the default layout for a vertical<span data-tooltip title="who would do this???"> </span>slider. 10670 * @option 10671 * @type {boolean} 10672 * @default false 10673 */ 10674 invertVertical: false, 10675 /** 10676 * Milliseconds before the `changed.zf-slider` event is triggered after value change. 10677 * @option 10678 * @type {number} 10679 * @default 500 10680 */ 10681 changedDelay: 500, 10682 /** 10683 * Basevalue for non-linear sliders 10684 * @option 10685 * @type {number} 10686 * @default 5 10687 */ 10688 nonLinearBase: 5, 10689 /** 10690 * Basevalue for non-linear sliders, possible values are: `'linear'`, `'pow'` & `'log'`. Pow and Log use the nonLinearBase setting. 10691 * @option 10692 * @type {string} 10693 * @default 'linear' 10694 */ 10695 positionValueFunction: 'linear' 10696}; 10697 10698function percent(frac, num) { 10699 return frac / num; 10700} 10701function absPosition($handle, dir, clickPos, param) { 10702 return Math.abs($handle.position()[dir] + $handle[param]() / 2 - clickPos); 10703} 10704function baseLog(base, value) { 10705 return Math.log(value) / Math.log(base); 10706} 10707 10708exports.Slider = Slider; 10709 10710/***/ }), 10711/* 34 */ 10712/***/ (function(module, exports, __webpack_require__) { 10713 10714"use strict"; 10715 10716 10717Object.defineProperty(exports, "__esModule", { 10718 value: true 10719}); 10720exports.Sticky = undefined; 10721 10722var _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; }; }(); 10723 10724var _jquery = __webpack_require__(0); 10725 10726var _jquery2 = _interopRequireDefault(_jquery); 10727 10728var _foundationUtil = __webpack_require__(1); 10729 10730var _foundationUtil2 = __webpack_require__(4); 10731 10732var _foundation = __webpack_require__(2); 10733 10734var _foundationUtil3 = __webpack_require__(5); 10735 10736function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 10737 10738function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10739 10740function _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; } 10741 10742function _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
10742onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10743 10744/** 10745 * Sticky module. 10746 * @module foundation.sticky 10747 * @requires foundation.util.triggers 10748 * @requires foundation.util.mediaQuery 10749 */ 10750 10751var Sticky = function (_Plugin) { 10752 _inherits(Sticky, _Plugin); 10753 10754 function Sticky() { 10755 _classCallCheck(this, Sticky); 10756 10757 return _possibleConstructorReturn(this, (Sticky.__proto__ || Object.getPrototypeOf(Sticky)).apply(this, arguments)); 10758 } 10759 10760 _createClass(Sticky, [{ 10761 key: '_setup', 10762 10763 /** 10764 * Creates a new instance of a sticky thing. 10765 * @class 10766 * @name Sticky 10767 * @param {jQuery} element - jQuery object to make sticky. 10768 * @param {Object} options - options object passed when creating the element programmatically. 10769 */ 10770 value: function _setup(element, options) { 10771 this.$element = element; 10772 this.options = _jquery2.default.extend({}, Sticky.defaults, this.$element.data(), options); 10773 this.className = 'Sticky'; // ie9 back compat 10774 10775 // Triggers init is idempotent, just need to make sure it is initialized 10776 _foundationUtil3.Triggers.init(_jquery2.default); 10777 10778 this._init(); 10779 } 10780 10781 /** 10782 * Initializes the sticky element by adding classes, getting/setting dimensions, breakpoints and attributes 10783 * @function 10784 * @private 10785 */ 10786 10787 }, { 10788 key: '_init', 10789 value: function _init() { 10790 _foundationUtil2.MediaQuery._init(); 10791 10792 var $parent = this.$element.parent('[data-sticky-container]'), 10793 id = this.$element[0].id || (0, _foundationUtil.GetYoDigits)(6, 'sticky'), 10794 _this = this; 10795 10796 if ($parent.length) { 10797 this.$container = $parent; 10798 } else { 10799 this.wasWrapped = true; 10800 this.$element.wrap(this.options.container); 10801 this.$container = this.$element.parent(); 10802 } 10803 this.$container.addClass(this.options.containerClass); 10804 10805 this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id, 'data-mutate': id }); 10806 if (this.options.anchor !== '') { 10807 (0, _jquery2.default)('#' + _this.options.anchor).attr({ 'data-mutate': id }); 10808 } 10809 10810 this.scrollCount = this.options.checkEvery; 10811 this.isStuck = false; 10812 (0, _jquery2.default)(window).one('load.zf.sticky', function () { 10813 //We calculate the container height to have correct values for anchor points offset calculation. 10814 _this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height; 10815 _this.$container.css('height', _this.containerHeight); 10816 _this.elemHeight = _this.containerHeight; 10817 if (_this.options.anchor !== '') { 10818 _this.$anchor = (0, _jquery2.default)('#' + _this.options.anchor); 10819 } else { 10820 _this._parsePoints(); 10821 } 10822 10823 _this._setSizes(function () { 10824 var scroll = window.pageYOffset; 10825 _this._calc(false, scroll); 10826 //Unstick the element will ensure that proper classes are set. 10827 if (!_this.isStuck) { 10828 _this._removeSticky(scroll >= _this.topPoint ? false : true); 10829 } 10830 }); 10831 _this._events(id.split('-').reverse().join('-')); 10832 }); 10833 } 10834 10835 /** 10836 * If using multiple elements as anchors, calculates the top and bottom pixel values the sticky thing should stick and unstick on. 10837 * @function 10838 * @private 10839 */ 10840 10841 }, { 10842 key: '_parsePoints', 10843 value: function _parsePoints() { 10844 var top = this.options.topAnchor == "" ? 1 : this.options.topAnchor, 10845 btm = this.options.btmAnchor == "" ? document.documentElement.scrollHeight : this.options.btmAnchor, 10846 pts = [top, btm], 10847 breaks = {}; 10848 for (var i = 0, len = pts.length; i < len && pts[i]; i++) { 10849 var pt; 10850 if (typeof pts[i] === 'number') { 10851 pt = pts[i]; 10852 } else { 10853 var place = pts[i].split(':'), 10854 anchor = (0, _jquery2.default)('#' + place[0]); 10855 10856 pt = anchor.offset().top; 10857 if (place[1] && place[1].toLowerCase() === 'bottom') { 10858 pt += anchor[0].getBoundingClientRect().height; 10859 } 10860 } 10861 breaks[i] = pt; 10862 } 10863 10864 this.points = breaks; 10865 return; 10866 } 10867 10868 /** 10869 * Adds event handlers for the scrolling element. 10870 * @private 10871 * @param {String} id - pseudo-random id for unique scroll event listener. 10872 */ 10873 10874 }, { 10875 key: '_events', 10876 value: function _events(id) { 10877 var _this = this, 10878 scrollListener = this.scrollListener = 'scroll.zf.' + id; 10879 if (this.isOn) { 10880 return; 10881 } 10882 if (this.canStick) { 10883 this.isOn = true; 10884 (0, _jquery2.default)(window).off(scrollListener).on(scrollListener, function (e) { 10885 if (_this.scrollCount === 0) { 10886 _this.scrollCount = _this.options.checkEvery; 10887 _this._setSizes(function () { 10888 _this._calc(false, window.pageYOffset); 10889 }); 10890 } else { 10891 _this.scrollCount--; 10892 _this._calc(false, window.pageYOffset); 10893 } 10894 }); 10895 } 10896 10897 this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function (e, el) { 10898 _this._eventsHandler(id); 10899 }); 10900 10901 this.$element.on('mutateme.zf.trigger', function (e, el) { 10902 _this._eventsHandler(id); 10903 }); 10904 10905 if (this.$anchor) { 10906 this.$anchor.on('mutateme.zf.trigger', function (e, el) { 10907 _this._eventsHandler(id); 10908 }); 10909 } 10910 } 10911 10912 /** 10913 * Handler for events. 10914 * @private 10915 * @param {String} id - pseudo-random id for unique scroll event listener. 10916 */ 10917 10918 }, { 10919 key: '_eventsHandler', 10920 value: function _eventsHandler(id) { 10921 var _this = this, 10922 scrollListener = this.scrollListener = 'scroll.zf.' + id; 10923 10924 _this._setSizes(function () { 10925 _this._calc(false); 10926 if (_this.canStick) { 10927 if (!_this.isOn) { 10928 _this._events(id); 10929 } 10930 } else if (_this.isOn) { 10931 _this._pauseListeners(scrollListener); 10932 } 10933 }); 10934 } 10935 10936 /** 10937 * Removes event handlers for scroll and change events on anchor. 10938 * @fires Sticky#pause 10939 * @param {String} scrollListener - unique, namespaced scroll listener attached to `window` 10940 */ 10941 10942 }, { 10943 key: '_pauseListeners', 10944 value: function _pauseListeners(scrollListener) { 10945 this.isOn = false;
10946 (0, _jquery2.default)(window).off(scrollListener); 10947 10948 /** 10949 * Fires when the plugin is paused due to resize event shrinking the view. 10950 * @event Sticky#pause 10951 * @private 10952 */ 10953 this.$element.trigger('pause.zf.sticky'); 10954 } 10955 10956 /** 10957 * Called on every `scroll` event and on `_init` 10958 * fires functions based on booleans and cached values 10959 * @param {Boolean} checkSizes - true if plugin should recalculate sizes and breakpoints. 10960 * @param {Number} scroll - current scroll position passed from scroll event cb function. If not passed, defaults to `window.pageYOffset`. 10961 */ 10962 10963 }, { 10964 key: '_calc', 10965 value: function _calc(checkSizes, scroll) { 10966 if (checkSizes) { 10967 this._setSizes(); 10968 } 10969 10970 if (!this.canStick) { 10971 if (this.isStuck) { 10972 this._removeSticky(true); 10973 } 10974 return false; 10975 } 10976 10977 if (!scroll) { 10978 scroll = window.pageYOffset; 10979 } 10980 10981 if (scroll >= this.topPoint) { 10982 if (scroll <= this.bottomPoint) { 10983 if (!this.isStuck) { 10984 this._setSticky(); 10985 } 10986 } else { 10987 if (this.isStuck) { 10988 this._removeSticky(false); 10989 } 10990 } 10991 } else { 10992 if (this.isStuck) { 10993 this._removeSticky(true); 10994 } 10995 } 10996 } 10997 10998 /** 10999 * Causes the $element to become stuck. 11000 * Adds `position: fixed;`, and helper classes. 11001 * @fires Sticky#stuckto 11002 * @function 11003 * @private 11004 */ 11005 11006 }, { 11007 key: '_setSticky', 11008 value: function _setSticky() { 11009 var _this = this, 11010 stickTo = this.options.stickTo, 11011 mrgn = stickTo === 'top' ? 'marginTop' : 'marginBottom', 11012 notStuckTo = stickTo === 'top' ? 'bottom' : 'top', 11013 css = {}; 11014 11015 css[mrgn] = this.options[mrgn] + 'em'; 11016 css[stickTo] = 0; 11017 css[notStuckTo] = 'auto'; 11018 this.isStuck = true; 11019 this.$element.removeClass('is-anchored is-at-' + notStuckTo).addClass('is-stuck is-at-' + stickTo).css(css) 11020 /** 11021 * Fires when the $element has become `position: fixed;` 11022 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.stuckto:top` 11023 * @event Sticky#stuckto 11024 */ 11025 .trigger('sticky.zf.stuckto:' + stickTo); 11026 this.$element.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function () { 11027 _this._setSizes(); 11028 }); 11029 } 11030 11031 /** 11032 * Causes the $element to become unstuck. 11033 * Removes `position: fixed;`, and helper classes. 11034 * Adds other helper classes. 11035 * @param {Boolean} isTop - tells the function if the $element should anchor to the top or bottom of its $anchor element. 11036 * @fires Sticky#unstuckfrom 11037 * @private 11038 */ 11039 11040 }, { 11041 key: '_removeSticky', 11042 value: function _removeSticky(isTop) { 11043 var stickTo = this.options.stickTo, 11044 stickToTop = stickTo === 'top', 11045 css = {}, 11046 anchorPt = (this.points ? this.points[1] - this.points[0] : this.anchorHeight) - this.elemHeight, 11047 mrgn = stickToTop ? 'marginTop' : 'marginBottom', 11048 notStuckTo = stickToTop ? 'bottom' : 'top', 11049 topOrBottom = isTop ? 'top' : 'bottom'; 11050 11051 css[mrgn] = 0; 11052 11053 css['bottom'] = 'auto'; 11054 if (isTop) { 11055 css['top'] = 0; 11056 } else { 11057 css['top'] = anchorPt; 11058 } 11059 11060 this.isStuck = false; 11061 this.$element.removeClass('is-stuck is-at-' + stickTo).addClass('is-anchored is-at-' + topOrBottom).css(css) 11062 /** 11063 * Fires when the $element has become anchored. 11064 * Namespaced to `top` or `bottom`, e.g. `sticky.zf.unstuckfrom:bottom` 11065 * @event Sticky#unstuckfrom 11066 */ 11067 .trigger('sticky.zf.unstuckfrom:' + topOrBottom); 11068 } 11069 11070 /** 11071 * Sets the $element and $container sizes for plugin. 11072 * Calls `_setBreakPoints`. 11073 * @param {Function} cb - optional callback function to fire on completion of `_setBreakPoints`. 11074 * @private 11075 */ 11076 11077 }, { 11078 key: '_setSizes', 11079 value: function _setSizes(cb) { 11080 this.canStick = _foundationUtil2.MediaQuery.is(this.options.stickyOn); 11081 if (!this.canStick) { 11082 if (cb && typeof cb === 'function') { 11083 cb(); 11084 } 11085 } 11086 var _this = this, 11087 newElemWidth = this.$container[0].getBoundingClientRect().width, 11088 comp = window.getComputedStyle(this.$container[0]), 11089 pdngl = parseInt(comp['padding-left'], 10), 11090 pdngr = parseInt(comp['padding-right'], 10); 11091 11092 if (this.$anchor && this.$anchor.length) { 11093 this.anchorHeight = this.$anchor[0].getBoundingClientRect().height; 11094 } else { 11095 this._parsePoints(); 11096 } 11097 11098 this.$element.css({ 11099 'max-width': newElemWidth - pdngl - pdngr + 'px' 11100 }); 11101 11102 var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight; 11103 if (this.$element.css("display") == "none") { 11104 newContainerHeight = 0; 11105 } 11106 this.containerHeight = newContainerHeight; 11107 this.$container.css({ 11108 height: newContainerHeight 11109 }); 11110 this.elemHeight = newContainerHeight; 11111 11112 if (!this.isStuck) { 11113 if (this.$element.hasClass('is-at-bottom')) { 11114 var anchorPt = (this.points ? this.points[1] - this.$container.offset().top : this.anchorHeight) - this.elemHeight;
11115 this.$element.css('top', anchorPt); 11116 } 11117 } 11118 11119 this._setBreakPoints(newContainerHeight, function () { 11120 if (cb && typeof cb === 'function') { 11121 cb(); 11122 } 11123 }); 11124 } 11125 11126 /** 11127 * Sets the upper and lower breakpoints for the element to become sticky/unsticky. 11128 * @param {Number} elemHeight - px value for sticky.$element height, calculated by `_setSizes`. 11129 * @param {Function} cb - optional callback function to be called on completion. 11130 * @private 11131 */ 11132 11133 }, { 11134 key: '_setBreakPoints', 11135 value: function _setBreakPoints(elemHeight, cb) { 11136 if (!this.canStick) { 11137 if (cb && typeof cb === 'function') { 11138 cb(); 11139 } else { 11140 return false; 11141 } 11142 } 11143 var mTop = emCalc(this.options.marginTop), 11144 mBtm = emCalc(this.options.marginBottom), 11145 topPoint = this.points ? this.points[0] : this.$anchor.offset().top, 11146 bottomPoint = this.points ? this.points[1] : topPoint + this.anchorHeight, 11147 11148 // topPoint = this.$anchor.offset().top || this.points[0], 11149 // bottomPoint = topPoint + this.anchorHeight || this.points[1], 11150 winHeight = window.innerHeight; 11151 11152 if (this.options.stickTo === 'top') { 11153 topPoint -= mTop; 11154 bottomPoint -= elemHeight + mTop; 11155 } else if (this.options.stickTo === 'bottom') { 11156 topPoint -= winHeight - (elemHeight + mBtm); 11157 bottomPoint -= winHeight - mBtm; 11158 } else { 11159 //this would be the stickTo: both option... tricky 11160 } 11161 11162 this.topPoint = topPoint; 11163 this.bottomPoint = bottomPoint; 11164 11165 if (cb && typeof cb === 'function') { 11166 cb(); 11167 } 11168 } 11169 11170 /** 11171 * Destroys the current sticky element. 11172 * Resets the element to the top position first. 11173 * Removes event listeners, JS-added css properties and classes, and unwraps the $element if the JS added the $container. 11174 * @function 11175 */ 11176 11177 }, { 11178 key: '_destroy', 11179 value: function _destroy() { 11180 this._removeSticky(true); 11181 11182 this.$element.removeClass(this.options.stickyClass + ' is-anchored is-at-top').css({ 11183 height: '', 11184 top: '', 11185 bottom: '', 11186 'max-width': '' 11187 }).off('resizeme.zf.trigger').off('mutateme.zf.trigger'); 11188 if (this.$anchor && this.$anchor.length) { 11189 this.$anchor.off('change.zf.sticky'); 11190 } 11191 (0, _jquery2.default)(window).off(this.scrollListener); 11192 11193 if (this.wasWrapped) { 11194 this.$element.unwrap(); 11195 } else { 11196 this.$container.removeClass(this.options.containerClass).css({ 11197 height: '' 11198 }); 11199 } 11200 } 11201 }]); 11202 11203 return Sticky; 11204}(_foundation.Plugin); 11205 11206Sticky.defaults = { 11207 /** 11208 * Customizable container template. Add your own classes for styling and sizing. 11209 * @option 11210 * @type {string} 11211 * @default '<div data-sticky-container></div>' 11212 */ 11213 container: '<div data-sticky-container></div>', 11214 /** 11215 * Location in the view the element sticks to. Can be `'top'` or `'bottom'`. 11216 * @option 11217 * @type {string} 11218 * @default 'top' 11219 */ 11220 stickTo: 'top', 11221 /** 11222 * If anchored to a single element, the id of that element. 11223 * @option 11224 * @type {string} 11225 * @default '' 11226 */ 11227 anchor: '', 11228 /** 11229 * If using more than one element as anchor points, the id of the top anchor. 11230 * @option 11231 * @type {string} 11232 * @default '' 11233 */ 11234 topAnchor: '', 11235 /** 11236 * If using more than one element as anchor points, the id of the bottom anchor. 11237 * @option 11238 * @type {string} 11239 * @default '' 11240 */ 11241 btmAnchor: '', 11242 /** 11243 * Margin, in `em`'s to apply to the top of the element when it becomes sticky. 11244 * @option 11245 * @type {number} 11246 * @default 1 11247 */ 11248 marginTop: 1, 11249 /** 11250 * Margin, in `em`'s to apply to the bottom of the element when it becomes sticky. 11251 * @option 11252 * @type {number} 11253 * @default 1 11254 */ 11255 marginBottom: 1, 11256 /** 11257 * Breakpoint string that is the minimum screen size an element should become sticky. 11258 * @option 11259 * @type {string} 11260 * @default 'medium' 11261 */ 11262 stickyOn: 'medium', 11263 /** 11264 * Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`. 11265 * @option 11266 * @type {string} 11267 * @default 'sticky' 11268 */ 11269 stickyClass: 'sticky', 11270 /** 11271 * Class applied to sticky container. Foundation defaults to `sticky-container`. 11272 * @option 11273 * @type {string} 11274 * @default 'sticky-container' 11275 */ 11276 containerClass: 'sticky-container', 11277 /** 11278 * 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. 11279 * @option 11280 * @type {number} 11281 * @default -1 11282 */ 11283 checkEvery: -1 11284}; 11285 11286/** 11287 * Helper function to calculate em values 11288 * @param Number {em} - number of em's to calculate into pixels 11289 */ 11290function emCalc(em) { 11291 return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em; 11292} 11293 11294exports.Sticky = Sticky; 11295 11296/***/ }), 11297/* 35 */ 11298/***/ (function(module, exports, __webpack_require__) { 11299 11300"use strict"; 11301 11302 11303Object.defineProperty(exports, "__esModule", { 11304 value: true 11305}); 11306exports.Toggler = undefined; 11307 11308var _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; }; }(); 11309 11310var _jquery = __webpack_require__(0); 11311 11312var _jquery2 = _interopRequireDefault(_jquery); 11313 11314var _foundationUtil = __webpack_require__(6); 11315 11316var _foundation = __webpack_require__(2); 11317 11318var _foundationUtil2 = __webpack_require__(5); 11319 11320function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11321 11322function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11323 11324function _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; } 11325 11326function _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
11326onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 11327 11328/** 11329 * Toggler module. 11330 * @module foundation.toggler 11331 * @requires foundation.util.motion 11332 * @requires foundation.util.triggers 11333 */ 11334 11335var Toggler = function (_Plugin) { 11336 _inherits(Toggler, _Plugin); 11337 11338 function Toggler() { 11339 _classCallCheck(this, Toggler); 11340 11341 return _possibleConstructorReturn(this, (Toggler.__proto__ || Object.getPrototypeOf(Toggler)).apply(this, arguments)); 11342 } 11343 11344 _createClass(Toggler, [{ 11345 key: '_setup', 11346 11347 /** 11348 * Creates a new instance of Toggler. 11349 * @class 11350 * @name Toggler 11351 * @fires Toggler#init 11352 * @param {Object} element - jQuery object to add the trigger to. 11353 * @param {Object} options - Overrides to the default plugin settings. 11354 */ 11355 value: function _setup(element, options) { 11356 this.$element = element; 11357 this.options = _jquery2.default.extend({}, Toggler.defaults, element.data(), options); 11358 this.className = ''; 11359 this.className = 'Toggler'; // ie9 back compat 11360 11361 // Triggers init is idempotent, just need to make sure it is initialized 11362 _foundationUtil2.Triggers.init(_jquery2.default); 11363 11364 this._init(); 11365 this._events(); 11366 } 11367 11368 /** 11369 * Initializes the Toggler plugin by parsing the toggle class from data-toggler, or animation classes from data-animate. 11370 * @function 11371 * @private 11372 */ 11373 11374 }, { 11375 key: '_init', 11376 value: function _init() { 11377 var input; 11378 // Parse animation classes if they were set 11379 if (this.options.animate) { 11380 input = this.options.animate.split(' '); 11381 11382 this.animationIn = input[0]; 11383 this.animationOut = input[1] || null; 11384 } 11385 // Otherwise, parse toggle class 11386 else { 11387 input = this.$element.data('toggler'); 11388 // Allow for a . at the beginning of the string 11389 this.className = input[0] === '.' ? input.slice(1) : input; 11390 } 11391 11392 // Add ARIA attributes to triggers 11393 var id = this.$element[0].id; 11394 (0, _jquery2.default)('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-controls', id); 11395 // If the target is hidden, add aria-hidden 11396 this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true); 11397 } 11398 11399 /** 11400 * Initializes events for the toggle trigger. 11401 * @function 11402 * @private 11403 */ 11404 11405 }, { 11406 key: '_events', 11407 value: function _events() { 11408 this.$element.off('toggle.zf.trigger').on('toggle.zf.trigger', this.toggle.bind(this)); 11409 } 11410 11411 /** 11412 * 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". 11413 * @function 11414 * @fires Toggler#on 11415 * @fires Toggler#off 11416 */ 11417 11418 }, { 11419 key: 'toggle', 11420 value: function toggle() { 11421 this[this.options.animate ? '_toggleAnimate' : '_toggleClass'](); 11422 } 11423 }, { 11424 key: '_toggleClass', 11425 value: function _toggleClass() { 11426 this.$element.toggleClass(this.className); 11427 11428 var isOn = this.$element.hasClass(this.className); 11429 if (isOn) { 11430 /** 11431 * Fires if the target element has the class after a toggle. 11432 * @event Toggler#on 11433 */ 11434 this.$element.trigger('on.zf.toggler'); 11435 } else { 11436 /** 11437 * Fires if the target element does not have the class after a toggle. 11438 * @event Toggler#off 11439 */ 11440 this.$element.trigger('off.zf.toggler'); 11441 } 11442 11443 this._updateARIA(isOn); 11444 this.$element.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11445 } 11446 }, { 11447 key: '_toggleAnimate', 11448 value: function _toggleAnimate() { 11449 var _this = this; 11450 11451 if (this.$element.is(':hidden')) { 11452 _foundationUtil.Motion.animateIn(this.$element, this.animationIn, function () { 11453 _this._updateARIA(true); 11454 this.trigger('on.zf.toggler'); 11455 this.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11456 }); 11457 } else { 11458 _foundationUtil.Motion.animateOut(this.$element, this.animationOut, function () { 11459 _this._updateARIA(false); 11460 this.trigger('off.zf.toggler'); 11461 this.find('[data-mutate]').trigger('mutateme.zf.trigger'); 11462 }); 11463 } 11464 } 11465 }, { 11466 key: '_updateARIA', 11467 value: function _updateARIA(isOn) { 11468 this.$element.attr('aria-expanded', isOn ? true : false); 11469 } 11470 11471 /** 11472 * Destroys the instance of Toggler on the element. 11473 * @function 11474 */ 11475 11476 }, { 11477 key: '_destroy', 11478 value: function _destroy() { 11479 this.$element.off('.zf.toggler'); 11480 } 11481 }]); 11482 11483 return Toggler; 11484}
vendor: 4,100 bytes, lines 11484-11577
11484(_foundation.Plugin); 11485 11486Toggler.defaults = { 11487 /** 11488 * Tells the plugin if the element should animated when toggled. 11489 * @option 11490 * @type {boolean} 11491 * @default false 11492 */ 11493 animate: false 11494}; 11495 11496exports.Toggler = Toggler; 11497 11498/***/ }), 11499/* 36 */ 11500/***/ (function(module, exports, __webpack_require__) { 11501 11502"use strict"; 11503 11504 11505Object.defineProperty(exports, "__esModule", { 11506 value: true 11507}); 11508exports.Tooltip = undefined; 11509 11510var _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; }; }(); 11511 11512var _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); } }; 11513 11514var _jquery = __webpack_require__(0); 11515 11516var _jquery2 = _interopRequireDefault(_jquery); 11517 11518var _foundationUtil = __webpack_require__(1); 11519 11520var _foundationUtil2 = __webpack_require__(4); 11521 11522var _foundationUtil3 = __webpack_require__(5); 11523 11524var _foundation = __webpack_require__(15); 11525 11526function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11527 11528function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11529 11530function _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; } 11531 11532function _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; } 11533 11534/** 11535 * Tooltip module. 11536 * @module foundation.tooltip 11537 * @requires foundation.util.box 11538 * @requires foundation.util.mediaQuery 11539 * @requires foundation.util.triggers 11540 */ 11541 11542var Tooltip = function (_Positionable) { 11543 _inherits(Tooltip, _Positionable); 11544 11545 function Tooltip() { 11546 _classCallCheck(this, Tooltip); 11547 11548 return _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).apply(this, arguments)); 11549 } 11550 11551 _createClass(Tooltip, [{ 11552 key: '_setup', 11553 11554 /** 11555 * Creates a new instance of a Tooltip. 11556 * @class 11557 * @name Tooltip 11558 * @fires Tooltip#init 11559 * @param {jQuery} element - jQuery object to attach a tooltip to. 11560 * @param {Object} options - object to extend the default configuration. 11561 */ 11562 value: function _setup(element, options) { 11563 this.$element = element; 11564 this.options = _jquery2.default.extend({}, Tooltip.defaults, this.$element.data(), options); 11565 this.className = 'Tooltip'; // ie9 back compat 11566 11567 this.isActive = false; 11568 this.isClick = false; 11569 11570 // Triggers init is idempotent, just need to make sure it is initialized 11571 _foundationUtil3.Triggers.init(_jquery2.default); 11572 11573 this._init(); 11574 } 11575 11576 /** 11577 * Initializes the tooltip by setting the creating the tip element, adding it's text, setting private variables and setting attributes on the anch
11577or. 11578 * @private 11579 */ 11580 11581 }, { 11582 key: '_init', 11583 value: function _init() { 11584 _foundationUtil2.MediaQuery._init(); 11585 var elemId = this.$element.attr('aria-describedby') || (0, _foundationUtil.GetYoDigits)(6, 'tooltip'); 11586 11587 this.options.tipText = this.options.tipText || this.$element.attr('title'); 11588 this.template = this.options.template ? (0, _jquery2.default)(this.options.template) : this._buildTemplate(elemId); 11589 11590 if (this.options.allowHtml) { 11591 this.template.appendTo(document.body).html(this.options.tipText).hide(); 11592 } else { 11593 this.template.appendTo(document.body).text(this.options.tipText).hide(); 11594 } 11595 11596 this.$element.attr({ 11597 'title': '', 11598 'aria-describedby': elemId, 11599 'data-yeti-box': elemId, 11600 'data-toggle': elemId, 11601 'data-resize': elemId 11602 }).addClass(this.options.triggerClass); 11603 11604 _get(Tooltip.prototype.__proto__ || Object.getPrototypeOf(Tooltip.prototype), '_init', this).call(this); 11605 this._events(); 11606 } 11607 }, { 11608 key: '_getDefaultPosition', 11609 value: function _getDefaultPosition() { 11610 // handle legacy classnames 11611 var position = this.$element[0].className.match(/\b(top|left|right|bottom)\b/g); 11612 return position ? position[0] : 'top'; 11613 } 11614 }, { 11615 key: '_getDefaultAlignment', 11616 value: function _getDefaultAlignment() { 11617 return 'center'; 11618 } 11619 }, { 11620 key: '_getHOffset', 11621 value: function _getHOffset() { 11622 if (this.position === 'left' || this.position === 'right') { 11623 return this.options.hOffset + this.options.tooltipWidth; 11624 } else { 11625 return this.options.hOffset; 11626 } 11627 } 11628 }, { 11629 key: '_getVOffset', 11630 value: function _getVOffset() { 11631 if (this.position === 'top' || this.position === 'bottom') { 11632 return this.options.vOffset + this.options.tooltipHeight; 11633 } else { 11634 return this.options.vOffset; 11635 } 11636 } 11637 11638 /** 11639 * builds the tooltip element, adds attributes, and returns the template. 11640 * @private 11641 */ 11642 11643 }, { 11644 key: '_buildTemplate', 11645 value: function _buildTemplate(id) { 11646 var templateClasses = (this.options.tooltipClass + ' ' + this.options.positionClass + ' ' + this.options.templateClasses).trim(); 11647 var $template = (0, _jquery2.default)('<div></div>').addClass(templateClasses).attr({ 11648 'role': 'tooltip', 11649 'aria-hidden': true, 11650 'data-is-active': false, 11651 'data-is-focus': false, 11652 'id': id 11653 }); 11654 return $template; 11655 } 11656 11657 /** 11658 * 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. 11659 * if the tooltip is larger than the screen width, default to full width - any user selected margin 11660 * @private 11661 */ 11662 11663 }, { 11664 key: '_setPosition', 11665 value: function _setPosition() { 11666 _get(Tooltip.prototype.__proto__ || Object.getPrototypeOf(Tooltip.prototype), '_setPosition', this).call(this, this.$element, this.template); 11667 } 11668 11669 /** 11670 * reveals the tooltip, and fires an event to close any other open tooltips on the page 11671 * @fires Tooltip#closeme 11672 * @fires Tooltip#show 11673 * @function 11674 */ 11675 11676 }, { 11677 key: 'show', 11678 value: function show() { 11679 if (this.options.showOn !== 'all' && !_foundationUtil2.MediaQuery.is(this.options.showOn)) { 11680 // console.error('The screen is too small to display this tooltip'); 11681 return false; 11682 } 11683 11684 var _this = this; 11685 this.template.css('visibility', 'hidden').show(); 11686 this._setPosition(); 11687 this.template.removeClass('top bottom left right').addClass(this.position); 11688 this.template.removeClass('align-top align-bottom align-left align-right align-center').addClass('align-' + this.alignment); 11689 11690 /** 11691 * Fires to close all other open tooltips on the page 11692 * @event Closeme#tooltip 11693 */ 11694 this.$element.trigger('closeme.zf.tooltip', this.template.attr('id')); 11695 11696 this.template.attr({ 11697 'data-is-active': true, 11698 'aria-hidden': false 11699 }); 11700 _this.isActive = true; 11701 // console.log(this.template); 11702 this.template.stop().hide().css('visibility', '').fadeIn(this.options.fadeInDuration, function () { 11703 //maybe do stuff? 11704 }); 11705 /** 11706 * Fires when the tooltip is shown 11707 * @event Tooltip#show 11708 */ 11709 this.$element.trigger('show.zf.tooltip'); 11710 } 11711 11712 /** 11713 * Hides the current tooltip, and resets the positioning class if it was changed due to collision 11714 * @fires Tooltip#hide 11715 * @function 11716 */ 11717 11718 }, { 11719 key: 'hide', 11720 value: function hide() { 11721 // console.log('hiding', this.$element.data('yeti-box')); 11722 var _this = this; 11723 this.template.stop().attr({ 11724 'aria-hidden': true, 11725 'data-is-active': false 11726 }).fadeOut(this.options.fadeOutDuration, function () { 11727 _this.isActive = false;
11728 _this.isClick = false; 11729 }); 11730 /** 11731 * fires when the tooltip is hidden 11732 * @event Tooltip#hide 11733 */ 11734 this.$element.trigger('hide.zf.tooltip'); 11735 } 11736 11737 /** 11738 * adds event listeners for the tooltip and its anchor 11739 * TODO combine some of the listeners like focus and mouseenter, etc. 11740 * @private 11741 */ 11742 11743 }, { 11744 key: '_events', 11745 value: function _events() { 11746 var _this = this; 11747 var $template = this.template; 11748 var isFocus = false; 11749 11750 if (!this.options.disableHover) { 11751 11752 this.$element.on('mouseenter.zf.tooltip', function (e) { 11753 if (!_this.isActive) { 11754 _this.timeout = setTimeout(function () { 11755 _this.show(); 11756 }, _this.options.hoverDelay); 11757 } 11758 }).on('mouseleave.zf.tooltip', function (e) { 11759 clearTimeout(_this.timeout); 11760 if (!isFocus || _this.isClick && !_this.options.clickOpen) { 11761 _this.hide(); 11762 } 11763 }); 11764 } 11765 11766 if (this.options.clickOpen) { 11767 this.$element.on('mousedown.zf.tooltip', function (e) { 11768 e.stopImmediatePropagation(); 11769 if (_this.isClick) { 11770 //_this.hide(); 11771 // _this.isClick = false; 11772 } else { 11773 _this.isClick = true; 11774 if ((_this.options.disableHover || !_this.$element.attr('tabindex')) && !_this.isActive) { 11775 _this.show(); 11776 } 11777 } 11778 }); 11779 } else { 11780 this.$element.on('mousedown.zf.tooltip', function (e) { 11781 e.stopImmediatePropagation(); 11782 _this.isClick = true; 11783 }); 11784 } 11785 11786 if (!this.options.disableForTouch) { 11787 this.$element.on('tap.zf.tooltip touchend.zf.tooltip', function (e) { 11788 _this.isActive ? _this.hide() : _this.show(); 11789 }); 11790 } 11791 11792 this.$element.on({ 11793 // 'toggle.zf.trigger': this.toggle.bind(this), 11794 // 'close.zf.trigger': this.hide.bind(this) 11795 'close.zf.trigger': this.hide.bind(this) 11796 }); 11797 11798 this.$element.on('focus.zf.tooltip', function (e) { 11799 isFocus = true; 11800 if (_this.isClick) { 11801 // If we're not showing open on clicks, we need to pretend a click-launched focus isn't 11802 // a real focus, otherwise on hover and come back we get bad behavior 11803 if (!_this.options.clickOpen) { 11804 isFocus = false; 11805 } 11806 return false; 11807 } else { 11808 _this.show(); 11809 } 11810 }).on('focusout.zf.tooltip', function (e) { 11811 isFocus = false; 11812 _this.isClick = false; 11813 _this.hide(); 11814 }).on('resizeme.zf.trigger', function () { 11815 if (_this.isActive) { 11816 _this._setPosition(); 11817 } 11818 }); 11819 } 11820 11821 /** 11822 * adds a toggle method, in addition to the static show() & hide() functions 11823 * @function 11824 */ 11825 11826 }, { 11827 key: 'toggle', 11828 value: function toggle() { 11829 if (this.isActive) { 11830 this.hide(); 11831 } else { 11832 this.show(); 11833 } 11834 } 11835 11836 /** 11837 * Destroys an instance of tooltip, removes template element from the view. 11838 * @function 11839 */ 11840 11841 }, { 11842 key: '_destroy', 11843 value: function _destroy() { 11844 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'); 11845 11846 this.template.remove(); 11847 } 11848 }]); 11849 11850 return Tooltip; 11851}(_foundation.Positionable); 11852 11853Tooltip.defaults = { 11854 disableForTouch: false, 11855 /** 11856 * Time, in ms, before a tooltip should open on hover. 11857 * @option 11858 * @type {number} 11859 * @default 200 11860 */ 11861 hoverDelay: 200, 11862 /** 11863 * Time, in ms, a tooltip should take to fade into view. 11864 * @option 11865 * @type {number} 11866 * @default 150 11867 */ 11868 fadeInDuration: 150, 11869 /** 11870 * Time, in ms, a tooltip should take to fade out of view. 11871 * @option 11872 * @type {number} 11873 * @default 150 11874 */ 11875 fadeOutDuration: 150, 11876 /** 11877 * Disables hover events from opening the tooltip if set to true 11878 * @option 11879 * @type {boolean} 11880 * @default false 11881 */ 11882 disableHover: false, 11883 /** 11884 * Optional addtional classes to apply to the tooltip template on init. 11885 * @option 11886 * @type {string} 11887 * @default '' 11888 */ 11889 templateClasses: '', 11890 /** 11891 * Non-optional class added to tooltip templates. Foundation default is 'tooltip'. 11892 * @option 11893 * @type {string} 11894 * @default 'tooltip' 11895 */ 11896 tooltipClass: 'tooltip', 11897 /** 11898 * Class applied to the tooltip anchor element. 11899 * @option 11900 * @type {string} 11901 * @default 'has-tip' 11902 */ 11903 triggerClass: 'has-tip', 11904 /** 11905 * Minimum breakpoint size at which to open the tooltip. 11906 * @option 11907 * @type {string} 11908 * @default 'small' 11909 */ 11910 showOn: 'small', 11911 /** 11912 * Custom template to be used to generate markup for tooltip. 11913 * @option 11914 * @type {string} 11915 * @default '' 11916 */ 11917 template: '', 11918 /** 11919 * Text displayed in the tooltip template on open. 11920 * @option 11921 * @type {string} 11922 * @default '' 11923 */ 11924 tipText: '', 11925 touchCloseText: 'Tap to close.', 11926 /** 11927 * Allows the tooltip to remain open if triggered with a click or touch event. 11928 * @option 11929 * @type {boolean} 11930 * @default true 11931 */ 11932 clickOpen: true, 11933 /** 11934 * DEPRECATED Additional positioning classes, set by the JS 11935 * @option 11936 * @type {string} 11937 * @default '' 11938 */ 11939 positionClass: '', 11940 /** 11941 * Position of tooltip. Can be left, right, bottom, top, or auto. 11942 * @option 11943 * @type {string} 11944 * @default 'auto' 11945 */ 11946 position: 'auto', 11947 /** 11948 * Alignment of tooltip relative to anchor. Can be left, right, bottom, top, center, or auto. 11949 * @option 11950 * @type {string} 11951 * @default 'auto' 11952 */ 11953 alignment: 'auto', 11954 /** 11955 * Allow overlap of container/window. If false, tooltip will first try to 11956 * position as defined by data-position and data-alignment, but reposition if 11957 * it would cause an overflow. @option 11958 * @type {boolean} 11959 * @default false 11960 */ 11961 allowOverlap: false, 11962 /** 11963 * Allow overlap of only the bottom of the container. This is the most common 11964 * behavior for dropdowns, allowing the dropdown to extend the bottom of the 11965 * screen but not otherwise influence or break out of the container. 11966 * Less common for tooltips. 11967 * @option 11968 * @type {boolean} 11969 * @default false 11970 */ 11971 allowBottomOverlap: false, 11972 /** 11973 * Distance, in pixels, the template should push away from the anch
11973or on the Y axis. 11974 * @option 11975 * @type {number} 11976 * @default 0 11977 */ 11978 vOffset: 0, 11979 /** 11980 * Distance, in pixels, the template should push away from the anchor on the X axis 11981 * @option 11982 * @type {number} 11983 * @default 0 11984 */ 11985 hOffset: 0, 11986 /** 11987 * Distance, in pixels, the template spacing auto-adjust for a vertical tooltip 11988 * @option 11989 * @type {number} 11990 * @default 14 11991 */ 11992 tooltipHeight: 14, 11993 /** 11994 * Distance, in pixels, the template spacing auto-adjust for a horizontal tooltip 11995 * @option 11996 * @type {number} 11997 * @default 12 11998 */ 11999 tooltipWidth: 12, 12000 /** 12001 * Allow HTML in tooltip. Warning: If you are loading user-generated content into tooltips, 12002 * allowing HTML may open yourself up to XSS attacks. 12003 * @option 12004 * @type {boolean} 12005 * @default false 12006 */ 12007 allowHtml: false 12008}; 12009 12010/** 12011 * TODO utilize resize event trigger 12012 */ 12013 12014exports.Tooltip = Tooltip; 12015 12016/***/ }), 12017/* 37 */ 12018/***/ (function(module, exports, __webpack_require__) { 12019 12020"use strict"; 12021 12022 12023module.exports = function (module) { 12024 if (!module.webpackPolyfill) { 12025 module.deprecate = function () {}; 12026 module.paths = []; 12027 // module.parent = undefined by default 12028 if (!module.children) module.children = []; 12029 Object.defineProperty(module, "loaded", { 12030 enumerable: true, 12031 get: function get() { 12032 return module.l; 12033 } 12034 }); 12035 Object.defineProperty(module, "id", { 12036 enumerable: true, 12037 get: function get() { 12038 return module.i; 12039 } 12040 }); 12041 module.webpackPolyfill = 1; 12042 } 12043 return module; 12044}; 12045 12046/***/ }), 12047/* 38 */ 12048/***/ (function(module, exports, __webpack_require__) { 12049 12050"use strict"; 12051/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; 12052 12053var _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; }; 12054 12055/** 12056 * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). 12057 * @version v4.3.1 12058 * @link https://github.com/ten1seven/what-input 12059 * @license MIT 12060 */ 12061(function webpackUniversalModuleDefinition(root, factory) { 12062 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), 12063 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 12064 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 12065 __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(); 12066})(undefined, function () { 12067 return (/******/function (modules) { 12068 // webpackBootstrap 12069 /******/ // The module cache 12070 /******/var installedModules = {}; 12071 12072 /******/ // The require function 12073 /******/function __webpack_require__(moduleId) { 12074 12075 /******/ // Check if module is in cache 12076 /******/if (installedModules[moduleId]) 12077 /******/return installedModules[moduleId].exports; 12078 12079 /******/ // Create a new module (and put it into the cache) 12080 /******/var module = installedModules[moduleId] = { 12081 /******/exports: {}, 12082 /******/id: moduleId, 12083 /******/loaded: false 12084 /******/ }; 12085 12086 /******/ // Execute the module function 12087 /******/modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 12088 12089 /******/ // Flag the module as loaded 12090 /******/module.loaded = true; 12091 12092 /******/ // Return the exports of the module 12093 /******/return module.exports; 12094 /******/ 12095 } 12096 12097 /******/ // expose the modules object (__webpack_modules__) 12098 /******/__webpack_require__.m = modules; 12099 12100 /******/ // expose the module cache 12101 /******/__webpack_require__.c = installedModules; 12102 12103 /******/ // __webpack_public_path__ 12104 /******/__webpack_require__.p = ""; 12105 12106 /******/ // Load entry module and return exports 12107 /******/return __webpack_require__(0); 12108 /******/ 12109 }( 12110 /************************************************************************/ 12111 /******/[ 12112 /* 0 */
12113 /***/function (module, exports) { 12114 12115 'use strict'; 12116 12117 module.exports = function () { 12118 /* 12119 * variables 12120 */ 12121 12122 // last used input type 12123 var currentInput = 'initial'; 12124 12125 // last used input intent 12126 var currentIntent = null; 12127 12128 // cache document.documentElement 12129 var doc = document.documentElement; 12130 12131 // form input types 12132 var formInputs = ['input', 'select', 'textarea']; 12133 12134 var functionList = []; 12135 12136 // list of modifier keys commonly used with the mouse and 12137 // can be safely ignored to prevent false keyboard detection 12138 var ignoreMap = [16, // shift 12139 17, // control 12140 18, // alt 12141 91, // Windows key / left Apple cmd 12142 93 // Windows menu / right Apple cmd 12143 ]; 12144 12145 // list of keys for which we change intent even for form inputs 12146 var changeIntentMap = [9 // tab 12147 ]; 12148 12149 // mapping of events to input types 12150 var inputMap = { 12151 keydown: 'keyboard', 12152 keyup: 'keyboard', 12153 mousedown: 'mouse', 12154 mousemove: 'mouse', 12155 MSPointerDown: 'pointer', 12156 MSPointerMove: 'pointer', 12157 pointerdown: 'pointer', 12158 pointermove: 'pointer', 12159 touchstart: 'touch' 12160 }; 12161 12162 // array of all used input types 12163 var inputTypes = []; 12164 12165 // boolean: true if touch buffer is active 12166 var isBuffering = false; 12167 12168 // boolean: true if the page is being scrolled 12169 var isScrolling = false; 12170 12171 // store current mouse position 12172 var mousePos = { 12173 x: null, 12174 y: null 12175 }; 12176 12177 // map of IE 10 pointer events 12178 var pointerMap = { 12179 2: 'touch', 12180 3: 'touch', // treat pen like touch 12181 4: 'mouse' 12182 }; 12183 12184 var supportsPassive = false; 12185 12186 try { 12187 var opts = Object.defineProperty({}, 'passive', { 12188 get: function get() { 12189 supportsPassive = true; 12190 } 12191 }); 12192 12193 window.addEventListener('test', null, opts); 12194 } catch (e) {} 12195 12196 /* 12197 * set up 12198 */ 12199 12200 var setUp = function setUp() { 12201 // add correct mouse wheel event mapping to `inputMap` 12202 inputMap[detectWheel()] = 'mouse'; 12203 12204 addListeners(); 12205 setInput(); 12206 }; 12207 12208 /* 12209 * events 12210 */ 12211 12212 var addListeners = function addListeners() { 12213 // `pointermove`, `MSPointerMove`, `mousemove` and mouse wheel event binding 12214 // can only demonstrate potential, but not actual, interaction 12215 // and are treated separately 12216 var options = supportsPassive ? { passive: true } : false; 12217 12218 // pointer events (mouse, pen, touch) 12219 if (window.PointerEvent) { 12220 doc.addEventListener('pointerdown', updateInput); 12221 doc.addEventListener('pointermove', setIntent); 12222 } else if (window.MSPointerEvent) { 12223 doc.addEventListener('MSPointerDown', updateInput); 12224 doc.addEventListener('MSPointerMove', setIntent); 12225 } else { 12226 // mouse events 12227 doc.addEventListener('mousedown', updateInput); 12228 doc.addEventListener('mousemove', setIntent); 12229 12230 // touch events 12231 if ('ontouchstart' in window) { 12232 doc.addEventListener('touchstart', touchBuffer, options); 12233 doc.addEventListener('touchend', touchBuffer); 12234 } 12235 } 12236 12237 // mouse wheel 12238 doc.addEventListener(detectWheel(), setIntent, options); 12239 12240 // keyboard events 12241 doc.addEventListener('keydown', updateInput); 12242 doc.addEventListener('keyup', updateInput); 12243 }; 12244 12245 // checks conditions before updating new input 12246 var updateInput = function updateInput(event) { 12247 // only execute if the touch buffer timer isn't running 12248 if (!isBuffering) { 12249 var eventKey = event.which; 12250 var value = inputMap[event.type]; 12251 if (value === 'pointer') value = pointerType(event); 12252 12253 if (currentInput !== value || currentIntent !== value) { 12254 var activeElem = document.activeElement; 12255 var activeInput = false; 12256 var notFormInput = activeElem && activeElem.nodeName && formInputs.indexOf(activeElem.nodeName.toLowerCase()) === -1; 12257 12258 if (notFormInput || changeIntentMap.indexOf(eventKey) !== -1) { 12259 activeInput = true; 12260 } 12261 12262 if (value === 'touch' || 12263 // ignore mouse modifier keys 12264 value === 'mouse' || 12265 // don't switch if the current element is a form input 12266 value === 'keyboard' && eventKey && activeInput && ignoreMap.indexOf(eventKey) === -1) { 12267 // set the current and catch-all variable 12268 currentInput = currentIntent = value; 12269 12270 setInput(); 12271 } 12272 } 12273 } 12274 }; 12275
12276 // updates the doc and `inputTypes` array with new input 12277 var setInput = function setInput() { 12278 doc.setAttribute('data-whatinput', currentInput); 12279 doc.setAttribute('data-whatintent', currentInput); 12280 12281 if (inputTypes.indexOf(currentInput) === -1) { 12282 inputTypes.push(currentInput); 12283 doc.className += ' whatinput-types-' + currentInput; 12284 } 12285 12286 fireFunctions('input'); 12287 }; 12288 12289 // updates input intent for `mousemove` and `pointermove` 12290 var setIntent = function setIntent(event) { 12291 // test to see if `mousemove` happened relative to the screen 12292 // to detect scrolling versus mousemove 12293 if (mousePos['x'] !== event.screenX || mousePos['y'] !== event.screenY) { 12294 isScrolling = false; 12295 12296 mousePos['x'] = event.screenX; 12297 mousePos['y'] = event.screenY; 12298 } else { 12299 isScrolling = true; 12300 } 12301 12302 // only execute if the touch buffer timer isn't running 12303 // or scrolling isn't happening 12304 if (!isBuffering && !isScrolling) { 12305 var value = inputMap[event.type]; 12306 if (value === 'pointer') value = pointerType(event); 12307 12308 if (currentIntent !== value) { 12309 currentIntent = value; 12310 12311 doc.setAttribute('data-whatintent', currentIntent); 12312 12313 fireFunctions('intent'); 12314 } 12315 } 12316 }; 12317 12318 // buffers touch events because they frequently also fire mouse events 12319 var touchBuffer = function touchBuffer(event) { 12320 if (event.type === 'touchstart') { 12321 isBuffering = false; 12322 12323 // set the current input 12324 updateInput(event); 12325 } else { 12326 isBuffering = true; 12327 } 12328 }; 12329 12330 var fireFunctions = function fireFunctions(type) { 12331 for (var i = 0, len = functionList.length; i < len; i++) { 12332 if (functionList[i].type === type) { 12333 functionList[i].fn.call(undefined, currentIntent); 12334 } 12335 } 12336 }; 12337 12338 /* 12339 * utilities 12340 */ 12341 12342 var pointerType = function pointerType(event) { 12343 if (typeof event.pointerType === 'number') { 12344 return pointerMap[event.pointerType]; 12345 } else { 12346 // treat pen like touch 12347 return event.pointerType === 'pen' ? 'touch' : event.pointerType; 12348 } 12349 }; 12350 12351 // detect version of mouse wheel event to use 12352 // via https://developer.mozilla.org/en-US/docs/Web/Events/wheel 12353 var detectWheel = function detectWheel() { 12354 var wheelType = void 0; 12355 12356 // Modern browsers support "wheel" 12357 if ('onwheel' in document.createElement('div')) { 12358 wheelType = 'wheel'; 12359 } else { 12360 // Webkit and IE support at least "mousewheel" 12361 // or assume that remaining browsers are older Firefox 12362 wheelType = document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll'; 12363 } 12364 12365 return wheelType; 12366 }; 12367 12368 var objPos = function objPos(match) { 12369 for (var i = 0, len = functionList.length; i < len; i++) { 12370 if (functionList[i].fn === match) { 12371 return i; 12372 } 12373 } 12374 }; 12375 12376 /* 12377 * init 12378 */ 12379 12380 // don't start script unless browser cuts the mustard 12381 // (also passes if polyfills are used) 12382 if ('addEventListener' in window && Array.prototype.indexOf) { 12383 setUp(); 12384 } 12385 12386 /* 12387 * api 12388 */ 12389 12390 return { 12391 // returns string: the current input type 12392 // opt: 'loose'|'strict' 12393 // 'strict' (default): returns the same value as the `data-whatinput` attribute 12394 // 'loose': includes `data-whatintent` value if it's more current than `data-whatinput` 12395 ask: function ask(opt) { 12396 return opt === 'loose' ? currentIntent : currentInput; 12397 }, 12398 12399 // returns array: all the detected input types 12400 types: function types() { 12401 return inputTypes; 12402 }, 12403 12404 // overwrites ignored keys with provided array 12405 ignoreKeys: function ignoreKeys(arr) { 12406 ignoreMap = arr; 12407 }, 12408 12409 // attach functions to input and intent "events" 12410 // funct: function to fire on change 12411 // eventType: 'input'|'intent' 12412 registerOnChange: function registerOnChange(fn, eventType) { 12413 functionList.push({ 12414 fn: fn, 12415 type: eventType || 'input' 12416 }); 12417 }, 12418 12419 unRegisterOnChange: function unRegisterOnChange(fn) { 12420 var position = objPos(fn); 12421 12422 if (position) { 12423 functionList.splice(position, 1); 12424 } 12425 } 12426 }; 12427 }(); 12428 12429 /***/ 12430 } 12431 /******/]) 12432 ); 12433}); 12434; 12435/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module))) 12436 12437/***/ }), 12438/* 39 */ 12439/***/ (function(module, exports, __webpack_require__) { 12440 12441"use strict"; 12442 12443 12444var _jquery = __webpack_require__(0); 12445 12446var _jquery2 = _interopRequireDefault(_jquery); 12447 12448function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12449 12450_jquery2.default.ajax({ 12451 dataType: 'jsonp', 12452 url: 'https://api.github.com/repos/olefredrik/foundationpress?callback=foundationpressGithub&access_token=ed6229228dbc763038dbf1e68d0d8a4a0935b38a', 12453 success: function success(response) { 12454 if (response && response.data.watchers) { 12455 var watchers = (Math.round(response.data.watchers / 100, 10) / 10).toFixed(1); 12456 (0, _jquery2.default)('#stargazers a').html(watchers + 'k stargazers'); 12457 } 12458 } 12459}); 12460 12461/***/ }), 12462/* 40 */ 12463/***/ (function(module, exports, __webpack_require__) { 12464 12465module.exports = __webpack_require__(19); 12466 12467 12468/***/ }) 12469/******/ ]);
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.