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