bootstrap 5.0.1 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/assets/javascripts/bootstrap-sprockets.js +7 -7
  4. data/assets/javascripts/bootstrap.js +332 -311
  5. data/assets/javascripts/bootstrap.min.js +2 -2
  6. data/assets/javascripts/bootstrap/alert.js +18 -17
  7. data/assets/javascripts/bootstrap/base-component.js +34 -25
  8. data/assets/javascripts/bootstrap/button.js +18 -19
  9. data/assets/javascripts/bootstrap/carousel.js +67 -52
  10. data/assets/javascripts/bootstrap/collapse.js +15 -6
  11. data/assets/javascripts/bootstrap/dom/data.js +2 -2
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +2 -2
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +2 -2
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +2 -2
  15. data/assets/javascripts/bootstrap/dropdown.js +61 -44
  16. data/assets/javascripts/bootstrap/modal.js +171 -108
  17. data/assets/javascripts/bootstrap/offcanvas.js +144 -95
  18. data/assets/javascripts/bootstrap/popover.js +35 -20
  19. data/assets/javascripts/bootstrap/scrollspy.js +14 -5
  20. data/assets/javascripts/bootstrap/tab.js +18 -10
  21. data/assets/javascripts/bootstrap/toast.js +17 -15
  22. data/assets/javascripts/bootstrap/tooltip.js +20 -21
  23. data/assets/stylesheets/_bootstrap-grid.scss +1 -1
  24. data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
  25. data/assets/stylesheets/_bootstrap.scss +1 -1
  26. data/assets/stylesheets/bootstrap/_card.scss +5 -5
  27. data/assets/stylesheets/bootstrap/_carousel.scss +2 -2
  28. data/assets/stylesheets/bootstrap/_dropdown.scss +4 -4
  29. data/assets/stylesheets/bootstrap/_functions.scss +61 -3
  30. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  31. data/assets/stylesheets/bootstrap/_modal.scss +4 -4
  32. data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -2
  33. data/assets/stylesheets/bootstrap/_popover.scss +10 -10
  34. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  35. data/assets/stylesheets/bootstrap/_toasts.scss +1 -1
  36. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
  37. data/assets/stylesheets/bootstrap/_variables.scss +22 -18
  38. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
  39. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
  40. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
  41. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  42. data/assets/stylesheets/bootstrap/forms/_form-select.scss +3 -0
  43. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +1 -1
  44. data/assets/stylesheets/bootstrap/mixins/_grid.scss +16 -9
  45. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
  46. data/lib/bootstrap/version.rb +2 -2
  47. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e00e53f08ddcb226fbc4ba5d5d0803e9040879a2d260d3597304550b6a9bff0b
4
- data.tar.gz: 0f239d578988e6faa40b51476f065b64f2b6ba84f291f2a71209aa1609bc6d91
3
+ metadata.gz: 0314dcfea7c5fef8beb89c89aae1079993ed58c6509eb6325a7b00bd25bac45e
4
+ data.tar.gz: 1cf536b8bb87f45060505977be1c795d1159b72bce299caeb8652a2f9c122e21
5
5
  SHA512:
