123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("./foundation.core"), require("./foundation.util.imageLoader"), require("./foundation.util.keyboard"), require("jquery"));
- else if(typeof define === 'function' && define.amd)
- define(["./foundation.core", "./foundation.util.imageLoader", "./foundation.util.keyboard", "jquery"], factory);
- else if(typeof exports === 'object')
- exports["foundation.tabs"] = factory(require("./foundation.core"), require("./foundation.util.imageLoader"), require("./foundation.util.keyboard"), require("jquery"));
- else
- root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.tabs"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.imageLoader"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.keyboard"], root["jQuery"]);
- })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_imageLoader__, __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
- return /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __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;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __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;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 18);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ "./foundation.core":
- /*!****************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***!
- \****************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
- /***/ }),
- /***/ "./foundation.util.imageLoader":
- /*!****************************************************************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.imageLoader"],"amd":"./foundation.util.imageLoader","commonjs":"./foundation.util.imageLoader","commonjs2":"./foundation.util.imageLoader"} ***!
- \****************************************************************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_imageLoader__;
- /***/ }),
- /***/ "./foundation.util.keyboard":
- /*!****************************************************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.keyboard"],"amd":"./foundation.util.keyboard","commonjs":"./foundation.util.keyboard","commonjs2":"./foundation.util.keyboard"} ***!
- \****************************************************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__;
- /***/ }),
- /***/ "./js/entries/plugins/foundation.tabs.js":
- /*!***********************************************!*\
- !*** ./js/entries/plugins/foundation.tabs.js ***!
- \***********************************************/
- /*! exports provided: Foundation, Tabs */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core");
- /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
- /* harmony import */ var _foundation_tabs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.tabs */ "./js/foundation.tabs.js");
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Tabs", function() { return _foundation_tabs__WEBPACK_IMPORTED_MODULE_1__["Tabs"]; });
- _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_tabs__WEBPACK_IMPORTED_MODULE_1__["Tabs"], 'Tabs');
- /***/ }),
- /***/ "./js/foundation.tabs.js":
- /*!*******************************!*\
- !*** ./js/foundation.tabs.js ***!
- \*******************************/
- /*! exports provided: Tabs */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Tabs", function() { return Tabs; });
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.plugin */ "./foundation.core");
- /* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.keyboard */ "./foundation.util.keyboard");
- /* harmony import */ var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation.util.imageLoader */ "./foundation.util.imageLoader");
- /* harmony import */ var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_imageLoader__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); }
- /**
- * Tabs module.
- * @module foundation.tabs
- * @requires foundation.util.keyboard
- * @requires foundation.util.imageLoader if tabs contain images
- */
- var Tabs =
- /*#__PURE__*/
- function (_Plugin) {
- _inherits(Tabs, _Plugin);
- function Tabs() {
- _classCallCheck(this, Tabs);
- return _possibleConstructorReturn(this, _getPrototypeOf(Tabs).apply(this, arguments));
- }
- _createClass(Tabs, [{
- key: "_setup",
- /**
- * Creates a new instance of tabs.
- * @class
- * @name Tabs
- * @fires Tabs#init
- * @param {jQuery} element - jQuery object to make into tabs.
- * @param {Object} options - Overrides to the default plugin settings.
- */
- value: function _setup(element, options) {
- this.$element = element;
- this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Tabs.defaults, this.$element.data(), options);
- this.className = 'Tabs'; // ie9 back compat
- this._init();
- _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].register('Tabs', {
- 'ENTER': 'open',
- 'SPACE': 'open',
- 'ARROW_RIGHT': 'next',
- 'ARROW_UP': 'previous',
- 'ARROW_DOWN': 'next',
- 'ARROW_LEFT': 'previous' // 'TAB': 'next',
- // 'SHIFT_TAB': 'previous'
- });
- }
- /**
- * Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab.
- * @private
- */
- }, {
- key: "_init",
- value: function _init() {
- var _this2 = this;
- var _this = this;
- this._isInitializing = true;
- this.$element.attr({
- 'role': 'tablist'
- });
- this.$tabTitles = this.$element.find(".".concat(this.options.linkClass));
- this.$tabContent = jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-tabs-content=\"".concat(this.$element[0].id, "\"]"));
- this.$tabTitles.each(function () {
- var $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
- $link = $elem.find('a'),
- isActive = $elem.hasClass("".concat(_this.options.linkActiveClass)),
- hash = $link.attr('data-tabs-target') || $link[0].hash.slice(1),
- linkId = $link[0].id ? $link[0].id : "".concat(hash, "-label"),
- $tabContent = jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(hash));
- $elem.attr({
- 'role': 'presentation'
- });
- $link.attr({
- 'role': 'tab',
- 'aria-controls': hash,
- 'aria-selected': isActive,
- 'id': linkId,
- 'tabindex': isActive ? '0' : '-1'
- });
- $tabContent.attr({
- 'role': 'tabpanel',
- 'aria-labelledby': linkId
- }); // Save up the initial hash to return to it later when going back in history
- if (isActive) {
- _this._initialAnchor = "#".concat(hash);
- }
- if (!isActive) {
- $tabContent.attr('aria-hidden', 'true');
- }
- if (isActive && _this.options.autoFocus) {
- _this.onLoadListener = Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["onLoad"])(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window), function () {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()('html, body').animate({
- scrollTop: $elem.offset().top
- }, _this.options.deepLinkSmudgeDelay, function () {
- $link.focus();
- });
- });
- }
- });
- if (this.options.matchHeight) {
- var $images = this.$tabContent.find('img');
- if ($images.length) {
- Object(_foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_3__["onImagesLoaded"])($images, this._setHeight.bind(this));
- } else {
- this._setHeight();
- }
- } // Current context-bound function to open tabs on page load or history hashchange
- this._checkDeepLink = function () {
- var anchor = window.location.hash;
- if (!anchor.length) {
- // If we are still initializing and there is no anchor, then there is nothing to do
- if (_this2._isInitializing) return; // Otherwise, move to the initial anchor
- if (_this2._initialAnchor) anchor = _this2._initialAnchor;
- }
- var anchorNoHash = anchor.indexOf('#') >= 0 ? anchor.slice(1) : anchor;
- var $anchor = anchorNoHash && jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(anchorNoHash));
- var $link = anchor && _this2.$element.find("[href$=\"".concat(anchor, "\"],[data-tabs-target=\"").concat(anchorNoHash, "\"]")).first(); // Whether the anchor element that has been found is part of this element
- var isOwnAnchor = !!($anchor.length && $link.length);
- if (isOwnAnchor) {
- // If there is an anchor for the hash, select it
- if ($anchor && $anchor.length && $link && $link.length) {
- _this2.selectTab($anchor, true);
- } // Otherwise, collapse everything
- else {
- _this2._collapse();
- } // Roll up a little to show the titles
- if (_this2.options.deepLinkSmudge) {
- var offset = _this2.$element.offset();
- jquery__WEBPACK_IMPORTED_MODULE_0___default()('html, body').animate({
- scrollTop: offset.top
- }, _this2.options.deepLinkSmudgeDelay);
- }
- /**
- * Fires when the plugin has deeplinked at pageload
- * @event Tabs#deeplink
- */
- _this2.$element.trigger('deeplink.zf.tabs', [$link, $anchor]);
- }
- }; //use browser to open a tab, if it exists in this tabset
- if (this.options.deepLink) {
- this._checkDeepLink();
- }
- this._events();
- this._isInitializing = false;
- }
- /**
- * Adds event handlers for items within the tabs.
- * @private
- */
- }, {
- key: "_events",
- value: function _events() {
- this._addKeyHandler();
- this._addClickHandler();
- this._setHeightMqHandler = null;
- if (this.options.matchHeight) {
- this._setHeightMqHandler = this._setHeight.bind(this);
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('changed.zf.mediaquery', this._setHeightMqHandler);
- }
- if (this.options.deepLink) {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('hashchange', this._checkDeepLink);
- }
- }
- /**
- * Adds click handlers for items within the tabs.
- * @private
- */
- }, {
- key: "_addClickHandler",
- value: function _addClickHandler() {
- var _this = this;
- this.$element.off('click.zf.tabs').on('click.zf.tabs', ".".concat(this.options.linkClass), function (e) {
- e.preventDefault();
- _this._handleTabChange(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this));
- });
- }
- /**
- * Adds keyboard event handlers for items within the tabs.
- * @private
- */
- }, {
- key: "_addKeyHandler",
- value: function _addKeyHandler() {
- var _this = this;
- this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function (e) {
- if (e.which === 9) return;
- var $element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
- $elements = $element.parent('ul').children('li'),
- $prevElement,
- $nextElement;
- $elements.each(function (i) {
- if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).is($element)) {
- if (_this.options.wrapOnKeys) {
- $prevElement = i === 0 ? $elements.last() : $elements.eq(i - 1);
- $nextElement = i === $elements.length - 1 ? $elements.first() : $elements.eq(i + 1);
- } else {
- $prevElement = $elements.eq(Math.max(0, i - 1));
- $nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1));
- }
- return;
- }
- }); // handle keyboard event with keyboard util
- _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].handleKey(e, 'Tabs', {
- open: function open() {
- $element.find('[role="tab"]').focus();
- _this._handleTabChange($element);
- },
- previous: function previous() {
- $prevElement.find('[role="tab"]').focus();
- _this._handleTabChange($prevElement);
- },
- next: function next() {
- $nextElement.find('[role="tab"]').focus();
- _this._handleTabChange($nextElement);
- },
- handled: function handled() {
- e.preventDefault();
- }
- });
- });
- }
- /**
- * Opens the tab `$targetContent` defined by `$target`. Collapses active tab.
- * @param {jQuery} $target - Tab to open.
- * @param {boolean} historyHandled - browser has already handled a history update
- * @fires Tabs#change
- * @function
- */
- }, {
- key: "_handleTabChange",
- value: function _handleTabChange($target, historyHandled) {
- // With `activeCollapse`, if the target is the active Tab, collapse it.
- if ($target.hasClass("".concat(this.options.linkActiveClass))) {
- if (this.options.activeCollapse) {
- this._collapse();
- }
- return;
- }
- var $oldTab = this.$element.find(".".concat(this.options.linkClass, ".").concat(this.options.linkActiveClass)),
- $tabLink = $target.find('[role="tab"]'),
- target = $tabLink.attr('data-tabs-target'),
- anchor = target && target.length ? "#".concat(target) : $tabLink[0].hash,
- $targetContent = this.$tabContent.find(anchor); //close old tab
- this._collapseTab($oldTab); //open new tab
- this._openTab($target); //either replace or update browser history
- if (this.options.deepLink && !historyHandled) {
- if (this.options.updateHistory) {
- history.pushState({}, '', anchor);
- } else {
- history.replaceState({}, '', anchor);
- }
- }
- /**
- * Fires when the plugin has successfully changed tabs.
- * @event Tabs#change
- */
- this.$element.trigger('change.zf.tabs', [$target, $targetContent]); //fire to children a mutation event
- $targetContent.find("[data-mutate]").trigger("mutateme.zf.trigger");
- }
- /**
- * Opens the tab `$targetContent` defined by `$target`.
- * @param {jQuery} $target - Tab to open.
- * @function
- */
- }, {
- key: "_openTab",
- value: function _openTab($target) {
- var $tabLink = $target.find('[role="tab"]'),
- hash = $tabLink.attr('data-tabs-target') || $tabLink[0].hash.slice(1),
- $targetContent = this.$tabContent.find("#".concat(hash));
- $target.addClass("".concat(this.options.linkActiveClass));
- $tabLink.attr({
- 'aria-selected': 'true',
- 'tabindex': '0'
- });
- $targetContent.addClass("".concat(this.options.panelActiveClass)).removeAttr('aria-hidden');
- }
- /**
- * Collapses `$targetContent` defined by `$target`.
- * @param {jQuery} $target - Tab to collapse.
- * @function
- */
- }, {
- key: "_collapseTab",
- value: function _collapseTab($target) {
- var $target_anchor = $target.removeClass("".concat(this.options.linkActiveClass)).find('[role="tab"]').attr({
- 'aria-selected': 'false',
- 'tabindex': -1
- });
- jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat($target_anchor.attr('aria-controls'))).removeClass("".concat(this.options.panelActiveClass)).attr({
- 'aria-hidden': 'true'
- });
- }
- /**
- * Collapses the active Tab.
- * @fires Tabs#collapse
- * @function
- */
- }, {
- key: "_collapse",
- value: function _collapse() {
- var $activeTab = this.$element.find(".".concat(this.options.linkClass, ".").concat(this.options.linkActiveClass));
- if ($activeTab.length) {
- this._collapseTab($activeTab);
- /**
- * Fires when the plugin has successfully collapsed tabs.
- * @event Tabs#collapse
- */
- this.$element.trigger('collapse.zf.tabs', [$activeTab]);
- }
- }
- /**
- * Public method for selecting a content pane to display.
- * @param {jQuery | String} elem - jQuery object or string of the id of the pane to display.
- * @param {boolean} historyHandled - browser has already handled a history update
- * @function
- */
- }, {
- key: "selectTab",
- value: function selectTab(elem, historyHandled) {
- var idStr, hashIdStr;
- if (_typeof(elem) === 'object') {
- idStr = elem[0].id;
- } else {
- idStr = elem;
- }
- if (idStr.indexOf('#') < 0) {
- hashIdStr = "#".concat(idStr);
- } else {
- hashIdStr = idStr;
- idStr = idStr.slice(1);
- }
- var $target = this.$tabTitles.has("[href$=\"".concat(hashIdStr, "\"],[data-tabs-target=\"").concat(idStr, "\"]")).first();
- this._handleTabChange($target, historyHandled);
- }
- }, {
- key: "_setHeight",
- /**
- * Sets the height of each panel to the height of the tallest panel.
- * If enabled in options, gets called on media query change.
- * If loading content via external source, can be called directly or with _reflow.
- * If enabled with `data-match-height="true"`, tabs sets to equal height
- * @function
- * @private
- */
- value: function _setHeight() {
- var max = 0,
- _this = this; // Lock down the `this` value for the root tabs object
- this.$tabContent.find(".".concat(this.options.panelClass)).css('height', '').each(function () {
- var panel = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
- isActive = panel.hasClass("".concat(_this.options.panelActiveClass)); // get the options from the parent instead of trying to get them from the child
- if (!isActive) {
- panel.css({
- 'visibility': 'hidden',
- 'display': 'block'
- });
- }
- var temp = this.getBoundingClientRect().height;
- if (!isActive) {
- panel.css({
- 'visibility': '',
- 'display': ''
- });
- }
- max = temp > max ? temp : max;
- }).css('height', "".concat(max, "px"));
- }
- /**
- * Destroys an instance of tabs.
- * @fires Tabs#destroyed
- */
- }, {
- key: "_destroy",
- value: function _destroy() {
- this.$element.find(".".concat(this.options.linkClass)).off('.zf.tabs').hide().end().find(".".concat(this.options.panelClass)).hide();
- if (this.options.matchHeight) {
- if (this._setHeightMqHandler != null) {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('changed.zf.mediaquery', this._setHeightMqHandler);
- }
- }
- if (this.options.deepLink) {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('hashchange', this._checkDeepLink);
- }
- if (this.onLoadListener) {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(this.onLoadListener);
- }
- }
- }]);
- return Tabs;
- }(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["Plugin"]);
- Tabs.defaults = {
- /**
- * Link the location hash to the active pane.
- * Set the location hash when the active pane changes, and open the corresponding pane when the location changes.
- * @option
- * @type {boolean}
- * @default false
- */
- deepLink: false,
- /**
- * If `deepLink` is enabled, adjust the deep link scroll to make sure the top of the tab panel is visible
- * @option
- * @type {boolean}
- * @default false
- */
- deepLinkSmudge: false,
- /**
- * If `deepLinkSmudge` is enabled, animation time (ms) for the deep link adjustment
- * @option
- * @type {number}
- * @default 300
- */
- deepLinkSmudgeDelay: 300,
- /**
- * If `deepLink` is enabled, update the browser history with the open tab
- * @option
- * @type {boolean}
- * @default false
- */
- updateHistory: false,
- /**
- * Allows the window to scroll to content of active pane on load.
- * Not recommended if more than one tab panel per page.
- * @option
- * @type {boolean}
- * @default false
- */
- autoFocus: false,
- /**
- * Allows keyboard input to 'wrap' around the tab links.
- * @option
- * @type {boolean}
- * @default true
- */
- wrapOnKeys: true,
- /**
- * Allows the tab content panes to match heights if set to true.
- * @option
- * @type {boolean}
- * @default false
- */
- matchHeight: false,
- /**
- * Allows active tabs to collapse when clicked.
- * @option
- * @type {boolean}
- * @default false
- */
- activeCollapse: false,
- /**
- * Class applied to `li`'s in tab link list.
- * @option
- * @type {string}
- * @default 'tabs-title'
- */
- linkClass: 'tabs-title',
- /**
- * Class applied to the active `li` in tab link list.
- * @option
- * @type {string}
- * @default 'is-active'
- */
- linkActiveClass: 'is-active',
- /**
- * Class applied to the content containers.
- * @option
- * @type {string}
- * @default 'tabs-panel'
- */
- panelClass: 'tabs-panel',
- /**
- * Class applied to the active content container.
- * @option
- * @type {string}
- * @default 'is-active'
- */
- panelActiveClass: 'is-active'
- };
- /***/ }),
- /***/ 18:
- /*!*****************************************************!*\
- !*** multi ./js/entries/plugins/foundation.tabs.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.tabs.js */"./js/entries/plugins/foundation.tabs.js");
- /***/ }),
- /***/ "jquery":
- /*!********************************************************************************************!*\
- !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
- /***/ })
- /******/ });
- });
- //# sourceMappingURL=foundation.tabs.js.map
|