bootstrap 5.2.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +55 -0
  3. data/README.md +25 -5
  4. data/assets/javascripts/bootstrap/alert.js +22 -32
  5. data/assets/javascripts/bootstrap/base-component.js +22 -38
  6. data/assets/javascripts/bootstrap/button.js +19 -22
  7. data/assets/javascripts/bootstrap/carousel.js +52 -135
  8. data/assets/javascripts/bootstrap/collapse.js +40 -102
  9. data/assets/javascripts/bootstrap/dom/data.js +8 -12
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +19 -66
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -17
  12. data/assets/javascripts/bootstrap/dom/selector-engine.js +42 -24
  13. data/assets/javascripts/bootstrap/dropdown.js +74 -143
  14. data/assets/javascripts/bootstrap/modal.js +66 -143
  15. data/assets/javascripts/bootstrap/offcanvas.js +50 -102
  16. data/assets/javascripts/bootstrap/popover.js +23 -29
  17. data/assets/javascripts/bootstrap/scrollspy.js +64 -97
  18. data/assets/javascripts/bootstrap/tab.js +55 -112
  19. data/assets/javascripts/bootstrap/toast.js +39 -77
  20. data/assets/javascripts/bootstrap/tooltip.js +99 -216
  21. data/assets/javascripts/bootstrap/util/backdrop.js +28 -54
  22. data/assets/javascripts/bootstrap/util/component-functions.js +13 -18
  23. data/assets/javascripts/bootstrap/util/config.js +15 -27
  24. data/assets/javascripts/bootstrap/util/focustrap.js +20 -36
  25. data/assets/javascripts/bootstrap/util/index.js +42 -111
  26. data/assets/javascripts/bootstrap/util/sanitizer.js +30 -42
  27. data/assets/javascripts/bootstrap/util/scrollbar.js +24 -50
  28. data/assets/javascripts/bootstrap/util/swipe.js +27 -48
  29. data/assets/javascripts/bootstrap/util/template-factory.js +25 -52
  30. data/assets/javascripts/bootstrap-sprockets.js +12 -12
  31. data/assets/javascripts/bootstrap.js +764 -1529
  32. data/assets/javascripts/bootstrap.min.js +3 -3
  33. data/assets/stylesheets/_bootstrap-grid.scss +1 -3
  34. data/assets/stylesheets/_bootstrap-reboot.scss +1 -0
  35. data/assets/stylesheets/_bootstrap.scss +1 -0
  36. data/assets/stylesheets/bootstrap/_accordion.scss +16 -4
  37. data/assets/stylesheets/bootstrap/_alert.scss +8 -11
  38. data/assets/stylesheets/bootstrap/_button-group.scss +3 -3
  39. data/assets/stylesheets/bootstrap/_buttons.scss +31 -10
  40. data/assets/stylesheets/bootstrap/_card.scss +5 -0
  41. data/assets/stylesheets/bootstrap/_carousel.scss +20 -5
  42. data/assets/stylesheets/bootstrap/_close.scss +32 -9
  43. data/assets/stylesheets/bootstrap/_dropdown.scss +3 -1
  44. data/assets/stylesheets/bootstrap/_functions.scss +3 -3
  45. data/assets/stylesheets/bootstrap/_grid.scss +6 -0
  46. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  47. data/assets/stylesheets/bootstrap/_list-group.scss +18 -12
  48. data/assets/stylesheets/bootstrap/_maps.scss +120 -0
  49. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  50. data/assets/stylesheets/bootstrap/_modal.scss +1 -1
  51. data/assets/stylesheets/bootstrap/_nav.scss +42 -5
  52. data/assets/stylesheets/bootstrap/_navbar.scss +17 -4
  53. data/assets/stylesheets/bootstrap/_offcanvas.scss +9 -6
  54. data/assets/stylesheets/bootstrap/_pagination.scss +1 -1
  55. data/assets/stylesheets/bootstrap/_popover.scss +5 -5
  56. data/assets/stylesheets/bootstrap/_progress.scss +10 -1
  57. data/assets/stylesheets/bootstrap/_reboot.scss +3 -3
  58. data/assets/stylesheets/bootstrap/_root.scss +121 -10
  59. data/assets/stylesheets/bootstrap/_tables.scss +18 -11
  60. data/assets/stylesheets/bootstrap/_toasts.scss +5 -2
  61. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -5
  62. data/assets/stylesheets/bootstrap/_utilities.scss +172 -13
  63. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  64. data/assets/stylesheets/bootstrap/_variables.scss +272 -162
  65. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +4 -0
  66. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +23 -3
  67. data/assets/stylesheets/bootstrap/forms/_form-check.scss +24 -11
  68. data/assets/stylesheets/bootstrap/forms/_form-control.scss +23 -3
  69. data/assets/stylesheets/bootstrap/forms/_form-select.scss +11 -2
  70. data/assets/stylesheets/bootstrap/forms/_input-group.scss +7 -4
  71. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +0 -2
  72. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +20 -2
  73. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  74. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  75. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -1
  76. data/assets/stylesheets/bootstrap/mixins/_banner.scss +3 -5
  77. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  78. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  79. data/assets/stylesheets/bootstrap/mixins/_forms.scss +18 -17
  80. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  81. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +2 -2
  82. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +2 -2
  83. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +5 -1
  84. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  85. data/bootstrap.gemspec +1 -1
  86. data/lib/bootstrap/version.rb +2 -2
  87. data/tasks/updater/js.rb +2 -2
  88. data/tasks/updater/network.rb +2 -2
  89. data/tasks/updater/scss.rb +1 -1
  90. data/tasks/updater.rb +2 -2
  91. data/test/gemfiles/rails_5_2.gemfile +8 -0
  92. data/test/gemfiles/rails_7_0.gemfile +7 -0
  93. data/test/test_helper.rb +3 -2
  94. metadata +17 -9
  95. data/.travis.yml +0 -32
