bootstrap 5.0.0.beta2 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/assets/javascripts/bootstrap-sprockets.js +8 -7
  4. data/assets/javascripts/bootstrap.js +2525 -2460
  5. data/assets/javascripts/bootstrap.min.js +2 -2
  6. data/assets/javascripts/bootstrap/alert.js +77 -179
  7. data/assets/javascripts/bootstrap/base-component.js +140 -38
  8. data/assets/javascripts/bootstrap/button.js +54 -100
  9. data/assets/javascripts/bootstrap/carousel.js +335 -451
  10. data/assets/javascripts/bootstrap/collapse.js +195 -303
  11. data/assets/javascripts/bootstrap/dom/data.js +34 -47
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +95 -90
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +23 -21
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +20 -28
  15. data/assets/javascripts/bootstrap/dropdown.js +323 -358
  16. data/assets/javascripts/bootstrap/modal.js +537 -489
  17. data/assets/javascripts/bootstrap/offcanvas.js +720 -0
  18. data/assets/javascripts/bootstrap/popover.js +112 -180
  19. data/assets/javascripts/bootstrap/scrollspy.js +167 -235
  20. data/assets/javascripts/bootstrap/tab.js +121 -188
  21. data/assets/javascripts/bootstrap/toast.js +166 -243
  22. data/assets/javascripts/bootstrap/tooltip.js +333 -495
  23. data/assets/stylesheets/_bootstrap-grid.scss +1 -1
  24. data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
  25. data/assets/stylesheets/_bootstrap.scss +2 -1
  26. data/assets/stylesheets/bootstrap/_accordion.scss +24 -32
  27. data/assets/stylesheets/bootstrap/_buttons.scss +2 -0
  28. data/assets/stylesheets/bootstrap/_card.scss +6 -6
  29. data/assets/stylesheets/bootstrap/_carousel.scss +2 -2
  30. data/assets/stylesheets/bootstrap/_dropdown.scss +14 -23
  31. data/assets/stylesheets/bootstrap/_functions.scss +61 -3
  32. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  33. data/assets/stylesheets/bootstrap/_list-group.scss +16 -5
  34. data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
  35. data/assets/stylesheets/bootstrap/_modal.scss +8 -24
  36. data/assets/stylesheets/bootstrap/_nav.scss +7 -0
  37. data/assets/stylesheets/bootstrap/_navbar.scss +2 -0
  38. data/assets/stylesheets/bootstrap/_offcanvas.scss +79 -0
  39. data/assets/stylesheets/bootstrap/_popover.scss +10 -10
  40. data/assets/stylesheets/bootstrap/_progress.scss +3 -0
  41. data/assets/stylesheets/bootstrap/_reboot.scss +7 -21
  42. data/assets/stylesheets/bootstrap/_spinners.scss +6 -2
  43. data/assets/stylesheets/bootstrap/_tables.scss +1 -0
  44. data/assets/stylesheets/bootstrap/_toasts.scss +1 -1
  45. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
  46. data/assets/stylesheets/bootstrap/_transitions.scss +2 -0
  47. data/assets/stylesheets/bootstrap/_utilities.scss +65 -37
  48. data/assets/stylesheets/bootstrap/_variables.scss +162 -50
  49. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
  50. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
  51. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
  52. data/assets/stylesheets/bootstrap/forms/_form-control.scss +0 -4
  53. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  54. data/assets/stylesheets/bootstrap/forms/_form-select.scss +3 -0
  55. data/assets/stylesheets/bootstrap/mixins/_alert.scss +2 -0
  56. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +2 -0
  57. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +7 -2
  58. data/assets/stylesheets/bootstrap/mixins/_caret.scss +2 -0
  59. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  60. data/assets/stylesheets/bootstrap/mixins/_forms.scss +25 -5
  61. data/assets/stylesheets/bootstrap/mixins/_grid.scss +23 -11
  62. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  63. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +2 -0
  64. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
  65. data/bootstrap.gemspec +1 -1
  66. data/lib/bootstrap/version.rb +2 -2
  67. data/tasks/updater/js.rb +1 -1
  68. data/tasks/updater/network.rb +7 -1
  69. metadata +9 -6
