Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dist/js/bootstrap.bundle.js')
-rw-r--r--dist/js/bootstrap.bundle.js985
1 files changed, 467 insertions, 518 deletions
diff --git a/dist/js/bootstrap.bundle.js b/dist/js/bootstrap.bundle.js
index 2bd91036a2..1678cd21a7 100644
--- a/dist/js/bootstrap.bundle.js
+++ b/dist/js/bootstrap.bundle.js
@@ -1,6 +1,6 @@
/*!
- * Bootstrap v5.0.0-beta1 (https://getbootstrap.com/)
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Bootstrap v5.0.0-beta2 (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) {
@@ -46,12 +46,22 @@
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
- subClass.__proto__ = superClass;
+
+ _setPrototypeOf(subClass, superClass);
+ }
+
+ function _setPrototypeOf(o, p) {
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
+ o.__proto__ = p;
+ return o;
+ };
+
+ return _setPrototypeOf(o, p);
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-beta1): util/index.js
+ * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -85,7 +95,20 @@
var selector = element.getAttribute('data-bs-target');
if (!selector || selector === '#') {
- var hrefAttr = element.getAttribute('href');
+ var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
+ // `document.querySelector` will rightfully complain it is invalid.
+ // See https://github.com/twbs/bootstrap/issues/32273
+
+ if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
+ return null;
+ } // Just in case some CMS puts out a full URL with the anchor appended
+
+
+ if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
+ hrefAttr = '#' + hrefAttr.split('#')[1];
+ }
+
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
}
@@ -163,7 +186,7 @@
var valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) {
- throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
+ throw new TypeError(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
}
});
};
@@ -234,9 +257,27 @@
var isRTL = document.documentElement.dir === 'rtl';
+ var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
+ onDOMContentLoaded(function () {
+ var $ = getjQuery();
+ /* istanbul ignore if */
+
+ if ($) {
+ var JQUERY_NO_CONFLICT = $.fn[name];
+ $.fn[name] = plugin.jQueryInterface;
+ $.fn[name].Constructor = plugin;
+
+ $.fn[name].noConflict = function () {
+ $.fn[name] = JQUERY_NO_CONFLICT;
+ return plugin.jQueryInterface;
+ };
+ }
+ });
+ };
+
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-beta1): dom/data.js
+ * Bootstrap (v5.0.0-beta2): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -303,7 +344,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-beta1): dom/event-handler.js
+ * Bootstrap (v5.0.0-beta2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -363,6 +404,7 @@
event.delegateTarget = target;
if (handler.oneOff) {
+ // eslint-disable-next-line unicorn/consistent-destructuring
EventHandler.off(element, event.type, fn);
}
@@ -582,7 +624,7 @@
* ------------------------------------------------------------------------
*/
- var VERSION = '5.0.0-beta1';
+ var VERSION = '5.0.0-beta2';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
@@ -631,9 +673,9 @@
var EVENT_CLOSE = "close" + EVENT_KEY;
var EVENT_CLOSED = "closed" + EVENT_KEY;
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
- var CLASSNAME_ALERT = 'alert';
- var CLASSNAME_FADE = 'fade';
- var CLASSNAME_SHOW = 'show';
+ var CLASS_NAME_ALERT = 'alert';
+ var CLASS_NAME_FADE = 'fade';
+ var CLASS_NAME_SHOW = 'show';
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -664,7 +706,7 @@
;
_proto._getRootElement = function _getRootElement(element) {
- return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
+ return getElementFromSelector(element) || element.closest("." + CLASS_NAME_ALERT);
};
_proto._triggerCloseEvent = function _triggerCloseEvent(element) {
@@ -674,16 +716,16 @@
_proto._removeElement = function _removeElement(element) {
var _this = this;
- element.classList.remove(CLASSNAME_SHOW);
+ element.classList.remove(CLASS_NAME_SHOW);
- if (!element.classList.contains(CLASSNAME_FADE)) {
+ if (!element.classList.contains(CLASS_NAME_FADE)) {
this._destroyElement(element);
return;
}
var transitionDuration = getTransitionDurationFromElement(element);
- EventHandler.one(element, TRANSITION_END, function () {
+ EventHandler.one(element, 'transitionend', function () {
return _this._destroyElement(element);
});
emulateTransitionEnd(element, transitionDuration);
@@ -724,8 +766,8 @@
_createClass(Alert, null, [{
key: "DATA_KEY",
- // Getters
- get: function get() {
+ get: // Getters
+ function get() {
return DATA_KEY;
}
}]);
@@ -747,21 +789,7 @@
* add .Alert to jQuery only if jQuery is present
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- $.fn[NAME] = Alert.jQueryInterface;
- $.fn[NAME].Constructor = Alert;
-
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return Alert.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME, Alert);
/**
* ------------------------------------------------------------------------
@@ -814,8 +842,8 @@
_createClass(Button, null, [{
key: "DATA_KEY",
- // Getters
- get: function get() {
+ get: // Getters
+ function get() {
return DATA_KEY$1;
}
}]);
@@ -847,25 +875,11 @@
* add .Button to jQuery only if jQuery is present
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$1];
- $.fn[NAME$1] = Button.jQueryInterface;
- $.fn[NAME$1].Constructor = Button;
-
- $.fn[NAME$1].noConflict = function () {
- $.fn[NAME$1] = JQUERY_NO_CONFLICT;
- return Button.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$1, Button);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-beta1): dom/manipulator.js
+ * Bootstrap (v5.0.0-beta2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -937,7 +951,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-beta1): dom/selector-engine.js
+ * Bootstrap (v5.0.0-beta2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -949,9 +963,6 @@
*/
var NODE_TEXT = 3;
var SelectorEngine = {
- matches: function matches(element, selector) {
- return element.matches(selector);
- },
find: function find(selector, element) {
var _ref;
@@ -971,9 +982,7 @@
children: function children(element, selector) {
var _ref2;
- var children = (_ref2 = []).concat.apply(_ref2, element.children);
-
- return children.filter(function (child) {
+ return (_ref2 = []).concat.apply(_ref2, element.children).filter(function (child) {
return child.matches(selector);
});
},
@@ -982,7 +991,7 @@
var ancestor = element.parentNode;
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
- if (this.matches(ancestor, selector)) {
+ if (ancestor.matches(selector)) {
parents.push(ancestor);
}
@@ -1008,7 +1017,7 @@
var next = element.nextElementSibling;
while (next) {
- if (this.matches(next, selector)) {
+ if (next.matches(selector)) {
return [next];
}
@@ -1081,12 +1090,11 @@
var SELECTOR_ITEM_IMG = '.carousel-item img';
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
var SELECTOR_INDICATORS = '.carousel-indicators';
+ var SELECTOR_INDICATOR = '[data-bs-target]';
var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
- var PointerType = {
- TOUCH: 'touch',
- PEN: 'pen'
- };
+ var POINTER_TYPE_TOUCH = 'touch';
+ var POINTER_TYPE_PEN = 'pen';
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -1233,12 +1241,20 @@
this.touchDeltaX = 0; // swipe left
if (direction > 0) {
- this.prev();
+ if (isRTL) {
+ this.next();
+ } else {
+ this.prev();
+ }
} // swipe right
if (direction < 0) {
- this.next();
+ if (isRTL) {
+ this.prev();
+ } else {
+ this.next();
+ }
}
};
@@ -1269,7 +1285,7 @@
var _this4 = this;
var start = function start(event) {
- if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
+ if (_this4._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
_this4.touchStartX = event.clientX;
} else if (!_this4._pointerEvent) {
_this4.touchStartX = event.touches[0].clientX;
@@ -1286,7 +1302,7 @@
};
var end = function end(event) {
- if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
+ if (_this4._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
_this4.touchDeltaX = event.clientX - _this4.touchStartX;
}
@@ -1345,16 +1361,22 @@
return;
}
- switch (event.key) {
- case ARROW_LEFT_KEY:
- event.preventDefault();
+ if (event.key === ARROW_LEFT_KEY) {
+ event.preventDefault();
+
+ if (isRTL) {
+ this.next();
+ } else {
this.prev();
- break;
+ }
+ } else if (event.key === ARROW_RIGHT_KEY) {
+ event.preventDefault();
- case ARROW_RIGHT_KEY:
- event.preventDefault();
+ if (isRTL) {
+ this.prev();
+ } else {
this.next();
- break;
+ }
}
};
@@ -1396,16 +1418,17 @@
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) {
- var indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
+ var activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
+ activeIndicator.classList.remove(CLASS_NAME_ACTIVE$1);
+ activeIndicator.removeAttribute('aria-current');
+ var indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
for (var i = 0; i < indicators.length; i++) {
- indicators[i].classList.remove(CLASS_NAME_ACTIVE$1);
- }
-
- var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
-
- if (nextIndicator) {
- nextIndicator.classList.add(CLASS_NAME_ACTIVE$1);
+ if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
+ indicators[i].classList.add(CLASS_NAME_ACTIVE$1);
+ indicators[i].setAttribute('aria-current', 'true');
+ break;
+ }
}
}
};
@@ -1439,19 +1462,9 @@
var nextElementIndex = this._getItemIndex(nextElement);
var isCycling = Boolean(this._interval);
- var directionalClassName;
- var orderClassName;
- var eventDirectionName;
-
- if (direction === DIRECTION_NEXT) {
- directionalClassName = CLASS_NAME_START;
- orderClassName = CLASS_NAME_NEXT;
- eventDirectionName = DIRECTION_LEFT;
- } else {
- directionalClassName = CLASS_NAME_END;
- orderClassName = CLASS_NAME_PREV;
- eventDirectionName = DIRECTION_RIGHT;
- }
+ var directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END;
+ var orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
+ var eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$1)) {
this._isSliding = false;
@@ -1485,7 +1498,7 @@
activeElement.classList.add(directionalClassName);
nextElement.classList.add(directionalClassName);
var transitionDuration = getTransitionDurationFromElement(activeElement);
- EventHandler.one(activeElement, TRANSITION_END, function () {
+ EventHandler.one(activeElement, 'transitionend', function () {
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE$1);
activeElement.classList.remove(CLASS_NAME_ACTIVE$1, orderClassName, directionalClassName);
@@ -1613,21 +1626,7 @@
* add .Carousel to jQuery only if jQuery is present
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$2];
- $.fn[NAME$2] = Carousel.jQueryInterface;
- $.fn[NAME$2].Constructor = Carousel;
-
- $.fn[NAME$2].noConflict = function () {
- $.fn[NAME$2] = JQUERY_NO_CONFLICT;
- return Carousel.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$2, Carousel);
/**
* ------------------------------------------------------------------------
@@ -1652,7 +1651,7 @@
var EVENT_HIDE = "hide" + EVENT_KEY$3;
var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
- var CLASS_NAME_SHOW = 'show';
+ var CLASS_NAME_SHOW$1 = 'show';
var CLASS_NAME_COLLAPSE = 'collapse';
var CLASS_NAME_COLLAPSING = 'collapsing';
var CLASS_NAME_COLLAPSED = 'collapsed';
@@ -1710,7 +1709,7 @@
// Public
_proto.toggle = function toggle() {
- if (this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (this._element.classList.contains(CLASS_NAME_SHOW$1)) {
this.hide();
} else {
this.show();
@@ -1720,7 +1719,7 @@
_proto.show = function show() {
var _this2 = this;
- if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$1)) {
return;
}
@@ -1792,7 +1791,7 @@
var complete = function complete() {
_this2._element.classList.remove(CLASS_NAME_COLLAPSING);
- _this2._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
+ _this2._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$1);
_this2._element.style[dimension] = '';
@@ -1804,7 +1803,7 @@
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
var scrollSize = "scroll" + capitalizedDimension;
var transitionDuration = getTransitionDurationFromElement(this._element);
- EventHandler.one(this._element, TRANSITION_END, complete);
+ EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
this._element.style[dimension] = this._element[scrollSize] + "px";
};
@@ -1812,7 +1811,7 @@
_proto.hide = function hide() {
var _this3 = this;
- if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
+ if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$1)) {
return;
}
@@ -1829,7 +1828,7 @@
this._element.classList.add(CLASS_NAME_COLLAPSING);
- this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
+ this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$1);
var triggerArrayLength = this._triggerArray.length;
@@ -1838,7 +1837,7 @@
var trigger = this._triggerArray[i];
var elem = getElementFromSelector(trigger);
- if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
+ if (elem && !elem.classList.contains(CLASS_NAME_SHOW$1)) {
trigger.classList.add(CLASS_NAME_COLLAPSED);
trigger.setAttribute('aria-expanded', false);
}
@@ -1859,7 +1858,7 @@
this._element.style[dimension] = '';
var transitionDuration = getTransitionDurationFromElement(this._element);
- EventHandler.one(this._element, TRANSITION_END, complete);
+ EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
};
@@ -1917,7 +1916,7 @@
return;
}
- var isOpen = element.classList.contains(CLASS_NAME_SHOW);
+ var isOpen = element.classList.contains(CLASS_NAME_SHOW$1);
triggerArray.forEach(function (elem) {
if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED);
@@ -1981,7 +1980,7 @@
EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
- if (event.target.tagName === 'A') {
+ if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
event.preventDefault();
}
@@ -2014,21 +2013,7 @@
* add .Collapse to jQuery only if jQuery is present
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$3];
- $.fn[NAME$3] = Collapse.jQueryInterface;
- $.fn[NAME$3].Constructor = Collapse;
-
- $.fn[NAME$3].noConflict = function () {
- $.fn[NAME$3] = JQUERY_NO_CONFLICT;
- return Collapse.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$3, Collapse);
var top = 'top';
var bottom = 'bottom';
@@ -2115,7 +2100,7 @@
return;
} // Flow doesn't support to extend this property, but it's the most
// effective way to apply styles to an HTMLElement
- // $FlowFixMe
+ // $FlowFixMe[cannot-write]
Object.assign(element.style, style);
@@ -2164,10 +2149,7 @@
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
- } // Flow doesn't support to extend this property, but it's the most
- // effective way to apply styles to an HTMLElement
- // $FlowFixMe
-
+ }
Object.assign(element.style, style);
Object.keys(attributes).forEach(function (attribute) {
@@ -2214,7 +2196,7 @@
do {
if (next && parent.isSameNode(next)) {
return true;
- } // $FlowFixMe: need a better way to handle this...
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
next = next.parentNode || next.host;
@@ -2234,8 +2216,9 @@
}
function getDocumentElement(element) {
- // $FlowFixMe: assume body is always available
- return ((isElement$1(element) ? element.ownerDocument : element.document) || window.document).documentElement;
+ // $FlowFixMe[incompatible-return]: assume body is always available
+ return ((isElement$1(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
+ element.document) || window.document).documentElement;
}
function getParentNode(element) {
@@ -2243,12 +2226,14 @@
return element;
}
- return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
+ // $FlowFixMe[incompatible-return]
+ // $FlowFixMe[prop-missing]
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
element.parentNode || // DOM Element detected
- // $FlowFixMe: need a better way to handle this...
+ // $FlowFixMe[incompatible-return]: need a better way to handle this...
element.host || // ShadowRoot detected
- // $FlowFixMe: HTMLElement is a Node
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
getDocumentElement(element) // fallback
);
@@ -2426,7 +2411,7 @@
// Zooming can change the DPR, but it seems to report a value that will
// cleanly divide the values into the appropriate subpixels.
- function roundOffsets(_ref) {
+ function roundOffsetsByDPR(_ref) {
var x = _ref.x,
y = _ref.y;
var win = window;
@@ -2446,11 +2431,14 @@
offsets = _ref2.offsets,
position = _ref2.position,
gpuAcceleration = _ref2.gpuAcceleration,
- adaptive = _ref2.adaptive;
+ adaptive = _ref2.adaptive,
+ roundOffsets = _ref2.roundOffsets;
- var _roundOffsets = roundOffsets(offsets),
- x = _roundOffsets.x,
- y = _roundOffsets.y;
+ var _ref3 = roundOffsets ? roundOffsetsByDPR(offsets) : offsets,
+ _ref3$x = _ref3.x,
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
+ _ref3$y = _ref3.y,
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
var hasX = offsets.hasOwnProperty('x');
var hasY = offsets.hasOwnProperty('y');
@@ -2463,7 +2451,7 @@
if (offsetParent === getWindow(popper)) {
offsetParent = getDocumentElement(popper);
- } // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
/*:: offsetParent = (offsetParent: Element); */
@@ -2494,13 +2482,15 @@
return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
}
- function computeStyles(_ref3) {
- var state = _ref3.state,
- options = _ref3.options;
+ function computeStyles(_ref4) {
+ var state = _ref4.state,
+ options = _ref4.options;
var _options$gpuAccelerat = options.gpuAcceleration,
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
_options$adaptive = options.adaptive,
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
+ _options$roundOffsets = options.roundOffsets,
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
var commonStyles = {
placement: getBasePlacement(state.placement),
@@ -2513,7 +2503,8 @@
state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
offsets: state.modifiersData.popperOffsets,
position: state.options.strategy,
- adaptive: adaptive
+ adaptive: adaptive,
+ roundOffsets: roundOffsets
})));
}
@@ -2521,7 +2512,8 @@
state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
offsets: state.modifiersData.arrow,
position: 'absolute',
- adaptive: false
+ adaptive: false,
+ roundOffsets: roundOffsets
})));
}
@@ -2717,7 +2709,7 @@
function getScrollParent(node) {
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
- // $FlowFixMe: assume body is always available
+ // $FlowFixMe[incompatible-return]: assume body is always available
return node.ownerDocument.body;
}
@@ -2731,7 +2723,7 @@
/*
given a DOM element, return the list of all scroll parents, up the list of ancesors
until we get to the top window object. This list is what we attach scroll listeners
- to, because if any of these parent elements scroll, we'll need to re-calculate the
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
reference element's position.
*/
@@ -2745,7 +2737,7 @@
var win = getWindow(scrollParent);
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
- return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
updatedList.concat(listScrollParents(getParentNode(target)));
}
@@ -2785,7 +2777,7 @@
if (!isElement$1(clipperElement)) {
return [];
- } // $FlowFixMe: https://github.com/facebook/flow/issues/1414
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
return clippingParents.filter(function (clippingParent) {
@@ -2871,11 +2863,11 @@
switch (variation) {
case start:
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
break;
case end:
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
break;
}
}
@@ -2957,15 +2949,14 @@
var variation = getVariation(placement);
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
return getVariation(placement) === variation;
- }) : basePlacements; // $FlowFixMe
-
+ }) : basePlacements;
var allowedPlacements = placements$1.filter(function (placement) {
return allowedAutoPlacements.indexOf(placement) >= 0;
});
if (allowedPlacements.length === 0) {
allowedPlacements = placements$1;
- } // $FlowFixMe: Flow seems to have problems with two array unions...
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
var overflows = allowedPlacements.reduce(function (acc, placement) {
@@ -3772,7 +3763,7 @@
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 = 'disabled';
- var CLASS_NAME_SHOW$1 = 'show';
+ var CLASS_NAME_SHOW$2 = 'show';
var CLASS_NAME_DROPUP = 'dropup';
var CLASS_NAME_DROPEND = 'dropend';
var CLASS_NAME_DROPSTART = 'dropstart';
@@ -3789,7 +3780,7 @@
var PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
var PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
var Default$2 = {
- offset: 0,
+ offset: [0, 2],
flip: true,
boundary: 'clippingParents',
reference: 'toggle',
@@ -3797,12 +3788,12 @@
popperConfig: null
};
var DefaultType$2 = {
- offset: '(number|string|function)',
+ offset: '(array|string|function)',
flip: 'boolean',
boundary: '(string|element)',
- reference: '(string|element)',
+ reference: '(string|element|object)',
display: 'string',
- popperConfig: '(null|object)'
+ popperConfig: '(null|object|function)'
};
/**
* ------------------------------------------------------------------------
@@ -3836,7 +3827,7 @@
return;
}
- var isActive = this._element.classList.contains(CLASS_NAME_SHOW$1);
+ var isActive = this._element.classList.contains(CLASS_NAME_SHOW$2);
Dropdown.clearMenus();
@@ -3848,7 +3839,7 @@
};
_proto.show = function show() {
- if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || 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$2)) {
return;
}
@@ -3863,7 +3854,9 @@
} // Totally disable Popper for Dropdowns in Navbar
- if (!this._inNavbar) {
+ if (this._inNavbar) {
+ Manipulator.setDataAttribute(this._menu, 'popper', 'none');
+ } else {
if (typeof Popper === 'undefined') {
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
}
@@ -3878,9 +3871,20 @@
if (typeof this._config.reference.jquery !== 'undefined') {
referenceElement = this._config.reference[0];
}
+ } else if (typeof this._config.reference === 'object') {
+ referenceElement = this._config.reference;
}
- this._popper = createPopper$2(referenceElement, this._menu, this._getPopperConfig());
+ var popperConfig = this._getPopperConfig();
+
+ var isDisplayStatic = popperConfig.modifiers.find(function (modifier) {
+ return modifier.name === 'applyStyles' && modifier.enabled === false;
+ });
+ this._popper = createPopper$2(referenceElement, this._menu, popperConfig);
+
+ if (isDisplayStatic) {
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static');
+ }
} // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
@@ -3899,23 +3903,22 @@
this._element.setAttribute('aria-expanded', true);
- this._menu.classList.toggle(CLASS_NAME_SHOW$1);
+ this._menu.classList.toggle(CLASS_NAME_SHOW$2);
- this._element.classList.toggle(CLASS_NAME_SHOW$1);
+ this._element.classList.toggle(CLASS_NAME_SHOW$2);
- EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget);
+ EventHandler.trigger(this._element, EVENT_SHOWN$1, relatedTarget);
};
_proto.hide = function hide() {
- if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !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$2)) {
return;
}
- var parent = Dropdown.getParentFromElement(this._element);
var relatedTarget = {
relatedTarget: this._element
};
- var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
+ var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$1, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
@@ -3925,11 +3928,12 @@
this._popper.destroy();
}
- this._menu.classList.toggle(CLASS_NAME_SHOW$1);
+ this._menu.classList.toggle(CLASS_NAME_SHOW$2);
- this._element.classList.toggle(CLASS_NAME_SHOW$1);
+ this._element.classList.toggle(CLASS_NAME_SHOW$2);
- EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
+ Manipulator.removeDataAttribute(this._menu, 'popper');
+ EventHandler.trigger(this._element, EVENT_HIDDEN$1, relatedTarget);
};
_proto.dispose = function dispose() {
@@ -3968,6 +3972,12 @@
_proto._getConfig = function _getConfig(config) {
config = _extends({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config);
typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
+
+ if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
+ // Popper virtual elements require a getBoundingClientRect method
+ throw new TypeError(NAME$4.toUpperCase() + ": Option \"reference\" provided type \"object\" without a required \"getBoundingClientRect\" method.");
+ }
+
return config;
};
@@ -4000,26 +4010,51 @@
return this._element.closest("." + CLASS_NAME_NAVBAR) !== null;
};
+ _proto._getOffset = function _getOffset() {
+ var _this3 = this;
+
+ var offset = this._config.offset;
+
+ if (typeof offset === 'string') {
+ return offset.split(',').map(function (val) {
+ return Number.parseInt(val, 10);
+ });
+ }
+
+ if (typeof offset === 'function') {
+ return function (popperData) {
+ return offset(popperData, _this3._element);
+ };
+ }
+
+ return offset;
+ };
+
_proto._getPopperConfig = function _getPopperConfig() {
- var popperConfig = {
+ var defaultBsPopperConfig = {
placement: this._getPlacement(),
modifiers: [{
name: 'preventOverflow',
options: {
altBoundary: this._config.flip,
- rootBoundary: this._config.boundary
+ boundary: this._config.boundary
+ }
+ }, {
+ name: 'offset',
+ options: {
+ offset: this._getOffset()
}
}]
}; // Disable Popper if we have a static display
if (this._config.display === 'static') {
- popperConfig.modifiers = [{
+ defaultBsPopperConfig.modifiers = [{
name: 'applyStyles',
enabled: false
}];
}
- return _extends({}, popperConfig, this._config.popperConfig);
+ return _extends({}, defaultBsPopperConfig, typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig);
} // Static
;
@@ -4055,7 +4090,6 @@
var toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$2);
for (var i = 0, len = toggles.length; i < len; i++) {
- var parent = Dropdown.getParentFromElement(toggles[i]);
var context = Data.getData(toggles[i], DATA_KEY$4);
var relatedTarget = {
relatedTarget: toggles[i]
@@ -4071,7 +4105,7 @@
var dropdownMenu = context._menu;
- if (!toggles[i].classList.contains(CLASS_NAME_SHOW$1)) {
+ if (!toggles[i].classList.contains(CLASS_NAME_SHOW$2)) {
continue;
}
@@ -4079,7 +4113,7 @@
continue;
}
- var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
+ var hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE$1, relatedTarget);
if (hideEvent.defaultPrevented) {
continue;
@@ -4101,9 +4135,10 @@
context._popper.destroy();
}
- dropdownMenu.classList.remove(CLASS_NAME_SHOW$1);
- toggles[i].classList.remove(CLASS_NAME_SHOW$1);
- EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
+ dropdownMenu.classList.remove(CLASS_NAME_SHOW$2);
+ toggles[i].classList.remove(CLASS_NAME_SHOW$2);
+ Manipulator.removeDataAttribute(dropdownMenu, 'popper');
+ EventHandler.trigger(toggles[i], EVENT_HIDDEN$1, relatedTarget);
}
};
@@ -4131,7 +4166,7 @@
}
var parent = Dropdown.getParentFromElement(this);
- var isActive = this.classList.contains(CLASS_NAME_SHOW$1);
+ var isActive = this.classList.contains(CLASS_NAME_SHOW$2);
if (event.key === ESCAPE_KEY) {
var button = this.matches(SELECTOR_DATA_TOGGLE$2) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$2)[0];
@@ -4140,6 +4175,14 @@
return;
}
+ if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
+ var _button = this.matches(SELECTOR_DATA_TOGGLE$2) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$2)[0];
+
+ _button.click();
+
+ return;
+ }
+
if (!isActive || event.key === SPACE_KEY) {
Dropdown.clearMenus();
return;
@@ -4212,21 +4255,7 @@
* add .Dropdown to jQuery only if jQuery is present
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$4];
- $.fn[NAME$4] = Dropdown.jQueryInterface;
- $.fn[NAME$4].Constructor = Dropdown;
-
- $.fn[NAME$4].noConflict = function () {
- $.fn[NAME$4] = JQUERY_NO_CONFLICT;
- return Dropdown.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$4, Dropdown);
/**
* ------------------------------------------------------------------------
@@ -4264,8 +4293,8 @@
var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
var CLASS_NAME_BACKDROP = 'modal-backdrop';
var CLASS_NAME_OPEN = 'modal-open';
- var CLASS_NAME_FADE = 'fade';
- var CLASS_NAME_SHOW$2 = 'show';
+ var CLASS_NAME_FADE$1 = 'fade';
+ var CLASS_NAME_SHOW$3 = 'show';
var CLASS_NAME_STATIC = 'modal-static';
var SELECTOR_DIALOG = '.modal-dialog';
var SELECTOR_MODAL_BODY = '.modal-body';
@@ -4312,7 +4341,7 @@
return;
}
- if (this._element.classList.contains(CLASS_NAME_FADE)) {
+ if (this._element.classList.contains(CLASS_NAME_FADE$1)) {
this._isTransitioning = true;
}
@@ -4371,7 +4400,7 @@
this._isShown = false;
- var transition = this._element.classList.contains(CLASS_NAME_FADE);
+ var transition = this._element.classList.contains(CLASS_NAME_FADE$1);
if (transition) {
this._isTransitioning = true;
@@ -4383,14 +4412,14 @@
EventHandler.off(document, EVENT_FOCUSIN);
- this._element.classList.remove(CLASS_NAME_SHOW$2);
+ this._element.classList.remove(CLASS_NAME_SHOW$3);
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
if (transition) {
var transitionDuration = getTransitionDurationFromElement(this._element);
- EventHandler.one(this._element, TRANSITION_END, function (event) {
+ EventHandler.one(this._element, 'transitionend', function (event) {
return _this3._hideModal(event);
});
emulateTransitionEnd(this._element, transitionDuration);
@@ -4437,7 +4466,7 @@
_proto._showElement = function _showElement(relatedTarget) {
var _this4 = this;
- var transition = this._element.classList.contains(CLASS_NAME_FADE);
+ var transition = this._element.classList.contains(CLASS_NAME_FADE$1);
var modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
@@ -4464,7 +4493,7 @@
reflow(this._element);
}
- this._element.classList.add(CLASS_NAME_SHOW$2);
+ this._element.classList.add(CLASS_NAME_SHOW$3);
if (this._config.focus) {
this._enforceFocus();
@@ -4483,7 +4512,7 @@
if (transition) {
var transitionDuration = getTransitionDurationFromElement(this._dialog);
- EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
+ EventHandler.one(this._dialog, 'transitionend', transitionComplete);
emulateTransitionEnd(this._dialog, transitionDuration);
} else {
transitionComplete();
@@ -4565,7 +4594,7 @@
_proto._showBackdrop = function _showBackdrop(callback) {
var _this9 = this;
- var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
+ var animate = this._element.classList.contains(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
if (this._isShown && this._config.backdrop) {
this._backdrop = document.createElement('div');
@@ -4597,7 +4626,7 @@
reflow(this._backdrop);
}
- this._backdrop.classList.add(CLASS_NAME_SHOW$2);
+ this._backdrop.classList.add(CLASS_NAME_SHOW$3);
if (!animate) {
callback();
@@ -4605,10 +4634,10 @@
}
var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
- EventHandler.one(this._backdrop, TRANSITION_END, callback);
+ EventHandler.one(this._backdrop, 'transitionend', callback);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) {
- this._backdrop.classList.remove(CLASS_NAME_SHOW$2);
+ this._backdrop.classList.remove(CLASS_NAME_SHOW$3);
var callbackRemove = function callbackRemove() {
_this9._removeBackdrop();
@@ -4616,10 +4645,10 @@
callback();
};
- if (this._element.classList.contains(CLASS_NAME_FADE)) {
+ if (this._element.classList.contains(CLASS_NAME_FADE$1)) {
var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
- EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
+ EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
} else {
callbackRemove();
@@ -4647,12 +4676,12 @@
this._element.classList.add(CLASS_NAME_STATIC);
var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
- EventHandler.off(this._element, TRANSITION_END);
- EventHandler.one(this._element, TRANSITION_END, function () {
+ EventHandler.off(this._element, 'transitionend');
+ EventHandler.one(this._element, 'transitionend', function () {
_this10._element.classList.remove(CLASS_NAME_STATIC);
if (!isModalOverflowing) {
- EventHandler.one(_this10._element, TRANSITION_END, function () {
+ EventHandler.one(_this10._element, 'transitionend', function () {
_this10._element.style.overflowY = '';
});
emulateTransitionEnd(_this10._element, modalTransitionDuration);
@@ -4693,60 +4722,50 @@
var _this11 = this;
if (this._isBodyOverflowing) {
- // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
- // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
- // Adjust fixed content padding
- SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
- var actualPadding = element.style.paddingRight;
- var calculatedPadding = window.getComputedStyle(element)['padding-right'];
- Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
- element.style.paddingRight = Number.parseFloat(calculatedPadding) + _this11._scrollbarWidth + "px";
- }); // Adjust sticky content margin
-
- SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
- var actualMargin = element.style.marginRight;
- var calculatedMargin = window.getComputedStyle(element)['margin-right'];
- Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
- element.style.marginRight = Number.parseFloat(calculatedMargin) - _this11._scrollbarWidth + "px";
- }); // Adjust body padding
-
- var actualPadding = document.body.style.paddingRight;
- var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
- Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
- document.body.style.paddingRight = Number.parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', function (calculatedValue) {
+ return calculatedValue + _this11._scrollbarWidth;
+ });
+
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', function (calculatedValue) {
+ return calculatedValue - _this11._scrollbarWidth;
+ });
+
+ this._setElementAttributes('body', 'paddingRight', function (calculatedValue) {
+ return calculatedValue + _this11._scrollbarWidth;
+ });
}
document.body.classList.add(CLASS_NAME_OPEN);
};
- _proto._resetScrollbar = function _resetScrollbar() {
- // Restore fixed content padding
- SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
- var padding = Manipulator.getDataAttribute(element, 'padding-right');
+ _proto._setElementAttributes = function _setElementAttributes(selector, styleProp, callback) {
+ SelectorEngine.find(selector).forEach(function (element) {
+ var actualValue = element.style[styleProp];
+ var calculatedValue = window.getComputedStyle(element)[styleProp];
+ Manipulator.setDataAttribute(element, styleProp, actualValue);
+ element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
+ });
+ };
- if (typeof padding !== 'undefined') {
- Manipulator.removeDataAttribute(element, 'padding-right');
- element.style.paddingRight = padding;
- }
- }); // Restore sticky content and navbar-toggler margin
+ _proto._resetScrollbar = function _resetScrollbar() {
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
- SelectorEngine.find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) {
- var margin = Manipulator.getDataAttribute(element, 'margin-right');
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
- if (typeof margin !== 'undefined') {
- Manipulator.removeDataAttribute(element, 'margin-right');
- element.style.marginRight = margin;
- }
- }); // Restore body padding
+ this._resetElementAttributes('body', 'paddingRight');
+ };
- var padding = Manipulator.getDataAttribute(document.body, 'padding-right');
+ _proto._resetElementAttributes = function _resetElementAttributes(selector, styleProp) {
+ SelectorEngine.find(selector).forEach(function (element) {
+ var value = Manipulator.getDataAttribute(element, styleProp);
- if (typeof padding === 'undefined') {
- document.body.style.paddingRight = '';
- } else {
- Manipulator.removeDataAttribute(document.body, 'padding-right');
- document.body.style.paddingRight = padding;
- }
+ if (typeof value === 'undefined' && element === document.body) {
+ element.style[styleProp] = '';
+ } else {
+ Manipulator.removeDataAttribute(element, styleProp);
+ element.style[styleProp] = value;
+ }
+ });
};
_proto._getScrollbarWidth = function _getScrollbarWidth() {
@@ -4830,7 +4849,7 @@
data = new Modal(target, config);
}
- data.show(this);
+ data.toggle(this);
});
/**
* ------------------------------------------------------------------------
@@ -4839,25 +4858,11 @@
* add .Modal to jQuery only if jQuery is present
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$5];
- $.fn[NAME$5] = Modal.jQueryInterface;
- $.fn[NAME$5].Constructor = Modal;
-
- $.fn[NAME$5].noConflict = function () {
- $.fn[NAME$5] = JQUERY_NO_CONFLICT;
- return Modal.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$5, Modal);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-beta1): util/sanitizer.js
+ * Bootstrap (v5.0.0-beta2): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4883,7 +4888,7 @@
if (allowedAttributeList.includes(attrName)) {
if (uriAttrs.has(attrName)) {
- return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
+ return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
}
return true;
@@ -4894,7 +4899,7 @@
}); // Check if a regular expression validates the attribute.
for (var i = 0, len = regExp.length; i < len; i++) {
- if (attrName.match(regExp[i])) {
+ if (regExp[i].test(attrName)) {
return true;
}
}
@@ -5003,14 +5008,15 @@
html: 'boolean',
selector: '(string|boolean)',
placement: '(string|function)',
+ offset: '(array|string|function)',
container: '(string|element|boolean)',
- fallbackPlacements: '(null|array)',
+ fallbackPlacements: 'array',
boundary: '(string|element)',
customClass: '(string|function)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
allowList: 'object',
- popperConfig: '(null|object)'
+ popperConfig: '(null|object|function)'
};
var AttachmentMap = {
AUTO: 'auto',
@@ -5028,8 +5034,9 @@
html: false,
selector: false,
placement: 'top',
+ offset: [0, 0],
container: false,
- fallbackPlacements: null,
+ fallbackPlacements: ['top', 'right', 'bottom', 'left'],
boundary: 'clippingParents',
customClass: '',
sanitize: true,
@@ -5049,9 +5056,9 @@
MOUSEENTER: "mouseenter" + EVENT_KEY$6,
MOUSELEAVE: "mouseleave" + EVENT_KEY$6
};
- var CLASS_NAME_FADE$1 = 'fade';
+ var CLASS_NAME_FADE$2 = 'fade';
var CLASS_NAME_MODAL = 'modal';
- var CLASS_NAME_SHOW$3 = 'show';
+ var CLASS_NAME_SHOW$4 = 'show';
var HOVER_STATE_SHOW = 'show';
var HOVER_STATE_OUT = 'out';
var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
@@ -5113,13 +5120,7 @@
}
if (event) {
- var dataKey = this.constructor.DATA_KEY;
- var context = Data.getData(event.delegateTarget, dataKey);
-
- if (!context) {
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
- Data.setData(event.delegateTarget, dataKey, context);
- }
+ var context = this._initializeOnDelegatedTarget(event);
context._activeTrigger.click = !context._activeTrigger.click;
@@ -5129,7 +5130,7 @@
context._leave(null, context);
}
} else {
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
+ if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$4)) {
this._leave(null, this);
return;
@@ -5144,7 +5145,7 @@
EventHandler.off(this._element, this.constructor.EVENT_KEY);
EventHandler.off(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
- if (this.tip) {
+ if (this.tip && this.tip.parentNode) {
this.tip.parentNode.removeChild(this.tip);
}
@@ -5171,81 +5172,83 @@
throw new Error('Please use show on visible elements');
}
- if (this.isWithContent() && this._isEnabled) {
- var showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
- var shadowRoot = findShadowRoot(this._element);
- var isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
+ if (!(this.isWithContent() && this._isEnabled)) {
+ return;
+ }
- if (showEvent.defaultPrevented || !isInTheDom) {
- return;
- }
+ var showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
+ var shadowRoot = findShadowRoot(this._element);
+ var isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
- var tip = this.getTipElement();
- var tipId = getUID(this.constructor.NAME);
- tip.setAttribute('id', tipId);
+ if (showEvent.defaultPrevented || !isInTheDom) {
+ return;
+ }
- this._element.setAttribute('aria-describedby', tipId);
+ var tip = this.getTipElement();
+ var tipId = getUID(this.constructor.NAME);
+ tip.setAttribute('id', tipId);
- this.setContent();
+ this._element.setAttribute('aria-describedby', tipId);
- if (this.config.animation) {
- tip.classList.add(CLASS_NAME_FADE$1);
- }
+ this.setContent();
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
+ if (this.config.animation) {
+ tip.classList.add(CLASS_NAME_FADE$2);
+ }
- var attachment = this._getAttachment(placement);
+ var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
- this._addAttachmentClass(attachment);
+ var attachment = this._getAttachment(placement);
- var container = this._getContainer();
+ this._addAttachmentClass(attachment);
- Data.setData(tip, this.constructor.DATA_KEY, this);
+ var container = this._getContainer();
- if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
- container.appendChild(tip);
- }
+ Data.setData(tip, this.constructor.DATA_KEY, this);
- EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
- this._popper = createPopper$2(this._element, tip, this._getPopperConfig(attachment));
- tip.classList.add(CLASS_NAME_SHOW$3);
- var customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
+ if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
+ container.appendChild(tip);
+ }
- if (customClass) {
- var _tip$classList;
+ EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
+ this._popper = createPopper$2(this._element, tip, this._getPopperConfig(attachment));
+ tip.classList.add(CLASS_NAME_SHOW$4);
+ var customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
- (_tip$classList = tip.classList).add.apply(_tip$classList, customClass.split(' '));
- } // If this is a touch-enabled device we add extra
- // empty mouseover listeners to the body's immediate children;
- // only needed because of broken event delegation on iOS
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
+ if (customClass) {
+ var _tip$classList;
+ (_tip$classList = tip.classList).add.apply(_tip$classList, customClass.split(' '));
+ } // If this is a touch-enabled device we add extra
+ // empty mouseover listeners to the body's immediate children;
+ // only needed because of broken event delegation on iOS
+ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
- if ('ontouchstart' in document.documentElement) {
- var _ref;
- (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
- EventHandler.on(element, 'mouseover', noop());
- });
- }
+ if ('ontouchstart' in document.documentElement) {
+ var _ref;
- var complete = function complete() {
- var prevHoverState = _this2._hoverState;
- _this2._hoverState = null;
- EventHandler.trigger(_this2._element, _this2.constructor.Event.SHOWN);
+ (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
+ EventHandler.on(element, 'mouseover', noop());
+ });
+ }
- if (prevHoverState === HOVER_STATE_OUT) {
- _this2._leave(null, _this2);
- }
- };
+ var complete = function complete() {
+ var prevHoverState = _this2._hoverState;
+ _this2._hoverState = null;
+ EventHandler.trigger(_this2._element, _this2.constructor.Event.SHOWN);
- if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
- var transitionDuration = getTransitionDurationFromElement(this.tip);
- EventHandler.one(this.tip, TRANSITION_END, complete);
- emulateTransitionEnd(this.tip, transitionDuration);
- } else {
- complete();
+ if (prevHoverState === HOVER_STATE_OUT) {
+ _this2._leave(null, _this2);
}
+ };
+
+ if (this.tip.classList.contains(CLASS_NAME_FADE$2)) {
+ var transitionDuration = getTransitionDurationFromElement(this.tip);
+ EventHandler.one(this.tip, 'transitionend', complete);
+ emulateTransitionEnd(this.tip, transitionDuration);
+ } else {
+ complete();
}
};
@@ -5282,7 +5285,7 @@
return;
}
- tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
+ tip.classList.remove(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
@@ -5297,9 +5300,9 @@
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
- if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
+ if (this.tip.classList.contains(CLASS_NAME_FADE$2)) {
var transitionDuration = getTransitionDurationFromElement(tip);
- EventHandler.one(tip, TRANSITION_END, complete);
+ EventHandler.one(tip, 'transitionend', complete);
emulateTransitionEnd(tip, transitionDuration);
} else {
complete();
@@ -5333,7 +5336,7 @@
_proto.setContent = function setContent() {
var tip = this.getTipElement();
this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
- tip.classList.remove(CLASS_NAME_FADE$1, CLASS_NAME_SHOW$3);
+ tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4);
};
_proto.setElementContent = function setElementContent(element, content) {
@@ -5393,26 +5396,58 @@
} // Private
;
- _proto._getPopperConfig = function _getPopperConfig(attachment) {
+ _proto._initializeOnDelegatedTarget = function _initializeOnDelegatedTarget(event, context) {
+ var dataKey = this.constructor.DATA_KEY;
+ context = context || Data.getData(event.delegateTarget, dataKey);
+
+ if (!context) {
+ context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
+ Data.setData(event.delegateTarget, dataKey, context);
+ }
+
+ return context;
+ };
+
+ _proto._getOffset = function _getOffset() {
var _this4 = this;
- var flipModifier = {
- name: 'flip',
- options: {
- altBoundary: true
- }
- };
+ var offset = this.config.offset;
+
+ if (typeof offset === 'string') {
+ return offset.split(',').map(function (val) {
+ return Number.parseInt(val, 10);
+ });
+ }
- if (this.config.fallbackPlacements) {
- flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
+ if (typeof offset === 'function') {
+ return function (popperData) {
+ return offset(popperData, _this4._element);
+ };
}
- var defaultBsConfig = {
+ return offset;
+ };
+
+ _proto._getPopperConfig = function _getPopperConfig(attachment) {
+ var _this5 = this;
+
+ var defaultBsPopperConfig = {
placement: attachment,
- modifiers: [flipModifier, {
+ modifiers: [{
+ name: 'flip',
+ options: {
+ altBoundary: true,
+ fallbackPlacements: this.config.fallbackPlacements
+ }
+ }, {
+ name: 'offset',
+ options: {
+ offset: this._getOffset()
+ }
+ }, {
name: 'preventOverflow',
options: {
- rootBoundary: this.config.boundary
+ boundary: this.config.boundary
}
}, {
name: 'arrow',
@@ -5424,16 +5459,16 @@
enabled: true,
phase: 'afterWrite',
fn: function fn(data) {
- return _this4._handlePopperPlacementChange(data);
+ return _this5._handlePopperPlacementChange(data);
}
}],
onFirstUpdate: function onFirstUpdate(data) {
if (data.options.placement !== data.placement) {
- _this4._handlePopperPlacementChange(data);
+ _this5._handlePopperPlacementChange(data);
}
}
};
- return _extends({}, defaultBsConfig, this.config.popperConfig);
+ return _extends({}, defaultBsPopperConfig, typeof this.config.popperConfig === 'function' ? this.config.popperConfig(defaultBsPopperConfig) : this.config.popperConfig);
};
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
@@ -5457,29 +5492,29 @@
};
_proto._setListeners = function _setListeners() {
- var _this5 = this;
+ var _this6 = this;
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
if (trigger === 'click') {
- EventHandler.on(_this5._element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
- return _this5.toggle(event);
+ EventHandler.on(_this6._element, _this6.constructor.Event.CLICK, _this6.config.selector, function (event) {
+ return _this6.toggle(event);
});
} else if (trigger !== TRIGGER_MANUAL) {
- var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
- var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
- EventHandler.on(_this5._element, eventIn, _this5.config.selector, function (event) {
- return _this5._enter(event);
+ var eventIn = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSEENTER : _this6.constructor.Event.FOCUSIN;
+ var eventOut = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSELEAVE : _this6.constructor.Event.FOCUSOUT;
+ EventHandler.on(_this6._element, eventIn, _this6.config.selector, function (event) {
+ return _this6._enter(event);
});
- EventHandler.on(_this5._element, eventOut, _this5.config.selector, function (event) {
- return _this5._leave(event);
+ EventHandler.on(_this6._element, eventOut, _this6.config.selector, function (event) {
+ return _this6._leave(event);
});
}
});
this._hideModalHandler = function () {
- if (_this5._element) {
- _this5.hide();
+ if (_this6._element) {
+ _this6.hide();
}
};
@@ -5512,19 +5547,13 @@
};
_proto._enter = function _enter(event, context) {
- var dataKey = this.constructor.DATA_KEY;
- context = context || Data.getData(event.delegateTarget, dataKey);
-
- if (!context) {
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
- Data.setData(event.delegateTarget, dataKey, context);
- }
+ context = this._initializeOnDelegatedTarget(event, context);
if (event) {
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
}
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
+ if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
context._hoverState = HOVER_STATE_SHOW;
return;
}
@@ -5545,13 +5574,7 @@
};
_proto._leave = function _leave(event, context) {
- var dataKey = this.constructor.DATA_KEY;
- context = context || Data.getData(event.delegateTarget, dataKey);
-
- if (!context) {
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
- Data.setData(event.delegateTarget, dataKey, context);
- }
+ context = this._initializeOnDelegatedTarget(event, context);
if (event) {
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
@@ -5732,21 +5755,7 @@
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$6];
- $.fn[NAME$6] = Tooltip.jQueryInterface;
- $.fn[NAME$6].Constructor = Tooltip;
-
- $.fn[NAME$6].noConflict = function () {
- $.fn[NAME$6] = JQUERY_NO_CONFLICT;
- return Tooltip.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$6, Tooltip);
/**
* ------------------------------------------------------------------------
@@ -5762,6 +5771,7 @@
var Default$5 = _extends({}, Tooltip.Default, {
placement: 'right',
+ offset: [0, 8],
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
@@ -5783,8 +5793,8 @@
MOUSEENTER: "mouseenter" + EVENT_KEY$7,
MOUSELEAVE: "mouseleave" + EVENT_KEY$7
};
- var CLASS_NAME_FADE$2 = 'fade';
- var CLASS_NAME_SHOW$4 = 'show';
+ var CLASS_NAME_FADE$3 = 'fade';
+ var CLASS_NAME_SHOW$5 = 'show';
var SELECTOR_TITLE = '.popover-header';
var SELECTOR_CONTENT = '.popover-body';
/**
@@ -5819,7 +5829,7 @@
}
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4);
+ tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$5);
} // Private
;
@@ -5872,8 +5882,8 @@
_createClass(Popover, null, [{
key: "Default",
- // Getters
- get: function get() {
+ get: // Getters
+ function get() {
return Default$5;
}
}, {
@@ -5913,21 +5923,7 @@
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$7];
- $.fn[NAME$7] = Popover.jQueryInterface;
- $.fn[NAME$7].Constructor = Popover;
-
- $.fn[NAME$7].noConflict = function () {
- $.fn[NAME$7] = JQUERY_NO_CONFLICT;
- return Popover.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$7, Popover);
/**
* ------------------------------------------------------------------------
@@ -5983,8 +5979,8 @@
_this._targets = [];
_this._activeTarget = null;
_this._scrollHeight = 0;
- EventHandler.on(_this._scrollElement, EVENT_SCROLL, function (event) {
- return _this._process(event);
+ EventHandler.on(_this._scrollElement, EVENT_SCROLL, function () {
+ return _this._process();
});
_this.refresh();
@@ -6213,21 +6209,7 @@
* add .ScrollSpy to jQuery only if jQuery is present
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$8];
- $.fn[NAME$8] = ScrollSpy.jQueryInterface;
- $.fn[NAME$8].Constructor = ScrollSpy;
-
- $.fn[NAME$8].noConflict = function () {
- $.fn[NAME$8] = JQUERY_NO_CONFLICT;
- return ScrollSpy.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$8, ScrollSpy);
/**
* ------------------------------------------------------------------------
@@ -6247,8 +6229,8 @@
var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
var CLASS_NAME_ACTIVE$3 = 'active';
var CLASS_NAME_DISABLED$1 = 'disabled';
- var CLASS_NAME_FADE$3 = 'fade';
- var CLASS_NAME_SHOW$5 = 'show';
+ var CLASS_NAME_FADE$4 = 'fade';
+ var CLASS_NAME_SHOW$6 = 'show';
var SELECTOR_DROPDOWN$1 = '.dropdown';
var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
var SELECTOR_ACTIVE$1 = '.active';
@@ -6290,14 +6272,9 @@
previous = previous[previous.length - 1];
}
- var hideEvent = null;
-
- if (previous) {
- hideEvent = EventHandler.trigger(previous, EVENT_HIDE$3, {
- relatedTarget: this._element
- });
- }
-
+ var hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$3, {
+ relatedTarget: this._element
+ }) : null;
var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
relatedTarget: previous
});
@@ -6330,7 +6307,7 @@
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);
+ var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$4);
var complete = function complete() {
return _this2._transitionComplete(element, active, callback);
@@ -6338,8 +6315,8 @@
if (active && isTransitioning) {
var transitionDuration = getTransitionDurationFromElement(active);
- active.classList.remove(CLASS_NAME_SHOW$5);
- EventHandler.one(active, TRANSITION_END, complete);
+ active.classList.remove(CLASS_NAME_SHOW$6);
+ EventHandler.one(active, 'transitionend', complete);
emulateTransitionEnd(active, transitionDuration);
} else {
complete();
@@ -6368,8 +6345,8 @@
reflow(element);
- if (element.classList.contains(CLASS_NAME_FADE$3)) {
- element.classList.add(CLASS_NAME_SHOW$5);
+ if (element.classList.contains(CLASS_NAME_FADE$4)) {
+ element.classList.add(CLASS_NAME_SHOW$6);
}
if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
@@ -6406,8 +6383,8 @@
_createClass(Tab, null, [{
key: "DATA_KEY",
- // Getters
- get: function get() {
+ get: // Getters
+ function get() {
return DATA_KEY$9;
}
}]);
@@ -6433,21 +6410,7 @@
* add .Tab to jQuery only if jQuery is present
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$9];
- $.fn[NAME$9] = Tab.jQueryInterface;
- $.fn[NAME$9].Constructor = Tab;
-
- $.fn[NAME$9].noConflict = function () {
- $.fn[NAME$9] = JQUERY_NO_CONFLICT;
- return Tab.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$9, Tab);
/**
* ------------------------------------------------------------------------
@@ -6463,9 +6426,9 @@
var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
- var CLASS_NAME_FADE$4 = 'fade';
+ var CLASS_NAME_FADE$5 = 'fade';
var CLASS_NAME_HIDE = 'hide';
- var CLASS_NAME_SHOW$6 = 'show';
+ var CLASS_NAME_SHOW$7 = 'show';
var CLASS_NAME_SHOWING = 'showing';
var DefaultType$7 = {
animation: 'boolean',
@@ -6515,13 +6478,13 @@
this._clearTimeout();
if (this._config.animation) {
- this._element.classList.add(CLASS_NAME_FADE$4);
+ this._element.classList.add(CLASS_NAME_FADE$5);
}
var complete = function complete() {
_this2._element.classList.remove(CLASS_NAME_SHOWING);
- _this2._element.classList.add(CLASS_NAME_SHOW$6);
+ _this2._element.classList.add(CLASS_NAME_SHOW$7);
EventHandler.trigger(_this2._element, EVENT_SHOWN$4);
@@ -6540,7 +6503,7 @@
if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element);
- EventHandler.one(this._element, TRANSITION_END, complete);
+ EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
@@ -6550,7 +6513,7 @@
_proto.hide = function hide() {
var _this3 = this;
- if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) {
+ if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
return;
}
@@ -6566,11 +6529,11 @@
EventHandler.trigger(_this3._element, EVENT_HIDDEN$4);
};
- this._element.classList.remove(CLASS_NAME_SHOW$6);
+ this._element.classList.remove(CLASS_NAME_SHOW$7);
if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element);
- EventHandler.one(this._element, TRANSITION_END, complete);
+ EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
@@ -6580,8 +6543,8 @@
_proto.dispose = function dispose() {
this._clearTimeout();
- if (this._element.classList.contains(CLASS_NAME_SHOW$6)) {
- this._element.classList.remove(CLASS_NAME_SHOW$6);
+ if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
+ this._element.classList.remove(CLASS_NAME_SHOW$7);
}
EventHandler.off(this._element, EVENT_CLICK_DISMISS$1);
@@ -6659,25 +6622,11 @@
*/
- onDOMContentLoaded(function () {
- var $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- var JQUERY_NO_CONFLICT = $.fn[NAME$a];
- $.fn[NAME$a] = Toast.jQueryInterface;
- $.fn[NAME$a].Constructor = Toast;
-
- $.fn[NAME$a].noConflict = function () {
- $.fn[NAME$a] = JQUERY_NO_CONFLICT;
- return Toast.jQueryInterface;
- };
- }
- });
+ defineJQueryPlugin(NAME$a, Toast);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-beta1): index.umd.js
+ * Bootstrap (v5.0.0-beta2): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/