@@ -1,18 +1,15 @@
1
1
  /*!
2
- * Bootstrap tooltip.js v5.2.0 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap tooltip.js v5.3.0 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./util/index'), require('./util/sanitizer'), require('./dom/event-handler'), require('./dom/manipulator'), require('./base-component'), require('./util/template-factory')) :
8
- typeof define === 'function' && define.amd ? define(['@popperjs/core', './util/index', './util/sanitizer', './dom/event-handler', './dom/manipulator', './base-component', './util/template-factory'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global["@popperjs/core"], global.Index, global.Sanitizer, global.EventHandler, global.Manipulator, global.BaseComponent, global.TemplateFactory));
10
- })(this, (function (Popper, index, sanitizer, EventHandler, Manipulator, BaseComponent, TemplateFactory) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./util/index.js'), require('./util/sanitizer.js'), require('./util/template-factory.js')) :
8
+ typeof define === 'function' && define.amd ? define(['@popperjs/core', './base-component', './dom/event-handler', './dom/manipulator', './util/index', './util/sanitizer', './util/template-factory'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global["@popperjs/core"], global.BaseComponent, global.EventHandler, global.Manipulator, global.Index, global.Sanitizer, global.TemplateFactory));
10
+ })(this, (function (Popper, BaseComponent, EventHandler, Manipulator, index_js, sanitizer_js, TemplateFactory) { 'use strict';
11
11
 
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- function _interopNamespace(e) {
15
- if (e && e.__esModule) return e;
12
+ function _interopNamespaceDefault(e) {
16
13
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
17
14
  if (e) {
18
15
  for (const k in e) {
@@ -29,18 +26,16 @@
29
26
  return Object.freeze(n);
30
27
  }
31
28
 
32
- const Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
33
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
34
- const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
35
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
36
- const TemplateFactory__default = /*#__PURE__*/_interopDefaultLegacy(TemplateFactory);
29
+ const Popper__namespace = /*#__PURE__*/_interopNamespaceDefault(Popper);
37
30
 
