foundation.responsiveAccordionTabs.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("./foundation.accordion"), require("./foundation.core"), require("./foundation.tabs"), require("./foundation.util.mediaQuery"), require("jquery"));
  4. else if(typeof define === 'function' && define.amd)
  5. define(["./foundation.accordion", "./foundation.core", "./foundation.tabs", "./foundation.util.mediaQuery", "jquery"], factory);
  6. else if(typeof exports === 'object')
  7. exports["foundation.responsiveAccordionTabs"] = factory(require("./foundation.accordion"), require("./foundation.core"), require("./foundation.tabs"), require("./foundation.util.mediaQuery"), require("jquery"));
  8. else
  9. root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.responsiveAccordionTabs"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.accordion"], root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.tabs"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.mediaQuery"], root["jQuery"]);
  10. })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_accordion__, __WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_tabs__, __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__, __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 = 11);
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./foundation.accordion":
  99. /*!************************************************************************************************************************************************************************************!*\
  100. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.accordion"],"amd":"./foundation.accordion","commonjs":"./foundation.accordion","commonjs2":"./foundation.accordion"} ***!
  101. \************************************************************************************************************************************************************************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports) {
  104. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_accordion__;
  105. /***/ }),
  106. /***/ "./foundation.core":
  107. /*!****************************************************************************************************************************************************************!*\
  108. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***!
  109. \****************************************************************************************************************************************************************/
  110. /*! no static exports found */
  111. /***/ (function(module, exports) {
  112. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
  113. /***/ }),
  114. /***/ "./foundation.tabs":
  115. /*!****************************************************************************************************************************************************************!*\
  116. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.tabs"],"amd":"./foundation.tabs","commonjs":"./foundation.tabs","commonjs2":"./foundation.tabs"} ***!
  117. \****************************************************************************************************************************************************************/
  118. /*! no static exports found */
  119. /***/ (function(module, exports) {
  120. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_tabs__;
  121. /***/ }),
  122. /***/ "./foundation.util.mediaQuery":
  123. /*!************************************************************************************************************************************************************************************************************!*\
  124. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.mediaQuery"],"amd":"./foundation.util.mediaQuery","commonjs":"./foundation.util.mediaQuery","commonjs2":"./foundation.util.mediaQuery"} ***!
  125. \************************************************************************************************************************************************************************************************************/
  126. /*! no static exports found */
  127. /***/ (function(module, exports) {
  128. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__;
  129. /***/ }),
  130. /***/ "./js/entries/plugins/foundation.responsiveAccordionTabs.js":
  131. /*!******************************************************************!*\
  132. !*** ./js/entries/plugins/foundation.responsiveAccordionTabs.js ***!
  133. \******************************************************************/
  134. /*! exports provided: Foundation, ResponsiveAccordionTabs */
  135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  136. "use strict";
  137. __webpack_require__.r(__webpack_exports__);
  138. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core");
  139. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
  140. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
  141. /* harmony import */ var _foundation_responsiveAccordionTabs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.responsiveAccordionTabs */ "./js/foundation.responsiveAccordionTabs.js");
  142. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ResponsiveAccordionTabs", function() { return _foundation_responsiveAccordionTabs__WEBPACK_IMPORTED_MODULE_1__["ResponsiveAccordionTabs"]; });
  143. _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_responsiveAccordionTabs__WEBPACK_IMPORTED_MODULE_1__["ResponsiveAccordionTabs"], 'ResponsiveAccordionTabs');
  144. /***/ }),
  145. /***/ "./js/foundation.responsiveAccordionTabs.js":
  146. /*!**************************************************!*\
  147. !*** ./js/foundation.responsiveAccordionTabs.js ***!
  148. \**************************************************/
  149. /*! exports provided: ResponsiveAccordionTabs */
  150. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  151. "use strict";
  152. __webpack_require__.r(__webpack_exports__);
  153. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResponsiveAccordionTabs", function() { return ResponsiveAccordionTabs; });
  154. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  155. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  156. /* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.util.mediaQuery */ "./foundation.util.mediaQuery");
  157. /* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__);
  158. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.core.utils */ "./foundation.core");
  159. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__);
  160. /* harmony import */ var _foundation_accordion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation.accordion */ "./foundation.accordion");
  161. /* harmony import */ var _foundation_accordion__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_foundation_accordion__WEBPACK_IMPORTED_MODULE_3__);
  162. /* harmony import */ var _foundation_tabs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./foundation.tabs */ "./foundation.tabs");
  163. /* harmony import */ var _foundation_tabs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_foundation_tabs__WEBPACK_IMPORTED_MODULE_4__);
  164. 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); }
  165. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  166. 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); } }
  167. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  168. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  169. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  170. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  171. 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); }
  172. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  173. // The plugin matches the plugin classes with these plugin instances.
  174. var MenuPlugins = {
  175. tabs: {
  176. cssClass: 'tabs',
  177. plugin: _foundation_tabs__WEBPACK_IMPORTED_MODULE_4__["Tabs"],
  178. open: function open(plugin, target) {
  179. return plugin.selectTab(target);
  180. },
  181. close: null
  182. /* not supported */
  183. ,
  184. toggle: null
  185. /* not supported */
  186. },
  187. accordion: {
  188. cssClass: 'accordion',
  189. plugin: _foundation_accordion__WEBPACK_IMPORTED_MODULE_3__["Accordion"],
  190. open: function open(plugin, target) {
  191. return plugin.down(jquery__WEBPACK_IMPORTED_MODULE_0___default()(target));
  192. },
  193. close: function close(plugin, target) {
  194. return plugin.up(jquery__WEBPACK_IMPORTED_MODULE_0___default()(target));
  195. },
  196. toggle: function toggle(plugin, target) {
  197. return plugin.toggle(jquery__WEBPACK_IMPORTED_MODULE_0___default()(target));
  198. }
  199. }
  200. };
  201. /**
  202. * ResponsiveAccordionTabs module.
  203. * @module foundation.responsiveAccordionTabs
  204. * @requires foundation.util.motion
  205. * @requires foundation.accordion
  206. * @requires foundation.tabs
  207. */
  208. var ResponsiveAccordionTabs =
  209. /*#__PURE__*/
  210. function (_Plugin) {
  211. _inherits(ResponsiveAccordionTabs, _Plugin);
  212. function ResponsiveAccordionTabs(element, options) {
  213. var _this2;
  214. _classCallCheck(this, ResponsiveAccordionTabs);
  215. _this2 = _possibleConstructorReturn(this, _getPrototypeOf(ResponsiveAccordionTabs).call(this, element, options));
  216. return _possibleConstructorReturn(_this2, _this2.options.reflow && _this2.storezfData || _assertThisInitialized(_this2));
  217. }
  218. /**
  219. * Creates a new instance of a responsive accordion tabs.
  220. * @class
  221. * @name ResponsiveAccordionTabs
  222. * @fires ResponsiveAccordionTabs#init
  223. * @param {jQuery} element - jQuery object to make into Responsive Accordion Tabs.
  224. * @param {Object} options - Overrides to the default plugin settings.
  225. */
  226. _createClass(ResponsiveAccordionTabs, [{
  227. key: "_setup",
  228. value: function _setup(element, options) {
  229. this.$element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  230. this.$element.data('zfPluginBase', this);
  231. this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, ResponsiveAccordionTabs.defaults, this.$element.data(), options);
  232. this.rules = this.$element.data('responsive-accordion-tabs');
  233. this.currentMq = null;
  234. this.currentRule = null;
  235. this.currentPlugin = null;
  236. this.className = 'ResponsiveAccordionTabs'; // ie9 back compat
  237. if (!this.$element.attr('id')) {
  238. this.$element.attr('id', Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__["GetYoDigits"])(6, 'responsiveaccordiontabs'));
  239. }
  240. this._init();
  241. this._events();
  242. }
  243. /**
  244. * Initializes the Menu by parsing the classes from the 'data-responsive-accordion-tabs' attribute on the element.
  245. * @function
  246. * @private
  247. */
  248. }, {
  249. key: "_init",
  250. value: function _init() {
  251. _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"]._init(); // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules
  252. if (typeof this.rules === 'string') {
  253. var rulesTree = {}; // Parse rules from "classes" pulled from data attribute
  254. var rules = this.rules.split(' '); // Iterate through every rule found
  255. for (var i = 0; i < rules.length; i++) {
  256. var rule = rules[i].split('-');
  257. var ruleSize = rule.length > 1 ? rule[0] : 'small';
  258. var rulePlugin = rule.length > 1 ? rule[1] : rule[0];
  259. if (MenuPlugins[rulePlugin] !== null) {
  260. rulesTree[ruleSize] = MenuPlugins[rulePlugin];
  261. }
  262. }
  263. this.rules = rulesTree;
  264. }
  265. this._getAllOptions();
  266. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.isEmptyObject(this.rules)) {
  267. this._checkMediaQueries();
  268. }
  269. }
  270. }, {
  271. key: "_getAllOptions",
  272. value: function _getAllOptions() {
  273. //get all defaults and options
  274. var _this = this;
  275. _this.allOptions = {};
  276. for (var key in MenuPlugins) {
  277. if (MenuPlugins.hasOwnProperty(key)) {
  278. var obj = MenuPlugins[key];
  279. try {
  280. var dummyPlugin = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<ul></ul>');
  281. var tmpPlugin = new obj.plugin(dummyPlugin, _this.options);
  282. for (var keyKey in tmpPlugin.options) {
  283. if (tmpPlugin.options.hasOwnProperty(keyKey) && keyKey !== 'zfPlugin') {
  284. var objObj = tmpPlugin.options[keyKey];
  285. _this.allOptions[keyKey] = objObj;
  286. }
  287. }
  288. tmpPlugin.destroy();
  289. } catch (e) {}
  290. }
  291. }
  292. }
  293. /**
  294. * Initializes events for the Menu.
  295. * @function
  296. * @private
  297. */
  298. }, {
  299. key: "_events",
  300. value: function _events() {
  301. this._changedZfMediaQueryHandler = this._checkMediaQueries.bind(this);
  302. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('changed.zf.mediaquery', this._changedZfMediaQueryHandler);
  303. }
  304. /**
  305. * 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.
  306. * @function
  307. * @private
  308. */
  309. }, {
  310. key: "_checkMediaQueries",
  311. value: function _checkMediaQueries() {
  312. var matchedMq,
  313. _this = this; // Iterate through each rule and find the last matching rule
  314. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.each(this.rules, function (key) {
  315. if (_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"].atLeast(key)) {
  316. matchedMq = key;
  317. }
  318. }); // No match? No dice
  319. if (!matchedMq) return; // Plugin already initialized? We good
  320. if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return; // Remove existing plugin-specific CSS classes
  321. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.each(MenuPlugins, function (key, value) {
  322. _this.$element.removeClass(value.cssClass);
  323. }); // Add the CSS class for the new plugin
  324. this.$element.addClass(this.rules[matchedMq].cssClass); // Create an instance of the new plugin
  325. if (this.currentPlugin) {
  326. //don't know why but on nested elements data zfPlugin get's lost
  327. if (!this.currentPlugin.$element.data('zfPlugin') && this.storezfData) this.currentPlugin.$element.data('zfPlugin', this.storezfData);
  328. this.currentPlugin.destroy();
  329. }
  330. this._handleMarkup(this.rules[matchedMq].cssClass);
  331. this.currentRule = this.rules[matchedMq];
  332. this.currentPlugin = new this.currentRule.plugin(this.$element, this.options);
  333. this.storezfData = this.currentPlugin.$element.data('zfPlugin');
  334. }
  335. }, {
  336. key: "_handleMarkup",
  337. value: function _handleMarkup(toSet) {
  338. var _this = this,
  339. fromString = 'accordion';
  340. var $panels = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-tabs-content=' + this.$element.attr('id') + ']');
  341. if ($panels.length) fromString = 'tabs';
  342. if (fromString === toSet) {
  343. return;
  344. }
  345. var tabsTitle = _this.allOptions.linkClass ? _this.allOptions.linkClass : 'tabs-title';
  346. var tabsPanel = _this.allOptions.panelClass ? _this.allOptions.panelClass : 'tabs-panel';
  347. this.$element.removeAttr('role');
  348. var $liHeads = this.$element.children('.' + tabsTitle + ',[data-accordion-item]').removeClass(tabsTitle).removeClass('accordion-item').removeAttr('data-accordion-item');
  349. var $liHeadsA = $liHeads.children('a').removeClass('accordion-title');
  350. if (fromString === 'tabs') {
  351. $panels = $panels.children('.' + tabsPanel).removeClass(tabsPanel).removeAttr('role').removeAttr('aria-hidden').removeAttr('aria-labelledby');
  352. $panels.children('a').removeAttr('role').removeAttr('aria-controls').removeAttr('aria-selected');
  353. } else {
  354. $panels = $liHeads.children('[data-tab-content]').removeClass('accordion-content');
  355. }
  356. $panels.css({
  357. display: '',
  358. visibility: ''
  359. });
  360. $liHeads.css({
  361. display: '',
  362. visibility: ''
  363. });
  364. if (toSet === 'accordion') {
  365. $panels.each(function (key, value) {
  366. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value).appendTo($liHeads.get(key)).addClass('accordion-content').attr('data-tab-content', '').removeClass('is-active').css({
  367. height: ''
  368. });
  369. jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-tabs-content=' + _this.$element.attr('id') + ']').after('<div id="tabs-placeholder-' + _this.$element.attr('id') + '"></div>').detach();
  370. $liHeads.addClass('accordion-item').attr('data-accordion-item', '');
  371. $liHeadsA.addClass('accordion-title');
  372. });
  373. } else if (toSet === 'tabs') {
  374. var $tabsContent = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-tabs-content=' + _this.$element.attr('id') + ']');
  375. var $placeholder = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#tabs-placeholder-' + _this.$element.attr('id'));
  376. if ($placeholder.length) {
  377. $tabsContent = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="tabs-content"></div>').insertAfter($placeholder).attr('data-tabs-content', _this.$element.attr('id'));
  378. $placeholder.remove();
  379. } else {
  380. $tabsContent = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="tabs-content"></div>').insertAfter(_this.$element).attr('data-tabs-content', _this.$element.attr('id'));
  381. }
  382. $panels.each(function (key, value) {
  383. var tempValue = jquery__WEBPACK_IMPORTED_MODULE_0___default()(value).appendTo($tabsContent).addClass(tabsPanel);
  384. var hash = $liHeadsA.get(key).hash.slice(1);
  385. var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(value).attr('id') || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__["GetYoDigits"])(6, 'accordion');
  386. if (hash !== id) {
  387. if (hash !== '') {
  388. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value).attr('id', hash);
  389. } else {
  390. hash = id;
  391. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value).attr('id', hash);
  392. jquery__WEBPACK_IMPORTED_MODULE_0___default()($liHeadsA.get(key)).attr('href', jquery__WEBPACK_IMPORTED_MODULE_0___default()($liHeadsA.get(key)).attr('href').replace('#', '') + '#' + hash);
  393. }
  394. }
  395. var isActive = jquery__WEBPACK_IMPORTED_MODULE_0___default()($liHeads.get(key)).hasClass('is-active');
  396. if (isActive) {
  397. tempValue.addClass('is-active');
  398. }
  399. });
  400. $liHeads.addClass(tabsTitle);
  401. }
  402. ;
  403. }
  404. /**
  405. * Opens the plugin pane defined by `target`.
  406. * @param {jQuery | String} target - jQuery object or string of the id of the pane to open.
  407. * @see Accordion.down
  408. * @see Tabs.selectTab
  409. * @function
  410. */
  411. }, {
  412. key: "open",
  413. value: function open(_target) {
  414. if (this.currentRule && typeof this.currentRule.open === 'function') {
  415. var _this$currentRule;
  416. return (_this$currentRule = this.currentRule).open.apply(_this$currentRule, [this.currentPlugin].concat(Array.prototype.slice.call(arguments)));
  417. }
  418. }
  419. /**
  420. * Closes the plugin pane defined by `target`. Not availaible for Tabs.
  421. * @param {jQuery | String} target - jQuery object or string of the id of the pane to close.
  422. * @see Accordion.up
  423. * @function
  424. */
  425. }, {
  426. key: "close",
  427. value: function close(_target) {
  428. if (this.currentRule && typeof this.currentRule.close === 'function') {
  429. var _this$currentRule2;
  430. return (_this$currentRule2 = this.currentRule).close.apply(_this$currentRule2, [this.currentPlugin].concat(Array.prototype.slice.call(arguments)));
  431. }
  432. }
  433. /**
  434. * Toggles the plugin pane defined by `target`. Not availaible for Tabs.
  435. * @param {jQuery | String} target - jQuery object or string of the id of the pane to toggle.
  436. * @see Accordion.toggle
  437. * @function
  438. */
  439. }, {
  440. key: "toggle",
  441. value: function toggle(_target) {
  442. if (this.currentRule && typeof this.currentRule.toggle === 'function') {
  443. var _this$currentRule3;
  444. return (_this$currentRule3 = this.currentRule).toggle.apply(_this$currentRule3, [this.currentPlugin].concat(Array.prototype.slice.call(arguments)));
  445. }
  446. }
  447. /**
  448. * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out.
  449. * @function
  450. */
  451. }, {
  452. key: "_destroy",
  453. value: function _destroy() {
  454. if (this.currentPlugin) this.currentPlugin.destroy();
  455. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('changed.zf.mediaquery', this._changedZfMediaQueryHandler);
  456. }
  457. }]);
  458. return ResponsiveAccordionTabs;
  459. }(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_2__["Plugin"]);
  460. ResponsiveAccordionTabs.defaults = {};
  461. /***/ }),
  462. /***/ 11:
  463. /*!************************************************************************!*\
  464. !*** multi ./js/entries/plugins/foundation.responsiveAccordionTabs.js ***!
  465. \************************************************************************/
  466. /*! no static exports found */
  467. /***/ (function(module, exports, __webpack_require__) {
  468. module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.responsiveAccordionTabs.js */"./js/entries/plugins/foundation.responsiveAccordionTabs.js");
  469. /***/ }),
  470. /***/ "jquery":
  471. /*!********************************************************************************************!*\
  472. !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
  473. \********************************************************************************************/
  474. /*! no static exports found */
  475. /***/ (function(module, exports) {
  476. module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
  477. /***/ })
  478. /******/ });
  479. });
  480. //# sourceMappingURL=foundation.responsiveAccordionTabs.js.map