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

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dist/js/bootstrap.esm.js')
-rw-r--r--dist/js/bootstrap.esm.js360
1 files changed, 176 insertions, 184 deletions
diff --git a/dist/js/bootstrap.esm.js b/dist/js/bootstrap.esm.js
index aa324296ac..b32daa8c45 100644
--- a/dist/js/bootstrap.esm.js
+++ b/dist/js/bootstrap.esm.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap v5.2.0-beta1 (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,13 +7,13 @@ import * as Popper from '@popperjs/core';
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/index.js
+ * Bootstrap (v5.2.0): 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)
+const TRANSITION_END = 'transitionend'; // Shout-out Angus Croll (https://goo.gl/pxwQGp)
const toType = object => {
if (object === null || object === undefined) {
@@ -322,7 +322,7 @@ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): dom/event-handler.js
+ * Bootstrap (v5.2.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -345,12 +345,12 @@ const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'cont
* Private methods
*/
-function getUidEvent(element, uid) {
+function makeEventUid(element, uid) {
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
}
-function getEvent(element) {
- const uid = getUidEvent(element);
+function getElementEvents(element) {
+ const uid = makeEventUid(element);
element.uidEvent = uid;
eventRegistry[uid] = eventRegistry[uid] || {};
return eventRegistry[uid];
@@ -358,7 +358,9 @@ function getEvent(element) {
function bootstrapHandler(element, fn) {
return function handler(event) {
- event.delegateTarget = element;
+ hydrateObj(event, {
+ delegateTarget: element
+ });
if (handler.oneOff) {
EventHandler.off(element, event.type, fn);
@@ -380,7 +382,9 @@ function bootstrapDelegationHandler(element, selector, fn) {
continue;
}
- event.delegateTarget = target;
+ hydrateObj(event, {
+ delegateTarget: target
+ });
if (handler.oneOff) {
EventHandler.off(element, event.type, selector, fn);
@@ -392,20 +396,21 @@ function bootstrapDelegationHandler(element, selector, fn) {
};
}
-function findHandler(events, handler, delegationSelector = null) {
- return Object.values(events).find(event => event.originalHandler === handler && event.delegationSelector === delegationSelector);
+function findHandler(events, callable, delegationSelector = null) {
+ return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
}
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
- const delegation = typeof handler === 'string';
- const originalHandler = delegation ? delegationFunction : handler;
+ const isDelegated = typeof handler === 'string'; // todo: tooltip passes `false` instead of selector, so we need to check
+
+ const callable = isDelegated ? delegationFunction : handler || delegationFunction;
let typeEvent = getTypeEvent(originalTypeEvent);
if (!nativeEvents.has(typeEvent)) {
typeEvent = originalTypeEvent;
}
- return [delegation, originalHandler, typeEvent];
+ return [isDelegated, callable, typeEvent];
}
function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
@@ -413,13 +418,9 @@ function addHandler(element, originalTypeEvent, handler, delegationFunction, one
return;
}
- if (!handler) {
- handler = delegationFunction;
- delegationFunction = null;
- } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
+ let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
-
if (originalTypeEvent in customEvents) {
const wrapFunction = fn => {
return function (event) {
@@ -429,31 +430,26 @@ function addHandler(element, originalTypeEvent, handler, delegationFunction, one
};
};
- if (delegationFunction) {
- delegationFunction = wrapFunction(delegationFunction);
- } else {
- handler = wrapFunction(handler);
- }
+ callable = wrapFunction(callable);
}
- const [delegation, originalHandler, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
- const events = getEvent(element);
+ const events = getElementEvents(element);
const handlers = events[typeEvent] || (events[typeEvent] = {});
- const previousFunction = findHandler(handlers, originalHandler, delegation ? handler : null);
+ const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
if (previousFunction) {
previousFunction.oneOff = previousFunction.oneOff && oneOff;
return;
}
- const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
- const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFunction) : bootstrapHandler(element, handler);
- fn.delegationSelector = delegation ? handler : null;
- fn.originalHandler = originalHandler;
+ const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
+ const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
+ fn.delegationSelector = isDelegated ? handler : null;
+ fn.callable = callable;
fn.oneOff = oneOff;
fn.uidEvent = uid;
handlers[uid] = fn;
- element.addEventListener(typeEvent, fn, delegation);
+ element.addEventListener(typeEvent, fn, isDelegated);
}
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
@@ -473,7 +469,7 @@ function removeNamespacedHandlers(element, events, typeEvent, namespace) {
for (const handlerKey of Object.keys(storeElementEvent)) {
if (handlerKey.includes(namespace)) {
const event = storeElementEvent[handlerKey];
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
}
}
@@ -498,18 +494,19 @@ const EventHandler = {
return;
}
- const [delegation, originalHandler, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
+ const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
const inNamespace = typeEvent !== originalTypeEvent;
- const events = getEvent(element);
+ const events = getElementEvents(element);
+ const storeElementEvent = events[typeEvent] || {};
const isNamespace = originalTypeEvent.startsWith('.');
- if (typeof originalHandler !== 'undefined') {
+ if (typeof callable !== 'undefined') {
// Simplest case: handler is passed, remove that listener ONLY.
- if (!events || !events[typeEvent]) {
+ if (!Object.keys(storeElementEvent).length) {
return;
}
- removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
+ removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
return;
}
@@ -519,14 +516,12 @@ const EventHandler = {
}
}
- const storeElementEvent = events[typeEvent] || {};
-
for (const keyHandlers of Object.keys(storeElementEvent)) {
const handlerKey = keyHandlers.replace(stripUidRegex, '');
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
const event = storeElementEvent[keyHandlers];
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
}
}
},
@@ -552,21 +547,11 @@ const EventHandler = {
defaultPrevented = jQueryEvent.isDefaultPrevented();
}
- const evt = new Event(event, {
+ let evt = new Event(event, {
bubbles,
cancelable: true
- }); // merge custom information in our event
-
- if (typeof args !== 'undefined') {
- for (const key of Object.keys(args)) {
- Object.defineProperty(evt, key, {
- get() {
- return args[key];
- }
-
- });
- }
- }
+ });
+ evt = hydrateObj(evt, args);
if (defaultPrevented) {
evt.preventDefault();
@@ -585,9 +570,28 @@ const EventHandler = {
};
+function hydrateObj(obj, meta) {
+ for (const [key, value] of Object.entries(meta || {})) {
+ try {
+ obj[key] = value;
+ } catch (_unused) {
+ Object.defineProperty(obj, key, {
+ configurable: true,
+
+ get() {
+ return value;
+ }
+
+ });
+ }
+ }
+
+ return obj;
+}
+
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): dom/data.js
+ * Bootstrap (v5.2.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -639,7 +643,7 @@ const Data = {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): dom/manipulator.js
+ * Bootstrap (v5.2.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -709,7 +713,7 @@ const Manipulator = {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/config.js
+ * Bootstrap (v5.2.0): util/config.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -770,7 +774,7 @@ class Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): base-component.js
+ * Bootstrap (v5.2.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -778,7 +782,7 @@ class Config {
* Constants
*/
-const VERSION = '5.2.0-beta1';
+const VERSION = '5.2.0';
/**
* Class definition
*/
@@ -849,7 +853,7 @@ class BaseComponent extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/component-functions.js
+ * Bootstrap (v5.2.0): util/component-functions.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -875,7 +879,7 @@ const enableDismissTrigger = (component, method = 'hide') => {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): alert.js
+ * Bootstrap (v5.2.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -955,7 +959,7 @@ defineJQueryPlugin(Alert);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): button.js
+ * Bootstrap (v5.2.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1017,7 +1021,7 @@ defineJQueryPlugin(Button);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): dom/selector-engine.js
+ * Bootstrap (v5.2.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1088,7 +1092,7 @@ const SelectorEngine = {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/swipe.js
+ * Bootstrap (v5.2.0): util/swipe.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1108,14 +1112,14 @@ const POINTER_TYPE_PEN = 'pen';
const CLASS_NAME_POINTER_EVENT = 'pointer-event';
const SWIPE_THRESHOLD = 40;
const Default$c = {
+ endCallback: null,
leftCallback: null,
- rightCallback: null,
- endCallback: null
+ rightCallback: null
};
const DefaultType$c = {
+ endCallback: '(function|null)',
leftCallback: '(function|null)',
- rightCallback: '(function|null)',
- endCallback: '(function|null)'
+ rightCallback: '(function|null)'
};
/**
* Class definition
@@ -1224,7 +1228,7 @@ class Swipe extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): carousel.js
+ * Bootstrap (v5.2.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1280,9 +1284,10 @@ const Default$b = {
};
const DefaultType$b = {
interval: '(number|boolean)',
+ // TODO:v6 remove boolean support
keyboard: 'boolean',
- ride: '(boolean|string)',
pause: '(string|boolean)',
+ ride: '(boolean|string)',
touch: 'boolean',
wrap: 'boolean'
};
@@ -1671,7 +1676,7 @@ defineJQueryPlugin(Carousel);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): collapse.js
+ * Bootstrap (v5.2.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1699,12 +1704,12 @@ const HEIGHT = 'height';
const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
const Default$a = {
- toggle: true,
- parent: null
+ parent: null,
+ toggle: true
};
const DefaultType$a = {
- toggle: 'boolean',
- parent: '(null|element)'
+ parent: '(null|element)',
+ toggle: 'boolean'
};
/**
* Class definition
@@ -1961,7 +1966,7 @@ defineJQueryPlugin(Collapse);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): dropdown.js
+ * Bootstrap (v5.2.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2007,20 +2012,20 @@ const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
const PLACEMENT_TOPCENTER = 'top';
const PLACEMENT_BOTTOMCENTER = 'bottom';
const Default$9 = {
- offset: [0, 2],
+ autoClose: true,
boundary: 'clippingParents',
- reference: 'toggle',
display: 'dynamic',
+ offset: [0, 2],
popperConfig: null,
- autoClose: true
+ reference: 'toggle'
};
const DefaultType$9 = {
- offset: '(array|string|function)',
+ autoClose: '(boolean|string)',
boundary: '(string|element)',
- reference: '(string|element|object)',
display: 'string',
+ offset: '(array|string|function)',
popperConfig: '(null|object|function)',
- autoClose: '(boolean|string)'
+ reference: '(string|element|object)'
};
/**
* Class definition
@@ -2391,7 +2396,7 @@ defineJQueryPlugin(Dropdown);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/scrollBar.js
+ * Bootstrap (v5.2.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2510,7 +2515,7 @@ class ScrollBarHelper {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/backdrop.js
+ * Bootstrap (v5.2.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2524,19 +2529,19 @@ const CLASS_NAME_SHOW$5 = 'show';
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
const Default$8 = {
className: 'modal-backdrop',
+ clickCallback: null,
+ isAnimated: false,
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
- isAnimated: false,
- rootElement: 'body',
- // give the choice to place backdrop under different elements
- clickCallback: null
+ rootElement: 'body' // give the choice to place backdrop under different elements
+
};
const DefaultType$8 = {
className: 'string',
- isVisible: 'boolean',
+ clickCallback: '(function|null)',
isAnimated: 'boolean',
- rootElement: '(element|string)',
- clickCallback: '(function|null)'
+ isVisible: 'boolean',
+ rootElement: '(element|string)'
};
/**
* Class definition
@@ -2656,7 +2661,7 @@ class Backdrop extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/focustrap.js
+ * Bootstrap (v5.2.0): util/focustrap.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2673,13 +2678,13 @@ const TAB_KEY = 'Tab';
const TAB_NAV_FORWARD = 'forward';
const TAB_NAV_BACKWARD = 'backward';
const Default$7 = {
- trapElement: null,
- // The element to trap focus inside of
- autofocus: true
+ autofocus: true,
+ trapElement: null // The element to trap focus inside of
+
};
const DefaultType$7 = {
- trapElement: 'element',
- autofocus: 'boolean'
+ autofocus: 'boolean',
+ trapElement: 'element'
};
/**
* Class definition
@@ -2765,7 +2770,7 @@ class FocusTrap extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): modal.js
+ * Bootstrap (v5.2.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2784,7 +2789,7 @@ 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}`;
const CLASS_NAME_OPEN = 'modal-open';
@@ -2797,13 +2802,13 @@ const SELECTOR_MODAL_BODY = '.modal-body';
const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
const Default$6 = {
backdrop: true,
- keyboard: true,
- focus: true
+ focus: true,
+ keyboard: true
};
const DefaultType$6 = {
backdrop: '(boolean|string)',
- keyboard: 'boolean',
- focus: 'boolean'
+ focus: 'boolean',
+ keyboard: 'boolean'
};
/**
* Class definition
@@ -2975,7 +2980,7 @@ class Modal extends BaseComponent {
this._adjustDialog();
}
});
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
+ EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
if (event.target !== event.currentTarget) {
// click is inside modal-dialog
return;
@@ -3138,7 +3143,7 @@ defineJQueryPlugin(Modal);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): offcanvas.js
+ * Bootstrap (v5.2.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3236,7 +3241,7 @@ class Offcanvas extends BaseComponent {
this._element.classList.add(CLASS_NAME_SHOWING$1);
const completeCallBack = () => {
- if (!this._config.scroll) {
+ if (!this._config.scroll || this._config.backdrop) {
this._focustrap.activate();
}
@@ -3412,7 +3417,7 @@ defineJQueryPlugin(Offcanvas);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/sanitizer.js
+ * Bootstrap (v5.2.0): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3421,14 +3426,14 @@ const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
/**
* A pattern that recognizes a commonly useful subset of URLs that are safe.
*
- * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
+ * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
*/
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
/**
* A pattern that matches safe data URLs. Only matches image, video and audio types.
*
- * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
+ * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
*/
const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
@@ -3517,7 +3522,7 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): util/template-factory.js
+ * Bootstrap (v5.2.0): util/template-factory.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3527,27 +3532,27 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
const NAME$5 = 'TemplateFactory';
const Default$4 = {
- extraClass: '',
- template: '<div></div>',
+ allowList: DefaultAllowlist,
content: {},
// { selector : text , selector2 : text2 , }
+ extraClass: '',
html: false,
sanitize: true,
sanitizeFn: null,
- allowList: DefaultAllowlist
+ template: '<div></div>'
};
const DefaultType$4 = {
- extraClass: '(string|function)',
- template: 'string',
+ allowList: 'object',
content: 'object',
+ extraClass: '(string|function)',
html: 'boolean',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
- allowList: 'object'
+ template: 'string'
};
const DefaultContentType = {
- selector: '(string|element)',
- entry: '(string|element|function|null)'
+ entry: '(string|element|function|null)',
+ selector: '(string|element)'
};
/**
* Class definition
@@ -3675,7 +3680,7 @@ class TemplateFactory extends Config {
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): tooltip.js
+ * Bootstrap (v5.2.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3713,42 +3718,42 @@ const AttachmentMap = {
LEFT: isRTL() ? 'right' : 'left'
};
const Default$3 = {
+ allowList: DefaultAllowlist,
animation: true,
- template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
- trigger: 'hover focus',
- title: '',
+ boundary: 'clippingParents',
+ container: false,
+ customClass: '',
delay: 0,
+ fallbackPlacements: ['top', 'right', 'bottom', 'left'],
html: false,
- selector: false,
- placement: 'top',
offset: [0, 0],
- container: false,
- fallbackPlacements: ['top', 'right', 'bottom', 'left'],
- boundary: 'clippingParents',
- customClass: '',
+ placement: 'top',
+ popperConfig: null,
sanitize: true,
sanitizeFn: null,
- allowList: DefaultAllowlist,
- popperConfig: null
+ selector: false,
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
+ title: '',
+ trigger: 'hover focus'
};
const DefaultType$3 = {
+ allowList: 'object',
animation: 'boolean',
- template: 'string',
- title: '(string|element|function)',
- trigger: 'string',
+ boundary: '(string|element)',
+ container: '(string|element|boolean)',
+ customClass: '(string|function)',
delay: '(number|object)',
+ fallbackPlacements: 'array',
html: 'boolean',
- selector: '(string|boolean)',
- placement: '(string|function)',
offset: '(array|string|function)',
- container: '(string|element|boolean)',
- fallbackPlacements: 'array',
- boundary: '(string|element)',
- customClass: '(string|function)',
+ placement: '(string|function)',
+ popperConfig: '(null|object|function)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
- allowList: 'object',
- popperConfig: '(null|object|function)'
+ selector: '(string|boolean)',
+ template: 'string',
+ title: '(string|element|function)',
+ trigger: 'string'
};
/**
* Class definition
@@ -3767,7 +3772,8 @@ class Tooltip extends BaseComponent {
this._isHovered = false;
this._activeTrigger = {};
this._popper = null;
- this._templateFactory = null; // Protected
+ this._templateFactory = null;
+ this._newContent = null; // Protected
this.tip = null;
@@ -3857,6 +3863,12 @@ class Tooltip extends BaseComponent {
if (showEvent.defaultPrevented || !isInTheDom) {
return;
+ } // todo v6 remove this OR make it optional
+
+
+ if (this.tip) {
+ this.tip.remove();
+ this.tip = null;
}
const tip = this._getTipElement();
@@ -3875,7 +3887,7 @@ class Tooltip extends BaseComponent {
if (this._popper) {
this._popper.update();
} else {
- this._createPopper(tip);
+ this._popper = this._createPopper(tip);
}
tip.classList.add(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we add extra
@@ -3961,7 +3973,7 @@ class Tooltip extends BaseComponent {
_getTipElement() {
if (!this.tip) {
- this.tip = this._createTipElement(this._getContentForTemplate());
+ this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
}
return this.tip;
@@ -3989,19 +4001,11 @@ class Tooltip extends BaseComponent {
}
setContent(content) {
- let isShown = false;
-
- if (this.tip) {
- isShown = this._isShown();
- this.tip.remove();
- this.tip = null;
- }
+ this._newContent = content;
- this._disposePopper();
-
- this.tip = this._createTipElement(content);
+ if (this._isShown()) {
+ this._disposePopper();
- if (isShown) {
this.show();
}
}
@@ -4028,7 +4032,7 @@ class Tooltip extends BaseComponent {
}
_getTitle() {
- return this._config.title;
+ return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
} // Private
@@ -4047,7 +4051,7 @@ class Tooltip extends BaseComponent {
_createPopper(tip) {
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
const attachment = AttachmentMap[placement.toUpperCase()];
- this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
+ return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
}
_getOffset() {
@@ -4160,7 +4164,7 @@ class Tooltip extends BaseComponent {
return;
}
- if (!this._element.getAttribute('aria-label') && !this._element.textContent) {
+ if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
this._element.setAttribute('aria-label', title);
}
@@ -4236,7 +4240,6 @@ class Tooltip extends BaseComponent {
}
config.originalTitle = this._element.getAttribute('title') || '';
- config.title = this._resolvePossibleFunction(config.title) || config.originalTitle;
if (typeof config.title === 'number') {
config.title = config.title.toString();
@@ -4299,7 +4302,7 @@ defineJQueryPlugin(Tooltip);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): popover.js
+ * Bootstrap (v5.2.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4311,11 +4314,11 @@ const NAME$3 = 'popover';
const SELECTOR_TITLE = '.popover-header';
const SELECTOR_CONTENT = '.popover-body';
const Default$2 = { ...Tooltip.Default,
- placement: 'right',
- offset: [0, 8],
- trigger: 'click',
content: '',
- template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
+ offset: [0, 8],
+ placement: 'right',
+ template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
+ trigger: 'click'
};
const DefaultType$2 = { ...Tooltip.DefaultType,
content: '(null|string|element|function)'
@@ -4382,7 +4385,7 @@ defineJQueryPlugin(Popover);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): scrollspy.js
+ * Bootstrap (v5.2.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4502,7 +4505,8 @@ class ScrollSpy extends BaseComponent {
if (root.scrollTo) {
root.scrollTo({
- top: height
+ top: height,
+ behavior: 'smooth'
});
return;
} // Chrome 60 doesn't support `scrollTo`
@@ -4668,7 +4672,7 @@ defineJQueryPlugin(ScrollSpy);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): tab.js
+ * Bootstrap (v5.2.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4769,15 +4773,9 @@ class Tab extends BaseComponent {
this._activate(getElementFromSelector(element)); // Search and activate/show the proper section
- const isAnimated = element.classList.contains(CLASS_NAME_FADE$1);
-
const complete = () => {
- if (isAnimated) {
- // todo: maybe is redundant
- element.classList.add(CLASS_NAME_SHOW$1);
- }
-
if (element.getAttribute('role') !== 'tab') {
+ element.classList.add(CLASS_NAME_SHOW$1);
return;
}
@@ -4792,7 +4790,7 @@ class Tab extends BaseComponent {
});
};
- this._queueCallback(complete, element, isAnimated);
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
}
_deactivate(element, relatedElem) {
@@ -4806,15 +4804,9 @@ class Tab extends BaseComponent {
this._deactivate(getElementFromSelector(element)); // Search and deactivate the shown section too
- const isAnimated = element.classList.contains(CLASS_NAME_FADE$1);
-
const complete = () => {
- if (isAnimated) {
- // todo maybe is redundant
- element.classList.remove(CLASS_NAME_SHOW$1);
- }
-
if (element.getAttribute('role') !== 'tab') {
+ element.classList.remove(CLASS_NAME_SHOW$1);
return;
}
@@ -4828,7 +4820,7 @@ class Tab extends BaseComponent {
});
};
- this._queueCallback(complete, element, isAnimated);
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
}
_keydown(event) {
@@ -4993,7 +4985,7 @@ defineJQueryPlugin(Tab);
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0-beta1): toast.js
+ * Bootstrap (v5.2.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/