bootstrap 4.6.2.1 → 5.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -4
- data/README.md +1 -7
- data/Rakefile +4 -16
- data/assets/javascripts/bootstrap/alert.js +148 -73
- data/assets/javascripts/bootstrap/button.js +71 -154
- data/assets/javascripts/bootstrap/carousel.js +315 -209
- data/assets/javascripts/bootstrap/collapse.js +307 -153
- data/assets/javascripts/bootstrap/dom/data.js +81 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +311 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +100 -0
- data/assets/javascripts/bootstrap/dom/polyfill.js +110 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +98 -0
- data/assets/javascripts/bootstrap/dropdown.js +257 -205
- data/assets/javascripts/bootstrap/modal.js +354 -250
- data/assets/javascripts/bootstrap/popover.js +85 -94
- data/assets/javascripts/bootstrap/scrollspy.js +179 -107
- data/assets/javascripts/bootstrap/tab.js +170 -99
- data/assets/javascripts/bootstrap/toast.js +181 -110
- data/assets/javascripts/bootstrap/tooltip.js +375 -226
- data/assets/javascripts/bootstrap-sprockets.js +5 -1
- data/assets/javascripts/bootstrap.js +2260 -1550
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -18
- data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
- data/assets/stylesheets/_bootstrap.scss +16 -10
- data/assets/stylesheets/bootstrap/_alert.scss +3 -4
- data/assets/stylesheets/bootstrap/_badge.scss +2 -27
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -17
- data/assets/stylesheets/bootstrap/_button-group.scss +16 -38
- data/assets/stylesheets/bootstrap/_buttons.scss +27 -45
- data/assets/stylesheets/bootstrap/_card.scss +22 -68
- data/assets/stylesheets/bootstrap/_carousel.scss +15 -20
- data/assets/stylesheets/bootstrap/_close.scss +9 -13
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +12 -9
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +82 -69
- data/assets/stylesheets/bootstrap/_grid.scss +3 -54
- data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +7 -4
- data/assets/stylesheets/bootstrap/_mixins.scss +6 -12
- data/assets/stylesheets/bootstrap/_modal.scss +36 -41
- data/assets/stylesheets/bootstrap/_nav.scss +7 -9
- data/assets/stylesheets/bootstrap/_navbar.scss +42 -82
- data/assets/stylesheets/bootstrap/_pagination.scss +7 -20
- data/assets/stylesheets/bootstrap/_popover.scss +14 -14
- data/assets/stylesheets/bootstrap/_progress.scss +3 -5
- data/assets/stylesheets/bootstrap/_reboot.scss +304 -172
- data/assets/stylesheets/bootstrap/_root.scss +5 -8
- data/assets/stylesheets/bootstrap/_spinners.scss +8 -17
- data/assets/stylesheets/bootstrap/_tables.scss +80 -114
- data/assets/stylesheets/bootstrap/_toasts.scss +2 -4
- data/assets/stylesheets/bootstrap/_tooltip.scss +9 -9
- data/assets/stylesheets/bootstrap/_transitions.scss +0 -7
- data/assets/stylesheets/bootstrap/_type.scss +38 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +503 -18
- data/assets/stylesheets/bootstrap/_variables.scss +548 -437
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +142 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +116 -0
- data/assets/stylesheets/bootstrap/forms/_form-file.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +136 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +82 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +140 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_embed.scss +31 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_screenreaders.scss +8 -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/mixins/_alert.scss +0 -4
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +11 -8
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +62 -47
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +23 -85
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +9 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +86 -34
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +15 -8
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +18 -24
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +49 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
- data/bootstrap.gemspec +3 -1
- data/lib/bootstrap/engine.rb +1 -17
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +6 -18
- data/tasks/updater/network.rb +1 -7
- metadata +49 -47
- 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/_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/gemfiles/rails_7_0_dartsass.gemfile +0 -8
- data/test/gemfiles/rails_7_0_sassc.gemfile +0 -8
- /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,86 +1,154 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap toast.js
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap toast.js v5.0.0-alpha1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2020 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 =
|
10
|
-
}
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js'], factory) :
|
9
|
+
(global = global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator));
|
10
|
+
}(this, (function (Data, EventHandler, Manipulator) { 'use strict';
|
11
|
+
|
12
|
+
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
|
13
|
+
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
|
14
|
+
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* --------------------------------------------------------------------------
|
18
|
+
* Bootstrap (v5.0.0-alpha1): util/index.js
|
19
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
20
|
+
* --------------------------------------------------------------------------
|
21
|
+
*/
|
22
|
+
var MILLISECONDS_MULTIPLIER = 1000;
|
23
|
+
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
24
|
+
|
25
|
+
var toType = function toType(obj) {
|
26
|
+
if (obj === null || obj === undefined) {
|
27
|
+
return "" + obj;
|
24
28
|
}
|
25
|
-
}
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
30
|
-
Object.defineProperty(Constructor, "prototype", {
|
31
|
-
writable: false
|
32
|
-
});
|
33
|
-
return Constructor;
|
34
|
-
}
|
30
|
+
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
31
|
+
};
|
35
32
|
|
36
|
-
function
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
34
|
+
if (!element) {
|
35
|
+
return 0;
|
36
|
+
} // Get transition-duration of the element
|
40
37
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
|
39
|
+
var _window$getComputedSt = window.getComputedStyle(element),
|
40
|
+
transitionDuration = _window$getComputedSt.transitionDuration,
|
41
|
+
transitionDelay = _window$getComputedSt.transitionDelay;
|
42
|
+
|
43
|
+
var floatTransitionDuration = parseFloat(transitionDuration);
|
44
|
+
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
45
|
+
|
46
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
47
|
+
return 0;
|
48
|
+
} // If multiple durations are defined, take the first
|
49
|
+
|
50
|
+
|
51
|
+
transitionDuration = transitionDuration.split(',')[0];
|
52
|
+
transitionDelay = transitionDelay.split(',')[0];
|
53
|
+
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
54
|
+
};
|
55
|
+
|
56
|
+
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
57
|
+
element.dispatchEvent(new Event(TRANSITION_END));
|
58
|
+
};
|
59
|
+
|
60
|
+
var isElement = function isElement(obj) {
|
61
|
+
return (obj[0] || obj).nodeType;
|
62
|
+
};
|
63
|
+
|
64
|
+
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
65
|
+
var called = false;
|
66
|
+
var durationPadding = 5;
|
67
|
+
var emulatedDuration = duration + durationPadding;
|
68
|
+
|
69
|
+
function listener() {
|
70
|
+
called = true;
|
71
|
+
element.removeEventListener(TRANSITION_END, listener);
|
72
|
+
}
|
73
|
+
|
74
|
+
element.addEventListener(TRANSITION_END, listener);
|
75
|
+
setTimeout(function () {
|
76
|
+
if (!called) {
|
77
|
+
triggerTransitionEnd(element);
|
46
78
|
}
|
79
|
+
}, emulatedDuration);
|
80
|
+
};
|
47
81
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
82
|
+
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
83
|
+
Object.keys(configTypes).forEach(function (property) {
|
84
|
+
var expectedTypes = configTypes[property];
|
85
|
+
var value = config[property];
|
86
|
+
var valueType = value && isElement(value) ? 'element' : toType(value);
|
87
|
+
|
88
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
89
|
+
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
90
|
+
}
|
91
|
+
});
|
92
|
+
};
|
93
|
+
|
94
|
+
var reflow = function reflow(element) {
|
95
|
+
return element.offsetHeight;
|
96
|
+
};
|
97
|
+
|
98
|
+
var getjQuery = function getjQuery() {
|
99
|
+
var _window = window,
|
100
|
+
jQuery = _window.jQuery;
|
101
|
+
|
102
|
+
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
103
|
+
return jQuery;
|
104
|
+
}
|
105
|
+
|
106
|
+
return null;
|
107
|
+
};
|
108
|
+
|
109
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
52
110
|
|
111
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
112
|
+
|
113
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
114
|
+
|
115
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
116
|
+
|
117
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
53
118
|
/**
|
119
|
+
* ------------------------------------------------------------------------
|
54
120
|
* Constants
|
121
|
+
* ------------------------------------------------------------------------
|
55
122
|
*/
|
56
123
|
|
57
124
|
var NAME = 'toast';
|
58
|
-
var VERSION = '
|
125
|
+
var VERSION = '5.0.0-alpha1';
|
59
126
|
var DATA_KEY = 'bs.toast';
|
60
127
|
var EVENT_KEY = "." + DATA_KEY;
|
61
|
-
var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
|
62
|
-
var CLASS_NAME_FADE = 'fade';
|
63
|
-
var CLASS_NAME_HIDE = 'hide';
|
64
|
-
var CLASS_NAME_SHOW = 'show';
|
65
|
-
var CLASS_NAME_SHOWING = 'showing';
|
66
128
|
var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY;
|
67
129
|
var EVENT_HIDE = "hide" + EVENT_KEY;
|
68
130
|
var EVENT_HIDDEN = "hidden" + EVENT_KEY;
|
69
131
|
var EVENT_SHOW = "show" + EVENT_KEY;
|
70
132
|
var EVENT_SHOWN = "shown" + EVENT_KEY;
|
71
|
-
var
|
72
|
-
var
|
73
|
-
|
74
|
-
|
75
|
-
delay: 500
|
76
|
-
};
|
133
|
+
var CLASS_NAME_FADE = 'fade';
|
134
|
+
var CLASS_NAME_HIDE = 'hide';
|
135
|
+
var CLASS_NAME_SHOW = 'show';
|
136
|
+
var CLASS_NAME_SHOWING = 'showing';
|
77
137
|
var DefaultType = {
|
78
138
|
animation: 'boolean',
|
79
139
|
autohide: 'boolean',
|
80
140
|
delay: 'number'
|
81
141
|
};
|
142
|
+
var Default = {
|
143
|
+
animation: true,
|
144
|
+
autohide: true,
|
145
|
+
delay: 500
|
146
|
+
};
|
147
|
+
var SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]';
|
82
148
|
/**
|
83
|
-
*
|
149
|
+
* ------------------------------------------------------------------------
|
150
|
+
* Class Definition
|
151
|
+
* ------------------------------------------------------------------------
|
84
152
|
*/
|
85
153
|
|
86
154
|
var Toast = /*#__PURE__*/function () {
|
@@ -90,6 +158,8 @@
|
|
90
158
|
this._timeout = null;
|
91
159
|
|
92
160
|
this._setListeners();
|
161
|
+
|
162
|
+
Data.setData(element, DATA_KEY, this);
|
93
163
|
} // Getters
|
94
164
|
|
95
165
|
|
@@ -99,15 +169,12 @@
|
|
99
169
|
_proto.show = function show() {
|
100
170
|
var _this = this;
|
101
171
|
|
102
|
-
var showEvent =
|
103
|
-
$__default["default"](this._element).trigger(showEvent);
|
172
|
+
var showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
|
104
173
|
|
105
|
-
if (showEvent.
|
174
|
+
if (showEvent.defaultPrevented) {
|
106
175
|
return;
|
107
176
|
}
|
108
177
|
|
109
|
-
this._clearTimeout();
|
110
|
-
|
111
178
|
if (this._config.animation) {
|
112
179
|
this._element.classList.add(CLASS_NAME_FADE);
|
113
180
|
}
|
@@ -117,7 +184,7 @@
|
|
117
184
|
|
118
185
|
_this._element.classList.add(CLASS_NAME_SHOW);
|
119
186
|
|
120
|
-
|
187
|
+
EventHandler.trigger(_this._element, EVENT_SHOWN);
|
121
188
|
|
122
189
|
if (_this._config.autohide) {
|
123
190
|
_this._timeout = setTimeout(function () {
|
@@ -128,96 +195,87 @@
|
|
128
195
|
|
129
196
|
this._element.classList.remove(CLASS_NAME_HIDE);
|
130
197
|
|
131
|
-
|
198
|
+
reflow(this._element);
|
132
199
|
|
133
200
|
this._element.classList.add(CLASS_NAME_SHOWING);
|
134
201
|
|
135
202
|
if (this._config.animation) {
|
136
|
-
var transitionDuration =
|
137
|
-
|
203
|
+
var transitionDuration = getTransitionDurationFromElement(this._element);
|
204
|
+
EventHandler.one(this._element, TRANSITION_END, complete);
|
205
|
+
emulateTransitionEnd(this._element, transitionDuration);
|
138
206
|
} else {
|
139
207
|
complete();
|
140
208
|
}
|
141
209
|
};
|
142
210
|
|
143
211
|
_proto.hide = function hide() {
|
212
|
+
var _this2 = this;
|
213
|
+
|
144
214
|
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
|
145
215
|
return;
|
146
216
|
}
|
147
217
|
|
148
|
-
var hideEvent =
|
149
|
-
$__default["default"](this._element).trigger(hideEvent);
|
218
|
+
var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
150
219
|
|
151
|
-
if (hideEvent.
|
220
|
+
if (hideEvent.defaultPrevented) {
|
152
221
|
return;
|
153
222
|
}
|
154
223
|
|
155
|
-
|
224
|
+
var complete = function complete() {
|
225
|
+
_this2._element.classList.add(CLASS_NAME_HIDE);
|
226
|
+
|
227
|
+
EventHandler.trigger(_this2._element, EVENT_HIDDEN);
|
228
|
+
};
|
229
|
+
|
230
|
+
this._element.classList.remove(CLASS_NAME_SHOW);
|
231
|
+
|
232
|
+
if (this._config.animation) {
|
233
|
+
var transitionDuration = getTransitionDurationFromElement(this._element);
|
234
|
+
EventHandler.one(this._element, TRANSITION_END, complete);
|
235
|
+
emulateTransitionEnd(this._element, transitionDuration);
|
236
|
+
} else {
|
237
|
+
complete();
|
238
|
+
}
|
156
239
|
};
|
157
240
|
|
158
241
|
_proto.dispose = function dispose() {
|
159
|
-
this.
|
242
|
+
clearTimeout(this._timeout);
|
243
|
+
this._timeout = null;
|
160
244
|
|
161
245
|
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
162
246
|
this._element.classList.remove(CLASS_NAME_SHOW);
|
163
247
|
}
|
164
248
|
|
165
|
-
|
166
|
-
|
249
|
+
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
250
|
+
Data.removeData(this._element, DATA_KEY);
|
167
251
|
this._element = null;
|
168
252
|
this._config = null;
|
169
253
|
} // Private
|
170
254
|
;
|
171
255
|
|
172
256
|
_proto._getConfig = function _getConfig(config) {
|
173
|
-
config =
|
174
|
-
|
257
|
+
config = _objectSpread(_objectSpread(_objectSpread({}, Default), Manipulator.getDataAttributes(this._element)), typeof config === 'object' && config ? config : {});
|
258
|
+
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
175
259
|
return config;
|
176
260
|
};
|
177
261
|
|
178
262
|
_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
263
|
var _this3 = this;
|
188
264
|
|
189
|
-
|
190
|
-
_this3.
|
191
|
-
|
192
|
-
$__default["default"](_this3._element).trigger(EVENT_HIDDEN);
|
193
|
-
};
|
194
|
-
|
195
|
-
this._element.classList.remove(CLASS_NAME_SHOW);
|
196
|
-
|
197
|
-
if (this._config.animation) {
|
198
|
-
var transitionDuration = Util__default["default"].getTransitionDurationFromElement(this._element);
|
199
|
-
$__default["default"](this._element).one(Util__default["default"].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
200
|
-
} else {
|
201
|
-
complete();
|
202
|
-
}
|
203
|
-
};
|
204
|
-
|
205
|
-
_proto._clearTimeout = function _clearTimeout() {
|
206
|
-
clearTimeout(this._timeout);
|
207
|
-
this._timeout = null;
|
265
|
+
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () {
|
266
|
+
return _this3.hide();
|
267
|
+
});
|
208
268
|
} // Static
|
209
269
|
;
|
210
270
|
|
211
|
-
Toast.
|
271
|
+
Toast.jQueryInterface = function jQueryInterface(config) {
|
212
272
|
return this.each(function () {
|
213
|
-
var
|
214
|
-
var data = $element.data(DATA_KEY);
|
273
|
+
var data = Data.getData(this, DATA_KEY);
|
215
274
|
|
216
275
|
var _config = typeof config === 'object' && config;
|
217
276
|
|
218
277
|
if (!data) {
|
219
278
|
data = new Toast(this, _config);
|
220
|
-
$element.data(DATA_KEY, data);
|
221
279
|
}
|
222
280
|
|
223
281
|
if (typeof config === 'string') {
|
@@ -230,6 +288,10 @@
|
|
230
288
|
});
|
231
289
|
};
|
232
290
|
|
291
|
+
Toast.getInstance = function getInstance(element) {
|
292
|
+
return Data.getData(element, DATA_KEY);
|
293
|
+
};
|
294
|
+
|
233
295
|
_createClass(Toast, null, [{
|
234
296
|
key: "VERSION",
|
235
297
|
get: function get() {
|
@@ -249,19 +311,28 @@
|
|
249
311
|
|
250
312
|
return Toast;
|
251
313
|
}();
|
314
|
+
|
315
|
+
var $ = getjQuery();
|
252
316
|
/**
|
317
|
+
* ------------------------------------------------------------------------
|
253
318
|
* jQuery
|
319
|
+
* ------------------------------------------------------------------------
|
320
|
+
* add .toast to jQuery only if jQuery is present
|
254
321
|
*/
|
255
322
|
|
323
|
+
/* istanbul ignore if */
|
256
324
|
|
257
|
-
$
|
258
|
-
|
325
|
+
if ($) {
|
326
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
327
|
+
$.fn[NAME] = Toast.jQueryInterface;
|
328
|
+
$.fn[NAME].Constructor = Toast;
|
259
329
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
330
|
+
$.fn[NAME].noConflict = function () {
|
331
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
332
|
+
return Toast.jQueryInterface;
|
333
|
+
};
|
334
|
+
}
|
264
335
|
|
265
336
|
return Toast;
|
266
337
|
|
267
|
-
}));
|
338
|
+
})));
|