diff options
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/tab.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/tab.js | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/tab.js b/vendor/twbs/bootstrap/js/dist/tab.js index 386152b69..b40169ca3 100644 --- a/vendor/twbs/bootstrap/js/dist/tab.js +++ b/vendor/twbs/bootstrap/js/dist/tab.js @@ -1,19 +1,26 @@ /*! - * Bootstrap tab.js v5.0.2 (https://getbootstrap.com/) + * Bootstrap tab.js v5.1.2 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/event-handler.js'), require('./base-component.js')) : - typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './base-component'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.SelectorEngine, global.EventHandler, global.Base)); -}(this, (function (SelectorEngine, EventHandler, BaseComponent) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : + typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/selector-engine', './base-component'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.EventHandler, global.SelectorEngine, global.Base)); +})(this, (function (EventHandler, SelectorEngine, BaseComponent) { 'use strict'; - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e }; - var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine); - var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); - var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent); + const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); + const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine); + const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent); + + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.2): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ const getSelector = element => { let selector = element.getAttribute('data-bs-target'); @@ -59,8 +66,20 @@ return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; }; + /** + * Trick to restart an element's animation + * + * @param {HTMLElement} element + * @return void + * + * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation + */ - const reflow = element => element.offsetHeight; + + const reflow = element => { + // eslint-disable-next-line no-unused-expressions + element.offsetHeight; + }; const getjQuery = () => { const { @@ -112,7 +131,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.0.2): tab.js + * Bootstrap (v5.1.2): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -148,7 +167,7 @@ * ------------------------------------------------------------------------ */ - class Tab extends BaseComponent__default['default'] { + class Tab extends BaseComponent__default.default { // Getters static get NAME() { return NAME; @@ -167,14 +186,14 @@ if (listElement) { const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; - previous = SelectorEngine__default['default'].find(itemSelector, listElement); + previous = SelectorEngine__default.default.find(itemSelector, listElement); previous = previous[previous.length - 1]; } - const hideEvent = previous ? EventHandler__default['default'].trigger(previous, EVENT_HIDE, { + const hideEvent = previous ? EventHandler__default.default.trigger(previous, EVENT_HIDE, { relatedTarget: this._element }) : null; - const showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, { + const showEvent = EventHandler__default.default.trigger(this._element, EVENT_SHOW, { relatedTarget: previous }); @@ -185,10 +204,10 @@ this._activate(this._element, listElement); const complete = () => { - EventHandler__default['default'].trigger(previous, EVENT_HIDDEN, { + EventHandler__default.default.trigger(previous, EVENT_HIDDEN, { relatedTarget: this._element }); - EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, { + EventHandler__default.default.trigger(this._element, EVENT_SHOWN, { relatedTarget: previous }); }; @@ -202,7 +221,7 @@ _activate(element, container, callback) { - const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine__default['default'].find(SELECTOR_ACTIVE_UL, container) : SelectorEngine__default['default'].children(container, SELECTOR_ACTIVE); + const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine__default.default.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine__default.default.children(container, SELECTOR_ACTIVE); const active = activeElements[0]; const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE); @@ -220,7 +239,7 @@ _transitionComplete(element, active, callback) { if (active) { active.classList.remove(CLASS_NAME_ACTIVE); - const dropdownChild = SelectorEngine__default['default'].findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode); + const dropdownChild = SelectorEngine__default.default.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode); if (dropdownChild) { dropdownChild.classList.remove(CLASS_NAME_ACTIVE); @@ -253,7 +272,7 @@ const dropdownElement = element.closest(SELECTOR_DROPDOWN); if (dropdownElement) { - SelectorEngine__default['default'].find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); + SelectorEngine__default.default.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); } element.setAttribute('aria-expanded', true); @@ -287,7 +306,7 @@ */ - EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { + EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { if (['A', 'AREA'].includes(this.tagName)) { event.preventDefault(); } @@ -310,5 +329,5 @@ return Tab; -}))); +})); //# sourceMappingURL=tab.js.map |