bootstrap 5.2.3 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) 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 +62 -111
  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 +10 -10
  30. data/assets/javascripts/bootstrap.js +688 -1443
  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 +42 -17
  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 +7 -7
  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 +268 -157
  61. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -0
  62. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +23 -3
  63. data/assets/stylesheets/bootstrap/forms/_form-check.scss +25 -12
  64. data/assets/stylesheets/bootstrap/forms/_form-control.scss +24 -4
  65. data/assets/stylesheets/bootstrap/forms/_form-range.scss +3 -3
  66. data/assets/stylesheets/bootstrap/forms/_form-select.scss +12 -3
  67. data/assets/stylesheets/bootstrap/forms/_input-group.scss +1 -1
  68. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +1 -4
  69. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +20 -2
  70. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  71. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  72. data/assets/stylesheets/bootstrap/helpers/_vr.scss +1 -1
  73. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -1
  74. data/assets/stylesheets/bootstrap/mixins/_banner.scss +2 -4
  75. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  76. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  77. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -7
  78. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  79. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +1 -1
  80. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +5 -1
  81. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  82. data/bootstrap.gemspec +1 -1
  83. data/lib/bootstrap/version.rb +2 -2
  84. data/tasks/updater/js.rb +1 -1
  85. data/tasks/updater/scss.rb +1 -1
  86. 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.1 (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
  */
@@ -39,6 +35,8 @@
39
35
  const ARROW_RIGHT_KEY = 'ArrowRight';
40
36
  const ARROW_UP_KEY = 'ArrowUp';
41
37
  const ARROW_DOWN_KEY = 'ArrowDown';
38
+ const HOME_KEY = 'Home';
39
+ const END_KEY = 'End';
42
40
  const CLASS_NAME_ACTIVE = 'active';
43
41
  const CLASS_NAME_FADE = 'fade';
44
42
  const CLASS_NAME_SHOW = 'show';
@@ -49,134 +47,115 @@
49
47
  const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
50
48
  const SELECTOR_OUTER = '.nav-item, .list-group-item';
51
49
  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
-
50
+ const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // TODO: could only be `tab` in v6
54
51
  const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
55
52
  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"]`;
53
+
56
54
  /**
57
55
  * Class definition
58
56
  */
59
57
 
60
- class Tab extends BaseComponent__default.default {
58
+ class Tab extends BaseComponent {
61
59
  constructor(element) {
62
60
  super(element);
63
61
  this._parent = this._element.closest(SELECTOR_TAB_PANEL);
64
-
65
62
  if (!this._parent) {
66
- return; // todo: should Throw exception on v6
63
+ return;
64
+ // TODO: should throw exception in v6
67
65
  // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
68
- } // Set up initial aria attributes
69
-
66
+ }
70
67
 
68
+ // Set up initial aria attributes
71
69
  this._setInitialAttributes(this._parent, this._getChildren());
70
+ EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
71
+ }
72
72
 
73
- EventHandler__default.default.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
74
- } // Getters
75
-
76
-
73
+ // Getters
77
74
  static get NAME() {
78
75
  return NAME;
79
- } // Public
80
-
76
+ }
81
77
 
78
+ // Public
82
79
  show() {
83
80
  // Shows this elem and deactivate the active sibling if exists
84
81
  const innerElem = this._element;
85
-
86
82
  if (this._elemIsActive(innerElem)) {
87
83
  return;
88
- } // Search for active tab on same parent to deactivate it
89
-
84
+ }
90
85
 
86
+ // Search for active tab on same parent to deactivate it
91
87
  const active = this._getActiveElem();
92
-
93
- const hideEvent = active ? EventHandler__default.default.trigger(active, EVENT_HIDE, {
88
+ const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE, {
94
89
  relatedTarget: innerElem
95
90
  }) : null;
96
- const showEvent = EventHandler__default.default.trigger(innerElem, EVENT_SHOW, {
91
+ const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW, {
97
92
  relatedTarget: active
98
93
  });
99
-
100
94
  if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
101
95
  return;
102
96
  }
103
-
104
97
  this._deactivate(active, innerElem);
105
-
106
98
  this._activate(innerElem, active);
107
- } // Private
108
-
99
+ }
109
100
 
