insights4you-jekyll-theme 0.2.2 → 0.4.0
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/CHANGELOG.md +110 -0
- data/README.md +113 -30
- data/_data/i4y-colors.json +218 -0
- data/_data/i4y-social-media.yml +0 -2
- data/_includes/layout/footer.html +48 -0
- data/_includes/{head.html → layout/head.html} +40 -20
- data/_includes/layout/navbar-logo.html +137 -0
- data/_includes/layout/navbar.html +82 -0
- data/_includes/ui/button.html +13 -14
- data/_includes/ui/icon.html +24 -26
- data/_includes/ui/spinner.html +2 -0
- data/_includes/utils/banner.html +7 -0
- data/_includes/utils/settings.html +144 -0
- data/_layouts/base.html +63 -0
- data/_layouts/default.html +39 -16
- data/_sass/_bootstrap-components.scss +31 -0
- data/_sass/_bootstrap-config.scss +7 -0
- data/_sass/_bootstrap-override.scss +78 -0
- data/_sass/_config.scss +9 -0
- data/_sass/_core.scss +78 -0
- data/_sass/_debug.scss +49 -0
- data/_sass/_mixins.scss +2 -0
- data/_sass/_props.scss +91 -0
- data/_sass/_utilities-marketing.scss +209 -0
- data/_sass/_utilities.scss +135 -0
- data/_sass/_variables-dark.scss +19 -0
- data/_sass/_variables-marketing.scss +0 -0
- data/_sass/_variables.scss +1001 -0
- data/_sass/bootstrap/LICENSE +21 -0
- data/_sass/bootstrap/README.md +246 -0
- data/_sass/bootstrap/js/index.esm.js +19 -0
- data/_sass/bootstrap/js/index.umd.js +34 -0
- data/_sass/bootstrap/js/src/alert.js +87 -0
- data/_sass/bootstrap/js/src/base-component.js +85 -0
- data/_sass/bootstrap/js/src/button.js +72 -0
- data/_sass/bootstrap/js/src/carousel.js +474 -0
- data/_sass/bootstrap/js/src/collapse.js +297 -0
- data/_sass/bootstrap/js/src/dom/data.js +55 -0
- data/_sass/bootstrap/js/src/dom/event-handler.js +317 -0
- data/_sass/bootstrap/js/src/dom/manipulator.js +71 -0
- data/_sass/bootstrap/js/src/dom/selector-engine.js +126 -0
- data/_sass/bootstrap/js/src/dropdown.js +455 -0
- data/_sass/bootstrap/js/src/modal.js +378 -0
- data/_sass/bootstrap/js/src/offcanvas.js +282 -0
- data/_sass/bootstrap/js/src/popover.js +97 -0
- data/_sass/bootstrap/js/src/scrollspy.js +296 -0
- data/_sass/bootstrap/js/src/tab.js +315 -0
- data/_sass/bootstrap/js/src/toast.js +225 -0
- data/_sass/bootstrap/js/src/tooltip.js +633 -0
- data/_sass/bootstrap/js/src/util/backdrop.js +151 -0
- data/_sass/bootstrap/js/src/util/component-functions.js +35 -0
- data/_sass/bootstrap/js/src/util/config.js +65 -0
- data/_sass/bootstrap/js/src/util/focustrap.js +115 -0
- data/_sass/bootstrap/js/src/util/index.js +306 -0
- data/_sass/bootstrap/js/src/util/sanitizer.js +117 -0
- data/_sass/bootstrap/js/src/util/scrollbar.js +114 -0
- data/_sass/bootstrap/js/src/util/swipe.js +146 -0
- data/_sass/bootstrap/js/src/util/template-factory.js +160 -0
- data/_sass/bootstrap/package.json +184 -0
- data/_sass/bootstrap/scss/_accordion.scss +158 -0
- data/_sass/bootstrap/scss/_alert.scss +68 -0
- data/_sass/bootstrap/scss/_badge.scss +38 -0
- data/_sass/bootstrap/scss/_breadcrumb.scss +40 -0
- data/_sass/bootstrap/scss/_button-group.scss +142 -0
- data/_sass/bootstrap/scss/_buttons.scss +216 -0
- data/_sass/bootstrap/scss/_card.scss +239 -0
- data/_sass/bootstrap/scss/_carousel.scss +236 -0
- data/_sass/bootstrap/scss/_close.scss +63 -0
- data/_sass/bootstrap/scss/_containers.scss +41 -0
- data/_sass/bootstrap/scss/_dropdown.scss +250 -0
- data/_sass/bootstrap/scss/_forms.scss +9 -0
- data/_sass/bootstrap/scss/_functions.scss +302 -0
- data/_sass/bootstrap/scss/_grid.scss +39 -0
- data/_sass/bootstrap/scss/_helpers.scss +12 -0
- data/_sass/bootstrap/scss/_images.scss +42 -0
- data/_sass/bootstrap/scss/_list-group.scss +197 -0
- data/_sass/bootstrap/scss/_maps.scss +174 -0
- data/_sass/bootstrap/scss/_mixins.scss +42 -0
- data/_sass/bootstrap/scss/_modal.scss +236 -0
- data/_sass/bootstrap/scss/_nav.scss +197 -0
- data/_sass/bootstrap/scss/_navbar.scss +289 -0
- data/_sass/bootstrap/scss/_offcanvas.scss +143 -0
- data/_sass/bootstrap/scss/_pagination.scss +109 -0
- data/_sass/bootstrap/scss/_placeholders.scss +51 -0
- data/_sass/bootstrap/scss/_popover.scss +196 -0
- data/_sass/bootstrap/scss/_progress.scss +68 -0
- data/_sass/bootstrap/scss/_reboot.scss +611 -0
- data/_sass/bootstrap/scss/_root.scss +187 -0
- data/_sass/bootstrap/scss/_spinners.scss +85 -0
- data/_sass/bootstrap/scss/_tables.scss +171 -0
- data/_sass/bootstrap/scss/_toasts.scss +73 -0
- data/_sass/bootstrap/scss/_tooltip.scss +119 -0
- data/_sass/bootstrap/scss/_transitions.scss +27 -0
- data/_sass/bootstrap/scss/_type.scss +106 -0
- data/_sass/bootstrap/scss/_utilities.scss +806 -0
- data/_sass/bootstrap/scss/_variables-dark.scss +87 -0
- data/_sass/bootstrap/scss/_variables.scss +1751 -0
- data/_sass/bootstrap/scss/bootstrap-grid.scss +62 -0
- data/_sass/bootstrap/scss/bootstrap-reboot.scss +10 -0
- data/_sass/bootstrap/scss/bootstrap-utilities.scss +19 -0
- data/_sass/bootstrap/scss/bootstrap.scss +52 -0
- data/_sass/bootstrap/scss/forms/_floating-labels.scss +95 -0
- data/_sass/bootstrap/scss/forms/_form-check.scss +189 -0
- data/_sass/bootstrap/scss/forms/_form-control.scss +214 -0
- data/_sass/bootstrap/scss/forms/_form-range.scss +91 -0
- data/_sass/bootstrap/scss/forms/_form-select.scss +80 -0
- data/_sass/bootstrap/scss/forms/_form-text.scss +11 -0
- data/_sass/bootstrap/scss/forms/_input-group.scss +132 -0
- data/_sass/bootstrap/scss/forms/_labels.scss +36 -0
- data/_sass/bootstrap/scss/forms/_validation.scss +12 -0
- data/_sass/bootstrap/scss/helpers/_clearfix.scss +3 -0
- data/_sass/bootstrap/scss/helpers/_color-bg.scss +7 -0
- data/_sass/bootstrap/scss/helpers/_colored-links.scss +30 -0
- data/_sass/bootstrap/scss/helpers/_focus-ring.scss +5 -0
- data/_sass/bootstrap/scss/helpers/_icon-link.scss +25 -0
- data/_sass/bootstrap/scss/helpers/_position.scss +36 -0
- data/_sass/bootstrap/scss/helpers/_ratio.scss +26 -0
- data/_sass/bootstrap/scss/helpers/_stacks.scss +15 -0
- data/_sass/bootstrap/scss/helpers/_stretched-link.scss +15 -0
- data/_sass/bootstrap/scss/helpers/_text-truncation.scss +7 -0
- data/_sass/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
- data/_sass/bootstrap/scss/helpers/_vr.scss +8 -0
- data/_sass/bootstrap/scss/mixins/_alert.scss +18 -0
- data/_sass/bootstrap/scss/mixins/_backdrop.scss +14 -0
- data/_sass/bootstrap/scss/mixins/_banner.scss +7 -0
- data/_sass/bootstrap/scss/mixins/_border-radius.scss +78 -0
- data/_sass/bootstrap/scss/mixins/_box-shadow.scss +18 -0
- data/_sass/bootstrap/scss/mixins/_breakpoints.scss +127 -0
- data/_sass/bootstrap/scss/mixins/_buttons.scss +70 -0
- data/_sass/bootstrap/scss/mixins/_caret.scss +69 -0
- data/_sass/bootstrap/scss/mixins/_clearfix.scss +9 -0
- data/_sass/bootstrap/scss/mixins/_color-mode.scss +21 -0
- data/_sass/bootstrap/scss/mixins/_color-scheme.scss +7 -0
- data/_sass/bootstrap/scss/mixins/_container.scss +11 -0
- data/_sass/bootstrap/scss/mixins/_deprecate.scss +10 -0
- data/_sass/bootstrap/scss/mixins/_forms.scss +163 -0
- data/_sass/bootstrap/scss/mixins/_gradients.scss +47 -0
- data/_sass/bootstrap/scss/mixins/_grid.scss +151 -0
- data/_sass/bootstrap/scss/mixins/_image.scss +16 -0
- data/_sass/bootstrap/scss/mixins/_list-group.scss +26 -0
- data/_sass/bootstrap/scss/mixins/_lists.scss +7 -0
- data/_sass/bootstrap/scss/mixins/_pagination.scss +10 -0
- data/_sass/bootstrap/scss/mixins/_reset-text.scss +17 -0
- data/_sass/bootstrap/scss/mixins/_resize.scss +6 -0
- data/_sass/bootstrap/scss/mixins/_table-variants.scss +24 -0
- data/_sass/bootstrap/scss/mixins/_text-truncate.scss +8 -0
- data/_sass/bootstrap/scss/mixins/_transition.scss +26 -0
- data/_sass/bootstrap/scss/mixins/_utilities.scss +97 -0
- data/_sass/bootstrap/scss/mixins/_visually-hidden.scss +33 -0
- data/_sass/bootstrap/scss/utilities/_api.scss +47 -0
- data/_sass/fonts/_webfonts.scss +15 -0
- data/_sass/helpers/_index.scss +143 -0
- data/_sass/layout/_animations.scss +63 -0
- data/_sass/layout/_core.scss +62 -0
- data/_sass/layout/_dark.scss +77 -0
- data/_sass/layout/_footer.scss +12 -0
- data/_sass/layout/_navbar.scss +392 -0
- data/_sass/layout/_page.scss +169 -0
- data/_sass/layout/_root.scss +64 -0
- data/_sass/marketing/_browser.scss +67 -0
- data/_sass/marketing/_core.scss +8 -0
- data/_sass/marketing/_filters.scss +0 -0
- data/_sass/marketing/_hero.scss +69 -0
- data/_sass/marketing/_pricing.scss +111 -0
- data/_sass/marketing/_sections.scss +124 -0
- data/_sass/marketing/_shape.scss +31 -0
- data/_sass/mixins/_functions.scss +96 -0
- data/_sass/mixins/_mixins.scss +68 -0
- data/_sass/tabler-flags.scss +2 -0
- data/_sass/tabler-marketing.scss +13 -0
- data/_sass/tabler-payments.scss +2 -0
- data/_sass/tabler-props.scss +1 -0
- data/_sass/tabler-socials.scss +2 -0
- data/_sass/tabler-themes.scss +121 -0
- data/_sass/tabler-vendors.scss +16 -0
- data/_sass/tabler.scss +2 -0
- data/_sass/ui/_accordion.scss +177 -0
- data/_sass/ui/_alerts.scss +99 -0
- data/_sass/ui/_avatars.scss +145 -0
- data/_sass/ui/_badges.scss +113 -0
- data/_sass/ui/_breadcrumbs.scss +50 -0
- data/_sass/ui/_button-group.scss +16 -0
- data/_sass/ui/_buttons.scss +261 -0
- data/_sass/ui/_calendars.scss +104 -0
- data/_sass/ui/_cards.scss +594 -0
- data/_sass/ui/_carousel.scss +68 -0
- data/_sass/ui/_charts.scss +61 -0
- data/_sass/ui/_chat.scss +38 -0
- data/_sass/ui/_chips.scss +0 -0
- data/_sass/ui/_close.scss +60 -0
- data/_sass/ui/_datagrid.scss +17 -0
- data/_sass/ui/_dropdowns.scss +120 -0
- data/_sass/ui/_empty.scss +60 -0
- data/_sass/ui/_flags.scss +31 -0
- data/_sass/ui/_forms.scss +241 -0
- data/_sass/ui/_grid.scss +115 -0
- data/_sass/ui/_icons.scss +72 -0
- data/_sass/ui/_images.scss +19 -0
- data/_sass/ui/_legend.scss +12 -0
- data/_sass/ui/_lists.scss +124 -0
- data/_sass/ui/_loaders.scss +72 -0
- data/_sass/ui/_login.scss +3 -0
- data/_sass/ui/_markdown.scss +43 -0
- data/_sass/ui/_modals.scss +67 -0
- data/_sass/ui/_nav.scss +96 -0
- data/_sass/ui/_offcanvas.scss +17 -0
- data/_sass/ui/_pagination.scss +58 -0
- data/_sass/ui/_payments.scss +28 -0
- data/_sass/ui/_placeholder.scss +9 -0
- data/_sass/ui/_popovers.scss +2 -0
- data/_sass/ui/_progress.scss +107 -0
- data/_sass/ui/_ribbons.scss +157 -0
- data/_sass/ui/_segmented.scss +101 -0
- data/_sass/ui/_signature.scss +15 -0
- data/_sass/ui/_social.scss +52 -0
- data/_sass/ui/_stars.scss +13 -0
- data/_sass/ui/_status.scss +163 -0
- data/_sass/ui/_steps.scss +156 -0
- data/_sass/ui/_switch-icon.scss +211 -0
- data/_sass/ui/_tables.scss +177 -0
- data/_sass/ui/_tags.scss +57 -0
- data/_sass/ui/_timeline.scss +61 -0
- data/_sass/ui/_toasts.scss +18 -0
- data/_sass/ui/_toolbar.scss +10 -0
- data/_sass/ui/_tracking.scss +29 -0
- data/_sass/ui/_type.scss +268 -0
- data/_sass/ui/forms/_form-check.scss +91 -0
- data/_sass/ui/forms/_form-colorinput.scss +54 -0
- data/_sass/ui/forms/_form-custom.scss +28 -0
- data/_sass/ui/forms/_form-icon.scss +35 -0
- data/_sass/ui/forms/_form-imagecheck.scss +105 -0
- data/_sass/ui/forms/_form-selectgroup.scss +153 -0
- data/_sass/ui/forms/_validation.scss +13 -0
- data/_sass/ui/typo/_hr.scss +77 -0
- data/_sass/utils/_background.scss +15 -0
- data/_sass/utils/_colors.scss +100 -0
- data/_sass/utils/_opacity.scss +7 -0
- data/_sass/utils/_scroll.scss +47 -0
- data/_sass/utils/_shadow.scss +9 -0
- data/_sass/utils/_sizing.scss +6 -0
- data/_sass/utils/_text.scss +15 -0
- data/_sass/vendors/_apexcharts.scss +48 -0
- data/_sass/vendors/_coloris.scss +72 -0
- data/_sass/vendors/_dropzone.scss +27 -0
- data/_sass/vendors/_fslightbox.scss +13 -0
- data/_sass/vendors/_jsvectormap.scss +47 -0
- data/_sass/vendors/_litepicker.scss +69 -0
- data/_sass/vendors/_nouislider.scss +49 -0
- data/_sass/vendors/_plyr.scss +3 -0
- data/_sass/vendors/_stars-rating.scss +22 -0
- data/_sass/vendors/_tinymce.scss +34 -0
- data/_sass/vendors/_tom-select.scss +81 -0
- data/_sass/vendors/_turbo.scss +3 -0
- data/_sass/vendors/_typed.scss +4 -0
- data/_sass/vendors/_wysiwyg.scss +34 -0
- data/assets/css/main.scss +10 -0
- data/assets/js/custom.js +175 -0
- data/assets/js/custom.min.js +1 -0
- data/assets/js/theme.js +12 -194
- data/assets/js/theme.min.js +12 -0
- data/insights4you-jekyll-theme.gemspec +93 -0
- metadata +386 -27
- data/_data/notifications.yml +0 -10
- data/_includes/footer.html +0 -48
- data/_includes/header-logo.html +0 -91
- data/_includes/header-navbar.html +0 -59
- data/_includes/header-svg.html +0 -275
- data/_layouts/home.html +0 -19
- data/_layouts/post.html +0 -19
- data/assets/css/theme.min.css +0 -120
@@ -0,0 +1,474 @@
|
|
1
|
+
/**
|
2
|
+
* --------------------------------------------------------------------------
|
3
|
+
* Bootstrap carousel.js
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
* --------------------------------------------------------------------------
|
6
|
+
*/
|
7
|
+
|
8
|
+
import BaseComponent from './base-component.js'
|
9
|
+
import EventHandler from './dom/event-handler.js'
|
10
|
+
import Manipulator from './dom/manipulator.js'
|
11
|
+
import SelectorEngine from './dom/selector-engine.js'
|
12
|
+
import {
|
13
|
+
defineJQueryPlugin,
|
14
|
+
getNextActiveElement,
|
15
|
+
isRTL,
|
16
|
+
isVisible,
|
17
|
+
reflow,
|
18
|
+
triggerTransitionEnd
|
19
|
+
} from './util/index.js'
|
20
|
+
import Swipe from './util/swipe.js'
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Constants
|
24
|
+
*/
|
25
|
+
|
26
|
+
const NAME = 'carousel'
|
27
|
+
const DATA_KEY = 'bs.carousel'
|
28
|
+
const EVENT_KEY = `.${DATA_KEY}`
|
29
|
+
const DATA_API_KEY = '.data-api'
|
30
|
+
|
31
|
+
const ARROW_LEFT_KEY = 'ArrowLeft'
|
32
|
+
const ARROW_RIGHT_KEY = 'ArrowRight'
|
33
|
+
const TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch
|
34
|
+
|
35
|
+
const ORDER_NEXT = 'next'
|
36
|
+
const ORDER_PREV = 'prev'
|
37
|
+
const DIRECTION_LEFT = 'left'
|
38
|
+
const DIRECTION_RIGHT = 'right'
|
39
|
+
|
40
|
+
const EVENT_SLIDE = `slide${EVENT_KEY}`
|
41
|
+
const EVENT_SLID = `slid${EVENT_KEY}`
|
42
|
+
const EVENT_KEYDOWN = `keydown${EVENT_KEY}`
|
43
|
+
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`
|
44
|
+
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`
|
45
|
+
const EVENT_DRAG_START = `dragstart${EVENT_KEY}`
|
46
|
+
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`
|
47
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
|
48
|
+
|
49
|
+
const CLASS_NAME_CAROUSEL = 'carousel'
|
50
|
+
const CLASS_NAME_ACTIVE = 'active'
|
51
|
+
const CLASS_NAME_SLIDE = 'slide'
|
52
|
+
const CLASS_NAME_END = 'carousel-item-end'
|
53
|
+
const CLASS_NAME_START = 'carousel-item-start'
|
54
|
+
const CLASS_NAME_NEXT = 'carousel-item-next'
|
55
|
+
const CLASS_NAME_PREV = 'carousel-item-prev'
|
56
|
+
|
57
|
+
const SELECTOR_ACTIVE = '.active'
|
58
|
+
const SELECTOR_ITEM = '.carousel-item'
|
59
|
+
const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM
|
60
|
+
const SELECTOR_ITEM_IMG = '.carousel-item img'
|
61
|
+
const SELECTOR_INDICATORS = '.carousel-indicators'
|
62
|
+
const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'
|
63
|
+
const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'
|
64
|
+
|
65
|
+
const KEY_TO_DIRECTION = {
|
66
|
+
[ARROW_LEFT_KEY]: DIRECTION_RIGHT,
|
67
|
+
[ARROW_RIGHT_KEY]: DIRECTION_LEFT
|
68
|
+
}
|
69
|
+
|
70
|
+
const Default = {
|
71
|
+
interval: 5000,
|
72
|
+
keyboard: true,
|
73
|
+
pause: 'hover',
|
74
|
+
ride: false,
|
75
|
+
touch: true,
|
76
|
+
wrap: true
|
77
|
+
}
|
78
|
+
|
79
|
+
const DefaultType = {
|
80
|
+
interval: '(number|boolean)', // TODO:v6 remove boolean support
|
81
|
+
keyboard: 'boolean',
|
82
|
+
pause: '(string|boolean)',
|
83
|
+
ride: '(boolean|string)',
|
84
|
+
touch: 'boolean',
|
85
|
+
wrap: 'boolean'
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Class definition
|
90
|
+
*/
|
91
|
+
|
92
|
+
class Carousel extends BaseComponent {
|
93
|
+
constructor(element, config) {
|
94
|
+
super(element, config)
|
95
|
+
|
96
|
+
this._interval = null
|
97
|
+
this._activeElement = null
|
98
|
+
this._isSliding = false
|
99
|
+
this.touchTimeout = null
|
100
|
+
this._swipeHelper = null
|
101
|
+
|
102
|
+
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)
|
103
|
+
this._addEventListeners()
|
104
|
+
|
105
|
+
if (this._config.ride === CLASS_NAME_CAROUSEL) {
|
106
|
+
this.cycle()
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
// Getters
|
111
|
+
static get Default() {
|
112
|
+
return Default
|
113
|
+
}
|
114
|
+
|
115
|
+
static get DefaultType() {
|
116
|
+
return DefaultType
|
117
|
+
}
|
118
|
+
|
119
|
+
static get NAME() {
|
120
|
+
return NAME
|
121
|
+
}
|
122
|
+
|
123
|
+
// Public
|
124
|
+
next() {
|
125
|
+
this._slide(ORDER_NEXT)
|
126
|
+
}
|
127
|
+
|
128
|
+
nextWhenVisible() {
|
129
|
+
// FIXME TODO use `document.visibilityState`
|
130
|
+
// Don't call next when the page isn't visible
|
131
|
+
// or the carousel or its parent isn't visible
|
132
|
+
if (!document.hidden && isVisible(this._element)) {
|
133
|
+
this.next()
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
prev() {
|
138
|
+
this._slide(ORDER_PREV)
|
139
|
+
}
|
140
|
+
|
141
|
+
pause() {
|
142
|
+
if (this._isSliding) {
|
143
|
+
triggerTransitionEnd(this._element)
|
144
|
+
}
|
145
|
+
|
146
|
+
this._clearInterval()
|
147
|
+
}
|
148
|
+
|
149
|
+
cycle() {
|
150
|
+
this._clearInterval()
|
151
|
+
this._updateInterval()
|
152
|
+
|
153
|
+
this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)
|
154
|
+
}
|
155
|
+
|
156
|
+
_maybeEnableCycle() {
|
157
|
+
if (!this._config.ride) {
|
158
|
+
return
|
159
|
+
}
|
160
|
+
|
161
|
+
if (this._isSliding) {
|
162
|
+
EventHandler.one(this._element, EVENT_SLID, () => this.cycle())
|
163
|
+
return
|
164
|
+
}
|
165
|
+
|
166
|
+
this.cycle()
|
167
|
+
}
|
168
|
+
|
169
|
+
to(index) {
|
170
|
+
const items = this._getItems()
|
171
|
+
if (index > items.length - 1 || index < 0) {
|
172
|
+
return
|
173
|
+
}
|
174
|
+
|
175
|
+
if (this._isSliding) {
|
176
|
+
EventHandler.one(this._element, EVENT_SLID, () => this.to(index))
|
177
|
+
return
|
178
|
+
}
|
179
|
+
|
180
|
+
const activeIndex = this._getItemIndex(this._getActive())
|
181
|
+
if (activeIndex === index) {
|
182
|
+
return
|
183
|
+
}
|
184
|
+
|
185
|
+
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV
|
186
|
+
|
187
|
+
this._slide(order, items[index])
|
188
|
+
}
|
189
|
+
|
190
|
+
dispose() {
|
191
|
+
if (this._swipeHelper) {
|
192
|
+
this._swipeHelper.dispose()
|
193
|
+
}
|
194
|
+
|
195
|
+
super.dispose()
|
196
|
+
}
|
197
|
+
|
198
|
+
// Private
|
199
|
+
_configAfterMerge(config) {
|
200
|
+
config.defaultInterval = config.interval
|
201
|
+
return config
|
202
|
+
}
|
203
|
+
|
204
|
+
_addEventListeners() {
|
205
|
+
if (this._config.keyboard) {
|
206
|
+
EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))
|
207
|
+
}
|
208
|
+
|
209
|
+
if (this._config.pause === 'hover') {
|
210
|
+
EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause())
|
211
|
+
EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle())
|
212
|
+
}
|
213
|
+
|
214
|
+
if (this._config.touch && Swipe.isSupported()) {
|
215
|
+
this._addTouchEventListeners()
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
_addTouchEventListeners() {
|
220
|
+
for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
|
221
|
+
EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault())
|
222
|
+
}
|
223
|
+
|
224
|
+
const endCallBack = () => {
|
225
|
+
if (this._config.pause !== 'hover') {
|
226
|
+
return
|
227
|
+
}
|
228
|
+
|
229
|
+
// If it's a touch-enabled device, mouseenter/leave are fired as
|
230
|
+
// part of the mouse compatibility events on first tap - the carousel
|
231
|
+
// would stop cycling until user tapped out of it;
|
232
|
+
// here, we listen for touchend, explicitly pause the carousel
|
233
|
+
// (as if it's the second time we tap on it, mouseenter compat event
|
234
|
+
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
235
|
+
// events to fire) we explicitly restart cycling
|
236
|
+
|
237
|
+
this.pause()
|
238
|
+
if (this.touchTimeout) {
|
239
|
+
clearTimeout(this.touchTimeout)
|
240
|
+
}
|
241
|
+
|
242
|
+
this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval)
|
243
|
+
}
|
244
|
+
|
245
|
+
const swipeConfig = {
|
246
|
+
leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
|
247
|
+
rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
|
248
|
+
endCallback: endCallBack
|
249
|
+
}
|
250
|
+
|
251
|
+
this._swipeHelper = new Swipe(this._element, swipeConfig)
|
252
|
+
}
|
253
|
+
|
254
|
+
_keydown(event) {
|
255
|
+
if (/input|textarea/i.test(event.target.tagName)) {
|
256
|
+
return
|
257
|
+
}
|
258
|
+
|
259
|
+
const direction = KEY_TO_DIRECTION[event.key]
|
260
|
+
if (direction) {
|
261
|
+
event.preventDefault()
|
262
|
+
this._slide(this._directionToOrder(direction))
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
_getItemIndex(element) {
|
267
|
+
return this._getItems().indexOf(element)
|
268
|
+
}
|
269
|
+
|
270
|
+
_setActiveIndicatorElement(index) {
|
271
|
+
if (!this._indicatorsElement) {
|
272
|
+
return
|
273
|
+
}
|
274
|
+
|
275
|
+
const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement)
|
276
|
+
|
277
|
+
activeIndicator.classList.remove(CLASS_NAME_ACTIVE)
|
278
|
+
activeIndicator.removeAttribute('aria-current')
|
279
|
+
|
280
|
+
const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement)
|
281
|
+
|
282
|
+
if (newActiveIndicator) {
|
283
|
+
newActiveIndicator.classList.add(CLASS_NAME_ACTIVE)
|
284
|
+
newActiveIndicator.setAttribute('aria-current', 'true')
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
_updateInterval() {
|
289
|
+
const element = this._activeElement || this._getActive()
|
290
|
+
|
291
|
+
if (!element) {
|
292
|
+
return
|
293
|
+
}
|
294
|
+
|
295
|
+
const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10)
|
296
|
+
|
297
|
+
this._config.interval = elementInterval || this._config.defaultInterval
|
298
|
+
}
|
299
|
+
|
300
|
+
_slide(order, element = null) {
|
301
|
+
if (this._isSliding) {
|
302
|
+
return
|
303
|
+
}
|
304
|
+
|
305
|
+
const activeElement = this._getActive()
|
306
|
+
const isNext = order === ORDER_NEXT
|
307
|
+
const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap)
|
308
|
+
|
309
|
+
if (nextElement === activeElement) {
|
310
|
+
return
|
311
|
+
}
|
312
|
+
|
313
|
+
const nextElementIndex = this._getItemIndex(nextElement)
|
314
|
+
|
315
|
+
const triggerEvent = eventName => {
|
316
|
+
return EventHandler.trigger(this._element, eventName, {
|
317
|
+
relatedTarget: nextElement,
|
318
|
+
direction: this._orderToDirection(order),
|
319
|
+
from: this._getItemIndex(activeElement),
|
320
|
+
to: nextElementIndex
|
321
|
+
})
|
322
|
+
}
|
323
|
+
|
324
|
+
const slideEvent = triggerEvent(EVENT_SLIDE)
|
325
|
+
|
326
|
+
if (slideEvent.defaultPrevented) {
|
327
|
+
return
|
328
|
+
}
|
329
|
+
|
330
|
+
if (!activeElement || !nextElement) {
|
331
|
+
// Some weirdness is happening, so we bail
|
332
|
+
// TODO: change tests that use empty divs to avoid this check
|
333
|
+
return
|
334
|
+
}
|
335
|
+
|
336
|
+
const isCycling = Boolean(this._interval)
|
337
|
+
this.pause()
|
338
|
+
|
339
|
+
this._isSliding = true
|
340
|
+
|
341
|
+
this._setActiveIndicatorElement(nextElementIndex)
|
342
|
+
this._activeElement = nextElement
|
343
|
+
|
344
|
+
const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END
|
345
|
+
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV
|
346
|
+
|
347
|
+
nextElement.classList.add(orderClassName)
|
348
|
+
|
349
|
+
reflow(nextElement)
|
350
|
+
|
351
|
+
activeElement.classList.add(directionalClassName)
|
352
|
+
nextElement.classList.add(directionalClassName)
|
353
|
+
|
354
|
+
const completeCallBack = () => {
|
355
|
+
nextElement.classList.remove(directionalClassName, orderClassName)
|
356
|
+
nextElement.classList.add(CLASS_NAME_ACTIVE)
|
357
|
+
|
358
|
+
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName)
|
359
|
+
|
360
|
+
this._isSliding = false
|
361
|
+
|
362
|
+
triggerEvent(EVENT_SLID)
|
363
|
+
}
|
364
|
+
|
365
|
+
this._queueCallback(completeCallBack, activeElement, this._isAnimated())
|
366
|
+
|
367
|
+
if (isCycling) {
|
368
|
+
this.cycle()
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
_isAnimated() {
|
373
|
+
return this._element.classList.contains(CLASS_NAME_SLIDE)
|
374
|
+
}
|
375
|
+
|
376
|
+
_getActive() {
|
377
|
+
return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)
|
378
|
+
}
|
379
|
+
|
380
|
+
_getItems() {
|
381
|
+
return SelectorEngine.find(SELECTOR_ITEM, this._element)
|
382
|
+
}
|
383
|
+
|
384
|
+
_clearInterval() {
|
385
|
+
if (this._interval) {
|
386
|
+
clearInterval(this._interval)
|
387
|
+
this._interval = null
|
388
|
+
}
|
389
|
+
}
|
390
|
+
|
391
|
+
_directionToOrder(direction) {
|
392
|
+
if (isRTL()) {
|
393
|
+
return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT
|
394
|
+
}
|
395
|
+
|
396
|
+
return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV
|
397
|
+
}
|
398
|
+
|
399
|
+
_orderToDirection(order) {
|
400
|
+
if (isRTL()) {
|
401
|
+
return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT
|
402
|
+
}
|
403
|
+
|
404
|
+
return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT
|
405
|
+
}
|
406
|
+
|
407
|
+
// Static
|
408
|
+
static jQueryInterface(config) {
|
409
|
+
return this.each(function () {
|
410
|
+
const data = Carousel.getOrCreateInstance(this, config)
|
411
|
+
|
412
|
+
if (typeof config === 'number') {
|
413
|
+
data.to(config)
|
414
|
+
return
|
415
|
+
}
|
416
|
+
|
417
|
+
if (typeof config === 'string') {
|
418
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
419
|
+
throw new TypeError(`No method named "${config}"`)
|
420
|
+
}
|
421
|
+
|
422
|
+
data[config]()
|
423
|
+
}
|
424
|
+
})
|
425
|
+
}
|
426
|
+
}
|
427
|
+
|
428
|
+
/**
|
429
|
+
* Data API implementation
|
430
|
+
*/
|
431
|
+
|
432
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {
|
433
|
+
const target = SelectorEngine.getElementFromSelector(this)
|
434
|
+
|
435
|
+
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
|
436
|
+
return
|
437
|
+
}
|
438
|
+
|
439
|
+
event.preventDefault()
|
440
|
+
|
441
|
+
const carousel = Carousel.getOrCreateInstance(target)
|
442
|
+
const slideIndex = this.getAttribute('data-bs-slide-to')
|
443
|
+
|
444
|
+
if (slideIndex) {
|
445
|
+
carousel.to(slideIndex)
|
446
|
+
carousel._maybeEnableCycle()
|
447
|
+
return
|
448
|
+
}
|
449
|
+
|
450
|
+
if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
|
451
|
+
carousel.next()
|
452
|
+
carousel._maybeEnableCycle()
|
453
|
+
return
|
454
|
+
}
|
455
|
+
|
456
|
+
carousel.prev()
|
457
|
+
carousel._maybeEnableCycle()
|
458
|
+
})
|
459
|
+
|
460
|
+
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
461
|
+
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE)
|
462
|
+
|
463
|
+
for (const carousel of carousels) {
|
464
|
+
Carousel.getOrCreateInstance(carousel)
|
465
|
+
}
|
466
|
+
})
|
467
|
+
|
468
|
+
/**
|
469
|
+
* jQuery
|
470
|
+
*/
|
471
|
+
|
472
|
+
defineJQueryPlugin(Carousel)
|
473
|
+
|
474
|
+
export default Carousel
|