aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/dist/js/bootstrap.bundle.js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-09-23 08:33:36 +0000
committerMario <mario@mariovavti.com>2021-09-23 08:33:36 +0000
commita451449766d581978068a5b8f8c1e27f50386ea7 (patch)
tree17388d0d116d3c3a3e14745397b5b3278e933d74 /vendor/twbs/bootstrap/dist/js/bootstrap.bundle.js
parent3347fab105a01f38800a907e7d6281d835a29f5c (diff)
downloadvolse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.tar.gz
volse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.tar.bz2
volse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.zip
Revert "composer update bootstrap to version 5.1.1"
This reverts commit 89e4006b2d84d398e34d407a019854823b1dd37d.
Diffstat (limited to 'vendor/twbs/bootstrap/dist/js/bootstrap.bundle.js')
-rw-r--r--vendor/twbs/bootstrap/dist/js/bootstrap.bundle.js1296
1 files changed, 616 insertions, 680 deletions
diff --git a/vendor/twbs/bootstrap/dist/js/bootstrap.bundle.js b/vendor/twbs/bootstrap/dist/js/bootstrap.bundle.js
index a8be9ae7c..d6ce66fe7 100644
--- a/vendor/twbs/bootstrap/dist/js/bootstrap.bundle.js
+++ b/vendor/twbs/bootstrap/dist/js/bootstrap.bundle.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap v5.1.1 (https://getbootstrap.com/)
+ * Bootstrap v5.0.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)
*/
@@ -11,10 +11,82 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/index.js
+ * Bootstrap (v5.0.2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
+
+ /**
+ * ------------------------------------------------------------------------
+ * Constants
+ * ------------------------------------------------------------------------
+ */
+ const NODE_TEXT = 3;
+ const SelectorEngine = {
+ find(selector, element = document.documentElement) {
+ return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
+ },
+
+ findOne(selector, element = document.documentElement) {
+ return Element.prototype.querySelector.call(element, selector);
+ },
+
+ children(element, selector) {
+ return [].concat(...element.children).filter(child => child.matches(selector));
+ },
+
+ parents(element, selector) {
+ const parents = [];
+ let ancestor = element.parentNode;
+
+ while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
+ if (ancestor.matches(selector)) {
+ parents.push(ancestor);
+ }
+
+ ancestor = ancestor.parentNode;
+ }
+
+ return parents;
+ },
+
+ prev(element, selector) {
+ let previous = element.previousElementSibling;
+
+ while (previous) {
+ if (previous.matches(selector)) {
+ return [previous];
+ }
+
+ previous = previous.previousElementSibling;
+ }
+
+ return [];
+ },
+
+ next(element, selector) {
+ let next = element.nextElementSibling;
+
+ while (next) {
+ if (next.matches(selector)) {
+ return [next];
+ }
+
+ next = next.nextElementSibling;
+ }
+
+ return [];
+ }
+
+ };
+
+ /**
+ * --------------------------------------------------------------------------
+ * Bootstrap (v5.0.2): util/index.js
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
+ * --------------------------------------------------------------------------
+ */
+
const MAX_UID = 1000000;
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
@@ -126,7 +198,7 @@
}
if (typeof obj === 'string' && obj.length > 0) {
- return document.querySelector(obj);
+ return SelectorEngine.findOne(obj);
}
return null;
@@ -192,20 +264,8 @@
};
const noop = () => {};
- /**
- * 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 => {
- // eslint-disable-next-line no-unused-expressions
- element.offsetHeight;
- };
+ const reflow = element => element.offsetHeight;
const getjQuery = () => {
const {
@@ -322,7 +382,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): dom/event-handler.js
+ * Bootstrap (v5.0.2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -385,6 +445,7 @@
event.delegateTarget = target;
if (handler.oneOff) {
+ // eslint-disable-next-line unicorn/consistent-destructuring
EventHandler.off(element, event.type, selector, fn);
}
@@ -610,7 +671,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): dom/data.js
+ * Bootstrap (v5.0.2): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -664,7 +725,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): base-component.js
+ * Bootstrap (v5.0.2): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -674,7 +735,7 @@
* ------------------------------------------------------------------------
*/
- const VERSION = '5.1.1';
+ const VERSION = '5.0.2';
class BaseComponent {
constructor(element) {
@@ -703,7 +764,7 @@
static getInstance(element) {
- return Data.get(getElement(element), this.DATA_KEY);
+ return Data.get(element, this.DATA_KEY);
}
static getOrCreateInstance(element, config = {}) {
@@ -730,33 +791,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/component-functions.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- * --------------------------------------------------------------------------
- */
-
- const enableDismissTrigger = (component, method = 'hide') => {
- const clickEvent = `click.dismiss${component.EVENT_KEY}`;
- const name = component.NAME;
- EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
- if (['A', 'AREA'].includes(this.tagName)) {
- event.preventDefault();
- }
-
- if (isDisabled(this)) {
- return;
- }
-
- const target = getElementFromSelector(this) || this.closest(`.${name}`);
- const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
-
- instance[method]();
- });
- };
-
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): alert.js
+ * Bootstrap (v5.0.2): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -766,13 +801,17 @@
* ------------------------------------------------------------------------
*/
- const NAME$d = 'alert';
- const DATA_KEY$c = 'bs.alert';
- const EVENT_KEY$c = `.${DATA_KEY$c}`;
- const EVENT_CLOSE = `close${EVENT_KEY$c}`;
- const EVENT_CLOSED = `closed${EVENT_KEY$c}`;
- const CLASS_NAME_FADE$5 = 'fade';
- const CLASS_NAME_SHOW$8 = 'show';
+ const NAME$c = 'alert';
+ const DATA_KEY$b = 'bs.alert';
+ const EVENT_KEY$b = `.${DATA_KEY$b}`;
+ const DATA_API_KEY$8 = '.data-api';
+ const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
+ const EVENT_CLOSE = `close${EVENT_KEY$b}`;
+ const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
+ const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
+ const CLASS_NAME_ALERT = 'alert';
+ const CLASS_NAME_FADE$6 = 'fade';
+ const CLASS_NAME_SHOW$9 = 'show';
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -782,30 +821,41 @@
class Alert extends BaseComponent {
// Getters
static get NAME() {
- return NAME$d;
+ return NAME$c;
} // Public
- close() {
- const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
+ close(element) {
+ const rootElement = element ? this._getRootElement(element) : this._element;
+
+ const customEvent = this._triggerCloseEvent(rootElement);
- if (closeEvent.defaultPrevented) {
+ if (customEvent === null || customEvent.defaultPrevented) {
return;
}
- this._element.classList.remove(CLASS_NAME_SHOW$8);
+ this._removeElement(rootElement);
+ } // Private
- const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
- this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
- } // Private
+ _getRootElement(element) {
+ return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
+ }
+
+ _triggerCloseEvent(element) {
+ return EventHandler.trigger(element, EVENT_CLOSE);
+ }
+ _removeElement(element) {
+ element.classList.remove(CLASS_NAME_SHOW$9);
+ const isAnimated = element.classList.contains(CLASS_NAME_FADE$6);
- _destroyElement() {
- this._element.remove();
+ this._queueCallback(() => this._destroyElement(element), element, isAnimated);
+ }
- EventHandler.trigger(this._element, EVENT_CLOSED);
- this.dispose();
+ _destroyElement(element) {
+ element.remove();
+ EventHandler.trigger(element, EVENT_CLOSED);
} // Static
@@ -813,16 +863,20 @@
return this.each(function () {
const data = Alert.getOrCreateInstance(this);
- if (typeof config !== 'string') {
- return;
+ if (config === 'close') {
+ data[config](this);
}
+ });
+ }
- if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
- throw new TypeError(`No method named "${config}"`);
+ static handleDismiss(alertInstance) {
+ return function (event) {
+ if (event) {
+ event.preventDefault();
}
- data[config](this);
- });
+ alertInstance.close(this);
+ };
}
}
@@ -833,7 +887,7 @@
*/
- enableDismissTrigger(Alert, 'close');
+ EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
/**
* ------------------------------------------------------------------------
* jQuery
@@ -845,7 +899,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): button.js
+ * Bootstrap (v5.0.2): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -855,13 +909,13 @@
* ------------------------------------------------------------------------
*/
- const NAME$c = 'button';
- const DATA_KEY$b = 'bs.button';
- const EVENT_KEY$b = `.${DATA_KEY$b}`;
+ const NAME$b = 'button';
+ const DATA_KEY$a = 'bs.button';
+ const EVENT_KEY$a = `.${DATA_KEY$a}`;
const DATA_API_KEY$7 = '.data-api';
const CLASS_NAME_ACTIVE$3 = 'active';
const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
- const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
+ const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`;
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -871,7 +925,7 @@
class Button extends BaseComponent {
// Getters
static get NAME() {
- return NAME$c;
+ return NAME$b;
} // Public
@@ -916,7 +970,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): dom/manipulator.js
+ * Bootstrap (v5.0.2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -974,8 +1028,8 @@
offset(element) {
const rect = element.getBoundingClientRect();
return {
- top: rect.top + window.pageYOffset,
- left: rect.left + window.pageXOffset
+ top: rect.top + document.body.scrollTop,
+ left: rect.left + document.body.scrollLeft
};
},
@@ -990,77 +1044,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): dom/selector-engine.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- * --------------------------------------------------------------------------
- */
- const NODE_TEXT = 3;
- const SelectorEngine = {
- find(selector, element = document.documentElement) {
- return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
- },
-
- findOne(selector, element = document.documentElement) {
- return Element.prototype.querySelector.call(element, selector);
- },
-
- children(element, selector) {
- return [].concat(...element.children).filter(child => child.matches(selector));
- },
-
- parents(element, selector) {
- const parents = [];
- let ancestor = element.parentNode;
-
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
- if (ancestor.matches(selector)) {
- parents.push(ancestor);
- }
-
- ancestor = ancestor.parentNode;
- }
-
- return parents;
- },
-
- prev(element, selector) {
- let previous = element.previousElementSibling;
-
- while (previous) {
- if (previous.matches(selector)) {
- return [previous];
- }
-
- previous = previous.previousElementSibling;
- }
-
- return [];
- },
-
- next(element, selector) {
- let next = element.nextElementSibling;
-
- while (next) {
- if (next.matches(selector)) {
- return [next];
- }
-
- next = next.nextElementSibling;
- }
-
- return [];
- },
-
- focusableChildren(element) {
- const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
- return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
- }
-
- };
-
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): carousel.js
+ * Bootstrap (v5.0.2): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1070,16 +1054,16 @@
* ------------------------------------------------------------------------
*/
- const NAME$b = 'carousel';
- const DATA_KEY$a = 'bs.carousel';
- const EVENT_KEY$a = `.${DATA_KEY$a}`;
+ const NAME$a = 'carousel';
+ const DATA_KEY$9 = 'bs.carousel';
+ const EVENT_KEY$9 = `.${DATA_KEY$9}`;
const DATA_API_KEY$6 = '.data-api';
const ARROW_LEFT_KEY = 'ArrowLeft';
const ARROW_RIGHT_KEY = 'ArrowRight';
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
const SWIPE_THRESHOLD = 40;
- const Default$a = {
+ const Default$9 = {
interval: 5000,
keyboard: true,
slide: false,
@@ -1087,7 +1071,7 @@
wrap: true,
touch: true
};
- const DefaultType$a = {
+ const DefaultType$9 = {
interval: '(number|boolean)',
keyboard: 'boolean',
slide: '(boolean|string)',
@@ -1103,19 +1087,19 @@
[ARROW_LEFT_KEY]: DIRECTION_RIGHT,
[ARROW_RIGHT_KEY]: DIRECTION_LEFT
};
- const EVENT_SLIDE = `slide${EVENT_KEY$a}`;
- const EVENT_SLID = `slid${EVENT_KEY$a}`;
- const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`;
- const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`;
- const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`;
- const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`;
- const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`;
- const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`;
- const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`;
- const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`;
- const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`;
- const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`;
- const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
+ const EVENT_SLIDE = `slide${EVENT_KEY$9}`;
+ const EVENT_SLID = `slid${EVENT_KEY$9}`;
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY$9}`;
+ const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$9}`;
+ const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$9}`;
+ const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
+ const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
+ const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
+ const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
+ const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
+ const EVENT_DRAG_START = `dragstart${EVENT_KEY$9}`;
+ const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$9}${DATA_API_KEY$6}`;
+ const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`;
const CLASS_NAME_CAROUSEL = 'carousel';
const CLASS_NAME_ACTIVE$2 = 'active';
const CLASS_NAME_SLIDE = 'slide';
@@ -1162,11 +1146,11 @@
static get Default() {
- return Default$a;
+ return Default$9;
}
static get NAME() {
- return NAME$b;
+ return NAME$a;
} // Public
@@ -1244,11 +1228,11 @@
_getConfig(config) {
- config = { ...Default$a,
+ config = { ...Default$9,
...Manipulator.getDataAttributes(this._element),
...(typeof config === 'object' ? config : {})
};
- typeCheckConfig(NAME$b, config, DefaultType$a);
+ typeCheckConfig(NAME$a, config, DefaultType$9);
return config;
}
@@ -1285,12 +1269,8 @@
}
_addTouchEventListeners() {
- const hasPointerPenTouch = event => {
- return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
- };
-
const start = event => {
- if (hasPointerPenTouch(event)) {
+ if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
this.touchStartX = event.clientX;
} else if (!this._pointerEvent) {
this.touchStartX = event.touches[0].clientX;
@@ -1303,7 +1283,7 @@
};
const end = event => {
- if (hasPointerPenTouch(event)) {
+ if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
this.touchDeltaX = event.clientX - this.touchStartX;
}
@@ -1609,7 +1589,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): collapse.js
+ * Bootstrap (v5.0.2): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1619,31 +1599,30 @@
* ------------------------------------------------------------------------
*/
- const NAME$a = 'collapse';
- const DATA_KEY$9 = 'bs.collapse';
- const EVENT_KEY$9 = `.${DATA_KEY$9}`;
+ const NAME$9 = 'collapse';
+ const DATA_KEY$8 = 'bs.collapse';
+ const EVENT_KEY$8 = `.${DATA_KEY$8}`;
const DATA_API_KEY$5 = '.data-api';
- const Default$9 = {
+ const Default$8 = {
toggle: true,
- parent: null
+ parent: ''
};
- const DefaultType$9 = {
+ const DefaultType$8 = {
toggle: 'boolean',
- parent: '(null|element)'
+ parent: '(string|element)'
};
- const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
- const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
- const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
- const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
- const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`;
- const CLASS_NAME_SHOW$7 = 'show';
+ const EVENT_SHOW$5 = `show${EVENT_KEY$8}`;
+ const EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`;
+ const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
+ const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
+ const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
+ const CLASS_NAME_SHOW$8 = 'show';
const CLASS_NAME_COLLAPSE = 'collapse';
const CLASS_NAME_COLLAPSING = 'collapsing';
const CLASS_NAME_COLLAPSED = 'collapsed';
- const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
const WIDTH = 'width';
const HEIGHT = 'height';
- const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
+ const SELECTOR_ACTIVES = '.show, .collapsing';
const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
/**
* ------------------------------------------------------------------------
@@ -1656,7 +1635,7 @@
super(element);
this._isTransitioning = false;
this._config = this._getConfig(config);
- this._triggerArray = [];
+ this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$4}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE$4}[data-bs-target="#${this._element.id}"]`);
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
for (let i = 0, len = toggleList.length; i < len; i++) {
@@ -1671,10 +1650,10 @@
}
}
- this._initializeChildren();
+ this._parent = this._config.parent ? this._getParent() : null;
if (!this._config.parent) {
- this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
+ this._addAriaAndCollapsedClass(this._element, this._triggerArray);
}
if (this._config.toggle) {
@@ -1684,16 +1663,16 @@
static get Default() {
- return Default$9;
+ return Default$8;
}
static get NAME() {
- return NAME$a;
+ return NAME$9;
} // Public
toggle() {
- if (this._isShown()) {
+ if (this._element.classList.contains(CLASS_NAME_SHOW$8)) {
this.hide();
} else {
this.show();
@@ -1701,21 +1680,30 @@
}
show() {
- if (this._isTransitioning || this._isShown()) {
+ if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) {
return;
}
- let actives = [];
+ let actives;
let activesData;
- if (this._config.parent) {
- const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
+ if (this._parent) {
+ actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(elem => {
+ if (typeof this._config.parent === 'string') {
+ return elem.getAttribute('data-bs-parent') === this._config.parent;
+ }
+
+ return elem.classList.contains(CLASS_NAME_COLLAPSE);
+ });
+
+ if (actives.length === 0) {
+ actives = null;
+ }
}
const container = SelectorEngine.findOne(this._selector);
- if (actives.length) {
+ if (actives) {
const tempActiveData = actives.find(elem => container !== elem);
activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
@@ -1730,17 +1718,17 @@
return;
}
- actives.forEach(elemActive => {
- if (container !== elemActive) {
- Collapse.getOrCreateInstance(elemActive, {
- toggle: false
- }).hide();
- }
+ if (actives) {
+ actives.forEach(elemActive => {
+ if (container !== elemActive) {
+ Collapse.collapseInterface(elemActive, 'hide');
+ }
- if (!activesData) {
- Data.set(elemActive, DATA_KEY$9, null);
- }
- });
+ if (!activesData) {
+ Data.set(elemActive, DATA_KEY$8, null);
+ }
+ });
+ }
const dimension = this._getDimension();
@@ -1750,18 +1738,22 @@
this._element.style[dimension] = 0;
- this._addAriaAndCollapsedClass(this._triggerArray, true);
+ if (this._triggerArray.length) {
+ this._triggerArray.forEach(element => {
+ element.classList.remove(CLASS_NAME_COLLAPSED);
+ element.setAttribute('aria-expanded', true);
+ });
+ }
- this._isTransitioning = true;
+ this.setTransitioning(true);
const complete = () => {
- this._isTransitioning = false;
-
this._element.classList.remove(CLASS_NAME_COLLAPSING);
- this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
+ this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
this._element.style[dimension] = '';
+ this.setTransitioning(false);
EventHandler.trigger(this._element, EVENT_SHOWN$5);
};
@@ -1774,7 +1766,7 @@
}
hide() {
- if (this._isTransitioning || !this._isShown()) {
+ if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) {
return;
}
@@ -1791,23 +1783,26 @@
this._element.classList.add(CLASS_NAME_COLLAPSING);
- this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
+ this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
const triggerArrayLength = this._triggerArray.length;
- for (let i = 0; i < triggerArrayLength; i++) {
- const trigger = this._triggerArray[i];
- const elem = getElementFromSelector(trigger);
+ if (triggerArrayLength > 0) {
+ for (let i = 0; i < triggerArrayLength; i++) {
+ const trigger = this._triggerArray[i];
+ const elem = getElementFromSelector(trigger);
- if (elem && !this._isShown(elem)) {
- this._addAriaAndCollapsedClass([trigger], false);
+ if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) {
+ trigger.classList.add(CLASS_NAME_COLLAPSED);
+ trigger.setAttribute('aria-expanded', false);
+ }
}
}
- this._isTransitioning = true;
+ this.setTransitioning(true);
const complete = () => {
- this._isTransitioning = false;
+ this.setTransitioning(false);
this._element.classList.remove(CLASS_NAME_COLLAPSING);
@@ -1821,47 +1816,45 @@
this._queueCallback(complete, this._element, true);
}
- _isShown(element = this._element) {
- return element.classList.contains(CLASS_NAME_SHOW$7);
+ setTransitioning(isTransitioning) {
+ this._isTransitioning = isTransitioning;
} // Private
_getConfig(config) {
- config = { ...Default$9,
- ...Manipulator.getDataAttributes(this._element),
+ config = { ...Default$8,
...config
};
config.toggle = Boolean(config.toggle); // Coerce string values
- config.parent = getElement(config.parent);
- typeCheckConfig(NAME$a, config, DefaultType$9);
+ typeCheckConfig(NAME$9, config, DefaultType$8);
return config;
}
_getDimension() {
- return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
+ return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
}
- _initializeChildren() {
- if (!this._config.parent) {
- return;
- }
-
- const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
- SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
+ _getParent() {
+ let {
+ parent
+ } = this._config;
+ parent = getElement(parent);
+ const selector = `${SELECTOR_DATA_TOGGLE$4}[data-bs-parent="${parent}"]`;
+ SelectorEngine.find(selector, parent).forEach(element => {
const selected = getElementFromSelector(element);
- if (selected) {
- this._addAriaAndCollapsedClass([element], this._isShown(selected));
- }
+ this._addAriaAndCollapsedClass(selected, [element]);
});
+ return parent;
}
- _addAriaAndCollapsedClass(triggerArray, isOpen) {
- if (!triggerArray.length) {
+ _addAriaAndCollapsedClass(element, triggerArray) {
+ if (!element || !triggerArray.length) {
return;
}
+ const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
triggerArray.forEach(elem => {
if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED);
@@ -1874,23 +1867,33 @@
} // Static
- static jQueryInterface(config) {
- return this.each(function () {
- const _config = {};
-
- if (typeof config === 'string' && /show|hide/.test(config)) {
- _config.toggle = false;
- }
+ static collapseInterface(element, config) {
+ let data = Collapse.getInstance(element);
+ const _config = { ...Default$8,
+ ...Manipulator.getDataAttributes(element),
+ ...(typeof config === 'object' && config ? config : {})
+ };
- const data = Collapse.getOrCreateInstance(this, _config);
+ if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
+ _config.toggle = false;
+ }
- if (typeof config === 'string') {
- if (typeof data[config] === 'undefined') {
- throw new TypeError(`No method named "${config}"`);
- }
+ if (!data) {
+ data = new Collapse(element, _config);
+ }
- data[config]();
+ if (typeof config === 'string') {
+ if (typeof data[config] === 'undefined') {
+ throw new TypeError(`No method named "${config}"`);
}
+
+ data[config]();
+ }
+ }
+
+ static jQueryInterface(config) {
+ return this.each(function () {
+ Collapse.collapseInterface(this, config);
});
}
@@ -1908,12 +1911,26 @@
event.preventDefault();
}
+ const triggerData = Manipulator.getDataAttributes(this);
const selector = getSelectorFromElement(this);
const selectorElements = SelectorEngine.find(selector);
selectorElements.forEach(element => {
- Collapse.getOrCreateInstance(element, {
- toggle: false
- }).toggle();
+ const data = Collapse.getInstance(element);
+ let config;
+
+ if (data) {
+ // update parent attribute
+ if (data._parent === null && typeof triggerData.parent === 'string') {
+ data._config.parent = triggerData.parent;
+ data._parent = data._getParent();
+ }
+
+ config = 'toggle';
+ } else {
+ config = triggerData;
+ }
+
+ Collapse.collapseInterface(element, config);
});
});
/**
@@ -2081,39 +2098,17 @@
return placement.split('-')[0];
}
- var round$1 = Math.round;
- function getBoundingClientRect(element, includeScale) {
- if (includeScale === void 0) {
- includeScale = false;
- }
-
+ function getBoundingClientRect(element) {
var rect = element.getBoundingClientRect();
- var scaleX = 1;
- var scaleY = 1;
-
- if (isHTMLElement(element) && includeScale) {
- var offsetHeight = element.offsetHeight;
- var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
- // Fallback to 1 in case both values are `0`
-
- if (offsetWidth > 0) {
- scaleX = rect.width / offsetWidth || 1;
- }
-
- if (offsetHeight > 0) {
- scaleY = rect.height / offsetHeight || 1;
- }
- }
-
return {
- width: round$1(rect.width / scaleX),
- height: round$1(rect.height / scaleY),
- top: round$1(rect.top / scaleY),
- right: round$1(rect.right / scaleX),
- bottom: round$1(rect.bottom / scaleY),
- left: round$1(rect.left / scaleX),
- x: round$1(rect.left / scaleX),
- y: round$1(rect.top / scaleY)
+ width: rect.width,
+ height: rect.height,
+ top: rect.top,
+ right: rect.right,
+ bottom: rect.bottom,
+ left: rect.left,
+ x: rect.left,
+ y: rect.top
};
}
@@ -2368,10 +2363,6 @@
requiresIfExists: ['preventOverflow']
};
- function getVariation(placement) {
- return placement.split('-')[1];
- }
-
var unsetSides = {
top: 'auto',
right: 'auto',
@@ -2398,7 +2389,6 @@
var popper = _ref2.popper,
popperRect = _ref2.popperRect,
placement = _ref2.placement,
- variation = _ref2.variation,
offsets = _ref2.offsets,
position = _ref2.position,
gpuAcceleration = _ref2.gpuAcceleration,
@@ -2425,7 +2415,7 @@
if (offsetParent === getWindow(popper)) {
offsetParent = getDocumentElement(popper);
- if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') {
+ if (getComputedStyle$1(offsetParent).position !== 'static') {
heightProp = 'scrollHeight';
widthProp = 'scrollWidth';
}
@@ -2434,14 +2424,14 @@
offsetParent = offsetParent;
- if (placement === top || (placement === left || placement === right) && variation === end) {
+ if (placement === top) {
sideY = bottom; // $FlowFixMe[prop-missing]
y -= offsetParent[heightProp] - popperRect.height;
y *= gpuAcceleration ? 1 : -1;
}
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
+ if (placement === left) {
sideX = right; // $FlowFixMe[prop-missing]
x -= offsetParent[widthProp] - popperRect.width;
@@ -2456,7 +2446,7 @@
if (gpuAcceleration) {
var _Object$assign;
- return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
}
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
@@ -2474,7 +2464,6 @@
var commonStyles = {
placement: getBasePlacement(state.placement),
- variation: getVariation(state.placement),
popper: state.elements.popper,
popperRect: state.rects.popper,
gpuAcceleration: gpuAcceleration
@@ -2777,6 +2766,10 @@
return clippingRect;
}
+ function getVariation(placement) {
+ return placement.split('-')[1];
+ }
+
function computeOffsets(_ref) {
var reference = _ref.reference,
element = _ref.element,
@@ -2862,10 +2855,11 @@
padding = _options$padding === void 0 ? 0 : _options$padding;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
var altContext = elementContext === popper ? reference : popper;
+ var referenceElement = state.elements.reference;
var popperRect = state.rects.popper;
var element = state.elements[altBoundary ? altContext : elementContext];
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
+ var referenceClientRect = getBoundingClientRect(referenceElement);
var popperOffsets = computeOffsets({
reference: referenceClientRect,
element: popperRect,
@@ -3342,24 +3336,16 @@
}
}
- function isElementScaled(element) {
- var rect = element.getBoundingClientRect();
- var scaleX = rect.width / element.offsetWidth || 1;
- var scaleY = rect.height / element.offsetHeight || 1;
- return scaleX !== 1 || scaleY !== 1;
- } // Returns the composite rect of an element relative to its offsetParent.
// Composite means it takes into account transforms as well as layout.
-
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
}
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
var documentElement = getDocumentElement(offsetParent);
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
+ var rect = getBoundingClientRect(elementOrVirtualElement);
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
var scroll = {
scrollLeft: 0,
scrollTop: 0
@@ -3376,7 +3362,7 @@
}
if (isHTMLElement(offsetParent)) {
- offsets = getBoundingClientRect(offsetParent, true);
+ offsets = getBoundingClientRect(offsetParent);
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
@@ -3513,8 +3499,7 @@
var isDestroyed = false;
var instance = {
state: state,
- setOptions: function setOptions(setOptionsAction) {
- var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
+ setOptions: function setOptions(options) {
cleanupModifierEffects();
state.options = Object.assign({}, defaultOptions, state.options, options);
state.scrollParents = {
@@ -3713,7 +3698,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): dropdown.js
+ * Bootstrap (v5.0.2): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3723,26 +3708,27 @@
* ------------------------------------------------------------------------
*/
- const NAME$9 = 'dropdown';
- const DATA_KEY$8 = 'bs.dropdown';
- const EVENT_KEY$8 = `.${DATA_KEY$8}`;
+ const NAME$8 = 'dropdown';
+ const DATA_KEY$7 = 'bs.dropdown';
+ const EVENT_KEY$7 = `.${DATA_KEY$7}`;
const DATA_API_KEY$4 = '.data-api';
const ESCAPE_KEY$2 = 'Escape';
const SPACE_KEY = 'Space';
- const TAB_KEY$1 = 'Tab';
+ const TAB_KEY = 'Tab';
const ARROW_UP_KEY = 'ArrowUp';
const ARROW_DOWN_KEY = 'ArrowDown';
const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
- const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`;
- const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
- const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
- const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
- const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`;
- const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`;
- const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`;
- const CLASS_NAME_SHOW$6 = 'show';
+ const EVENT_HIDE$4 = `hide${EVENT_KEY$7}`;
+ const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$7}`;
+ const EVENT_SHOW$4 = `show${EVENT_KEY$7}`;
+ const EVENT_SHOWN$4 = `shown${EVENT_KEY$7}`;
+ const EVENT_CLICK = `click${EVENT_KEY$7}`;
+ const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
+ const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
+ const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
+ const CLASS_NAME_SHOW$7 = 'show';
const CLASS_NAME_DROPUP = 'dropup';
const CLASS_NAME_DROPEND = 'dropend';
const CLASS_NAME_DROPSTART = 'dropstart';
@@ -3757,7 +3743,7 @@
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
- const Default$8 = {
+ const Default$7 = {
offset: [0, 2],
boundary: 'clippingParents',
reference: 'toggle',
@@ -3765,7 +3751,7 @@
popperConfig: null,
autoClose: true
};
- const DefaultType$8 = {
+ const DefaultType$7 = {
offset: '(array|string|function)',
boundary: '(string|element)',
reference: '(string|element|object)',
@@ -3786,31 +3772,45 @@
this._config = this._getConfig(config);
this._menu = this._getMenuElement();
this._inNavbar = this._detectNavbar();
+
+ this._addEventListeners();
} // Getters
static get Default() {
- return Default$8;
+ return Default$7;
}
static get DefaultType() {
- return DefaultType$8;
+ return DefaultType$7;
}
static get NAME() {
- return NAME$9;
+ return NAME$8;
} // Public
toggle() {
- return this._isShown() ? this.hide() : this.show();
+ if (isDisabled(this._element)) {
+ return;
+ }
+
+ const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
+
+ if (isActive) {
+ this.hide();
+ return;
+ }
+
+ this.show();
}
show() {
- if (isDisabled(this._element) || this._isShown(this._menu)) {
+ if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
return;
}
+ const parent = Dropdown.getParentFromElement(this._element);
const relatedTarget = {
relatedTarget: this._element
};
@@ -3818,14 +3818,34 @@
if (showEvent.defaultPrevented) {
return;
- }
+ } // Totally disable Popper for Dropdowns in Navbar
- const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
if (this._inNavbar) {
Manipulator.setDataAttribute(this._menu, 'popper', 'none');
} else {
- this._createPopper(parent);
+ if (typeof Popper === 'undefined') {
+ throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
+ }
+
+ let referenceElement = this._element;
+
+ if (this._config.reference === 'parent') {
+ referenceElement = parent;
+ } else if (isElement$1(this._config.reference)) {
+ referenceElement = getElement(this._config.reference);
+ } else if (typeof this._config.reference === 'object') {
+ referenceElement = this._config.reference;
+ }
+
+ const popperConfig = this._getPopperConfig();
+
+ const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
+ this._popper = createPopper(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
@@ -3840,15 +3860,15 @@
this._element.setAttribute('aria-expanded', true);
- this._menu.classList.add(CLASS_NAME_SHOW$6);
+ this._menu.classList.toggle(CLASS_NAME_SHOW$7);
- this._element.classList.add(CLASS_NAME_SHOW$6);
+ this._element.classList.toggle(CLASS_NAME_SHOW$7);
EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
}
hide() {
- if (isDisabled(this._element) || !this._isShown(this._menu)) {
+ if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
return;
}
@@ -3876,6 +3896,13 @@
} // Private
+ _addEventListeners() {
+ EventHandler.on(this._element, EVENT_CLICK, event => {
+ event.preventDefault();
+ this.toggle();
+ });
+ }
+
_completeHide(relatedTarget) {
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
@@ -3893,9 +3920,9 @@
this._popper.destroy();
}
- this._menu.classList.remove(CLASS_NAME_SHOW$6);
+ this._menu.classList.remove(CLASS_NAME_SHOW$7);
- this._element.classList.remove(CLASS_NAME_SHOW$6);
+ this._element.classList.remove(CLASS_NAME_SHOW$7);
this._element.setAttribute('aria-expanded', 'false');
@@ -3908,45 +3935,16 @@
...Manipulator.getDataAttributes(this._element),
...config
};
- typeCheckConfig(NAME$9, config, this.constructor.DefaultType);
+ typeCheckConfig(NAME$8, config, this.constructor.DefaultType);
if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
// Popper virtual elements require a getBoundingClientRect method
- throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
+ throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
}
return config;
}
- _createPopper(parent) {
- if (typeof Popper === 'undefined') {
- throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
- }
-
- let referenceElement = this._element;
-
- if (this._config.reference === 'parent') {
- referenceElement = parent;
- } else if (isElement$1(this._config.reference)) {
- referenceElement = getElement(this._config.reference);
- } else if (typeof this._config.reference === 'object') {
- referenceElement = this._config.reference;
- }
-
- const popperConfig = this._getPopperConfig();
-
- const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
- this._popper = createPopper(referenceElement, this._menu, popperConfig);
-
- if (isDisplayStatic) {
- Manipulator.setDataAttribute(this._menu, 'popper', 'static');
- }
- }
-
- _isShown(element = this._element) {
- return element.classList.contains(CLASS_NAME_SHOW$6);
- }
-
_getMenuElement() {
return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
}
@@ -4036,24 +4034,26 @@
} // Static
- static jQueryInterface(config) {
- return this.each(function () {
- const data = Dropdown.getOrCreateInstance(this, config);
-
- if (typeof config !== 'string') {
- return;
- }
+ static dropdownInterface(element, config) {
+ const data = Dropdown.getOrCreateInstance(element, config);
+ if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
+ }
+ }
+
+ static jQueryInterface(config) {
+ return this.each(function () {
+ Dropdown.dropdownInterface(this, config);
});
}
static clearMenus(event) {
- if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
+ if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
return;
}
@@ -4066,7 +4066,7 @@
continue;
}
- if (!context._isShown()) {
+ if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) {
continue;
}
@@ -4083,7 +4083,7 @@
} // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
- if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
+ if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
continue;
}
@@ -4112,7 +4112,7 @@
return;
}
- const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
+ const isActive = this.classList.contains(CLASS_NAME_SHOW$7);
if (!isActive && event.key === ESCAPE_KEY$2) {
return;
@@ -4125,20 +4125,20 @@
return;
}
- const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
- const instance = Dropdown.getOrCreateInstance(getToggleButton);
+ const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
if (event.key === ESCAPE_KEY$2) {
- instance.hide();
+ getToggleButton().focus();
+ Dropdown.clearMenus();
return;
}
if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
if (!isActive) {
- instance.show();
+ getToggleButton().click();
}
- instance._selectMenuItem(event);
+ Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
return;
}
@@ -4162,7 +4162,7 @@
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
event.preventDefault();
- Dropdown.getOrCreateInstance(this).toggle();
+ Dropdown.dropdownInterface(this);
});
/**
* ------------------------------------------------------------------------
@@ -4175,7 +4175,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/scrollBar.js
+ * Bootstrap (v5.0.2): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4279,12 +4279,11 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/backdrop.js
+ * Bootstrap (v5.0.2): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
- const Default$7 = {
- className: 'modal-backdrop',
+ const Default$6 = {
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
@@ -4292,17 +4291,17 @@
// give the choice to place backdrop under different elements
clickCallback: null
};
- const DefaultType$7 = {
- className: 'string',
+ const DefaultType$6 = {
isVisible: 'boolean',
isAnimated: 'boolean',
rootElement: '(element|string)',
clickCallback: '(function|null)'
};
- const NAME$8 = 'backdrop';
- const CLASS_NAME_FADE$4 = 'fade';
- const CLASS_NAME_SHOW$5 = 'show';
- const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`;
+ const NAME$7 = 'backdrop';
+ const CLASS_NAME_BACKDROP = 'modal-backdrop';
+ const CLASS_NAME_FADE$5 = 'fade';
+ const CLASS_NAME_SHOW$6 = 'show';
+ const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
class Backdrop {
constructor(config) {
@@ -4323,7 +4322,7 @@
reflow(this._getElement());
}
- this._getElement().classList.add(CLASS_NAME_SHOW$5);
+ this._getElement().classList.add(CLASS_NAME_SHOW$6);
this._emulateAnimation(() => {
execute(callback);
@@ -4336,7 +4335,7 @@
return;
}
- this._getElement().classList.remove(CLASS_NAME_SHOW$5);
+ this._getElement().classList.remove(CLASS_NAME_SHOW$6);
this._emulateAnimation(() => {
this.dispose();
@@ -4348,10 +4347,10 @@
_getElement() {
if (!this._element) {
const backdrop = document.createElement('div');
- backdrop.className = this._config.className;
+ backdrop.className = CLASS_NAME_BACKDROP;
if (this._config.isAnimated) {
- backdrop.classList.add(CLASS_NAME_FADE$4);
+ backdrop.classList.add(CLASS_NAME_FADE$5);
}
this._element = backdrop;
@@ -4361,12 +4360,12 @@
}
_getConfig(config) {
- config = { ...Default$7,
+ config = { ...Default$6,
...(typeof config === 'object' ? config : {})
}; // use getElement() with the default "body" to get a fresh Element on each instantiation
config.rootElement = getElement(config.rootElement);
- typeCheckConfig(NAME$8, config, DefaultType$7);
+ typeCheckConfig(NAME$7, config, DefaultType$6);
return config;
}
@@ -4375,7 +4374,7 @@
return;
}
- this._config.rootElement.append(this._getElement());
+ this._config.rootElement.appendChild(this._getElement());
EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
execute(this._config.clickCallback);
@@ -4403,110 +4402,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/focustrap.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * --------------------------------------------------------------------------
- */
- const Default$6 = {
- trapElement: null,
- // The element to trap focus inside of
- autofocus: true
- };
- const DefaultType$6 = {
- trapElement: 'element',
- autofocus: 'boolean'
- };
- const NAME$7 = 'focustrap';
- const DATA_KEY$7 = 'bs.focustrap';
- const EVENT_KEY$7 = `.${DATA_KEY$7}`;
- const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`;
- const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`;
- const TAB_KEY = 'Tab';
- const TAB_NAV_FORWARD = 'forward';
- const TAB_NAV_BACKWARD = 'backward';
-
- class FocusTrap {
- constructor(config) {
- this._config = this._getConfig(config);
- this._isActive = false;
- this._lastTabNavDirection = null;
- }
-
- activate() {
- const {
- trapElement,
- autofocus
- } = this._config;
-
- if (this._isActive) {
- return;
- }
-
- if (autofocus) {
- trapElement.focus();
- }
-
- EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop
-
- EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
- EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
- this._isActive = true;
- }
-
- deactivate() {
- if (!this._isActive) {
- return;
- }
-
- this._isActive = false;
- EventHandler.off(document, EVENT_KEY$7);
- } // Private
-
-
- _handleFocusin(event) {
- const {
- target
- } = event;
- const {
- trapElement
- } = this._config;
-
- if (target === document || target === trapElement || trapElement.contains(target)) {
- return;
- }
-
- const elements = SelectorEngine.focusableChildren(trapElement);
-
- if (elements.length === 0) {
- trapElement.focus();
- } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
- elements[elements.length - 1].focus();
- } else {
- elements[0].focus();
- }
- }
-
- _handleKeydown(event) {
- if (event.key !== TAB_KEY) {
- return;
- }
-
- this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
- }
-
- _getConfig(config) {
- config = { ...Default$6,
- ...(typeof config === 'object' ? config : {})
- };
- typeCheckConfig(NAME$7, config, DefaultType$6);
- return config;
- }
-
- }
-
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): modal.js
+ * Bootstrap (v5.0.2): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4536,20 +4432,21 @@
const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
+ const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$6}`;
const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
- const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`;
+ const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
const CLASS_NAME_OPEN = 'modal-open';
- const CLASS_NAME_FADE$3 = 'fade';
- const CLASS_NAME_SHOW$4 = 'show';
+ const CLASS_NAME_FADE$4 = 'fade';
+ const CLASS_NAME_SHOW$5 = 'show';
const CLASS_NAME_STATIC = 'modal-static';
- const OPEN_SELECTOR$1 = '.modal.show';
const SELECTOR_DIALOG = '.modal-dialog';
const SELECTOR_MODAL_BODY = '.modal-body';
const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
+ const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -4562,7 +4459,6 @@
this._config = this._getConfig(config);
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
this._backdrop = this._initializeBackDrop();
- this._focustrap = this._initializeFocusTrap();
this._isShown = false;
this._ignoreBackdropClick = false;
this._isTransitioning = false;
@@ -4612,6 +4508,7 @@
this._setResizeEvent();
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event));
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
if (event.target === this._element) {
@@ -4623,7 +4520,11 @@
this._showBackdrop(() => this._showElement(relatedTarget));
}
- hide() {
+ hide(event) {
+ if (event && ['A', 'AREA'].includes(event.target.tagName)) {
+ event.preventDefault();
+ }
+
if (!this._isShown || this._isTransitioning) {
return;
}
@@ -4646,11 +4547,11 @@
this._setResizeEvent();
- this._focustrap.deactivate();
+ EventHandler.off(document, EVENT_FOCUSIN$2);
- this._element.classList.remove(CLASS_NAME_SHOW$4);
+ this._element.classList.remove(CLASS_NAME_SHOW$5);
- EventHandler.off(this._element, EVENT_CLICK_DISMISS);
+ EventHandler.off(this._element, EVENT_CLICK_DISMISS$2);
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
this._queueCallback(() => this._hideModal(), this._element, isAnimated);
@@ -4661,9 +4562,14 @@
this._backdrop.dispose();
- this._focustrap.deactivate();
-
super.dispose();
+ /**
+ * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
+ * Do not move `document` in `htmlElements` array
+ * It will remove `EVENT_CLICK_DATA_API` event that should remain
+ */
+
+ EventHandler.off(document, EVENT_FOCUSIN$2);
}
handleUpdate() {
@@ -4679,12 +4585,6 @@
});
}
- _initializeFocusTrap() {
- return new FocusTrap({
- trapElement: this._element
- });
- }
-
_getConfig(config) {
config = { ...Default$5,
...Manipulator.getDataAttributes(this._element),
@@ -4701,7 +4601,7 @@
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
// Don't move modal's DOM position
- document.body.append(this._element);
+ document.body.appendChild(this._element);
}
this._element.style.display = 'block';
@@ -4722,11 +4622,15 @@
reflow(this._element);
}
- this._element.classList.add(CLASS_NAME_SHOW$4);
+ this._element.classList.add(CLASS_NAME_SHOW$5);
+
+ if (this._config.focus) {
+ this._enforceFocus();
+ }
const transitionComplete = () => {
if (this._config.focus) {
- this._focustrap.activate();
+ this._element.focus();
}
this._isTransitioning = false;
@@ -4738,6 +4642,16 @@
this._queueCallback(transitionComplete, this._dialog, isAnimated);
}
+ _enforceFocus() {
+ EventHandler.off(document, EVENT_FOCUSIN$2); // guard against infinite focus loop
+
+ EventHandler.on(document, EVENT_FOCUSIN$2, event => {
+ if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
+ this._element.focus();
+ }
+ });
+ }
+
_setEscapeEvent() {
if (this._isShown) {
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
@@ -4784,7 +4698,7 @@
}
_showBackdrop(callback) {
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
if (this._ignoreBackdropClick) {
this._ignoreBackdropClick = false;
return;
@@ -4805,7 +4719,7 @@
}
_isAnimated() {
- return this._element.classList.contains(CLASS_NAME_FADE$3);
+ return this._element.classList.contains(CLASS_NAME_FADE$4);
}
_triggerBackdropTransition() {
@@ -4912,18 +4826,10 @@
this.focus();
}
});
- }); // avoid conflict when clicking moddal toggler while another one is open
-
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
-
- if (allReadyOpen) {
- Modal.getInstance(allReadyOpen).hide();
- }
-
+ });
const data = Modal.getOrCreateInstance(target);
data.toggle(this);
});
- enableDismissTrigger(Modal);
/**
* ------------------------------------------------------------------------
* jQuery
@@ -4935,7 +4841,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): offcanvas.js
+ * Bootstrap (v5.0.2): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4961,15 +4867,17 @@
keyboard: 'boolean',
scroll: 'boolean'
};
- const CLASS_NAME_SHOW$3 = 'show';
- const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
+ const CLASS_NAME_SHOW$4 = 'show';
const OPEN_SELECTOR = '.offcanvas.show';
const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
+ const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$5}`;
const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
+ const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
+ const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
/**
* ------------------------------------------------------------------------
@@ -4983,7 +4891,6 @@
this._config = this._getConfig(config);
this._isShown = false;
this._backdrop = this._initializeBackDrop();
- this._focustrap = this._initializeFocusTrap();
this._addEventListeners();
} // Getters
@@ -5022,6 +4929,8 @@
if (!this._config.scroll) {
new ScrollBarHelper().hide();
+
+ this._enforceFocusOnElement(this._element);
}
this._element.removeAttribute('aria-hidden');
@@ -5030,13 +4939,9 @@
this._element.setAttribute('role', 'dialog');
- this._element.classList.add(CLASS_NAME_SHOW$3);
+ this._element.classList.add(CLASS_NAME_SHOW$4);
const completeCallBack = () => {
- if (!this._config.scroll) {
- this._focustrap.activate();
- }
-
EventHandler.trigger(this._element, EVENT_SHOWN$2, {
relatedTarget
});
@@ -5056,13 +4961,13 @@
return;
}
- this._focustrap.deactivate();
+ EventHandler.off(document, EVENT_FOCUSIN$1);
this._element.blur();
this._isShown = false;
- this._element.classList.remove(CLASS_NAME_SHOW$3);
+ this._element.classList.remove(CLASS_NAME_SHOW$4);
this._backdrop.hide();
@@ -5088,9 +4993,8 @@
dispose() {
this._backdrop.dispose();
- this._focustrap.deactivate();
-
super.dispose();
+ EventHandler.off(document, EVENT_FOCUSIN$1);
} // Private
@@ -5105,7 +5009,6 @@
_initializeBackDrop() {
return new Backdrop({
- className: CLASS_NAME_BACKDROP,
isVisible: this._config.backdrop,
isAnimated: true,
rootElement: this._element.parentNode,
@@ -5113,13 +5016,19 @@
});
}
- _initializeFocusTrap() {
- return new FocusTrap({
- trapElement: this._element
+ _enforceFocusOnElement(element) {
+ EventHandler.off(document, EVENT_FOCUSIN$1); // guard against infinite focus loop
+
+ EventHandler.on(document, EVENT_FOCUSIN$1, event => {
+ if (document !== event.target && element !== event.target && !element.contains(event.target)) {
+ element.focus();
+ }
});
+ element.focus();
}
_addEventListeners() {
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
if (this._config.keyboard && event.key === ESCAPE_KEY) {
this.hide();
@@ -5180,7 +5089,6 @@
data.toggle(this);
});
EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
- enableDismissTrigger(Offcanvas);
/**
* ------------------------------------------------------------------------
* jQuery
@@ -5191,7 +5099,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): util/sanitizer.js
+ * Bootstrap (v5.0.2): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -5304,7 +5212,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): tooltip.js
+ * Bootstrap (v5.0.2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -5318,6 +5226,7 @@
const DATA_KEY$4 = 'bs.tooltip';
const EVENT_KEY$4 = `.${DATA_KEY$4}`;
const CLASS_PREFIX$1 = 'bs-tooltip';
+ const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
const DefaultType$3 = {
animation: 'boolean',
@@ -5376,14 +5285,12 @@
MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
};
- const CLASS_NAME_FADE$2 = 'fade';
+ const CLASS_NAME_FADE$3 = 'fade';
const CLASS_NAME_MODAL = 'modal';
- const CLASS_NAME_SHOW$2 = 'show';
+ const CLASS_NAME_SHOW$3 = 'show';
const HOVER_STATE_SHOW = 'show';
const HOVER_STATE_OUT = 'out';
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
- const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
- const EVENT_MODAL_HIDE = 'hide.bs.modal';
const TRIGGER_HOVER = 'hover';
const TRIGGER_FOCUS = 'focus';
const TRIGGER_CLICK = 'click';
@@ -5460,7 +5367,7 @@
context._leave(null, context);
}
} else {
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) {
+ if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
this._leave(null, this);
return;
@@ -5472,13 +5379,15 @@
dispose() {
clearTimeout(this._timeout);
- EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
+ EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
if (this.tip) {
this.tip.remove();
}
- this._disposePopper();
+ if (this._popper) {
+ this._popper.destroy();
+ }
super.dispose();
}
@@ -5498,15 +5407,6 @@
if (showEvent.defaultPrevented || !isInTheDom) {
return;
- } // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title`
- // This will be removed later in favor of a `setContent` method
-
-
- if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
- this._disposePopper();
-
- this.tip.remove();
- this.tip = null;
}
const tip = this.getTipElement();
@@ -5515,8 +5415,10 @@
this._element.setAttribute('aria-describedby', tipId);
+ this.setContent();
+
if (this._config.animation) {
- tip.classList.add(CLASS_NAME_FADE$2);
+ tip.classList.add(CLASS_NAME_FADE$3);
}
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
@@ -5531,7 +5433,7 @@
Data.set(tip, this.constructor.DATA_KEY, this);
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
- container.append(tip);
+ container.appendChild(tip);
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
}
@@ -5541,9 +5443,8 @@
this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment));
}
- tip.classList.add(CLASS_NAME_SHOW$2);
-
- const customClass = this._resolvePossibleFunction(this._config.customClass);
+ tip.classList.add(CLASS_NAME_SHOW$3);
+ const customClass = typeof this._config.customClass === 'function' ? this._config.customClass() : this._config.customClass;
if (customClass) {
tip.classList.add(...customClass.split(' '));
@@ -5569,7 +5470,7 @@
}
};
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
this._queueCallback(complete, this.tip, isAnimated);
}
@@ -5596,7 +5497,11 @@
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
- this._disposePopper();
+ if (this._popper) {
+ this._popper.destroy();
+
+ this._popper = null;
+ }
};
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
@@ -5605,7 +5510,7 @@
return;
}
- tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra
+ tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
@@ -5615,7 +5520,7 @@
this._activeTrigger[TRIGGER_CLICK] = false;
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
this._queueCallback(complete, this.tip, isAnimated);
@@ -5640,27 +5545,14 @@
const element = document.createElement('div');
element.innerHTML = this._config.template;
- const tip = element.children[0];
- this.setContent(tip);
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
- this.tip = tip;
+ this.tip = element.children[0];
return this.tip;
}
- setContent(tip) {
- this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
- }
-
- _sanitizeAndSetContent(template, content, selector) {
- const templateElement = SelectorEngine.findOne(selector, template);
-
- if (!content && templateElement) {
- templateElement.remove();
- return;
- } // we use append for html objects to maintain js events
-
-
- this.setElementContent(templateElement, content);
+ setContent() {
+ const tip = this.getTipElement();
+ this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
+ tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
}
setElementContent(element, content) {
@@ -5674,7 +5566,7 @@
if (this._config.html) {
if (content.parentNode !== element) {
element.innerHTML = '';
- element.append(content);
+ element.appendChild(content);
}
} else {
element.textContent = content.textContent;
@@ -5695,9 +5587,13 @@
}
getTitle() {
- const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
+ let title = this._element.getAttribute('data-bs-original-title');
- return this._resolvePossibleFunction(title);
+ if (!title) {
+ title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
+ }
+
+ return title;
}
updateAttachment(attachment) {
@@ -5714,7 +5610,15 @@
_initializeOnDelegatedTarget(event, context) {
- return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
+ const dataKey = this.constructor.DATA_KEY;
+ context = context || Data.get(event.delegateTarget, dataKey);
+
+ if (!context) {
+ context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
+ Data.set(event.delegateTarget, dataKey, context);
+ }
+
+ return context;
}
_getOffset() {
@@ -5733,10 +5637,6 @@
return offset;
}
- _resolvePossibleFunction(content) {
- return typeof content === 'function' ? content.call(this._element) : content;
- }
-
_getPopperConfig(attachment) {
const defaultBsPopperConfig = {
placement: attachment,
@@ -5778,7 +5678,7 @@
}
_addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
+ this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`);
}
_getAttachment(placement) {
@@ -5805,7 +5705,7 @@
}
};
- EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
+ EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
if (this._config.selector) {
this._config = { ...this._config,
@@ -5840,7 +5740,7 @@
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
}
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) {
+ if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
context._hoverState = HOVER_STATE_SHOW;
return;
}
@@ -5936,32 +5836,26 @@
_getDelegateConfig() {
const config = {};
- for (const key in this._config) {
- if (this.constructor.Default[key] !== this._config[key]) {
- config[key] = this._config[key];
+ if (this._config) {
+ for (const key in this._config) {
+ if (this.constructor.Default[key] !== this._config[key]) {
+ config[key] = this._config[key];
+ }
}
- } // In the future can be replaced with:
- // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
- // `Object.fromEntries(keysWithDifferentValues)`
-
+ }
return config;
}
_cleanTipClass() {
const tip = this.getTipElement();
- const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
- const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
+ const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
if (tabClass !== null && tabClass.length > 0) {
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
}
}
- _getBasicClassPrefix() {
- return CLASS_PREFIX$1;
- }
-
_handlePopperPlacementChange(popperData) {
const {
state
@@ -5976,14 +5870,6 @@
this._cleanTipClass();
this._addAttachmentClass(this._getAttachment(state.placement));
- }
-
- _disposePopper() {
- if (this._popper) {
- this._popper.destroy();
-
- this._popper = null;
- }
} // Static
@@ -6014,7 +5900,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): popover.js
+ * Bootstrap (v5.0.2): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -6028,6 +5914,7 @@
const DATA_KEY$3 = 'bs.popover';
const EVENT_KEY$3 = `.${DATA_KEY$3}`;
const CLASS_PREFIX = 'bs-popover';
+ const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
const Default$2 = { ...Tooltip.Default,
placement: 'right',
offset: [0, 8],
@@ -6050,6 +5937,8 @@
MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
};
+ const CLASS_NAME_FADE$2 = 'fade';
+ const CLASS_NAME_SHOW$2 = 'show';
const SELECTOR_TITLE = '.popover-header';
const SELECTOR_CONTENT = '.popover-body';
/**
@@ -6081,19 +5970,55 @@
return this.getTitle() || this._getContent();
}
- setContent(tip) {
- this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
+ getTipElement() {
+ if (this.tip) {
+ return this.tip;
+ }
+
+ this.tip = super.getTipElement();
+
+ if (!this.getTitle()) {
+ SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
+ }
+
+ if (!this._getContent()) {
+ SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
+ }
+
+ return this.tip;
+ }
+
+ setContent() {
+ const tip = this.getTipElement(); // we use append for html objects to maintain js events
+
+ this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
+
+ let content = this._getContent();
+
+ if (typeof content === 'function') {
+ content = content.call(this._element);
+ }
- this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
+ this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
+ tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
} // Private
+ _addAttachmentClass(attachment) {
+ this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
+ }
+
_getContent() {
- return this._resolvePossibleFunction(this._config.content);
+ return this._element.getAttribute('data-bs-content') || this._config.content;
}
- _getBasicClassPrefix() {
- return CLASS_PREFIX;
+ _cleanTipClass() {
+ const tip = this.getTipElement();
+ const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
+
+ if (tabClass !== null && tabClass.length > 0) {
+ tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
+ }
} // Static
@@ -6124,7 +6049,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): scrollspy.js
+ * Bootstrap (v5.0.2): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -6158,7 +6083,6 @@
const SELECTOR_NAV_LINKS = '.nav-link';
const SELECTOR_NAV_ITEMS = '.nav-item';
const SELECTOR_LIST_ITEMS = '.list-group-item';
- const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
const SELECTOR_DROPDOWN$1 = '.dropdown';
const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
const METHOD_OFFSET = 'offset';
@@ -6174,6 +6098,7 @@
super(element);
this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
this._config = this._getConfig(config);
+ this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
this._offsets = [];
this._targets = [];
this._activeTarget = null;
@@ -6201,7 +6126,7 @@
this._offsets = [];
this._targets = [];
this._scrollHeight = this._getScrollHeight();
- const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target);
+ const targets = SelectorEngine.find(this._selector);
targets.map(element => {
const targetSelector = getSelectorFromElement(element);
const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
@@ -6233,7 +6158,20 @@
...Manipulator.getDataAttributes(this._element),
...(typeof config === 'object' && config ? config : {})
};
- config.target = getElement(config.target) || document.documentElement;
+
+ if (typeof config.target !== 'string' && isElement$1(config.target)) {
+ let {
+ id
+ } = config.target;
+
+ if (!id) {
+ id = getUID(NAME$2);
+ config.target.id = id;
+ }
+
+ config.target = `#${id}`;
+ }
+
typeCheckConfig(NAME$2, config, DefaultType$1);
return config;
}
@@ -6293,13 +6231,16 @@
this._clear();
- const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
- const link = SelectorEngine.findOne(queries.join(','), this._config.target);
- link.classList.add(CLASS_NAME_ACTIVE$1);
+ const queries = this._selector.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
+
+ const link = SelectorEngine.findOne(queries.join(','));
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
+ link.classList.add(CLASS_NAME_ACTIVE$1);
} else {
+ // Set triggered link as active
+ link.classList.add(CLASS_NAME_ACTIVE$1);
SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
// Set triggered links parents as active
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
@@ -6317,7 +6258,7 @@
}
_clear() {
- SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
+ SelectorEngine.find(this._selector).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
} // Static
@@ -6359,7 +6300,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): tab.js
+ * Bootstrap (v5.0.2): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -6557,7 +6498,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): toast.js
+ * Bootstrap (v5.0.2): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -6570,6 +6511,7 @@
const NAME = 'toast';
const DATA_KEY = 'bs.toast';
const EVENT_KEY = `.${DATA_KEY}`;
+ const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
@@ -6579,8 +6521,7 @@
const EVENT_SHOW = `show${EVENT_KEY}`;
const EVENT_SHOWN = `shown${EVENT_KEY}`;
const CLASS_NAME_FADE = 'fade';
- const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
-
+ const CLASS_NAME_HIDE = 'hide';
const CLASS_NAME_SHOW = 'show';
const CLASS_NAME_SHOWING = 'showing';
const DefaultType = {
@@ -6593,6 +6534,7 @@
autohide: true,
delay: 5000
};
+ const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -6640,18 +6582,17 @@
const complete = () => {
this._element.classList.remove(CLASS_NAME_SHOWING);
+ this._element.classList.add(CLASS_NAME_SHOW);
+
EventHandler.trigger(this._element, EVENT_SHOWN);
this._maybeScheduleHide();
};
- this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
-
+ this._element.classList.remove(CLASS_NAME_HIDE);
reflow(this._element);
- this._element.classList.add(CLASS_NAME_SHOW);
-
this._element.classList.add(CLASS_NAME_SHOWING);
this._queueCallback(complete, this._element, this._config.animation);
@@ -6669,17 +6610,12 @@
}
const complete = () => {
- this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
-
-
- this._element.classList.remove(CLASS_NAME_SHOWING);
-
- this._element.classList.remove(CLASS_NAME_SHOW);
+ this._element.classList.add(CLASS_NAME_HIDE);
EventHandler.trigger(this._element, EVENT_HIDDEN);
};
- this._element.classList.add(CLASS_NAME_SHOWING);
+ this._element.classList.remove(CLASS_NAME_SHOW);
this._queueCallback(complete, this._element, this._config.animation);
}
@@ -6747,6 +6683,7 @@
}
_setListeners() {
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
@@ -6774,8 +6711,6 @@
}
}
-
- enableDismissTrigger(Toast);
/**
* ------------------------------------------------------------------------
* jQuery
@@ -6783,11 +6718,12 @@
* add .Toast to jQuery only if jQuery is present
*/
+
defineJQueryPlugin(Toast);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): index.umd.js
+ * Bootstrap (v5.0.2): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/