bootstrap 5.0.0 → 5.1.1

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/assets/javascripts/bootstrap/alert.js +77 -106
  4. data/assets/javascripts/bootstrap/base-component.js +126 -7
  5. data/assets/javascripts/bootstrap/button.js +24 -24
  6. data/assets/javascripts/bootstrap/carousel.js +115 -128
  7. data/assets/javascripts/bootstrap/collapse.js +119 -176
  8. data/assets/javascripts/bootstrap/dom/data.js +2 -2
  9. data/assets/javascripts/bootstrap/dom/event-handler.js +3 -4
  10. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -4
  11. data/assets/javascripts/bootstrap/dom/selector-engine.js +47 -5
  12. data/assets/javascripts/bootstrap/dropdown.js +142 -130
  13. data/assets/javascripts/bootstrap/modal.js +376 -171
  14. data/assets/javascripts/bootstrap/offcanvas.js +328 -133
  15. data/assets/javascripts/bootstrap/popover.js +27 -59
  16. data/assets/javascripts/bootstrap/scrollspy.js +51 -56
  17. data/assets/javascripts/bootstrap/tab.js +39 -66
  18. data/assets/javascripts/bootstrap/toast.js +175 -86
  19. data/assets/javascripts/bootstrap/tooltip.js +141 -185
  20. data/assets/javascripts/bootstrap-sprockets.js +6 -6
  21. data/assets/javascripts/bootstrap.js +1031 -1026
  22. data/assets/javascripts/bootstrap.min.js +2 -2
  23. data/assets/stylesheets/_bootstrap-grid.scss +3 -1
  24. data/assets/stylesheets/_bootstrap-reboot.scss +2 -4
  25. data/assets/stylesheets/_bootstrap.scss +2 -1
  26. data/assets/stylesheets/bootstrap/_card.scss +7 -6
  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 +100 -3
  30. data/assets/stylesheets/bootstrap/_grid.scss +11 -0
  31. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  32. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  33. data/assets/stylesheets/bootstrap/_list-group.scss +5 -5
  34. data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
  35. data/assets/stylesheets/bootstrap/_modal.scss +7 -26
  36. data/assets/stylesheets/bootstrap/_navbar.scss +30 -1
  37. data/assets/stylesheets/bootstrap/_offcanvas.scss +8 -2
  38. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  39. data/assets/stylesheets/bootstrap/_popover.scss +10 -10
  40. data/assets/stylesheets/bootstrap/_reboot.scss +12 -8
  41. data/assets/stylesheets/bootstrap/_root.scss +40 -2
  42. data/assets/stylesheets/bootstrap/_tables.scss +1 -0
  43. data/assets/stylesheets/bootstrap/_toasts.scss +3 -3
  44. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
  45. data/assets/stylesheets/bootstrap/_transitions.scss +6 -0
  46. data/assets/stylesheets/bootstrap/_utilities.scss +44 -8
  47. data/assets/stylesheets/bootstrap/_variables.scss +200 -25
  48. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
  49. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
  50. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
  51. data/assets/stylesheets/bootstrap/forms/_form-control.scss +6 -6
  52. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  53. data/assets/stylesheets/bootstrap/forms/_form-select.scss +3 -0
  54. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  55. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  56. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  57. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +1 -1
  58. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -1
  59. data/assets/stylesheets/bootstrap/mixins/_grid.scss +33 -8
  60. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +27 -6
  61. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
  62. data/bootstrap.gemspec +3 -3
  63. data/lib/bootstrap/version.rb +2 -2
  64. data/tasks/updater/js.rb +6 -2
  65. metadata +12 -8
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap tooltip.js v5.0.0 (https://getbootstrap.com/)
2
+ * Bootstrap tooltip.js v5.1.1 (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
  */
@@ -40,13 +40,11 @@
40
40
 
41
41
  /**
42
42
  * --------------------------------------------------------------------------
43
- * Bootstrap (v5.0.0): util/index.js
43
+ * Bootstrap (v5.1.1): util/index.js
44
44
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
45
45
  * --------------------------------------------------------------------------
46
46
  */
47
47
  const MAX_UID = 1000000;
48
- const MILLISECONDS_MULTIPLIER = 1000;
49
- const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
50
48
 
51
49
  const toType = obj => {
52
50
  if (obj === null || obj === undefined) {
@@ -70,51 +68,29 @@
70
68
  return prefix;
71
69
  };
72
70
 
73
- const getTransitionDurationFromElement = element => {
74
- if (!element) {
75
- return 0;
76
- } // Get transition-duration of the element
77
-
78
-
79
- let {
80
- transitionDuration,
81
- transitionDelay
82
- } = window.getComputedStyle(element);
83
- const floatTransitionDuration = Number.parseFloat(transitionDuration);
84
- const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
85
-
86
- if (!floatTransitionDuration && !floatTransitionDelay) {
87
- return 0;
88
- } // If multiple durations are defined, take the first
89
-
71
+ const isElement = obj => {
72
+ if (!obj || typeof obj !== 'object') {
73
+ return false;
74
+ }
90
75
 
91
- transitionDuration = transitionDuration.split(',')[0];
92
- transitionDelay = transitionDelay.split(',')[0];
93
- return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
94
- };
76
+ if (typeof obj.jquery !== 'undefined') {
77
+ obj = obj[0];
78
+ }
95
79
 
96
- const triggerTransitionEnd = element => {
97
- element.dispatchEvent(new Event(TRANSITION_END));
80
+ return typeof obj.nodeType !== 'undefined';
98
81
  };
99
82
 
100
- const isElement = obj => (obj[0] || obj).nodeType;
101
-
102
- const emulateTransitionEnd = (element, duration) => {
103
- let called = false;
104
- const durationPadding = 5;
105
- const emulatedDuration = duration + durationPadding;
83
+ const getElement = obj => {
84
+ if (isElement(obj)) {
85
+ // it's a jQuery object or a node element
86
+ return obj.jquery ? obj[0] : obj;
87
+ }
106
88
 
107
- function listener() {
108
- called = true;
109
- element.removeEventListener(TRANSITION_END, listener);
89
+ if (typeof obj === 'string' && obj.length > 0) {
90
+ return document.querySelector(obj);
110
91
  }
111
92
 
112
- element.addEventListener(TRANSITION_END, listener);
113
- setTimeout(() => {
114
- if (!called) {
115
- triggerTransitionEnd(element);
116
- }
117
- }, emulatedDuration);
93
+ return null;
118
94
  };
119
95
 
120
96
  const typeCheckConfig = (componentName, config, configTypes) => {
@@ -166,9 +142,18 @@
166
142
  return null;
167
143
  };
168
144
 
145
+ const DOMContentLoadedCallbacks = [];
146
+
169
147
  const onDOMContentLoaded = callback => {
170
148
  if (document.readyState === 'loading') {
171
- document.addEventListener('DOMContentLoaded', callback);
149
+ // add listener on the first call when the document is in loading state
150
+ if (!DOMContentLoadedCallbacks.length) {
151
+ document.addEventListener('DOMContentLoaded', () => {
152
+ DOMContentLoadedCallbacks.forEach(callback => callback());
153
+ });
154
+ }
155
+
156
+ DOMContentLoadedCallbacks.push(callback);
172
157
  } else {
173
158
  callback();
174
159
  }
@@ -176,12 +161,13 @@
176
161
 
177
162
  const isRTL = () => document.documentElement.dir === 'rtl';
178
163
 
179
- const defineJQueryPlugin = (name, plugin) => {
164
+ const defineJQueryPlugin = plugin => {
180
165
  onDOMContentLoaded(() => {
181
166
  const $ = getjQuery();
182
167
  /* istanbul ignore if */
183
168
 
184
169
  if ($) {
170
+ const name = plugin.NAME;
185
171
  const JQUERY_NO_CONFLICT = $.fn[name];
186
172
  $.fn[name] = plugin.jQueryInterface;
187
173
  $.fn[name].Constructor = plugin;
@@ -196,7 +182,7 @@
196
182
 
197
183
  /**
198
184
  * --------------------------------------------------------------------------
199
- * Bootstrap (v5.0.0): util/sanitizer.js
185
+ * Bootstrap (v5.1.1): util/sanitizer.js
200
186
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
201
187
  * --------------------------------------------------------------------------
202
188
  */
@@ -291,7 +277,7 @@
291
277
  const elName = el.nodeName.toLowerCase();
292
278
 
293
279
  if (!allowlistKeys.includes(elName)) {
294
- el.parentNode.removeChild(el);
280
+ el.remove();
295
281
  continue;
296
282
  }
297
283
 
@@ -309,7 +295,7 @@
309
295
 
310
296
  /**
311
297
  * --------------------------------------------------------------------------
312
- * Bootstrap (v5.0.0): tooltip.js
298
+ * Bootstrap (v5.1.1): tooltip.js
313
299
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
314
300
  * --------------------------------------------------------------------------
315
301
  */
@@ -323,7 +309,6 @@
323
309
  const DATA_KEY = 'bs.tooltip';
324
310
  const EVENT_KEY = `.${DATA_KEY}`;
325
311
  const CLASS_PREFIX = 'bs-tooltip';
326
- const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
327
312
  const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
328
313
  const DefaultType = {
329
314
  animation: 'boolean',
@@ -370,7 +355,7 @@
370
355
  allowList: DefaultAllowlist,
371
356
  popperConfig: null
372
357
  };
373
- const Event$1 = {
358
+ const Event = {
374
359
  HIDE: `hide${EVENT_KEY}`,
375
360
  HIDDEN: `hidden${EVENT_KEY}`,
376
361
  SHOW: `show${EVENT_KEY}`,
@@ -388,6 +373,8 @@
388
373
  const HOVER_STATE_SHOW = 'show';
389
374
  const HOVER_STATE_OUT = 'out';
390
375
  const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
376
+ const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
377
+ const EVENT_MODAL_HIDE = 'hide.bs.modal';
391
378
  const TRIGGER_HOVER = 'hover';
392
379
  const TRIGGER_FOCUS = 'focus';
393
380
  const TRIGGER_CLICK = 'click';
@@ -412,7 +399,7 @@
412
399
  this._activeTrigger = {};
413
400
  this._popper = null; // Protected
414
401
 
415
- this.config = this._getConfig(config);
402
+ this._config = this._getConfig(config);
416
403
  this.tip = null;
417
404
 
418
405
  this._setListeners();
@@ -427,16 +414,8 @@
427
414
  return NAME;
428
415
  }
429
416
 
430
- static get DATA_KEY() {
431
- return DATA_KEY;
432
- }
433
-
434
417
  static get Event() {
435
- return Event$1;
436
- }
437
-
438
- static get EVENT_KEY() {
439
- return EVENT_KEY;
418
+ return Event;
440
419
  }
441
420
 
442
421
  static get DefaultType() {
@@ -484,24 +463,14 @@
484
463
 
485
464
  dispose() {
486
465
  clearTimeout(this._timeout);
487
- EventHandler__default['default'].off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
466
+ EventHandler__default['default'].off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
488
467
 
489
- if (this.tip && this.tip.parentNode) {
490
- this.tip.parentNode.removeChild(this.tip);
468
+ if (this.tip) {
469
+ this.tip.remove();
491
470
  }
492
471
 
493
- this._isEnabled = null;
494
- this._timeout = null;
495
- this._hoverState = null;
496
- this._activeTrigger = null;
472
+ this._disposePopper();
497
473
 
498
- if (this._popper) {
499
- this._popper.destroy();
500
- }
501
-
502
- this._popper = null;
503
- this.config = null;
504
- this.tip = null;
505
474
  super.dispose();
506
475
  }
507
476
 
@@ -520,6 +489,15 @@
520
489
 
521
490
  if (showEvent.defaultPrevented || !isInTheDom) {
522
491
  return;
492
+ } // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title`
493
+ // This will be removed later in favor of a `setContent` method
494
+
495
+
496
+ if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
497
+ this._disposePopper();
498
+
499
+ this.tip.remove();
500
+ this.tip = null;
523
501
  }
524
502
 
525
503
  const tip = this.getTipElement();
@@ -528,24 +506,23 @@
528
506
 
529
507
  this._element.setAttribute('aria-describedby', tipId);
530
508
 
531
- this.setContent();
532
-
533
- if (this.config.animation) {
509
+ if (this._config.animation) {
534
510
  tip.classList.add(CLASS_NAME_FADE);
535
511
  }
536
512
 
537
- const placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
513
+ const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
538
514
 
539
515
  const attachment = this._getAttachment(placement);
540
516
 
541
517
  this._addAttachmentClass(attachment);
542
518
 
543
- const container = this._getContainer();
544
-
519
+ const {
520
+ container
521
+ } = this._config;
545
522
  Data__default['default'].set(tip, this.constructor.DATA_KEY, this);
546
523
 
547
524
  if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
548
- container.appendChild(tip);
525
+ container.append(tip);
549
526
  EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
550
527
  }
551
528
 
@@ -556,7 +533,8 @@
556
533
  }
557
534
 
558
535
  tip.classList.add(CLASS_NAME_SHOW);
559
- const customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
536
+
537
+ const customClass = this._resolvePossibleFunction(this._config.customClass);
560
538
 
561
539
  if (customClass) {
562
540
  tip.classList.add(...customClass.split(' '));
@@ -582,13 +560,9 @@
582
560
  }
583
561
  };
584
562
 
585
- if (this.tip.classList.contains(CLASS_NAME_FADE)) {
586
- const transitionDuration = getTransitionDurationFromElement(this.tip);
587
- EventHandler__default['default'].one(this.tip, 'transitionend', complete);
588
- emulateTransitionEnd(this.tip, transitionDuration);
589
- } else {
590
- complete();
591
- }
563
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
564
+
565
+ this._queueCallback(complete, this.tip, isAnimated);
592
566
  }
593
567
 
594
568
  hide() {
@@ -603,8 +577,8 @@
603
577
  return;
604
578
  }
605
579
 
606
- if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
607
- tip.parentNode.removeChild(tip);
580
+ if (this._hoverState !== HOVER_STATE_SHOW) {
581
+ tip.remove();
608
582
  }
609
583
 
610
584
  this._cleanTipClass();
@@ -613,11 +587,7 @@
613
587
 
614
588
  EventHandler__default['default'].trigger(this._element, this.constructor.Event.HIDDEN);
615
589
 
616
- if (this._popper) {
617
- this._popper.destroy();
618
-
619
- this._popper = null;
620
- }
590
+ this._disposePopper();
621
591
  };
622
592
 
623
593
  const hideEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.HIDE);
@@ -636,14 +606,9 @@
636
606
  this._activeTrigger[TRIGGER_CLICK] = false;
637
607
  this._activeTrigger[TRIGGER_FOCUS] = false;
638
608
  this._activeTrigger[TRIGGER_HOVER] = false;
609
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
639
610
 
640
- if (this.tip.classList.contains(CLASS_NAME_FADE)) {
641
- const transitionDuration = getTransitionDurationFromElement(tip);
642
- EventHandler__default['default'].one(tip, 'transitionend', complete);
643
- emulateTransitionEnd(tip, transitionDuration);
644
- } else {
645
- complete();
646
- }
611
+ this._queueCallback(complete, this.tip, isAnimated);
647
612
 
648
613
  this._hoverState = '';
649
614
  }
@@ -665,15 +630,28 @@
665
630
  }
666
631
 
667
632
  const element = document.createElement('div');
668
- element.innerHTML = this.config.template;
669
- this.tip = element.children[0];
633
+ element.innerHTML = this._config.template;
634
+ const tip = element.children[0];
635
+ this.setContent(tip);
636
+ tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
637
+ this.tip = tip;
670
638
  return this.tip;
671
639
  }
672
640
 
673
- setContent() {
674
- const tip = this.getTipElement();
675
- this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
676
- tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
641
+ setContent(tip) {
642
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
643
+ }
644
+
645
+ _sanitizeAndSetContent(template, content, selector) {
646
+ const templateElement = SelectorEngine__default['default'].findOne(selector, template);
647
+
648
+ if (!content && templateElement) {
649
+ templateElement.remove();
650
+ return;
651
+ } // we use append for html objects to maintain js events
652
+
653
+
654
+ this.setElementContent(templateElement, content);
677
655
  }
678
656
 
679
657
  setElementContent(element, content) {
@@ -681,16 +659,13 @@
681
659
  return;
682
660
  }
683
661
 
684
- if (typeof content === 'object' && isElement(content)) {
685
- if (content.jquery) {
686
- content = content[0];
687
- } // content is a DOM node or a jQuery
688
-
662
+ if (isElement(content)) {
663
+ content = getElement(content); // content is a DOM node or a jQuery
689
664
 
690
- if (this.config.html) {
665
+ if (this._config.html) {
691
666
  if (content.parentNode !== element) {
692
667
  element.innerHTML = '';
693
- element.appendChild(content);
668
+ element.append(content);
694
669
  }
695
670
  } else {
696
671
  element.textContent = content.textContent;
@@ -699,9 +674,9 @@
699
674
  return;
700
675
  }
701
676
 
702
- if (this.config.html) {
703
- if (this.config.sanitize) {
704
- content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
677
+ if (this._config.html) {
678
+ if (this._config.sanitize) {
679
+ content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
705
680
  }
706
681
 
707
682
  element.innerHTML = content;
@@ -711,13 +686,9 @@
711
686
  }
712
687
 
713
688
  getTitle() {
714
- let title = this._element.getAttribute('data-bs-original-title');
689
+ const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
715
690
 
716
- if (!title) {
717
- title = typeof this.config.title === 'function' ? this.config.title.call(this._element) : this.config.title;
718
- }
719
-
720
- return title;
691
+ return this._resolvePossibleFunction(title);
721
692
  }
722
693
 
723
694
  updateAttachment(attachment) {
@@ -734,21 +705,13 @@
734
705
 
735
706
 
736
707
  _initializeOnDelegatedTarget(event, context) {
737
- const dataKey = this.constructor.DATA_KEY;
738
- context = context || Data__default['default'].get(event.delegateTarget, dataKey);
739
-
740
- if (!context) {
741
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
742
- Data__default['default'].set(event.delegateTarget, dataKey, context);
743
- }
744
-
745
- return context;
708
+ return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
746
709
  }
747
710
 
748
711
  _getOffset() {
749
712
  const {
750
713
  offset
751
- } = this.config;
714
+ } = this._config;
752
715
 
753
716
  if (typeof offset === 'string') {
754
717
  return offset.split(',').map(val => Number.parseInt(val, 10));
@@ -761,13 +724,17 @@
761
724
  return offset;
762
725
  }
763
726
 
727
+ _resolvePossibleFunction(content) {
728
+ return typeof content === 'function' ? content.call(this._element) : content;
729
+ }
730
+
764
731
  _getPopperConfig(attachment) {
765
732
  const defaultBsPopperConfig = {
766
733
  placement: attachment,
767
734
  modifiers: [{
768
735
  name: 'flip',
769
736
  options: {
770
- fallbackPlacements: this.config.fallbackPlacements
737
+ fallbackPlacements: this._config.fallbackPlacements
771
738
  }
772
739
  }, {
773
740
  name: 'offset',
@@ -777,7 +744,7 @@
777
744
  }, {
778
745
  name: 'preventOverflow',
779
746
  options: {
780
- boundary: this.config.boundary
747
+ boundary: this._config.boundary
781
748
  }
782
749
  }, {
783
750
  name: 'arrow',
@@ -797,24 +764,12 @@
797
764
  }
798
765
  };
799
766
  return { ...defaultBsPopperConfig,
800
- ...(typeof this.config.popperConfig === 'function' ? this.config.popperConfig(defaultBsPopperConfig) : this.config.popperConfig)
767
+ ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
801
768
  };
802
769
  }
803
770
 
804
771
  _addAttachmentClass(attachment) {
805
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
806
- }
807
-
808
- _getContainer() {
809
- if (this.config.container === false) {
810
- return document.body;
811
- }
812
-
813
- if (isElement(this.config.container)) {
814
- return this.config.container;
815
- }
816
-
817
- return SelectorEngine__default['default'].findOne(this.config.container);
772
+ this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
818
773
  }
819
774
 
820
775
  _getAttachment(placement) {
@@ -822,15 +777,16 @@
822
777
  }
823
778
 
824
779
  _setListeners() {
825
- const triggers = this.config.trigger.split(' ');
780
+ const triggers = this._config.trigger.split(' ');
781
+
826
782
  triggers.forEach(trigger => {
827
783
  if (trigger === 'click') {
828
- EventHandler__default['default'].on(this._element, this.constructor.Event.CLICK, this.config.selector, event => this.toggle(event));
784
+ EventHandler__default['default'].on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
829
785
  } else if (trigger !== TRIGGER_MANUAL) {
830
786
  const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
831
787
  const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
832
- EventHandler__default['default'].on(this._element, eventIn, this.config.selector, event => this._enter(event));
833
- EventHandler__default['default'].on(this._element, eventOut, this.config.selector, event => this._leave(event));
788
+ EventHandler__default['default'].on(this._element, eventIn, this._config.selector, event => this._enter(event));
789
+ EventHandler__default['default'].on(this._element, eventOut, this._config.selector, event => this._leave(event));
834
790
  }
835
791
  });
836
792
 
@@ -840,10 +796,10 @@
840
796
  }
841
797
  };
842
798
 
843
- EventHandler__default['default'].on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
799
+ EventHandler__default['default'].on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
844
800
 
845
- if (this.config.selector) {
846
- this.config = { ...this.config,
801
+ if (this._config.selector) {
802
+ this._config = { ...this._config,
847
803
  trigger: 'manual',
848
804
  selector: ''
849
805
  };
@@ -883,7 +839,7 @@
883
839
  clearTimeout(context._timeout);
884
840
  context._hoverState = HOVER_STATE_SHOW;
885
841
 
886
- if (!context.config.delay || !context.config.delay.show) {
842
+ if (!context._config.delay || !context._config.delay.show) {
887
843
  context.show();
888
844
  return;
889
845
  }
@@ -892,7 +848,7 @@
892
848
  if (context._hoverState === HOVER_STATE_SHOW) {
893
849
  context.show();
894
850
  }
895
- }, context.config.delay.show);
851
+ }, context._config.delay.show);
896
852
  }
897
853
 
898
854
  _leave(event, context) {
@@ -909,7 +865,7 @@
909
865
  clearTimeout(context._timeout);
910
866
  context._hoverState = HOVER_STATE_OUT;
911
867
 
912
- if (!context.config.delay || !context.config.delay.hide) {
868
+ if (!context._config.delay || !context._config.delay.hide) {
913
869
  context.hide();
914
870
  return;
915
871
  }
@@ -918,7 +874,7 @@
918
874
  if (context._hoverState === HOVER_STATE_OUT) {
919
875
  context.hide();
920
876
  }
921
- }, context.config.delay.hide);
877
+ }, context._config.delay.hide);
922
878
  }
923
879
 
924
880
  _isWithActiveTrigger() {
@@ -938,15 +894,11 @@
938
894
  delete dataAttributes[dataAttr];
939
895
  }
940
896
  });
941
-
942
- if (config && typeof config.container === 'object' && config.container.jquery) {
943
- config.container = config.container[0];
944
- }
945
-
946
897
  config = { ...this.constructor.Default,
947
898
  ...dataAttributes,
948
899
  ...(typeof config === 'object' && config ? config : {})
949
900
  };
901
+ config.container = config.container === false ? document.body : getElement(config.container);
950
902
 
951
903
  if (typeof config.delay === 'number') {
952
904
  config.delay = {
@@ -975,26 +927,32 @@
975
927
  _getDelegateConfig() {
976
928
  const config = {};
977
929
 
978
- if (this.config) {
979
- for (const key in this.config) {
980
- if (this.constructor.Default[key] !== this.config[key]) {
981
- config[key] = this.config[key];
982
- }
930
+ for (const key in this._config) {
931
+ if (this.constructor.Default[key] !== this._config[key]) {
932
+ config[key] = this._config[key];
983
933
  }
984
- }
934
+ } // In the future can be replaced with:
935
+ // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
936
+ // `Object.fromEntries(keysWithDifferentValues)`
937
+
985
938
 
986
939
  return config;
987
940
  }
988
941
 
989
942
  _cleanTipClass() {
990
943
  const tip = this.getTipElement();
991
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
944
+ const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
945
+ const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
992
946
 
993
947
  if (tabClass !== null && tabClass.length > 0) {
994
948
  tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
995
949
  }
996
950
  }
997
951
 
952
+ _getBasicClassPrefix() {
953
+ return CLASS_PREFIX;
954
+ }
955
+
998
956
  _handlePopperPlacementChange(popperData) {
999
957
  const {
1000
958
  state
@@ -1009,22 +967,20 @@
1009
967
  this._cleanTipClass();
1010
968
 
1011
969
  this._addAttachmentClass(this._getAttachment(state.placement));
970
+ }
971
+
972
+ _disposePopper() {
973
+ if (this._popper) {
974
+ this._popper.destroy();
975
+
976
+ this._popper = null;
977
+ }
1012
978
  } // Static
1013
979
 
1014
980
 
1015
981
  static jQueryInterface(config) {
1016
982
  return this.each(function () {
1017
- let data = Data__default['default'].get(this, DATA_KEY);
1018
-
1019
- const _config = typeof config === 'object' && config;
1020
-
1021
- if (!data && /dispose|hide/.test(config)) {
1022
- return;
1023
- }
1024
-
1025
- if (!data) {
1026
- data = new Tooltip(this, _config);
1027
- }
983
+ const data = Tooltip.getOrCreateInstance(this, config);
1028
984
 
1029
985
  if (typeof config === 'string') {
1030
986
  if (typeof data[config] === 'undefined') {
@@ -1045,7 +1001,7 @@
1045
1001
  */
1046
1002
 
1047
1003
 
1048
- defineJQueryPlugin(NAME, Tooltip);
1004
+ defineJQueryPlugin(Tooltip);
1049
1005
 
1050
1006
  return Tooltip;
1051
1007
 
@@ -2,18 +2,18 @@
2
2
  //= require ./bootstrap/dom/data
3
3
  //= require ./bootstrap/dom/event-handler
4
4
  //= require ./bootstrap/base-component
5
- //= require ./bootstrap/alert
6
- //= require ./bootstrap/button
7
5
  //= require ./bootstrap/dom/manipulator
8
6
  //= require ./bootstrap/dom/selector-engine
7
+ //= require ./bootstrap/scrollspy
9
8
  //= require ./bootstrap/carousel
10
- //= require ./bootstrap/collapse
11
- //= require ./bootstrap/dropdown
9
+ //= require ./bootstrap/alert
12
10
  //= require ./bootstrap/modal
13
- //= require ./bootstrap/offcanvas
14
11
  //= require ./bootstrap/tooltip
15
12
  //= require ./bootstrap/popover
16
- //= require ./bootstrap/scrollspy
13
+ //= require ./bootstrap/button
14
+ //= require ./bootstrap/collapse
17
15
  //= require ./bootstrap/tab
16
+ //= require ./bootstrap/offcanvas
17
+ //= require ./bootstrap/dropdown
18
18
  //= require ./bootstrap/toast
19
19
  //= require ./bootstrap-global-this-undefine