@@ -1,156 +1,58 @@
1
1
  /*!
2
- * Bootstrap toast.js v5.0.0-beta2 (https://getbootstrap.com/)
2
+ * Bootstrap toast.js v5.0.2 (https://getbootstrap.com/)
3
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('./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';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/manipulator', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.EventHandler, global.Manipulator, global.Base));
10
+ }(this, (function (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 Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
14
  var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
15
  var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
17
16
  var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
18
17
 
19
- function _defineProperties(target, props) {
20
- for (var i = 0; i < props.length; i++) {
21
- var descriptor = props[i];
22
- descriptor.enumerable = descriptor.enumerable || false;
23
- descriptor.configurable = true;
24
- if ("value" in descriptor) descriptor.writable = true;
25
- Object.defineProperty(target, descriptor.key, descriptor);
26
- }
27
- }
28
-
29
- function _createClass(Constructor, protoProps, staticProps) {
30
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
31
- if (staticProps) _defineProperties(Constructor, staticProps);
32
- return Constructor;
33
- }
34
-
35
- function _extends() {
36
- _extends = Object.assign || function (target) {
37
- for (var i = 1; i < arguments.length; i++) {
38
- var source = arguments[i];
39
-
40
- for (var key in source) {
41
- if (Object.prototype.hasOwnProperty.call(source, key)) {
42
- target[key] = source[key];
43
- }
44
- }
45
- }
46
-
47
- return target;
48
- };
49
-
50
- return _extends.apply(this, arguments);
51
- }
52
-
53
- function _inheritsLoose(subClass, superClass) {
54
- subClass.prototype = Object.create(superClass.prototype);
55
- subClass.prototype.constructor = subClass;
56
-
57
- _setPrototypeOf(subClass, superClass);
58
- }
59
-
60
- function _setPrototypeOf(o, p) {
61
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
62
- o.__proto__ = p;
63
- return o;
64
- };
65
-
66
- return _setPrototypeOf(o, p);
67
- }
68
-
69
- /**
70
- * --------------------------------------------------------------------------
71
- * Bootstrap (v5.0.0-beta2): util/index.js
72
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
73
- * --------------------------------------------------------------------------
74
- */
75
- var MILLISECONDS_MULTIPLIER = 1000;
76
- var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
77
-
78
- var toType = function toType(obj) {
18
+ const toType = obj => {
79
19
  if (obj === null || obj === undefined) {
80
- return "" + obj;
20
+ return `${obj}`;
81
21
  }
82
22
 
83
23
  return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
84
24
  };
85
25
 
86
- var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
87
- if (!element) {
88
- return 0;
89
- } // Get transition-duration of the element
90
-
91
-
92
- var _window$getComputedSt = window.getComputedStyle(element),
93
- transitionDuration = _window$getComputedSt.transitionDuration,
94
- transitionDelay = _window$getComputedSt.transitionDelay;
95
-
96
- var floatTransitionDuration = Number.parseFloat(transitionDuration);
97
- var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
98
-
99
- if (!floatTransitionDuration && !floatTransitionDelay) {
100
- return 0;
101
- } // If multiple durations are defined, take the first
102
-
103
-
104
- transitionDuration = transitionDuration.split(',')[0];
105
- transitionDelay = transitionDelay.split(',')[0];
106
- return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
107
- };
108
-
109
- var triggerTransitionEnd = function triggerTransitionEnd(element) {
110
- element.dispatchEvent(new Event(TRANSITION_END));
111
- };
112
-
113
- var isElement = function isElement(obj) {
114
- return (obj[0] || obj).nodeType;
115
- };
116
-
117
- var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
118
- var called = false;
119
- var durationPadding = 5;
120
- var emulatedDuration = duration + durationPadding;
26
+ const isElement = obj => {
27
+ if (!obj || typeof obj !== 'object') {
28
+ return false;
29
+ }
121
30
 
122
- function listener() {
123
- called = true;
124
- element.removeEventListener(TRANSITION_END, listener);
31
+ if (typeof obj.jquery !== 'undefined') {
32
+ obj = obj[0];
125
33
  }
126
34
 
127
- element.addEventListener(TRANSITION_END, listener);
128
- setTimeout(function () {
129
- if (!called) {
130
- triggerTransitionEnd(element);
131
- }
132
- }, emulatedDuration);
35
+ return typeof obj.nodeType !== 'undefined';
133
36
  };
134
37
 
135
- var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
136
- Object.keys(configTypes).forEach(function (property) {
137
- var expectedTypes = configTypes[property];
138
- var value = config[property];
139
- var valueType = value && isElement(value) ? 'element' : toType(value);
38
+ const typeCheckConfig = (componentName, config, configTypes) => {
39
+ Object.keys(configTypes).forEach(property => {
40
+ const expectedTypes = configTypes[property];
41
+ const value = config[property];
42
+ const valueType = value && isElement(value) ? 'element' : toType(value);
140
43
 
141
44
  if (!new RegExp(expectedTypes).test(valueType)) {
142
- throw new TypeError(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
45
+ throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
143
46
  }
144
47
  });
145
48
  };
146
49
 
147
- var reflow = function reflow(element) {
148
- return element.offsetHeight;
149
- };
50
+ const reflow = element => element.offsetHeight;
150
51
 
151
- var getjQuery = function getjQuery() {
152
- var _window = window,
153
- jQuery = _window.jQuery;
52
+ const getjQuery = () => {
53
+ const {
54
+ jQuery
55
+ } = window;
154
56
 
155
57
  if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
156
58
  return jQuery;
@@ -159,27 +61,35 @@
159
61
  return null;
160
62
  };
161
63
 
162
- var onDOMContentLoaded = function onDOMContentLoaded(callback) {
64
+ const DOMContentLoadedCallbacks = [];
65
+
66
+ const onDOMContentLoaded = callback => {
163
67
  if (document.readyState === 'loading') {
164
- document.addEventListener('DOMContentLoaded', callback);
68
+ // add listener on the first call when the document is in loading state
69
+ if (!DOMContentLoadedCallbacks.length) {
70
+ document.addEventListener('DOMContentLoaded', () => {
71
+ DOMContentLoadedCallbacks.forEach(callback => callback());
72
+ });
73
+ }
74
+
75
+ DOMContentLoadedCallbacks.push(callback);
165
76
  } else {
166
77
  callback();
167
78
  }
168
79
  };
169
80
 
170
- document.documentElement.dir === 'rtl';
171
-
172
- var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
173
- onDOMContentLoaded(function () {
174
- var $ = getjQuery();
81
+ const defineJQueryPlugin = plugin => {
82
+ onDOMContentLoaded(() => {
83
+ const $ = getjQuery();
175
84
  /* istanbul ignore if */
176
85
 
177
86
  if ($) {
178
- var JQUERY_NO_CONFLICT = $.fn[name];
87
+ const name = plugin.NAME;
88
+ const JQUERY_NO_CONFLICT = $.fn[name];
179
89
  $.fn[name] = plugin.jQueryInterface;
180
90
  $.fn[name].Constructor = plugin;
181
91
 
182
- $.fn[name].noConflict = function () {
92
+ $.fn[name].noConflict = () => {
183
93
  $.fn[name] = JQUERY_NO_CONFLICT;
184
94
  return plugin.jQueryInterface;
185
95
  };
@@ -187,64 +97,78 @@
187
97
  });
188
98
  };
189
99
 
100
+ /**
101
+ * --------------------------------------------------------------------------
102
+ * Bootstrap (v5.0.2): toast.js
103
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
104
+ * --------------------------------------------------------------------------
105
+ */
190
106
  /**
191
107
  * ------------------------------------------------------------------------
192
108
  * Constants
193
109
  * ------------------------------------------------------------------------
194
110
  */
195
111
 
196
- var NAME = 'toast';
197
- var DATA_KEY = 'bs.toast';
198
- var EVENT_KEY = "." + DATA_KEY;
199
- var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY;
200
- var EVENT_HIDE = "hide" + EVENT_KEY;
201
- var EVENT_HIDDEN = "hidden" + EVENT_KEY;
202
- var EVENT_SHOW = "show" + EVENT_KEY;
203
- var EVENT_SHOWN = "shown" + EVENT_KEY;
204
- var CLASS_NAME_FADE = 'fade';
205
- var CLASS_NAME_HIDE = 'hide';
206
- var CLASS_NAME_SHOW = 'show';
207
- var CLASS_NAME_SHOWING = 'showing';
208
- var DefaultType = {
112
+ const NAME = 'toast';
113
+ const DATA_KEY = 'bs.toast';
114
+ const EVENT_KEY = `.${DATA_KEY}`;
115
+ const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
116
+ const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
117
+ const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
118
+ const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
119
+ const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
120
+ const EVENT_HIDE = `hide${EVENT_KEY}`;
121
+ const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
122
+ const EVENT_SHOW = `show${EVENT_KEY}`;
123
+ const EVENT_SHOWN = `shown${EVENT_KEY}`;
124
+ const CLASS_NAME_FADE = 'fade';
125
+ const CLASS_NAME_HIDE = 'hide';
126
+ const CLASS_NAME_SHOW = 'show';
127
+ const CLASS_NAME_SHOWING = 'showing';
128
+ const DefaultType = {
209
129
  animation: 'boolean',
210
130
  autohide: 'boolean',
211
131
  delay: 'number'
212
132
  };
213
- var Default = {
133
+ const Default = {
214
134
  animation: true,
215
135
  autohide: true,
216
136
  delay: 5000
217
137
  };
218
- var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
138
+ const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
219
139
  /**
220
140
  * ------------------------------------------------------------------------
221
141
  * Class Definition
222
142
  * ------------------------------------------------------------------------
223
143
  */
224
144
 
225
- var Toast = /*#__PURE__*/function (_BaseComponent) {
226
- _inheritsLoose(Toast, _BaseComponent);
227
-
228
- function Toast(element, config) {
229
- var _this;
145
+ class Toast extends BaseComponent__default['default'] {
146
+ constructor(element, config) {
147
+ super(element);
148
+ this._config = this._getConfig(config);
149
+ this._timeout = null;
150
+ this._hasMouseInteraction = false;
151
+ this._hasKeyboardInteraction = false;
230
152
 
231
- _this = _BaseComponent.call(this, element) || this;
232
- _this._config = _this._getConfig(config);
233
- _this._timeout = null;
153
+ this._setListeners();
154
+ } // Getters
234
155
 
235
- _this._setListeners();
236
156
 
237
- return _this;
238
- } // Getters
157
+ static get DefaultType() {
158
+ return DefaultType;
159
+ }
239
160
 
161
+ static get Default() {
162
+ return Default;
163
+ }
240
164
 
241
- var _proto = Toast.prototype;
165
+ static get NAME() {
166
+ return NAME;
167
+ } // Public
242
168
 
243
- // Public
244
- _proto.show = function show() {
245
- var _this2 = this;
246
169
 
247
- var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
170
+ show() {
171
+ const showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
248
172
 
249
173
  if (showEvent.defaultPrevented) {
250
174
  return;
@@ -256,18 +180,14 @@
256
180
  this._element.classList.add(CLASS_NAME_FADE);
257
181
  }
258
182
 
259
- var complete = function complete() {
260
- _this2._element.classList.remove(CLASS_NAME_SHOWING);
183
+ const complete = () => {
184
+ this._element.classList.remove(CLASS_NAME_SHOWING);
261
185
 
262
- _this2._element.classList.add(CLASS_NAME_SHOW);
186
+ this._element.classList.add(CLASS_NAME_SHOW);
263
187
 
264
- EventHandler__default['default'].trigger(_this2._element, EVENT_SHOWN);
188
+ EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
265
189
 
266
- if (_this2._config.autohide) {
267
- _this2._timeout = setTimeout(function () {
268
- _this2.hide();
269
- }, _this2._config.delay);
270
- }
190
+ this._maybeScheduleHide();
271
191
  };
272
192
 
273
193
  this._element.classList.remove(CLASS_NAME_HIDE);
@@ -276,119 +196,122 @@
276
196
 
277
197
  this._element.classList.add(CLASS_NAME_SHOWING);
278
198
 
279
- if (this._config.animation) {
280
- var transitionDuration = getTransitionDurationFromElement(this._element);
281
- EventHandler__default['default'].one(this._element, 'transitionend', complete);
282
- emulateTransitionEnd(this._element, transitionDuration);
283
- } else {
284
- complete();
285
- }
286
- };
287
-
288
- _proto.hide = function hide() {
289
- var _this3 = this;
199
+ this._queueCallback(complete, this._element, this._config.animation);
200
+ }
290
201
 
202
+ hide() {
291
203
  if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
292
204
  return;
293
205
  }
294
206
 
295
- var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
207
+ const hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
296
208
 
297
209
  if (hideEvent.defaultPrevented) {
298
210
  return;
299
211
  }
300
212
 
301
- var complete = function complete() {
302
- _this3._element.classList.add(CLASS_NAME_HIDE);
213
+ const complete = () => {
214
+ this._element.classList.add(CLASS_NAME_HIDE);
303
215
 
304
- EventHandler__default['default'].trigger(_this3._element, EVENT_HIDDEN);
216
+ EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
305
217
  };
306
218
 
307
219
  this._element.classList.remove(CLASS_NAME_SHOW);
308
220
 
309
- if (this._config.animation) {
310
- var transitionDuration = getTransitionDurationFromElement(this._element);
311
- EventHandler__default['default'].one(this._element, 'transitionend', complete);
312
- emulateTransitionEnd(this._element, transitionDuration);
313
- } else {
314
- complete();
315
- }
316
- };
221
+ this._queueCallback(complete, this._element, this._config.animation);
222
+ }
317
223
 
318
- _proto.dispose = function dispose() {
224
+ dispose() {
319
225
  this._clearTimeout();
320
226
 
321
227
  if (this._element.classList.contains(CLASS_NAME_SHOW)) {
322
228
  this._element.classList.remove(CLASS_NAME_SHOW);
323
229
  }
324
230
 
325
- EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
326
-
327
- _BaseComponent.prototype.dispose.call(this);
328
-
329
- this._config = null;
231
+ super.dispose();
330
232
  } // Private
331
- ;
332
233
 
333
- _proto._getConfig = function _getConfig(config) {
334
- config = _extends({}, Default, Manipulator__default['default'].getDataAttributes(this._element), typeof config === 'object' && config ? config : {});
234
+
235
+ _getConfig(config) {
236
+ config = { ...Default,
237
+ ...Manipulator__default['default'].getDataAttributes(this._element),
238
+ ...(typeof config === 'object' && config ? config : {})
239
+ };
335
240
  typeCheckConfig(NAME, config, this.constructor.DefaultType);
336
241
  return config;
337
- };
242
+ }
243
+
244
+ _maybeScheduleHide() {
245
+ if (!this._config.autohide) {
246
+ return;
247
+ }
338
248
 
339
- _proto._setListeners = function _setListeners() {
340
- var _this4 = this;
249
+ if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
250
+ return;
251
+ }
341
252
 
342
- EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () {
343
- return _this4.hide();
344
- });
345
- };
253
+ this._timeout = setTimeout(() => {
254
+ this.hide();
255
+ }, this._config.delay);
256
+ }
346
257
 
347
- _proto._clearTimeout = function _clearTimeout() {
258
+ _onInteraction(event, isInteracting) {
259
+ switch (event.type) {
260
+ case 'mouseover':
261
+ case 'mouseout':
262
+ this._hasMouseInteraction = isInteracting;
263
+ break;
264
+
265
+ case 'focusin':
266
+ case 'focusout':
267
+ this._hasKeyboardInteraction = isInteracting;
268
+ break;
269
+ }
270
+
271
+ if (isInteracting) {
272
+ this._clearTimeout();
273
+
274
+ return;
275
+ }
276
+
277
+ const nextElement = event.relatedTarget;
278
+
279
+ if (this._element === nextElement || this._element.contains(nextElement)) {
280
+ return;
281
+ }
282
+
283
+ this._maybeScheduleHide();
284
+ }
285
+
286
+ _setListeners() {
287
+ EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
288
+ EventHandler__default['default'].on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
289
+ EventHandler__default['default'].on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
290
+ EventHandler__default['default'].on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
291
+ EventHandler__default['default'].on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
292
+ }
293
+
294
+ _clearTimeout() {
348
295
  clearTimeout(this._timeout);
349
296
  this._timeout = null;
350
297
  } // Static
351
- ;
352
-
353
- Toast.jQueryInterface = function jQueryInterface(config) {
354
- return this.each(function () {
355
- var data = Data__default['default'].getData(this, DATA_KEY);
356
298
 
357
- var _config = typeof config === 'object' && config;
358
299
 
359
- if (!data) {
360
- data = new Toast(this, _config);
361
- }
300
+ static jQueryInterface(config) {
301
+ return this.each(function () {
302
+ const data = Toast.getOrCreateInstance(this, config);
362
303
 
363
304
  if (typeof config === 'string') {
364
305
  if (typeof data[config] === 'undefined') {
365
- throw new TypeError("No method named \"" + config + "\"");
306
+ throw new TypeError(`No method named "${config}"`);
366
307
  }
367
308
 
368
309
  data[config](this);
369
310
  }
370
311
  });
371
- };
372
-
373
- _createClass(Toast, null, [{
374
- key: "DefaultType",
375
- get: function get() {
376
- return DefaultType;
377
- }
378
- }, {
379
- key: "Default",
380
- get: function get() {
381
- return Default;
382
- }
383
- }, {
384
- key: "DATA_KEY",
385
- get: function get() {
386
- return DATA_KEY;
387
- }
388
- }]);
312
+ }
389
313
 
390
- return Toast;
391
- }(BaseComponent__default['default']);
314
+ }
392
315
  /**
393
316
  * ------------------------------------------------------------------------
394
317
  * jQuery
@@ -397,7 +320,7 @@
397
320
  */
398
321
 
399
322
 
400
- defineJQueryPlugin(NAME, Toast);
323
+ defineJQueryPlugin(Toast);
401
324
 
402
325
  return Toast;
403
326