aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/src/toast.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/src/toast.js')
-rw-r--r--vendor/twbs/bootstrap/js/src/toast.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/vendor/twbs/bootstrap/js/src/toast.js b/vendor/twbs/bootstrap/js/src/toast.js
index 8a7fcdc71..b6c9bdd79 100644
--- a/vendor/twbs/bootstrap/js/src/toast.js
+++ b/vendor/twbs/bootstrap/js/src/toast.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): toast.js
+ * Bootstrap (v5.0.2): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -13,7 +13,6 @@ import {
import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
import BaseComponent from './base-component'
-import { enableDismissTrigger } from './util/component-functions'
/**
* ------------------------------------------------------------------------
@@ -25,6 +24,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}`
@@ -35,7 +35,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'
@@ -51,6 +51,8 @@ const Default = {
delay: 5000
}
+const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]'
+
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -99,14 +101,15 @@ class Toast extends BaseComponent {
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)
@@ -124,13 +127,11 @@ class Toast extends BaseComponent {
}
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)
}
@@ -200,6 +201,7 @@ class Toast extends BaseComponent {
}
_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))
@@ -228,8 +230,6 @@ class Toast extends BaseComponent {
}
}
-enableDismissTrigger(Toast)
-
/**
* ------------------------------------------------------------------------
* jQuery