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