bootstrap 5.2.3 → 5.3.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/javascripts/bootstrap/alert.js +21 -32
  4. data/assets/javascripts/bootstrap/base-component.js +21 -38
  5. data/assets/javascripts/bootstrap/button.js +18 -22
  6. data/assets/javascripts/bootstrap/carousel.js +51 -135
  7. data/assets/javascripts/bootstrap/collapse.js +39 -102
  8. data/assets/javascripts/bootstrap/dom/data.js +8 -12
  9. data/assets/javascripts/bootstrap/dom/event-handler.js +18 -66
  10. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -17
  11. data/assets/javascripts/bootstrap/dom/selector-engine.js +41 -24
  12. data/assets/javascripts/bootstrap/dropdown.js +73 -145
  13. data/assets/javascripts/bootstrap/modal.js +52 -133
  14. data/assets/javascripts/bootstrap/offcanvas.js +49 -102
  15. data/assets/javascripts/bootstrap/popover.js +22 -29
  16. data/assets/javascripts/bootstrap/scrollspy.js +51 -89
  17. data/assets/javascripts/bootstrap/tab.js +51 -109
  18. data/assets/javascripts/bootstrap/toast.js +30 -73
  19. data/assets/javascripts/bootstrap/tooltip.js +74 -177
  20. data/assets/javascripts/bootstrap/util/backdrop.js +27 -54
  21. data/assets/javascripts/bootstrap/util/component-functions.js +13 -19
  22. data/assets/javascripts/bootstrap/util/config.js +14 -27
  23. data/assets/javascripts/bootstrap/util/focustrap.js +19 -36
  24. data/assets/javascripts/bootstrap/util/index.js +42 -111
  25. data/assets/javascripts/bootstrap/util/sanitizer.js +13 -19
  26. data/assets/javascripts/bootstrap/util/scrollbar.js +23 -50
  27. data/assets/javascripts/bootstrap/util/swipe.js +26 -48
  28. data/assets/javascripts/bootstrap/util/template-factory.js +24 -52
  29. data/assets/javascripts/bootstrap-sprockets.js +1 -1
  30. data/assets/javascripts/bootstrap.js +626 -1406
  31. data/assets/javascripts/bootstrap.min.js +3 -3
  32. data/assets/stylesheets/_bootstrap-grid.scss +1 -3
  33. data/assets/stylesheets/_bootstrap-reboot.scss +1 -0
  34. data/assets/stylesheets/_bootstrap.scss +1 -0
  35. data/assets/stylesheets/bootstrap/_accordion.scss +9 -0
  36. data/assets/stylesheets/bootstrap/_alert.scss +8 -11
  37. data/assets/stylesheets/bootstrap/_button-group.scss +2 -2
  38. data/assets/stylesheets/bootstrap/_buttons.scss +3 -3
  39. data/assets/stylesheets/bootstrap/_card.scss +5 -0
  40. data/assets/stylesheets/bootstrap/_carousel.scss +20 -2
  41. data/assets/stylesheets/bootstrap/_close.scss +32 -9
  42. data/assets/stylesheets/bootstrap/_dropdown.scss +1 -0
  43. data/assets/stylesheets/bootstrap/_functions.scss +1 -1
  44. data/assets/stylesheets/bootstrap/_grid.scss +6 -0
  45. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  46. data/assets/stylesheets/bootstrap/_list-group.scss +12 -7
  47. data/assets/stylesheets/bootstrap/_maps.scss +120 -0
  48. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  49. data/assets/stylesheets/bootstrap/_nav.scss +40 -3
  50. data/assets/stylesheets/bootstrap/_navbar.scss +13 -3
  51. data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -2
  52. data/assets/stylesheets/bootstrap/_pagination.scss +1 -1
  53. data/assets/stylesheets/bootstrap/_progress.scss +10 -1
  54. data/assets/stylesheets/bootstrap/_reboot.scss +3 -3
  55. data/assets/stylesheets/bootstrap/_root.scss +125 -10
  56. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  57. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -5
  58. data/assets/stylesheets/bootstrap/_utilities.scss +172 -13
  59. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  60. data/assets/stylesheets/bootstrap/_variables.scss +260 -151
  61. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -0
  62. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +21 -3
  63. data/assets/stylesheets/bootstrap/forms/_form-check.scss +24 -11
  64. data/assets/stylesheets/bootstrap/forms/_form-control.scss +23 -3
  65. data/assets/stylesheets/bootstrap/forms/_form-select.scss +11 -2
  66. data/assets/stylesheets/bootstrap/forms/_input-group.scss +1 -1
  67. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +22 -2
  68. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  69. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  70. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -1
  71. data/assets/stylesheets/bootstrap/mixins/_banner.scss +2 -4
  72. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  73. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  74. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -7
  75. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  76. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +1 -1
  77. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +5 -1
  78. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  79. data/bootstrap.gemspec +1 -1
  80. data/lib/bootstrap/version.rb +2 -2
  81. data/tasks/updater/js.rb +1 -1
  82. data/tasks/updater/scss.rb +1 -1
  83. metadata +10 -6