38
31
  /**
39
32
  * --------------------------------------------------------------------------
40
- * Bootstrap (v5.2.0): tooltip.js
33
+ * Bootstrap tooltip.js
41
34
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
42
35
  * --------------------------------------------------------------------------
43
36
  */
37
+
38
+
44
39
  /**
45
40
  * Constants
46
41
  */
@@ -70,12 +65,12 @@
70
65
  const AttachmentMap = {
71
66
  AUTO: 'auto',
72
67
  TOP: 'top',
73
- RIGHT: index.isRTL() ? 'left' : 'right',
68
+ RIGHT: index_js.isRTL() ? 'left' : 'right',
74
69
  BOTTOM: 'bottom',
75
- LEFT: index.isRTL() ? 'right' : 'left'
70
+ LEFT: index_js.isRTL() ? 'right' : 'left'
76
71
  };
77
72
  const Default = {
78
- allowList: sanitizer.DefaultAllowlist,
73
+ allowList: sanitizer_js.DefaultAllowlist,
79
74
  animation: true,
80
75
  boundary: 'clippingParents',
81
76
  container: false,
@@ -83,7 +78,7 @@
83
78
  delay: 0,
84
79
  fallbackPlacements: ['top', 'right', 'bottom', 'left'],
85
80
  html: false,
86
- offset: [0, 0],
81
+ offset: [0, 6],
87
82
  placement: 'top',
88
83
  popperConfig: null,
89
84
  sanitize: true,
@@ -112,325 +107,250 @@
112
107
  title: '(string|element|function)',
113
108
  trigger: 'string'
114
109
  };
110
+
115
111
  /**
116
112
  * Class definition
117
113
  */
118
114
 
119
- class Tooltip extends BaseComponent__default.default {
115
+ class Tooltip extends BaseComponent {
120
116
  constructor(element, config) {
121
117
  if (typeof Popper__namespace === 'undefined') {
122
118
  throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
123
119
  }
120
+ super(element, config);
124
121
 
125
- super(element, config); // Private
126
-
122
+ // Private
127
123
  this._isEnabled = true;
128
124
  this._timeout = 0;
129
- this._isHovered = false;
125
+ this._isHovered = null;
130
126
  this._activeTrigger = {};
131
127
  this._popper = null;
132
128
  this._templateFactory = null;
133
- this._newContent = null; // Protected
129
+ this._newContent = null;
134
130
 
131
+ // Protected
135
132
  this.tip = null;
136
-
137
133
  this._setListeners();
138
- } // Getters
139
-
134
+ if (!this._config.selector) {
135
+ this._fixTitle();
136
+ }
137
+ }
140
138
 
139
+ // Getters
141
140
  static get Default() {
142
141
  return Default;
143
142
  }
144
-
145
143
  static get DefaultType() {
146
144
  return DefaultType;
147
145
  }
148
-
149
146
  static get NAME() {
150
147
  return NAME;
151
- } // Public
152
-
148
+ }
153
149
 
150
+ // Public
154
151
  enable() {
155
152
  this._isEnabled = true;
156
153
  }
157
-
158
154
  disable() {
159
155
  this._isEnabled = false;
160
156
  }
161
-
162
157
  toggleEnabled() {
163
158
  this._isEnabled = !this._isEnabled;
164
159
  }
