@uibit/carousel 0.1.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/LICENSE +21 -0
- package/README.md +27 -0
- package/custom-elements.json +527 -0
- package/dist/carousel.d.ts +85 -0
- package/dist/carousel.d.ts.map +1 -0
- package/dist/carousel.js +430 -0
- package/dist/carousel.js.map +1 -0
- package/dist/frameworks/angular/index.ts +80 -0
- package/dist/frameworks/astro/index.d.ts +10 -0
- package/dist/frameworks/nuxt/index.ts +7 -0
- package/dist/frameworks/preact/index.d.ts +22 -0
- package/dist/frameworks/qwik/index.tsx +10 -0
- package/dist/frameworks/react/index.d.ts +27 -0
- package/dist/frameworks/solid/index.d.ts +23 -0
- package/dist/frameworks/stencil/index.d.ts +21 -0
- package/dist/frameworks/svelte/index.svelte +81 -0
- package/dist/frameworks/vue/index.ts +33 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +163 -0
- package/dist/styles.js.map +1 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +92 -0
package/dist/carousel.js
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html } from 'lit';
|
|
8
|
+
import { customElement, fromLucide, getIcon, msg, str, UIBitElement } from '@uibit/core';
|
|
9
|
+
import { ChevronLeft, ChevronRight } from 'lucide';
|
|
10
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
11
|
+
import { styles } from './styles';
|
|
12
|
+
/**
|
|
13
|
+
* Accessible, scroll-driven carousel with keyboard navigation, auto-play,
|
|
14
|
+
* and configurable items-per-view via CSS custom properties.
|
|
15
|
+
*
|
|
16
|
+
* @fires {{ index: number, totalSlides: number }} slide-change - Fired when the active slide changes
|
|
17
|
+
*
|
|
18
|
+
* @slot item - One or more slide elements (add `slot="item"` to each child)
|
|
19
|
+
*
|
|
20
|
+
* @cssprop [--uibit-carousel-gap=1rem] - Gap between slides
|
|
21
|
+
* @cssprop [--uibit-carousel-padding=0] - Padding inside the viewport around slides
|
|
22
|
+
* @cssprop [--uibit-carousel-duration=300ms] - Scroll animation duration
|
|
23
|
+
* @cssprop [--uibit-carousel-items-per-view=1] - Number of slides visible at once
|
|
24
|
+
* @cssprop [--uibit-carousel-border-color=#e5e7eb] - Border color of the viewport
|
|
25
|
+
* @cssprop [--uibit-carousel-button-bg=#f9fafb] - Background of prev/next buttons
|
|
26
|
+
* @cssprop [--uibit-carousel-button-bg-hover=#f3f4f6] - Hover background of prev/next buttons
|
|
27
|
+
* @cssprop [--uibit-carousel-button-color-hover=#ffffff] - Hover text/icon color of prev/next buttons
|
|
28
|
+
* @cssprop [--uibit-carousel-indicator-bg=#e5e7eb] - Background of inactive indicator dots
|
|
29
|
+
* @cssprop [--uibit-carousel-indicator-active-bg=#000000] - Background of the active indicator dot
|
|
30
|
+
* @cssprop [--uibit-carousel-focus-color=#000000] - Color of the focus outline on buttons
|
|
31
|
+
*
|
|
32
|
+
* @csspart carousel - The root carousel container
|
|
33
|
+
* @csspart viewport - The overflow-hidden viewport
|
|
34
|
+
* @csspart content - The scrollable slides row
|
|
35
|
+
* @csspart controls - The control bar below the viewport
|
|
36
|
+
* @csspart buttons - The prev/next button group
|
|
37
|
+
* @csspart button - Each navigation button
|
|
38
|
+
* @csspart button-prev - The previous slide button
|
|
39
|
+
* @csspart button-next - The next slide button
|
|
40
|
+
* @csspart indicators - The indicator dot group
|
|
41
|
+
* @csspart indicator - Each indicator dot
|
|
42
|
+
* @csspart indicator-active - Added to the active indicator dot
|
|
43
|
+
*/
|
|
44
|
+
let UIBitCarousel = class UIBitCarousel extends UIBitElement {
|
|
45
|
+
static { this.styles = styles; }
|
|
46
|
+
get itemsPerView() {
|
|
47
|
+
if (typeof window === 'undefined')
|
|
48
|
+
return 1;
|
|
49
|
+
const val = this.getCssPropertyValue('--uibit-carousel-items-per-view');
|
|
50
|
+
return val ? parseFloat(val) || 1 : 1;
|
|
51
|
+
}
|
|
52
|
+
get gap() {
|
|
53
|
+
if (typeof window === 'undefined')
|
|
54
|
+
return 16;
|
|
55
|
+
const val = this.getCssPropertyValue('--uibit-carousel-gap');
|
|
56
|
+
return val ? parseFloat(val) ?? 16 : 16;
|
|
57
|
+
}
|
|
58
|
+
get duration() {
|
|
59
|
+
if (typeof window === 'undefined')
|
|
60
|
+
return 300;
|
|
61
|
+
const val = this.getCssPropertyValue('--uibit-carousel-duration');
|
|
62
|
+
if (!val)
|
|
63
|
+
return 300;
|
|
64
|
+
if (val.endsWith('ms'))
|
|
65
|
+
return parseFloat(val) || 300;
|
|
66
|
+
if (val.endsWith('s'))
|
|
67
|
+
return (parseFloat(val) * 1000) || 300;
|
|
68
|
+
return parseFloat(val) || 300;
|
|
69
|
+
}
|
|
70
|
+
constructor(config) {
|
|
71
|
+
super();
|
|
72
|
+
/** Automatically advance slides on a timer. */
|
|
73
|
+
this.autoPlay = false;
|
|
74
|
+
/** Milliseconds between auto-play advances. */
|
|
75
|
+
this.autoPlayInterval = 5000;
|
|
76
|
+
/** When `true`, the carousel wraps from the last slide back to the first. */
|
|
77
|
+
this.loop = true;
|
|
78
|
+
this.currentIndex = 0;
|
|
79
|
+
this.totalSlides = 0;
|
|
80
|
+
this.canPrev = false;
|
|
81
|
+
this.canNext = true;
|
|
82
|
+
this.slideIntersectionRatios = new Map();
|
|
83
|
+
this.isProgrammaticScroll = false;
|
|
84
|
+
this.isPausedByInteraction = false;
|
|
85
|
+
this.handlePointerEnter = () => {
|
|
86
|
+
this.isPausedByInteraction = true;
|
|
87
|
+
this.stopAutoPlay();
|
|
88
|
+
};
|
|
89
|
+
this.handlePointerLeave = () => {
|
|
90
|
+
this.isPausedByInteraction = false;
|
|
91
|
+
if (this.autoPlay) {
|
|
92
|
+
this.setupAutoPlay();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
this.handleFocusIn = () => {
|
|
96
|
+
this.isPausedByInteraction = true;
|
|
97
|
+
this.stopAutoPlay();
|
|
98
|
+
};
|
|
99
|
+
this.handleFocusOut = () => {
|
|
100
|
+
this.isPausedByInteraction = false;
|
|
101
|
+
if (this.autoPlay) {
|
|
102
|
+
this.setupAutoPlay();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
if (config) {
|
|
106
|
+
this.autoPlay = config.autoPlay ?? this.autoPlay;
|
|
107
|
+
this.autoPlayInterval = config.autoPlayInterval ?? this.autoPlayInterval;
|
|
108
|
+
this.loop = config.loop ?? this.loop;
|
|
109
|
+
if (config.itemsPerView !== undefined) {
|
|
110
|
+
this.style.setProperty('--uibit-carousel-items-per-view', String(config.itemsPerView));
|
|
111
|
+
}
|
|
112
|
+
if (config.gap !== undefined) {
|
|
113
|
+
this.style.setProperty('--uibit-carousel-gap', typeof config.gap === 'number' ? `${config.gap}px` : config.gap);
|
|
114
|
+
}
|
|
115
|
+
if (config.duration !== undefined) {
|
|
116
|
+
this.style.setProperty('--uibit-carousel-duration', typeof config.duration === 'number' ? `${config.duration}ms` : config.duration);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
firstUpdated() {
|
|
121
|
+
this.setupCarousel();
|
|
122
|
+
this.setupAutoPlay();
|
|
123
|
+
this.setupKeyboardNavigation();
|
|
124
|
+
this.listen(this, 'pointerenter', this.handlePointerEnter);
|
|
125
|
+
this.listen(this, 'pointerleave', this.handlePointerLeave);
|
|
126
|
+
this.listen(this, 'focusin', this.handleFocusIn);
|
|
127
|
+
this.listen(this, 'focusout', this.handleFocusOut);
|
|
128
|
+
}
|
|
129
|
+
updated(changedProperties) {
|
|
130
|
+
if (changedProperties.has('autoPlay') ||
|
|
131
|
+
changedProperties.has('autoPlayInterval')) {
|
|
132
|
+
if (this.autoPlay) {
|
|
133
|
+
this.setupAutoPlay();
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
this.stopAutoPlay();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
disconnectedCallback() {
|
|
141
|
+
super.disconnectedCallback();
|
|
142
|
+
this.stopAutoPlay();
|
|
143
|
+
if (this.programmaticScrollTimeout) {
|
|
144
|
+
clearTimeout(this.programmaticScrollTimeout);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
setupCarousel() {
|
|
148
|
+
if (!this.content)
|
|
149
|
+
return;
|
|
150
|
+
const items = this.getSlides();
|
|
151
|
+
this.totalSlides = items.length;
|
|
152
|
+
// Decorate slotted elements with accessibility attributes
|
|
153
|
+
items.forEach((item, index) => {
|
|
154
|
+
if (!item.id) {
|
|
155
|
+
item.id = `uibit-carousel-slide-${index}`;
|
|
156
|
+
}
|
|
157
|
+
item.setAttribute('role', 'group');
|
|
158
|
+
item.setAttribute('aria-roledescription', 'slide');
|
|
159
|
+
item.setAttribute('aria-label', msg(str `Slide ${index + 1} of ${this.totalSlides}`));
|
|
160
|
+
});
|
|
161
|
+
this.updateNavigationState();
|
|
162
|
+
this.setupResizeObserver();
|
|
163
|
+
this.setupSlideObserver();
|
|
164
|
+
}
|
|
165
|
+
setupSlideObserver() {
|
|
166
|
+
if (!this.content)
|
|
167
|
+
return;
|
|
168
|
+
this.slideObserver?.disconnect();
|
|
169
|
+
this.slideIntersectionRatios.clear();
|
|
170
|
+
const slides = this.getSlides();
|
|
171
|
+
if (!slides.length)
|
|
172
|
+
return;
|
|
173
|
+
this.slideObserver = new IntersectionObserver((entries) => {
|
|
174
|
+
entries.forEach(e => this.slideIntersectionRatios.set(e.target, e.intersectionRatio));
|
|
175
|
+
if (this.isProgrammaticScroll)
|
|
176
|
+
return;
|
|
177
|
+
let maxRatio = -1;
|
|
178
|
+
let closestIndex = this.currentIndex;
|
|
179
|
+
slides.forEach((slide, index) => {
|
|
180
|
+
const ratio = this.slideIntersectionRatios.get(slide) ?? 0;
|
|
181
|
+
if (ratio > maxRatio) {
|
|
182
|
+
maxRatio = ratio;
|
|
183
|
+
closestIndex = index;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
if (closestIndex !== this.currentIndex) {
|
|
187
|
+
this.currentIndex = closestIndex;
|
|
188
|
+
this.updateNavigationState();
|
|
189
|
+
this.emitSlideChange();
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this.updateNavigationState();
|
|
193
|
+
}
|
|
194
|
+
}, {
|
|
195
|
+
root: this.content,
|
|
196
|
+
threshold: [0, 0.25, 0.5, 0.75, 1.0],
|
|
197
|
+
});
|
|
198
|
+
slides.forEach(s => this.slideObserver.observe(s));
|
|
199
|
+
this.registerDisposable(() => this.slideObserver?.disconnect());
|
|
200
|
+
}
|
|
201
|
+
setupResizeObserver() {
|
|
202
|
+
if (!this.content || this.resizeObserver)
|
|
203
|
+
return;
|
|
204
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
205
|
+
this.updateNavigationState();
|
|
206
|
+
});
|
|
207
|
+
this.resizeObserver.observe(this.content);
|
|
208
|
+
this.registerDisposable(() => this.resizeObserver?.disconnect());
|
|
209
|
+
}
|
|
210
|
+
setupKeyboardNavigation() {
|
|
211
|
+
this.listen(this, 'keydown', (e) => {
|
|
212
|
+
if (e.key === 'ArrowLeft') {
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
this.prev();
|
|
215
|
+
}
|
|
216
|
+
else if (e.key === 'ArrowRight') {
|
|
217
|
+
e.preventDefault();
|
|
218
|
+
this.next();
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
setupAutoPlay() {
|
|
223
|
+
this.stopAutoPlay();
|
|
224
|
+
if (!this.autoPlay || this.isPausedByInteraction)
|
|
225
|
+
return;
|
|
226
|
+
this.autoPlayTimer = window.setInterval(() => {
|
|
227
|
+
if (this.currentIndex < this.totalSlides - 1) {
|
|
228
|
+
this.next();
|
|
229
|
+
}
|
|
230
|
+
else if (this.loop) {
|
|
231
|
+
this.scrollToSlide(0);
|
|
232
|
+
}
|
|
233
|
+
}, this.autoPlayInterval);
|
|
234
|
+
}
|
|
235
|
+
stopAutoPlay() {
|
|
236
|
+
if (this.autoPlayTimer) {
|
|
237
|
+
clearInterval(this.autoPlayTimer);
|
|
238
|
+
this.autoPlayTimer = undefined;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
getSlides() {
|
|
242
|
+
const slots = this.shadowRoot?.querySelectorAll('slot') ?? [];
|
|
243
|
+
const slides = [];
|
|
244
|
+
slots.forEach(slot => {
|
|
245
|
+
const name = slot.getAttribute('name');
|
|
246
|
+
if (name === 'item' || !name) {
|
|
247
|
+
const assigned = slot.assignedElements();
|
|
248
|
+
slides.push(...assigned.filter(el => {
|
|
249
|
+
const s = el.getAttribute('slot');
|
|
250
|
+
return s === 'item' || !s;
|
|
251
|
+
}));
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
return slides;
|
|
255
|
+
}
|
|
256
|
+
updateNavigationState() {
|
|
257
|
+
this.canPrev = this.currentIndex > 0 || this.loop;
|
|
258
|
+
this.canNext = this.currentIndex < this.totalSlides - 1 || this.loop;
|
|
259
|
+
}
|
|
260
|
+
prev() {
|
|
261
|
+
if (this.currentIndex > 0) {
|
|
262
|
+
this.scrollToSlide(this.currentIndex - 1);
|
|
263
|
+
}
|
|
264
|
+
else if (this.loop) {
|
|
265
|
+
this.scrollToSlide(this.totalSlides - 1);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
next() {
|
|
269
|
+
if (this.currentIndex < this.totalSlides - 1) {
|
|
270
|
+
this.scrollToSlide(this.currentIndex + 1);
|
|
271
|
+
}
|
|
272
|
+
else if (this.loop) {
|
|
273
|
+
this.scrollToSlide(0);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
goToSlide(index) {
|
|
277
|
+
if (index >= 0 && index < this.totalSlides) {
|
|
278
|
+
this.scrollToSlide(index);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
scrollToSlide(index) {
|
|
282
|
+
if (!this.content)
|
|
283
|
+
return;
|
|
284
|
+
const items = this.getSlides();
|
|
285
|
+
const item = items[index];
|
|
286
|
+
if (item) {
|
|
287
|
+
this.isProgrammaticScroll = true;
|
|
288
|
+
if (this.programmaticScrollTimeout) {
|
|
289
|
+
clearTimeout(this.programmaticScrollTimeout);
|
|
290
|
+
}
|
|
291
|
+
const containerRect = this.content.getBoundingClientRect();
|
|
292
|
+
const itemRect = item.getBoundingClientRect();
|
|
293
|
+
const style = window.getComputedStyle(this.content);
|
|
294
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
295
|
+
const targetScrollLeft = this.content.scrollLeft + (itemRect.left - containerRect.left) - paddingLeft;
|
|
296
|
+
this.content.scrollTo({
|
|
297
|
+
left: targetScrollLeft,
|
|
298
|
+
behavior: 'smooth'
|
|
299
|
+
});
|
|
300
|
+
this.currentIndex = index;
|
|
301
|
+
this.updateNavigationState();
|
|
302
|
+
this.emitSlideChange();
|
|
303
|
+
const onScrollEnd = () => {
|
|
304
|
+
this.isProgrammaticScroll = false;
|
|
305
|
+
this.content?.removeEventListener('scrollend', onScrollEnd);
|
|
306
|
+
};
|
|
307
|
+
if ('onscrollend' in window) {
|
|
308
|
+
this.content.addEventListener('scrollend', onScrollEnd);
|
|
309
|
+
}
|
|
310
|
+
this.programmaticScrollTimeout = window.setTimeout(() => {
|
|
311
|
+
this.isProgrammaticScroll = false;
|
|
312
|
+
if (this.content && 'onscrollend' in window) {
|
|
313
|
+
this.content.removeEventListener('scrollend', onScrollEnd);
|
|
314
|
+
}
|
|
315
|
+
}, this.duration + 100);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
emitSlideChange() {
|
|
319
|
+
this.dispatchCustomEvent('slide-change', {
|
|
320
|
+
index: this.currentIndex,
|
|
321
|
+
totalSlides: this.totalSlides
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
handleSlotChange() {
|
|
325
|
+
this.setupCarousel();
|
|
326
|
+
}
|
|
327
|
+
render() {
|
|
328
|
+
const isAutoplayPlaying = this.autoPlay && !this.isPausedByInteraction;
|
|
329
|
+
return html `
|
|
330
|
+
<div
|
|
331
|
+
part="carousel"
|
|
332
|
+
class="carousel"
|
|
333
|
+
role="region"
|
|
334
|
+
aria-roledescription="carousel"
|
|
335
|
+
aria-label=${msg('Content Carousel')}
|
|
336
|
+
>
|
|
337
|
+
<div
|
|
338
|
+
part="viewport"
|
|
339
|
+
class="carousel-viewport"
|
|
340
|
+
aria-live="${isAutoplayPlaying ? 'off' : 'polite'}"
|
|
341
|
+
>
|
|
342
|
+
<div
|
|
343
|
+
part="content"
|
|
344
|
+
class="carousel-content"
|
|
345
|
+
>
|
|
346
|
+
<slot name="item" @slotchange=${this.handleSlotChange}></slot>
|
|
347
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
|
|
351
|
+
<div part="controls" class="carousel-controls">
|
|
352
|
+
<div part="buttons" class="carousel-buttons">
|
|
353
|
+
<slot name="prev" @click=${() => this.prev()}>
|
|
354
|
+
<button
|
|
355
|
+
part="button button-prev"
|
|
356
|
+
class="carousel-button"
|
|
357
|
+
aria-label=${msg('Previous slide')}
|
|
358
|
+
?disabled=${!this.canPrev}
|
|
359
|
+
>
|
|
360
|
+
${getIcon('chevron-left', 16, fromLucide(ChevronLeft))}
|
|
361
|
+
</button>
|
|
362
|
+
</slot>
|
|
363
|
+
<slot name="next" @click=${() => this.next()}>
|
|
364
|
+
<button
|
|
365
|
+
part="button button-next"
|
|
366
|
+
class="carousel-button"
|
|
367
|
+
aria-label=${msg('Next slide')}
|
|
368
|
+
?disabled=${!this.canNext}
|
|
369
|
+
>
|
|
370
|
+
${getIcon('chevron-right', 16, fromLucide(ChevronRight))}
|
|
371
|
+
</button>
|
|
372
|
+
</slot>
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
<slot name="indicators">
|
|
376
|
+
<div part="indicators" class="carousel-indicators" role="tablist" aria-label=${msg('Slides')}>
|
|
377
|
+
${Array.from({ length: this.totalSlides }).map((_, index) => html `
|
|
378
|
+
<button
|
|
379
|
+
role="tab"
|
|
380
|
+
part="indicator ${index === this.currentIndex ? 'indicator-active' : ''}"
|
|
381
|
+
class="carousel-indicator ${index === this.currentIndex ? 'active' : ''}"
|
|
382
|
+
aria-label=${msg(str `Go to slide ${index + 1}`)}
|
|
383
|
+
aria-selected=${index === this.currentIndex}
|
|
384
|
+
aria-controls="uibit-carousel-slide-${index}"
|
|
385
|
+
@click=${() => this.goToSlide(index)}
|
|
386
|
+
></button>
|
|
387
|
+
`)}
|
|
388
|
+
</div>
|
|
389
|
+
</slot>
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
`;
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
__decorate([
|
|
396
|
+
property({ type: Boolean, attribute: 'auto-play' })
|
|
397
|
+
], UIBitCarousel.prototype, "autoPlay", void 0);
|
|
398
|
+
__decorate([
|
|
399
|
+
property({ type: Number, attribute: 'auto-play-interval' })
|
|
400
|
+
], UIBitCarousel.prototype, "autoPlayInterval", void 0);
|
|
401
|
+
__decorate([
|
|
402
|
+
property({ type: Boolean })
|
|
403
|
+
], UIBitCarousel.prototype, "loop", void 0);
|
|
404
|
+
__decorate([
|
|
405
|
+
query('.carousel-content')
|
|
406
|
+
], UIBitCarousel.prototype, "content", void 0);
|
|
407
|
+
__decorate([
|
|
408
|
+
query('.carousel-viewport')
|
|
409
|
+
], UIBitCarousel.prototype, "viewport", void 0);
|
|
410
|
+
__decorate([
|
|
411
|
+
query('slot[name="item"]')
|
|
412
|
+
], UIBitCarousel.prototype, "slotElement", void 0);
|
|
413
|
+
__decorate([
|
|
414
|
+
state()
|
|
415
|
+
], UIBitCarousel.prototype, "currentIndex", void 0);
|
|
416
|
+
__decorate([
|
|
417
|
+
state()
|
|
418
|
+
], UIBitCarousel.prototype, "totalSlides", void 0);
|
|
419
|
+
__decorate([
|
|
420
|
+
state()
|
|
421
|
+
], UIBitCarousel.prototype, "canPrev", void 0);
|
|
422
|
+
__decorate([
|
|
423
|
+
state()
|
|
424
|
+
], UIBitCarousel.prototype, "canNext", void 0);
|
|
425
|
+
UIBitCarousel = __decorate([
|
|
426
|
+
customElement('uibit-carousel')
|
|
427
|
+
], UIBitCarousel);
|
|
428
|
+
export { UIBitCarousel };
|
|
429
|
+
export default UIBitCarousel;
|
|
430
|
+
//# sourceMappingURL=carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../src/carousel.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEI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ribute, numberAttribute } from '@angular/core';
|
|
2
|
+
import '@uibit/carousel';
|
|
3
|
+
import type { UIBitCarousel as HTMLElementClass } from '@uibit/carousel';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'uibit-carousel',
|
|
7
|
+
template: '<ng-content></ng-content>',
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
standalone: true,
|
|
10
|
+
host: {
|
|
11
|
+
'(slide-change)': 'slideChange.emit($event)'
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
export class NgxUIBitCarousel {
|
|
15
|
+
constructor(private el: ElementRef<HTMLElementClass>) {
|
|
16
|
+
effect(() => {
|
|
17
|
+
if (this.el.nativeElement) {
|
|
18
|
+
this.el.nativeElement.autoPlay = this.autoPlay();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
effect(() => {
|
|
22
|
+
if (this.el.nativeElement) {
|
|
23
|
+
this.el.nativeElement.autoPlayInterval = this.autoPlayInterval();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
effect(() => {
|
|
27
|
+
if (this.el.nativeElement) {
|
|
28
|
+
this.el.nativeElement.loop = this.loop();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
effect(() => {
|
|
32
|
+
if (this.el.nativeElement) {
|
|
33
|
+
this.el.nativeElement.content = this.content();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
effect(() => {
|
|
37
|
+
if (this.el.nativeElement) {
|
|
38
|
+
this.el.nativeElement.viewport = this.viewport();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
effect(() => {
|
|
42
|
+
if (this.el.nativeElement) {
|
|
43
|
+
this.el.nativeElement.slotElement = this.slotElement();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
effect(() => {
|
|
47
|
+
if (this.el.nativeElement) {
|
|
48
|
+
this.el.nativeElement.currentIndex = this.currentIndex();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
effect(() => {
|
|
52
|
+
if (this.el.nativeElement) {
|
|
53
|
+
this.el.nativeElement.totalSlides = this.totalSlides();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
effect(() => {
|
|
57
|
+
if (this.el.nativeElement) {
|
|
58
|
+
this.el.nativeElement.canPrev = this.canPrev();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
effect(() => {
|
|
62
|
+
if (this.el.nativeElement) {
|
|
63
|
+
this.el.nativeElement.canNext = this.canNext();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
readonly autoPlay = input<boolean, any>(false, { transform: booleanAttribute });
|
|
69
|
+
readonly autoPlayInterval = input<number, any>(5000, { transform: numberAttribute });
|
|
70
|
+
readonly loop = input<boolean, any>(true, { transform: booleanAttribute });
|
|
71
|
+
readonly content = input<HTMLElement | undefined, any>(undefined);
|
|
72
|
+
readonly viewport = input<HTMLElement | undefined, any>(undefined);
|
|
73
|
+
readonly slotElement = input<HTMLSlotElement | undefined, any>(undefined);
|
|
74
|
+
readonly currentIndex = input<number, any>(0, { transform: numberAttribute });
|
|
75
|
+
readonly totalSlides = input<number, any>(0, { transform: numberAttribute });
|
|
76
|
+
readonly canPrev = input<boolean, any>(false, { transform: booleanAttribute });
|
|
77
|
+
readonly canNext = input<boolean, any>(true, { transform: booleanAttribute });
|
|
78
|
+
|
|
79
|
+
readonly slideChange = output<CustomEvent<{ index: number, totalSlides: number }>>();
|
|
80
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UIBitCarousel as HTMLElementClass } from '@uibit/carousel';
|
|
2
|
+
import '@uibit/carousel';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
namespace astroHTML.JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'uibit-carousel': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { UIBitCarousel as HTMLElementClass } from '@uibit/carousel';
|
|
3
|
+
import '@uibit/carousel';
|
|
4
|
+
|
|
5
|
+
declare module 'preact' {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
'uibit-carousel': JSX.HTMLAttributes<HTMLElementClass> & {
|
|
9
|
+
autoPlay?: boolean;
|
|
10
|
+
autoPlayInterval?: number;
|
|
11
|
+
loop?: boolean;
|
|
12
|
+
content?: HTMLElement | undefined;
|
|
13
|
+
viewport?: HTMLElement | undefined;
|
|
14
|
+
slotElement?: HTMLSlotElement | undefined;
|
|
15
|
+
currentIndex?: number;
|
|
16
|
+
totalSlides?: number;
|
|
17
|
+
canPrev?: boolean;
|
|
18
|
+
canNext?: boolean;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HTMLAttributes, ClassAttributes } from 'react';
|
|
2
|
+
import type { UIBitCarousel as HTMLElementClass } from '@uibit/carousel';
|
|
3
|
+
import '@uibit/carousel';
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
namespace React {
|
|
7
|
+
namespace JSX {
|
|
8
|
+
interface IntrinsicElements {
|
|
9
|
+
'uibit-carousel': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
class?: string;
|
|
12
|
+
autoPlay?: boolean;
|
|
13
|
+
autoPlayInterval?: number;
|
|
14
|
+
loop?: boolean;
|
|
15
|
+
content?: HTMLElement | undefined;
|
|
16
|
+
viewport?: HTMLElement | undefined;
|
|
17
|
+
slotElement?: HTMLSlotElement | undefined;
|
|
18
|
+
currentIndex?: number;
|
|
19
|
+
totalSlides?: number;
|
|
20
|
+
canPrev?: boolean;
|
|
21
|
+
canNext?: boolean;
|
|
22
|
+
onSlideChange?: (event: any) => void;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { JSX } from 'solid-js';
|
|
2
|
+
import type { UIBitCarousel as HTMLElementClass } from '@uibit/carousel';
|
|
3
|
+
import '@uibit/carousel';
|
|
4
|
+
|
|
5
|
+
declare module 'solid-js' {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
'uibit-carousel': Partial<HTMLElementClass> & JSX.HTMLAttributes<HTMLElementClass> & {
|
|
9
|
+
autoPlay?: boolean;
|
|
10
|
+
autoPlayInterval?: number;
|
|
11
|
+
loop?: boolean;
|
|
12
|
+
content?: HTMLElement | undefined;
|
|
13
|
+
viewport?: HTMLElement | undefined;
|
|
14
|
+
slotElement?: HTMLSlotElement | undefined;
|
|
15
|
+
currentIndex?: number;
|
|
16
|
+
totalSlides?: number;
|
|
17
|
+
canPrev?: boolean;
|
|
18
|
+
canNext?: boolean;
|
|
19
|
+
"on:slide-change"?: (event: CustomEvent) => void;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { UIBitCarousel as HTMLElementClass } from '@uibit/carousel';
|
|
2
|
+
import '@uibit/carousel';
|
|
3
|
+
|
|
4
|
+
declare module '@stencil/core' {
|
|
5
|
+
export namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'uibit-carousel': HTMLElementClass & {
|
|
8
|
+
autoPlay?: boolean;
|
|
9
|
+
autoPlayInterval?: number;
|
|
10
|
+
loop?: boolean;
|
|
11
|
+
content?: HTMLElement | undefined;
|
|
12
|
+
viewport?: HTMLElement | undefined;
|
|
13
|
+
slotElement?: HTMLSlotElement | undefined;
|
|
14
|
+
currentIndex?: number;
|
|
15
|
+
totalSlides?: number;
|
|
16
|
+
canPrev?: boolean;
|
|
17
|
+
canNext?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|