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