aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/dist/js/bootstrap.esm.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/dist/js/bootstrap.esm.js')
-rw-r--r--vendor/twbs/bootstrap/dist/js/bootstrap.esm.js195
1 files changed, 94 insertions, 101 deletions
diff --git a/vendor/twbs/bootstrap/dist/js/bootstrap.esm.js b/vendor/twbs/bootstrap/dist/js/bootstrap.esm.js
index 66a976be2..b32daa8c4 100644
--- a/vendor/twbs/bootstrap/dist/js/bootstrap.esm.js
+++ b/vendor/twbs/bootstrap/dist/js/bootstrap.esm.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap v5.2.2 (https://getbootstrap.com/)
+ * Bootstrap v5.2.0 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
@@ -7,7 +7,7 @@ import * as Popper from '@popperjs/core';
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/index.js
+ * Bootstrap (v5.2.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -322,7 +322,7 @@ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dom/event-handler.js
+ * Bootstrap (v5.2.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -591,7 +591,7 @@ function hydrateObj(obj, meta) {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dom/data.js
+ * Bootstrap (v5.2.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -643,7 +643,7 @@ const Data = {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dom/manipulator.js
+ * Bootstrap (v5.2.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -713,7 +713,7 @@ const Manipulator = {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/config.js
+ * Bootstrap (v5.2.0): util/config.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -774,7 +774,7 @@ class Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): base-component.js
+ * Bootstrap (v5.2.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -782,7 +782,7 @@ class Config {
* Constants
*/
-const VERSION = '5.2.2';
+const VERSION = '5.2.0';
/**
* Class definition
*/
@@ -853,7 +853,7 @@ class BaseComponent extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/component-functions.js
+ * Bootstrap (v5.2.0): util/component-functions.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -879,7 +879,7 @@ const enableDismissTrigger = (component, method = 'hide') => {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): alert.js
+ * Bootstrap (v5.2.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -959,7 +959,7 @@ defineJQueryPlugin(Alert);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): button.js
+ * Bootstrap (v5.2.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1021,7 +1021,7 @@ defineJQueryPlugin(Button);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dom/selector-engine.js
+ * Bootstrap (v5.2.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1092,7 +1092,7 @@ const SelectorEngine = {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/swipe.js
+ * Bootstrap (v5.2.0): util/swipe.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1228,7 +1228,7 @@ class Swipe extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): carousel.js
+ * Bootstrap (v5.2.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1676,7 +1676,7 @@ defineJQueryPlugin(Carousel);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): collapse.js
+ * Bootstrap (v5.2.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1966,7 +1966,7 @@ defineJQueryPlugin(Collapse);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): dropdown.js
+ * Bootstrap (v5.2.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2036,9 +2036,8 @@ class Dropdown extends BaseComponent {
super(element, config);
this._popper = null;
this._parent = this._element.parentNode; // dropdown wrapper
- // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
- this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent);
+ this._menu = SelectorEngine.findOne(SELECTOR_MENU, this._parent);
this._inNavbar = this._detectNavbar();
} // Getters
@@ -2354,9 +2353,8 @@ class Dropdown extends BaseComponent {
return;
}
- event.preventDefault(); // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
-
- const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
+ event.preventDefault();
+ const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
const instance = Dropdown.getOrCreateInstance(getToggleButton);
if (isUpOrDownEvent) {
@@ -2398,7 +2396,7 @@ defineJQueryPlugin(Dropdown);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/scrollBar.js
+ * Bootstrap (v5.2.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2517,7 +2515,7 @@ class ScrollBarHelper {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/backdrop.js
+ * Bootstrap (v5.2.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2663,7 +2661,7 @@ class Backdrop extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/focustrap.js
+ * Bootstrap (v5.2.0): util/focustrap.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2772,7 +2770,7 @@ class FocusTrap extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): modal.js
+ * Bootstrap (v5.2.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2791,7 +2789,6 @@ const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
-const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
@@ -2984,22 +2981,20 @@ class Modal extends BaseComponent {
}
});
EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
- // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
- EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
- if (this._element !== event.target || this._element !== event2.target) {
- return;
- }
+ if (event.target !== event.currentTarget) {
+ // click is inside modal-dialog
+ return;
+ }
- if (this._config.backdrop === 'static') {
- this._triggerBackdropTransition();
+ if (this._config.backdrop === 'static') {
+ this._triggerBackdropTransition();
- return;
- }
+ return;
+ }
- if (this._config.backdrop) {
- this.hide();
- }
- });
+ if (this._config.backdrop) {
+ this.hide();
+ }
});
}
@@ -3148,7 +3143,7 @@ defineJQueryPlugin(Modal);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): offcanvas.js
+ * Bootstrap (v5.2.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3422,7 +3417,7 @@ defineJQueryPlugin(Offcanvas);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/sanitizer.js
+ * Bootstrap (v5.2.0): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3527,7 +3522,7 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): util/template-factory.js
+ * Bootstrap (v5.2.0): util/template-factory.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3685,7 +3680,7 @@ class TemplateFactory extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): tooltip.js
+ * Bootstrap (v5.2.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3774,7 +3769,7 @@ class Tooltip extends BaseComponent {
this._isEnabled = true;
this._timeout = 0;
- this._isHovered = null;
+ this._isHovered = false;
this._activeTrigger = {};
this._popper = null;
this._templateFactory = null;
@@ -3783,10 +3778,6 @@ class Tooltip extends BaseComponent {
this.tip = null;
this._setListeners();
-
- if (!this._config.selector) {
- this._fixTitle();
- }
} // Getters
@@ -3815,12 +3806,24 @@ class Tooltip extends BaseComponent {
this._isEnabled = !this._isEnabled;
}
- toggle() {
+ toggle(event) {
if (!this._isEnabled) {
return;
}
- this._activeTrigger.click = !this._activeTrigger.click;
+ if (event) {
+ const context = this._initializeOnDelegatedTarget(event);
+
+ context._activeTrigger.click = !context._activeTrigger.click;
+
+ if (context._isWithActiveTrigger()) {
+ context._enter();
+ } else {
+ context._leave();
+ }
+
+ return;
+ }
if (this._isShown()) {
this._leave();
@@ -3839,10 +3842,6 @@ class Tooltip extends BaseComponent {
this.tip.remove();
}
- if (this._element.getAttribute('data-bs-original-title')) {
- this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
- }
-
this._disposePopper();
super.dispose();
@@ -3903,13 +3902,13 @@ class Tooltip extends BaseComponent {
}
const complete = () => {
+ const previousHoverState = this._isHovered;
+ this._isHovered = false;
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
- if (this._isHovered === false) {
+ if (previousHoverState) {
this._leave();
}
-
- this._isHovered = false;
};
this._queueCallback(complete, this.tip, this._isAnimated());
@@ -3940,7 +3939,7 @@ class Tooltip extends BaseComponent {
this._activeTrigger[TRIGGER_CLICK] = false;
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
- this._isHovered = null; // it is a trick to support manual triggering
+ this._isHovered = false;
const complete = () => {
if (this._isWithActiveTrigger()) {
@@ -4033,7 +4032,7 @@ class Tooltip extends BaseComponent {
}
_getTitle() {
- return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
+ return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
} // Private
@@ -4119,11 +4118,7 @@ class Tooltip extends BaseComponent {
for (const trigger of triggers) {
if (trigger === 'click') {
- EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => {
- const context = this._initializeOnDelegatedTarget(event);
-
- context.toggle();
- });
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => this.toggle(event));
} else if (trigger !== TRIGGER_MANUAL) {
const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
@@ -4151,10 +4146,19 @@ class Tooltip extends BaseComponent {
};
EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
+
+ if (this._config.selector) {
+ this._config = { ...this._config,
+ trigger: 'manual',
+ selector: ''
+ };
+ } else {
+ this._fixTitle();
+ }
}
_fixTitle() {
- const title = this._element.getAttribute('title');
+ const title = this._config.originalTitle;
if (!title) {
return;
@@ -4164,9 +4168,6 @@ class Tooltip extends BaseComponent {
this._element.setAttribute('aria-label', title);
}
- this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
-
-
this._element.removeAttribute('title');
}
@@ -4238,6 +4239,8 @@ class Tooltip extends BaseComponent {
};
}
+ config.originalTitle = this._element.getAttribute('title') || '';
+
if (typeof config.title === 'number') {
config.title = config.title.toString();
}
@@ -4256,13 +4259,11 @@ class Tooltip extends BaseComponent {
if (this.constructor.Default[key] !== this._config[key]) {
config[key] = this._config[key];
}
- }
-
- config.selector = false;
- config.trigger = 'manual'; // In the future can be replaced with:
+ } // 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;
}
@@ -4301,7 +4302,7 @@ defineJQueryPlugin(Tooltip);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): popover.js
+ * Bootstrap (v5.2.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4384,7 +4385,7 @@ defineJQueryPlugin(Popover);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): scrollspy.js
+ * Bootstrap (v5.2.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4415,16 +4416,14 @@ const Default$1 = {
// TODO: v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: '0px 0px -25%',
smoothScroll: false,
- target: null,
- threshold: [0.1, 0.5, 1]
+ target: null
};
const DefaultType$1 = {
offset: '(number|null)',
// TODO v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: 'string',
smoothScroll: 'boolean',
- target: 'element',
- threshold: 'array'
+ target: 'element'
};
/**
* Class definition
@@ -4485,14 +4484,7 @@ class ScrollSpy extends BaseComponent {
_configAfterMerge(config) {
// TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
- config.target = getElement(config.target) || document.body; // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
-
- config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
-
- if (typeof config.threshold === 'string') {
- config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
- }
-
+ config.target = getElement(config.target) || document.body;
return config;
}
@@ -4528,8 +4520,8 @@ class ScrollSpy extends BaseComponent {
_getNewObserver() {
const options = {
root: this._rootElement,
- threshold: this._config.threshold,
- rootMargin: this._config.rootMargin
+ threshold: [0.1, 0.5, 1],
+ rootMargin: this._getRootMargin()
};
return new IntersectionObserver(entries => this._observerCallback(entries), options);
} // The logic of selection
@@ -4574,6 +4566,11 @@ class ScrollSpy extends BaseComponent {
activate(entry);
}
}
+ } // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
+
+
+ _getRootMargin() {
+ return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin;
}
_initializeTargetsAndObservables() {
@@ -4675,7 +4672,7 @@ defineJQueryPlugin(ScrollSpy);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): tab.js
+ * Bootstrap (v5.2.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4703,6 +4700,7 @@ const CLASS_NAME_SHOW$1 = 'show';
const CLASS_DROPDOWN = 'dropdown';
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
const SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
+const SELECTOR_DROPDOWN_ITEM = '.dropdown-item';
const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)';
const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
const SELECTOR_OUTER = '.nav-item, .list-group-item';
@@ -4781,6 +4779,7 @@ class Tab extends BaseComponent {
return;
}
+ element.focus();
element.removeAttribute('tabindex');
element.setAttribute('aria-selected', true);
@@ -4836,9 +4835,6 @@ class Tab extends BaseComponent {
const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true);
if (nextActiveElement) {
- nextActiveElement.focus({
- preventScroll: true
- });
Tab.getOrCreateInstance(nextActiveElement).show();
}
}
@@ -4914,6 +4910,7 @@ class Tab extends BaseComponent {
toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
+ toggle(SELECTOR_DROPDOWN_ITEM, CLASS_NAME_ACTIVE);
outerElem.setAttribute('aria-expanded', open);
}
@@ -4988,7 +4985,7 @@ defineJQueryPlugin(Tab);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): toast.js
+ * Bootstrap (v5.2.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -5139,17 +5136,13 @@ class Toast extends BaseComponent {
switch (event.type) {
case 'mouseover':
case 'mouseout':
- {
- this._hasMouseInteraction = isInteracting;
- break;
- }
+ this._hasMouseInteraction = isInteracting;
+ break;
case 'focusin':
case 'focusout':
- {
- this._hasKeyboardInteraction = isInteracting;
- break;
- }
+ this._hasKeyboardInteraction = isInteracting;
+ break;
}
if (isInteracting) {