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