bootstrap 5.2.3 → 5.3.0

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