|
1 | 1 | (function (global, factory) {
|
2 | 2 | if (typeof define === "function" && define.amd) {
|
3 |
| - define(['exports', 'babel-runtime/core-js/weak-map', 'babel-runtime/helpers/typeof', 'babel-runtime/helpers/toConsumableArray', 'babel-runtime/core-js/object/get-prototype-of', 'babel-runtime/helpers/classCallCheck', 'babel-runtime/helpers/createClass', 'babel-runtime/helpers/possibleConstructorReturn', 'babel-runtime/helpers/get', 'babel-runtime/helpers/inherits', '../misc/mixin', '../mixins/create-component', '../mixins/init-component-by-search', '../polyfills/toggle-class', '../polyfills/event-matches', '../misc/on', '../polyfills/array-from', '../polyfills/element-matches', '../polyfills/object-assign', '../polyfills/custom-event'], factory); |
| 3 | + define(['exports', 'babel-runtime/core-js/weak-map', 'babel-runtime/helpers/toConsumableArray', 'babel-runtime/core-js/object/get-prototype-of', 'babel-runtime/helpers/classCallCheck', 'babel-runtime/helpers/createClass', 'babel-runtime/helpers/possibleConstructorReturn', 'babel-runtime/helpers/get', 'babel-runtime/helpers/inherits', '../misc/mixin', '../mixins/create-component', '../mixins/init-component-by-search', '../polyfills/toggle-class', '../polyfills/event-matches', '../misc/on', '../polyfills/array-from', '../polyfills/element-matches', '../polyfills/object-assign', '../polyfills/custom-event'], factory); |
4 | 4 | } else if (typeof exports !== "undefined") {
|
5 |
| - factory(exports, require('babel-runtime/core-js/weak-map'), require('babel-runtime/helpers/typeof'), require('babel-runtime/helpers/toConsumableArray'), require('babel-runtime/core-js/object/get-prototype-of'), require('babel-runtime/helpers/classCallCheck'), require('babel-runtime/helpers/createClass'), require('babel-runtime/helpers/possibleConstructorReturn'), require('babel-runtime/helpers/get'), require('babel-runtime/helpers/inherits'), require('../misc/mixin'), require('../mixins/create-component'), require('../mixins/init-component-by-search'), require('../polyfills/toggle-class'), require('../polyfills/event-matches'), require('../misc/on'), require('../polyfills/array-from'), require('../polyfills/element-matches'), require('../polyfills/object-assign'), require('../polyfills/custom-event')); |
| 5 | + factory(exports, require('babel-runtime/core-js/weak-map'), require('babel-runtime/helpers/toConsumableArray'), require('babel-runtime/core-js/object/get-prototype-of'), require('babel-runtime/helpers/classCallCheck'), require('babel-runtime/helpers/createClass'), require('babel-runtime/helpers/possibleConstructorReturn'), require('babel-runtime/helpers/get'), require('babel-runtime/helpers/inherits'), require('../misc/mixin'), require('../mixins/create-component'), require('../mixins/init-component-by-search'), require('../polyfills/toggle-class'), require('../polyfills/event-matches'), require('../misc/on'), require('../polyfills/array-from'), require('../polyfills/element-matches'), require('../polyfills/object-assign'), require('../polyfills/custom-event')); |
6 | 6 | } else {
|
7 | 7 | var mod = {
|
8 | 8 | exports: {}
|
9 | 9 | };
|
10 |
| - factory(mod.exports, global.weakMap, global._typeof, global.toConsumableArray, global.getPrototypeOf, global.classCallCheck, global.createClass, global.possibleConstructorReturn, global.get, global.inherits, global.mixin, global.createComponent, global.initComponentBySearch, global.toggleClass, global.eventMatches, global.on, global.arrayFrom, global.elementMatches, global.objectAssign, global.customEvent); |
| 10 | + factory(mod.exports, global.weakMap, global.toConsumableArray, global.getPrototypeOf, global.classCallCheck, global.createClass, global.possibleConstructorReturn, global.get, global.inherits, global.mixin, global.createComponent, global.initComponentBySearch, global.toggleClass, global.eventMatches, global.on, global.arrayFrom, global.elementMatches, global.objectAssign, global.customEvent); |
11 | 11 | global.leftNav = mod.exports;
|
12 | 12 | }
|
13 |
| -})(this, function (exports, _weakMap, _typeof2, _toConsumableArray2, _getPrototypeOf, _classCallCheck2, _createClass2, _possibleConstructorReturn2, _get2, _inherits2, _mixin2, _createComponent, _initComponentBySearch, _toggleClass, _eventMatches, _on) { |
| 13 | +})(this, function (exports, _weakMap, _toConsumableArray2, _getPrototypeOf, _classCallCheck2, _createClass2, _possibleConstructorReturn2, _get2, _inherits2, _mixin2, _createComponent, _initComponentBySearch, _toggleClass, _eventMatches, _on) { |
14 | 14 | 'use strict';
|
15 | 15 |
|
16 | 16 | Object.defineProperty(exports, "__esModule", {
|
|
19 | 19 |
|
20 | 20 | var _weakMap2 = _interopRequireDefault(_weakMap);
|
21 | 21 |
|
22 |
| - var _typeof3 = _interopRequireDefault(_typeof2); |
23 |
| - |
24 | 22 | var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
25 | 23 |
|
26 | 24 | var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
|
407 | 405 | // Sorry
|
408 | 406 | var leftNavSectionItem = (0, _eventMatches2.default)(evt, this.options.selectorLeftNavSection);
|
409 | 407 | if (leftNavSectionItem) {
|
410 |
| - var _ret = function () { |
411 |
| - // currently selected |
412 |
| - var selectedLeftNavSectionItem = _this10.element.querySelector(_this10.options.selectorLeftNavCurrentSection); |
413 |
| - var selectedLeftNavSectionItemTitle = selectedLeftNavSectionItem.querySelector(_this10.options.selectorLeftNavCurrentSectionTitle); |
414 |
| - var selectedLeftNavSectionItemIcon = _this10.element.querySelector(_this10.options.selectorLeftNavCurrentSectionIcon); |
415 |
| - var selectedLeftNavSectionItemUse = selectedLeftNavSectionItemIcon.querySelector('use'); |
416 |
| - var selectedLeftNavSectionValue = selectedLeftNavSectionItem.dataset.leftNavCurrentSection; |
417 |
| - |
418 |
| - // clicked on item |
419 |
| - var leftNavSectionItemLink = leftNavSectionItem.querySelector(_this10.options.selectorLeftNavSectionLink); |
420 |
| - var leftNavSectionItemIcon = leftNavSectionItem.querySelector(_this10.options.selectorLeftNavSectionIcon); |
421 |
| - var leftNavSectionItemIconUse = leftNavSectionItemIcon.querySelector('use'); |
422 |
| - var leftNavSectionValue = leftNavSectionItem.dataset.leftNavSection; |
423 |
| - |
424 |
| - if (_this10.leftNavSectionActive) { |
425 |
| - return { |
426 |
| - v: void 0 |
427 |
| - }; |
428 |
| - } |
429 |
| - _this10.leftNavSectionActive = true; |
430 |
| - |
431 |
| - var newLeftNavSectionItem = document.createElement('li'); |
432 |
| - newLeftNavSectionItem.setAttribute('data-left-nav-section', selectedLeftNavSectionValue); |
433 |
| - newLeftNavSectionItem.classList.add(_this10.options.classNavSection); |
434 |
| - newLeftNavSectionItem.classList.add(_this10.options.classNavSection + '--' + selectedLeftNavSectionValue); |
435 |
| - |
436 |
| - var newLeftNavSectionItemAnchor = document.createElement('a'); |
437 |
| - newLeftNavSectionItemAnchor.setAttribute('href', 'javascript:void(0)'); // eslint-disable-line no-script-url |
438 |
| - newLeftNavSectionItemAnchor.setAttribute('tabindex', 0); |
439 |
| - newLeftNavSectionItemAnchor.classList.add(_this10.options.classNavSectionAnchor); |
440 |
| - |
441 |
| - var newLeftNavSectionItemIcon = selectedLeftNavSectionItemIcon.cloneNode(true); |
442 |
| - // IE11 doesn't support classList on SVG, must revert to className |
443 |
| - newLeftNavSectionItemIcon.setAttribute('class', 'bx--left-nav__section--taxonomy-icon'); |
444 |
| - newLeftNavSectionItemIcon.removeAttribute('data-left-nav-current-section-icon'); |
445 |
| - newLeftNavSectionItemIcon.setAttribute('data-left-nav-section-icon', selectedLeftNavSectionValue); |
446 |
| - |
447 |
| - var newLeftNavSectionItemLink = document.createElement('span'); |
448 |
| - newLeftNavSectionItemLink.setAttribute('data-left-nav-section-link', ''); |
449 |
| - newLeftNavSectionItemLink.classList.add(_this10.options.classNavSectionLink); |
450 |
| - newLeftNavSectionItemLink.textContent = selectedLeftNavSectionItemTitle.textContent; |
451 |
| - |
452 |
| - _this10.animateNavSection(leftNavSectionItem); |
453 |
| - _this10.animateNavList(leftNavSectionValue); |
454 |
| - |
455 |
| - newLeftNavSectionItemAnchor.appendChild(newLeftNavSectionItemIcon); |
456 |
| - newLeftNavSectionItemAnchor.appendChild(newLeftNavSectionItemLink); |
457 |
| - newLeftNavSectionItem.appendChild(newLeftNavSectionItemAnchor); |
458 |
| - leftNavSections.insertBefore(newLeftNavSectionItem, leftNavSections.firstChild); |
459 |
| - |
460 |
| - setTimeout(function () { |
461 |
| - selectedLeftNavSectionItemTitle.textContent = leftNavSectionItemLink.textContent; |
462 |
| - selectedLeftNavSectionItem.setAttribute('data-left-nav-current-section', leftNavSectionValue); |
463 |
| - selectedLeftNavSectionItemIcon.setAttribute('data-left-nav-current-section-icon', leftNavSectionValue); |
464 |
| - selectedLeftNavSectionItemUse.setAttribute('xlink:href', leftNavSectionItemIconUse.getAttribute('xlink:href')); |
465 |
| - |
466 |
| - leftNavSectionItem.parentNode.removeChild(leftNavSectionItem); // Cant use .remove() because of IE11 |
467 |
| - _this10.leftNavSectionActive = false; |
468 |
| - }, 450); // Wait for nav items to animate |
469 |
| - }(); |
470 |
| - |
471 |
| - if ((typeof _ret === 'undefined' ? 'undefined' : (0, _typeof3.default)(_ret)) === "object") return _ret.v; |
| 408 | + // currently selected |
| 409 | + var selectedLeftNavSectionItem = this.element.querySelector(this.options.selectorLeftNavCurrentSection); |
| 410 | + var selectedLeftNavSectionItemTitle = selectedLeftNavSectionItem.querySelector(this.options.selectorLeftNavCurrentSectionTitle); |
| 411 | + var selectedLeftNavSectionItemIcon = this.element.querySelector(this.options.selectorLeftNavCurrentSectionIcon); |
| 412 | + var selectedLeftNavSectionItemUse = selectedLeftNavSectionItemIcon.querySelector('use'); |
| 413 | + var selectedLeftNavSectionValue = selectedLeftNavSectionItem.dataset.leftNavCurrentSection; |
| 414 | + |
| 415 | + // clicked on item |
| 416 | + var leftNavSectionItemLink = leftNavSectionItem.querySelector(this.options.selectorLeftNavSectionLink); |
| 417 | + var leftNavSectionItemIcon = leftNavSectionItem.querySelector(this.options.selectorLeftNavSectionIcon); |
| 418 | + var leftNavSectionItemIconUse = leftNavSectionItemIcon.querySelector('use'); |
| 419 | + var leftNavSectionValue = leftNavSectionItem.dataset.leftNavSection; |
| 420 | + |
| 421 | + if (this.leftNavSectionActive) { |
| 422 | + return; |
| 423 | + } |
| 424 | + this.leftNavSectionActive = true; |
| 425 | + |
| 426 | + var newLeftNavSectionItem = document.createElement('li'); |
| 427 | + newLeftNavSectionItem.setAttribute('data-left-nav-section', selectedLeftNavSectionValue); |
| 428 | + newLeftNavSectionItem.classList.add(this.options.classNavSection); |
| 429 | + newLeftNavSectionItem.classList.add(this.options.classNavSection + '--' + selectedLeftNavSectionValue); |
| 430 | + |
| 431 | + var newLeftNavSectionItemAnchor = document.createElement('a'); |
| 432 | + newLeftNavSectionItemAnchor.setAttribute('href', 'javascript:void(0)'); // eslint-disable-line no-script-url |
| 433 | + newLeftNavSectionItemAnchor.setAttribute('tabindex', 0); |
| 434 | + newLeftNavSectionItemAnchor.classList.add(this.options.classNavSectionAnchor); |
| 435 | + |
| 436 | + var newLeftNavSectionItemIcon = selectedLeftNavSectionItemIcon.cloneNode(true); |
| 437 | + // IE11 doesn't support classList on SVG, must revert to className |
| 438 | + newLeftNavSectionItemIcon.setAttribute('class', 'bx--left-nav__section--taxonomy-icon'); |
| 439 | + newLeftNavSectionItemIcon.removeAttribute('data-left-nav-current-section-icon'); |
| 440 | + newLeftNavSectionItemIcon.setAttribute('data-left-nav-section-icon', selectedLeftNavSectionValue); |
| 441 | + |
| 442 | + var newLeftNavSectionItemLink = document.createElement('span'); |
| 443 | + newLeftNavSectionItemLink.setAttribute('data-left-nav-section-link', ''); |
| 444 | + newLeftNavSectionItemLink.classList.add(this.options.classNavSectionLink); |
| 445 | + newLeftNavSectionItemLink.textContent = selectedLeftNavSectionItemTitle.textContent; |
| 446 | + |
| 447 | + this.animateNavSection(leftNavSectionItem); |
| 448 | + this.animateNavList(leftNavSectionValue); |
| 449 | + |
| 450 | + newLeftNavSectionItemAnchor.appendChild(newLeftNavSectionItemIcon); |
| 451 | + newLeftNavSectionItemAnchor.appendChild(newLeftNavSectionItemLink); |
| 452 | + newLeftNavSectionItem.appendChild(newLeftNavSectionItemAnchor); |
| 453 | + leftNavSections.insertBefore(newLeftNavSectionItem, leftNavSections.firstChild); |
| 454 | + |
| 455 | + setTimeout(function () { |
| 456 | + selectedLeftNavSectionItemTitle.textContent = leftNavSectionItemLink.textContent; |
| 457 | + selectedLeftNavSectionItem.setAttribute('data-left-nav-current-section', leftNavSectionValue); |
| 458 | + selectedLeftNavSectionItemIcon.setAttribute('data-left-nav-current-section-icon', leftNavSectionValue); |
| 459 | + selectedLeftNavSectionItemUse.setAttribute('xlink:href', leftNavSectionItemIconUse.getAttribute('xlink:href')); |
| 460 | + |
| 461 | + leftNavSectionItem.parentNode.removeChild(leftNavSectionItem); // Cant use .remove() because of IE11 |
| 462 | + _this10.leftNavSectionActive = false; |
| 463 | + }, 450); // Wait for nav items to animate |
472 | 464 | }
|
473 | 465 | }
|
474 | 466 | }, {
|
|
0 commit comments