diff options
Diffstat (limited to 'dist/js/bootstrap.esm.js')
-rw-r--r-- | dist/js/bootstrap.esm.js | 274 |
1 files changed, 107 insertions, 167 deletions
diff --git a/dist/js/bootstrap.esm.js b/dist/js/bootstrap.esm.js index b878149a61..d90b2ef36e 100644 --- a/dist/js/bootstrap.esm.js +++ b/dist/js/bootstrap.esm.js @@ -1,7 +1,7 @@ /*! * Bootstrap v5.0.0-alpha1 (https://getbootstrap.com/) * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ import Popper from 'popper.js'; @@ -79,7 +79,7 @@ function _inheritsLoose(subClass, superClass) { /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-alpha1): util/index.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ var MAX_UID = 1000000; @@ -254,7 +254,7 @@ var getjQuery = function getjQuery() { /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-alpha1): dom/data.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -393,7 +393,7 @@ if (!supportScopeQuery) { /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-alpha1): dom/event-handler.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** @@ -830,90 +830,6 @@ if ($$1) { } /** - * -------------------------------------------------------------------------- - * Bootstrap (v5.0.0-alpha1): dom/selector-engine.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ -/** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - -var NODE_TEXT = 3; -var SelectorEngine = { - matches: function matches(element, selector) { - return element.matches(selector); - }, - find: function find$1(selector, element) { - var _ref; - - if (element === void 0) { - element = document.documentElement; - } - - return (_ref = []).concat.apply(_ref, find.call(element, selector)); - }, - findOne: function findOne$1(selector, element) { - if (element === void 0) { - element = document.documentElement; - } - - return findOne.call(element, selector); - }, - children: function children(element, selector) { - var _ref2; - - var children = (_ref2 = []).concat.apply(_ref2, element.children); - - return children.filter(function (child) { - return child.matches(selector); - }); - }, - parents: function parents(element, selector) { - var parents = []; - var ancestor = element.parentNode; - - while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) { - if (this.matches(ancestor, selector)) { - parents.push(ancestor); - } - - ancestor = ancestor.parentNode; - } - - return parents; - }, - prev: function prev(element, selector) { - var previous = element.previousElementSibling; - - while (previous) { - if (previous.matches(selector)) { - return [previous]; - } - - previous = previous.previousElementSibling; - } - - return []; - }, - next: function next(element, selector) { - var next = element.nextElementSibling; - - while (next) { - if (this.matches(next, selector)) { - return [next]; - } - - next = next.nextElementSibling; - } - - return []; - } -}; - -/** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ @@ -925,16 +841,8 @@ var DATA_KEY$1 = 'bs.button'; var EVENT_KEY$1 = "." + DATA_KEY$1; var DATA_API_KEY$1 = '.data-api'; var CLASS_NAME_ACTIVE = 'active'; -var CLASS_NAME_DISABLED = 'disabled'; -var CLASS_NAME_FOCUS = 'focus'; -var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; -var SELECTOR_DATA_TOGGLE = '[data-toggle="buttons"]'; -var SELECTOR_INPUT = 'input:not([type="hidden"])'; -var SELECTOR_ACTIVE = '.active'; -var SELECTOR_BUTTON = '.btn'; +var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]'; var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1; -var EVENT_FOCUS_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1; -var EVENT_BLUR_DATA_API = "blur" + EVENT_KEY$1 + DATA_API_KEY$1; /** * ------------------------------------------------------------------------ * Class Definition @@ -952,46 +860,8 @@ var Button = /*#__PURE__*/function () { // Public _proto.toggle = function toggle() { - var triggerChangeEvent = true; - var addAriaPressed = true; - - var rootElement = this._element.closest(SELECTOR_DATA_TOGGLE); - - if (rootElement) { - var input = SelectorEngine.findOne(SELECTOR_INPUT, this._element); - - if (input && input.type === 'radio') { - if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) { - triggerChangeEvent = false; - } else { - var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE, rootElement); - - if (activeElement) { - activeElement.classList.remove(CLASS_NAME_ACTIVE); - } - } - - if (triggerChangeEvent) { - if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains(CLASS_NAME_DISABLED) || rootElement.classList.contains(CLASS_NAME_DISABLED)) { - return; - } - - input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE); - EventHandler.trigger(input, 'change'); - } - - input.focus(); - addAriaPressed = false; - } - } - - if (addAriaPressed) { - this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE)); - } - - if (triggerChangeEvent) { - this._element.classList.toggle(CLASS_NAME_ACTIVE); - } + // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method + this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE)); }; _proto.dispose = function dispose() { @@ -1034,9 +904,9 @@ var Button = /*#__PURE__*/function () { */ -EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) { +EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE, function (event) { event.preventDefault(); - var button = event.target.closest(SELECTOR_BUTTON); + var button = event.target.closest(SELECTOR_DATA_TOGGLE); var data = Data.getData(button, DATA_KEY$1); if (!data) { @@ -1045,20 +915,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, f data.toggle(); }); -EventHandler.on(document, EVENT_FOCUS_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { - var button = event.target.closest(SELECTOR_BUTTON); - - if (button) { - button.classList.add(CLASS_NAME_FOCUS); - } -}); -EventHandler.on(document, EVENT_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { - var button = event.target.closest(SELECTOR_BUTTON); - - if (button) { - button.classList.remove(CLASS_NAME_FOCUS); - } -}); var $$2 = getjQuery(); /** * ------------------------------------------------------------------------ @@ -1083,7 +939,7 @@ if ($$2) { /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-alpha1): dom/manipulator.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ function normalizeData(val) { @@ -1161,6 +1017,90 @@ var Manipulator = { }; /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-alpha1): dom/selector-engine.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +var NODE_TEXT = 3; +var SelectorEngine = { + matches: function matches(element, selector) { + return element.matches(selector); + }, + find: function find$1(selector, element) { + var _ref; + + if (element === void 0) { + element = document.documentElement; + } + + return (_ref = []).concat.apply(_ref, find.call(element, selector)); + }, + findOne: function findOne$1(selector, element) { + if (element === void 0) { + element = document.documentElement; + } + + return findOne.call(element, selector); + }, + children: function children(element, selector) { + var _ref2; + + var children = (_ref2 = []).concat.apply(_ref2, element.children); + + return children.filter(function (child) { + return child.matches(selector); + }); + }, + parents: function parents(element, selector) { + var parents = []; + var ancestor = element.parentNode; + + while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) { + if (this.matches(ancestor, selector)) { + parents.push(ancestor); + } + + ancestor = ancestor.parentNode; + } + + return parents; + }, + prev: function prev(element, selector) { + var previous = element.previousElementSibling; + + while (previous) { + if (previous.matches(selector)) { + return [previous]; + } + + previous = previous.previousElementSibling; + } + + return []; + }, + next: function next(element, selector) { + var next = element.nextElementSibling; + + while (next) { + if (this.matches(next, selector)) { + return [next]; + } + + next = next.nextElementSibling; + } + + return []; + } +}; + +/** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ @@ -1217,7 +1157,7 @@ var CLASS_NAME_LEFT = 'carousel-item-left'; var CLASS_NAME_NEXT = 'carousel-item-next'; var CLASS_NAME_PREV = 'carousel-item-prev'; var CLASS_NAME_POINTER_EVENT = 'pointer-event'; -var SELECTOR_ACTIVE$1 = '.active'; +var SELECTOR_ACTIVE = '.active'; var SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; var SELECTOR_ITEM = '.carousel-item'; var SELECTOR_ITEM_IMG = '.carousel-item img'; @@ -1532,7 +1472,7 @@ var Carousel = /*#__PURE__*/function () { _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { if (this._indicatorsElement) { - var indicators = SelectorEngine.find(SELECTOR_ACTIVE$1, this._indicatorsElement); + var indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement); for (var i = 0; i < indicators.length; i++) { indicators[i].classList.remove(CLASS_NAME_ACTIVE$1); @@ -2187,7 +2127,7 @@ var EVENT_CLICK = "click" + EVENT_KEY$4; var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4; var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4; var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4; -var CLASS_NAME_DISABLED$1 = 'disabled'; +var CLASS_NAME_DISABLED = 'disabled'; var CLASS_NAME_SHOW$1 = 'show'; var CLASS_NAME_DROPUP = 'dropup'; var CLASS_NAME_DROPRIGHT = 'dropright'; @@ -2246,7 +2186,7 @@ var Dropdown = /*#__PURE__*/function () { // Public _proto.toggle = function toggle() { - if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1)) { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) { return; } @@ -2262,7 +2202,7 @@ var Dropdown = /*#__PURE__*/function () { }; _proto.show = function show() { - if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1) || this._menu.classList.contains(CLASS_NAME_SHOW$1)) { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$1)) { return; } @@ -2326,7 +2266,7 @@ var Dropdown = /*#__PURE__*/function () { }; _proto.hide = function hide() { - if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1) || !this._menu.classList.contains(CLASS_NAME_SHOW$1)) { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$1)) { return; } @@ -2561,7 +2501,7 @@ var Dropdown = /*#__PURE__*/function () { event.preventDefault(); event.stopPropagation(); - if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED$1)) { + if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) { return; } @@ -3284,7 +3224,7 @@ if ($$6) { /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-alpha1): util/sanitizer.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; @@ -4667,12 +4607,12 @@ var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9; var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7; var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; var CLASS_NAME_ACTIVE$3 = 'active'; -var CLASS_NAME_DISABLED$2 = 'disabled'; +var CLASS_NAME_DISABLED$1 = 'disabled'; var CLASS_NAME_FADE$3 = 'fade'; var CLASS_NAME_SHOW$5 = 'show'; var SELECTOR_DROPDOWN$1 = '.dropdown'; var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; -var SELECTOR_ACTIVE$2 = '.active'; +var SELECTOR_ACTIVE$1 = '.active'; var SELECTOR_ACTIVE_UL = ':scope > li > .active'; var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'; var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; @@ -4696,7 +4636,7 @@ var Tab = /*#__PURE__*/function () { _proto.show = function show() { var _this = this; - if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE$3) || this._element.classList.contains(CLASS_NAME_DISABLED$2)) { + if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE$3) || this._element.classList.contains(CLASS_NAME_DISABLED$1)) { return; } @@ -4706,7 +4646,7 @@ var Tab = /*#__PURE__*/function () { var listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP$1); if (listElement) { - var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2; + var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$1; previous = SelectorEngine.find(itemSelector, listElement); previous = previous[previous.length - 1]; } @@ -4754,7 +4694,7 @@ var Tab = /*#__PURE__*/function () { _proto._activate = function _activate(element, container, callback) { var _this2 = this; - var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE$2); + var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE$1); var active = activeElements[0]; var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$3); |