165
-
166
- toggle(event) {
160
+ toggle() {
167
161
  if (!this._isEnabled) {
168
162
  return;
169
163
  }
170
-
171
- if (event) {
172
- const context = this._initializeOnDelegatedTarget(event);
173
-
174
- context._activeTrigger.click = !context._activeTrigger.click;
175
-
176
- if (context._isWithActiveTrigger()) {
177
- context._enter();
178
- } else {
179
- context._leave();
180
- }
181
-
182
- return;
183
- }
184
-
164
+ this._activeTrigger.click = !this._activeTrigger.click;
185
165
  if (this._isShown()) {
186
166
  this._leave();
187
-
188
167
  return;
189
168
  }
190
-
191
169
  this._enter();
192
170
  }
193
-
194
171
  dispose() {
195
172
  clearTimeout(this._timeout);
196
- EventHandler__default.default.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
197
-
198
- if (this.tip) {
199
- this.tip.remove();
173
+ EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
174
+ if (this._element.getAttribute('data-bs-original-title')) {
175
+ this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
200
176
  }
201
-
202
177
  this._disposePopper();
203
-
204
178
  super.dispose();
205
179
  }
206
-
207
180
  show() {
208
181
  if (this._element.style.display === 'none') {
209
182
  throw new Error('Please use show on visible elements');
210
183
  }
211
-
212
184
  if (!(this._isWithContent() && this._isEnabled)) {
213
185
  return;
214
186
  }
215
-
216
- const showEvent = EventHandler__default.default.trigger(this._element, this.constructor.eventName(EVENT_SHOW));
217
- const shadowRoot = index.findShadowRoot(this._element);
218
-
187
+ const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW));
188
+ const shadowRoot = index_js.findShadowRoot(this._element);
219
189
  const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
220
-
221
190
  if (showEvent.defaultPrevented || !isInTheDom) {
222
191
  return;
223
- } // todo v6 remove this OR make it optional
224
-
225
-
226
- if (this.tip) {
227
- this.tip.remove();
228
- this.tip = null;
229
192
  }
230
193
 
194
+ // TODO: v6 remove this or make it optional
195
+ this._disposePopper();
231
196
  const tip = this._getTipElement();
232
-
233
197
  this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
234
-
235
198
  const {
236
199
  container
237
200
  } = this._config;
238
-
239
201
  if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
240
202
  container.append(tip);
241
- EventHandler__default.default.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
242
- }
243
-
244
- if (this._popper) {
245
- this._popper.update();
246
- } else {
247
- this._popper = this._createPopper(tip);
203
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
248
204
  }
205
+ this._popper = this._createPopper(tip);
206
+ tip.classList.add(CLASS_NAME_SHOW);
249
207
 
250
- tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
208
+ // If this is a touch-enabled device we add extra
251
209
  // empty mouseover listeners to the body's immediate children;
252
210
  // only needed because of broken event delegation on iOS
253
211
  // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
254
-
255
212
  if ('ontouchstart' in document.documentElement) {
256
213
  for (const element of [].concat(...document.body.children)) {
257
- EventHandler__default.default.on(element, 'mouseover', index.noop);
214
+ EventHandler.on(element, 'mouseover', index_js.noop);
258
215
  }
259
216
  }
260
-
261
217
  const complete = () => {
262
- const previousHoverState = this._isHovered;
263
- this._isHovered = false;
264
- EventHandler__default.default.trigger(this._element, this.constructor.eventName(EVENT_SHOWN));
265
-
266
- if (previousHoverState) {
218
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN));
219
+ if (this._isHovered === false) {
267
220
  this._leave();
268
221
  }
222
+ this._isHovered = false;
269
223
  };
270
-
271
224
  this._queueCallback(complete, this.tip, this._isAnimated());
272
225
  }
273
-
274
226
  hide() {
275
227
  if (!this._isShown()) {
276
228
  return;
277
229
  }
278
-
279
- const hideEvent = EventHandler__default.default.trigger(this._element, this.constructor.eventName(EVENT_HIDE));
280
-
230
+ const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE));
281
231
  if (hideEvent.defaultPrevented) {
282
232
  return;
283
233
  }
284
-
285
234
  const tip = this._getTipElement();
235
+ tip.classList.remove(CLASS_NAME_SHOW);
286
236
 