@@ -1,26 +1,21 @@
1
1
  /*!
2
- * Bootstrap tab.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap tab.js v5.3.0-alpha3 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 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('./util/index'), require('./dom/event-handler'), require('./dom/selector-engine'), require('./base-component')) :
8
- typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './dom/selector-engine', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Index, global.EventHandler, global.SelectorEngine, global.BaseComponent));
10
- })(this, (function (index, EventHandler, SelectorEngine, BaseComponent) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
16
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./util/index.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/index'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Index));
10
+ })(this, (function (BaseComponent, EventHandler, SelectorEngine, index_js) { 'use strict';
17
11
 
18
12
  /**
19
13
  * --------------------------------------------------------------------------
20
- * Bootstrap (v5.2.3): tab.js
14
+ * Bootstrap tab.js
21
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
22
16
  * --------------------------------------------------------------------------
23
17
  */
18
+
24
19
  /**
25
20
  * Constants
26
21
  */
@@ -49,134 +44,109 @@
49
44
  const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
50
45
  const SELECTOR_OUTER = '.nav-item, .list-group-item';
51
46
  const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
52
- const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // todo:v6: could be only `tab`
53
-
47
+ const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // TODO: could only be `tab` in v6
54
48
  const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
55
49
  const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
50
+
56
51
  /**
57
52
  * Class definition
58
53
  */
59
54
 
60
- class Tab extends BaseComponent__default.default {
55
+ class Tab extends BaseComponent {
61
56
  constructor(element) {
62
57
  super(element);
63
58
  this._parent = this._element.closest(SELECTOR_TAB_PANEL);
64
-
65
59
  if (!this._parent) {
66
- return; // todo: should Throw exception on v6
60
+ return;
61
+ // TODO: should throw exception in v6
67
62
  // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
68
- } // Set up initial aria attributes
69
-
63
+ }
70
64
 
65
+ // Set up initial aria attributes
71
66
  this._setInitialAttributes(this._parent, this._getChildren());
67
+ EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
68
+ }
72
69
 
73
- EventHandler__default.default.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
74
- } // Getters
75
-
76
-
70
+ // Getters
77
71
  static get NAME() {
78
72
  return NAME;
79
- } // Public
80
-
73
+ }
81
74
 
75
+ // Public
82
76
  show() {
83
77
  // Shows this elem and deactivate the active sibling if exists
84
78
  const innerElem = this._element;
85
-
86
79
  if (this._elemIsActive(innerElem)) {
87
80
  return;
88
- } // Search for active tab on same parent to deactivate it
89
-
81
+ }
90
82
 
83
+ // Search for active tab on same parent to deactivate it
91
84
  const active = this._getActiveElem();
