aboutsummaryrefslogtreecommitdiff
path: root/js/dist/alert.js
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-08-16 20:47:33 -0400
committerGitHub <[email protected]>2024-08-16 20:47:33 -0400
commit6b28433d9cfde435be8ec2bd6cf91e6324d08865 (patch)
tree8343c27b8b95ff5639233e81cf157f92e5688466 /js/dist/alert.js
parentd53094ec16ba385faae2973ddee648698b32ab24 (diff)
parent048f56f51460df75e92a2f7b472e1c56baeb68f7 (diff)
downloadbootstrap-main.tar.xz
bootstrap-main.zip
Merge branch 'twbs:main' into mainHEADmain
Diffstat (limited to 'js/dist/alert.js')
-rw-r--r--js/dist/alert.js189
1 files changed, 22 insertions, 167 deletions
diff --git a/js/dist/alert.js b/js/dist/alert.js
index 3f73b68d2..d37e96e43 100644
--- a/js/dist/alert.js
+++ b/js/dist/alert.js
@@ -1,155 +1,24 @@
/*!
- * Bootstrap alert.js v5.1.3 (https://getbootstrap.com/)
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Bootstrap alert.js v5.3.3 (https://getbootstrap.com/)
+ * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.EventHandler, global.Base));
-})(this, (function (EventHandler, BaseComponent) { 'use strict';
-
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
-
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
-
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v5.1.3): util/index.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- * --------------------------------------------------------------------------
- */
-
- const getSelector = element => {
- let selector = element.getAttribute('data-bs-target');
-
- if (!selector || selector === '#') {
- let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
- // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
- // `document.querySelector` will rightfully complain it is invalid.
- // See https://github.com/twbs/bootstrap/issues/32273
-
- if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
- return null;
- } // Just in case some CMS puts out a full URL with the anchor appended
-
-
- if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
- hrefAttr = `#${hrefAttr.split('#')[1]}`;
- }
-
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
- }
-
- return selector;
- };
-
- const getElementFromSelector = element => {
- const selector = getSelector(element);
- return selector ? document.querySelector(selector) : null;
- };
-
- const isDisabled = element => {
- if (!element || element.nodeType !== Node.ELEMENT_NODE) {
- return true;
- }
-
- if (element.classList.contains('disabled')) {
- return true;
- }
-
- if (typeof element.disabled !== 'undefined') {
- return element.disabled;
- }
-
- return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
- };
-
- const getjQuery = () => {
- const {
- jQuery
- } = window;
-
- if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
- return jQuery;
- }
-
- return null;
- };
-
- const DOMContentLoadedCallbacks = [];
-
- const onDOMContentLoaded = callback => {
- if (document.readyState === 'loading') {
- // add listener on the first call when the document is in loading state
- if (!DOMContentLoadedCallbacks.length) {
- document.addEventListener('DOMContentLoaded', () => {
- DOMContentLoadedCallbacks.forEach(callback => callback());
- });
- }
-
- DOMContentLoadedCallbacks.push(callback);
- } else {
- callback();
- }
- };
-
- const defineJQueryPlugin = plugin => {
- onDOMContentLoaded(() => {
- const $ = getjQuery();
- /* istanbul ignore if */
-
- if ($) {
- const name = plugin.NAME;
- const JQUERY_NO_CONFLICT = $.fn[name];
- $.fn[name] = plugin.jQueryInterface;
- $.fn[name].Constructor = plugin;
-
- $.fn[name].noConflict = () => {
- $.fn[name] = JQUERY_NO_CONFLICT;
- return plugin.jQueryInterface;
- };
- }
- });
- };
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./util/component-functions.js'), require('./util/index.js')) :
+ typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './util/component-functions', './util/index'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.BaseComponent, global.EventHandler, global.ComponentFunctions, global.Index));
+})(this, (function (BaseComponent, EventHandler, componentFunctions_js, index_js) { 'use strict';
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.3): util/component-functions.js
+ * Bootstrap alert.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__default.default.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.3): alert.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- * --------------------------------------------------------------------------
- */
/**
- * ------------------------------------------------------------------------
* Constants
- * ------------------------------------------------------------------------
*/
const NAME = 'alert';
@@ -159,75 +28,61 @@
const EVENT_CLOSED = `closed${EVENT_KEY}`;
const CLASS_NAME_FADE = 'fade';
const CLASS_NAME_SHOW = 'show';
+
/**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
+ * Class definition
*/
- class Alert extends BaseComponent__default.default {
+ class Alert extends BaseComponent {
// Getters
static get NAME() {
return NAME;
- } // Public
-
+ }
+ // Public
close() {
- const closeEvent = EventHandler__default.default.trigger(this._element, EVENT_CLOSE);
-
+ const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
if (closeEvent.defaultPrevented) {
return;
}
-
this._element.classList.remove(CLASS_NAME_SHOW);
-
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE);
-
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
- } // Private
-
+ }
+ // Private
_destroyElement() {
this._element.remove();
-
- EventHandler__default.default.trigger(this._element, EVENT_CLOSED);
+ EventHandler.trigger(this._element, EVENT_CLOSED);
this.dispose();
- } // Static
-
+ }
+ // Static
static jQueryInterface(config) {
return this.each(function () {
const data = Alert.getOrCreateInstance(this);
-
if (typeof config !== 'string') {
return;
}
-
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
throw new TypeError(`No method named "${config}"`);
}
-
data[config](this);
});
}
-
}
+
/**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
+ * Data API implementation
*/
+ componentFunctions_js.enableDismissTrigger(Alert, 'close');
- enableDismissTrigger(Alert, 'close');
/**
- * ------------------------------------------------------------------------
* jQuery
- * ------------------------------------------------------------------------
- * add .Alert to jQuery only if jQuery is present
*/
- defineJQueryPlugin(Alert);
+ index_js.defineJQueryPlugin(Alert);
return Alert;