287
- tip.classList.remove(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra
237
+ // If this is a touch-enabled device we remove the extra
288
238
  // empty mouseover listeners we added for iOS support
289
-
290
239
  if ('ontouchstart' in document.documentElement) {
291
240
  for (const element of [].concat(...document.body.children)) {
292
- EventHandler__default.default.off(element, 'mouseover', index.noop);
241
+ EventHandler.off(element, 'mouseover', index_js.noop);
293
242
  }
294
243
  }
295
-
296
244
  this._activeTrigger[TRIGGER_CLICK] = false;
297
245
  this._activeTrigger[TRIGGER_FOCUS] = false;
298
246
  this._activeTrigger[TRIGGER_HOVER] = false;
299
- this._isHovered = false;
247
+ this._isHovered = null; // it is a trick to support manual triggering
300
248
 
301
249
  const complete = () => {
302
250
  if (this._isWithActiveTrigger()) {
303
251
  return;
304
252
  }
305
-
306
253
  if (!this._isHovered) {
307
- tip.remove();
254
+ this._disposePopper();
308
255
  }
309
-
310
256
  this._element.removeAttribute('aria-describedby');
311
-
312
- EventHandler__default.default.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN));
313
-
314
- this._disposePopper();
257
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN));
315
258
  };
316
-
317
259
  this._queueCallback(complete, this.tip, this._isAnimated());
318
260
  }
319
-
320
261
  update() {
321
262
  if (this._popper) {
322
263
  this._popper.update();
323
264
  }
324
- } // Protected
325
-
265
+ }
326
266
 
267
+ // Protected
327
268
  _isWithContent() {
328
269
  return Boolean(this._getTitle());
329
270
  }
330
-
331
271
  _getTipElement() {
332
272
  if (!this.tip) {
333
273
  this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
334
274
  }
335
-
336
275
  return this.tip;
337
276
  }
338
-
339
277
  _createTipElement(content) {
340
- const tip = this._getTemplateFactory(content).toHtml(); // todo: remove this check on v6
341
-
278
+ const tip = this._getTemplateFactory(content).toHtml();
342
279
 
280
+ // TODO: remove this check in v6
343
281
  if (!tip) {
344
282
  return null;
345
283
  }
346
-
347
- tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW); // todo: on v6 the following can be achieved with CSS only
348
-
284
+ tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
285
+ // TODO: v6 the following can be achieved with CSS only
349
286
  tip.classList.add(`bs-${this.constructor.NAME}-auto`);
350
- const tipId = index.getUID(this.constructor.NAME).toString();
287
+ const tipId = index_js.getUID(this.constructor.NAME).toString();
351
288
  tip.setAttribute('id', tipId);
352
-
353
289
  if (this._isAnimated()) {
354
290
  tip.classList.add(CLASS_NAME_FADE);
355
291
  }
356
-
357
292
  return tip;
358
293
  }
359
-
360
294
  setContent(content) {
361
295
  this._newContent = content;
362
-
363
296
  if (this._isShown()) {
364
297
  this._disposePopper();
365
-
366
298
  this.show();
367
299
  }
368
300
  }
369
-
370
301
  _getTemplateFactory(content) {
371
302
  if (this._templateFactory) {
372
303
  this._templateFactory.changeContent(content);
373
304
  } else {
374
- this._templateFactory = new TemplateFactory__default.default({ ...this._config,
305
+ this._templateFactory = new TemplateFactory({
306
+ ...this._config,
375
307
  // the `content` var has to be after `this._config`
376
308
  // to override config.content in case of popover
377
309
  content,
378
310
  extraClass: this._resolvePossibleFunction(this._config.customClass)
379
311
  });
380
312
  }
381
-
382
313
  return this._templateFactory;
383
314
  }
384
-
385
315
  _getContentForTemplate() {
386
316
  return {
387
317
  [SELECTOR_TOOLTIP_INNER]: this._getTitle()
388
318
  };
389
319
  }
390
-
391
320
  _getTitle() {
392
- return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
393
- } // Private
394
-
321
+ return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
322
+ }
395
323
 
324
+ // Private
396
325
  _initializeOnDelegatedTarget(event) {
397
326
  return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
398
327
  }
399
-
400
328
  _isAnimated() {
401
329
  return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE);
402
330
  }
403
-
404
331
  _isShown() {
405
332
  return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW);
406
333
  }