92
-
93
- const hideEvent = active ? EventHandler__default.default.trigger(active, EVENT_HIDE, {
85
+ const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE, {
94
86
  relatedTarget: innerElem
95
87
  }) : null;
96
- const showEvent = EventHandler__default.default.trigger(innerElem, EVENT_SHOW, {
88
+ const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW, {
97
89
  relatedTarget: active
98
90
  });
99
-
100
91
  if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
101
92
  return;
102
93
  }
103
-
104
94
  this._deactivate(active, innerElem);
105
-
106
95
  this._activate(innerElem, active);
107
- } // Private
108
-
96
+ }
109
97
 
98
+ // Private
110
99
  _activate(element, relatedElem) {
111
100
  if (!element) {
112
101
  return;
113
102
  }
114
-
115
103
  element.classList.add(CLASS_NAME_ACTIVE);
116
-
117
- this._activate(index.getElementFromSelector(element)); // Search and activate/show the proper section
118
-
104
+ this._activate(SelectorEngine.getElementFromSelector(element)); // Search and activate/show the proper section
119
105
 
120
106
  const complete = () => {
121
107
  if (element.getAttribute('role') !== 'tab') {
122
108
  element.classList.add(CLASS_NAME_SHOW);
123
109
  return;
124
110
  }
125
-
126
111
  element.removeAttribute('tabindex');
127
112
  element.setAttribute('aria-selected', true);
128
-
129
113
  this._toggleDropDown(element, true);
130
-
131
- EventHandler__default.default.trigger(element, EVENT_SHOWN, {
114
+ EventHandler.trigger(element, EVENT_SHOWN, {
132
115
  relatedTarget: relatedElem
133
116
  });
134
117
  };
135
-
136
118
  this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE));
137
119
  }
138
-
139
120
  _deactivate(element, relatedElem) {
140
121
  if (!element) {
141
122
  return;
142
123
  }
143
-
144
124
  element.classList.remove(CLASS_NAME_ACTIVE);
145
125
  element.blur();
146
-
147
- this._deactivate(index.getElementFromSelector(element)); // Search and deactivate the shown section too
148
-
126
+ this._deactivate(SelectorEngine.getElementFromSelector(element)); // Search and deactivate the shown section too
149
127
 
150
128
  const complete = () => {
151
129
  if (element.getAttribute('role') !== 'tab') {
152
130
  element.classList.remove(CLASS_NAME_SHOW);
153
131
  return;
154
132
  }
155
-
156
133
  element.setAttribute('aria-selected', false);
157
134
  element.setAttribute('tabindex', '-1');
158
-
159
135
  this._toggleDropDown(element, false);
160
-
161
- EventHandler__default.default.trigger(element, EVENT_HIDDEN, {
136
+ EventHandler.trigger(element, EVENT_HIDDEN, {
162
137
  relatedTarget: relatedElem
163
138
  });
164
139
  };
165
-
166
140
  this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE));
167
141
  }
168
-
169
142
  _keydown(event) {
170
143
  if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) {
171
144
  return;
172
145
  }
173
-
174
146
  event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
175
-
176
147
  event.preventDefault();
177
148
  const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
