Subversion Repositories wimsdev

Rev

Rev 14197 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. (function webpackUniversalModuleDefinition(root, factory) {
  2.   if(typeof exports === 'object' && typeof module === 'object')
  3.     module.exports = factory(require("./foundation.core"), require("./foundation.util.box"), require("./foundation.util.keyboard"), require("./foundation.util.nest"), require("./foundation.util.touch"), require("jquery"));
  4.   else if(typeof define === 'function' && define.amd)
  5.     define(["./foundation.core", "./foundation.util.box", "./foundation.util.keyboard", "./foundation.util.nest", "./foundation.util.touch", "jquery"], factory);
  6.   else if(typeof exports === 'object')
  7.     exports["foundation.dropdownMenu"] = factory(require("./foundation.core"), require("./foundation.util.box"), require("./foundation.util.keyboard"), require("./foundation.util.nest"), require("./foundation.util.touch"), require("jquery"));
  8.   else
  9.     root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.dropdownMenu"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.box"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.keyboard"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.nest"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.touch"], root["jQuery"]);
  10. })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_box__, __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__, __WEBPACK_EXTERNAL_MODULE__foundation_util_nest__, __WEBPACK_EXTERNAL_MODULE__foundation_util_touch__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/   // The module cache
  13. /******/   var installedModules = {};
  14. /******/
  15. /******/   // The require function
  16. /******/   function __webpack_require__(moduleId) {
  17. /******/
  18. /******/     // Check if module is in cache
  19. /******/     if(installedModules[moduleId]) {
  20. /******/       return installedModules[moduleId].exports;
  21. /******/     }
  22. /******/     // Create a new module (and put it into the cache)
  23. /******/     var module = installedModules[moduleId] = {
  24. /******/       i: moduleId,
  25. /******/       l: false,
  26. /******/       exports: {}
  27. /******/     };
  28. /******/
  29. /******/     // Execute the module function
  30. /******/     modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/     // Flag the module as loaded
  33. /******/     module.l = true;
  34. /******/
  35. /******/     // Return the exports of the module
  36. /******/     return module.exports;
  37. /******/   }
  38. /******/
  39. /******/
  40. /******/   // expose the modules object (__webpack_modules__)
  41. /******/   __webpack_require__.m = modules;
  42. /******/
  43. /******/   // expose the module cache
  44. /******/   __webpack_require__.c = installedModules;
  45. /******/
  46. /******/   // define getter function for harmony exports
  47. /******/   __webpack_require__.d = function(exports, name, getter) {
  48. /******/     if(!__webpack_require__.o(exports, name)) {
  49. /******/       Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/     }
  51. /******/   };
  52. /******/
  53. /******/   // define __esModule on exports
  54. /******/   __webpack_require__.r = function(exports) {
  55. /******/     if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/       Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/     }
  58. /******/     Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/   };
  60. /******/
  61. /******/   // create a fake namespace object
  62. /******/   // mode & 1: value is a module id, require it
  63. /******/   // mode & 2: merge all properties of value into the ns
  64. /******/   // mode & 4: return value when already ns object
  65. /******/   // mode & 8|1: behave like require
  66. /******/   __webpack_require__.t = function(value, mode) {
  67. /******/     if(mode & 1) value = __webpack_require__(value);
  68. /******/     if(mode & 8) return value;
  69. /******/     if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/     var ns = Object.create(null);
  71. /******/     __webpack_require__.r(ns);
  72. /******/     Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/     if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/     return ns;
  75. /******/   };
  76. /******/
  77. /******/   // getDefaultExport function for compatibility with non-harmony modules
  78. /******/   __webpack_require__.n = function(module) {
  79. /******/     var getter = module && module.__esModule ?
  80. /******/       function getDefault() { return module['default']; } :
  81. /******/       function getModuleExports() { return module; };
  82. /******/     __webpack_require__.d(getter, 'a', getter);
  83. /******/     return getter;
  84. /******/   };
  85. /******/
  86. /******/   // Object.prototype.hasOwnProperty.call
  87. /******/   __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/   // __webpack_public_path__
  90. /******/   __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/   // Load entry module and return exports
  94. /******/   return __webpack_require__(__webpack_require__.s = 5);
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98.  
  99. /***/ "./foundation.core":
  100. /*!****************************************************************************************************************************************************************!*\
  101.   !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***!
  102.   \****************************************************************************************************************************************************************/
  103. /*! no static exports found */
  104. /***/ (function(module, exports) {
  105.  
  106. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
  107.  
  108. /***/ }),
  109.  
  110. /***/ "./foundation.util.box":
  111. /*!********************************************************************************************************************************************************************************!*\
  112.   !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.box"],"amd":"./foundation.util.box","commonjs":"./foundation.util.box","commonjs2":"./foundation.util.box"} ***!
  113.   \********************************************************************************************************************************************************************************/
  114. /*! no static exports found */
  115. /***/ (function(module, exports) {
  116.  
  117. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_box__;
  118.  
  119. /***/ }),
  120.  
  121. /***/ "./foundation.util.keyboard":
  122. /*!****************************************************************************************************************************************************************************************************!*\
  123.   !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.keyboard"],"amd":"./foundation.util.keyboard","commonjs":"./foundation.util.keyboard","commonjs2":"./foundation.util.keyboard"} ***!
  124.   \****************************************************************************************************************************************************************************************************/
  125. /*! no static exports found */
  126. /***/ (function(module, exports) {
  127.  
  128. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__;
  129.  
  130. /***/ }),
  131.  
  132. /***/ "./foundation.util.nest":
  133. /*!************************************************************************************************************************************************************************************!*\
  134.   !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.nest"],"amd":"./foundation.util.nest","commonjs":"./foundation.util.nest","commonjs2":"./foundation.util.nest"} ***!
  135.   \************************************************************************************************************************************************************************************/
  136. /*! no static exports found */
  137. /***/ (function(module, exports) {
  138.  
  139. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_nest__;
  140.  
  141. /***/ }),
  142.  
  143. /***/ "./foundation.util.touch":
  144. /*!****************************************************************************************************************************************************************************************!*\
  145.   !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.touch"],"amd":"./foundation.util.touch","commonjs":"./foundation.util.touch","commonjs2":"./foundation.util.touch"} ***!
  146.   \****************************************************************************************************************************************************************************************/
  147. /*! no static exports found */
  148. /***/ (function(module, exports) {
  149.  
  150. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_touch__;
  151.  
  152. /***/ }),
  153.  
  154. /***/ "./js/entries/plugins/foundation.dropdownMenu.js":
  155. /*!*******************************************************!*\
  156.   !*** ./js/entries/plugins/foundation.dropdownMenu.js ***!
  157.   \*******************************************************/
  158. /*! exports provided: Foundation, DropdownMenu */
  159. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  160.  
  161. "use strict";
  162. __webpack_require__.r(__webpack_exports__);
  163. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core");
  164. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
  165. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
  166.  
  167. /* harmony import */ var _foundation_dropdownMenu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.dropdownMenu */ "./js/foundation.dropdownMenu.js");
  168. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DropdownMenu", function() { return _foundation_dropdownMenu__WEBPACK_IMPORTED_MODULE_1__["DropdownMenu"]; });
  169.  
  170.  
  171.  
  172. _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_dropdownMenu__WEBPACK_IMPORTED_MODULE_1__["DropdownMenu"], 'DropdownMenu');
  173.  
  174.  
  175. /***/ }),
  176.  
  177. /***/ "./js/foundation.dropdownMenu.js":
  178. /*!***************************************!*\
  179.   !*** ./js/foundation.dropdownMenu.js ***!
  180.   \***************************************/
  181. /*! exports provided: DropdownMenu */
  182. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  183.  
  184. "use strict";
  185. __webpack_require__.r(__webpack_exports__);
  186. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DropdownMenu", function() { return DropdownMenu; });
  187. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  188. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  189. /* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.plugin */ "./foundation.core");
  190. /* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__);
  191. /* harmony import */ var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.keyboard */ "./foundation.util.keyboard");
  192. /* harmony import */ var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__);
  193. /* harmony import */ var _foundation_util_nest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation.util.nest */ "./foundation.util.nest");
  194. /* harmony import */ var _foundation_util_nest__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_nest__WEBPACK_IMPORTED_MODULE_3__);
  195. /* harmony import */ var _foundation_util_box__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./foundation.util.box */ "./foundation.util.box");
  196. /* harmony import */ var _foundation_util_box__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_box__WEBPACK_IMPORTED_MODULE_4__);
  197. /* harmony import */ var _foundation_util_touch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./foundation.util.touch */ "./foundation.util.touch");
  198. /* harmony import */ var _foundation_util_touch__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_touch__WEBPACK_IMPORTED_MODULE_5__);
  199.  
  200.  
  201. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  202.  
  203. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  204.  
  205. 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); } }
  206.  
  207. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  208.  
  209. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  210.  
  211. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  212.  
  213. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  214.  
  215. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  216.  
  217. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. /**
  227.  * DropdownMenu module.
  228.  * @module foundation.dropdownMenu
  229.  * @requires foundation.util.keyboard
  230.  * @requires foundation.util.box
  231.  * @requires foundation.util.nest
  232.  * @requires foundation.util.touch
  233.  */
  234.  
  235. var DropdownMenu =
  236. /*#__PURE__*/
  237. function (_Plugin) {
  238.   _inherits(DropdownMenu, _Plugin);
  239.  
  240.   function DropdownMenu() {
  241.     _classCallCheck(this, DropdownMenu);
  242.  
  243.     return _possibleConstructorReturn(this, _getPrototypeOf(DropdownMenu).apply(this, arguments));
  244.   }
  245.  
  246.   _createClass(DropdownMenu, [{
  247.     key: "_setup",
  248.  
  249.     /**
  250.      * Creates a new instance of DropdownMenu.
  251.      * @class
  252.      * @name DropdownMenu
  253.      * @fires DropdownMenu#init
  254.      * @param {jQuery} element - jQuery object to make into a dropdown menu.
  255.      * @param {Object} options - Overrides to the default plugin settings.
  256.      */
  257.     value: function _setup(element, options) {
  258.       this.$element = element;
  259.       this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, DropdownMenu.defaults, this.$element.data(), options);
  260.       this.className = 'DropdownMenu'; // ie9 back compat
  261.  
  262.       _foundation_util_touch__WEBPACK_IMPORTED_MODULE_5__["Touch"].init(jquery__WEBPACK_IMPORTED_MODULE_0___default.a); // Touch init is idempotent, we just need to make sure it's initialied.
  263.  
  264.       this._init();
  265.  
  266.       _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].register('DropdownMenu', {
  267.         'ENTER': 'open',
  268.         'SPACE': 'open',
  269.         'ARROW_RIGHT': 'next',
  270.         'ARROW_UP': 'up',
  271.         'ARROW_DOWN': 'down',
  272.         'ARROW_LEFT': 'previous',
  273.         'ESCAPE': 'close'
  274.       });
  275.     }
  276.     /**
  277.      * Initializes the plugin, and calls _prepareMenu
  278.      * @private
  279.      * @function
  280.      */
  281.  
  282.   }, {
  283.     key: "_init",
  284.     value: function _init() {
  285.       _foundation_util_nest__WEBPACK_IMPORTED_MODULE_3__["Nest"].Feather(this.$element, 'dropdown');
  286.       var subs = this.$element.find('li.is-dropdown-submenu-parent');
  287.       this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub');
  288.       this.$menuItems = this.$element.find('[role="menuitem"]');
  289.       this.$tabs = this.$element.children('[role="menuitem"]');
  290.       this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass);
  291.  
  292.       if (this.options.alignment === 'auto') {
  293.         if (this.$element.hasClass(this.options.rightClass) || Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["rtl"])() || this.$element.parents('.top-bar-right').is('*')) {
  294.           this.options.alignment = 'right';
  295.           subs.addClass('opens-left');
  296.         } else {
  297.           this.options.alignment = 'left';
  298.           subs.addClass('opens-right');
  299.         }
  300.       } else {
  301.         if (this.options.alignment === 'right') {
  302.           subs.addClass('opens-left');
  303.         } else {
  304.           subs.addClass('opens-right');
  305.         }
  306.       }
  307.  
  308.       this.changed = false;
  309.  
  310.       this._events();
  311.     }
  312.   }, {
  313.     key: "_isVertical",
  314.     value: function _isVertical() {
  315.       return this.$tabs.css('display') === 'block' || this.$element.css('flex-direction') === 'column';
  316.     }
  317.   }, {
  318.     key: "_isRtl",
  319.     value: function _isRtl() {
  320.       return this.$element.hasClass('align-right') || Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["rtl"])() && !this.$element.hasClass('align-left');
  321.     }
  322.     /**
  323.      * Adds event listeners to elements within the menu
  324.      * @private
  325.      * @function
  326.      */
  327.  
  328.   }, {
  329.     key: "_events",
  330.     value: function _events() {
  331.       var _this = this,
  332.           hasTouch = 'ontouchstart' in window || typeof window.ontouchstart !== 'undefined',
  333.           parClass = 'is-dropdown-submenu-parent'; // used for onClick and in the keyboard handlers
  334.  
  335.  
  336.       var handleClickFn = function handleClickFn(e) {
  337.         var $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(e.target).parentsUntil('ul', ".".concat(parClass)),
  338.             hasSub = $elem.hasClass(parClass),
  339.             hasClicked = $elem.attr('data-is-click') === 'true',
  340.             $sub = $elem.children('.is-dropdown-submenu');
  341.  
  342.         if (hasSub) {
  343.           if (hasClicked) {
  344.             if (!_this.options.closeOnClick || !_this.options.clickOpen && !hasTouch || _this.options.forceFollow && hasTouch) {
  345.               return;
  346.             }
  347.  
  348.             e.preventDefault();
  349.  
  350.             _this._hide($elem);
  351.           } else {
  352.             e.preventDefault();
  353.  
  354.             _this._show($sub);
  355.  
  356.             $elem.add($elem.parentsUntil(_this.$element, ".".concat(parClass))).attr('data-is-click', true);
  357.           }
  358.         }
  359.       };
  360.  
  361.       if (this.options.clickOpen || hasTouch) {
  362.         this.$menuItems.on('click.zf.dropdownMenu touchstart.zf.dropdownMenu', handleClickFn);
  363.       } // Handle Leaf element Clicks
  364.  
  365.  
  366.       if (_this.options.closeOnClickInside) {
  367.         this.$menuItems.on('click.zf.dropdownMenu', function (e) {
  368.           var $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
  369.               hasSub = $elem.hasClass(parClass);
  370.  
  371.           if (!hasSub) {
  372.             _this._hide();
  373.           }
  374.         });
  375.       }
  376.  
  377.       if (!this.options.disableHover) {
  378.         this.$menuItems.on('mouseenter.zf.dropdownMenu', function (e) {
  379.           var $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
  380.               hasSub = $elem.hasClass(parClass);
  381.  
  382.           if (hasSub) {
  383.             clearTimeout($elem.data('_delay'));
  384.             $elem.data('_delay', setTimeout(function () {
  385.               _this._show($elem.children('.is-dropdown-submenu'));
  386.             }, _this.options.hoverDelay));
  387.           }
  388.         }).on('mouseleave.zf.dropdownmenu', Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["ignoreMousedisappear"])(function (e) {
  389.           var $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
  390.               hasSub = $elem.hasClass(parClass);
  391.  
  392.           if (hasSub && _this.options.autoclose) {
  393.             if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) {
  394.               return false;
  395.             }
  396.  
  397.             clearTimeout($elem.data('_delay'));
  398.             $elem.data('_delay', setTimeout(function () {
  399.               _this._hide($elem);
  400.             }, _this.options.closingTime));
  401.           }
  402.         }));
  403.       }
  404.  
  405.       this.$menuItems.on('keydown.zf.dropdownMenu', function (e) {
  406.         var $element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(e.target).parentsUntil('ul', '[role="menuitem"]'),
  407.             isTab = _this.$tabs.index($element) > -1,
  408.             $elements = isTab ? _this.$tabs : $element.siblings('li').add($element),
  409.             $prevElement,
  410.             $nextElement;
  411.         $elements.each(function (i) {
  412.           if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).is($element)) {
  413.             $prevElement = $elements.eq(i - 1);
  414.             $nextElement = $elements.eq(i + 1);
  415.             return;
  416.           }
  417.         });
  418.  
  419.         var nextSibling = function nextSibling() {
  420.           $nextElement.children('a:first').focus();
  421.           e.preventDefault();
  422.         },
  423.             prevSibling = function prevSibling() {
  424.           $prevElement.children('a:first').focus();
  425.           e.preventDefault();
  426.         },
  427.             openSub = function openSub() {
  428.           var $sub = $element.children('ul.is-dropdown-submenu');
  429.  
  430.           if ($sub.length) {
  431.             _this._show($sub);
  432.  
  433.             $element.find('li > a:first').focus();
  434.             e.preventDefault();
  435.           } else {
  436.             return;
  437.           }
  438.         },
  439.             closeSub = function closeSub() {
  440.           //if ($element.is(':first-child')) {
  441.           var close = $element.parent('ul').parent('li');
  442.           close.children('a:first').focus();
  443.  
  444.           _this._hide(close);
  445.  
  446.           e.preventDefault(); //}
  447.         };
  448.  
  449.         var functions = {
  450.           open: openSub,
  451.           close: function close() {
  452.             _this._hide(_this.$element);
  453.  
  454.             _this.$menuItems.eq(0).children('a').focus(); // focus to first element
  455.  
  456.  
  457.             e.preventDefault();
  458.           }
  459.         };
  460.  
  461.         if (isTab) {
  462.           if (_this._isVertical()) {
  463.             // vertical menu
  464.             if (_this._isRtl()) {
  465.               // right aligned
  466.               jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend(functions, {
  467.                 down: nextSibling,
  468.                 up: prevSibling,
  469.                 next: closeSub,
  470.                 previous: openSub
  471.               });
  472.             } else {
  473.               // left aligned
  474.               jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend(functions, {
  475.                 down: nextSibling,
  476.                 up: prevSibling,
  477.                 next: openSub,
  478.                 previous: closeSub
  479.               });
  480.             }
  481.           } else {
  482.             // horizontal menu
  483.             if (_this._isRtl()) {
  484.               // right aligned
  485.               jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend(functions, {
  486.                 next: prevSibling,
  487.                 previous: nextSibling,
  488.                 down: openSub,
  489.                 up: closeSub
  490.               });
  491.             } else {
  492.               // left aligned
  493.               jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend(functions, {
  494.                 next: nextSibling,
  495.                 previous: prevSibling,
  496.                 down: openSub,
  497.                 up: closeSub
  498.               });
  499.             }
  500.           }
  501.         } else {
  502.           // not tabs -> one sub
  503.           if (_this._isRtl()) {
  504.             // right aligned
  505.             jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend(functions, {
  506.               next: closeSub,
  507.               previous: openSub,
  508.               down: nextSibling,
  509.               up: prevSibling
  510.             });
  511.           } else {
  512.             // left aligned
  513.             jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend(functions, {
  514.               next: openSub,
  515.               previous: closeSub,
  516.               down: nextSibling,
  517.               up: prevSibling
  518.             });
  519.           }
  520.         }
  521.  
  522.         _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].handleKey(e, 'DropdownMenu', functions);
  523.       });
  524.     }
  525.     /**
  526.      * Adds an event handler to the body to close any dropdowns on a click.
  527.      * @function
  528.      * @private
  529.      */
  530.  
  531.   }, {
  532.     key: "_addBodyHandler",
  533.     value: function _addBodyHandler() {
  534.       var _this2 = this;
  535.  
  536.       var $body = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body);
  537.  
  538.       this._removeBodyHandler();
  539.  
  540.       $body.on('click.zf.dropdownMenu tap.zf.dropdownMenu', function (e) {
  541.         var isItself = !!jquery__WEBPACK_IMPORTED_MODULE_0___default()(e.target).closest(_this2.$element).length;
  542.         if (isItself) return;
  543.  
  544.         _this2._hide();
  545.  
  546.         _this2._removeBodyHandler();
  547.       });
  548.     }
  549.     /**
  550.      * Remove the body event handler. See `_addBodyHandler`.
  551.      * @function
  552.      * @private
  553.      */
  554.  
  555.   }, {
  556.     key: "_removeBodyHandler",
  557.     value: function _removeBodyHandler() {
  558.       jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).off('click.zf.dropdownMenu tap.zf.dropdownMenu');
  559.     }
  560.     /**
  561.      * Opens a dropdown pane, and checks for collisions first.
  562.      * @param {jQuery} $sub - ul element that is a submenu to show
  563.      * @function
  564.      * @private
  565.      * @fires DropdownMenu#show
  566.      */
  567.  
  568.   }, {
  569.     key: "_show",
  570.     value: function _show($sub) {
  571.       var idx = this.$tabs.index(this.$tabs.filter(function (i, el) {
  572.         return jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).find($sub).length > 0;
  573.       }));
  574.       var $sibs = $sub.parent('li.is-dropdown-submenu-parent').siblings('li.is-dropdown-submenu-parent');
  575.  
  576.       this._hide($sibs, idx);
  577.  
  578.       $sub.css('visibility', 'hidden').addClass('js-dropdown-active').parent('li.is-dropdown-submenu-parent').addClass('is-active');
  579.       var clear = _foundation_util_box__WEBPACK_IMPORTED_MODULE_4__["Box"].ImNotTouchingYou($sub, null, true);
  580.  
  581.       if (!clear) {
  582.         var oldClass = this.options.alignment === 'left' ? '-right' : '-left',
  583.             $parentLi = $sub.parent('.is-dropdown-submenu-parent');
  584.         $parentLi.removeClass("opens".concat(oldClass)).addClass("opens-".concat(this.options.alignment));
  585.         clear = _foundation_util_box__WEBPACK_IMPORTED_MODULE_4__["Box"].ImNotTouchingYou($sub, null, true);
  586.  
  587.         if (!clear) {
  588.           $parentLi.removeClass("opens-".concat(this.options.alignment)).addClass('opens-inner');
  589.         }
  590.  
  591.         this.changed = true;
  592.       }
  593.  
  594.       $sub.css('visibility', '');
  595.  
  596.       if (this.options.closeOnClick) {
  597.         this._addBodyHandler();
  598.       }
  599.       /**
  600.        * Fires when the new dropdown pane is visible.
  601.        * @event DropdownMenu#show
  602.        */
  603.  
  604.  
  605.       this.$element.trigger('show.zf.dropdownMenu', [$sub]);
  606.     }
  607.     /**
  608.      * Hides a single, currently open dropdown pane, if passed a parameter, otherwise, hides everything.
  609.      * @function
  610.      * @param {jQuery} $elem - element with a submenu to hide
  611.      * @param {Number} idx - index of the $tabs collection to hide
  612.      * @fires DropdownMenu#hide
  613.      * @private
  614.      */
  615.  
  616.   }, {
  617.     key: "_hide",
  618.     value: function _hide($elem, idx) {
  619.       var $toClose;
  620.  
  621.       if ($elem && $elem.length) {
  622.         $toClose = $elem;
  623.       } else if (typeof idx !== 'undefined') {
  624.         $toClose = this.$tabs.not(function (i, el) {
  625.           return i === idx;
  626.         });
  627.       } else {
  628.         $toClose = this.$element;
  629.       }
  630.  
  631.       var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0;
  632.  
  633.       if (somethingToClose) {
  634.         var $activeItem = $toClose.find('li.is-active');
  635.         $activeItem.add($toClose).attr({
  636.           'data-is-click': false
  637.         }).removeClass('is-active');
  638.         $toClose.find('ul.js-dropdown-active').removeClass('js-dropdown-active');
  639.  
  640.         if (this.changed || $toClose.find('opens-inner').length) {
  641.           var oldClass = this.options.alignment === 'left' ? 'right' : 'left';
  642.           $toClose.find('li.is-dropdown-submenu-parent').add($toClose).removeClass("opens-inner opens-".concat(this.options.alignment)).addClass("opens-".concat(oldClass));
  643.           this.changed = false;
  644.         }
  645.  
  646.         clearTimeout($activeItem.data('_delay'));
  647.  
  648.         this._removeBodyHandler();
  649.         /**
  650.          * Fires when the open menus are closed.
  651.          * @event DropdownMenu#hide
  652.          */
  653.  
  654.  
  655.         this.$element.trigger('hide.zf.dropdownMenu', [$toClose]);
  656.       }
  657.     }
  658.     /**
  659.      * Destroys the plugin.
  660.      * @function
  661.      */
  662.  
  663.   }, {
  664.     key: "_destroy",
  665.     value: function _destroy() {
  666.       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');
  667.       jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).off('.zf.dropdownMenu');
  668.       _foundation_util_nest__WEBPACK_IMPORTED_MODULE_3__["Nest"].Burn(this.$element, 'dropdown');
  669.     }
  670.   }]);
  671.  
  672.   return DropdownMenu;
  673. }(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["Plugin"]);
  674. /**
  675.  * Default settings for plugin
  676.  */
  677.  
  678.  
  679. DropdownMenu.defaults = {
  680.   /**
  681.    * Disallows hover events from opening submenus
  682.    * @option
  683.    * @type {boolean}
  684.    * @default false
  685.    */
  686.   disableHover: false,
  687.  
  688.   /**
  689.    * Allow a submenu to automatically close on a mouseleave event, if not clicked open.
  690.    * @option
  691.    * @type {boolean}
  692.    * @default true
  693.    */
  694.   autoclose: true,
  695.  
  696.   /**
  697.    * Amount of time to delay opening a submenu on hover event.
  698.    * @option
  699.    * @type {number}
  700.    * @default 50
  701.    */
  702.   hoverDelay: 50,
  703.  
  704.   /**
  705.    * Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu.
  706.    * @option
  707.    * @type {boolean}
  708.    * @default false
  709.    */
  710.   clickOpen: false,
  711.  
  712.   /**
  713.    * Amount of time to delay closing a submenu on a mouseleave event.
  714.    * @option
  715.    * @type {number}
  716.    * @default 500
  717.    */
  718.   closingTime: 500,
  719.  
  720.   /**
  721.    * Position of the menu relative to what direction the submenus should open. Handled by JS. Can be `'auto'`, `'left'` or `'right'`.
  722.    * @option
  723.    * @type {string}
  724.    * @default 'auto'
  725.    */
  726.   alignment: 'auto',
  727.  
  728.   /**
  729.    * Allow clicks on the body to close any open submenus.
  730.    * @option
  731.    * @type {boolean}
  732.    * @default true
  733.    */
  734.   closeOnClick: true,
  735.  
  736.   /**
  737.    * Allow clicks on leaf anchor links to close any open submenus.
  738.    * @option
  739.    * @type {boolean}
  740.    * @default true
  741.    */
  742.   closeOnClickInside: true,
  743.  
  744.   /**
  745.    * Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class.
  746.    * @option
  747.    * @type {string}
  748.    * @default 'vertical'
  749.    */
  750.   verticalClass: 'vertical',
  751.  
  752.   /**
  753.    * Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class.
  754.    * @option
  755.    * @type {string}
  756.    * @default 'align-right'
  757.    */
  758.   rightClass: 'align-right',
  759.  
  760.   /**
  761.    * Boolean to force overide the clicking of links to perform default action, on second touch event for mobile.
  762.    * @option
  763.    * @type {boolean}
  764.    * @default true
  765.    */
  766.   forceFollow: true
  767. };
  768.  
  769.  
  770. /***/ }),
  771.  
  772. /***/ 5:
  773. /*!*************************************************************!*\
  774.   !*** multi ./js/entries/plugins/foundation.dropdownMenu.js ***!
  775.   \*************************************************************/
  776. /*! no static exports found */
  777. /***/ (function(module, exports, __webpack_require__) {
  778.  
  779. module.exports = __webpack_require__(/*! /Volumes/Data/Development/Foundation/foundation-sites/js/entries/plugins/foundation.dropdownMenu.js */"./js/entries/plugins/foundation.dropdownMenu.js");
  780.  
  781.  
  782. /***/ }),
  783.  
  784. /***/ "jquery":
  785. /*!********************************************************************************************!*\
  786.   !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
  787.   \********************************************************************************************/
  788. /*! no static exports found */
  789. /***/ (function(module, exports) {
  790.  
  791. module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
  792.  
  793. /***/ })
  794.  
  795. /******/ });
  796. });
  797. //# sourceMappingURL=foundation.dropdownMenu.js.map