bootstrap-italia 2.13.3 → 2.14.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.
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/bootstrap-italia.esm.js +1 -2
- package/dist/bootstrap-italia.esm.js.map +1 -1
- package/dist/css/bootstrap-italia.min.css +1 -1
- package/dist/css/bootstrap-italia.min.css.map +1 -1
- package/dist/js/bootstrap-italia.bundle.min.js +14 -8
- package/dist/js/bootstrap-italia.min.js +4 -4
- package/dist/plugins/back-to-top.js +0 -6
- package/dist/plugins/back-to-top.js.map +1 -1
- package/dist/plugins/button.js +3 -3
- package/dist/plugins/button.js.map +1 -1
- package/dist/plugins/carousel.js +183 -402
- package/dist/plugins/carousel.js.map +1 -1
- package/dist/plugins/forward.js.map +1 -1
- package/dist/plugins/header-sticky.js +1 -7
- package/dist/plugins/header-sticky.js.map +1 -1
- package/dist/plugins/input-label.js +5 -1
- package/dist/plugins/input-label.js.map +1 -1
- package/dist/plugins/input-number.js +5 -7
- package/dist/plugins/input-number.js.map +1 -1
- package/dist/plugins/masonry.js +8 -1
- package/dist/plugins/masonry.js.map +1 -1
- package/dist/plugins/select-autocomplete.js +66 -17
- package/dist/plugins/select-autocomplete.js.map +1 -1
- package/dist/plugins/tooltip.js +10 -0
- package/dist/plugins/tooltip.js.map +1 -1
- package/dist/plugins/track-focus.js +0 -6
- package/dist/plugins/track-focus.js.map +1 -1
- package/dist/plugins/util/pageScroll.js +1 -1
- package/dist/plugins/util/pageScroll.js.map +1 -1
- package/dist/plugins/util/youtube-video.js +1 -2
- package/dist/plugins/util/youtube-video.js.map +1 -1
- package/dist/plugins/vendor/accessible-autocomplete.js +9 -0
- package/dist/plugins/vendor/accessible-autocomplete.js.map +1 -0
- package/dist/svg/sprites.svg +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -3
- package/src/js/bootstrap-italia.entry.js +0 -2
- package/src/js/bootstrap-italia.esm.js +1 -2
- package/src/js/icons.js +9 -0
- package/src/js/plugins/back-to-top.js +0 -6
- package/src/js/plugins/button.js +3 -3
- package/src/js/plugins/carousel.js +184 -402
- package/src/js/plugins/forward.js +0 -1
- package/src/js/plugins/header-sticky.js +1 -7
- package/src/js/plugins/input-label.js +5 -1
- package/src/js/plugins/input-number.js +5 -7
- package/src/js/plugins/masonry.js +8 -1
- package/src/js/plugins/select-autocomplete.js +67 -17
- package/src/js/plugins/tooltip.js +10 -0
- package/src/js/plugins/track-focus.js +0 -6
- package/src/js/plugins/util/pageScroll.js +1 -1
- package/src/js/plugins/util/youtube-video.js +1 -2
- package/src/js/plugins/vendor/accessible-autocomplete.js +1 -0
- package/src/js/version.js +1 -1
- package/src/scss/base/_variables.scss +1 -1
- package/src/scss/base/_version.scss +1 -1
- package/src/scss/components/_buttons.scss +3 -3
- package/src/scss/components/_carousel.scss +7 -235
- package/src/scss/components/_navigation.scss +1 -1
- package/src/scss/components/_tab.scss +4 -4
- package/src/scss/forms/_accessible-autocomplete.scss +0 -19
- package/src/scss/forms/_form-input-number.scss +1 -1
- package/src/scss/forms/_form-input-upload.scss +1 -1
- package/src/scss/forms/_form-toggles.scss +1 -1
- package/src/scss/forms/_forms.scss +2 -1
- package/src/scss/forms/_just-validate.scss +4 -4
- package/src/scss/utilities/focus.scss +26 -16
- package/src/svg/it-bluesky.svg +4 -0
- package/src/svg/it-car.svg +4 -0
- package/src/svg/it-cart.svg +5 -0
- package/src/svg/it-file-docx.svg +12 -0
- package/src/svg/it-file-image.svg +5 -0
- package/src/svg/it-file-signed.svg +16 -0
- package/src/svg/it-file-xlsx.svg +11 -0
- package/src/svg/it-sign.svg +8 -0
- package/src/svg/it-spotify.svg +4 -0
- package/types/index.d.ts +0 -2
- package/types/plugins/carousel.d.ts +42 -2
- package/dist/plugins/carousel-bi.js +0 -226
- package/dist/plugins/carousel-bi.js.map +0 -1
- package/dist/plugins/util/swipe.js +0 -150
- package/dist/plugins/util/swipe.js.map +0 -1
- package/src/js/plugins/carousel-bi.js +0 -225
- package/types/plugins/carousel-bi.d.ts +0 -57
package/src/js/plugins/button.js
CHANGED
|
@@ -50,10 +50,10 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
|
50
50
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) => {
|
|
51
51
|
event.preventDefault()
|
|
52
52
|
|
|
53
|
-
const
|
|
54
|
-
const
|
|
53
|
+
const buttonEl = event.target.closest(SELECTOR_DATA_TOGGLE)
|
|
54
|
+
const button = Button.getOrCreateInstance(buttonEl)
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
button.toggle()
|
|
57
57
|
})
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -3,445 +3,227 @@
|
|
|
3
3
|
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
4
4
|
* Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
|
|
5
5
|
* Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
|
|
6
|
-
* This a fork of Bootstrap: Initial license and original file name below
|
|
7
|
-
* Bootstrap (v5.2.3): carousel.js
|
|
8
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
9
6
|
* --------------------------------------------------------------------------
|
|
10
7
|
*/
|
|
11
8
|
|
|
12
|
-
import
|
|
13
|
-
import EventHandler from './dom/event-handler'
|
|
14
|
-
import Manipulator from './dom/manipulator'
|
|
15
|
-
import SelectorEngine from './dom/selector-engine'
|
|
16
|
-
import Swipe from './util/swipe'
|
|
17
|
-
import BaseComponent from './base-component'
|
|
9
|
+
import Splide from '@splidejs/splide'
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
import BaseComponent from './base-component.js'
|
|
12
|
+
import SelectorEngine from './dom/selector-engine'
|
|
13
|
+
import EventHandler from './dom/event-handler'
|
|
22
14
|
|
|
23
15
|
const NAME = 'carousel'
|
|
24
16
|
const DATA_KEY = 'bs.carousel'
|
|
25
17
|
const EVENT_KEY = `.${DATA_KEY}`
|
|
26
18
|
const DATA_API_KEY = '.data-api'
|
|
27
19
|
|
|
28
|
-
const ARROW_LEFT_KEY = 'ArrowLeft'
|
|
29
|
-
const ARROW_RIGHT_KEY = 'ArrowRight'
|
|
30
|
-
const TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch
|
|
31
|
-
|
|
32
|
-
const ORDER_NEXT = 'next'
|
|
33
|
-
const ORDER_PREV = 'prev'
|
|
34
|
-
const DIRECTION_LEFT = 'left'
|
|
35
|
-
const DIRECTION_RIGHT = 'right'
|
|
36
|
-
|
|
37
|
-
const EVENT_SLIDE = `slide${EVENT_KEY}`
|
|
38
|
-
const EVENT_SLID = `slid${EVENT_KEY}`
|
|
39
|
-
const EVENT_KEYDOWN = `keydown${EVENT_KEY}`
|
|
40
|
-
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`
|
|
41
|
-
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`
|
|
42
|
-
const EVENT_DRAG_START = `dragstart${EVENT_KEY}`
|
|
43
20
|
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`
|
|
44
|
-
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
|
|
45
21
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const Default = {
|
|
68
|
-
interval: 5000,
|
|
69
|
-
keyboard: true,
|
|
70
|
-
pause: 'hover',
|
|
71
|
-
ride: false,
|
|
72
|
-
touch: true,
|
|
73
|
-
wrap: true,
|
|
22
|
+
const SELECTOR_CAROUSEL = '[data-bs-carousel-splide]'
|
|
23
|
+
|
|
24
|
+
const CONFIG_DEFAULT = {
|
|
25
|
+
slideFocus: false,
|
|
26
|
+
rewind: true,
|
|
27
|
+
perMove: 1,
|
|
28
|
+
i18n: {
|
|
29
|
+
prev: 'Slide precedente',
|
|
30
|
+
next: 'Slide successiva',
|
|
31
|
+
first: 'Vai alla prima slide',
|
|
32
|
+
last: 'Vai all’ultima slide',
|
|
33
|
+
slideX: 'Vai alla slide %s',
|
|
34
|
+
pageX: 'Vai a pagina %s',
|
|
35
|
+
play: 'Attiva autoplay',
|
|
36
|
+
pause: 'Pausa autoplay',
|
|
37
|
+
carousel: 'Carosello',
|
|
38
|
+
select: 'Seleziona una slide da mostrare',
|
|
39
|
+
slide: 'slide',
|
|
40
|
+
slideLabel: '%s di %s',
|
|
41
|
+
},
|
|
74
42
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
43
|
+
const CONFIGS = {
|
|
44
|
+
'it-carousel-landscape-abstract-three-cols': {
|
|
45
|
+
type: 'slide',
|
|
46
|
+
perPage: 3,
|
|
47
|
+
gap: 24,
|
|
48
|
+
padding: { left: 0, right: 0 },
|
|
49
|
+
arrows: false,
|
|
50
|
+
breakpoints: {
|
|
51
|
+
768: {
|
|
52
|
+
perPage: 1,
|
|
53
|
+
gap: 24,
|
|
54
|
+
padding: { left: 0, right: 0 },
|
|
55
|
+
arrows: false,
|
|
56
|
+
},
|
|
57
|
+
992: {
|
|
58
|
+
perPage: 2,
|
|
59
|
+
gap: 24,
|
|
60
|
+
padding: { left: 40, right: 40 },
|
|
61
|
+
arrows: false,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
'it-carousel-landscape-abstract-three-cols-arrow-visible': {
|
|
66
|
+
type: 'slide',
|
|
67
|
+
perPage: 3,
|
|
68
|
+
gap: 24,
|
|
69
|
+
padding: { left: 0, right: 0 },
|
|
70
|
+
arrows: true,
|
|
71
|
+
breakpoints: {
|
|
72
|
+
768: {
|
|
73
|
+
perPage: 1,
|
|
74
|
+
gap: 24,
|
|
75
|
+
padding: { left: 40, right: 40 },
|
|
76
|
+
arrows: true,
|
|
77
|
+
},
|
|
78
|
+
992: {
|
|
79
|
+
perPage: 2,
|
|
80
|
+
gap: 24,
|
|
81
|
+
padding: { left: 40, right: 40 },
|
|
82
|
+
arrows: true,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
'it-big-img': {
|
|
87
|
+
type: 'loop',
|
|
88
|
+
perPage: 1,
|
|
89
|
+
gap: 48,
|
|
90
|
+
padding: { left: 320, right: 320 },
|
|
91
|
+
arrows: false,
|
|
92
|
+
breakpoints: {
|
|
93
|
+
768: {
|
|
94
|
+
perPage: 1,
|
|
95
|
+
gap: 0,
|
|
96
|
+
padding: { left: 0, right: 0 },
|
|
97
|
+
arrows: false,
|
|
98
|
+
},
|
|
99
|
+
992: {
|
|
100
|
+
perPage: 1,
|
|
101
|
+
gap: 24,
|
|
102
|
+
padding: { left: 160, right: 160 },
|
|
103
|
+
arrows: false,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
'it-standard-image': {
|
|
108
|
+
type: 'loop',
|
|
109
|
+
perPage: 3,
|
|
110
|
+
gap: 24,
|
|
111
|
+
padding: { left: 48, right: 48 },
|
|
112
|
+
arrows: false,
|
|
113
|
+
breakpoints: {
|
|
114
|
+
768: {
|
|
115
|
+
perPage: 1,
|
|
116
|
+
gap: 24,
|
|
117
|
+
padding: { left: 40, right: 40 },
|
|
118
|
+
arrows: false,
|
|
119
|
+
},
|
|
120
|
+
992: {
|
|
121
|
+
perPage: 2,
|
|
122
|
+
gap: 24,
|
|
123
|
+
padding: { left: 48, right: 48 },
|
|
124
|
+
arrows: false,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
'it-carousel-landscape-abstract': {
|
|
129
|
+
type: 'slide',
|
|
130
|
+
perPage: 1,
|
|
131
|
+
gap: 24,
|
|
132
|
+
padding: { left: 0, right: 0 },
|
|
133
|
+
arrows: false,
|
|
134
|
+
breakpoints: {
|
|
135
|
+
768: {
|
|
136
|
+
perPage: 1,
|
|
137
|
+
gap: 24,
|
|
138
|
+
padding: { left: 0, right: 0 },
|
|
139
|
+
arrows: false,
|
|
140
|
+
},
|
|
141
|
+
992: {
|
|
142
|
+
perPage: 1,
|
|
143
|
+
gap: 24,
|
|
144
|
+
padding: { left: 24, right: 24 },
|
|
145
|
+
arrows: false,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
'it-calendar-wrapper': {
|
|
150
|
+
type: 'slide',
|
|
151
|
+
perPage: 4,
|
|
152
|
+
gap: 0,
|
|
153
|
+
padding: { left: 0, right: 0 },
|
|
154
|
+
arrows: false,
|
|
155
|
+
breakpoints: {
|
|
156
|
+
560: {
|
|
157
|
+
perPage: 1,
|
|
158
|
+
gap: 0,
|
|
159
|
+
padding: { left: 24, right: 24 },
|
|
160
|
+
arrows: false,
|
|
161
|
+
},
|
|
162
|
+
768: {
|
|
163
|
+
perPage: 2,
|
|
164
|
+
gap: 0,
|
|
165
|
+
padding: { left: 0, right: 0 },
|
|
166
|
+
arrows: false,
|
|
167
|
+
},
|
|
168
|
+
992: {
|
|
169
|
+
perPage: 3,
|
|
170
|
+
gap: 0,
|
|
171
|
+
padding: { left: 0, right: 0 },
|
|
172
|
+
arrows: false,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
83
176
|
}
|
|
84
177
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
constructor(element, config) {
|
|
91
|
-
super(element, config)
|
|
178
|
+
class CarouselBI extends BaseComponent {
|
|
179
|
+
constructor(element) {
|
|
180
|
+
super(element)
|
|
181
|
+
this._config = this._getConfig()
|
|
182
|
+
this._splide = new Splide(this._element, this._config)
|
|
92
183
|
|
|
93
|
-
this.
|
|
94
|
-
this._activeElement = null
|
|
95
|
-
this._isSliding = false
|
|
96
|
-
this.touchTimeout = null
|
|
97
|
-
this._swipeHelper = null
|
|
98
|
-
|
|
99
|
-
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)
|
|
100
|
-
this._addEventListeners()
|
|
101
|
-
|
|
102
|
-
if (this._config.ride === CLASS_NAME_CAROUSEL) {
|
|
103
|
-
this.cycle()
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Getters
|
|
108
|
-
static get Default() {
|
|
109
|
-
return Default
|
|
184
|
+
this._init()
|
|
110
185
|
}
|
|
111
186
|
|
|
112
|
-
|
|
113
|
-
|
|
187
|
+
dispose() {
|
|
188
|
+
this._splide.destroy()
|
|
189
|
+
super.dispose()
|
|
114
190
|
}
|
|
191
|
+
// Getters
|
|
115
192
|
|
|
116
193
|
static get NAME() {
|
|
117
194
|
return NAME
|
|
118
195
|
}
|
|
119
196
|
|
|
120
197
|
// Public
|
|
121
|
-
next() {
|
|
122
|
-
this._slide(ORDER_NEXT)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
nextWhenVisible() {
|
|
126
|
-
// FIXME TODO use `document.visibilityState`
|
|
127
|
-
// Don't call next when the page isn't visible
|
|
128
|
-
// or the carousel or its parent isn't visible
|
|
129
|
-
if (!document.hidden && isVisible(this._element)) {
|
|
130
|
-
this.next()
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
prev() {
|
|
135
|
-
this._slide(ORDER_PREV)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
pause() {
|
|
139
|
-
if (this._isSliding) {
|
|
140
|
-
triggerTransitionEnd(this._element)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
this._clearInterval()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
cycle() {
|
|
147
|
-
this._clearInterval()
|
|
148
|
-
this._updateInterval()
|
|
149
|
-
|
|
150
|
-
this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
_maybeEnableCycle() {
|
|
154
|
-
if (!this._config.ride) {
|
|
155
|
-
return
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (this._isSliding) {
|
|
159
|
-
EventHandler.one(this._element, EVENT_SLID, () => this.cycle())
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
this.cycle()
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
to(index) {
|
|
167
|
-
const items = this._getItems()
|
|
168
|
-
if (index > items.length - 1 || index < 0) {
|
|
169
|
-
return
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (this._isSliding) {
|
|
173
|
-
EventHandler.one(this._element, EVENT_SLID, () => this.to(index))
|
|
174
|
-
return
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const activeIndex = this._getItemIndex(this._getActive())
|
|
178
|
-
if (activeIndex === index) {
|
|
179
|
-
return
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV
|
|
183
|
-
|
|
184
|
-
this._slide(order, items[index])
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
dispose() {
|
|
188
|
-
if (this._swipeHelper) {
|
|
189
|
-
this._swipeHelper.dispose()
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
super.dispose()
|
|
193
|
-
}
|
|
194
198
|
|
|
195
199
|
// Private
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return config
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
_addEventListeners() {
|
|
202
|
-
if (this._config.keyboard) {
|
|
203
|
-
EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event))
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (this._config.pause === 'hover') {
|
|
207
|
-
EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause())
|
|
208
|
-
EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle())
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (this._config.touch && Swipe.isSupported()) {
|
|
212
|
-
this._addTouchEventListeners()
|
|
213
|
-
}
|
|
200
|
+
_init() {
|
|
201
|
+
this._splide.mount()
|
|
214
202
|
}
|
|
215
203
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const endCallBack = () => {
|
|
222
|
-
if (this._config.pause !== 'hover') {
|
|
223
|
-
return
|
|
204
|
+
_getConfig() {
|
|
205
|
+
let conf = Object.assign({}, CONFIG_DEFAULT)
|
|
206
|
+
Object.keys(CONFIGS).forEach((classKey) => {
|
|
207
|
+
if (this._element.classList.contains(classKey)) {
|
|
208
|
+
conf = Object.assign({}, conf, CONFIGS[classKey])
|
|
224
209
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
// part of the mouse compatibility events on first tap - the carousel
|
|
228
|
-
// would stop cycling until user tapped out of it;
|
|
229
|
-
// here, we listen for touchend, explicitly pause the carousel
|
|
230
|
-
// (as if it's the second time we tap on it, mouseenter compat event
|
|
231
|
-
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
|
232
|
-
// events to fire) we explicitly restart cycling
|
|
233
|
-
|
|
234
|
-
this.pause()
|
|
235
|
-
if (this.touchTimeout) {
|
|
236
|
-
clearTimeout(this.touchTimeout)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const swipeConfig = {
|
|
243
|
-
leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
|
|
244
|
-
rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
|
|
245
|
-
endCallback: endCallBack,
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
this._swipeHelper = new Swipe(this._element, swipeConfig)
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
_keydown(event) {
|
|
252
|
-
if (/input|textarea/i.test(event.target.tagName)) {
|
|
253
|
-
return
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const direction = KEY_TO_DIRECTION[event.key]
|
|
257
|
-
if (direction) {
|
|
258
|
-
event.preventDefault()
|
|
259
|
-
this._slide(this._directionToOrder(direction))
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
_getItemIndex(element) {
|
|
264
|
-
return this._getItems().indexOf(element)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
_setActiveIndicatorElement(index) {
|
|
268
|
-
if (!this._indicatorsElement) {
|
|
269
|
-
return
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement)
|
|
273
|
-
|
|
274
|
-
activeIndicator.classList.remove(CLASS_NAME_ACTIVE)
|
|
275
|
-
activeIndicator.removeAttribute('aria-current')
|
|
276
|
-
|
|
277
|
-
const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement)
|
|
278
|
-
|
|
279
|
-
if (newActiveIndicator) {
|
|
280
|
-
newActiveIndicator.classList.add(CLASS_NAME_ACTIVE)
|
|
281
|
-
newActiveIndicator.setAttribute('aria-current', 'true')
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
_updateInterval() {
|
|
286
|
-
const element = this._activeElement || this._getActive()
|
|
287
|
-
|
|
288
|
-
if (!element) {
|
|
289
|
-
return
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10)
|
|
293
|
-
|
|
294
|
-
this._config.interval = elementInterval || this._config.defaultInterval
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
_slide(order, element = null) {
|
|
298
|
-
if (this._isSliding) {
|
|
299
|
-
return
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const activeElement = this._getActive()
|
|
303
|
-
const isNext = order === ORDER_NEXT
|
|
304
|
-
const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap)
|
|
305
|
-
|
|
306
|
-
if (nextElement === activeElement) {
|
|
307
|
-
return
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
const nextElementIndex = this._getItemIndex(nextElement)
|
|
311
|
-
|
|
312
|
-
const triggerEvent = (eventName) => {
|
|
313
|
-
return EventHandler.trigger(this._element, eventName, {
|
|
314
|
-
relatedTarget: nextElement,
|
|
315
|
-
direction: this._orderToDirection(order),
|
|
316
|
-
from: this._getItemIndex(activeElement),
|
|
317
|
-
to: nextElementIndex,
|
|
318
|
-
})
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const slideEvent = triggerEvent(EVENT_SLIDE)
|
|
322
|
-
|
|
323
|
-
if (slideEvent.defaultPrevented) {
|
|
324
|
-
return
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if (!activeElement || !nextElement) {
|
|
328
|
-
// Some weirdness is happening, so we bail
|
|
329
|
-
// todo: change tests that use empty divs to avoid this check
|
|
330
|
-
return
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const isCycling = Boolean(this._interval)
|
|
334
|
-
this.pause()
|
|
335
|
-
|
|
336
|
-
this._isSliding = true
|
|
337
|
-
|
|
338
|
-
this._setActiveIndicatorElement(nextElementIndex)
|
|
339
|
-
this._activeElement = nextElement
|
|
340
|
-
|
|
341
|
-
const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END
|
|
342
|
-
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV
|
|
343
|
-
|
|
344
|
-
nextElement.classList.add(orderClassName)
|
|
345
|
-
|
|
346
|
-
reflow(nextElement)
|
|
347
|
-
|
|
348
|
-
activeElement.classList.add(directionalClassName)
|
|
349
|
-
nextElement.classList.add(directionalClassName)
|
|
350
|
-
|
|
351
|
-
const completeCallBack = () => {
|
|
352
|
-
nextElement.classList.remove(directionalClassName, orderClassName)
|
|
353
|
-
nextElement.classList.add(CLASS_NAME_ACTIVE)
|
|
354
|
-
|
|
355
|
-
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName)
|
|
356
|
-
|
|
357
|
-
this._isSliding = false
|
|
358
|
-
|
|
359
|
-
triggerEvent(EVENT_SLID)
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
this._queueCallback(completeCallBack, activeElement, this._isAnimated())
|
|
363
|
-
|
|
364
|
-
if (isCycling) {
|
|
365
|
-
this.cycle()
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
_isAnimated() {
|
|
370
|
-
return this._element.classList.contains(CLASS_NAME_SLIDE)
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
_getActive() {
|
|
374
|
-
return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
_getItems() {
|
|
378
|
-
return SelectorEngine.find(SELECTOR_ITEM, this._element)
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
_clearInterval() {
|
|
382
|
-
if (this._interval) {
|
|
383
|
-
clearInterval(this._interval)
|
|
384
|
-
this._interval = null
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
_directionToOrder(direction) {
|
|
389
|
-
if (isRTL()) {
|
|
390
|
-
return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
_orderToDirection(order) {
|
|
397
|
-
if (isRTL()) {
|
|
398
|
-
return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT
|
|
210
|
+
})
|
|
211
|
+
return conf
|
|
402
212
|
}
|
|
403
213
|
}
|
|
404
214
|
|
|
405
215
|
/**
|
|
406
|
-
*
|
|
216
|
+
* ------------------------------------------------------------------------
|
|
217
|
+
* Data Api implementation
|
|
218
|
+
* ------------------------------------------------------------------------
|
|
407
219
|
*/
|
|
408
|
-
|
|
409
220
|
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
410
|
-
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {
|
|
411
|
-
const target = getElementFromSelector(this)
|
|
412
|
-
|
|
413
|
-
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
|
|
414
|
-
return
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
event.preventDefault()
|
|
418
|
-
|
|
419
|
-
const carousel = Carousel.getOrCreateInstance(target)
|
|
420
|
-
const slideIndex = this.getAttribute('data-bs-slide-to')
|
|
421
|
-
|
|
422
|
-
if (slideIndex) {
|
|
423
|
-
carousel.to(slideIndex)
|
|
424
|
-
carousel._maybeEnableCycle()
|
|
425
|
-
return
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
|
|
429
|
-
carousel.next()
|
|
430
|
-
carousel._maybeEnableCycle()
|
|
431
|
-
return
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
carousel.prev()
|
|
435
|
-
carousel._maybeEnableCycle()
|
|
436
|
-
})
|
|
437
|
-
|
|
438
221
|
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|
439
|
-
const carousels = SelectorEngine.find(
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
222
|
+
const carousels = SelectorEngine.find(SELECTOR_CAROUSEL)
|
|
223
|
+
carousels.forEach((carousel) => {
|
|
224
|
+
CarouselBI.getOrCreateInstance(carousel)
|
|
225
|
+
})
|
|
444
226
|
})
|
|
445
227
|
}
|
|
446
228
|
|
|
447
|
-
export default
|
|
229
|
+
export default CarouselBI
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import BaseComponent from './base-component.js'
|
|
10
10
|
|
|
11
11
|
import EventHandler from './dom/event-handler'
|
|
12
|
-
//import SelectorEngine from './dom/selector-engine'
|
|
13
12
|
import Manipulator from './dom/manipulator'
|
|
14
13
|
import { getElementFromSelector } from './util/index'
|
|
15
14
|
|
|
@@ -17,7 +17,7 @@ const CLASS_NAME_CLONED_HEADER = 'cloned-element'
|
|
|
17
17
|
const CLASS_NAME_SHOW = 'show'
|
|
18
18
|
const CLASS_NAME_ISTICKY = 'is-sticky'
|
|
19
19
|
|
|
20
|
-
const SELECTOR_HEADER = '.it-header-sticky'
|
|
20
|
+
const SELECTOR_HEADER = '.it-header-sticky [data-bs-toggle="sticky"]'
|
|
21
21
|
const SELECTOR_TOGGLER = '.custom-navbar-toggler'
|
|
22
22
|
const SELECTOR_MENU_WRAPPER = '.menu-wrapper'
|
|
23
23
|
const SELECTOR_BRAND_WRAPPER = '.it-brand-wrapper'
|
|
@@ -89,12 +89,6 @@ class HeaderSticky {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
/*if (toAdd) {
|
|
94
|
-
elSticky.nextElementSibling.style.paddingTop = navbarHeight + (isDesktop ? navOffsetTop - scrollToGap : navbarHeight - scrollToGap) + 'px'
|
|
95
|
-
} else {
|
|
96
|
-
elSticky.nextElementSibling.style.paddingTop = 0 + 'px'
|
|
97
|
-
}*/
|
|
98
92
|
}
|
|
99
93
|
|
|
100
94
|
/**
|
|
@@ -81,7 +81,11 @@ class InputLabel {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
_isEmpty() {
|
|
84
|
-
|
|
84
|
+
if (this._element.getAttribute('type') === 'number') {
|
|
85
|
+
return !this._element.value && !this._element.getAttribute('placeholder') && !this._element.validity.badInput
|
|
86
|
+
} else {
|
|
87
|
+
return !this._element.value && !this._element.getAttribute('placeholder')
|
|
88
|
+
}
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
_labelOut() {
|