178
- const nextActiveElement = index.getNextActiveElement(this._getChildren().filter(element => !index.isDisabled(element)), event.target, isNext, true);
179
-
149
+ const nextActiveElement = index_js.getNextActiveElement(this._getChildren().filter(element => !index_js.isDisabled(element)), event.target, isNext, true);
180
150
  if (nextActiveElement) {
181
151
  nextActiveElement.focus({
182
152
  preventScroll: true
@@ -184,141 +154,113 @@
184
154
  Tab.getOrCreateInstance(nextActiveElement).show();
185
155
  }
186
156
  }
187
-
188
157
  _getChildren() {
189
158
  // collection of inner elements
190
- return SelectorEngine__default.default.find(SELECTOR_INNER_ELEM, this._parent);
159
+ return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
191
160
  }
192
-
193
161
  _getActiveElem() {
194
162
  return this._getChildren().find(child => this._elemIsActive(child)) || null;
195
163
  }
196
-
197
164
  _setInitialAttributes(parent, children) {
198
165
  this._setAttributeIfNotExists(parent, 'role', 'tablist');
199
-
200
166
  for (const child of children) {
201
167
  this._setInitialAttributesOnChild(child);
202
168
  }
203
169
  }
204
-
205
170
  _setInitialAttributesOnChild(child) {
206
171
  child = this._getInnerElement(child);
207
-
208
172
  const isActive = this._elemIsActive(child);
209
-
210
173
  const outerElem = this._getOuterElement(child);
211
-
212
174
  child.setAttribute('aria-selected', isActive);
213
-
214
175
  if (outerElem !== child) {
215
176
  this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
216
177
  }
217
-
218
178
  if (!isActive) {
219
179
  child.setAttribute('tabindex', '-1');
220
180
  }
181
+ this._setAttributeIfNotExists(child, 'role', 'tab');
221
182
 
222
- this._setAttributeIfNotExists(child, 'role', 'tab'); // set attributes to the related panel too
223
-
224
-
183
+ // set attributes to the related panel too
225
184
  this._setInitialAttributesOnTargetPanel(child);
226
185
  }
227
-
228
186
  _setInitialAttributesOnTargetPanel(child) {
229
- const target = index.getElementFromSelector(child);
230
-
187
+ const target = SelectorEngine.getElementFromSelector(child);
231
188
  if (!target) {
232
189
  return;
233
190
  }
234
-
235
191
  this._setAttributeIfNotExists(target, 'role', 'tabpanel');
236
-
237
192
  if (child.id) {
238
- this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`);
193
+ this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`);
239
194
  }
240
195
  }
241
-
242
196
  _toggleDropDown(element, open) {
243
197
  const outerElem = this._getOuterElement(element);
244
-
245
198
  if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
246
199
  return;
247
200
  }
248
-
249
201
  const toggle = (selector, className) => {
250
- const element = SelectorEngine__default.default.findOne(selector, outerElem);
251
-
202
+ const element = SelectorEngine.findOne(selector, outerElem);
252
203
  if (element) {
253
204
  element.classList.toggle(className, open);
254
205
  }
255
206
  };
256
-
257
207
  toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
258
208
  toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW);
259
209
  outerElem.setAttribute('aria-expanded', open);
260
210
  }
261
-
262
211
  _setAttributeIfNotExists(element, attribute, value) {
263
212
  if (!element.hasAttribute(attribute)) {
264
213
  element.setAttribute(attribute, value);
265
214
  }
266
215
  }
267
-
268
216
  _elemIsActive(elem) {
269
217
  return elem.classList.contains(CLASS_NAME_ACTIVE);
270
- } // Try to get the inner element (usually the .nav-link)
271
-
218
+ }
272
219
 
220
+ // Try to get the inner element (usually the .nav-link)
273
221
  _getInnerElement(elem) {
274
- return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine__default.default.findOne(SELECTOR_INNER_ELEM, elem);
275
- } // Try to get the outer element (usually the .nav-item)
276
-
222
+ return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
223
+ }
277
224
 
225
+ // Try to get the outer element (usually the .nav-item)
278
226
  _getOuterElement(elem) {
279
227
  return elem.closest(SELECTOR_OUTER) || elem;
280
- } // Static
281
-
228
+ }
282
229
 
230
+ // Static
283
231
  static jQueryInterface(config) {
284
232
  return this.each(function () {
285
233
  const data = Tab.getOrCreateInstance(this);
286
-
287
234
  if (typeof config !== 'string') {
288
235
  return;
289
236
  }
290
-
291
237
  if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
292
238
  throw new TypeError(`No method named "${config}"`);
293
239
  }
294
-
295
240
  data[config]();
296
241
  });
297
242
  }
298
-
299
243
  }
244
+
300
245
  /**
301
246
  * Data API implementation
302
247
  */
303
248
 
304
-
305
- EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
249
+ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
306
250
  if (['A', 'AREA'].includes(this.tagName)) {
307
251
  event.preventDefault();
308
252
  }
