123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("./foundation.core"), require("./foundation.util.keyboard"), require("./foundation.util.nest"), require("jquery"));
- else if(typeof define === 'function' && define.amd)
- define(["./foundation.core", "./foundation.util.keyboard", "./foundation.util.nest", "jquery"], factory);
- else if(typeof exports === 'object')
- exports["foundation.accordionMenu"] = factory(require("./foundation.core"), require("./foundation.util.keyboard"), require("./foundation.util.nest"), require("jquery"));
- else
- root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.accordionMenu"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.keyboard"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.nest"], root["jQuery"]);
- })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__, __WEBPACK_EXTERNAL_MODULE__foundation_util_nest__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
- return (function(modules) {
-
- var installedModules = {};
-
- function __webpack_require__(moduleId) {
-
- if(installedModules[moduleId]) {
- return installedModules[moduleId].exports;
- }
-
- var module = installedModules[moduleId] = {
- i: moduleId,
- l: false,
- exports: {}
- };
-
- modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-
- module.l = true;
-
- return module.exports;
- }
-
- __webpack_require__.m = modules;
-
- __webpack_require__.c = installedModules;
-
- __webpack_require__.d = function(exports, name, getter) {
- if(!__webpack_require__.o(exports, name)) {
- Object.defineProperty(exports, name, { enumerable: true, get: getter });
- }
- };
-
- __webpack_require__.r = function(exports) {
- if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- }
- Object.defineProperty(exports, '__esModule', { value: true });
- };
-
-
-
-
-
- __webpack_require__.t = function(value, mode) {
- if(mode & 1) value = __webpack_require__(value);
- if(mode & 8) return value;
- if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- var ns = Object.create(null);
- __webpack_require__.r(ns);
- Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- return ns;
- };
-
- __webpack_require__.n = function(module) {
- var getter = module && module.__esModule ?
- function getDefault() { return module['default']; } :
- function getModuleExports() { return module; };
- __webpack_require__.d(getter, 'a', getter);
- return getter;
- };
-
- __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-
- __webpack_require__.p = "";
-
- return __webpack_require__(__webpack_require__.s = 2);
- })
- ({
- "./foundation.core":
- (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
- }),
- "./foundation.util.keyboard":
- (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__;
- }),
- "./foundation.util.nest":
- (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_nest__;
- }),
- "./js/entries/plugins/foundation.accordionMenu.js":
- (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./foundation.core");
- var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
- __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
- var _foundation_accordionMenu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./js/foundation.accordionMenu.js");
- __webpack_require__.d(__webpack_exports__, "AccordionMenu", function() { return _foundation_accordionMenu__WEBPACK_IMPORTED_MODULE_1__["AccordionMenu"]; });
- _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_accordionMenu__WEBPACK_IMPORTED_MODULE_1__["AccordionMenu"], 'AccordionMenu');
- }),
- "./js/foundation.accordionMenu.js":
- (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- __webpack_require__.d(__webpack_exports__, "AccordionMenu", function() { return AccordionMenu; });
- var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "jquery");
- var jquery__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
- var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./foundation.util.keyboard");
- var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__);
- var _foundation_util_nest__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./foundation.util.nest");
- var _foundation_util_nest__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(_foundation_util_nest__WEBPACK_IMPORTED_MODULE_2__);
- var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( "./foundation.core");
- var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__);
- 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); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- 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); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var AccordionMenu =
- function (_Plugin) {
- _inherits(AccordionMenu, _Plugin);
- function AccordionMenu() {
- _classCallCheck(this, AccordionMenu);
- return _possibleConstructorReturn(this, _getPrototypeOf(AccordionMenu).apply(this, arguments));
- }
- _createClass(AccordionMenu, [{
- key: "_setup",
-
- value: function _setup(element, options) {
- this.$element = element;
- this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, AccordionMenu.defaults, this.$element.data(), options);
- this.className = 'AccordionMenu';
- this._init();
- _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].register('AccordionMenu', {
- 'ENTER': 'toggle',
- 'SPACE': 'toggle',
- 'ARROW_RIGHT': 'open',
- 'ARROW_UP': 'up',
- 'ARROW_DOWN': 'down',
- 'ARROW_LEFT': 'close',
- 'ESCAPE': 'closeAll'
- });
- }
-
- }, {
- key: "_init",
- value: function _init() {
- _foundation_util_nest__WEBPACK_IMPORTED_MODULE_2__["Nest"].Feather(this.$element, 'accordion');
- var _this = this;
- this.$element.find('[data-submenu]').not('.is-active').slideUp(0);
- this.$element.attr({
- 'role': 'tree',
- 'aria-multiselectable': this.options.multiOpen
- });
- this.$menuLinks = this.$element.find('.is-accordion-submenu-parent');
- this.$menuLinks.each(function () {
- var linkId = this.id || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"])(6, 'acc-menu-link'),
- $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
- $sub = $elem.children('[data-submenu]'),
- subId = $sub[0].id || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"])(6, 'acc-menu'),
- isActive = $sub.hasClass('is-active');
- if (_this.options.parentLink) {
- var $anchor = $elem.children('a');
- $anchor.clone().prependTo($sub).wrap('<li data-is-parent-link class="is-submenu-parent-item is-submenu-item is-accordion-submenu-item"></li>');
- }
- if (_this.options.submenuToggle) {
- $elem.addClass('has-submenu-toggle');
- $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>');
- } else {
- $elem.attr({
- 'aria-controls': subId,
- 'aria-expanded': isActive,
- 'id': linkId
- });
- }
- $sub.attr({
- 'aria-labelledby': linkId,
- 'aria-hidden': !isActive,
- 'role': 'group',
- 'id': subId
- });
- });
- this.$element.find('li').attr({
- 'role': 'treeitem'
- });
- var initPanes = this.$element.find('.is-active');
- if (initPanes.length) {
- initPanes.each(function () {
- _this.down(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this));
- });
- }
- this._events();
- }
-
- }, {
- key: "_events",
- value: function _events() {
- var _this = this;
- this.$element.find('li').each(function () {
- var $submenu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).children('[data-submenu]');
- if ($submenu.length) {
- if (_this.options.submenuToggle) {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).children('.submenu-toggle').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) {
- _this.toggle($submenu);
- });
- } else {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).children('a').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function (e) {
- e.preventDefault();
- _this.toggle($submenu);
- });
- }
- }
- }).on('keydown.zf.accordionMenu', function (e) {
- var $element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
- $elements = $element.parent('ul').children('li'),
- $prevElement,
- $nextElement,
- $target = $element.children('[data-submenu]');
- $elements.each(function (i) {
- if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).is($element)) {
- $prevElement = $elements.eq(Math.max(0, i - 1)).find('a').first();
- $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1)).find('a').first();
- if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).children('[data-submenu]:visible').length) {
-
- $nextElement = $element.find('li:first-child').find('a').first();
- }
- if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).is(':first-child')) {
-
- $prevElement = $element.parents('li').first().find('a').first();
- } else if ($prevElement.parents('li').first().children('[data-submenu]:visible').length) {
-
- $prevElement = $prevElement.parents('li').find('li:last-child').find('a').first();
- }
- if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).is(':last-child')) {
-
- $nextElement = $element.parents('li').first().next('li').find('a').first();
- }
- return;
- }
- });
- _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].handleKey(e, 'AccordionMenu', {
- open: function open() {
- if ($target.is(':hidden')) {
- _this.down($target);
- $target.find('li').first().find('a').first().focus();
- }
- },
- close: function close() {
- if ($target.length && !$target.is(':hidden')) {
-
- _this.up($target);
- } else if ($element.parent('[data-submenu]').length) {
-
- _this.up($element.parent('[data-submenu]'));
- $element.parents('li').first().find('a').first().focus();
- }
- },
- up: function up() {
- $prevElement.focus();
- return true;
- },
- down: function down() {
- $nextElement.focus();
- return true;
- },
- toggle: function toggle() {
- if (_this.options.submenuToggle) {
- return false;
- }
- if ($element.children('[data-submenu]').length) {
- _this.toggle($element.children('[data-submenu]'));
- return true;
- }
- },
- closeAll: function closeAll() {
- _this.hideAll();
- },
- handled: function handled(preventDefault) {
- if (preventDefault) {
- e.preventDefault();
- }
- }
- });
- });
- }
-
- }, {
- key: "hideAll",
- value: function hideAll() {
- this.up(this.$element.find('[data-submenu]'));
- }
-
- }, {
- key: "showAll",
- value: function showAll() {
- this.down(this.$element.find('[data-submenu]'));
- }
-
- }, {
- key: "toggle",
- value: function toggle($target) {
- if (!$target.is(':animated')) {
- if (!$target.is(':hidden')) {
- this.up($target);
- } else {
- this.down($target);
- }
- }
- }
-
- }, {
- key: "down",
- value: function down($target) {
- var _this2 = this;
-
-
- if (!this.options.multiOpen) {
-
-
- var $targetBranch = $target.parentsUntil(this.$element).add($target).add($target.find('.is-active'));
- var $othersActiveSubmenus = this.$element.find('.is-active').not($targetBranch);
- this.up($othersActiveSubmenus);
- }
- $target.addClass('is-active').attr({
- 'aria-hidden': false
- });
- if (this.options.submenuToggle) {
- $target.prev('.submenu-toggle').attr({
- 'aria-expanded': true
- });
- } else {
- $target.parent('.is-accordion-submenu-parent').attr({
- 'aria-expanded': true
- });
- }
- $target.slideDown(this.options.slideSpeed, function () {
-
- _this2.$element.trigger('down.zf.accordionMenu', [$target]);
- });
- }
-
- }, {
- key: "up",
- value: function up($target) {
- var _this3 = this;
- var $submenus = $target.find('[data-submenu]');
- var $allmenus = $target.add($submenus);
- $submenus.slideUp(0);
- $allmenus.removeClass('is-active').attr('aria-hidden', true);
- if (this.options.submenuToggle) {
- $allmenus.prev('.submenu-toggle').attr('aria-expanded', false);
- } else {
- $allmenus.parent('.is-accordion-submenu-parent').attr('aria-expanded', false);
- }
- $target.slideUp(this.options.slideSpeed, function () {
-
- _this3.$element.trigger('up.zf.accordionMenu', [$target]);
- });
- }
-
- }, {
- key: "_destroy",
- value: function _destroy() {
- this.$element.find('[data-submenu]').slideDown(0).css('display', '');
- this.$element.find('a').off('click.zf.accordionMenu');
- this.$element.find('[data-is-parent-link]').detach();
- if (this.options.submenuToggle) {
- this.$element.find('.has-submenu-toggle').removeClass('has-submenu-toggle');
- this.$element.find('.submenu-toggle').remove();
- }
- _foundation_util_nest__WEBPACK_IMPORTED_MODULE_2__["Nest"].Burn(this.$element, 'accordion');
- }
- }]);
- return AccordionMenu;
- }(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["Plugin"]);
- AccordionMenu.defaults = {
-
- parentLink: false,
-
- slideSpeed: 250,
-
- submenuToggle: false,
-
- submenuToggleText: 'Toggle menu',
-
- multiOpen: true
- };
- }),
- 2:
- (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__("./js/entries/plugins/foundation.accordionMenu.js");
- }),
- "jquery":
- (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
- })
- });
- });
|