101
+ // Private
110
102
  _activate(element, relatedElem) {
111
103
  if (!element) {
112
104
  return;
113
105
  }
114
-
115
106
  element.classList.add(CLASS_NAME_ACTIVE);
116
-
117
- this._activate(index.getElementFromSelector(element)); // Search and activate/show the proper section
118
-
107
+ this._activate(SelectorEngine.getElementFromSelector(element)); // Search and activate/show the proper section
119
108
 
120
109
  const complete = () => {
121
110
  if (element.getAttribute('role') !== 'tab') {
122
111
  element.classList.add(CLASS_NAME_SHOW);
123
112
  return;
124
113
  }
125
-
126
114
  element.removeAttribute('tabindex');
127
115
  element.setAttribute('aria-selected', true);
128
-
129
116
  this._toggleDropDown(element, true);
130
-
131
- EventHandler__default.default.trigger(element, EVENT_SHOWN, {
117
+ EventHandler.trigger(element, EVENT_SHOWN, {
132
118
  relatedTarget: relatedElem
133
119
  });
134
120
  };
135
-
136
121
  this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE));
137
122
  }
138
-
139
123
  _deactivate(element, relatedElem) {
140
124
  if (!element) {
141
125
  return;
142
126
  }
143
-
144
127
  element.classList.remove(CLASS_NAME_ACTIVE);
145
128
  element.blur();
146
-
147
- this._deactivate(index.getElementFromSelector(element)); // Search and deactivate the shown section too
148
-
129
+ this._deactivate(SelectorEngine.getElementFromSelector(element)); // Search and deactivate the shown section too
149
130
 
150
131
  const complete = () => {
151
132
  if (element.getAttribute('role') !== 'tab') {
152
133
  element.classList.remove(CLASS_NAME_SHOW);
153
134
  return;
154
135
  }
155
-
156
136
  element.setAttribute('aria-selected', false);
157
137
  element.setAttribute('tabindex', '-1');
158
-
159
138
  this._toggleDropDown(element, false);
160
-
161
- EventHandler__default.default.trigger(element, EVENT_HIDDEN, {
139
+ EventHandler.trigger(element, EVENT_HIDDEN, {
162
140
  relatedTarget: relatedElem
163
141
  });
164
142
  };
165
-
166
143
  this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE));
167
144
  }
168
-
169
145
  _keydown(event) {
170
- if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) {
146
+ if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
171
147
  return;
172
148
  }
173
-
174
149
  event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
175
-
176
150
  event.preventDefault();
177
- 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
-
151
+ const children = this._getChildren().filter(element => !index_js.isDisabled(element));
152
+ let nextActiveElement;
153
+ if ([HOME_KEY, END_KEY].includes(event.key)) {
154
+ nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
155
+ } else {
156
+ const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
157
+ nextActiveElement = index_js.getNextActiveElement(children, event.target, isNext, true);
158
+ }
180
159
  if (nextActiveElement) {
181
160
  nextActiveElement.focus({
182
161
  preventScroll: true
@@ -184,141 +163,113 @@
184
163
  Tab.getOrCreateInstance(nextActiveElement).show();
185
164
  }
186
165
  }
187
-
188
166
  _getChildren() {
189
167
  // collection of inner elements
190
- return SelectorEngine__default.default.find(SELECTOR_INNER_ELEM, this._parent);
168
+ return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
191
169
  }
192
-
193
170
  _getActiveElem() {
194
171
  return this._getChildren().find(child => this._elemIsActive(child)) || null;
195
172
  }
196
-
197
173
  _setInitialAttributes(parent, children) {
198
174
  this._setAttributeIfNotExists(parent, 'role', 'tablist');
199
-
200
175
  for (const child of children) {
201
176
  this._setInitialAttributesOnChild(child);
202
177
  }
203
178
  }
204
-
205
179
  _setInitialAttributesOnChild(child) {
206
180
  child = this._getInnerElement(child);
207
-
208
181
  const isActive = this._elemIsActive(child);
209
-
210
182
  const outerElem = this._getOuterElement(child);
211
-
212
183
  child.setAttribute('aria-selected', isActive);
213
-
214
184
  if (outerElem !== child) {
215
185
  this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
216
186
  }
217
-
218
187
  if (!isActive) {
219
188
  child.setAttribute('tabindex', '-1');
220
189
  }
190
+ this._setAttributeIfNotExists(child, 'role', 'tab');
221
191
 
222
- this._setAttributeIfNotExists(child, 'role', 'tab'); // set attributes to the related panel too
223
-
224
-
192
+ // set attributes to the related panel too
225
193
  this._setInitialAttributesOnTargetPanel(child);
226
194
  }
227
-
228
195
  _setInitialAttributesOnTargetPanel(child) {
229
- const target = index.getElementFromSelector(child);
230
-
196
+ const target = SelectorEngine.getElementFromSelector(child);
231
197
  if (!target) {
232
198
  return;
233
199
  }
234
-
235
200
  this._setAttributeIfNotExists(target, 'role', 'tabpanel');
236
-
237
201
  if (child.id) {
238
- this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`);
202
+ this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`);
239
203
  }
240
204
  }