309
-
310
- if (index.isDisabled(this)) {
253
+ if (index_js.isDisabled(this)) {
311
254
  return;
312
255
  }
313
-
314
256
  Tab.getOrCreateInstance(this).show();
315
257
  });
258
+
316
259
  /**
317
260
  * Initialize on focus
318
261
  */
319
-
320
- EventHandler__default.default.on(window, EVENT_LOAD_DATA_API, () => {
321
- for (const element of SelectorEngine__default.default.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
262
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
263
+ for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
322
264
  Tab.getOrCreateInstance(element);
323
265
  }
324
266
  });
@@ -326,7 +268,7 @@
326
268
  * jQuery
327
269
  */
328
270
 
329
- index.defineJQueryPlugin(Tab);
271
+ index_js.defineJQueryPlugin(Tab);
330
272
 
331
273
  return Tab;
332
274
 
@@ -1,25 +1,21 @@
1
1
  /*!
2
- * Bootstrap toast.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap toast.js v5.3.0-alpha3 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 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('./util/index'), require('./dom/event-handler'), require('./base-component'), require('./util/component-functions')) :
8
- typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './base-component', './util/component-functions'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.Index, global.EventHandler, global.BaseComponent, global.ComponentFunctions));
10
- })(this, (function (index, EventHandler, BaseComponent, componentFunctions) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
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';
16
11
 
17
12
  /**
18
13
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.2.3): toast.js
14
+ * Bootstrap toast.js
20
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
16
  * --------------------------------------------------------------------------
22
17
  */
18
+
23
19
  /**
24
20
  * Constants
25
21
  */
@@ -37,7 +33,6 @@
37
33
  const EVENT_SHOWN = `shown${EVENT_KEY}`;
38
34
  const CLASS_NAME_FADE = 'fade';
39
35
  const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
40
-
41
36
  const CLASS_NAME_SHOW = 'show';
42
37
  const CLASS_NAME_SHOWING = 'showing';
43
38
  const DefaultType = {
@@ -50,119 +45,91 @@
50
45
  autohide: true,
51
46
  delay: 5000
52
47
  };
48
+
53
49
  /**
54
50
  * Class definition
55
51
  */
56
52
 
57
- class Toast extends BaseComponent__default.default {
53
+ class Toast extends BaseComponent {
58
54
  constructor(element, config) {
59
55
  super(element, config);
60
56
  this._timeout = null;
61
57
  this._hasMouseInteraction = false;
62
58
  this._hasKeyboardInteraction = false;
63
-
64
59
  this._setListeners();
65
- } // Getters
66
-
60
+ }
67
61
 
62
+ // Getters
68
63
  static get Default() {
69
64
  return Default;
70
65
  }
71
-
72
66
  static get DefaultType() {
73
67
  return DefaultType;
74
68
  }
75
-
76
69
  static get NAME() {
77
70
  return NAME;
78
- } // Public
79
-
71
+ }
80
72
 
73
+ // Public
81
74
  show() {
82
- const showEvent = EventHandler__default.default.trigger(this._element, EVENT_SHOW);
83
-
75
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
84
76
  if (showEvent.defaultPrevented) {
85
77
  return;
86
78
  }
87
-
88
79
  this._clearTimeout();
89
-
90
80
  if (this._config.animation) {
91
81
  this._element.classList.add(CLASS_NAME_FADE);
92
82
  }
93
-
94
83
  const complete = () => {
95
84
  this._element.classList.remove(CLASS_NAME_SHOWING);
96
-
97
- EventHandler__default.default.trigger(this._element, EVENT_SHOWN);
98
-
85
+ EventHandler.trigger(this._element, EVENT_SHOWN);
99
86
  this._maybeScheduleHide();
100
87
  };
101
-
102
88
  this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
103
-
104
-
105
- index.reflow(this._element);
106
-
89
+ index_js.reflow(this._element);
107
90
  this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
108
-
109
91
  this._queueCallback(complete, this._element, this._config.animation);
110
92
  }
