bootstrap 4.6.2.1 → 5.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +61 -0
- data/CHANGELOG.md +7 -2
- data/Gemfile +1 -0
- data/README.md +33 -15
- data/Rakefile +1 -2
- data/assets/javascripts/bootstrap/alert.js +50 -147
- data/assets/javascripts/bootstrap/base-component.js +83 -0
- data/assets/javascripts/bootstrap/button.js +40 -190
- data/assets/javascripts/bootstrap/carousel.js +282 -537
- data/assets/javascripts/bootstrap/collapse.js +166 -314
- data/assets/javascripts/bootstrap/dom/data.js +62 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
- data/assets/javascripts/bootstrap/dropdown.js +297 -455
- data/assets/javascripts/bootstrap/modal.js +223 -566
- data/assets/javascripts/bootstrap/offcanvas.js +245 -0
- data/assets/javascripts/bootstrap/popover.js +59 -208
- data/assets/javascripts/bootstrap/scrollspy.js +213 -276
- data/assets/javascripts/bootstrap/tab.js +222 -200
- data/assets/javascripts/bootstrap/toast.js +137 -206
- data/assets/javascripts/bootstrap/tooltip.js +403 -747
- data/assets/javascripts/bootstrap/util/backdrop.js +138 -0
- data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
- data/assets/javascripts/bootstrap/util/config.js +67 -0
- data/assets/javascripts/bootstrap/util/focustrap.js +112 -0
- data/assets/javascripts/bootstrap/util/index.js +280 -0
- data/assets/javascripts/bootstrap/util/sanitizer.js +113 -0
- data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
- data/assets/javascripts/bootstrap/util/swipe.js +134 -0
- data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
- data/assets/javascripts/bootstrap-global-this-define.js +6 -0
- data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
- data/assets/javascripts/bootstrap-sprockets.js +21 -5
- data/assets/javascripts/bootstrap.js +3625 -3488
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -21
- data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
- data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
- data/assets/stylesheets/_bootstrap.scss +21 -13
- data/assets/stylesheets/bootstrap/_accordion.scss +153 -0
- data/assets/stylesheets/bootstrap/_alert.scss +32 -16
- data/assets/stylesheets/bootstrap/_badge.scss +15 -31
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
- data/assets/stylesheets/bootstrap/_button-group.scss +32 -48
- data/assets/stylesheets/bootstrap/_buttons.scss +145 -71
- data/assets/stylesheets/bootstrap/_card.scss +67 -115
- data/assets/stylesheets/bootstrap/_carousel.scss +63 -37
- data/assets/stylesheets/bootstrap/_close.scss +53 -27
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +135 -23
- data/assets/stylesheets/bootstrap/_grid.scss +18 -52
- data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +93 -48
- data/assets/stylesheets/bootstrap/_maps.scss +174 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
- data/assets/stylesheets/bootstrap/_modal.scss +112 -112
- data/assets/stylesheets/bootstrap/_nav.scss +100 -28
- data/assets/stylesheets/bootstrap/_navbar.scss +130 -173
- data/assets/stylesheets/bootstrap/_offcanvas.scss +147 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_popover.scss +99 -73
- data/assets/stylesheets/bootstrap/_progress.scss +35 -14
- data/assets/stylesheets/bootstrap/_reboot.scss +319 -192
- data/assets/stylesheets/bootstrap/_root.scss +177 -9
- data/assets/stylesheets/bootstrap/_spinners.scss +43 -23
- data/assets/stylesheets/bootstrap/_tables.scss +101 -115
- data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
- data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
- data/assets/stylesheets/bootstrap/_transitions.scss +3 -2
- data/assets/stylesheets/bootstrap/_type.scss +40 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
- data/assets/stylesheets/bootstrap/_variables-dark.scss +102 -0
- data/assets/stylesheets/bootstrap/_variables.scss +1210 -606
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +97 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +189 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
- data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
- data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
- data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
- data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +64 -96
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +118 -36
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +211 -91
- data/bootstrap.gemspec +6 -6
- data/lib/bootstrap/engine.rb +0 -1
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +17 -5
- data/tasks/updater/network.rb +2 -2
- data/tasks/updater/scss.rb +2 -2
- data/tasks/updater.rb +2 -2
- data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
- data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
- data/test/dummy_rails/app/views/pages/root.html +89 -0
- data/test/dummy_rails/config/application.rb +0 -5
- data/test/dummy_rails/public/favicon.ico +0 -0
- data/test/gemfiles/rails_4_2.gemfile +2 -1
- data/test/gemfiles/rails_5_0.gemfile +1 -2
- data/test/gemfiles/rails_5_1.gemfile +1 -2
- data/test/gemfiles/rails_5_2.gemfile +7 -0
- data/test/gemfiles/rails_6_0.gemfile +1 -1
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- data/test/gemfiles/rails_7_0_dartsass.gemfile +0 -1
- data/test/gemfiles/rails_7_0_sassc.gemfile +0 -1
- data/test/rails_test.rb +0 -5
- data/test/test_helper.rb +3 -2
- metadata +92 -86
- data/.travis.yml +0 -31
- data/assets/javascripts/bootstrap/util.js +0 -189
- data/assets/stylesheets/bootstrap/_code.scss +0 -48
- data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
- data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -132
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
- data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
- data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
- data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
- data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
- data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
- /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,266 +1,197 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap toast.js
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap toast.js v5.3.5 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
(function (global, factory) {
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('
|
8
|
-
typeof define === 'function' && define.amd ? define(['
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.
|
10
|
-
})(this, (function (
|
7
|
+
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')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './util/component-functions', './util/index'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.BaseComponent, global.EventHandler, global.ComponentFunctions, global.Index));
|
10
|
+
})(this, (function (BaseComponent, EventHandler, componentFunctions_js, index_js) { 'use strict';
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
for (var i = 0; i < props.length; i++) {
|
19
|
-
var descriptor = props[i];
|
20
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
21
|
-
descriptor.configurable = true;
|
22
|
-
if ("value" in descriptor) descriptor.writable = true;
|
23
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
28
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
29
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
30
|
-
Object.defineProperty(Constructor, "prototype", {
|
31
|
-
writable: false
|
32
|
-
});
|
33
|
-
return Constructor;
|
34
|
-
}
|
35
|
-
|
36
|
-
function _extends() {
|
37
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
38
|
-
for (var i = 1; i < arguments.length; i++) {
|
39
|
-
var source = arguments[i];
|
40
|
-
|
41
|
-
for (var key in source) {
|
42
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
43
|
-
target[key] = source[key];
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap toast.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
47
18
|
|
48
|
-
return target;
|
49
|
-
};
|
50
|
-
return _extends.apply(this, arguments);
|
51
|
-
}
|
52
19
|
|
53
20
|
/**
|
54
21
|
* Constants
|
55
22
|
*/
|
56
23
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
animation: true,
|
74
|
-
autohide: true,
|
75
|
-
delay: 500
|
76
|
-
};
|
77
|
-
var DefaultType = {
|
24
|
+
const NAME = 'toast';
|
25
|
+
const DATA_KEY = 'bs.toast';
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
27
|
+
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
|
28
|
+
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
|
29
|
+
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
30
|
+
const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
|
31
|
+
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
32
|
+
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
33
|
+
const EVENT_SHOW = `show${EVENT_KEY}`;
|
34
|
+
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
35
|
+
const CLASS_NAME_FADE = 'fade';
|
36
|
+
const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
|
37
|
+
const CLASS_NAME_SHOW = 'show';
|
38
|
+
const CLASS_NAME_SHOWING = 'showing';
|
39
|
+
const DefaultType = {
|
78
40
|
animation: 'boolean',
|
79
41
|
autohide: 'boolean',
|
80
42
|
delay: 'number'
|
81
43
|
};
|
44
|
+
const Default = {
|
45
|
+
animation: true,
|
46
|
+
autohide: true,
|
47
|
+
delay: 5000
|
48
|
+
};
|
49
|
+
|
82
50
|
/**
|
83
51
|
* Class definition
|
84
52
|
*/
|
85
53
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
this._config = this._getConfig(config);
|
54
|
+
class Toast extends BaseComponent {
|
55
|
+
constructor(element, config) {
|
56
|
+
super(element, config);
|
90
57
|
this._timeout = null;
|
91
|
-
|
58
|
+
this._hasMouseInteraction = false;
|
59
|
+
this._hasKeyboardInteraction = false;
|
92
60
|
this._setListeners();
|
93
|
-
}
|
94
|
-
|
61
|
+
}
|
95
62
|
|
96
|
-
|
63
|
+
// Getters
|
64
|
+
static get Default() {
|
65
|
+
return Default;
|
66
|
+
}
|
67
|
+
static get DefaultType() {
|
68
|
+
return DefaultType;
|
69
|
+
}
|
70
|
+
static get NAME() {
|
71
|
+
return NAME;
|
72
|
+
}
|
97
73
|
|
98
74
|
// Public
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
var showEvent = $__default["default"].Event(EVENT_SHOW);
|
103
|
-
$__default["default"](this._element).trigger(showEvent);
|
104
|
-
|
105
|
-
if (showEvent.isDefaultPrevented()) {
|
75
|
+
show() {
|
76
|
+
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
|
77
|
+
if (showEvent.defaultPrevented) {
|
106
78
|
return;
|
107
79
|
}
|
108
|
-
|
109
80
|
this._clearTimeout();
|
110
|
-
|
111
81
|
if (this._config.animation) {
|
112
82
|
this._element.classList.add(CLASS_NAME_FADE);
|
113
83
|
}
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
_this._element.classList.add(CLASS_NAME_SHOW);
|
119
|
-
|
120
|
-
$__default["default"](_this._element).trigger(EVENT_SHOWN);
|
121
|
-
|
122
|
-
if (_this._config.autohide) {
|
123
|
-
_this._timeout = setTimeout(function () {
|
124
|
-
_this.hide();
|
125
|
-
}, _this._config.delay);
|
126
|
-
}
|
84
|
+
const complete = () => {
|
85
|
+
this._element.classList.remove(CLASS_NAME_SHOWING);
|
86
|
+
EventHandler.trigger(this._element, EVENT_SHOWN);
|
87
|
+
this._maybeScheduleHide();
|
127
88
|
};
|
128
|
-
|
129
|
-
this._element
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
if (this._config.animation) {
|
136
|
-
var transitionDuration = Util__default["default"].getTransitionDurationFromElement(this._element);
|
137
|
-
$__default["default"](this._element).one(Util__default["default"].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
138
|
-
} else {
|
139
|
-
complete();
|
140
|
-
}
|
141
|
-
};
|
142
|
-
|
143
|
-
_proto.hide = function hide() {
|
144
|
-
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
|
89
|
+
this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
|
90
|
+
index_js.reflow(this._element);
|
91
|
+
this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
|
92
|
+
this._queueCallback(complete, this._element, this._config.animation);
|
93
|
+
}
|
94
|
+
hide() {
|
95
|
+
if (!this.isShown()) {
|
145
96
|
return;
|
146
97
|
}
|
147
|
-
|
148
|
-
|
149
|
-
$__default["default"](this._element).trigger(hideEvent);
|
150
|
-
|
151
|
-
if (hideEvent.isDefaultPrevented()) {
|
98
|
+
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
99
|
+
if (hideEvent.defaultPrevented) {
|
152
100
|
return;
|
153
101
|
}
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
102
|
+
const complete = () => {
|
103
|
+
this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
|
104
|
+
this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
|
105
|
+
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
106
|
+
};
|
107
|
+
this._element.classList.add(CLASS_NAME_SHOWING);
|
108
|
+
this._queueCallback(complete, this._element, this._config.animation);
|
109
|
+
}
|
110
|
+
dispose() {
|
159
111
|
this._clearTimeout();
|
160
|
-
|
161
|
-
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
112
|
+
if (this.isShown()) {
|
162
113
|
this._element.classList.remove(CLASS_NAME_SHOW);
|
163
114
|
}
|
115
|
+
super.dispose();
|
116
|
+
}
|
117
|
+
isShown() {
|
118
|
+
return this._element.classList.contains(CLASS_NAME_SHOW);
|
119
|
+
}
|
164
120
|
|
165
|
-
|
166
|
-
$__default["default"].removeData(this._element, DATA_KEY);
|
167
|
-
this._element = null;
|
168
|
-
this._config = null;
|
169
|
-
} // Private
|
170
|
-
;
|
171
|
-
|
172
|
-
_proto._getConfig = function _getConfig(config) {
|
173
|
-
config = _extends({}, Default, $__default["default"](this._element).data(), typeof config === 'object' && config ? config : {});
|
174
|
-
Util__default["default"].typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
175
|
-
return config;
|
176
|
-
};
|
177
|
-
|
178
|
-
_proto._setListeners = function _setListeners() {
|
179
|
-
var _this2 = this;
|
180
|
-
|
181
|
-
$__default["default"](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () {
|
182
|
-
return _this2.hide();
|
183
|
-
});
|
184
|
-
};
|
185
|
-
|
186
|
-
_proto._close = function _close() {
|
187
|
-
var _this3 = this;
|
188
|
-
|
189
|
-
var complete = function complete() {
|
190
|
-
_this3._element.classList.add(CLASS_NAME_HIDE);
|
191
|
-
|
192
|
-
$__default["default"](_this3._element).trigger(EVENT_HIDDEN);
|
193
|
-
};
|
194
|
-
|
195
|
-
this._element.classList.remove(CLASS_NAME_SHOW);
|
121
|
+
// Private
|
196
122
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
} else {
|
201
|
-
complete();
|
123
|
+
_maybeScheduleHide() {
|
124
|
+
if (!this._config.autohide) {
|
125
|
+
return;
|
202
126
|
}
|
203
|
-
|
204
|
-
|
205
|
-
|
127
|
+
if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
this._timeout = setTimeout(() => {
|
131
|
+
this.hide();
|
132
|
+
}, this._config.delay);
|
133
|
+
}
|
134
|
+
_onInteraction(event, isInteracting) {
|
135
|
+
switch (event.type) {
|
136
|
+
case 'mouseover':
|
137
|
+
case 'mouseout':
|
138
|
+
{
|
139
|
+
this._hasMouseInteraction = isInteracting;
|
140
|
+
break;
|
141
|
+
}
|
142
|
+
case 'focusin':
|
143
|
+
case 'focusout':
|
144
|
+
{
|
145
|
+
this._hasKeyboardInteraction = isInteracting;
|
146
|
+
break;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
if (isInteracting) {
|
150
|
+
this._clearTimeout();
|
151
|
+
return;
|
152
|
+
}
|
153
|
+
const nextElement = event.relatedTarget;
|
154
|
+
if (this._element === nextElement || this._element.contains(nextElement)) {
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
this._maybeScheduleHide();
|
158
|
+
}
|
159
|
+
_setListeners() {
|
160
|
+
EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
|
161
|
+
EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
|
162
|
+
EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
|
163
|
+
EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
|
164
|
+
}
|
165
|
+
_clearTimeout() {
|
206
166
|
clearTimeout(this._timeout);
|
207
167
|
this._timeout = null;
|
208
|
-
}
|
209
|
-
;
|
168
|
+
}
|
210
169
|
|
211
|
-
|
170
|
+
// Static
|
171
|
+
static jQueryInterface(config) {
|
212
172
|
return this.each(function () {
|
213
|
-
|
214
|
-
var data = $element.data(DATA_KEY);
|
215
|
-
|
216
|
-
var _config = typeof config === 'object' && config;
|
217
|
-
|
218
|
-
if (!data) {
|
219
|
-
data = new Toast(this, _config);
|
220
|
-
$element.data(DATA_KEY, data);
|
221
|
-
}
|
222
|
-
|
173
|
+
const data = Toast.getOrCreateInstance(this, config);
|
223
174
|
if (typeof config === 'string') {
|
224
175
|
if (typeof data[config] === 'undefined') {
|
225
|
-
throw new TypeError(
|
176
|
+
throw new TypeError(`No method named "${config}"`);
|
226
177
|
}
|
227
|
-
|
228
178
|
data[config](this);
|
229
179
|
}
|
230
180
|
});
|
231
|
-
}
|
232
|
-
|
233
|
-
_createClass(Toast, null, [{
|
234
|
-
key: "VERSION",
|
235
|
-
get: function get() {
|
236
|
-
return VERSION;
|
237
|
-
}
|
238
|
-
}, {
|
239
|
-
key: "DefaultType",
|
240
|
-
get: function get() {
|
241
|
-
return DefaultType;
|
242
|
-
}
|
243
|
-
}, {
|
244
|
-
key: "Default",
|
245
|
-
get: function get() {
|
246
|
-
return Default;
|
247
|
-
}
|
248
|
-
}]);
|
181
|
+
}
|
182
|
+
}
|
249
183
|
|
250
|
-
return Toast;
|
251
|
-
}();
|
252
184
|
/**
|
253
|
-
*
|
185
|
+
* Data API implementation
|
254
186
|
*/
|
255
187
|
|
188
|
+
componentFunctions_js.enableDismissTrigger(Toast);
|
256
189
|
|
257
|
-
|
258
|
-
|
190
|
+
/**
|
191
|
+
* jQuery
|
192
|
+
*/
|
259
193
|
|
260
|
-
|
261
|
-
$__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
|
262
|
-
return Toast._jQueryInterface;
|
263
|
-
};
|
194
|
+
index_js.defineJQueryPlugin(Toast);
|
264
195
|
|
265
196
|
return Toast;
|
266
197
|
|