aboutsummaryrefslogtreecommitdiff
path: root/js/dist/util/component-functions.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/util/component-functions.js
parentd53094ec16ba385faae2973ddee648698b32ab24 (diff)
parent048f56f51460df75e92a2f7b472e1c56baeb68f7 (diff)
downloadbootstrap-main.tar.xz
bootstrap-main.zip
Merge branch 'twbs:main' into mainHEADmain
Diffstat (limited to 'js/dist/util/component-functions.js')
-rw-r--r--js/dist/util/component-functions.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/js/dist/util/component-functions.js b/js/dist/util/component-functions.js
new file mode 100644
index 000000000..7848b314b
--- /dev/null
+++ b/js/dist/util/component-functions.js
@@ -0,0 +1,42 @@
+/*!
+ * Bootstrap component-functions.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' ? factory(exports, require('../dom/event-handler.js'), require('../dom/selector-engine.js'), require('./index.js')) :
+ typeof define === 'function' && define.amd ? define(['exports', '../dom/event-handler', '../dom/selector-engine', './index'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComponentFunctions = {}, global.EventHandler, global.SelectorEngine, global.Index));
+})(this, (function (exports, EventHandler, SelectorEngine, index_js) { 'use strict';
+
+ /**
+ * --------------------------------------------------------------------------
+ * Bootstrap 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 (index_js.isDisabled(this)) {
+ return;
+ }
+ const target = SelectorEngine.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]();
+ });
+ };
+
+ exports.enableDismissTrigger = enableDismissTrigger;
+
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+
+}));
+//# sourceMappingURL=component-functions.js.map