111
-
112
93
  hide() {
113
94
  if (!this.isShown()) {
114
95
  return;
115
96
  }
116
-
117
- const hideEvent = EventHandler__default.default.trigger(this._element, EVENT_HIDE);
118
-
97
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
119
98
  if (hideEvent.defaultPrevented) {
120
99
  return;
121
100
  }
122
-
123
101
  const complete = () => {
124
102
  this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
125
-
126
-
127
103
  this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
128
-
129
- EventHandler__default.default.trigger(this._element, EVENT_HIDDEN);
104
+ EventHandler.trigger(this._element, EVENT_HIDDEN);
130
105
  };
131
-
132
106
  this._element.classList.add(CLASS_NAME_SHOWING);
133
-
134
107
  this._queueCallback(complete, this._element, this._config.animation);
135
108
  }
136
-
137
109
  dispose() {
138
110
  this._clearTimeout();
139
-
140
111
  if (this.isShown()) {
141
112
  this._element.classList.remove(CLASS_NAME_SHOW);
142
113
  }
143
-
144
114
  super.dispose();
145
115
  }
146
-
147
116
  isShown() {
148
117
  return this._element.classList.contains(CLASS_NAME_SHOW);
149
- } // Private
118
+ }
150
119
 
120
+ // Private
151
121
 
152
122
  _maybeScheduleHide() {
153
123
  if (!this._config.autohide) {
154
124
  return;
155
125
  }
156
-
157
126
  if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
158
127
  return;
159
128
  }
160
-
161
129
  this._timeout = setTimeout(() => {
162
130
  this.hide();
163
131
  }, this._config.delay);
164
132
  }
165
-
166
133
  _onInteraction(event, isInteracting) {
167
134
  switch (event.type) {
168
135
  case 'mouseover':
@@ -171,7 +138,6 @@
171
138
  this._hasMouseInteraction = isInteracting;
172
139
  break;
173
140
  }
174
-
175
141
  case 'focusin':
176
142
  case 'focusout':
177
143
  {
@@ -179,61 +145,52 @@
179
145
  break;
180
146
  }
181
147
  }
182
-
183
148
  if (isInteracting) {
184
149
  this._clearTimeout();
185
-
186
150
  return;
187
151
  }
188
-
189
152
  const nextElement = event.relatedTarget;
190
-
191
153
  if (this._element === nextElement || this._element.contains(nextElement)) {
192
154
  return;
193
155
  }
194
-
195
156
  this._maybeScheduleHide();
196
157
  }
197
-
198
158
  _setListeners() {
199
- EventHandler__default.default.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
200
- EventHandler__default.default.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
201
- EventHandler__default.default.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
202
- EventHandler__default.default.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
159
+ EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
160
+ EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
161
+ EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
162
+ EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
203
163
  }
204
-
205
164
  _clearTimeout() {
206
165
  clearTimeout(this._timeout);
207
166
  this._timeout = null;
208
- } // Static
209
-
167
+ }
210
168
 
169
+ // Static
211
170
  static jQueryInterface(config) {
212
171
  return this.each(function () {
213
172
  const data = Toast.getOrCreateInstance(this, config);
214
-
215
173
  if (typeof config === 'string') {
216
174
  if (typeof data[config] === 'undefined') {
217
175
  throw new TypeError(`No method named "${config}"`);
218
176
  }
219
-
220
177
  data[config](this);
221
178
  }
222
179
  });
223
180
  }
224
-
225
181
  }
182
+
226
183
  /**
227
184
  * Data API implementation
228
185
  */
229
186
 
187
+ componentFunctions_js.enableDismissTrigger(Toast);
230
188
 
231
- componentFunctions.enableDismissTrigger(Toast);
232
189
  /**
233
190
  * jQuery
234
191
  */
235
192
 
236
- index.defineJQueryPlugin(Toast);
193
+ index_js.defineJQueryPlugin(Toast);
237
194
 
238
195
  return Toast;
239
196