407
-
408
334
  _createPopper(tip) {
409
- const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
335
+ const placement = index_js.execute(this._config.placement, [this, tip, this._element]);
410
336
  const attachment = AttachmentMap[placement.toUpperCase()];
411
337
  return Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
412
338
  }
413
-
414
339
  _getOffset() {
415
340
  const {
416
341
  offset
417
342
  } = this._config;
418
-
419
343
  if (typeof offset === 'string') {
420
344
  return offset.split(',').map(value => Number.parseInt(value, 10));
421
345
  }
422
-
423
346
  if (typeof offset === 'function') {
424
347
  return popperData => offset(popperData, this._element);
425
348
  }
426
-
427
349
  return offset;
428
350
  }
429
-
430
351
  _resolvePossibleFunction(arg) {
431
- return typeof arg === 'function' ? arg.call(this._element) : arg;
352
+ return index_js.execute(arg, [this._element]);
432
353
  }
433
-
434
354
  _getPopperConfig(attachment) {
435
355
  const defaultBsPopperConfig = {
436
356
  placement: attachment,
@@ -465,197 +385,160 @@
465
385
  }
466
386
  }]
467
387
  };
468
- return { ...defaultBsPopperConfig,
469
- ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
388
+ return {
389
+ ...defaultBsPopperConfig,
390
+ ...index_js.execute(this._config.popperConfig, [defaultBsPopperConfig])
470
391
  };
471
392
  }
472
-
473
393
  _setListeners() {
474
394
  const triggers = this._config.trigger.split(' ');
475
-
476
395
  for (const trigger of triggers) {
477
396
  if (trigger === 'click') {
478
- EventHandler__default.default.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => this.toggle(event));
397
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {
398
+ const context = this._initializeOnDelegatedTarget(event);
399
+ context.toggle();
400
+ });
479
401
  } else if (trigger !== TRIGGER_MANUAL) {
480
402
  const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN);
481
403
  const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT);
482
- EventHandler__default.default.on(this._element, eventIn, this._config.selector, event => {
404
+ EventHandler.on(this._element, eventIn, this._config.selector, event => {
483
405
  const context = this._initializeOnDelegatedTarget(event);
484
-
485
406
  context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
486
-
487
407
  context._enter();
488
408
  });
489
- EventHandler__default.default.on(this._element, eventOut, this._config.selector, event => {
409
+ EventHandler.on(this._element, eventOut, this._config.selector, event => {
490
410
  const context = this._initializeOnDelegatedTarget(event);
491
-
492
411
  context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
493
-
494
412
  context._leave();
495
413
  });
496
414
  }
497
415
  }
498
-
499
416
  this._hideModalHandler = () => {
500
417
  if (this._element) {
501
418
  this.hide();
502
419
  }
503
420
  };
504
-
505
- EventHandler__default.default.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
506
-
507
- if (this._config.selector) {
508
- this._config = { ...this._config,
509
- trigger: 'manual',
510
- selector: ''
511
- };
512
- } else {
513
- this._fixTitle();
514
- }
421
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
515
422
  }
516
-
517
423
  _fixTitle() {
518
- const title = this._config.originalTitle;
519
-
424
+ const title = this._element.getAttribute('title');
520
425
  if (!title) {
521
426
  return;
522
427
  }
523
-
524
428
  if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
525
429
  this._element.setAttribute('aria-label', title);
526
430
  }
527
-
431
+ this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
528
432
  this._element.removeAttribute('title');
529
433
  }
530
-
531
434
  _enter() {
532
435
  if (this._isShown() || this._isHovered) {
533
436
  this._isHovered = true;
534
437
  return;
535
438
  }
536
-
537
439
  this._isHovered = true;
538
-
539
440
  this._setTimeout(() => {
540
441
  if (this._isHovered) {
541
442
  this.show();
542
443
  }
543
444
  }, this._config.delay.show);
544
445
  }