6
- metadata.gz: 40448c17c92f5767dc6791b559a129d2842f74ad667d8cb21402058383bad293dbd37cd0173fae40ecf1b8f8620ff3d37f932631056bcdae1ac7b99275d6a2b8
7
- data.tar.gz: 79518238b77d51ece52c474e17aeba9a1dc6af2567c376e22e1f45fb0b43e95966b6d184837aceb5dd33b7825fcd514e5f6ae9f60537262707a0464974599f8d
6
+ metadata.gz: 91e3199ea081cf8a4e515f637a20f155ae77ab602e821220e35218cd52af51563adc616646c099aeda3ee88ee1365d12bb12865963f6fae5b7481af449d3351d
7
+ data.tar.gz: 56fbbc51f5db1cad7c06e785f7b8868010c7db2bdaa6d9278a012b28b15cf7cbbe7c5fa3339f49df40e751032e956f4a00d57558caff3f626d9f1ab4236122a4
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bootstrap Ruby Gem [![Build Status](https://travis-ci.org/twbs/bootstrap-rubygem.svg?branch=master)](https://travis-ci.org/twbs/bootstrap-rubygem) [![Gem](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap)
2
2
 
3
- [Bootstrap 4][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) and Hanami (formerly Lotus).
3
+ [Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) and Hanami (formerly Lotus).
4
4
 
5
5
  For Sass versions of Bootstrap 3 and 2 see [bootstrap-sass](https://github.com/twbs/bootstrap-sass) instead.
6
6
 
@@ -20,7 +20,7 @@ Please see the appropriate guide for your environment of choice:
20
20
  Add `bootstrap` to your Gemfile:
21
21
 
22
22
  ```ruby
23
- gem 'bootstrap', '~> 5.0.1'
23
+ gem 'bootstrap', '~> 5.0.2'
24
24
  ```
25
25
 
26
26
  Ensure that `sprockets-rails` is at least v2.3.2.
@@ -4,16 +4,16 @@
4
4
  //= require ./bootstrap/base-component
5
5
  //= require ./bootstrap/dom/manipulator
6
6
  //= require ./bootstrap/dom/selector-engine
7
- //= require ./bootstrap/dropdown
8
- //= require ./bootstrap/scrollspy
9
- //= require ./bootstrap/alert
7
+ //= require ./bootstrap/carousel
10
8
  //= require ./bootstrap/collapse
9
+ //= require ./bootstrap/button
10
+ //= require ./bootstrap/tab
11
11
  //= require ./bootstrap/toast
12
12
  //= require ./bootstrap/tooltip
13
- //= require ./bootstrap/offcanvas
14
13
  //= require ./bootstrap/popover
15
- //= require ./bootstrap/button
14
+ //= require ./bootstrap/alert
15
+ //= require ./bootstrap/offcanvas
16
+ //= require ./bootstrap/scrollspy
16
17
  //= require ./bootstrap/modal
17
- //= require ./bootstrap/tab
18
- //= require ./bootstrap/carousel
18
+ //= require ./bootstrap/dropdown
19
19
  //= require ./bootstrap-global-this-undefine
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap v5.0.1 (https://getbootstrap.com/)
2
+ * Bootstrap 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
  */
@@ -33,7 +33,7 @@
33
33
 
34
34
  /**
35
35
  * --------------------------------------------------------------------------
36
- * Bootstrap (v5.0.1): dom/selector-engine.js
36
+ * Bootstrap (v5.0.2): dom/selector-engine.js
37
37
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38
38
  * --------------------------------------------------------------------------
39
39
  */
@@ -104,7 +104,7 @@
104
104
 
105
105
  /**
106
106
  * --------------------------------------------------------------------------
107
- * Bootstrap (v5.0.1): util/index.js
107
+ * Bootstrap (v5.0.2): util/index.js
108
108
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
109
109
  * --------------------------------------------------------------------------
110
110
  */
@@ -226,24 +226,6 @@
226
226
  return null;
227
227
  };
228
228
 
229
- const emulateTransitionEnd = (element, duration) => {
230
- let called = false;
231
- const durationPadding = 5;
232
- const emulatedDuration = duration + durationPadding;
233
-
234
- function listener() {
235
- called = true;
236
- element.removeEventListener(TRANSITION_END, listener);
237
- }
238
-
239
- element.addEventListener(TRANSITION_END, listener);
240
- setTimeout(() => {
241
- if (!called) {
242
- triggerTransitionEnd(element);
243
- }
244
- }, emulatedDuration);
245
- };
246
-
247
229
  const typeCheckConfig = (componentName, config, configTypes) => {
248
230
  Object.keys(configTypes).forEach(property => {
249
231
  const expectedTypes = configTypes[property];
@@ -257,17 +239,11 @@
257
239
  };
258
240
 
259
241
  const isVisible = element => {
260
- if (!element) {
242
+ if (!isElement(element) || element.getClientRects().length === 0) {
261
243
  return false;
262
244
  }
263
245
 
264
- if (element.style && element.parentNode && element.parentNode.style) {
265
- const elementStyle = getComputedStyle(element);
266
- const parentNodeStyle = getComputedStyle(element.parentNode);
267
- return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
268
- }
269
-
270
- return false;
246
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
271
247
  };
272
248
 
273
249
  const isDisabled = element => {
@@ -325,9 +301,18 @@
325
301
  return null;
326
302
  };
327
303
 
304
+ const DOMContentLoadedCallbacks = [];
305
+
328
306
  const onDOMContentLoaded = callback => {
329
307
  if (document.readyState === 'loading') {
330
- document.addEventListener('DOMContentLoaded', callback);
308
+ // add listener on the first call when the document is in loading state
309
+ if (!DOMContentLoadedCallbacks.length) {
310
+ document.addEventListener('DOMContentLoaded', () => {
311
+ DOMContentLoadedCallbacks.forEach(callback => callback());
312
+ });
313
+ }
314
+
315
+ DOMContentLoadedCallbacks.push(callback);
331
316
  } else {
332
317
  callback();
333
318
  }
@@ -360,63 +345,66 @@
360
345
  }
361
346
  };
362
347
 
363
- /**
364
- * --------------------------------------------------------------------------
365
- * Bootstrap (v5.0.1): dom/data.js
366
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
367
- * --------------------------------------------------------------------------
368
- */
369
-
370
- /**
371
- * ------------------------------------------------------------------------
372
- * Constants
373
- * ------------------------------------------------------------------------
374
- */
375
- const elementMap = new Map();
376
- var Data = {
377
- set(element, key, instance) {
378
- if (!elementMap.has(element)) {
379
- elementMap.set(element, new Map());
380
- }
348
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
349
+ if (!waitForTransition) {
350
+ execute(callback);
351
+ return;
352
+ }
381
353
 
382
- const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
383
- // can be removed later when multiple key/instances are fine to be used
354
+ const durationPadding = 5;
355
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
356
+ let called = false;
384
357
 
385
- if (!instanceMap.has(key) && instanceMap.size !== 0) {
386
- // eslint-disable-next-line no-console
387
- console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
358
+ const handler = ({
359
+ target
360
+ }) => {
361
+ if (target !== transitionElement) {
388
362
  return;
389
363
  }
390
364
 
391
- instanceMap.set(key, instance);
392
- },
365
+ called = true;
366
+ transitionElement.removeEventListener(TRANSITION_END, handler);
367
+ execute(callback);
368
+ };
393
369
 
394
- get(element, key) {
395
- if (elementMap.has(element)) {
396
- return elementMap.get(element).get(key) || null;
370
+ transitionElement.addEventListener(TRANSITION_END, handler);
371
+ setTimeout(() => {
372
+ if (!called) {
373
+ triggerTransitionEnd(transitionElement);
397
374
  }
375
+ }, emulatedDuration);
376
+ };
377
+ /**
378
+ * Return the previous/next element of a list.
379
+ *
380
+ * @param {array} list The list of elements
381
+ * @param activeElement The active element
382
+ * @param shouldGetNext Choose to get next or previous element
383
+ * @param isCycleAllowed
384
+ * @return {Element|elem} The proper element
385
+ */
398
386
 
399
- return null;
400
- },
401
387
 
402
- remove(element, key) {
403
- if (!elementMap.has(element)) {
404
- return;
405
- }
388
+ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
389
+ let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
406
390
 
407
- const instanceMap = elementMap.get(element);
408
- instanceMap.delete(key); // free up element references if there are no instances left for an element
391
+ if (index === -1) {
392
+ return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
393
+ }
409
394
 
410
- if (instanceMap.size === 0) {
411
- elementMap.delete(element);
412
- }
395
+ const listLength = list.length;
396
+ index += shouldGetNext ? 1 : -1;
397
+
398
+ if (isCycleAllowed) {
399
+ index = (index + listLength) % listLength;
413
400
  }
414
401
 
402
+ return list[Math.max(0, Math.min(index, listLength - 1))];
415
403
  };
416
404
 
417
405
  /**
418
406
  * --------------------------------------------------------------------------
419
- * Bootstrap (v5.0.1): dom/event-handler.js
407
+ * Bootstrap (v5.0.2): dom/event-handler.js
420
408
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
421
409
  * --------------------------------------------------------------------------
422
410
  */
@@ -705,17 +693,71 @@
705
693
 
706
694
  /**
707
695
  * --------------------------------------------------------------------------
708
- * Bootstrap (v5.0.1): base-component.js
696
+ * Bootstrap (v5.0.2): dom/data.js
709
697
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
710
698
  * --------------------------------------------------------------------------
711
699
  */
700
+
712
701
  /**
713
702
  * ------------------------------------------------------------------------
714
703
  * Constants
715
704
  * ------------------------------------------------------------------------
716
705
  */
706
+ const elementMap = new Map();
707
+ var Data = {
708
+ set(element, key, instance) {
709
+ if (!elementMap.has(element)) {
710
+ elementMap.set(element, new Map());
711
+ }
712
+
713
+ const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
714
+ // can be removed later when multiple key/instances are fine to be used
717
715
 
718
- const VERSION = '5.0.1';
716
+ if (!instanceMap.has(key) && instanceMap.size !== 0) {
717
+ // eslint-disable-next-line no-console
718
+ console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
719
+ return;
720
+ }
721
+
722
+ instanceMap.set(key, instance);
723
+ },
724
+
725
+ get(element, key) {
726
+ if (elementMap.has(element)) {
727
+ return elementMap.get(element).get(key) || null;
728
+ }
729
+
730
+ return null;
731
+ },
732
+
733
+ remove(element, key) {
734
+ if (!elementMap.has(element)) {
735
+ return;
736
+ }
737
+
738
+ const instanceMap = elementMap.get(element);
739
+ instanceMap.delete(key); // free up element references if there are no instances left for an element
740
+
741
+ if (instanceMap.size === 0) {
742
+ elementMap.delete(element);
743
+ }
744
+ }
745
+
746
+ };
747
+
748
+ /**
749
+ * --------------------------------------------------------------------------
750
+ * Bootstrap (v5.0.2): base-component.js
751
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
752
+ * --------------------------------------------------------------------------
753
+ */
754
+ /**
755
+ * ------------------------------------------------------------------------
756
+ * Constants
757
+ * ------------------------------------------------------------------------
758
+ */
759
+
760
+ const VERSION = '5.0.2';
719
761
 
720
762
  class BaseComponent {
721
763
  constructor(element) {
@@ -738,14 +780,7 @@
738
780
  }
739
781
 
740
782
  _queueCallback(callback, element, isAnimated = true) {
741
- if (!isAnimated) {
742
- execute(callback);
743
- return;
744
- }
745
-
746
- const transitionDuration = getTransitionDurationFromElement(element);
747
- EventHandler.one(element, 'transitionend', () => execute(callback));
748
- emulateTransitionEnd(element, transitionDuration);
783
+ executeAfterTransition(callback, element, isAnimated);
749
784
  }
750
785
  /** Static */
751
786
 
@@ -754,6 +789,10 @@
754
789
  return Data.get(element, this.DATA_KEY);
755
790
  }
756
791
 
792
+ static getOrCreateInstance(element, config = {}) {
793
+ return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
794
+ }
795
+
757
796
  static get VERSION() {
758
797
  return VERSION;
759
798
  }
@@ -774,7 +813,7 @@
774
813
 
775
814
  /**
776
815
  * --------------------------------------------------------------------------
777
- * Bootstrap (v5.0.1): alert.js
816
+ * Bootstrap (v5.0.2): alert.js
778
817
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
779
818
  * --------------------------------------------------------------------------
780
819
  */
@@ -837,21 +876,14 @@
837
876
  }
838
877
 
839
878
  _destroyElement(element) {
840
- if (element.parentNode) {
841
- element.parentNode.removeChild(element);
842
- }
843
-
879
+ element.remove();
844
880
  EventHandler.trigger(element, EVENT_CLOSED);
845
881
  } // Static
846
882
 
847
883
 
848
884
  static jQueryInterface(config) {
849
885
  return this.each(function () {
850
- let data = Data.get(this, DATA_KEY$b);
851
-
852
- if (!data) {
853
- data = new Alert(this);
854
- }
886
+ const data = Alert.getOrCreateInstance(this);
855
887
 
856
888
  if (config === 'close') {
857
889
  data[config](this);
@@ -889,7 +921,7 @@
889
921
 
890
922
  /**
891
923
  * --------------------------------------------------------------------------
892
- * Bootstrap (v5.0.1): button.js
924
+ * Bootstrap (v5.0.2): button.js
893
925
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
894
926
  * --------------------------------------------------------------------------
895
927
  */
@@ -927,11 +959,7 @@
927
959
 
928
960
  static jQueryInterface(config) {
929
961
  return this.each(function () {
930
- let data = Data.get(this, DATA_KEY$a);
931
-
932
- if (!data) {
933
- data = new Button(this);
934
- }
962
+ const data = Button.getOrCreateInstance(this);
935
963
 
936
964
  if (config === 'toggle') {
937
965
  data[config]();
@@ -950,12 +978,7 @@
950
978
  EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
951
979
  event.preventDefault();
952
980
  const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
953
- let data = Data.get(button, DATA_KEY$a);
954
-
955
- if (!data) {
956
- data = new Button(button);
957
- }
958
-
981
+ const data = Button.getOrCreateInstance(button);
959
982
  data.toggle();
960
983
  });
961
984
  /**
@@ -969,7 +992,7 @@
969
992
 
970
993
  /**
971
994
  * --------------------------------------------------------------------------
972
- * Bootstrap (v5.0.1): dom/manipulator.js
995
+ * Bootstrap (v5.0.2): dom/manipulator.js
973
996
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
974
997
  * --------------------------------------------------------------------------
975
998
  */
@@ -1043,7 +1066,7 @@
1043
1066
 
1044
1067
  /**
1045
1068
  * --------------------------------------------------------------------------
1046
- * Bootstrap (v5.0.1): carousel.js
1069
+ * Bootstrap (v5.0.2): carousel.js
1047
1070
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
1048
1071
  * --------------------------------------------------------------------------
1049
1072
  */
@@ -1082,6 +1105,10 @@
1082
1105
  const ORDER_PREV = 'prev';
1083
1106
  const DIRECTION_LEFT = 'left';
1084
1107
  const DIRECTION_RIGHT = 'right';
1108
+ const KEY_TO_DIRECTION = {
1109
+ [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
1110
+ [ARROW_RIGHT_KEY]: DIRECTION_LEFT
1111
+ };
1085
1112
  const EVENT_SLIDE = `slide${EVENT_KEY$9}`;
1086
1113
  const EVENT_SLID = `slid${EVENT_KEY$9}`;
1087
1114
  const EVENT_KEYDOWN = `keydown${EVENT_KEY$9}`;
@@ -1150,9 +1177,7 @@
1150
1177
 
1151
1178
 
1152
1179
  next() {
1153
- if (!this._isSliding) {
1154
- this._slide(ORDER_NEXT);
1155
- }
1180
+ this._slide(ORDER_NEXT);
1156
1181
  }
1157
1182
 
1158
1183
  nextWhenVisible() {
@@ -1164,9 +1189,7 @@
1164
1189
  }
1165
1190
 
1166
1191
  prev() {
1167
- if (!this._isSliding) {
1168
- this._slide(ORDER_PREV);
1169
- }
1192
+ this._slide(ORDER_PREV);
1170
1193
  }
1171
1194
 
1172
1195
  pause(event) {
@@ -1228,7 +1251,8 @@
1228
1251
 
1229
1252
  _getConfig(config) {
1230
1253
  config = { ...Default$9,
1231
- ...config
1254
+ ...Manipulator.getDataAttributes(this._element),
1255
+ ...(typeof config === 'object' ? config : {})
1232
1256
  };
1233
1257
  typeCheckConfig(NAME$a, config, DefaultType$9);
1234
1258
  return config;
@@ -1326,14 +1350,12 @@
1326
1350
  return;
1327
1351
  }
1328
1352
 
1329
- if (event.key === ARROW_LEFT_KEY) {
1330
- event.preventDefault();
1353
+ const direction = KEY_TO_DIRECTION[event.key];
1331
1354
 
1332
- this._slide(DIRECTION_RIGHT);
1333
- } else if (event.key === ARROW_RIGHT_KEY) {
1355
+ if (direction) {
1334
1356
  event.preventDefault();
1335
1357
 
1336
- this._slide(DIRECTION_LEFT);
1358
+ this._slide(direction);
1337
1359
  }
1338
1360
  }
1339
1361
 
@@ -1344,20 +1366,7 @@
1344
1366
 
1345
1367
  _getItemByOrder(order, activeElement) {
1346
1368
  const isNext = order === ORDER_NEXT;
1347
- const isPrev = order === ORDER_PREV;
1348
-
1349
- const activeIndex = this._getItemIndex(activeElement);
1350
-
1351
- const lastItemIndex = this._items.length - 1;
1352
- const isGoingToWrap = isPrev && activeIndex === 0 || isNext && activeIndex === lastItemIndex;
1353
-
1354
- if (isGoingToWrap && !this._config.wrap) {
1355
- return activeElement;
1356
- }
1357
-
1358
- const delta = isPrev ? -1 : 1;
1359
- const itemIndex = (activeIndex + delta) % this._items.length;
1360
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
1369
+ return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
1361
1370
  }
1362
1371
 
1363
1372
  _triggerSlideEvent(relatedTarget, eventDirectionName) {
@@ -1430,6 +1439,10 @@
1430
1439
  return;
1431
1440
  }
1432
1441
 
1442
+ if (this._isSliding) {
1443
+ return;
1444
+ }
1445
+
1433
1446
  const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
1434
1447
 
1435
1448
  if (slideEvent.defaultPrevented) {
@@ -1513,10 +1526,10 @@
1513
1526
 
1514
1527
 
1515
1528
  static carouselInterface(element, config) {
1516
- let data = Data.get(element, DATA_KEY$9);
1517
- let _config = { ...Default$9,
1518
- ...Manipulator.getDataAttributes(element)
1519
- };
1529
+ const data = Carousel.getOrCreateInstance(element, config);
1530
+ let {
1531
+ _config
1532
+ } = data;
1520
1533
 
1521
1534
  if (typeof config === 'object') {
1522
1535
  _config = { ..._config,
@@ -1526,10 +1539,6 @@
1526
1539
 
1527
1540
  const action = typeof config === 'string' ? config : _config.slide;
1528
1541
 
1529
- if (!data) {
1530
- data = new Carousel(element, _config);
1531
- }
1532
-
1533
1542
  if (typeof config === 'number') {
1534
1543
  data.to(config);
1535
1544
  } else if (typeof action === 'string') {
@@ -1569,7 +1578,7 @@
1569
1578
  Carousel.carouselInterface(target, config);
1570
1579
 
1571
1580
  if (slideIndex) {
1572
- Data.get(target, DATA_KEY$9).to(slideIndex);
1581
+ Carousel.getInstance(target).to(slideIndex);
1573
1582
  }
1574
1583
 
1575
1584
  event.preventDefault();
@@ -1588,7 +1597,7 @@
1588
1597
  const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
1589
1598
 
1590
1599
  for (let i = 0, len = carousels.length; i < len; i++) {
1591
- Carousel.carouselInterface(carousels[i], Data.get(carousels[i], DATA_KEY$9));
1600
+ Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
1592
1601
  }
1593
1602
  });
1594
1603
  /**
@@ -1602,7 +1611,7 @@
1602
1611
 
1603
1612
  /**
1604
1613
  * --------------------------------------------------------------------------
1605
- * Bootstrap (v5.0.1): collapse.js
1614
+ * Bootstrap (v5.0.2): collapse.js
1606
1615
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
1607
1616
  * --------------------------------------------------------------------------
1608
1617
  */
@@ -1718,7 +1727,7 @@
1718
1727
 
1719
1728
  if (actives) {
1720
1729
  const tempActiveData = actives.find(elem => container !== elem);
1721
- activesData = tempActiveData ? Data.get(tempActiveData, DATA_KEY$8) : null;
1730
+ activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
1722
1731
 
1723
1732
  if (activesData && activesData._isTransitioning) {
1724
1733
  return;
@@ -1881,7 +1890,7 @@
1881
1890
 
1882
1891
 
1883
1892
  static collapseInterface(element, config) {
1884
- let data = Data.get(element, DATA_KEY$8);
1893
+ let data = Collapse.getInstance(element);
1885
1894
  const _config = { ...Default$8,
1886
1895
  ...Manipulator.getDataAttributes(element),
1887
1896
  ...(typeof config === 'object' && config ? config : {})
@@ -1928,7 +1937,7 @@
1928
1937
  const selector = getSelectorFromElement(this);
1929
1938
  const selectorElements = SelectorEngine.find(selector);
1930
1939
  selectorElements.forEach(element => {
1931
- const data = Data.get(element, DATA_KEY$8);
1940
+ const data = Collapse.getInstance(element);
1932
1941
  let config;
1933
1942
 
1934
1943
  if (data) {
@@ -1957,7 +1966,7 @@
1957
1966
 
1958
1967
  /**
1959
1968
  * --------------------------------------------------------------------------
1960
- * Bootstrap (v5.0.1): dropdown.js
1969
+ * Bootstrap (v5.0.2): dropdown.js
1961
1970
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
1962
1971
  * --------------------------------------------------------------------------
1963
1972
  */
@@ -2277,38 +2286,24 @@
2277
2286
  };
2278
2287
  }
2279
2288
 
2280
- _selectMenuItem(event) {
2289
+ _selectMenuItem({
2290
+ key,
2291
+ target
2292
+ }) {
2281
2293
  const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
2282
2294
 
2283
2295
  if (!items.length) {
2284
2296
  return;
2285
- }
2286
-
2287
- let index = items.indexOf(event.target); // Up
2288
-
2289
- if (event.key === ARROW_UP_KEY && index > 0) {
2290
- index--;
2291
- } // Down
2297
+ } // if target isn't included in items (e.g. when expanding the dropdown)
2298
+ // allow cycling to get the last item in case key equals ARROW_UP_KEY
2292
2299
 
2293
2300
 
2294
- if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
2295
- index++;
2296
- } // index is -1 if the first keydown is an ArrowUp
2297
-
2298
-
2299
- index = index === -1 ? 0 : index;
2300
- items[index].focus();
2301
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
2301
2302
  } // Static
2302
2303
 
2303
2304
 
2304
2305
  static dropdownInterface(element, config) {
2305
- let data = Data.get(element, DATA_KEY$7);
2306
-
2307
- const _config = typeof config === 'object' ? config : null;
2308
-
2309
- if (!data) {
2310
- data = new Dropdown(element, _config);
2311
- }
2306
+ const data = Dropdown.getOrCreateInstance(element, config);
2312
2307
 
2313
2308
  if (typeof config === 'string') {
2314
2309
  if (typeof data[config] === 'undefined') {
@@ -2333,7 +2328,7 @@
2333
2328
  const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
2334
2329
 
2335
2330
  for (let i = 0, len = toggles.length; i < len; i++) {
2336
- const context = Data.get(toggles[i], DATA_KEY$7);
2331
+ const context = Dropdown.getInstance(toggles[i]);
2337
2332
 
2338
2333
  if (!context || context._config.autoClose === false) {
2339
2334
  continue;
@@ -2406,17 +2401,19 @@
2406
2401
  return;
2407
2402
  }
2408
2403
 
2409
- if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
2410
- getToggleButton().click();
2404
+ if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
2405
+ if (!isActive) {
2406
+ getToggleButton().click();
2407
+ }
2408
+
2409
+ Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
2410
+
2411
2411
  return;
2412
2412
  }
2413
2413
 
2414
2414
  if (!isActive || event.key === SPACE_KEY) {
2415
2415
  Dropdown.clearMenus();
2416
- return;
2417
2416
  }
2418
-
2419
- Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
2420
2417
  }
2421
2418
 
2422
2419
  }
@@ -2446,81 +2443,111 @@
2446
2443
 
2447
2444
  /**
2448
2445
  * --------------------------------------------------------------------------
2449
- * Bootstrap (v5.0.1): util/scrollBar.js
2446
+ * Bootstrap (v5.0.2): util/scrollBar.js
2450
2447
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2451
2448
  * --------------------------------------------------------------------------
2452
2449
  */
2453
2450
  const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
2454
2451
  const SELECTOR_STICKY_CONTENT = '.sticky-top';
2455
2452
 
2456
- const getWidth = () => {
2457
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
2458
- const documentWidth = document.documentElement.clientWidth;
2459
- return Math.abs(window.innerWidth - documentWidth);
2460
- };
2453
+ class ScrollBarHelper {
2454
+ constructor() {
2455
+ this._element = document.body;
2456
+ }
2461
2457
 
2462
- const hide = (width = getWidth()) => {
2463
- _disableOverFlow(); // give padding to element to balances the hidden scrollbar width
2458
+ getWidth() {
2459
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
2460
+ const documentWidth = document.documentElement.clientWidth;
2461
+ return Math.abs(window.innerWidth - documentWidth);
2462
+ }
2464
2463
 
2464
+ hide() {
2465
+ const width = this.getWidth();
2465
2466
 
2466
- _setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
2467
+ this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
2467
2468
 
2468
2469
 
2469
- _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
2470
+ this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
2470
2471
 
2471
- _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
2472
- };
2473
2472
 
2474
- const _disableOverFlow = () => {
2475
- const actualValue = document.body.style.overflow;
2473
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
2476
2474
 
2477
- if (actualValue) {
2478
- Manipulator.setDataAttribute(document.body, 'overflow', actualValue);
2475
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
2479
2476
  }
2480
2477
 
2481
- document.body.style.overflow = 'hidden';
2482
- };
2478
+ _disableOverFlow() {
2479
+ this._saveInitialAttribute(this._element, 'overflow');
2483
2480
 
2484
- const _setElementAttributes = (selector, styleProp, callback) => {
2485
- const scrollbarWidth = getWidth();
2486
- SelectorEngine.find(selector).forEach(element => {
2487
- if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
2488
- return;
2489
- }
2481
+ this._element.style.overflow = 'hidden';
2482
+ }
2490
2483
 
2491
- const actualValue = element.style[styleProp];
2492
- const calculatedValue = window.getComputedStyle(element)[styleProp];
2493
- Manipulator.setDataAttribute(element, styleProp, actualValue);
2494
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
2495
- });
2496
- };
2484
+ _setElementAttributes(selector, styleProp, callback) {
2485
+ const scrollbarWidth = this.getWidth();
2486
+
2487
+ const manipulationCallBack = element => {
2488
+ if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
2489
+ return;
2490
+ }
2497
2491
 
2498
- const reset = () => {
2499
- _resetElementAttributes('body', 'overflow');
2492
+ this._saveInitialAttribute(element, styleProp);
2500
2493
 
2501
- _resetElementAttributes('body', 'paddingRight');
2494
+ const calculatedValue = window.getComputedStyle(element)[styleProp];
2495
+ element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
2496
+ };
2502
2497
 
2503
- _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
2498
+ this._applyManipulationCallback(selector, manipulationCallBack);
2499
+ }
2504
2500
 
2505
- _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
2506
- };
2501
+ reset() {
2502
+ this._resetElementAttributes(this._element, 'overflow');
2503
+
2504
+ this._resetElementAttributes(this._element, 'paddingRight');
2505
+
2506
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
2507
+
2508
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
2509
+ }
2510
+
2511
+ _saveInitialAttribute(element, styleProp) {
2512
+ const actualValue = element.style[styleProp];
2513
+
2514
+ if (actualValue) {
2515
+ Manipulator.setDataAttribute(element, styleProp, actualValue);
2516
+ }
2517
+ }
2518
+
2519
+ _resetElementAttributes(selector, styleProp) {
2520
+ const manipulationCallBack = element => {
2521
+ const value = Manipulator.getDataAttribute(element, styleProp);
2522
+
2523
+ if (typeof value === 'undefined') {
2524
+ element.style.removeProperty(styleProp);
2525
+ } else {
2526
+ Manipulator.removeDataAttribute(element, styleProp);
2527
+ element.style[styleProp] = value;
2528
+ }
2529
+ };
2507
2530
 
2508
- const _resetElementAttributes = (selector, styleProp) => {
2509
- SelectorEngine.find(selector).forEach(element => {
2510
- const value = Manipulator.getDataAttribute(element, styleProp);
2531
+ this._applyManipulationCallback(selector, manipulationCallBack);
2532
+ }
2511
2533
 
2512
- if (typeof value === 'undefined') {
2513
- element.style.removeProperty(styleProp);
2534
+ _applyManipulationCallback(selector, callBack) {
2535
+ if (isElement(selector)) {
2536
+ callBack(selector);
2514
2537
  } else {
2515
- Manipulator.removeDataAttribute(element, styleProp);
2516
- element.style[styleProp] = value;
2538
+ SelectorEngine.find(selector, this._element).forEach(callBack);
2517
2539
  }
2518
- });
2519
- };
2540
+ }
2541
+
2542
+ isOverflowing() {
2543
+ return this.getWidth() > 0;
2544
+ }
2545
+
2546
+ }
2520
2547
 
2521
2548
  /**
2522
2549
  * --------------------------------------------------------------------------
2523
- * Bootstrap (v5.0.1): util/backdrop.js
2550
+ * Bootstrap (v5.0.2): util/backdrop.js
2524
2551
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2525
2552
  * --------------------------------------------------------------------------
2526
2553
  */
@@ -2528,14 +2555,14 @@
2528
2555
  isVisible: true,
2529
2556
  // if false, we use the backdrop helper without adding any element to the dom
2530
2557
  isAnimated: false,
2531
- rootElement: document.body,
2558
+ rootElement: 'body',
2532
2559
  // give the choice to place backdrop under different elements
2533
2560
  clickCallback: null
2534
2561
  };
2535
2562
  const DefaultType$6 = {
2536
2563
  isVisible: 'boolean',
2537
2564
  isAnimated: 'boolean',
2538
- rootElement: 'element',
2565
+ rootElement: '(element|string)',
2539
2566
  clickCallback: '(function|null)'
2540
2567
  };
2541
2568
  const NAME$7 = 'backdrop';
@@ -2603,8 +2630,9 @@
2603
2630
  _getConfig(config) {
2604
2631
  config = { ...Default$6,
2605
2632
  ...(typeof config === 'object' ? config : {})
2606
- };
2607
- config.rootElement = config.rootElement || document.body;
2633
+ }; // use getElement() with the default "body" to get a fresh Element on each instantiation
2634
+
2635
+ config.rootElement = getElement(config.rootElement);
2608
2636
  typeCheckConfig(NAME$7, config, DefaultType$6);
2609
2637
  return config;
2610
2638
  }
@@ -2629,27 +2657,20 @@
2629
2657
 
2630
2658
  EventHandler.off(this._element, EVENT_MOUSEDOWN);
2631
2659
 
2632
- this._getElement().parentNode.removeChild(this._element);
2660
+ this._element.remove();
2633
2661
 
2634
2662
  this._isAppended = false;
2635
2663
  }
2636
2664
 
2637
2665
  _emulateAnimation(callback) {
2638
- if (!this._config.isAnimated) {
2639
- execute(callback);
2640
- return;
2641
- }
2642
-
2643
- const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
2644
- EventHandler.one(this._getElement(), 'transitionend', () => execute(callback));
2645
- emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
2666
+ executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
2646
2667
  }
2647
2668
 
2648
2669
  }
2649
2670
 
2650
2671
  /**
2651
2672
  * --------------------------------------------------------------------------
2652
- * Bootstrap (v5.0.1): modal.js
2673
+ * Bootstrap (v5.0.2): modal.js
2653
2674
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2654
2675
  * --------------------------------------------------------------------------
2655
2676
  */
@@ -2709,6 +2730,7 @@
2709
2730
  this._isShown = false;
2710
2731
  this._ignoreBackdropClick = false;
2711
2732
  this._isTransitioning = false;
2733
+ this._scrollBar = new ScrollBarHelper();
2712
2734
  } // Getters
2713
2735
 
2714
2736
 
@@ -2730,20 +2752,22 @@
2730
2752
  return;
2731
2753
  }
2732
2754
 
2733
- if (this._isAnimated()) {
2734
- this._isTransitioning = true;
2735
- }
2736
-
2737
2755
  const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
2738
2756
  relatedTarget
2739
2757
  });
2740
2758
 
2741
- if (this._isShown || showEvent.defaultPrevented) {
2759
+ if (showEvent.defaultPrevented) {
2742
2760
  return;
2743
2761
  }
2744
2762
 
2745
2763
  this._isShown = true;
2746
- hide();
2764
+
2765
+ if (this._isAnimated()) {
2766
+ this._isTransitioning = true;
2767
+ }
2768
+
2769
+ this._scrollBar.hide();
2770
+
2747
2771
  document.body.classList.add(CLASS_NAME_OPEN);
2748
2772
 
2749
2773
  this._adjustDialog();
@@ -2765,7 +2789,7 @@
2765
2789
  }
2766
2790
 
2767
2791
  hide(event) {
2768
- if (event) {
2792
+ if (event && ['A', 'AREA'].includes(event.target.tagName)) {
2769
2793
  event.preventDefault();
2770
2794
  }
2771
2795
 
@@ -2832,7 +2856,7 @@
2832
2856
  _getConfig(config) {
2833
2857
  config = { ...Default$5,
2834
2858
  ...Manipulator.getDataAttributes(this._element),
2835
- ...config
2859
+ ...(typeof config === 'object' ? config : {})
2836
2860
  };
2837
2861
  typeCheckConfig(NAME$6, config, DefaultType$5);
2838
2862
  return config;
@@ -2935,7 +2959,8 @@
2935
2959
 
2936
2960
  this._resetAdjustments();
2937
2961
 
2938
- reset();
2962
+ this._scrollBar.reset();
2963
+
2939
2964
  EventHandler.trigger(this._element, EVENT_HIDDEN$3);
2940
2965
  });
2941
2966
  }
@@ -2972,27 +2997,32 @@
2972
2997
  return;
2973
2998
  }
2974
2999
 
2975
- const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
3000
+ const {
3001
+ classList,
3002
+ scrollHeight,
3003
+ style
3004
+ } = this._element;
3005
+ const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed
3006
+
3007
+ if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
3008
+ return;
3009
+ }
2976
3010
 
2977
3011
  if (!isModalOverflowing) {
2978
- this._element.style.overflowY = 'hidden';
3012
+ style.overflowY = 'hidden';
2979
3013
  }
2980
3014
 
2981
- this._element.classList.add(CLASS_NAME_STATIC);
3015
+ classList.add(CLASS_NAME_STATIC);
2982
3016
 
2983
- const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
2984
- EventHandler.off(this._element, 'transitionend');
2985
- EventHandler.one(this._element, 'transitionend', () => {
2986
- this._element.classList.remove(CLASS_NAME_STATIC);
3017
+ this._queueCallback(() => {
3018
+ classList.remove(CLASS_NAME_STATIC);
2987
3019
 
2988
3020
  if (!isModalOverflowing) {
2989
- EventHandler.one(this._element, 'transitionend', () => {
2990
- this._element.style.overflowY = '';
2991
- });
2992
- emulateTransitionEnd(this._element, modalTransitionDuration);
3021
+ this._queueCallback(() => {
3022
+ style.overflowY = '';
3023
+ }, this._dialog);
2993
3024
  }
2994
- });
2995
- emulateTransitionEnd(this._element, modalTransitionDuration);
3025
+ }, this._dialog);
2996
3026
 
2997
3027
  this._element.focus();
2998
3028
  } // ----------------------------------------------------------------------
@@ -3002,7 +3032,9 @@
3002
3032
 
3003
3033
  _adjustDialog() {
3004
3034
  const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
3005
- const scrollbarWidth = getWidth();
3035
+
3036
+ const scrollbarWidth = this._scrollBar.getWidth();
3037
+
3006
3038
  const isBodyOverflowing = scrollbarWidth > 0;
3007
3039
 
3008
3040
  if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
@@ -3022,7 +3054,7 @@
3022
3054
 
3023
3055
  static jQueryInterface(config, relatedTarget) {
3024
3056
  return this.each(function () {
3025
- const data = Modal.getInstance(this) || new Modal(this, typeof config === 'object' ? config : {});
3057
+ const data = Modal.getOrCreateInstance(this, config);
3026
3058
 
3027
3059
  if (typeof config !== 'string') {
3028
3060
  return;
@@ -3063,7 +3095,7 @@
3063
3095
  }
3064
3096
  });
3065
3097
  });
3066
- const data = Modal.getInstance(target) || new Modal(target);
3098
+ const data = Modal.getOrCreateInstance(target);
3067
3099
  data.toggle(this);
3068
3100
  });
3069
3101
  /**
@@ -3077,7 +3109,7 @@
3077
3109
 
3078
3110
  /**
3079
3111
  * --------------------------------------------------------------------------
3080
- * Bootstrap (v5.0.1): offcanvas.js
3112
+ * Bootstrap (v5.0.2): offcanvas.js
3081
3113
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
3082
3114
  * --------------------------------------------------------------------------
3083
3115
  */
@@ -3164,7 +3196,7 @@
3164
3196
  this._backdrop.show();
3165
3197
 
3166
3198
  if (!this._config.scroll) {
3167
- hide();
3199
+ new ScrollBarHelper().hide();
3168
3200
 
3169
3201
  this._enforceFocusOnElement(this._element);
3170
3202
  }
@@ -3217,7 +3249,7 @@
3217
3249
  this._element.style.visibility = 'hidden';
3218
3250
 
3219
3251
  if (!this._config.scroll) {
3220
- reset();
3252
+ new ScrollBarHelper().reset();
3221
3253
  }
3222
3254
 
3223
3255
  EventHandler.trigger(this._element, EVENT_HIDDEN$2);
@@ -3275,7 +3307,7 @@
3275
3307
 
3276
3308
  static jQueryInterface(config) {
3277
3309
  return this.each(function () {
3278
- const data = Data.get(this, DATA_KEY$5) || new Offcanvas(this, typeof config === 'object' ? config : {});
3310
+ const data = Offcanvas.getOrCreateInstance(this, config);
3279
3311
 
3280
3312
  if (typeof config !== 'string') {
3281
3313
  return;
@@ -3321,12 +3353,10 @@
3321
3353
  Offcanvas.getInstance(allReadyOpen).hide();
3322
3354
  }
3323
3355
 
3324
- const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target);
3356
+ const data = Offcanvas.getOrCreateInstance(target);
3325
3357
  data.toggle(this);
3326
3358
  });
3327
- EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
3328
- SelectorEngine.find(OPEN_SELECTOR).forEach(el => (Data.get(el, DATA_KEY$5) || new Offcanvas(el)).show());
3329
- });
3359
+ EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
3330
3360
  /**
3331
3361
  * ------------------------------------------------------------------------
3332
3362
  * jQuery
@@ -3337,7 +3367,7 @@
3337
3367
 
3338
3368
  /**
3339
3369
  * --------------------------------------------------------------------------
3340
- * Bootstrap (v5.0.1): util/sanitizer.js
3370
+ * Bootstrap (v5.0.2): util/sanitizer.js
3341
3371
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3342
3372
  * --------------------------------------------------------------------------
3343
3373
  */
@@ -3432,7 +3462,7 @@
3432
3462
  const elName = el.nodeName.toLowerCase();
3433
3463
 
3434
3464
  if (!allowlistKeys.includes(elName)) {
3435
- el.parentNode.removeChild(el);
3465
+ el.remove();
3436
3466
  continue;
3437
3467
  }
3438
3468
 
@@ -3450,7 +3480,7 @@
3450
3480
 
3451
3481
  /**
3452
3482
  * --------------------------------------------------------------------------
3453
- * Bootstrap (v5.0.1): tooltip.js
3483
+ * Bootstrap (v5.0.2): tooltip.js
3454
3484
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3455
3485
  * --------------------------------------------------------------------------
3456
3486
  */
@@ -3619,8 +3649,8 @@
3619
3649
  clearTimeout(this._timeout);
3620
3650
  EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
3621
3651
 
3622
- if (this.tip && this.tip.parentNode) {
3623
- this.tip.parentNode.removeChild(this.tip);
3652
+ if (this.tip) {
3653
+ this.tip.remove();
3624
3654
  }
3625
3655
 
3626
3656
  if (this._popper) {
@@ -3725,8 +3755,8 @@
3725
3755
  return;
3726
3756
  }
3727
3757
 
3728
- if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
3729
- tip.parentNode.removeChild(tip);
3758
+ if (this._hoverState !== HOVER_STATE_SHOW) {
3759
+ tip.remove();
3730
3760
  }
3731
3761
 
3732
3762
  this._cleanTipClass();
@@ -4113,17 +4143,7 @@
4113
4143
 
4114
4144
  static jQueryInterface(config) {
4115
4145
  return this.each(function () {
4116
- let data = Data.get(this, DATA_KEY$4);
4117
-
4118
- const _config = typeof config === 'object' && config;
4119
-
4120
- if (!data && /dispose|hide/.test(config)) {
4121
- return;
4122
- }
4123
-
4124
- if (!data) {
4125
- data = new Tooltip(this, _config);
4126
- }
4146
+ const data = Tooltip.getOrCreateInstance(this, config);
4127
4147
 
4128
4148
  if (typeof config === 'string') {
4129
4149
  if (typeof data[config] === 'undefined') {
@@ -4148,7 +4168,7 @@
4148
4168
 
4149
4169
  /**
4150
4170
  * --------------------------------------------------------------------------
4151
- * Bootstrap (v5.0.1): popover.js
4171
+ * Bootstrap (v5.0.2): popover.js
4152
4172
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4153
4173
  * --------------------------------------------------------------------------
4154
4174
  */
@@ -4218,6 +4238,24 @@
4218
4238
  return this.getTitle() || this._getContent();
4219
4239
  }
4220
4240
 
4241
+ getTipElement() {
4242
+ if (this.tip) {
4243
+ return this.tip;
4244
+ }
4245
+
4246
+ this.tip = super.getTipElement();
4247
+
4248
+ if (!this.getTitle()) {
4249
+ SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
4250
+ }
4251
+
4252
+ if (!this._getContent()) {
4253
+ SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
4254
+ }
4255
+
4256
+ return this.tip;
4257
+ }
4258
+
4221
4259
  setContent() {
4222
4260
  const tip = this.getTipElement(); // we use append for html objects to maintain js events
4223
4261
 
@@ -4254,18 +4292,7 @@
4254
4292
 
4255
4293
  static jQueryInterface(config) {
4256
4294
  return this.each(function () {
4257
- let data = Data.get(this, DATA_KEY$3);
4258
-
4259
- const _config = typeof config === 'object' ? config : null;
4260
-
4261
- if (!data && /dispose|hide/.test(config)) {
4262
- return;
4263
- }
4264
-
4265
- if (!data) {
4266
- data = new Popover(this, _config);
4267
- Data.set(this, DATA_KEY$3, data);
4268
- }
4295
+ const data = Popover.getOrCreateInstance(this, config);
4269
4296
 
4270
4297
  if (typeof config === 'string') {
4271
4298
  if (typeof data[config] === 'undefined') {
@@ -4290,7 +4317,7 @@
4290
4317
 
4291
4318
  /**
4292
4319
  * --------------------------------------------------------------------------
4293
- * Bootstrap (v5.0.1): scrollspy.js
4320
+ * Bootstrap (v5.0.2): scrollspy.js
4294
4321
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4295
4322
  * --------------------------------------------------------------------------
4296
4323
  */
@@ -4505,7 +4532,7 @@
4505
4532
 
4506
4533
  static jQueryInterface(config) {
4507
4534
  return this.each(function () {
4508
- const data = ScrollSpy.getInstance(this) || new ScrollSpy(this, typeof config === 'object' ? config : {});
4535
+ const data = ScrollSpy.getOrCreateInstance(this, config);
4509
4536
 
4510
4537
  if (typeof config !== 'string') {
4511
4538
  return;
@@ -4541,7 +4568,7 @@
4541
4568
 
4542
4569
  /**
4543
4570
  * --------------------------------------------------------------------------
4544
- * Bootstrap (v5.0.1): tab.js
4571
+ * Bootstrap (v5.0.2): tab.js
4545
4572
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4546
4573
  * --------------------------------------------------------------------------
4547
4574
  */
@@ -4696,7 +4723,7 @@
4696
4723
 
4697
4724
  static jQueryInterface(config) {
4698
4725
  return this.each(function () {
4699
- const data = Data.get(this, DATA_KEY$1) || new Tab(this);
4726
+ const data = Tab.getOrCreateInstance(this);
4700
4727
 
4701
4728
  if (typeof config === 'string') {
4702
4729
  if (typeof data[config] === 'undefined') {
@@ -4725,7 +4752,7 @@
4725
4752
  return;
4726
4753
  }
4727
4754
 
4728
- const data = Data.get(this, DATA_KEY$1) || new Tab(this);
4755
+ const data = Tab.getOrCreateInstance(this);
4729
4756
  data.show();
4730
4757
  });
4731
4758
  /**
@@ -4739,7 +4766,7 @@
4739
4766
 
4740
4767
  /**
4741
4768
  * --------------------------------------------------------------------------
4742
- * Bootstrap (v5.0.1): toast.js
4769
+ * Bootstrap (v5.0.2): toast.js
4743
4770
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4744
4771
  * --------------------------------------------------------------------------
4745
4772
  */
@@ -4939,13 +4966,7 @@
4939
4966
 
4940
4967
  static jQueryInterface(config) {
4941
4968
  return this.each(function () {
4942
- let data = Data.get(this, DATA_KEY);
4943
-
4944
- const _config = typeof config === 'object' && config;
4945
-
4946
- if (!data) {
4947
- data = new Toast(this, _config);
4948
- }
4969
+ const data = Toast.getOrCreateInstance(this, config);
4949
4970
 
4950
4971
  if (typeof config === 'string') {
4951
4972
  if (typeof data[config] === 'undefined') {
@@ -4970,7 +4991,7 @@
4970
4991
 
4971
4992
  /**
4972
4993
  * --------------------------------------------------------------------------
4973
- * Bootstrap (v5.0.1): index.umd.js
4994
+ * Bootstrap (v5.0.2): index.umd.js
4974
4995
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4975
4996
  * --------------------------------------------------------------------------
4976
4997
  */