bootstrap 5.2.2 → 5.3.0.alpha3

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