545
-
546
446
  _leave() {
547
447
  if (this._isWithActiveTrigger()) {
548
448
  return;
549
449
  }
550
-
551
450
  this._isHovered = false;
552
-
553
451
  this._setTimeout(() => {
554
452
  if (!this._isHovered) {
555
453
  this.hide();
556
454
  }
557
455
  }, this._config.delay.hide);
558
456
  }
559
-
560
457
  _setTimeout(handler, timeout) {
561
458
  clearTimeout(this._timeout);
562
459
  this._timeout = setTimeout(handler, timeout);
563
460
  }
564
-
565
461
  _isWithActiveTrigger() {
566
462
  return Object.values(this._activeTrigger).includes(true);
567
463
  }
568
-
569
464
  _getConfig(config) {
570
- const dataAttributes = Manipulator__default.default.getDataAttributes(this._element);
571
-
465
+ const dataAttributes = Manipulator.getDataAttributes(this._element);
572
466
  for (const dataAttribute of Object.keys(dataAttributes)) {
573
467
  if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
574
468
  delete dataAttributes[dataAttribute];
575
469
  }
576
470
  }
577
-
578
- config = { ...dataAttributes,
471
+ config = {
472
+ ...dataAttributes,
579
473
  ...(typeof config === 'object' && config ? config : {})
580
474
  };
581
475
  config = this._mergeConfigObj(config);
582
476
  config = this._configAfterMerge(config);
583
-
584
477
  this._typeCheckConfig(config);
585
-
586
478
  return config;
587
479
  }
588
-
589
480
  _configAfterMerge(config) {
590
- config.container = config.container === false ? document.body : index.getElement(config.container);
591
-
481
+ config.container = config.container === false ? document.body : index_js.getElement(config.container);
592
482
  if (typeof config.delay === 'number') {
593
483
  config.delay = {
594
484
  show: config.delay,
595
485
  hide: config.delay
596
486
  };
597
487
  }
598
-
599
- config.originalTitle = this._element.getAttribute('title') || '';
600
-
601
488
  if (typeof config.title === 'number') {
602
489
  config.title = config.title.toString();
603
490
  }
604
-
605
491
  if (typeof config.content === 'number') {
606
492
  config.content = config.content.toString();
607
493
  }
608
-
609
494
  return config;
610
495
  }
611
-
612
496
  _getDelegateConfig() {
613
497
  const config = {};
614
-
615
- for (const key in this._config) {
616
- if (this.constructor.Default[key] !== this._config[key]) {
617
- config[key] = this._config[key];
498
+ for (const [key, value] of Object.entries(this._config)) {
499
+ if (this.constructor.Default[key] !== value) {
500
+ config[key] = value;
618
501
  }
619
- } // In the future can be replaced with:
502
+ }
503
+ config.selector = false;
504
+ config.trigger = 'manual';
505
+
506
+ // In the future can be replaced with:
620
507
  // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
621
508
  // `Object.fromEntries(keysWithDifferentValues)`
622
-
623
-
624
509
  return config;
625
510
  }
626
-
627
511
  _disposePopper() {
628
512
  if (this._popper) {
629
513
  this._popper.destroy();
630
-
631
514
  this._popper = null;
632
515
  }
633
- } // Static
634
-
516
+ if (this.tip) {
517
+ this.tip.remove();
518
+ this.tip = null;
519
+ }
520
+ }
635
521
 
522
+ // Static
636
523
  static jQueryInterface(config) {
637
524
  return this.each(function () {
638
525
  const data = Tooltip.getOrCreateInstance(this, config);
639
-
640
526
  if (typeof config !== 'string') {
641
527
  return;
642
528
  }
643
-
644
529
  if (typeof data[config] === 'undefined') {
645
530
  throw new TypeError(`No method named "${config}"`);
646
531
  }
647
-
648
532
  data[config]();
649
533
  });
650
534
  }
651
-
652
535
  }
536
+
653
537
  /**
654
538
  * jQuery
655
539
  */
656
540
 
657
-
658
- index.defineJQueryPlugin(Tooltip);
541
+ index_js.defineJQueryPlugin(Tooltip);
659
542
 
660
543
  return Tooltip;
661
544