bootstrap 5.2.3 → 5.3.2

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