241
-
242
205
  _toggleDropDown(element, open) {
243
206
  const outerElem = this._getOuterElement(element);
244
-
245
207
  if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
246
208
  return;
247
209
  }
248
-
249
210
  const toggle = (selector, className) => {
250
- const element = SelectorEngine__default.default.findOne(selector, outerElem);
251
-
211
+ const element = SelectorEngine.findOne(selector, outerElem);
252
212
  if (element) {
253
213
  element.classList.toggle(className, open);
254
214
  }
255
215
  };
256
-
257
216
  toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
258
217
  toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW);
259
218
  outerElem.setAttribute('aria-expanded', open);
260
219
  }
261
-
262
220
  _setAttributeIfNotExists(element, attribute, value) {
263
221
  if (!element.hasAttribute(attribute)) {
264
222
  element.setAttribute(attribute, value);
265
223
  }
266
224
  }
267
-
268
225
  _elemIsActive(elem) {
269
226
  return elem.classList.contains(CLASS_NAME_ACTIVE);
270
- } // Try to get the inner element (usually the .nav-link)
271
-
227
+ }
272
228
 
229
+ // Try to get the inner element (usually the .nav-link)
273
230
  _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
-
231
+ return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
232
+ }
277
233
 
234
+ // Try to get the outer element (usually the .nav-item)
278
235
  _getOuterElement(elem) {
279
236
  return elem.closest(SELECTOR_OUTER) || elem;
280
- } // Static
281
-
237
+ }
282
238
 
239
+ // Static
283
240
  static jQueryInterface(config) {
284
241
  return this.each(function () {
285
242
  const data = Tab.getOrCreateInstance(this);
286
-
287
243
  if (typeof config !== 'string') {
288
244
  return;
289
245
  }
290
-
291
246
  if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
292
247
  throw new TypeError(`No method named "${config}"`);
293
248
  }
294
-
295
249
  data[config]();
296
250
  });
297
251
  }
298
-
299
252
  }
253
+
300
254
  /**
301
255
  * Data API implementation
302
256
  */
303
257
 
304
-
305
- EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
258
+ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
306
259
  if (['A', 'AREA'].includes(this.tagName)) {
307
260
  event.preventDefault();
308
261
  }
309
-
310
- if (index.isDisabled(this)) {
262
+ if (index_js.isDisabled(this)) {
311
263
  return;
312
264
  }
313
-
314
265
  Tab.getOrCreateInstance(this).show();
315
266
  });
267
+
316
268
  /**
317
269
  * Initialize on focus
318
270
  */
319
-
320
- EventHandler__default.default.on(window, EVENT_LOAD_DATA_API, () => {
321
- for (const element of SelectorEngine__default.default.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
271
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
272
+ for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
322
273
  Tab.getOrCreateInstance(element);
323
274
  }
324
275
  });
@@ -326,7 +277,7 @@
326
277
  * jQuery
327
278
  */
328
279
 
329
- index.defineJQueryPlugin(Tab);
280
+ index_js.defineJQueryPlugin(Tab);
330
281
 
331
282
  return Tab;
332
283
 
@@ -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.1 (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