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,28 +1,21 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap carousel.js v5.
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap carousel.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('./
|
8
|
-
typeof define === 'function' && define.amd ? define(['./
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.
|
10
|
-
})(this, (function (
|
11
|
-
|
12
|
-
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
13
|
-
|
14
|
-
const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
15
|
-
const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
16
|
-
const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
17
|
-
const Swipe__default = /*#__PURE__*/_interopDefaultLegacy(Swipe);
|
18
|
-
const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./util/index.js'), require('./util/swipe.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './util/index', './util/swipe'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.BaseComponent, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Index, global.Swipe));
|
10
|
+
})(this, (function (BaseComponent, EventHandler, Manipulator, SelectorEngine, index_js, Swipe) { 'use strict';
|
19
11
|
|
20
12
|
/**
|
21
13
|
* --------------------------------------------------------------------------
|
22
|
-
* Bootstrap
|
14
|
+
* Bootstrap carousel.js
|
23
15
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
24
16
|
* --------------------------------------------------------------------------
|
25
17
|
*/
|
18
|
+
|
26
19
|
/**
|
27
20
|
* Constants
|
28
21
|
*/
|
@@ -82,11 +75,12 @@
|
|
82
75
|
touch: 'boolean',
|
83
76
|
wrap: 'boolean'
|
84
77
|
};
|
78
|
+
|
85
79
|
/**
|
86
80
|
* Class definition
|
87
81
|
*/
|
88
82
|
|
89
|
-
class Carousel extends
|
83
|
+
class Carousel extends BaseComponent {
|
90
84
|
constructor(element, config) {
|
91
85
|
super(element, config);
|
92
86
|
this._interval = null;
|
@@ -94,136 +88,110 @@
|
|
94
88
|
this._isSliding = false;
|
95
89
|
this.touchTimeout = null;
|
96
90
|
this._swipeHelper = null;
|
97
|
-
this._indicatorsElement =
|
98
|
-
|
91
|
+
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
|
99
92
|
this._addEventListeners();
|
100
|
-
|
101
93
|
if (this._config.ride === CLASS_NAME_CAROUSEL) {
|
102
94
|
this.cycle();
|
103
95
|
}
|
104
|
-
}
|
105
|
-
|
96
|
+
}
|
106
97
|
|
98
|
+
// Getters
|
107
99
|
static get Default() {
|
108
100
|
return Default;
|
109
101
|
}
|
110
|
-
|
111
102
|
static get DefaultType() {
|
112
103
|
return DefaultType;
|
113
104
|
}
|
114
|
-
|
115
105
|
static get NAME() {
|
116
106
|
return NAME;
|
117
|
-
}
|
118
|
-
|
107
|
+
}
|
119
108
|
|
109
|
+
// Public
|
120
110
|
next() {
|
121
111
|
this._slide(ORDER_NEXT);
|
122
112
|
}
|
123
|
-
|
124
113
|
nextWhenVisible() {
|
125
114
|
// FIXME TODO use `document.visibilityState`
|
126
115
|
// Don't call next when the page isn't visible
|
127
116
|
// or the carousel or its parent isn't visible
|
128
|
-
if (!document.hidden &&
|
117
|
+
if (!document.hidden && index_js.isVisible(this._element)) {
|
129
118
|
this.next();
|
130
119
|
}
|
131
120
|
}
|
132
|
-
|
133
121
|
prev() {
|
134
122
|
this._slide(ORDER_PREV);
|
135
123
|
}
|
136
|
-
|
137
124
|
pause() {
|
138
125
|
if (this._isSliding) {
|
139
|
-
|
126
|
+
index_js.triggerTransitionEnd(this._element);
|
140
127
|
}
|
141
|
-
|
142
128
|
this._clearInterval();
|
143
129
|
}
|
144
|
-
|
145
130
|
cycle() {
|
146
131
|
this._clearInterval();
|
147
|
-
|
148
132
|
this._updateInterval();
|
149
|
-
|
150
133
|
this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
|
151
134
|
}
|
152
|
-
|
153
135
|
_maybeEnableCycle() {
|
154
136
|
if (!this._config.ride) {
|
155
137
|
return;
|
156
138
|
}
|
157
|
-
|
158
139
|
if (this._isSliding) {
|
159
|
-
|
140
|
+
EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
|
160
141
|
return;
|
161
142
|
}
|
162
|
-
|
163
143
|
this.cycle();
|
164
144
|
}
|
165
|
-
|
166
145
|
to(index) {
|
167
146
|
const items = this._getItems();
|
168
|
-
|
169
147
|
if (index > items.length - 1 || index < 0) {
|
170
148
|
return;
|
171
149
|
}
|
172
|
-
|
173
150
|
if (this._isSliding) {
|
174
|
-
|
151
|
+
EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
|
175
152
|
return;
|
176
153
|
}
|
177
|
-
|
178
154
|
const activeIndex = this._getItemIndex(this._getActive());
|
179
|
-
|
180
155
|
if (activeIndex === index) {
|
181
156
|
return;
|
182
157
|
}
|
183
|
-
|
184
158
|
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
|
185
|
-
|
186
159
|
this._slide(order, items[index]);
|
187
160
|
}
|
188
|
-
|
189
161
|
dispose() {
|
190
162
|
if (this._swipeHelper) {
|
191
163
|
this._swipeHelper.dispose();
|
192
164
|
}
|
193
|
-
|
194
165
|
super.dispose();
|
195
|
-
}
|
196
|
-
|
166
|
+
}
|
197
167
|
|
168
|
+
// Private
|
198
169
|
_configAfterMerge(config) {
|
199
170
|
config.defaultInterval = config.interval;
|
200
171
|
return config;
|
201
172
|
}
|
202
|
-
|
203
173
|
_addEventListeners() {
|
204
174
|
if (this._config.keyboard) {
|
205
|
-
|
175
|
+
EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
|
206
176
|
}
|
207
|
-
|
208
177
|
if (this._config.pause === 'hover') {
|
209
|
-
|
210
|
-
|
178
|
+
EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause());
|
179
|
+
EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle());
|
211
180
|
}
|
212
|
-
|
213
|
-
if (this._config.touch && Swipe__default.default.isSupported()) {
|
181
|
+
if (this._config.touch && Swipe.isSupported()) {
|
214
182
|
this._addTouchEventListeners();
|
215
183
|
}
|
216
184
|
}
|
217
|
-
|
218
185
|
_addTouchEventListeners() {
|
219
|
-
for (const img of
|
220
|
-
|
186
|
+
for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
|
187
|
+
EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault());
|
221
188
|
}
|
222
|
-
|
223
189
|
const endCallBack = () => {
|
224
190
|
if (this._config.pause !== 'hover') {
|
225
191
|
return;
|
226
|
-
}
|
192
|
+
}
|
193
|
+
|
194
|
+
// If it's a touch-enabled device, mouseenter/leave are fired as
|
227
195
|
// part of the mouse compatibility events on first tap - the carousel
|
228
196
|
// would stop cycling until user tapped out of it;
|
229
197
|
// here, we listen for touchend, explicitly pause the carousel
|
@@ -231,120 +199,92 @@
|
|
231
199
|
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
232
200
|
// events to fire) we explicitly restart cycling
|
233
201
|
|
234
|
-
|
235
202
|
this.pause();
|
236
|
-
|
237
203
|
if (this.touchTimeout) {
|
238
204
|
clearTimeout(this.touchTimeout);
|
239
205
|
}
|
240
|
-
|
241
206
|
this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
|
242
207
|
};
|
243
|
-
|
244
208
|
const swipeConfig = {
|
245
209
|
leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
|
246
210
|
rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
|
247
211
|
endCallback: endCallBack
|
248
212
|
};
|
249
|
-
this._swipeHelper = new
|
213
|
+
this._swipeHelper = new Swipe(this._element, swipeConfig);
|
250
214
|
}
|
251
|
-
|
252
215
|
_keydown(event) {
|
253
216
|
if (/input|textarea/i.test(event.target.tagName)) {
|
254
217
|
return;
|
255
218
|
}
|
256
|
-
|
257
219
|
const direction = KEY_TO_DIRECTION[event.key];
|
258
|
-
|
259
220
|
if (direction) {
|
260
221
|
event.preventDefault();
|
261
|
-
|
262
222
|
this._slide(this._directionToOrder(direction));
|
263
223
|
}
|
264
224
|
}
|
265
|
-
|
266
225
|
_getItemIndex(element) {
|
267
226
|
return this._getItems().indexOf(element);
|
268
227
|
}
|
269
|
-
|
270
228
|
_setActiveIndicatorElement(index) {
|
271
229
|
if (!this._indicatorsElement) {
|
272
230
|
return;
|
273
231
|
}
|
274
|
-
|
275
|
-
const activeIndicator = SelectorEngine__default.default.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
|
232
|
+
const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
|
276
233
|
activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
|
277
234
|
activeIndicator.removeAttribute('aria-current');
|
278
|
-
const newActiveIndicator =
|
279
|
-
|
235
|
+
const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement);
|
280
236
|
if (newActiveIndicator) {
|
281
237
|
newActiveIndicator.classList.add(CLASS_NAME_ACTIVE);
|
282
238
|
newActiveIndicator.setAttribute('aria-current', 'true');
|
283
239
|
}
|
284
240
|
}
|
285
|
-
|
286
241
|
_updateInterval() {
|
287
242
|
const element = this._activeElement || this._getActive();
|
288
|
-
|
289
243
|
if (!element) {
|
290
244
|
return;
|
291
245
|
}
|
292
|
-
|
293
246
|
const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
|
294
247
|
this._config.interval = elementInterval || this._config.defaultInterval;
|
295
248
|
}
|
296
|
-
|
297
249
|
_slide(order, element = null) {
|
298
250
|
if (this._isSliding) {
|
299
251
|
return;
|
300
252
|
}
|
301
|
-
|
302
253
|
const activeElement = this._getActive();
|
303
|
-
|
304
254
|
const isNext = order === ORDER_NEXT;
|
305
|
-
const nextElement = element ||
|
306
|
-
|
255
|
+
const nextElement = element || index_js.getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
|
307
256
|
if (nextElement === activeElement) {
|
308
257
|
return;
|
309
258
|
}
|
310
|
-
|
311
259
|
const nextElementIndex = this._getItemIndex(nextElement);
|
312
|
-
|
313
260
|
const triggerEvent = eventName => {
|
314
|
-
return
|
261
|
+
return EventHandler.trigger(this._element, eventName, {
|
315
262
|
relatedTarget: nextElement,
|
316
263
|
direction: this._orderToDirection(order),
|
317
264
|
from: this._getItemIndex(activeElement),
|
318
265
|
to: nextElementIndex
|
319
266
|
});
|
320
267
|
};
|
321
|
-
|
322
268
|
const slideEvent = triggerEvent(EVENT_SLIDE);
|
323
|
-
|
324
269
|
if (slideEvent.defaultPrevented) {
|
325
270
|
return;
|
326
271
|
}
|
327
|
-
|
328
272
|
if (!activeElement || !nextElement) {
|
329
273
|
// Some weirdness is happening, so we bail
|
330
|
-
//
|
274
|
+
// TODO: change tests that use empty divs to avoid this check
|
331
275
|
return;
|
332
276
|
}
|
333
|
-
|
334
277
|
const isCycling = Boolean(this._interval);
|
335
278
|
this.pause();
|
336
279
|
this._isSliding = true;
|
337
|
-
|
338
280
|
this._setActiveIndicatorElement(nextElementIndex);
|
339
|
-
|
340
281
|
this._activeElement = nextElement;
|
341
282
|
const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
|
342
283
|
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
|
343
284
|
nextElement.classList.add(orderClassName);
|
344
|
-
|
285
|
+
index_js.reflow(nextElement);
|
345
286
|
activeElement.classList.add(directionalClassName);
|
346
287
|
nextElement.classList.add(directionalClassName);
|
347
|
-
|
348
288
|
const completeCallBack = () => {
|
349
289
|
nextElement.classList.remove(directionalClassName, orderClassName);
|
350
290
|
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
@@ -352,118 +292,94 @@
|
|
352
292
|
this._isSliding = false;
|
353
293
|
triggerEvent(EVENT_SLID);
|
354
294
|
};
|
355
|
-
|
356
295
|
this._queueCallback(completeCallBack, activeElement, this._isAnimated());
|
357
|
-
|
358
296
|
if (isCycling) {
|
359
297
|
this.cycle();
|
360
298
|
}
|
361
299
|
}
|
362
|
-
|
363
300
|
_isAnimated() {
|
364
301
|
return this._element.classList.contains(CLASS_NAME_SLIDE);
|
365
302
|
}
|
366
|
-
|
367
303
|
_getActive() {
|
368
|
-
return
|
304
|
+
return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
369
305
|
}
|
370
|
-
|
371
306
|
_getItems() {
|
372
|
-
return
|
307
|
+
return SelectorEngine.find(SELECTOR_ITEM, this._element);
|
373
308
|
}
|
374
|
-
|
375
309
|
_clearInterval() {
|
376
310
|
if (this._interval) {
|
377
311
|
clearInterval(this._interval);
|
378
312
|
this._interval = null;
|
379
313
|
}
|
380
314
|
}
|
381
|
-
|
382
315
|
_directionToOrder(direction) {
|
383
|
-
if (
|
316
|
+
if (index_js.isRTL()) {
|
384
317
|
return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
|
385
318
|
}
|
386
|
-
|
387
319
|
return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
|
388
320
|
}
|
389
|
-
|
390
321
|
_orderToDirection(order) {
|
391
|
-
if (
|
322
|
+
if (index_js.isRTL()) {
|
392
323
|
return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
393
324
|
}
|
394
|
-
|
395
325
|
return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
|
396
|
-
}
|
397
|
-
|
326
|
+
}
|
398
327
|
|
328
|
+
// Static
|
399
329
|
static jQueryInterface(config) {
|
400
330
|
return this.each(function () {
|
401
331
|
const data = Carousel.getOrCreateInstance(this, config);
|
402
|
-
|
403
332
|
if (typeof config === 'number') {
|
404
333
|
data.to(config);
|
405
334
|
return;
|
406
335
|
}
|
407
|
-
|
408
336
|
if (typeof config === 'string') {
|
409
337
|
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
410
338
|
throw new TypeError(`No method named "${config}"`);
|
411
339
|
}
|
412
|
-
|
413
340
|
data[config]();
|
414
341
|
}
|
415
342
|
});
|
416
343
|
}
|
417
|
-
|
418
344
|
}
|
345
|
+
|
419
346
|
/**
|
420
347
|
* Data API implementation
|
421
348
|
*/
|
422
349
|
|
423
|
-
|
424
|
-
|
425
|
-
const target = index.getElementFromSelector(this);
|
426
|
-
|
350
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {
|
351
|
+
const target = SelectorEngine.getElementFromSelector(this);
|
427
352
|
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
|
428
353
|
return;
|
429
354
|
}
|
430
|
-
|
431
355
|
event.preventDefault();
|
432
356
|
const carousel = Carousel.getOrCreateInstance(target);
|
433
357
|
const slideIndex = this.getAttribute('data-bs-slide-to');
|
434
|
-
|
435
358
|
if (slideIndex) {
|
436
359
|
carousel.to(slideIndex);
|
437
|
-
|
438
360
|
carousel._maybeEnableCycle();
|
439
|
-
|
440
361
|
return;
|
441
362
|
}
|
442
|
-
|
443
|
-
if (Manipulator__default.default.getDataAttribute(this, 'slide') === 'next') {
|
363
|
+
if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
|
444
364
|
carousel.next();
|
445
|
-
|
446
365
|
carousel._maybeEnableCycle();
|
447
|
-
|
448
366
|
return;
|
449
367
|
}
|
450
|
-
|
451
368
|
carousel.prev();
|
452
|
-
|
453
369
|
carousel._maybeEnableCycle();
|
454
370
|
});
|
455
|
-
|
456
|
-
const carousels =
|
457
|
-
|
371
|
+
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
372
|
+
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
|
458
373
|
for (const carousel of carousels) {
|
459
374
|
Carousel.getOrCreateInstance(carousel);
|
460
375
|
}
|
461
376
|
});
|
377
|
+
|
462
378
|
/**
|
463
379
|
* jQuery
|
464
380
|
*/
|
465
381
|
|
466
|
-
|
382
|
+
index_js.defineJQueryPlugin(Carousel);
|
467
383
|
|
468
384
|
return Carousel;
|
469
385
|
|